Merge remote branch 'main/master' into radeon-rewrite
authorDave Airlie <airlied@redhat.com>
Fri, 20 Mar 2009 00:52:17 +0000 (10:52 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 20 Mar 2009 00:52:17 +0000 (10:52 +1000)
Conflicts:
src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/r300/r300_swtcl.c
src/mesa/drivers/dri/r300/radeon_ioctl.c
src/mesa/drivers/dri/radeon/radeon_screen.c

1126 files changed:
Makefile
SConstruct
bin/config.guess
bin/config.sub
configs/autoconf.in
configs/darwin
configs/default
configs/linux
configs/linux-cell
configs/linux-llvm
configure.ac
docs/MESA_shader_debug.spec
docs/relnotes-7.5.html
include/EGL/eglplatform.h
include/GL/gl.h
include/GL/gl_mangle.h
include/GL/glext.h
include/GL/glut.h
include/GL/internal/dri_interface.h
include/GL/wglext.h [new file with mode: 0644]
progs/SConscript
progs/demos/arbfplight.c
progs/demos/arbfslight.c
progs/demos/cubemap.c
progs/demos/engine.c
progs/demos/fslight.c
progs/demos/gearbox.c
progs/demos/gears.c
progs/demos/geartrain.c
progs/demos/gloss.c
progs/demos/glslnoise.c
progs/demos/isosurf.c
progs/demos/reflect.c
progs/demos/streaming_rect.c
progs/demos/texcyl.c
progs/fp/Makefile
progs/fp/SConscript [new file with mode: 0644]
progs/fp/fp-tri.c
progs/fp/kill-pos.txt [new file with mode: 0644]
progs/fp/position.txt
progs/fp/tex-pos-kil-1.txt [new file with mode: 0644]
progs/fp/tex-pos-kil.txt [new file with mode: 0644]
progs/fp/tex-pos.txt [new file with mode: 0644]
progs/fp/tex.txt [new file with mode: 0644]
progs/glsl/.gitignore
progs/glsl/Makefile
progs/glsl/shadow_sampler.c [new file with mode: 0644]
progs/tests/.gitignore
progs/tests/Makefile
progs/tests/SConscript [new file with mode: 0644]
progs/tests/afsmultiarb.c
progs/tests/antialias.c
progs/tests/api_speed.c
progs/tests/arbfpspec.c
progs/tests/arbfptest1.c
progs/tests/arbfptexture.c
progs/tests/arbfptrig.c
progs/tests/arbnpot-mipmap.c
progs/tests/arbnpot.c
progs/tests/arbvptest1.c
progs/tests/arbvptest3.c
progs/tests/arbvptorus.c
progs/tests/arbvpwarpmesh.c
progs/tests/arraytexture.c
progs/tests/blendminmax.c
progs/tests/blendsquare.c
progs/tests/blendxor.c
progs/tests/bufferobj.c
progs/tests/bug_3050.c
progs/tests/bug_3101.c
progs/tests/bug_3195.c
progs/tests/bug_texstore_i8.c
progs/tests/bumpmap.c [new file with mode: 0644]
progs/tests/calibrate_rast.c
progs/tests/copypixrate.c
progs/tests/crossbar.c
progs/tests/cva.c
progs/tests/debugger.c
progs/tests/dinoshade.c
progs/tests/drawbuffers.c
progs/tests/exactrast.c
progs/tests/ext422square.c
progs/tests/fbotest1.c
progs/tests/fbotest2.c
progs/tests/fbotexture.c
progs/tests/fillrate.c
progs/tests/floattex.c
progs/tests/fog.c
progs/tests/fogcoord.c
progs/tests/fptest1.c
progs/tests/fptexture.c
progs/tests/interleave.c
progs/tests/invert.c
progs/tests/lineclip.c
progs/tests/manytex.c
progs/tests/mapbufrange.c [new file with mode: 0644]
progs/tests/mapvbo.c [new file with mode: 0644]
progs/tests/minmag.c
progs/tests/mipgen.c [new file with mode: 0644]
progs/tests/mipmap_limits.c
progs/tests/mipmap_view.c
progs/tests/multipal.c
progs/tests/multitexarray.c
progs/tests/multiwindow.c
progs/tests/no_s3tc.c
progs/tests/packedpixels.c
progs/tests/pbo.c
progs/tests/prog_parameter.c
progs/tests/projtex.c
progs/tests/quads.c
progs/tests/random.c
progs/tests/readrate.c
progs/tests/rubberband.c
progs/tests/seccolor.c
progs/tests/shader_api.c
progs/tests/stencil_twoside.c
progs/tests/stencil_wrap.c
progs/tests/stencilwrap.c
progs/tests/subtex.c
progs/tests/subtexrate.c
progs/tests/tex1d.c
progs/tests/texcmp.c
progs/tests/texcompress2.c
progs/tests/texfilt.c
progs/tests/texgenmix.c
progs/tests/texline.c
progs/tests/texrect.c
progs/tests/texwrap.c
progs/tests/unfilledclip.c
progs/tests/vao-01.c
progs/tests/vao-02.c
progs/tests/vparray.c
progs/tests/vpeval.c
progs/tests/vptest1.c
progs/tests/vptest2.c
progs/tests/vptest3.c
progs/tests/vptorus.c
progs/tests/vpwarpmesh.c
progs/tests/yuvrect.c
progs/tests/yuvsquare.c
progs/tests/zcomp.c
progs/tests/zdrawpix.c
progs/tests/zreaddraw.c
progs/trivial/.gitignore
progs/trivial/Makefile
progs/trivial/SConscript
progs/trivial/clear-random.c
progs/trivial/clear-repeat.c
progs/trivial/clear.c
progs/trivial/createwin.c
progs/trivial/dlist-dangling.c
progs/trivial/dlist-edgeflag-dangling.c
progs/trivial/dlist-edgeflag.c
progs/trivial/draw2arrays.c [new file with mode: 0644]
progs/trivial/line-clip.c
progs/trivial/line-cull.c
progs/trivial/line-stipple-wide.c
progs/trivial/line-userclip-clip.c
progs/trivial/line-userclip-nop-clip.c
progs/trivial/line-userclip-nop.c
progs/trivial/line-userclip.c
progs/trivial/line-wide.c
progs/trivial/line.c
progs/trivial/lineloop-clip.c
progs/trivial/lineloop.c
progs/trivial/linestrip-clip.c
progs/trivial/linestrip-flat-stipple.c
progs/trivial/linestrip-stipple-wide.c
progs/trivial/linestrip-stipple.c
progs/trivial/linestrip.c
progs/trivial/long-fixed-func.c
progs/trivial/point-clip.c
progs/trivial/point-sprite.c
progs/trivial/point-wide-smooth.c
progs/trivial/point-wide.c
progs/trivial/point.c
progs/trivial/poly-flat-clip.c
progs/trivial/poly-flat-unfilled-clip.c
progs/trivial/poly-flat.c
progs/trivial/poly-unfilled.c
progs/trivial/poly.c
progs/trivial/quad-clip-all-vertices.c
progs/trivial/quad-clip-nearplane.c
progs/trivial/quad-clip.c
progs/trivial/quad-degenerate.c
progs/trivial/quad-flat.c
progs/trivial/quad-offset-factor.c
progs/trivial/quad-offset-unfilled.c
progs/trivial/quad-offset-units.c
progs/trivial/quad-tex-2d.c
progs/trivial/quad-tex-3d.c
progs/trivial/quad-tex-alpha.c
progs/trivial/quad-tex-pbo.c
progs/trivial/quad-tex-sub.c [new file with mode: 0644]
progs/trivial/quad-unfilled-clip.c
progs/trivial/quad-unfilled-stipple.c
progs/trivial/quad-unfilled.c
progs/trivial/quad.c
progs/trivial/quads.c
progs/trivial/quadstrip-clip.c [new file with mode: 0644]
progs/trivial/quadstrip-cont.c
progs/trivial/quadstrip-flat.c
progs/trivial/quadstrip.c
progs/trivial/tri-alpha-tex.c
progs/trivial/tri-alpha.c
progs/trivial/tri-blend-color.c
progs/trivial/tri-clear.c
progs/trivial/tri-clip.c
progs/trivial/tri-cull-both.c
progs/trivial/tri-cull.c
progs/trivial/tri-dlist.c
progs/trivial/tri-edgeflag.c
progs/trivial/tri-fbo-tex-mip.c [new file with mode: 0644]
progs/trivial/tri-fbo-tex.c
progs/trivial/tri-flat-clip.c
progs/trivial/tri-flat.c
progs/trivial/tri-fog.c
progs/trivial/tri-fp-const-imm.c
progs/trivial/tri-fp.c
progs/trivial/tri-lit.c
progs/trivial/tri-logicop-none.c [new file with mode: 0644]
progs/trivial/tri-logicop-xor.c [new file with mode: 0644]
progs/trivial/tri-mask-tri.c
progs/trivial/tri-orig.c
progs/trivial/tri-query.c
progs/trivial/tri-repeat.c
progs/trivial/tri-scissor-tri.c
progs/trivial/tri-square.c
progs/trivial/tri-stencil.c
progs/trivial/tri-stipple.c
progs/trivial/tri-tex-3d.c
progs/trivial/tri-tex.c
progs/trivial/tri-tri.c
progs/trivial/tri-unfilled-clip.c
progs/trivial/tri-unfilled-edgeflag.c
progs/trivial/tri-unfilled-fog.c [new file with mode: 0644]
progs/trivial/tri-unfilled-point.c
progs/trivial/tri-unfilled-smooth.c
progs/trivial/tri-unfilled-tri-lit.c
progs/trivial/tri-unfilled-tri.c
progs/trivial/tri-unfilled-userclip-stip.c
progs/trivial/tri-unfilled-userclip.c
progs/trivial/tri-unfilled.c
progs/trivial/tri-userclip.c
progs/trivial/tri-viewport.c [new file with mode: 0644]
progs/trivial/tri-z-9.c
progs/trivial/tri-z-eq.c
progs/trivial/tri.c
progs/trivial/trifan-flat-clip.c
progs/trivial/trifan-flat-unfilled-clip.c
progs/trivial/trifan-flat.c
progs/trivial/trifan-unfilled.c
progs/trivial/trifan.c
progs/trivial/tristrip-clip.c
progs/trivial/tristrip-flat.c
progs/trivial/tristrip.c
progs/trivial/vp-tri-cb-pos.c
progs/trivial/vp-tri-cb-tex.c
progs/util/readtex.c
progs/vp/addimm.txt [new file with mode: 0644]
progs/vp/arl-static.txt [new file with mode: 0644]
progs/vp/arl-unused.txt [new file with mode: 0644]
progs/vp/exp-no-w.txt [new file with mode: 0644]
progs/vp/msk.txt [new file with mode: 0644]
progs/vp/psiz-mul.txt [new file with mode: 0644]
progs/vp/vp-tris.c
progs/vpglsl/Makefile
progs/vpglsl/mov.glsl [new file with mode: 0644]
progs/vpglsl/vp-tris.c
progs/wgl/SConscript [new file with mode: 0644]
progs/wgl/sharedtex_mt/sharedtex_mt.c [new file with mode: 0644]
progs/wgl/wglthreads/wglthreads.c [new file with mode: 0644]
progs/xdemos/.gitignore
progs/xdemos/Makefile
progs/xdemos/glsync.c
progs/xdemos/glxpixmap.c
progs/xdemos/manywin.c
progs/xdemos/sharedtex_mt.c [new file with mode: 0644]
scons/gallium.py
scons/generic.py
src/egl/drivers/glx/egl_glx.c
src/egl/main/Makefile
src/egl/main/eglconfig.c
src/gallium/Makefile
src/gallium/Makefile.template
src/gallium/auxiliary/Makefile
src/gallium/auxiliary/cso_cache/Makefile
src/gallium/auxiliary/cso_cache/cso_cache.c
src/gallium/auxiliary/cso_cache/cso_context.c
src/gallium/auxiliary/cso_cache/cso_hash.c
src/gallium/auxiliary/draw/Makefile
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_pipe_aaline.c
src/gallium/auxiliary/draw/draw_pipe_aapoint.c
src/gallium/auxiliary/draw/draw_pipe_pstipple.c
src/gallium/auxiliary/draw/draw_pipe_vbuf.c
src/gallium/auxiliary/draw/draw_pt.c
src/gallium/auxiliary/draw/draw_pt.h
src/gallium/auxiliary/draw/draw_pt_emit.c
src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
src/gallium/auxiliary/draw/draw_pt_post_vs.c
src/gallium/auxiliary/draw/draw_vbuf.h
src/gallium/auxiliary/draw/draw_vs_aos.c
src/gallium/auxiliary/draw/draw_vs_aos.h
src/gallium/auxiliary/draw/draw_vs_aos_io.c
src/gallium/auxiliary/gallivm/storagesoa.cpp
src/gallium/auxiliary/indices/Makefile
src/gallium/auxiliary/indices/SConscript
src/gallium/auxiliary/indices/u_indices.h
src/gallium/auxiliary/indices/u_indices_gen.c
src/gallium/auxiliary/indices/u_indices_gen.py
src/gallium/auxiliary/indices/u_unfilled_gen.c [new file with mode: 0644]
src/gallium/auxiliary/indices/u_unfilled_gen.py [new file with mode: 0644]
src/gallium/auxiliary/indices/u_unfilled_indices.c [new file with mode: 0644]
src/gallium/auxiliary/pipebuffer/Makefile
src/gallium/auxiliary/pipebuffer/pb_buffer.h
src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
src/gallium/auxiliary/pipebuffer/pb_validate.c
src/gallium/auxiliary/rtasm/Makefile
src/gallium/auxiliary/rtasm/rtasm_cpu.c
src/gallium/auxiliary/rtasm/rtasm_execmem.c
src/gallium/auxiliary/rtasm/rtasm_ppc.c
src/gallium/auxiliary/rtasm/rtasm_x86sse.c
src/gallium/auxiliary/sct/Makefile
src/gallium/auxiliary/sct/sct.c
src/gallium/auxiliary/tgsi/Makefile
src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt [new file with mode: 0644]
src/gallium/auxiliary/tgsi/tgsi_build.c
src/gallium/auxiliary/tgsi/tgsi_dump.c
src/gallium/auxiliary/tgsi/tgsi_dump_c.c
src/gallium/auxiliary/tgsi/tgsi_exec.c
src/gallium/auxiliary/tgsi/tgsi_info.c
src/gallium/auxiliary/tgsi/tgsi_iterate.c
src/gallium/auxiliary/tgsi/tgsi_parse.c
src/gallium/auxiliary/tgsi/tgsi_ppc.c
src/gallium/auxiliary/tgsi/tgsi_sanity.c
src/gallium/auxiliary/tgsi/tgsi_scan.c
src/gallium/auxiliary/tgsi/tgsi_sse2.c
src/gallium/auxiliary/tgsi/tgsi_text.c
src/gallium/auxiliary/tgsi/tgsi_transform.c
src/gallium/auxiliary/tgsi/tgsi_util.c
src/gallium/auxiliary/translate/Makefile
src/gallium/auxiliary/util/Makefile
src/gallium/auxiliary/util/SConscript
src/gallium/auxiliary/util/p_debug.c [deleted file]
src/gallium/auxiliary/util/p_debug_mem.c [deleted file]
src/gallium/auxiliary/util/p_debug_prof.c [deleted file]
src/gallium/auxiliary/util/u_bitmask.c [new file with mode: 0644]
src/gallium/auxiliary/util/u_bitmask.h [new file with mode: 0644]
src/gallium/auxiliary/util/u_blit.c
src/gallium/auxiliary/util/u_cache.c
src/gallium/auxiliary/util/u_debug.c [new file with mode: 0644]
src/gallium/auxiliary/util/u_debug.h [new file with mode: 0644]
src/gallium/auxiliary/util/u_debug_memory.c [new file with mode: 0644]
src/gallium/auxiliary/util/u_debug_profile.c [new file with mode: 0644]
src/gallium/auxiliary/util/u_debug_stack.c [new file with mode: 0644]
src/gallium/auxiliary/util/u_debug_stack.h [new file with mode: 0644]
src/gallium/auxiliary/util/u_draw_quad.c
src/gallium/auxiliary/util/u_gen_mipmap.c
src/gallium/auxiliary/util/u_handle_table.c
src/gallium/auxiliary/util/u_hash_table.c
src/gallium/auxiliary/util/u_keymap.c
src/gallium/auxiliary/util/u_linear.c
src/gallium/auxiliary/util/u_math.h
src/gallium/auxiliary/util/u_memory.h
src/gallium/auxiliary/util/u_mm.c
src/gallium/auxiliary/util/u_rect.c
src/gallium/auxiliary/util/u_simple_screen.c
src/gallium/auxiliary/util/u_simple_shaders.c
src/gallium/auxiliary/util/u_simple_shaders.h
src/gallium/auxiliary/util/u_stream_stdc.c
src/gallium/auxiliary/util/u_tile.c
src/gallium/auxiliary/util/u_tile.h
src/gallium/auxiliary/util/u_time.c
src/gallium/auxiliary/util/u_time.h
src/gallium/auxiliary/util/u_timed_winsys.c
src/gallium/drivers/Makefile
src/gallium/drivers/cell/ppu/cell_clear.c
src/gallium/drivers/cell/ppu/cell_context.h
src/gallium/drivers/cell/ppu/cell_fence.c
src/gallium/drivers/cell/ppu/cell_pipe_state.c
src/gallium/drivers/cell/ppu/cell_state_emit.c
src/gallium/drivers/cell/ppu/cell_state_shader.c
src/gallium/drivers/cell/ppu/cell_surface.c
src/gallium/drivers/cell/ppu/cell_texture.c
src/gallium/drivers/cell/ppu/cell_texture.h
src/gallium/drivers/cell/ppu/cell_vbuf.c
src/gallium/drivers/cell/spu/Makefile
src/gallium/drivers/cell/spu/spu_tri.c
src/gallium/drivers/cell/spu/spu_util.c
src/gallium/drivers/failover/Makefile
src/gallium/drivers/failover/fo_context.c
src/gallium/drivers/failover/fo_state.c
src/gallium/drivers/i915simple/Makefile
src/gallium/drivers/i915simple/i915_debug.c
src/gallium/drivers/i915simple/i915_fpc_translate.c
src/gallium/drivers/i915simple/i915_prim_vbuf.c
src/gallium/drivers/i915simple/i915_screen.c
src/gallium/drivers/i915simple/i915_screen.h
src/gallium/drivers/i915simple/i915_state_emit.c
src/gallium/drivers/i915simple/i915_state_sampler.c
src/gallium/drivers/i915simple/i915_surface.c
src/gallium/drivers/i915simple/i915_texture.c
src/gallium/drivers/i915simple/i915_winsys.h
src/gallium/drivers/i965simple/Makefile
src/gallium/drivers/i965simple/brw_eu_debug.c
src/gallium/drivers/i965simple/brw_surface.c
src/gallium/drivers/i965simple/brw_tex_layout.c
src/gallium/drivers/i965simple/brw_wm_surface_state.c
src/gallium/drivers/nouveau/nouveau_stateobj.h
src/gallium/drivers/nouveau/nouveau_winsys.h
src/gallium/drivers/nv04/Makefile
src/gallium/drivers/nv04/nv04_miptree.c
src/gallium/drivers/nv04/nv04_prim_vbuf.c
src/gallium/drivers/nv04/nv04_screen.c
src/gallium/drivers/nv04/nv04_screen.h
src/gallium/drivers/nv04/nv04_state.h
src/gallium/drivers/nv04/nv04_state_emit.c
src/gallium/drivers/nv04/nv04_surface.c
src/gallium/drivers/nv04/nv04_surface_2d.c
src/gallium/drivers/nv04/nv04_surface_2d.h
src/gallium/drivers/nv04/nv04_transfer.c [new file with mode: 0644]
src/gallium/drivers/nv10/Makefile
src/gallium/drivers/nv10/nv10_miptree.c
src/gallium/drivers/nv10/nv10_prim_vbuf.c
src/gallium/drivers/nv10/nv10_screen.c
src/gallium/drivers/nv10/nv10_screen.h
src/gallium/drivers/nv10/nv10_state_emit.c
src/gallium/drivers/nv10/nv10_surface.c
src/gallium/drivers/nv10/nv10_transfer.c [new file with mode: 0644]
src/gallium/drivers/nv20/Makefile
src/gallium/drivers/nv20/nv20_miptree.c
src/gallium/drivers/nv20/nv20_prim_vbuf.c
src/gallium/drivers/nv20/nv20_screen.c
src/gallium/drivers/nv20/nv20_screen.h
src/gallium/drivers/nv20/nv20_state_emit.c
src/gallium/drivers/nv20/nv20_surface.c
src/gallium/drivers/nv20/nv20_transfer.c [new file with mode: 0644]
src/gallium/drivers/nv30/Makefile
src/gallium/drivers/nv30/nv30_fragprog.c
src/gallium/drivers/nv30/nv30_fragtex.c
src/gallium/drivers/nv30/nv30_miptree.c
src/gallium/drivers/nv30/nv30_screen.c
src/gallium/drivers/nv30/nv30_screen.h
src/gallium/drivers/nv30/nv30_state.c
src/gallium/drivers/nv30/nv30_state.h
src/gallium/drivers/nv30/nv30_state_blend.c
src/gallium/drivers/nv30/nv30_state_fb.c
src/gallium/drivers/nv30/nv30_state_scissor.c
src/gallium/drivers/nv30/nv30_state_stipple.c
src/gallium/drivers/nv30/nv30_state_viewport.c
src/gallium/drivers/nv30/nv30_surface.c
src/gallium/drivers/nv30/nv30_transfer.c [new file with mode: 0644]
src/gallium/drivers/nv30/nv30_vbo.c
src/gallium/drivers/nv30/nv30_vertprog.c
src/gallium/drivers/nv40/Makefile
src/gallium/drivers/nv40/nv40_fragprog.c
src/gallium/drivers/nv40/nv40_fragtex.c
src/gallium/drivers/nv40/nv40_miptree.c
src/gallium/drivers/nv40/nv40_screen.c
src/gallium/drivers/nv40/nv40_screen.h
src/gallium/drivers/nv40/nv40_state.c
src/gallium/drivers/nv40/nv40_state.h
src/gallium/drivers/nv40/nv40_state_blend.c
src/gallium/drivers/nv40/nv40_state_fb.c
src/gallium/drivers/nv40/nv40_state_scissor.c
src/gallium/drivers/nv40/nv40_state_viewport.c
src/gallium/drivers/nv40/nv40_surface.c
src/gallium/drivers/nv40/nv40_transfer.c [new file with mode: 0644]
src/gallium/drivers/nv40/nv40_vbo.c
src/gallium/drivers/nv40/nv40_vertprog.c
src/gallium/drivers/nv50/Makefile
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_miptree.c
src/gallium/drivers/nv50/nv50_program.c
src/gallium/drivers/nv50/nv50_query.c
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nv50/nv50_screen.h
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 [new file with mode: 0644]
src/gallium/drivers/nv50/nv50_vbo.c
src/gallium/drivers/r300/Makefile
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_cs_inlines.h
src/gallium/drivers/r300/r300_debug.c [new file with mode: 0644]
src/gallium/drivers/r300/r300_debug.h [new file with mode: 0644]
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_query.c [new file with mode: 0644]
src/gallium/drivers/r300/r300_query.h [new file with mode: 0644]
src/gallium/drivers/r300/r300_reg.h
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_screen.h
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_state_derived.c [new file with mode: 0644]
src/gallium/drivers/r300/r300_state_derived.h [new file with mode: 0644]
src/gallium/drivers/r300/r300_state_inlines.h [new file with mode: 0644]
src/gallium/drivers/r300/r300_state_invariant.c [new file with mode: 0644]
src/gallium/drivers/r300/r300_state_invariant.h [new file with mode: 0644]
src/gallium/drivers/r300/r300_state_shader.c
src/gallium/drivers/r300/r300_state_shader.h
src/gallium/drivers/r300/r300_surface.c
src/gallium/drivers/r300/r300_surface.h
src/gallium/drivers/r300/r300_swtcl_emit.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_texture.h
src/gallium/drivers/r300/r300_winsys.h
src/gallium/drivers/softpipe/Makefile
src/gallium/drivers/softpipe/SConscript
src/gallium/drivers/softpipe/sp_context.c
src/gallium/drivers/softpipe/sp_context.h
src/gallium/drivers/softpipe/sp_draw_arrays.c
src/gallium/drivers/softpipe/sp_flush.c
src/gallium/drivers/softpipe/sp_fs_exec.c
src/gallium/drivers/softpipe/sp_fs_llvm.c
src/gallium/drivers/softpipe/sp_fs_sse.c
src/gallium/drivers/softpipe/sp_headers.h [deleted file]
src/gallium/drivers/softpipe/sp_prim_vbuf.c
src/gallium/drivers/softpipe/sp_quad.c [deleted file]
src/gallium/drivers/softpipe/sp_quad.h
src/gallium/drivers/softpipe/sp_quad_alpha_test.c
src/gallium/drivers/softpipe/sp_quad_blend.c
src/gallium/drivers/softpipe/sp_quad_bufloop.c
src/gallium/drivers/softpipe/sp_quad_colormask.c
src/gallium/drivers/softpipe/sp_quad_coverage.c
src/gallium/drivers/softpipe/sp_quad_depth_test.c
src/gallium/drivers/softpipe/sp_quad_earlyz.c
src/gallium/drivers/softpipe/sp_quad_fs.c
src/gallium/drivers/softpipe/sp_quad_occlusion.c
src/gallium/drivers/softpipe/sp_quad_output.c
src/gallium/drivers/softpipe/sp_quad_pipe.c [new file with mode: 0644]
src/gallium/drivers/softpipe/sp_quad_pipe.h [new file with mode: 0644]
src/gallium/drivers/softpipe/sp_quad_stencil.c
src/gallium/drivers/softpipe/sp_quad_stipple.c
src/gallium/drivers/softpipe/sp_query.c
src/gallium/drivers/softpipe/sp_setup.c
src/gallium/drivers/softpipe/sp_state.h
src/gallium/drivers/softpipe/sp_state_fs.c
src/gallium/drivers/softpipe/sp_state_sampler.c
src/gallium/drivers/softpipe/sp_state_surface.c
src/gallium/drivers/softpipe/sp_surface.c
src/gallium/drivers/softpipe/sp_tex_sample.c
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/trace/Makefile
src/gallium/drivers/trace/SConscript
src/gallium/drivers/trace/tr_buffer.c [new file with mode: 0644]
src/gallium/drivers/trace/tr_buffer.h [new file with mode: 0644]
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_context.h
src/gallium/drivers/trace/tr_dump.c
src/gallium/drivers/trace/tr_dump.h
src/gallium/drivers/trace/tr_screen.c
src/gallium/drivers/trace/tr_screen.h
src/gallium/drivers/trace/tr_state.c
src/gallium/drivers/trace/tr_state.h
src/gallium/drivers/trace/tr_texture.c
src/gallium/drivers/trace/tr_texture.h
src/gallium/drivers/trace/tr_winsys.c [deleted file]
src/gallium/drivers/trace/tr_winsys.h [deleted file]
src/gallium/include/pipe/internal/p_winsys_screen.h
src/gallium/include/pipe/p_atomic.h [new file with mode: 0644]
src/gallium/include/pipe/p_config.h
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_debug.h [deleted file]
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_format.h
src/gallium/include/pipe/p_inlines.h
src/gallium/include/pipe/p_refcnt.h [new file with mode: 0644]
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/pipe/p_thread.h
src/gallium/include/state_tracker/drm_api.h
src/gallium/state_trackers/dri2/Makefile [new file with mode: 0644]
src/gallium/state_trackers/dri2/dri_context.c [new file with mode: 0644]
src/gallium/state_trackers/dri2/dri_context.h [new file with mode: 0644]
src/gallium/state_trackers/dri2/dri_drawable.c [new file with mode: 0644]
src/gallium/state_trackers/dri2/dri_drawable.h [new file with mode: 0644]
src/gallium/state_trackers/dri2/dri_extensions.c [new file with mode: 0644]
src/gallium/state_trackers/dri2/dri_screen.c [new file with mode: 0644]
src/gallium/state_trackers/dri2/dri_screen.h [new file with mode: 0644]
src/gallium/state_trackers/egl/Makefile
src/gallium/state_trackers/egl/egl_context.c
src/gallium/state_trackers/egl/egl_surface.c
src/gallium/state_trackers/egl/egl_tracker.c
src/gallium/state_trackers/egl/egl_tracker.h
src/gallium/state_trackers/g3dvl/Makefile
src/gallium/state_trackers/g3dvl/vl_basic_csc.c
src/gallium/state_trackers/g3dvl/vl_context.c
src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
src/gallium/state_trackers/glx/dri/dri_context.c [deleted file]
src/gallium/state_trackers/glx/dri/dri_context.h [deleted file]
src/gallium/state_trackers/glx/dri/dri_drawable.c [deleted file]
src/gallium/state_trackers/glx/dri/dri_drawable.h [deleted file]
src/gallium/state_trackers/glx/dri/dri_extensions.c [deleted file]
src/gallium/state_trackers/glx/dri/dri_lock.c [deleted file]
src/gallium/state_trackers/glx/dri/dri_screen.c [deleted file]
src/gallium/state_trackers/glx/dri/dri_screen.h [deleted file]
src/gallium/state_trackers/glx/xlib/Makefile
src/gallium/state_trackers/glx/xlib/SConscript
src/gallium/state_trackers/glx/xlib/glxapi.c
src/gallium/state_trackers/glx/xlib/xm_api.c
src/gallium/state_trackers/glx/xlib/xm_api.h
src/gallium/state_trackers/python/gallium.i
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/retrace/interpreter.py
src/gallium/state_trackers/python/samples/tri.py
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/python/st_softpipe_winsys.c
src/gallium/state_trackers/wgl/SConscript
src/gallium/state_trackers/wgl/icd/stw_icd.c
src/gallium/state_trackers/wgl/opengl32.mingw.def [new file with mode: 0644]
src/gallium/state_trackers/wgl/shared/stw_context.c
src/gallium/state_trackers/wgl/shared/stw_context.h
src/gallium/state_trackers/wgl/shared/stw_device.c
src/gallium/state_trackers/wgl/shared/stw_device.h
src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
src/gallium/state_trackers/wgl/shared/stw_pixelformat.c
src/gallium/state_trackers/wgl/shared/stw_public.h
src/gallium/state_trackers/wgl/shared/stw_quirks.c
src/gallium/state_trackers/wgl/stw.c [deleted file]
src/gallium/state_trackers/wgl/stw.h [deleted file]
src/gallium/state_trackers/wgl/wgl/stw_wgl.c
src/gallium/state_trackers/wgl/wgl/stw_wgl.h
src/gallium/state_trackers/xorg/Makefile [new file with mode: 0644]
src/gallium/state_trackers/xorg/xorg_crtc.c [new file with mode: 0644]
src/gallium/state_trackers/xorg/xorg_dri2.c [new file with mode: 0644]
src/gallium/state_trackers/xorg/xorg_driver.c [new file with mode: 0644]
src/gallium/state_trackers/xorg/xorg_exa.c [new file with mode: 0644]
src/gallium/state_trackers/xorg/xorg_output.c [new file with mode: 0644]
src/gallium/state_trackers/xorg/xorg_tracker.h [new file with mode: 0644]
src/gallium/state_trackers/xorg/xorg_winsys.h [new file with mode: 0644]
src/gallium/winsys/Makefile
src/gallium/winsys/drm/Makefile
src/gallium/winsys/drm/Makefile.template
src/gallium/winsys/drm/intel/Makefile
src/gallium/winsys/drm/intel/common/Makefile [deleted file]
src/gallium/winsys/drm/intel/common/Makefile.template [deleted file]
src/gallium/winsys/drm/intel/common/intel_be_batchbuffer.c [deleted file]
src/gallium/winsys/drm/intel/common/intel_be_batchbuffer.h [deleted file]
src/gallium/winsys/drm/intel/common/intel_be_context.c [deleted file]
src/gallium/winsys/drm/intel/common/intel_be_context.h [deleted file]
src/gallium/winsys/drm/intel/common/intel_be_device.c [deleted file]
src/gallium/winsys/drm/intel/common/intel_be_device.h [deleted file]
src/gallium/winsys/drm/intel/common/ws_dri_bufmgr.c [deleted file]
src/gallium/winsys/drm/intel/common/ws_dri_bufmgr.h [deleted file]
src/gallium/winsys/drm/intel/common/ws_dri_bufpool.h [deleted file]
src/gallium/winsys/drm/intel/common/ws_dri_drmpool.c [deleted file]
src/gallium/winsys/drm/intel/common/ws_dri_fencemgr.c [deleted file]
src/gallium/winsys/drm/intel/common/ws_dri_fencemgr.h [deleted file]
src/gallium/winsys/drm/intel/common/ws_dri_mallocpool.c [deleted file]
src/gallium/winsys/drm/intel/common/ws_dri_slabpool.c [deleted file]
src/gallium/winsys/drm/intel/dri/Makefile [deleted file]
src/gallium/winsys/drm/intel/dri/SConscript [deleted file]
src/gallium/winsys/drm/intel/dri/intel_batchbuffer.h [deleted file]
src/gallium/winsys/drm/intel/dri/intel_context.c [deleted file]
src/gallium/winsys/drm/intel/dri/intel_context.h [deleted file]
src/gallium/winsys/drm/intel/dri/intel_lock.c [deleted file]
src/gallium/winsys/drm/intel/dri/intel_reg.h [deleted file]
src/gallium/winsys/drm/intel/dri/intel_screen.c [deleted file]
src/gallium/winsys/drm/intel/dri/intel_screen.h [deleted file]
src/gallium/winsys/drm/intel/dri/intel_swapbuffers.c [deleted file]
src/gallium/winsys/drm/intel/dri/intel_swapbuffers.h [deleted file]
src/gallium/winsys/drm/intel/dri/intel_winsys_softpipe.c [deleted file]
src/gallium/winsys/drm/intel/dri/intel_winsys_softpipe.h [deleted file]
src/gallium/winsys/drm/intel/dri/server/i830_common.h [deleted file]
src/gallium/winsys/drm/intel/dri/server/i830_dri.h [deleted file]
src/gallium/winsys/drm/intel/dri2/Makefile [new file with mode: 0644]
src/gallium/winsys/drm/intel/egl/Makefile
src/gallium/winsys/drm/intel/egl/intel_api.c [deleted file]
src/gallium/winsys/drm/intel/egl/intel_api.h [deleted file]
src/gallium/winsys/drm/intel/egl/intel_context.c [deleted file]
src/gallium/winsys/drm/intel/egl/intel_device.c [deleted file]
src/gallium/winsys/drm/intel/gem/Makefile
src/gallium/winsys/drm/intel/gem/Makefile.template [deleted file]
src/gallium/winsys/drm/intel/gem/intel_be_api.c [new file with mode: 0644]
src/gallium/winsys/drm/intel/gem/intel_be_api.h [new file with mode: 0644]
src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c
src/gallium/winsys/drm/intel/gem/intel_be_context.c
src/gallium/winsys/drm/intel/gem/intel_be_context.h
src/gallium/winsys/drm/intel/gem/intel_be_device.c
src/gallium/winsys/drm/intel/gem/intel_be_device.h
src/gallium/winsys/drm/intel/gem/intel_be_fence.h
src/gallium/winsys/drm/intel/xorg/Makefile [new file with mode: 0644]
src/gallium/winsys/drm/intel/xorg/intel_xorg.c [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/Makefile
src/gallium/winsys/drm/nouveau/common/Makefile [deleted file]
src/gallium/winsys/drm/nouveau/common/Makefile.template [deleted file]
src/gallium/winsys/drm/nouveau/common/nouveau_context.c [deleted file]
src/gallium/winsys/drm/nouveau/common/nouveau_context.h [deleted file]
src/gallium/winsys/drm/nouveau/common/nouveau_dri.h [deleted file]
src/gallium/winsys/drm/nouveau/common/nouveau_local.h [deleted file]
src/gallium/winsys/drm/nouveau/common/nouveau_lock.c [deleted file]
src/gallium/winsys/drm/nouveau/common/nouveau_screen.c [deleted file]
src/gallium/winsys/drm/nouveau/common/nouveau_screen.h [deleted file]
src/gallium/winsys/drm/nouveau/common/nouveau_winsys.c [deleted file]
src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c [deleted file]
src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.h [deleted file]
src/gallium/winsys/drm/nouveau/common/nouveau_winsys_softpipe.c [deleted file]
src/gallium/winsys/drm/nouveau/dri/Makefile
src/gallium/winsys/drm/nouveau/dri/nouveau_context.c [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/dri/nouveau_context.h [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.c [deleted file]
src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.h [deleted file]
src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.c [deleted file]
src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.h [deleted file]
src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c
src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h
src/gallium/winsys/drm/nouveau/dri2/Makefile [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/drm/Makefile [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c [new file with mode: 0644]
src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.h [new file with mode: 0644]
src/gallium/winsys/drm/radeon/Makefile
src/gallium/winsys/drm/radeon/core/Makefile [new file with mode: 0644]
src/gallium/winsys/drm/radeon/core/radeon_buffer.c [new file with mode: 0644]
src/gallium/winsys/drm/radeon/core/radeon_buffer.h [new file with mode: 0644]
src/gallium/winsys/drm/radeon/core/radeon_drm.c [new file with mode: 0644]
src/gallium/winsys/drm/radeon/core/radeon_drm.h [new file with mode: 0644]
src/gallium/winsys/drm/radeon/core/radeon_r300.c [new file with mode: 0644]
src/gallium/winsys/drm/radeon/core/radeon_r300.h [new file with mode: 0644]
src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c [new file with mode: 0644]
src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.h [new file with mode: 0644]
src/gallium/winsys/drm/radeon/dri2/Makefile [new file with mode: 0644]
src/gallium/winsys/drm/radeon/egl/Makefile [new file with mode: 0644]
src/gallium/winsys/drm/radeon/radeon_buffer.c [deleted file]
src/gallium/winsys/drm/radeon/radeon_buffer.h [deleted file]
src/gallium/winsys/drm/radeon/radeon_context.c [deleted file]
src/gallium/winsys/drm/radeon/radeon_context.h [deleted file]
src/gallium/winsys/drm/radeon/radeon_r300.c [deleted file]
src/gallium/winsys/drm/radeon/radeon_r300.h [deleted file]
src/gallium/winsys/drm/radeon/radeon_screen.c [deleted file]
src/gallium/winsys/drm/radeon/radeon_screen.h [deleted file]
src/gallium/winsys/drm/radeon/radeon_winsys_softpipe.c [deleted file]
src/gallium/winsys/drm/radeon/radeon_winsys_softpipe.h [deleted file]
src/gallium/winsys/drm/radeon/xorg/Makefile [new file with mode: 0644]
src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c [new file with mode: 0644]
src/gallium/winsys/egl_xlib/egl_xlib.c
src/gallium/winsys/egl_xlib/sw_winsys.c
src/gallium/winsys/g3dvl/nouveau/nouveau_swapbuffers.c
src/gallium/winsys/g3dvl/xsp_winsys.c
src/gallium/winsys/gdi/SConscript
src/gallium/winsys/gdi/gdi_softpipe_winsys.c
src/gallium/winsys/xlib/xlib_brw_aub.c
src/gallium/winsys/xlib/xlib_brw_screen.c
src/gallium/winsys/xlib/xlib_cell.c
src/gallium/winsys/xlib/xlib_softpipe.c
src/glew/Makefile
src/glx/x11/dri2_glx.c
src/glx/x11/dri_common.c
src/glx/x11/dri_glx.c
src/glx/x11/glxclient.h
src/glx/x11/glxcmds.c
src/glx/x11/glxext.c
src/glx/x11/indirect.c
src/glx/x11/indirect.h
src/glx/x11/indirect_init.c
src/glx/x11/indirect_size.c
src/mesa/Makefile
src/mesa/SConscript
src/mesa/drivers/common/driverfuncs.c
src/mesa/drivers/dri/common/extension_helper.h
src/mesa/drivers/dri/common/texmem.c
src/mesa/drivers/dri/common/utils.c
src/mesa/drivers/dri/common/xmlpool/options.h
src/mesa/drivers/dri/common/xmlpool/t_options.h
src/mesa/drivers/dri/fb/fb_dri.c
src/mesa/drivers/dri/ffb/ffb_state.c
src/mesa/drivers/dri/ffb/ffb_xmesa.c
src/mesa/drivers/dri/gamma/gamma_tex.c
src/mesa/drivers/dri/gamma/gamma_xmesa.c
src/mesa/drivers/dri/i810/i810screen.c
src/mesa/drivers/dri/i915/i830_context.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/intel_tris.c
src/mesa/drivers/dri/i965/brw_cc.c
src/mesa/drivers/dri/i965/brw_clip_line.c
src/mesa/drivers/dri/i965/brw_clip_tri.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_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_misc_state.c
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/brw_sf.c
src/mesa/drivers/dri/i965/brw_sf_state.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_dump.c
src/mesa/drivers/dri/i965/brw_structs.h
src/mesa/drivers/dri/i965/brw_vs_constval.c
src/mesa/drivers/dri/i965/brw_vs_emit.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
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_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/intel/intel_batchbuffer.c
src/mesa/drivers/dri/intel/intel_blit.c
src/mesa/drivers/dri/intel/intel_buffer_objects.c
src/mesa/drivers/dri/intel/intel_buffers.c
src/mesa/drivers/dri/intel/intel_chipset.h
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_decode.c
src/mesa/drivers/dri/intel/intel_depthtmp.h [new file with mode: 0644]
src/mesa/drivers/dri/intel/intel_extensions.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_pixel.c
src/mesa/drivers/dri/intel/intel_pixel_copy.c
src/mesa/drivers/dri/intel/intel_pixel_draw.c
src/mesa/drivers/dri/intel/intel_regions.c
src/mesa/drivers/dri/intel/intel_regions.h
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/drivers/dri/intel/intel_span.c
src/mesa/drivers/dri/intel/intel_spantmp.h [new file with mode: 0644]
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_validate.c
src/mesa/drivers/dri/mach64/mach64_screen.c
src/mesa/drivers/dri/mga/mga_texstate.c
src/mesa/drivers/dri/mga/mga_xmesa.c
src/mesa/drivers/dri/mga/mgapixel.c
src/mesa/drivers/dri/r128/r128_screen.c
src/mesa/drivers/dri/r200/r200_pixel.c
src/mesa/drivers/dri/r200/r200_texstate.c
src/mesa/drivers/dri/r200/r200_vertprog.c
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/r300_emit.c
src/mesa/drivers/dri/r300/r300_fragprog.c
src/mesa/drivers/dri/r300/r300_reg.h
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/r300/r300_swtcl.c
src/mesa/drivers/dri/r300/r300_vertprog.c
src/mesa/drivers/dri/r300/r500_fragprog.c
src/mesa/drivers/dri/r300/radeon_nqssadce.c
src/mesa/drivers/dri/r300/radeon_program_pair.c
src/mesa/drivers/dri/radeon/radeon_common.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_texstate.c
src/mesa/drivers/dri/radeon/server/radeon_reg.h
src/mesa/drivers/dri/s3v/s3v_tex.c
src/mesa/drivers/dri/s3v/s3v_xmesa.c
src/mesa/drivers/dri/savage/savage_xmesa.c
src/mesa/drivers/dri/savage/savagestate.c
src/mesa/drivers/dri/sis/sis_screen.c
src/mesa/drivers/dri/swrast/swrast.c
src/mesa/drivers/dri/tdfx/tdfx_context.c
src/mesa/drivers/dri/tdfx/tdfx_pixels.c
src/mesa/drivers/dri/tdfx/tdfx_render.c
src/mesa/drivers/dri/tdfx/tdfx_screen.c
src/mesa/drivers/dri/tdfx/tdfx_state.c
src/mesa/drivers/dri/trident/trident_context.c
src/mesa/drivers/dri/unichrome/via_screen.c
src/mesa/drivers/dri/unichrome/via_state.c
src/mesa/drivers/ggi/default/stubs.c
src/mesa/drivers/glide/fxdd.c
src/mesa/drivers/glslcompiler/glslcompiler.c
src/mesa/drivers/windows/gdi/mesa.def
src/mesa/drivers/windows/gdi/wmesa.c
src/mesa/drivers/x11/Makefile
src/mesa/drivers/x11/glxapi.c
src/mesa/drivers/x11/xm_api.c
src/mesa/drivers/x11/xm_buffer.c
src/mesa/drivers/x11/xm_span.c
src/mesa/glapi/dispatch.h
src/mesa/glapi/glX_proto_recv.py
src/mesa/glapi/gl_API.xml
src/mesa/glapi/gl_SPARC_asm.py
src/mesa/glapi/gl_enums.py
src/mesa/glapi/glapi.c
src/mesa/glapi/glapi_getproc.c
src/mesa/glapi/glapioffsets.h
src/mesa/glapi/glapitable.h
src/mesa/glapi/glapitemp.h
src/mesa/glapi/glprocs.h
src/mesa/glapi/glthread.c
src/mesa/glapi/glthread.h
src/mesa/main/api_exec.c
src/mesa/main/api_validate.c
src/mesa/main/attrib.c
src/mesa/main/bufferobj.c
src/mesa/main/buffers.c
src/mesa/main/clip.c
src/mesa/main/compiler.h [new file with mode: 0644]
src/mesa/main/config.h
src/mesa/main/context.c
src/mesa/main/context.h
src/mesa/main/cpuinfo.c [new file with mode: 0644]
src/mesa/main/cpuinfo.h [new file with mode: 0644]
src/mesa/main/dd.h
src/mesa/main/debug.c
src/mesa/main/dispatch.c
src/mesa/main/dlist.c
src/mesa/main/dlopen.c
src/mesa/main/drawpix.c
src/mesa/main/enable.c
src/mesa/main/enums.c
src/mesa/main/execmem.c
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/framebuffer.c
src/mesa/main/framebuffer.h
src/mesa/main/get.c
src/mesa/main/get_gen.py
src/mesa/main/getstring.c
src/mesa/main/glheader.h
src/mesa/main/hash.c
src/mesa/main/image.c
src/mesa/main/image.h
src/mesa/main/imports.c
src/mesa/main/imports.h
src/mesa/main/macros.h
src/mesa/main/matrix.c
src/mesa/main/matrix.h
src/mesa/main/mfeatures.h
src/mesa/main/mipmap.c
src/mesa/main/mtypes.h
src/mesa/main/shaders.c
src/mesa/main/shared.c [new file with mode: 0644]
src/mesa/main/shared.h [new file with mode: 0644]
src/mesa/main/state.c
src/mesa/main/stencil.c
src/mesa/main/texenv.c
src/mesa/main/texenv.h
src/mesa/main/texenvprogram.c
src/mesa/main/texformat.c
src/mesa/main/texformat.h
src/mesa/main/texformat_tmp.h
src/mesa/main/texgen.c
src/mesa/main/teximage.c
src/mesa/main/texobj.c
src/mesa/main/texparam.c
src/mesa/main/texstate.c
src/mesa/main/texstore.c
src/mesa/main/texstore.h
src/mesa/main/version.h
src/mesa/main/viewport.c [new file with mode: 0644]
src/mesa/main/viewport.h [new file with mode: 0644]
src/mesa/main/vtxfmt.c
src/mesa/math/m_debug_util.h
src/mesa/math/m_matrix.c
src/mesa/math/m_matrix.h
src/mesa/math/m_xform.c
src/mesa/math/m_xform.h
src/mesa/math/mathmod.h [deleted file]
src/mesa/shader/arbprogparse.c
src/mesa/shader/arbprogram.c
src/mesa/shader/nvfragparse.c
src/mesa/shader/nvfragparse.h
src/mesa/shader/nvprogram.c
src/mesa/shader/nvvertparse.c
src/mesa/shader/prog_debug.c [deleted file]
src/mesa/shader/prog_debug.h [deleted file]
src/mesa/shader/prog_execute.c
src/mesa/shader/prog_execute.h
src/mesa/shader/prog_instruction.c
src/mesa/shader/prog_instruction.h
src/mesa/shader/prog_optimize.c [new file with mode: 0644]
src/mesa/shader/prog_optimize.h [new file with mode: 0644]
src/mesa/shader/prog_parameter.c
src/mesa/shader/prog_parameter.h
src/mesa/shader/prog_print.c
src/mesa/shader/prog_statevars.c
src/mesa/shader/prog_statevars.h
src/mesa/shader/program.c
src/mesa/shader/programopt.c
src/mesa/shader/programopt.h
src/mesa/shader/shader_api.c
src/mesa/shader/slang/library/slang_common_builtin.gc
src/mesa/shader/slang/library/slang_common_builtin_gc.h
src/mesa/shader/slang/library/slang_fragment_builtin.gc
src/mesa/shader/slang/library/slang_fragment_builtin_gc.h
src/mesa/shader/slang/library/slang_vertex_builtin.gc
src/mesa/shader/slang/library/slang_vertex_builtin_gc.h
src/mesa/shader/slang/slang_builtin.c
src/mesa/shader/slang/slang_codegen.c
src/mesa/shader/slang/slang_codegen.h
src/mesa/shader/slang/slang_compile.c
src/mesa/shader/slang/slang_emit.c
src/mesa/shader/slang/slang_ir.c
src/mesa/shader/slang/slang_ir.h
src/mesa/shader/slang/slang_link.c
src/mesa/shader/slang/slang_preprocess.c
src/mesa/sources.mak
src/mesa/sparc/clip.S
src/mesa/sparc/glapi_sparc.S
src/mesa/sparc/norm.S
src/mesa/sparc/sparc.c
src/mesa/sparc/sparc.h
src/mesa/state_tracker/st_atom.c
src/mesa/state_tracker/st_atom_constbuf.c
src/mesa/state_tracker/st_atom_depth.c
src/mesa/state_tracker/st_atom_framebuffer.c
src/mesa/state_tracker/st_atom_pixeltransfer.c
src/mesa/state_tracker/st_atom_shader.c
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_cb_accum.c
src/mesa/state_tracker/st_cb_bitmap.c
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_fbo.c
src/mesa/state_tracker/st_cb_feedback.c
src/mesa/state_tracker/st_cb_flush.c
src/mesa/state_tracker/st_cb_program.c
src/mesa/state_tracker/st_cb_queryobj.c
src/mesa/state_tracker/st_cb_rasterpos.c
src/mesa/state_tracker/st_cb_readpixels.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_cb_viewport.c [new file with mode: 0644]
src/mesa/state_tracker/st_cb_viewport.h [new file with mode: 0644]
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h
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_framebuffer.c
src/mesa/state_tracker/st_gen_mipmap.c
src/mesa/state_tracker/st_mesa_to_tgsi.c
src/mesa/state_tracker/st_program.c
src/mesa/state_tracker/st_texture.c
src/mesa/state_tracker/st_texture.h
src/mesa/swrast/s_atifragshader.c
src/mesa/swrast/s_buffers.c [deleted file]
src/mesa/swrast/s_clear.c [new file with mode: 0644]
src/mesa/swrast/s_context.c
src/mesa/swrast/s_context.h
src/mesa/swrast/s_drawpix.c
src/mesa/swrast/s_feedback.c
src/mesa/swrast/s_fragprog.c
src/mesa/swrast/s_span.c
src/mesa/swrast/s_texcombine.c
src/mesa/swrast/s_texfilter.c
src/mesa/swrast/s_triangle.c
src/mesa/swrast/swrast.h
src/mesa/swrast_setup/ss_triangle.c
src/mesa/swrast_setup/ss_tritmp.h
src/mesa/tnl/t_context.c
src/mesa/tnl/t_context.h
src/mesa/tnl/t_rasterpos.c
src/mesa/tnl/t_vb_points.c
src/mesa/tnl/t_vb_texgen.c
src/mesa/tnl/t_vertex.c
src/mesa/tnl/t_vp_build.c
src/mesa/tnl_dd/t_dd_vb.c
src/mesa/vbo/vbo_exec.c
src/mesa/vbo/vbo_exec.h
src/mesa/vbo/vbo_exec_api.c
src/mesa/vbo/vbo_exec_array.c
src/mesa/vbo/vbo_exec_draw.c
src/mesa/vbo/vbo_save.h
src/mesa/vbo/vbo_save_api.c
src/mesa/vbo/vbo_save_draw.c
src/mesa/x86-64/glapi_x86-64.S
src/mesa/x86-64/x86-64.c
src/mesa/x86/3dnow.c
src/mesa/x86/common_x86.c
src/mesa/x86/common_x86_asm.h
src/mesa/x86/common_x86_macros.h [deleted file]
src/mesa/x86/gen_matypes.c
src/mesa/x86/glapi_x86.S
src/mesa/x86/sse.c
src/mesa/x86/x86.c [deleted file]
src/mesa/x86/x86.h [deleted file]
src/mesa/x86/x86_xform.c [new file with mode: 0644]
src/mesa/x86/x86_xform.h [new file with mode: 0644]
windows/VC7/progs/progs.sln [new file with mode: 0644]
windows/VC7/progs/wgl/sharedtex_mt.vcproj [new file with mode: 0644]
windows/VC7/progs/wgl/wglthreads.vcproj [new file with mode: 0644]
windows/VC8/mesa/mesa/mesa.vcproj

index c79fb1cb28be99c5c298e1a731a0b72a2ed8134b..59f0a07a4802e52c50983339cfd97b1ea0a8d4e2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -190,8 +190,6 @@ MAIN_FILES = \
        $(DIRECTORY)/configure.ac                                       \
        $(DIRECTORY)/acinclude.m4                                       \
        $(DIRECTORY)/aclocal.m4                                         \
-       $(DIRECTORY)/descrip.mms                                        \
-       $(DIRECTORY)/mms-config.                                        \
        $(DIRECTORY)/bin/config.guess                                   \
        $(DIRECTORY)/bin/config.sub                                     \
        $(DIRECTORY)/bin/install-sh                                     \
@@ -221,11 +219,11 @@ MAIN_FILES = \
        $(DIRECTORY)/include/GL/osmesa.h                                \
        $(DIRECTORY)/include/GL/svgamesa.h                              \
        $(DIRECTORY)/include/GL/vms_x_fix.h                             \
+       $(DIRECTORY)/include/GL/wglext.h                                \
        $(DIRECTORY)/include/GL/wmesa.h                                 \
        $(DIRECTORY)/src/Makefile                                       \
-       $(DIRECTORY)/src/descrip.mms                                    \
        $(DIRECTORY)/src/mesa/Makefile*                                 \
-       $(DIRECTORY)/src/mesa/sources                                   \
+       $(DIRECTORY)/src/mesa/sources.mak                               \
        $(DIRECTORY)/src/mesa/descrip.mms                               \
        $(DIRECTORY)/src/mesa/gl.pc.in                                  \
        $(DIRECTORY)/src/mesa/osmesa.pc.in                              \
@@ -233,13 +231,11 @@ MAIN_FILES = \
        $(DIRECTORY)/src/mesa/main/*.[chS]                              \
        $(DIRECTORY)/src/mesa/main/descrip.mms                          \
        $(DIRECTORY)/src/mesa/glapi/*.[chS]                             \
-       $(DIRECTORY)/src/mesa/glapi/descrip.mms                         \
        $(DIRECTORY)/src/mesa/math/*.[ch]                               \
        $(DIRECTORY)/src/mesa/math/descrip.mms                          \
        $(DIRECTORY)/src/mesa/shader/*.[ch]                             \
        $(DIRECTORY)/src/mesa/shader/descrip.mms                        \
        $(DIRECTORY)/src/mesa/shader/grammar/*.[ch]                     \
-       $(DIRECTORY)/src/mesa/shader/grammar/descrip.mms                \
        $(DIRECTORY)/src/mesa/shader/slang/*.[ch]                       \
        $(DIRECTORY)/src/mesa/shader/slang/descrip.mms                  \
        $(DIRECTORY)/src/mesa/shader/slang/library/*.[ch]               \
@@ -300,11 +296,36 @@ MAIN_FILES = \
        $(DIRECTORY)/progs/util/README                                  \
        $(DIRECTORY)/progs/util/*.[ch]                                  \
        $(DIRECTORY)/progs/util/sampleMakefile                          \
-       $(DIRECTORY)/vms/analyze_map.com                                \
-       $(DIRECTORY)/vms/xlib.opt                                       \
-       $(DIRECTORY)/vms/xlib_share.opt                                 \
        $(DIRECTORY)/windows/VC8/
 
+EGL_FILES = \
+       $(DIRECTORY)/include/EGL/*.h                                    \
+       $(DIRECTORY)/include/GLES/*.h                                   \
+       $(DIRECTORY)/include/GLES2/*.h                                  \
+       $(DIRECTORY)/src/egl/Makefile                                   \
+       $(DIRECTORY)/src/egl/*/Makefile                                 \
+       $(DIRECTORY)/src/egl/*/*.[ch]                                   \
+       $(DIRECTORY)/src/egl/*/*/Makefile                               \
+       $(DIRECTORY)/src/egl/*/*/*.[ch]                                 \
+
+GALLIUM_FILES = \
+       $(DIRECTORY)/src/mesa/state_tracker/*[ch]                       \
+       $(DIRECTORY)/src/gallium/Makefile                               \
+       $(DIRECTORY)/src/gallium/Makefile.template                      \
+       $(DIRECTORY)/src/gallium/SConscript                             \
+       $(DIRECTORY)/src/gallium/*/Makefile                             \
+       $(DIRECTORY)/src/gallium/*/SConscript                           \
+       $(DIRECTORY)/src/gallium/*/*/Makefile                           \
+       $(DIRECTORY)/src/gallium/*/*/Makefile.template                  \
+       $(DIRECTORY)/src/gallium/*/*/SConscript                         \
+       $(DIRECTORY)/src/gallium/*/*/*.[ch]                             \
+       $(DIRECTORY)/src/gallium/*/*/*.py                               \
+       $(DIRECTORY)/src/gallium/*/*/*/Makefile                         \
+       $(DIRECTORY)/src/gallium/*/*/*/SConscript                       \
+       $(DIRECTORY)/src/gallium/*/*/*/*.[ch]                           \
+       $(DIRECTORY)/src/gallium/*/*/*/*.py                             \
+       $(DIRECTORY)/src/gallium/*/*/*/*/*.[ch]                         \
+
 
 DRI_FILES = \
        $(DIRECTORY)/include/GL/internal/dri_interface.h                \
@@ -325,15 +346,12 @@ DRI_FILES = \
 
 SGI_GLU_FILES = \
        $(DIRECTORY)/src/glu/Makefile                                   \
-       $(DIRECTORY)/src/glu/descrip.mms                                \
        $(DIRECTORY)/src/glu/glu.pc.in                                  \
        $(DIRECTORY)/src/glu/sgi/Makefile                               \
        $(DIRECTORY)/src/glu/sgi/Makefile.mgw                           \
        $(DIRECTORY)/src/glu/sgi/Makefile.win                           \
-       $(DIRECTORY)/src/glu/sgi/Makefile.DJ                            \
        $(DIRECTORY)/src/glu/sgi/glu.def                                \
        $(DIRECTORY)/src/glu/sgi/dummy.cc                               \
-       $(DIRECTORY)/src/glu/sgi/descrip.mms                            \
        $(DIRECTORY)/src/glu/sgi/glu.exports                            \
        $(DIRECTORY)/src/glu/sgi/glu.exports.darwin                     \
        $(DIRECTORY)/src/glu/sgi/mesaglu.opt                            \
@@ -438,7 +456,13 @@ DEPEND_FILES = \
        $(TOP)/src/glu/sgi/depend
 
 
-LIB_FILES = $(MAIN_FILES) $(DRI_FILES) $(SGI_GLU_FILES) $(GLW_FILES)
+LIB_FILES = \
+       $(MAIN_FILES)           \
+       $(EGL_FILES)            \
+       $(GALLIUM_FILES)        \
+       $(DRI_FILES)            \
+       $(SGI_GLU_FILES)        \
+       $(GLW_FILES)
 
 
 # Everything for new a Mesa release:
index a22b9483da04dd9c649d17e0f31ef70646144484..7e7f51516e8453c1903fe0b37a4919491ffb745b 100644 (file)
@@ -32,7 +32,7 @@ import common
 default_statetrackers = 'mesa'
 
 if common.default_platform in ('linux', 'freebsd', 'darwin'):
-       default_drivers = 'softpipe,failover,i915simple,i965simple,trace'
+       default_drivers = 'softpipe,failover,i915simple,trace'
        default_winsys = 'xlib'
 elif common.default_platform in ('winddk',):
        default_drivers = 'softpipe,i915simple,trace'
@@ -133,7 +133,7 @@ if dri:
 # LLVM
 if llvm:
        # See also http://www.scons.org/wiki/UsingPkgConfig
-       env.ParseConfig('llvm-config --cflags --ldflags --libs backend bitreader engine ipo')
+       env.ParseConfig('llvm-config --cflags --ldflags --libs backend bitreader engine instrumentation interpreter ipo')
        env.Append(CPPDEFINES = ['MESA_LLVM'])
         # Force C++ linkage
        env['LINK'] = env['CXX']
index 278f9e9e07c1d1a3bda668e6529bcce3006cfbdf..e5716eea733e225984bd4634a1d655127dfa470c 100755 (executable)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
 
-timestamp='2007-07-22'
+timestamp='2009-02-03'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -56,8 +56,8 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -331,7 +331,20 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
        exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       eval $set_cc_for_build
+       SUN_ARCH="i386"
+       # If there is a compiler, see if it is configured for 64-bit objects.
+       # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+       # This test works for both compilers.
+       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+           if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+               (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+               grep IS_64BIT_ARCH >/dev/null
+           then
+               SUN_ARCH="x86_64"
+           fi
+       fi
+       echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
        exit ;;
     sun4*:SunOS:6*:*)
        # According to config.sub, this is the proper way to canonicalize
@@ -532,7 +545,7 @@ EOF
                echo rs6000-ibm-aix3.2
        fi
        exit ;;
-    *:AIX:*:[45])
+    *:AIX:*:[456])
        IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
        if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
                IBM_ARCH=rs6000
@@ -796,9 +809,12 @@ EOF
            x86)
                echo i586-pc-interix${UNAME_RELEASE}
                exit ;;
-           EM64T | authenticamd)
+           EM64T | authenticamd | genuineintel)
                echo x86_64-unknown-interix${UNAME_RELEASE}
                exit ;;
+           IA64)
+               echo ia64-unknown-interix${UNAME_RELEASE}
+               exit ;;
        esac ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
        echo i${UNAME_MACHINE}-pc-mks
@@ -833,7 +849,14 @@ EOF
        echo ${UNAME_MACHINE}-pc-minix
        exit ;;
     arm*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       eval $set_cc_for_build
+       if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+           | grep -q __ARM_EABI__
+       then
+           echo ${UNAME_MACHINE}-unknown-linux-gnu
+       else
+           echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+       fi
        exit ;;
     avr32*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -925,6 +948,9 @@ EOF
        if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
        echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
        exit ;;
+    padre:Linux:*:*)
+       echo sparc-unknown-linux-gnu
+       exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
        # Look for CPU level
        case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -954,8 +980,8 @@ EOF
     x86_64:Linux:*:*)
        echo x86_64-unknown-linux-gnu
        exit ;;
-    xtensa:Linux:*:*)
-       echo xtensa-unknown-linux-gnu
+    xtensa*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
        exit ;;
     i*86:Linux:*:*)
        # The BFD linker knows what the default object file format is, so
@@ -975,9 +1001,6 @@ EOF
          a.out-i386-linux)
                echo "${UNAME_MACHINE}-pc-linux-gnuaout"
                exit ;;
-         coff-i386)
-               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-               exit ;;
          "")
                # Either a pre-BFD a.out linker (linux-gnuoldld) or
                # one that does not give us useful --help.
@@ -1131,6 +1154,16 @@ EOF
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
           && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+       OS_REL='.3'
+       test -r /etc/.relid \
+           && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+           && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+           && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+           && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
        echo m68k-unknown-lynxos${UNAME_RELEASE}
        exit ;;
@@ -1206,6 +1239,9 @@ EOF
     BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
        echo i586-pc-beos
        exit ;;
+    BePC:Haiku:*:*)    # Haiku running on Intel PC compatible.
+       echo i586-pc-haiku
+       exit ;;
     SX-4:SUPER-UX:*:*)
        echo sx4-nec-superux${UNAME_RELEASE}
        exit ;;
@@ -1314,6 +1350,9 @@ EOF
     i*86:rdos:*:*)
        echo ${UNAME_MACHINE}-pc-rdos
        exit ;;
+    i*86:AROS:*:*)
+       echo ${UNAME_MACHINE}-pc-aros
+       exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1474,9 +1513,9 @@ This script, last modified $timestamp, has failed to recognize
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be
index 1761d8bdf6307c02067b3581e183ba2fdef7e1fa..d546a94b951e23587658e1c730708d1eae5aaed4 100755 (executable)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
 
-timestamp='2007-06-28'
+timestamp='2009-02-03'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -72,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -122,6 +122,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
   uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -249,13 +250,16 @@ case $basic_machine in
        | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
        | i370 | i860 | i960 | ia64 \
        | ip2k | iq2000 \
+       | lm32 \
        | m32c | m32r | m32rle | m68000 | m68k | m88k \
-       | maxq | mb | microblaze | mcore | mep \
+       | maxq | mb | microblaze | mcore | mep | metag \
        | mips | mipsbe | mipseb | mipsel | mipsle \
        | mips16 \
        | mips64 | mips64el \
-       | mips64vr | mips64vrel \
+       | mips64octeon | mips64octeonel \
        | mips64orion | mips64orionel \
+       | mips64r5900 | mips64r5900el \
+       | mips64vr | mips64vrel \
        | mips64vr4100 | mips64vr4100el \
        | mips64vr4300 | mips64vr4300el \
        | mips64vr5000 | mips64vr5000el \
@@ -277,7 +281,7 @@ case $basic_machine in
        | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
        | pyramid \
        | score \
-       | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
        | sh64 | sh64le \
        | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
        | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -286,7 +290,7 @@ case $basic_machine in
        | v850 | v850e \
        | we32k \
        | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
-       | z8k)
+       | z8k | z80)
                basic_machine=$basic_machine-unknown
                ;;
        m6811 | m68hc11 | m6812 | m68hc12)
@@ -329,14 +333,17 @@ case $basic_machine in
        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
        | i*86-* | i860-* | i960-* | ia64-* \
        | ip2k-* | iq2000-* \
+       | lm32-* \
        | m32c-* | m32r-* | m32rle-* \
        | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-       | m88110-* | m88k-* | maxq-* | mcore-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
        | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
        | mips16-* \
        | mips64-* | mips64el-* \
-       | mips64vr-* | mips64vrel-* \
+       | mips64octeon-* | mips64octeonel-* \
        | mips64orion-* | mips64orionel-* \
+       | mips64r5900-* | mips64r5900el-* \
+       | mips64vr-* | mips64vrel-* \
        | mips64vr4100-* | mips64vr4100el-* \
        | mips64vr4300-* | mips64vr4300el-* \
        | mips64vr5000-* | mips64vr5000el-* \
@@ -358,20 +365,24 @@ case $basic_machine in
        | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
        | pyramid-* \
        | romp-* | rs6000-* \
-       | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
        | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
        | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
        | sparclite-* \
        | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
        | tahoe-* | thumb-* \
-       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
        | tron-* \
        | v850-* | v850e-* | vax-* \
        | we32k-* \
        | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-       | xstormy16-* | xtensa-* \
+       | xstormy16-* | xtensa*-* \
        | ymp-* \
-       | z8k-*)
+       | z8k-* | z80-*)
+               ;;
+       # Recognize the basic CPU types without company name, with glob match.
+       xtensa*)
+               basic_machine=$basic_machine-unknown
                ;;
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
@@ -435,6 +446,10 @@ case $basic_machine in
                basic_machine=m68k-apollo
                os=-bsd
                ;;
+       aros)
+               basic_machine=i386-pc
+               os=-aros
+               ;;
        aux)
                basic_machine=m68k-apple
                os=-aux
@@ -443,10 +458,22 @@ case $basic_machine in
                basic_machine=ns32k-sequent
                os=-dynix
                ;;
+       blackfin)
+               basic_machine=bfin-unknown
+               os=-linux
+               ;;
+       blackfin-*)
+               basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
        c90)
                basic_machine=c90-cray
                os=-unicos
                ;;
+        cegcc)
+               basic_machine=arm-unknown
+               os=-cegcc
+               ;;
        convex-c1)
                basic_machine=c1-convex
                os=-bsd
@@ -514,6 +541,10 @@ case $basic_machine in
                basic_machine=m88k-motorola
                os=-sysv3
                ;;
+       dicos)
+               basic_machine=i686-pc
+               os=-dicos
+               ;;
        djgpp)
                basic_machine=i586-pc
                os=-msdosdjgpp
@@ -668,6 +699,14 @@ case $basic_machine in
                basic_machine=m68k-isi
                os=-sysv
                ;;
+       m68knommu)
+               basic_machine=m68k-unknown
+               os=-linux
+               ;;
+       m68knommu-*)
+               basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
        m88k-omron*)
                basic_machine=m88k-omron
                ;;
@@ -813,6 +852,14 @@ case $basic_machine in
                basic_machine=i860-intel
                os=-osf
                ;;
+       parisc)
+               basic_machine=hppa-unknown
+               os=-linux
+               ;;
+       parisc-*)
+               basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
        pbd)
                basic_machine=sparc-tti
                ;;
@@ -1021,6 +1068,10 @@ case $basic_machine in
                basic_machine=tic6x-unknown
                os=-coff
                ;;
+       tile*)
+               basic_machine=tile-unknown
+               os=-linux-gnu
+               ;;
        tx39)
                basic_machine=mipstx39-unknown
                ;;
@@ -1096,6 +1147,10 @@ case $basic_machine in
                basic_machine=z8k-unknown
                os=-sim
                ;;
+       z80-*-coff)
+               basic_machine=z80-unknown
+               os=-sim
+               ;;
        none)
                basic_machine=none-none
                os=-none
@@ -1134,7 +1189,7 @@ case $basic_machine in
        we32k)
                basic_machine=we32k-att
                ;;
-       sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+       sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
                basic_machine=sh-unknown
                ;;
        sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1206,8 +1261,9 @@ case $os in
        -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
              | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
              | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+             | -kopensolaris* \
              | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-             | -aos* \
+             | -aos* | -aros* \
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
              | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1216,7 +1272,7 @@ case $os in
              | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-             | -chorusos* | -chorusrdb* \
+             | -chorusos* | -chorusrdb* | -cegcc* \
              | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
              | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
              | -uxpv* | -beos* | -mpeix* | -udk* \
@@ -1356,6 +1412,9 @@ case $os in
        -zvmoe)
                os=-zvmoe
                ;;
+       -dicos*)
+               os=-dicos
+               ;;
        -none)
                ;;
        *)
index d7860294eae9b51fb7cb1a037d393e4cd75bd419..0f9306d8226b36d396123a3bb09cbde7f4e1c6d7 100644 (file)
@@ -66,12 +66,12 @@ GLU_DIRS = @GLU_DIRS@
 DRIVER_DIRS = @DRIVER_DIRS@
 GALLIUM_DIRS = @GALLIUM_DIRS@
 GALLIUM_AUXILIARY_DIRS = @GALLIUM_AUXILIARY_DIRS@
-GALLIUM_DRIVER_DIRS = @GALLIUM_DRIVER_DIRS@
+GALLIUM_DRIVERS_DIRS = @GALLIUM_DRIVERS_DIRS@
 GALLIUM_WINSYS_DIRS = @GALLIUM_WINSYS_DIRS@
 GALLIUM_WINSYS_DRM_DIRS = @GALLIUM_WINSYS_DRM_DIRS@
 GALLIUM_STATE_TRACKERS_DIRS = @GALLIUM_STATE_TRACKERS_DIRS@
 GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
-GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVER_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
+GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
 
 # Which subdirs under $(TOP)/progs/ to enter:
 PROGRAM_DIRS = @PROGRAM_DIRS@
@@ -92,6 +92,7 @@ MOTIF_CFLAGS = @MOTIF_CFLAGS@
 GL_LIB_DEPS = $(EXTRA_LIB_PATH) @GL_LIB_DEPS@
 OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \
        $(EXTRA_LIB_PATH) @OSMESA_LIB_DEPS@
+EGL_LIB_DEPS = $(EXTRA_LIB_PATH) @EGL_LIB_DEPS@
 GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLU_MESA_DEPS@ \
        $(EXTRA_LIB_PATH) @GLU_LIB_DEPS@
 GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLUT_MESA_DEPS@ \
@@ -124,6 +125,9 @@ DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
 # Where libGL will look for DRI hardware drivers
 DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
 
+# Xorg driver install directory (for xorg state-tracker)
+XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@
+
 # pkg-config substitutions
 GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@
 GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@
index c50ea9c44d5497c91947b7543dfa7f6421f7114d..29fa0f13ff44a53712819153b3d94b9165055911 100644 (file)
@@ -6,6 +6,8 @@ CONFIG_NAME = darwin
 
 INSTALL_DIR = /usr/X11
 
+X11_DIR = $(INSTALL_DIR)
+
 # Compiler and flags
 CC = gcc
 CXX = gcc
@@ -21,9 +23,9 @@ DEFINES =  -D_DARWIN_C_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L \
 ARCH_FLAGS += $(RC_CFLAGS)
 
 CFLAGS =  -ggdb3 -Os -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing \
-       -I$(INSTALL_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
+       -I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
 CXXFLAGS =  -ggdb3 -Os -Wall -fno-strict-aliasing \
-       -I$(INSTALL_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
+       -I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
 
 # Library names (actual file names)
 GL_LIB_NAME = libGL.dylib
@@ -39,12 +41,12 @@ GLUT_LIB_GLOB = libglut.*dylib
 GLW_LIB_GLOB = libGLw.*dylib
 OSMESA_LIB_GLOB = libOSMesa.*dylib
 
-GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread
+GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread
 OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
 GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB)  -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXmu -lXi -lXext
-GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXt
-APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
+GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB)  -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXi -lXext
+GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXt
+APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
 
 # omit glw lib for now:
 SRC_DIRS = glx/x11 mesa glu glut/glx glew
index a90d46f18e11ea4c36b0e8688542071e1dd9350b..eab36a36775411149c3eb12cec6e53062937e100 100644 (file)
@@ -92,8 +92,8 @@ EGL_DRIVERS_DIRS = demo
 GALLIUM_DIRS = auxiliary drivers state_trackers
 GALLIUM_AUXILIARY_DIRS = draw translate cso_cache pipebuffer tgsi sct rtasm util indices
 GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
-GALLIUM_DRIVER_DIRS = softpipe i915simple i965simple failover trace
-GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVER_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
+GALLIUM_DRIVERS_DIRS = softpipe i915simple failover trace
+GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
 GALLIUM_WINSYS_DIRS = xlib egl_xlib
 GALLIUM_WINSYS_DRM_DIRS =
 GALLIUM_STATE_TRACKERS_DIRS = glx
@@ -102,6 +102,7 @@ GALLIUM_STATE_TRACKERS_DIRS = glx
 # Library dependencies
 #EXTRA_LIB_PATH ?=
 GL_LIB_DEPS     = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
+EGL_LIB_DEPS    = $(EXTRA_LIB_PATH) -lX11 -ldl
 OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
 GLU_LIB_DEPS    = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
 GLUT_LIB_DEPS   = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lm
@@ -121,6 +122,9 @@ DRI_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/dri
 # Where libGL will look for DRI hardware drivers
 DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
 
+# Xorg driver install directory (for xorg state-tracker)
+XORG_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/xorg/modules/drivers
+
 # pkg-config substitutions
 GL_PC_REQ_PRIV =
 GL_PC_LIB_PRIV =
index 15700a1a3bf4236b75a0df38de5f6ecf035b88c4..73a6b61b2f603f299b3eeb652358196561ae417b 100644 (file)
@@ -22,7 +22,8 @@ DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
 
 X11_INCLUDES = -I/usr/X11R6/include
 
-CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
+CFLAGS = -Wall -Wmissing-prototypes -Wdeclaration-after-statement \
+       $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
        $(DEFINES) $(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math 
 
 CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
index d58a7a6ec728efde094b661143b354b6dc93e937..19d435fecce8c542128a2f02e3797a66904ed1c9 100644 (file)
@@ -6,7 +6,7 @@ CONFIG_NAME = linux-cell
 
 
 # Omiting other gallium drivers:
-GALLIUM_DRIVER_DIRS = cell softpipe trace
+GALLIUM_DRIVERS_DIRS = cell softpipe trace
 
 
 # Compiler and flags
index a9d740574cfed12ce642e020e47e3b0385863dd3..e7ecd826d5310db1a8d10c5143e5ac5e38f4e015 100644 (file)
@@ -22,9 +22,9 @@ endif
 
 ifeq ($(MESA_LLVM),1)
 #  LLVM_CFLAGS=`llvm-config --cflags`
-  LLVM_CXXFLAGS=`llvm-config --cxxflags backend bitreader engine ipo` -Wno-long-long
-  LLVM_LDFLAGS=`llvm-config --ldflags backend bitreader engine ipo`
-  LLVM_LIBS=`llvm-config --libs backend bitreader engine ipo`
+  LLVM_CXXFLAGS=`llvm-config --cxxflags backend bitreader engine ipo interpreter instrumentation` -Wno-long-long
+  LLVM_LDFLAGS=`llvm-config --ldflags backend bitreader engine ipo interpreter instrumentation`
+  LLVM_LIBS=`llvm-config --libs backend bitreader engine ipo interpreter instrumentation`
   MKLIB_OPTIONS=-cplusplus
 else
   LLVM_CFLAGS=
index ea2992d38b0e9643f94318e3686d5d6088059c3d..4164d377ce8c55b4620c7485e635b2764930bf5d 100644 (file)
@@ -87,7 +87,7 @@ dnl Compiler macros
 DEFINES=""
 AC_SUBST([DEFINES])
 case "$host_os" in
-*-gnu*)
+linux*|*-gnu*)
     DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
     ;;
 solaris*)
@@ -307,6 +307,13 @@ if test "x$enable_asm" = xyes; then
             ;;
         esac
         ;;
+    sparc*)
+        case "$host_os" in
+        linux*)
+            asm_arch=sparc
+            ;;
+        esac
+        ;;
     esac
 
     case "$asm_arch" in
@@ -327,6 +334,12 @@ if test "x$enable_asm" = xyes; then
         MESA_ASM_SOURCES='$(PPC_SOURCES)'
         AC_MSG_RESULT([yes, ppc])
         ;;
+    sparc)
+        ASM_FLAGS="-DUSE_SPARC_ASM"
+        MESA_ASM_SOURCES='$(SPARC_SOURCES)'
+        GLAPI_ASM_SOURCES='$(SPARC_API)'
+        AC_MSG_RESULT([yes, sparc])
+        ;;
     *)
         AC_MSG_RESULT([no, platform not supported])
         ;;
@@ -382,7 +395,7 @@ default_driver="xlib"
 case "$host_os" in
 linux*)
     case "$host_cpu" in
-    i*86|x86_64|powerpc*) default_driver="dri";;
+    i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
     esac
     ;;
 *freebsd* | dragonfly*)
@@ -409,14 +422,14 @@ esac
 dnl
 dnl Driver specific build directories
 dnl
-SRC_DIRS="mesa egl"
+SRC_DIRS="mesa egl glew"
 GLU_DIRS="sgi"
 WINDOW_SYSTEM=""
 GALLIUM_DIRS="auxiliary drivers state_trackers"
 GALLIUM_WINSYS_DIRS=""
 GALLIUM_WINSYS_DRM_DIRS=""
 GALLIUM_AUXILIARY_DIRS="draw translate cso_cache pipebuffer tgsi sct rtasm util"
-GALLIUM_DRIVER_DIRS="softpipe failover trace"
+GALLIUM_DRIVERS_DIRS="softpipe failover trace"
 GALLIUM_STATE_TRACKERS_DIRS=""
 
 case "$mesa_driver" in
@@ -428,9 +441,6 @@ dri)
     DRIVER_DIRS="dri"
     WINDOW_SYSTEM="dri"
     GALLIUM_WINSYS_DIRS="drm $GALLIUM_WINSYS_DIRS"
-    GALLIUM_WINSYS_DRM_DIRS="intel"
-    GALLIUM_DRIVER_DIRS="$GALLIUM_DRIVER_DIRS i915simple i965simple"
-    GALLIUM_STATE_TRACKERS_DIRS="egl"
     ;;
 osmesa)
     DRIVER_DIRS="osmesa"
@@ -443,7 +453,7 @@ AC_SUBST([WINDOW_SYSTEM])
 AC_SUBST([GALLIUM_DIRS])
 AC_SUBST([GALLIUM_WINSYS_DIRS])
 AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
-AC_SUBST([GALLIUM_DRIVER_DIRS])
+AC_SUBST([GALLIUM_DRIVERS_DIRS])
 AC_SUBST([GALLIUM_AUXILIARY_DIRS])
 AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
 AC_SUBST([RADEON_CFLAGS])
@@ -867,6 +877,19 @@ AC_SUBST([OSMESA_MESA_DEPS])
 AC_SUBST([OSMESA_PC_REQ])
 AC_SUBST([OSMESA_PC_LIB_PRIV])
 
+dnl
+dnl EGL configuration
+dnl
+if test "$x11_pkgconfig" = yes; then
+    PKG_CHECK_MODULES([EGL],[x11])
+    EGL_LIB_DEPS="$EGL_LIBS"
+else
+    # should check these...
+    EGL_LIB_DEPS="$X_LIBS -lX11"
+fi
+EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS $OS_LIBS"
+AC_SUBST([EGL_LIB_DEPS])
+
 dnl
 dnl GLU configuration
 dnl
@@ -1087,6 +1110,86 @@ if test "x$enable_gallium" = xyes; then
     SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
 fi
 
+dnl
+dnl Gallium state trackers configuration
+dnl
+AC_ARG_WITH([state-trackers],
+    [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
+        [comma delimited state_trackers list, e.g.
+        "egl,glx" @<:@default=auto@:>@])],
+    [with_state_trackers="$withval"],
+    [with_state_trackers=yes])
+
+case "$with_state_trackers" in
+no)
+    GALLIUM_STATE_TRACKERS_DIRS=""
+    ;;
+yes)
+    # look at what else is built
+    case "$mesa_driver" in
+    dri)
+        GALLIUM_STATE_TRACKERS_DIRS=egl
+        ;;
+    esac
+    ;;
+*)
+    # verify the requested state tracker exist
+    state_trackers=`IFS=', '; echo $with_state_trackers`
+    for tracker in $state_trackers; do
+        test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
+            AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
+    done
+    GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
+    ;;
+esac
+
+AC_ARG_WITH([xorg-driver-dir],
+    [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
+                    [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
+    [XORG_DRIVER_INSTALL_DIR="$withval"],
+    [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
+AC_SUBST([XORG_DRIVER_INSTALL_DIR])
+
+dnl
+dnl Gallium Intel configuration
+dnl
+AC_ARG_ENABLE([gallium-intel],
+    [AS_HELP_STRING([--disable-gallium-intel],
+        [build gallium intel @<:@default=enabled@:>@])],
+    [enable_gallium_intel="$enableval"],
+    [enable_gallium_intel=yes])
+if test "x$enable_gallium_intel" = xyes; then
+    GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel"
+    GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915simple"
+fi
+
+dnl
+dnl Gallium Radeon configuration
+dnl
+AC_ARG_ENABLE([gallium-radeon],
+    [AS_HELP_STRING([--enable-gallium-radeon],
+        [build gallium radeon @<:@default=disabled@:>@])],
+    [enable_gallium_radeon="$enableval"],
+    [enable_gallium_radeon=no])
+if test "x$enable_gallium_radeon" = xyes; then
+    GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
+    GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
+fi
+
+dnl
+dnl Gallium Radeon configuration
+dnl
+AC_ARG_ENABLE([gallium-nouveau],
+    [AS_HELP_STRING([--enable-gallium-nouveau],
+        [build gallium nouveau @<:@default=disabled@:>@])],
+    [enable_gallium_nouveau="$enableval"],
+    [enable_gallium_nouveau=no])
+if test "x$enable_gallium_nouveau" = xyes; then
+    GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
+    GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nv04 nv10 nv20 nv30 nv40 nv50"
+fi
+
+
 dnl Restore LDFLAGS and CPPFLAGS
 LDFLAGS="$_SAVE_LDFLAGS"
 CPPFLAGS="$_SAVE_CPPFLAGS"
@@ -1138,9 +1241,9 @@ if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
     echo "        Gallium:         yes"
     echo "        Gallium dirs:    $GALLIUM_DIRS"
     echo "        Winsys dirs:     $GALLIUM_WINSYS_DIRS"
-    echo "        Winsys drm dirs: $GALLIUM_WINSYS_DRM_DIRS"
+    echo "        Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
     echo "        Auxiliary dirs:  $GALLIUM_AUXILIARY_DIRS"
-    echo "        Driver dirs:     $GALLIUM_DRIVER_DIRS"
+    echo "        Driver dirs:     $GALLIUM_DRIVERS_DIRS"
     echo "        Trackers dirs:   $GALLIUM_STATE_TRACKERS_DIRS"
 else
     echo "        Gallium:         no"
index 1f7d42ac91446e6fa3d1e8b62cff58756c7922db..fab92abc76281fedbd025ff994113cbe740f33a0 100644 (file)
@@ -13,7 +13,7 @@ Contact
 
 Status
 
-    XXX - Not complete yet!!!
+    Obsolete.
 
 Version
 
index 621bd4afacf03254bbe265d3e8960751b218c131..f29553b0fb2d4205fc2088e6851849982ef8a26c 100644 (file)
@@ -39,6 +39,7 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
 <li>GL_EXT_vertex_array_bgra extension (software drivers, i965 driver)
 <li>GL_NV_texture_env_combine4 extension (software drivers, i965/i915 drivers)
 <li>GL_EXT_texture_swizzle extension (software drivers, i965 driver)
+<li>Updated SPARC assembly optimizations (David S. Miller)
 </ul>
 
 
index 02c3b94bd8af284bf8a638f4329cc4ae9e0f4577..d873428d756e5fa96f74a7cef5410ca38b817f99 100644 (file)
@@ -68,7 +68,7 @@ typedef HWND  NativeWindowType;
 typedef HBITMAP NativePixmapType;
 /** END Added for Windows **/
 
-#elif defined(__gnu_linux__)
+#elif defined(__gnu_linux__) || defined(__FreeBSD__)
 
 /** BEGIN Added for X (Mesa) **/
 #ifndef EGLAPI
index c9ef6136fab32b5ce567e62911713338d99c68f0..aad51214fbeae31ea795adc75c2746d8c2c7c416 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.1
+ * Version:  7.5
  *
  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
  *
index 1dcd4a895b8543876b940020f6a9ef15abe691a4..639d7bb7a40f50c508b55f38e42fa3736bad5d18 100644 (file)
 #define glAsyncMarkerSGIX              MANGLE(AsyncMarkerSGIX)
 #define glAttachObjectARB              MANGLE(AttachObjectARB)
 #define glAttachShader         MANGLE(AttachShader)
+#define glBeginConditionalRender               MANGLE(BeginConditionalRender)
+#define glBeginConditionalRenderNV             MANGLE(BeginConditionalRenderNV)
 #define glBeginFragmentShaderATI               MANGLE(BeginFragmentShaderATI)
 #define glBegin                MANGLE(Begin)
 #define glBeginOcclusionQueryNV                MANGLE(BeginOcclusionQueryNV)
 #define glBeginQueryARB                MANGLE(BeginQueryARB)
 #define glBeginQuery           MANGLE(BeginQuery)
+#define glBeginTransformFeedbackEXT            MANGLE(BeginTransformFeedbackEXT)
+#define glBeginTransformFeedback               MANGLE(BeginTransformFeedback)
 #define glBeginTransformFeedbackNV             MANGLE(BeginTransformFeedbackNV)
 #define glBeginVertexShaderEXT         MANGLE(BeginVertexShaderEXT)
 #define glBindAttribLocationARB                MANGLE(BindAttribLocationARB)
 #define glBindAttribLocation           MANGLE(BindAttribLocation)
 #define glBindBufferARB                MANGLE(BindBufferARB)
+#define glBindBufferBaseEXT            MANGLE(BindBufferBaseEXT)
+#define glBindBufferBase               MANGLE(BindBufferBase)
 #define glBindBufferBaseNV             MANGLE(BindBufferBaseNV)
 #define glBindBuffer           MANGLE(BindBuffer)
+#define glBindBufferOffsetEXT          MANGLE(BindBufferOffsetEXT)
 #define glBindBufferOffsetNV           MANGLE(BindBufferOffsetNV)
+#define glBindBufferRangeEXT           MANGLE(BindBufferRangeEXT)
+#define glBindBufferRange              MANGLE(BindBufferRange)
 #define glBindBufferRangeNV            MANGLE(BindBufferRangeNV)
 #define glBindFragDataLocationEXT              MANGLE(BindFragDataLocationEXT)
+#define glBindFragDataLocation         MANGLE(BindFragDataLocation)
 #define glBindFragmentShaderATI                MANGLE(BindFragmentShaderATI)
 #define glBindFramebufferEXT           MANGLE(BindFramebufferEXT)
+#define glBindFramebuffer              MANGLE(BindFramebuffer)
 #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 glBindRenderbufferEXT          MANGLE(BindRenderbufferEXT)
+#define glBindRenderbuffer             MANGLE(BindRenderbuffer)
 #define glBindTexGenParameterEXT               MANGLE(BindTexGenParameterEXT)
 #define glBindTextureEXT               MANGLE(BindTextureEXT)
 #define glBindTexture          MANGLE(BindTexture)
 #define glBindTextureUnitParameterEXT          MANGLE(BindTextureUnitParameterEXT)
+#define glBindTransformFeedbackNV              MANGLE(BindTransformFeedbackNV)
 #define glBindVertexArrayAPPLE         MANGLE(BindVertexArrayAPPLE)
+#define glBindVertexArray              MANGLE(BindVertexArray)
 #define glBindVertexShaderEXT          MANGLE(BindVertexShaderEXT)
 #define glBinormal3bEXT                MANGLE(Binormal3bEXT)
 #define glBinormal3bvEXT               MANGLE(Binormal3bvEXT)
 #define glBlendFuncSeparateINGR                MANGLE(BlendFuncSeparateINGR)
 #define glBlendFuncSeparate            MANGLE(BlendFuncSeparate)
 #define glBlitFramebufferEXT           MANGLE(BlitFramebufferEXT)
+#define glBlitFramebuffer              MANGLE(BlitFramebuffer)
 #define glBufferDataARB                MANGLE(BufferDataARB)
 #define glBufferData           MANGLE(BufferData)
 #define glBufferParameteriAPPLE                MANGLE(BufferParameteriAPPLE)
 #define glCallList             MANGLE(CallList)
 #define glCallLists            MANGLE(CallLists)
 #define glCheckFramebufferStatusEXT            MANGLE(CheckFramebufferStatusEXT)
+#define glCheckFramebufferStatus               MANGLE(CheckFramebufferStatus)
+#define glCheckNamedFramebufferStatusEXT               MANGLE(CheckNamedFramebufferStatusEXT)
 #define glClampColorARB                MANGLE(ClampColorARB)
+#define glClampColor           MANGLE(ClampColor)
 #define glClearAccum           MANGLE(ClearAccum)
+#define glClearBufferfi                MANGLE(ClearBufferfi)
+#define glClearBufferfv                MANGLE(ClearBufferfv)
+#define glClearBufferiv                MANGLE(ClearBufferiv)
+#define glClearBufferuiv               MANGLE(ClearBufferuiv)
 #define glClearColorIiEXT              MANGLE(ClearColorIiEXT)
 #define glClearColorIuiEXT             MANGLE(ClearColorIuiEXT)
 #define glClearColor           MANGLE(ClearColor)
 #define glClientActiveTextureARB               MANGLE(ClientActiveTextureARB)
 #define glClientActiveTexture          MANGLE(ClientActiveTexture)
 #define glClientActiveVertexStreamATI          MANGLE(ClientActiveVertexStreamATI)
+#define glClientAttribDefaultEXT               MANGLE(ClientAttribDefaultEXT)
 #define glClipPlane            MANGLE(ClipPlane)
 #define glColor3b              MANGLE(Color3b)
 #define glColor3bv             MANGLE(Color3bv)
 #define glColorFragmentOp1ATI          MANGLE(ColorFragmentOp1ATI)
 #define glColorFragmentOp2ATI          MANGLE(ColorFragmentOp2ATI)
 #define glColorFragmentOp3ATI          MANGLE(ColorFragmentOp3ATI)
+#define glColorMaski           MANGLE(ColorMaski)
 #define glColorMaskIndexedEXT          MANGLE(ColorMaskIndexedEXT)
 #define glColorMask            MANGLE(ColorMask)
 #define glColorMaterial                MANGLE(ColorMaterial)
 #define glCombinerStageParameterfvNV           MANGLE(CombinerStageParameterfvNV)
 #define glCompileShaderARB             MANGLE(CompileShaderARB)
 #define glCompileShader                MANGLE(CompileShader)
+#define glCompressedMultiTexImage1DEXT         MANGLE(CompressedMultiTexImage1DEXT)
+#define glCompressedMultiTexImage2DEXT         MANGLE(CompressedMultiTexImage2DEXT)
+#define glCompressedMultiTexImage3DEXT         MANGLE(CompressedMultiTexImage3DEXT)
+#define glCompressedMultiTexSubImage1DEXT              MANGLE(CompressedMultiTexSubImage1DEXT)
+#define glCompressedMultiTexSubImage2DEXT              MANGLE(CompressedMultiTexSubImage2DEXT)
+#define glCompressedMultiTexSubImage3DEXT              MANGLE(CompressedMultiTexSubImage3DEXT)
 #define glCompressedTexImage1DARB              MANGLE(CompressedTexImage1DARB)
 #define glCompressedTexImage1D         MANGLE(CompressedTexImage1D)
 #define glCompressedTexImage2DARB              MANGLE(CompressedTexImage2DARB)
 #define glCompressedTexSubImage2D              MANGLE(CompressedTexSubImage2D)
 #define glCompressedTexSubImage3DARB           MANGLE(CompressedTexSubImage3DARB)
 #define glCompressedTexSubImage3D              MANGLE(CompressedTexSubImage3D)
+#define glCompressedTextureImage1DEXT          MANGLE(CompressedTextureImage1DEXT)
+#define glCompressedTextureImage2DEXT          MANGLE(CompressedTextureImage2DEXT)
+#define glCompressedTextureImage3DEXT          MANGLE(CompressedTextureImage3DEXT)
+#define glCompressedTextureSubImage1DEXT               MANGLE(CompressedTextureSubImage1DEXT)
+#define glCompressedTextureSubImage2DEXT               MANGLE(CompressedTextureSubImage2DEXT)
+#define glCompressedTextureSubImage3DEXT               MANGLE(CompressedTextureSubImage3DEXT)
 #define glConvolutionFilter1DEXT               MANGLE(ConvolutionFilter1DEXT)
 #define glConvolutionFilter1D          MANGLE(ConvolutionFilter1D)
 #define glConvolutionFilter2DEXT               MANGLE(ConvolutionFilter2DEXT)
 #define glCopyConvolutionFilter1D              MANGLE(CopyConvolutionFilter1D)
 #define glCopyConvolutionFilter2DEXT           MANGLE(CopyConvolutionFilter2DEXT)
 #define glCopyConvolutionFilter2D              MANGLE(CopyConvolutionFilter2D)
+#define glCopyMultiTexImage1DEXT               MANGLE(CopyMultiTexImage1DEXT)
+#define glCopyMultiTexImage2DEXT               MANGLE(CopyMultiTexImage2DEXT)
+#define glCopyMultiTexSubImage1DEXT            MANGLE(CopyMultiTexSubImage1DEXT)
+#define glCopyMultiTexSubImage2DEXT            MANGLE(CopyMultiTexSubImage2DEXT)
+#define glCopyMultiTexSubImage3DEXT            MANGLE(CopyMultiTexSubImage3DEXT)
 #define glCopyPixels           MANGLE(CopyPixels)
 #define glCopyTexImage1DEXT            MANGLE(CopyTexImage1DEXT)
 #define glCopyTexImage1D               MANGLE(CopyTexImage1D)
 #define glCopyTexSubImage2D            MANGLE(CopyTexSubImage2D)
 #define glCopyTexSubImage3DEXT         MANGLE(CopyTexSubImage3DEXT)
 #define glCopyTexSubImage3D            MANGLE(CopyTexSubImage3D)
+#define glCopyTextureImage1DEXT                MANGLE(CopyTextureImage1DEXT)
+#define glCopyTextureImage2DEXT                MANGLE(CopyTextureImage2DEXT)
+#define glCopyTextureSubImage1DEXT             MANGLE(CopyTextureSubImage1DEXT)
+#define glCopyTextureSubImage2DEXT             MANGLE(CopyTextureSubImage2DEXT)
+#define glCopyTextureSubImage3DEXT             MANGLE(CopyTextureSubImage3DEXT)
 #define glCreateDebugObjectMESA                MANGLE(CreateDebugObjectMESA)
 #define glCreateProgram                MANGLE(CreateProgram)
 #define glCreateProgramObjectARB               MANGLE(CreateProgramObjectARB)
 #define glDeleteFencesNV               MANGLE(DeleteFencesNV)
 #define glDeleteFragmentShaderATI              MANGLE(DeleteFragmentShaderATI)
 #define glDeleteFramebuffersEXT                MANGLE(DeleteFramebuffersEXT)
+#define glDeleteFramebuffers           MANGLE(DeleteFramebuffers)
 #define glDeleteLists          MANGLE(DeleteLists)
 #define glDeleteObjectARB              MANGLE(DeleteObjectARB)
 #define glDeleteOcclusionQueriesNV             MANGLE(DeleteOcclusionQueriesNV)
 #define glDeleteQueriesARB             MANGLE(DeleteQueriesARB)
 #define glDeleteQueries                MANGLE(DeleteQueries)
 #define glDeleteRenderbuffersEXT               MANGLE(DeleteRenderbuffersEXT)
+#define glDeleteRenderbuffers          MANGLE(DeleteRenderbuffers)
 #define glDeleteShader         MANGLE(DeleteShader)
 #define glDeleteTexturesEXT            MANGLE(DeleteTexturesEXT)
 #define glDeleteTextures               MANGLE(DeleteTextures)
+#define glDeleteTransformFeedbacksNV           MANGLE(DeleteTransformFeedbacksNV)
 #define glDeleteVertexArraysAPPLE              MANGLE(DeleteVertexArraysAPPLE)
+#define glDeleteVertexArrays           MANGLE(DeleteVertexArrays)
 #define glDeleteVertexShaderEXT                MANGLE(DeleteVertexShaderEXT)
 #define glDepthBoundsdNV               MANGLE(DepthBoundsdNV)
 #define glDepthBoundsEXT               MANGLE(DepthBoundsEXT)
 #define glDetachObjectARB              MANGLE(DetachObjectARB)
 #define glDetachShader         MANGLE(DetachShader)
 #define glDetailTexFuncSGIS            MANGLE(DetailTexFuncSGIS)
+#define glDisableClientStateIndexedEXT         MANGLE(DisableClientStateIndexedEXT)
 #define glDisableClientState           MANGLE(DisableClientState)
+#define glDisablei             MANGLE(Disablei)
 #define glDisableIndexedEXT            MANGLE(DisableIndexedEXT)
 #define glDisable              MANGLE(Disable)
 #define glDisableVariantClientStateEXT         MANGLE(DisableVariantClientStateEXT)
 #define glDisableVertexAttribArrayARB          MANGLE(DisableVertexAttribArrayARB)
 #define glDisableVertexAttribArray             MANGLE(DisableVertexAttribArray)
 #define glDrawArraysEXT                MANGLE(DrawArraysEXT)
+#define glDrawArraysInstancedARB               MANGLE(DrawArraysInstancedARB)
 #define glDrawArraysInstancedEXT               MANGLE(DrawArraysInstancedEXT)
 #define glDrawArrays           MANGLE(DrawArrays)
 #define glDrawBuffer           MANGLE(DrawBuffer)
 #define glDrawBuffers          MANGLE(DrawBuffers)
 #define glDrawElementArrayAPPLE                MANGLE(DrawElementArrayAPPLE)
 #define glDrawElementArrayATI          MANGLE(DrawElementArrayATI)
+#define glDrawElementsInstancedARB             MANGLE(DrawElementsInstancedARB)
 #define glDrawElementsInstancedEXT             MANGLE(DrawElementsInstancedEXT)
 #define glDrawElements         MANGLE(DrawElements)
 #define glDrawMeshArraysSUN            MANGLE(DrawMeshArraysSUN)
 #define glDrawRangeElementArrayATI             MANGLE(DrawRangeElementArrayATI)
 #define glDrawRangeElementsEXT         MANGLE(DrawRangeElementsEXT)
 #define glDrawRangeElements            MANGLE(DrawRangeElements)
+#define glDrawTransformFeedbackNV              MANGLE(DrawTransformFeedbackNV)
 #define glEdgeFlag             MANGLE(EdgeFlag)
 #define glEdgeFlagPointerEXT           MANGLE(EdgeFlagPointerEXT)
 #define glEdgeFlagPointerListIBM               MANGLE(EdgeFlagPointerListIBM)
 #define glEdgeFlagv            MANGLE(EdgeFlagv)
 #define glElementPointerAPPLE          MANGLE(ElementPointerAPPLE)
 #define glElementPointerATI            MANGLE(ElementPointerATI)
+#define glEnableClientStateIndexedEXT          MANGLE(EnableClientStateIndexedEXT)
 #define glEnableClientState            MANGLE(EnableClientState)
+#define glEnablei              MANGLE(Enablei)
 #define glEnableIndexedEXT             MANGLE(EnableIndexedEXT)
 #define glEnable               MANGLE(Enable)
 #define glEnableVariantClientStateEXT          MANGLE(EnableVariantClientStateEXT)
 #define glEnableVertexAttribArrayARB           MANGLE(EnableVertexAttribArrayARB)
 #define glEnableVertexAttribArray              MANGLE(EnableVertexAttribArray)
+#define glEndConditionalRender         MANGLE(EndConditionalRender)
+#define glEndConditionalRenderNV               MANGLE(EndConditionalRenderNV)
 #define glEndFragmentShaderATI         MANGLE(EndFragmentShaderATI)
 #define glEndList              MANGLE(EndList)
 #define glEnd          MANGLE(End)
 #define glEndOcclusionQueryNV          MANGLE(EndOcclusionQueryNV)
 #define glEndQueryARB          MANGLE(EndQueryARB)
 #define glEndQuery             MANGLE(EndQuery)
+#define glEndTransformFeedbackEXT              MANGLE(EndTransformFeedbackEXT)
+#define glEndTransformFeedback         MANGLE(EndTransformFeedback)
 #define glEndTransformFeedbackNV               MANGLE(EndTransformFeedbackNV)
 #define glEndVertexShaderEXT           MANGLE(EndVertexShaderEXT)
 #define glEvalCoord1d          MANGLE(EvalCoord1d)
 #define glFinishTextureSUNX            MANGLE(FinishTextureSUNX)
 #define glFlush                MANGLE(Flush)
 #define glFlushMappedBufferRangeAPPLE          MANGLE(FlushMappedBufferRangeAPPLE)
+#define glFlushMappedBufferRange               MANGLE(FlushMappedBufferRange)
 #define glFlushPixelDataRangeNV                MANGLE(FlushPixelDataRangeNV)
 #define glFlushRasterSGIX              MANGLE(FlushRasterSGIX)
 #define glFlushVertexArrayRangeAPPLE           MANGLE(FlushVertexArrayRangeAPPLE)
 #define glFragmentMaterialfvSGIX               MANGLE(FragmentMaterialfvSGIX)
 #define glFragmentMaterialiSGIX                MANGLE(FragmentMaterialiSGIX)
 #define glFragmentMaterialivSGIX               MANGLE(FragmentMaterialivSGIX)
+#define glFramebufferDrawBufferEXT             MANGLE(FramebufferDrawBufferEXT)
+#define glFramebufferDrawBuffersEXT            MANGLE(FramebufferDrawBuffersEXT)
+#define glFramebufferReadBufferEXT             MANGLE(FramebufferReadBufferEXT)
 #define glFramebufferRenderbufferEXT           MANGLE(FramebufferRenderbufferEXT)
+#define glFramebufferRenderbuffer              MANGLE(FramebufferRenderbuffer)
 #define glFramebufferTexture1DEXT              MANGLE(FramebufferTexture1DEXT)
+#define glFramebufferTexture1D         MANGLE(FramebufferTexture1D)
 #define glFramebufferTexture2DEXT              MANGLE(FramebufferTexture2DEXT)
+#define glFramebufferTexture2D         MANGLE(FramebufferTexture2D)
 #define glFramebufferTexture3DEXT              MANGLE(FramebufferTexture3DEXT)
+#define glFramebufferTexture3D         MANGLE(FramebufferTexture3D)
+#define glFramebufferTextureARB                MANGLE(FramebufferTextureARB)
 #define glFramebufferTextureEXT                MANGLE(FramebufferTextureEXT)
+#define glFramebufferTextureFaceARB            MANGLE(FramebufferTextureFaceARB)
 #define glFramebufferTextureFaceEXT            MANGLE(FramebufferTextureFaceEXT)
+#define glFramebufferTextureLayerARB           MANGLE(FramebufferTextureLayerARB)
 #define glFramebufferTextureLayerEXT           MANGLE(FramebufferTextureLayerEXT)
+#define glFramebufferTextureLayer              MANGLE(FramebufferTextureLayer)
+#define glFrameTerminatorGREMEDY               MANGLE(FrameTerminatorGREMEDY)
 #define glFrameZoomSGIX                MANGLE(FrameZoomSGIX)
 #define glFreeObjectBufferATI          MANGLE(FreeObjectBufferATI)
 #define glFrontFace            MANGLE(FrontFace)
 #define glGenBuffersARB                MANGLE(GenBuffersARB)
 #define glGenBuffers           MANGLE(GenBuffers)
 #define glGenerateMipmapEXT            MANGLE(GenerateMipmapEXT)
+#define glGenerateMipmap               MANGLE(GenerateMipmap)
+#define glGenerateMultiTexMipmapEXT            MANGLE(GenerateMultiTexMipmapEXT)
+#define glGenerateTextureMipmapEXT             MANGLE(GenerateTextureMipmapEXT)
 #define glGenFencesAPPLE               MANGLE(GenFencesAPPLE)
 #define glGenFencesNV          MANGLE(GenFencesNV)
 #define glGenFragmentShadersATI                MANGLE(GenFragmentShadersATI)
 #define glGenFramebuffersEXT           MANGLE(GenFramebuffersEXT)
+#define glGenFramebuffers              MANGLE(GenFramebuffers)
 #define glGenLists             MANGLE(GenLists)
 #define glGenOcclusionQueriesNV                MANGLE(GenOcclusionQueriesNV)
 #define glGenProgramsARB               MANGLE(GenProgramsARB)
 #define glGenQueriesARB                MANGLE(GenQueriesARB)
 #define glGenQueries           MANGLE(GenQueries)
 #define glGenRenderbuffersEXT          MANGLE(GenRenderbuffersEXT)
+#define glGenRenderbuffers             MANGLE(GenRenderbuffers)
 #define glGenSymbolsEXT                MANGLE(GenSymbolsEXT)
 #define glGenTexturesEXT               MANGLE(GenTexturesEXT)
 #define glGenTextures          MANGLE(GenTextures)
+#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 glGetAttribLocationARB         MANGLE(GetAttribLocationARB)
 #define glGetAttribLocation            MANGLE(GetAttribLocation)
 #define glGetBooleanIndexedvEXT                MANGLE(GetBooleanIndexedvEXT)
+#define glGetBooleani_v                MANGLE(GetBooleani_v)
 #define glGetBooleanv          MANGLE(GetBooleanv)
 #define glGetBufferParameterivARB              MANGLE(GetBufferParameterivARB)
 #define glGetBufferParameteriv         MANGLE(GetBufferParameteriv)
 #define glGetCombinerOutputParameterfvNV               MANGLE(GetCombinerOutputParameterfvNV)
 #define glGetCombinerOutputParameterivNV               MANGLE(GetCombinerOutputParameterivNV)
 #define glGetCombinerStageParameterfvNV                MANGLE(GetCombinerStageParameterfvNV)
+#define glGetCompressedMultiTexImageEXT                MANGLE(GetCompressedMultiTexImageEXT)
 #define glGetCompressedTexImageARB             MANGLE(GetCompressedTexImageARB)
 #define glGetCompressedTexImage                MANGLE(GetCompressedTexImage)
+#define glGetCompressedTextureImageEXT         MANGLE(GetCompressedTextureImageEXT)
 #define glGetConvolutionFilterEXT              MANGLE(GetConvolutionFilterEXT)
 #define glGetConvolutionFilter         MANGLE(GetConvolutionFilter)
 #define glGetConvolutionParameterfvEXT         MANGLE(GetConvolutionParameterfvEXT)
 #define glGetDebugLogLengthMESA                MANGLE(GetDebugLogLengthMESA)
 #define glGetDebugLogMESA              MANGLE(GetDebugLogMESA)
 #define glGetDetailTexFuncSGIS         MANGLE(GetDetailTexFuncSGIS)
+#define glGetDoubleIndexedvEXT         MANGLE(GetDoubleIndexedvEXT)
 #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 glGetFloatv            MANGLE(GetFloatv)
 #define glGetFogFuncSGIS               MANGLE(GetFogFuncSGIS)
 #define glGetFragDataLocationEXT               MANGLE(GetFragDataLocationEXT)
+#define glGetFragDataLocation          MANGLE(GetFragDataLocation)
 #define glGetFragmentLightfvSGIX               MANGLE(GetFragmentLightfvSGIX)
 #define glGetFragmentLightivSGIX               MANGLE(GetFragmentLightivSGIX)
 #define glGetFragmentMaterialfvSGIX            MANGLE(GetFragmentMaterialfvSGIX)
 #define glGetFragmentMaterialivSGIX            MANGLE(GetFragmentMaterialivSGIX)
 #define glGetFramebufferAttachmentParameterivEXT               MANGLE(GetFramebufferAttachmentParameterivEXT)
+#define glGetFramebufferAttachmentParameteriv          MANGLE(GetFramebufferAttachmentParameteriv)
+#define glGetFramebufferParameterivEXT         MANGLE(GetFramebufferParameterivEXT)
 #define glGetHandleARB         MANGLE(GetHandleARB)
 #define glGetHistogramEXT              MANGLE(GetHistogramEXT)
 #define glGetHistogram         MANGLE(GetHistogram)
 #define glGetInfoLogARB                MANGLE(GetInfoLogARB)
 #define glGetInstrumentsSGIX           MANGLE(GetInstrumentsSGIX)
 #define glGetIntegerIndexedvEXT                MANGLE(GetIntegerIndexedvEXT)
+#define glGetIntegeri_v                MANGLE(GetIntegeri_v)
 #define glGetIntegerv          MANGLE(GetIntegerv)
 #define glGetInvariantBooleanvEXT              MANGLE(GetInvariantBooleanvEXT)
 #define glGetInvariantFloatvEXT                MANGLE(GetInvariantFloatvEXT)
 #define glGetMinmaxParameterfv         MANGLE(GetMinmaxParameterfv)
 #define glGetMinmaxParameterivEXT              MANGLE(GetMinmaxParameterivEXT)
 #define glGetMinmaxParameteriv         MANGLE(GetMinmaxParameteriv)
+#define glGetMultisamplefvNV           MANGLE(GetMultisamplefvNV)
+#define glGetMultiTexEnvfvEXT          MANGLE(GetMultiTexEnvfvEXT)
+#define glGetMultiTexEnvivEXT          MANGLE(GetMultiTexEnvivEXT)
+#define glGetMultiTexGendvEXT          MANGLE(GetMultiTexGendvEXT)
+#define glGetMultiTexGenfvEXT          MANGLE(GetMultiTexGenfvEXT)
+#define glGetMultiTexGenivEXT          MANGLE(GetMultiTexGenivEXT)
+#define glGetMultiTexImageEXT          MANGLE(GetMultiTexImageEXT)
+#define glGetMultiTexLevelParameterfvEXT               MANGLE(GetMultiTexLevelParameterfvEXT)
+#define glGetMultiTexLevelParameterivEXT               MANGLE(GetMultiTexLevelParameterivEXT)
+#define glGetMultiTexParameterfvEXT            MANGLE(GetMultiTexParameterfvEXT)
+#define glGetMultiTexParameterIivEXT           MANGLE(GetMultiTexParameterIivEXT)
+#define glGetMultiTexParameterIuivEXT          MANGLE(GetMultiTexParameterIuivEXT)
+#define glGetMultiTexParameterivEXT            MANGLE(GetMultiTexParameterivEXT)
+#define glGetNamedBufferParameterivEXT         MANGLE(GetNamedBufferParameterivEXT)
+#define glGetNamedBufferPointervEXT            MANGLE(GetNamedBufferPointervEXT)
+#define glGetNamedBufferSubDataEXT             MANGLE(GetNamedBufferSubDataEXT)
+#define glGetNamedFramebufferAttachmentParameterivEXT          MANGLE(GetNamedFramebufferAttachmentParameterivEXT)
+#define glGetNamedProgramivEXT         MANGLE(GetNamedProgramivEXT)
+#define glGetNamedProgramLocalParameterdvEXT           MANGLE(GetNamedProgramLocalParameterdvEXT)
+#define glGetNamedProgramLocalParameterfvEXT           MANGLE(GetNamedProgramLocalParameterfvEXT)
+#define glGetNamedProgramLocalParameterIivEXT          MANGLE(GetNamedProgramLocalParameterIivEXT)
+#define glGetNamedProgramLocalParameterIuivEXT         MANGLE(GetNamedProgramLocalParameterIuivEXT)
+#define glGetNamedProgramStringEXT             MANGLE(GetNamedProgramStringEXT)
+#define glGetNamedRenderbufferParameterivEXT           MANGLE(GetNamedRenderbufferParameterivEXT)
 #define glGetObjectBufferfvATI         MANGLE(GetObjectBufferfvATI)
 #define glGetObjectBufferivATI         MANGLE(GetObjectBufferivATI)
 #define glGetObjectParameterfvARB              MANGLE(GetObjectParameterfvARB)
 #define glGetPixelMapusv               MANGLE(GetPixelMapusv)
 #define glGetPixelTexGenParameterfvSGIS                MANGLE(GetPixelTexGenParameterfvSGIS)
 #define glGetPixelTexGenParameterivSGIS                MANGLE(GetPixelTexGenParameterivSGIS)
+#define glGetPointerIndexedvEXT                MANGLE(GetPointerIndexedvEXT)
 #define glGetPointervEXT               MANGLE(GetPointervEXT)
 #define glGetPointerv          MANGLE(GetPointerv)
 #define glGetPolygonStipple            MANGLE(GetPolygonStipple)
 #define glGetQueryObjectuivARB         MANGLE(GetQueryObjectuivARB)
 #define glGetQueryObjectuiv            MANGLE(GetQueryObjectuiv)
 #define glGetRenderbufferParameterivEXT                MANGLE(GetRenderbufferParameterivEXT)
+#define glGetRenderbufferParameteriv           MANGLE(GetRenderbufferParameteriv)
 #define glGetSeparableFilterEXT                MANGLE(GetSeparableFilterEXT)
 #define glGetSeparableFilter           MANGLE(GetSeparableFilter)
 #define glGetShaderInfoLog             MANGLE(GetShaderInfoLog)
 #define glGetShaderSourceARB           MANGLE(GetShaderSourceARB)
 #define glGetShaderSource              MANGLE(GetShaderSource)
 #define glGetSharpenTexFuncSGIS                MANGLE(GetSharpenTexFuncSGIS)
+#define glGetStringi           MANGLE(GetStringi)
 #define glGetString            MANGLE(GetString)
 #define glGetTexBumpParameterfvATI             MANGLE(GetTexBumpParameterfvATI)
 #define glGetTexBumpParameterivATI             MANGLE(GetTexBumpParameterivATI)
 #define glGetTexLevelParameteriv               MANGLE(GetTexLevelParameteriv)
 #define glGetTexParameterfv            MANGLE(GetTexParameterfv)
 #define glGetTexParameterIivEXT                MANGLE(GetTexParameterIivEXT)
+#define glGetTexParameterIiv           MANGLE(GetTexParameterIiv)
 #define glGetTexParameterIuivEXT               MANGLE(GetTexParameterIuivEXT)
+#define glGetTexParameterIuiv          MANGLE(GetTexParameterIuiv)
 #define glGetTexParameteriv            MANGLE(GetTexParameteriv)
+#define glGetTextureImageEXT           MANGLE(GetTextureImageEXT)
+#define glGetTextureLevelParameterfvEXT                MANGLE(GetTextureLevelParameterfvEXT)
+#define glGetTextureLevelParameterivEXT                MANGLE(GetTextureLevelParameterivEXT)
+#define glGetTextureParameterfvEXT             MANGLE(GetTextureParameterfvEXT)
+#define glGetTextureParameterIivEXT            MANGLE(GetTextureParameterIivEXT)
+#define glGetTextureParameterIuivEXT           MANGLE(GetTextureParameterIuivEXT)
+#define glGetTextureParameterivEXT             MANGLE(GetTextureParameterivEXT)
 #define glGetTrackMatrixivNV           MANGLE(GetTrackMatrixivNV)
+#define glGetTransformFeedbackVaryingEXT               MANGLE(GetTransformFeedbackVaryingEXT)
+#define glGetTransformFeedbackVarying          MANGLE(GetTransformFeedbackVarying)
 #define glGetTransformFeedbackVaryingNV                MANGLE(GetTransformFeedbackVaryingNV)
 #define glGetUniformBufferSizeEXT              MANGLE(GetUniformBufferSizeEXT)
 #define glGetUniformfvARB              MANGLE(GetUniformfvARB)
 #define glGetUniformLocation           MANGLE(GetUniformLocation)
 #define glGetUniformOffsetEXT          MANGLE(GetUniformOffsetEXT)
 #define glGetUniformuivEXT             MANGLE(GetUniformuivEXT)
+#define glGetUniformuiv                MANGLE(GetUniformuiv)
 #define glGetVariantArrayObjectfvATI           MANGLE(GetVariantArrayObjectfvATI)
 #define glGetVariantArrayObjectivATI           MANGLE(GetVariantArrayObjectivATI)
 #define glGetVariantBooleanvEXT                MANGLE(GetVariantBooleanvEXT)
 #define glGetVertexAttribfv            MANGLE(GetVertexAttribfv)
 #define glGetVertexAttribfvNV          MANGLE(GetVertexAttribfvNV)
 #define glGetVertexAttribIivEXT                MANGLE(GetVertexAttribIivEXT)
+#define glGetVertexAttribIiv           MANGLE(GetVertexAttribIiv)
 #define glGetVertexAttribIuivEXT               MANGLE(GetVertexAttribIuivEXT)
+#define glGetVertexAttribIuiv          MANGLE(GetVertexAttribIuiv)
 #define glGetVertexAttribivARB         MANGLE(GetVertexAttribivARB)
 #define glGetVertexAttribiv            MANGLE(GetVertexAttribiv)
 #define glGetVertexAttribivNV          MANGLE(GetVertexAttribivNV)
 #define glIsAsyncMarkerSGIX            MANGLE(IsAsyncMarkerSGIX)
 #define glIsBufferARB          MANGLE(IsBufferARB)
 #define glIsBuffer             MANGLE(IsBuffer)
+#define glIsEnabledi           MANGLE(IsEnabledi)
 #define glIsEnabledIndexedEXT          MANGLE(IsEnabledIndexedEXT)
 #define glIsEnabled            MANGLE(IsEnabled)
 #define glIsFenceAPPLE         MANGLE(IsFenceAPPLE)
 #define glIsFenceNV            MANGLE(IsFenceNV)
 #define glIsFramebufferEXT             MANGLE(IsFramebufferEXT)
+#define glIsFramebuffer                MANGLE(IsFramebuffer)
 #define glIsList               MANGLE(IsList)
 #define glIsObjectBufferATI            MANGLE(IsObjectBufferATI)
 #define glIsOcclusionQueryNV           MANGLE(IsOcclusionQueryNV)
 #define glIsQueryARB           MANGLE(IsQueryARB)
 #define glIsQuery              MANGLE(IsQuery)
 #define glIsRenderbufferEXT            MANGLE(IsRenderbufferEXT)
+#define glIsRenderbuffer               MANGLE(IsRenderbuffer)
 #define glIsShader             MANGLE(IsShader)
 #define glIsTextureEXT         MANGLE(IsTextureEXT)
 #define glIsTexture            MANGLE(IsTexture)
+#define glIsTransformFeedbackNV                MANGLE(IsTransformFeedbackNV)
 #define glIsVariantEnabledEXT          MANGLE(IsVariantEnabledEXT)
 #define glIsVertexArrayAPPLE           MANGLE(IsVertexArrayAPPLE)
+#define glIsVertexArray                MANGLE(IsVertexArray)
 #define glLightEnviSGIX                MANGLE(LightEnviSGIX)
 #define glLightf               MANGLE(Lightf)
 #define glLightfv              MANGLE(Lightfv)
 #define glMap2f                MANGLE(Map2f)
 #define glMapBufferARB         MANGLE(MapBufferARB)
 #define glMapBuffer            MANGLE(MapBuffer)
+#define glMapBufferRange               MANGLE(MapBufferRange)
 #define glMapControlPointsNV           MANGLE(MapControlPointsNV)
 #define glMapGrid1d            MANGLE(MapGrid1d)
 #define glMapGrid1f            MANGLE(MapGrid1f)
 #define glMapGrid2d            MANGLE(MapGrid2d)
 #define glMapGrid2f            MANGLE(MapGrid2f)
+#define glMapNamedBufferEXT            MANGLE(MapNamedBufferEXT)
 #define glMapObjectBufferATI           MANGLE(MapObjectBufferATI)
 #define glMapParameterfvNV             MANGLE(MapParameterfvNV)
 #define glMapParameterivNV             MANGLE(MapParameterivNV)
 #define glMaterialfv           MANGLE(Materialfv)
 #define glMateriali            MANGLE(Materiali)
 #define glMaterialiv           MANGLE(Materialiv)
+#define glMatrixFrustumEXT             MANGLE(MatrixFrustumEXT)
 #define glMatrixIndexPointerARB                MANGLE(MatrixIndexPointerARB)
 #define glMatrixIndexubvARB            MANGLE(MatrixIndexubvARB)
 #define glMatrixIndexuivARB            MANGLE(MatrixIndexuivARB)
 #define glMatrixIndexusvARB            MANGLE(MatrixIndexusvARB)
+#define glMatrixLoaddEXT               MANGLE(MatrixLoaddEXT)
+#define glMatrixLoadfEXT               MANGLE(MatrixLoadfEXT)
+#define glMatrixLoadIdentityEXT                MANGLE(MatrixLoadIdentityEXT)
+#define glMatrixLoadTransposedEXT              MANGLE(MatrixLoadTransposedEXT)
+#define glMatrixLoadTransposefEXT              MANGLE(MatrixLoadTransposefEXT)
 #define glMatrixMode           MANGLE(MatrixMode)
+#define glMatrixMultdEXT               MANGLE(MatrixMultdEXT)
+#define glMatrixMultfEXT               MANGLE(MatrixMultfEXT)
+#define glMatrixMultTransposedEXT              MANGLE(MatrixMultTransposedEXT)
+#define glMatrixMultTransposefEXT              MANGLE(MatrixMultTransposefEXT)
+#define glMatrixOrthoEXT               MANGLE(MatrixOrthoEXT)
+#define glMatrixPopEXT         MANGLE(MatrixPopEXT)
+#define glMatrixPushEXT                MANGLE(MatrixPushEXT)
+#define glMatrixRotatedEXT             MANGLE(MatrixRotatedEXT)
+#define glMatrixRotatefEXT             MANGLE(MatrixRotatefEXT)
+#define glMatrixScaledEXT              MANGLE(MatrixScaledEXT)
+#define glMatrixScalefEXT              MANGLE(MatrixScalefEXT)
+#define glMatrixTranslatedEXT          MANGLE(MatrixTranslatedEXT)
+#define glMatrixTranslatefEXT          MANGLE(MatrixTranslatefEXT)
 #define glMinmaxEXT            MANGLE(MinmaxEXT)
 #define glMinmax               MANGLE(Minmax)
 #define glMultiDrawArraysEXT           MANGLE(MultiDrawArraysEXT)
 #define glMultiDrawRangeElementArrayAPPLE              MANGLE(MultiDrawRangeElementArrayAPPLE)
 #define glMultiModeDrawArraysIBM               MANGLE(MultiModeDrawArraysIBM)
 #define glMultiModeDrawElementsIBM             MANGLE(MultiModeDrawElementsIBM)
+#define glMultiTexBufferEXT            MANGLE(MultiTexBufferEXT)
 #define glMultiTexCoord1dARB           MANGLE(MultiTexCoord1dARB)
 #define glMultiTexCoord1d              MANGLE(MultiTexCoord1d)
 #define glMultiTexCoord1dvARB          MANGLE(MultiTexCoord1dvARB)
 #define glMultiTexCoord4s              MANGLE(MultiTexCoord4s)
 #define glMultiTexCoord4svARB          MANGLE(MultiTexCoord4svARB)
 #define glMultiTexCoord4sv             MANGLE(MultiTexCoord4sv)
+#define glMultiTexCoordPointerEXT              MANGLE(MultiTexCoordPointerEXT)
+#define glMultiTexEnvfEXT              MANGLE(MultiTexEnvfEXT)
+#define glMultiTexEnvfvEXT             MANGLE(MultiTexEnvfvEXT)
+#define glMultiTexEnviEXT              MANGLE(MultiTexEnviEXT)
+#define glMultiTexEnvivEXT             MANGLE(MultiTexEnvivEXT)
+#define glMultiTexGendEXT              MANGLE(MultiTexGendEXT)
+#define glMultiTexGendvEXT             MANGLE(MultiTexGendvEXT)
+#define glMultiTexGenfEXT              MANGLE(MultiTexGenfEXT)
+#define glMultiTexGenfvEXT             MANGLE(MultiTexGenfvEXT)
+#define glMultiTexGeniEXT              MANGLE(MultiTexGeniEXT)
+#define glMultiTexGenivEXT             MANGLE(MultiTexGenivEXT)
+#define glMultiTexImage1DEXT           MANGLE(MultiTexImage1DEXT)
+#define glMultiTexImage2DEXT           MANGLE(MultiTexImage2DEXT)
+#define glMultiTexImage3DEXT           MANGLE(MultiTexImage3DEXT)
+#define glMultiTexParameterfEXT                MANGLE(MultiTexParameterfEXT)
+#define glMultiTexParameterfvEXT               MANGLE(MultiTexParameterfvEXT)
+#define glMultiTexParameteriEXT                MANGLE(MultiTexParameteriEXT)
+#define glMultiTexParameterIivEXT              MANGLE(MultiTexParameterIivEXT)
+#define glMultiTexParameterIuivEXT             MANGLE(MultiTexParameterIuivEXT)
+#define glMultiTexParameterivEXT               MANGLE(MultiTexParameterivEXT)
+#define glMultiTexRenderbufferEXT              MANGLE(MultiTexRenderbufferEXT)
+#define glMultiTexSubImage1DEXT                MANGLE(MultiTexSubImage1DEXT)
+#define glMultiTexSubImage2DEXT                MANGLE(MultiTexSubImage2DEXT)
+#define glMultiTexSubImage3DEXT                MANGLE(MultiTexSubImage3DEXT)
 #define glMultMatrixd          MANGLE(MultMatrixd)
 #define glMultMatrixf          MANGLE(MultMatrixf)
 #define glMultTransposeMatrixdARB              MANGLE(MultTransposeMatrixdARB)
 #define glMultTransposeMatrixd         MANGLE(MultTransposeMatrixd)
 #define glMultTransposeMatrixfARB              MANGLE(MultTransposeMatrixfARB)
 #define glMultTransposeMatrixf         MANGLE(MultTransposeMatrixf)
+#define glNamedBufferDataEXT           MANGLE(NamedBufferDataEXT)
+#define glNamedBufferSubDataEXT                MANGLE(NamedBufferSubDataEXT)
+#define glNamedFramebufferRenderbufferEXT              MANGLE(NamedFramebufferRenderbufferEXT)
+#define glNamedFramebufferTexture1DEXT         MANGLE(NamedFramebufferTexture1DEXT)
+#define glNamedFramebufferTexture2DEXT         MANGLE(NamedFramebufferTexture2DEXT)
+#define glNamedFramebufferTexture3DEXT         MANGLE(NamedFramebufferTexture3DEXT)
+#define glNamedFramebufferTextureEXT           MANGLE(NamedFramebufferTextureEXT)
+#define glNamedFramebufferTextureFaceEXT               MANGLE(NamedFramebufferTextureFaceEXT)
+#define glNamedFramebufferTextureLayerEXT              MANGLE(NamedFramebufferTextureLayerEXT)
+#define glNamedProgramLocalParameter4dEXT              MANGLE(NamedProgramLocalParameter4dEXT)
+#define glNamedProgramLocalParameter4dvEXT             MANGLE(NamedProgramLocalParameter4dvEXT)
+#define glNamedProgramLocalParameter4fEXT              MANGLE(NamedProgramLocalParameter4fEXT)
+#define glNamedProgramLocalParameter4fvEXT             MANGLE(NamedProgramLocalParameter4fvEXT)
+#define glNamedProgramLocalParameterI4iEXT             MANGLE(NamedProgramLocalParameterI4iEXT)
+#define glNamedProgramLocalParameterI4ivEXT            MANGLE(NamedProgramLocalParameterI4ivEXT)
+#define glNamedProgramLocalParameterI4uiEXT            MANGLE(NamedProgramLocalParameterI4uiEXT)
+#define glNamedProgramLocalParameterI4uivEXT           MANGLE(NamedProgramLocalParameterI4uivEXT)
+#define glNamedProgramLocalParameters4fvEXT            MANGLE(NamedProgramLocalParameters4fvEXT)
+#define glNamedProgramLocalParametersI4ivEXT           MANGLE(NamedProgramLocalParametersI4ivEXT)
+#define glNamedProgramLocalParametersI4uivEXT          MANGLE(NamedProgramLocalParametersI4uivEXT)
+#define glNamedProgramStringEXT                MANGLE(NamedProgramStringEXT)
+#define glNamedRenderbufferStorageEXT          MANGLE(NamedRenderbufferStorageEXT)
+#define glNamedRenderbufferStorageMultisampleCoverageEXT               MANGLE(NamedRenderbufferStorageMultisampleCoverageEXT)
+#define glNamedRenderbufferStorageMultisampleEXT               MANGLE(NamedRenderbufferStorageMultisampleEXT)
 #define glNewList              MANGLE(NewList)
 #define glNewObjectBufferATI           MANGLE(NewObjectBufferATI)
 #define glNormal3b             MANGLE(Normal3b)
 #define glOrtho                MANGLE(Ortho)
 #define glPassTexCoordATI              MANGLE(PassTexCoordATI)
 #define glPassThrough          MANGLE(PassThrough)
+#define glPauseTransformFeedbackNV             MANGLE(PauseTransformFeedbackNV)
 #define glPixelDataRangeNV             MANGLE(PixelDataRangeNV)
 #define glPixelMapfv           MANGLE(PixelMapfv)
 #define glPixelMapuiv          MANGLE(PixelMapuiv)
 #define glProgramParameter4dvNV                MANGLE(ProgramParameter4dvNV)
 #define glProgramParameter4fNV         MANGLE(ProgramParameter4fNV)
 #define glProgramParameter4fvNV                MANGLE(ProgramParameter4fvNV)
+#define glProgramParameteriARB         MANGLE(ProgramParameteriARB)
 #define glProgramParameteriEXT         MANGLE(ProgramParameteriEXT)
 #define glProgramParameters4dvNV               MANGLE(ProgramParameters4dvNV)
 #define glProgramParameters4fvNV               MANGLE(ProgramParameters4fvNV)
 #define glProgramStringARB             MANGLE(ProgramStringARB)
+#define glProgramUniform1fEXT          MANGLE(ProgramUniform1fEXT)
+#define glProgramUniform1fvEXT         MANGLE(ProgramUniform1fvEXT)
+#define glProgramUniform1iEXT          MANGLE(ProgramUniform1iEXT)
+#define glProgramUniform1ivEXT         MANGLE(ProgramUniform1ivEXT)
+#define glProgramUniform1uiEXT         MANGLE(ProgramUniform1uiEXT)
+#define glProgramUniform1uivEXT                MANGLE(ProgramUniform1uivEXT)
+#define glProgramUniform2fEXT          MANGLE(ProgramUniform2fEXT)
+#define glProgramUniform2fvEXT         MANGLE(ProgramUniform2fvEXT)
+#define glProgramUniform2iEXT          MANGLE(ProgramUniform2iEXT)
+#define glProgramUniform2ivEXT         MANGLE(ProgramUniform2ivEXT)
+#define glProgramUniform2uiEXT         MANGLE(ProgramUniform2uiEXT)
+#define glProgramUniform2uivEXT                MANGLE(ProgramUniform2uivEXT)
+#define glProgramUniform3fEXT          MANGLE(ProgramUniform3fEXT)
+#define glProgramUniform3fvEXT         MANGLE(ProgramUniform3fvEXT)
+#define glProgramUniform3iEXT          MANGLE(ProgramUniform3iEXT)
+#define glProgramUniform3ivEXT         MANGLE(ProgramUniform3ivEXT)
+#define glProgramUniform3uiEXT         MANGLE(ProgramUniform3uiEXT)
+#define glProgramUniform3uivEXT                MANGLE(ProgramUniform3uivEXT)
+#define glProgramUniform4fEXT          MANGLE(ProgramUniform4fEXT)
+#define glProgramUniform4fvEXT         MANGLE(ProgramUniform4fvEXT)
+#define glProgramUniform4iEXT          MANGLE(ProgramUniform4iEXT)
+#define glProgramUniform4ivEXT         MANGLE(ProgramUniform4ivEXT)
+#define glProgramUniform4uiEXT         MANGLE(ProgramUniform4uiEXT)
+#define glProgramUniform4uivEXT                MANGLE(ProgramUniform4uivEXT)
+#define glProgramUniformMatrix2fvEXT           MANGLE(ProgramUniformMatrix2fvEXT)
+#define glProgramUniformMatrix2x3fvEXT         MANGLE(ProgramUniformMatrix2x3fvEXT)
+#define glProgramUniformMatrix2x4fvEXT         MANGLE(ProgramUniformMatrix2x4fvEXT)
+#define glProgramUniformMatrix3fvEXT           MANGLE(ProgramUniformMatrix3fvEXT)
+#define glProgramUniformMatrix3x2fvEXT         MANGLE(ProgramUniformMatrix3x2fvEXT)
+#define glProgramUniformMatrix3x4fvEXT         MANGLE(ProgramUniformMatrix3x4fvEXT)
+#define glProgramUniformMatrix4fvEXT           MANGLE(ProgramUniformMatrix4fvEXT)
+#define glProgramUniformMatrix4x2fvEXT         MANGLE(ProgramUniformMatrix4x2fvEXT)
+#define glProgramUniformMatrix4x3fvEXT         MANGLE(ProgramUniformMatrix4x3fvEXT)
 #define glProgramVertexLimitNV         MANGLE(ProgramVertexLimitNV)
 #define glPushAttrib           MANGLE(PushAttrib)
+#define glPushClientAttribDefaultEXT           MANGLE(PushClientAttribDefaultEXT)
 #define glPushClientAttrib             MANGLE(PushClientAttrib)
 #define glPushMatrix           MANGLE(PushMatrix)
 #define glPushName             MANGLE(PushName)
 #define glRectsv               MANGLE(Rectsv)
 #define glReferencePlaneSGIX           MANGLE(ReferencePlaneSGIX)
 #define glRenderbufferStorageEXT               MANGLE(RenderbufferStorageEXT)
+#define glRenderbufferStorage          MANGLE(RenderbufferStorage)
 #define glRenderbufferStorageMultisampleCoverageNV             MANGLE(RenderbufferStorageMultisampleCoverageNV)
 #define glRenderbufferStorageMultisampleEXT            MANGLE(RenderbufferStorageMultisampleEXT)
+#define glRenderbufferStorageMultisample               MANGLE(RenderbufferStorageMultisample)
 #define glRenderMode           MANGLE(RenderMode)
 #define glReplacementCodePointerSUN            MANGLE(ReplacementCodePointerSUN)
 #define glReplacementCodeubSUN         MANGLE(ReplacementCodeubSUN)
 #define glResetMinmaxEXT               MANGLE(ResetMinmaxEXT)
 #define glResetMinmax          MANGLE(ResetMinmax)
 #define glResizeBuffersMESA            MANGLE(ResizeBuffersMESA)
+#define glResumeTransformFeedbackNV            MANGLE(ResumeTransformFeedbackNV)
 #define glRotated              MANGLE(Rotated)
 #define glRotatef              MANGLE(Rotatef)
 #define glSampleCoverageARB            MANGLE(SampleCoverageARB)
 #define glSampleCoverage               MANGLE(SampleCoverage)
 #define glSampleMapATI         MANGLE(SampleMapATI)
 #define glSampleMaskEXT                MANGLE(SampleMaskEXT)
+#define glSampleMaskIndexedNV          MANGLE(SampleMaskIndexedNV)
 #define glSampleMaskSGIS               MANGLE(SampleMaskSGIS)
 #define glSamplePatternEXT             MANGLE(SamplePatternEXT)
 #define glSamplePatternSGIS            MANGLE(SamplePatternSGIS)
 #define glTestFenceAPPLE               MANGLE(TestFenceAPPLE)
 #define glTestFenceNV          MANGLE(TestFenceNV)
 #define glTestObjectAPPLE              MANGLE(TestObjectAPPLE)
+#define glTexBufferARB         MANGLE(TexBufferARB)
 #define glTexBufferEXT         MANGLE(TexBufferEXT)
 #define glTexBumpParameterfvATI                MANGLE(TexBumpParameterfvATI)
 #define glTexBumpParameterivATI                MANGLE(TexBumpParameterivATI)
 #define glTexParameterf                MANGLE(TexParameterf)
 #define glTexParameterfv               MANGLE(TexParameterfv)
 #define glTexParameterIivEXT           MANGLE(TexParameterIivEXT)
+#define glTexParameterIiv              MANGLE(TexParameterIiv)
 #define glTexParameteri                MANGLE(TexParameteri)
 #define glTexParameterIuivEXT          MANGLE(TexParameterIuivEXT)
+#define glTexParameterIuiv             MANGLE(TexParameterIuiv)
 #define glTexParameteriv               MANGLE(TexParameteriv)
+#define glTexRenderbufferNV            MANGLE(TexRenderbufferNV)
 #define glTexSubImage1DEXT             MANGLE(TexSubImage1DEXT)
 #define glTexSubImage1D                MANGLE(TexSubImage1D)
 #define glTexSubImage2DEXT             MANGLE(TexSubImage2DEXT)
 #define glTexSubImage3DEXT             MANGLE(TexSubImage3DEXT)
 #define glTexSubImage3D                MANGLE(TexSubImage3D)
 #define glTexSubImage4DSGIS            MANGLE(TexSubImage4DSGIS)
+#define glTextureBufferEXT             MANGLE(TextureBufferEXT)
 #define glTextureColorMaskSGIS         MANGLE(TextureColorMaskSGIS)
+#define glTextureImage1DEXT            MANGLE(TextureImage1DEXT)
+#define glTextureImage2DEXT            MANGLE(TextureImage2DEXT)
+#define glTextureImage3DEXT            MANGLE(TextureImage3DEXT)
 #define glTextureLightEXT              MANGLE(TextureLightEXT)
 #define glTextureMaterialEXT           MANGLE(TextureMaterialEXT)
 #define glTextureNormalEXT             MANGLE(TextureNormalEXT)
+#define glTextureParameterfEXT         MANGLE(TextureParameterfEXT)
+#define glTextureParameterfvEXT                MANGLE(TextureParameterfvEXT)
+#define glTextureParameteriEXT         MANGLE(TextureParameteriEXT)
+#define glTextureParameterIivEXT               MANGLE(TextureParameterIivEXT)
+#define glTextureParameterIuivEXT              MANGLE(TextureParameterIuivEXT)
+#define glTextureParameterivEXT                MANGLE(TextureParameterivEXT)
+#define glTextureRenderbufferEXT               MANGLE(TextureRenderbufferEXT)
+#define glTextureSubImage1DEXT         MANGLE(TextureSubImage1DEXT)
+#define glTextureSubImage2DEXT         MANGLE(TextureSubImage2DEXT)
+#define glTextureSubImage3DEXT         MANGLE(TextureSubImage3DEXT)
 #define glTrackMatrixNV                MANGLE(TrackMatrixNV)
 #define glTransformFeedbackAttribsNV           MANGLE(TransformFeedbackAttribsNV)
+#define glTransformFeedbackVaryingsEXT         MANGLE(TransformFeedbackVaryingsEXT)
+#define glTransformFeedbackVaryings            MANGLE(TransformFeedbackVaryings)
 #define glTransformFeedbackVaryingsNV          MANGLE(TransformFeedbackVaryingsNV)
 #define glTranslated           MANGLE(Translated)
 #define glTranslatef           MANGLE(Translatef)
 #define glUniform1ivARB                MANGLE(Uniform1ivARB)
 #define glUniform1iv           MANGLE(Uniform1iv)
 #define glUniform1uiEXT                MANGLE(Uniform1uiEXT)
+#define glUniform1ui           MANGLE(Uniform1ui)
 #define glUniform1uivEXT               MANGLE(Uniform1uivEXT)
+#define glUniform1uiv          MANGLE(Uniform1uiv)
 #define glUniform2fARB         MANGLE(Uniform2fARB)
 #define glUniform2f            MANGLE(Uniform2f)
 #define glUniform2fvARB                MANGLE(Uniform2fvARB)
 #define glUniform2ivARB                MANGLE(Uniform2ivARB)
 #define glUniform2iv           MANGLE(Uniform2iv)
 #define glUniform2uiEXT                MANGLE(Uniform2uiEXT)
+#define glUniform2ui           MANGLE(Uniform2ui)
 #define glUniform2uivEXT               MANGLE(Uniform2uivEXT)
+#define glUniform2uiv          MANGLE(Uniform2uiv)
 #define glUniform3fARB         MANGLE(Uniform3fARB)
 #define glUniform3f            MANGLE(Uniform3f)
 #define glUniform3fvARB                MANGLE(Uniform3fvARB)
 #define glUniform3ivARB                MANGLE(Uniform3ivARB)
 #define glUniform3iv           MANGLE(Uniform3iv)
 #define glUniform3uiEXT                MANGLE(Uniform3uiEXT)
+#define glUniform3ui           MANGLE(Uniform3ui)
 #define glUniform3uivEXT               MANGLE(Uniform3uivEXT)
+#define glUniform3uiv          MANGLE(Uniform3uiv)
 #define glUniform4fARB         MANGLE(Uniform4fARB)
 #define glUniform4f            MANGLE(Uniform4f)
 #define glUniform4fvARB                MANGLE(Uniform4fvARB)
 #define glUniform4ivARB                MANGLE(Uniform4ivARB)
 #define glUniform4iv           MANGLE(Uniform4iv)
 #define glUniform4uiEXT                MANGLE(Uniform4uiEXT)
+#define glUniform4ui           MANGLE(Uniform4ui)
 #define glUniform4uivEXT               MANGLE(Uniform4uivEXT)
+#define glUniform4uiv          MANGLE(Uniform4uiv)
 #define glUniformBufferEXT             MANGLE(UniformBufferEXT)
 #define glUniformMatrix2fvARB          MANGLE(UniformMatrix2fvARB)
 #define glUniformMatrix2fv             MANGLE(UniformMatrix2fv)
 #define glUnlockArraysEXT              MANGLE(UnlockArraysEXT)
 #define glUnmapBufferARB               MANGLE(UnmapBufferARB)
 #define glUnmapBuffer          MANGLE(UnmapBuffer)
+#define glUnmapNamedBufferEXT          MANGLE(UnmapNamedBufferEXT)
 #define glUnmapObjectBufferATI         MANGLE(UnmapObjectBufferATI)
 #define glUpdateObjectBufferATI                MANGLE(UpdateObjectBufferATI)
 #define glUseProgram           MANGLE(UseProgram)
 #define glVertexAttrib4usvARB          MANGLE(VertexAttrib4usvARB)
 #define glVertexAttrib4usv             MANGLE(VertexAttrib4usv)
 #define glVertexAttribArrayObjectATI           MANGLE(VertexAttribArrayObjectATI)
+#define glVertexAttribDivisor          MANGLE(VertexAttribDivisor)
 #define glVertexAttribI1iEXT           MANGLE(VertexAttribI1iEXT)
+#define glVertexAttribI1i              MANGLE(VertexAttribI1i)
 #define glVertexAttribI1ivEXT          MANGLE(VertexAttribI1ivEXT)
+#define glVertexAttribI1iv             MANGLE(VertexAttribI1iv)
 #define glVertexAttribI1uiEXT          MANGLE(VertexAttribI1uiEXT)
+#define glVertexAttribI1ui             MANGLE(VertexAttribI1ui)
 #define glVertexAttribI1uivEXT         MANGLE(VertexAttribI1uivEXT)
+#define glVertexAttribI1uiv            MANGLE(VertexAttribI1uiv)
 #define glVertexAttribI2iEXT           MANGLE(VertexAttribI2iEXT)
+#define glVertexAttribI2i              MANGLE(VertexAttribI2i)
 #define glVertexAttribI2ivEXT          MANGLE(VertexAttribI2ivEXT)
+#define glVertexAttribI2iv             MANGLE(VertexAttribI2iv)
 #define glVertexAttribI2uiEXT          MANGLE(VertexAttribI2uiEXT)
+#define glVertexAttribI2ui             MANGLE(VertexAttribI2ui)
 #define glVertexAttribI2uivEXT         MANGLE(VertexAttribI2uivEXT)
+#define glVertexAttribI2uiv            MANGLE(VertexAttribI2uiv)
 #define glVertexAttribI3iEXT           MANGLE(VertexAttribI3iEXT)
+#define glVertexAttribI3i              MANGLE(VertexAttribI3i)
 #define glVertexAttribI3ivEXT          MANGLE(VertexAttribI3ivEXT)
+#define glVertexAttribI3iv             MANGLE(VertexAttribI3iv)
 #define glVertexAttribI3uiEXT          MANGLE(VertexAttribI3uiEXT)
+#define glVertexAttribI3ui             MANGLE(VertexAttribI3ui)
 #define glVertexAttribI3uivEXT         MANGLE(VertexAttribI3uivEXT)
+#define glVertexAttribI3uiv            MANGLE(VertexAttribI3uiv)
 #define glVertexAttribI4bvEXT          MANGLE(VertexAttribI4bvEXT)
+#define glVertexAttribI4bv             MANGLE(VertexAttribI4bv)
 #define glVertexAttribI4iEXT           MANGLE(VertexAttribI4iEXT)
+#define glVertexAttribI4i              MANGLE(VertexAttribI4i)
 #define glVertexAttribI4ivEXT          MANGLE(VertexAttribI4ivEXT)
+#define glVertexAttribI4iv             MANGLE(VertexAttribI4iv)
 #define glVertexAttribI4svEXT          MANGLE(VertexAttribI4svEXT)
+#define glVertexAttribI4sv             MANGLE(VertexAttribI4sv)
 #define glVertexAttribI4ubvEXT         MANGLE(VertexAttribI4ubvEXT)
+#define glVertexAttribI4ubv            MANGLE(VertexAttribI4ubv)
 #define glVertexAttribI4uiEXT          MANGLE(VertexAttribI4uiEXT)
+#define glVertexAttribI4ui             MANGLE(VertexAttribI4ui)
 #define glVertexAttribI4uivEXT         MANGLE(VertexAttribI4uivEXT)
+#define glVertexAttribI4uiv            MANGLE(VertexAttribI4uiv)
 #define glVertexAttribI4usvEXT         MANGLE(VertexAttribI4usvEXT)
+#define glVertexAttribI4usv            MANGLE(VertexAttribI4usv)
 #define glVertexAttribIPointerEXT              MANGLE(VertexAttribIPointerEXT)
+#define glVertexAttribIPointer         MANGLE(VertexAttribIPointer)
 #define glVertexAttribPointerARB               MANGLE(VertexAttribPointerARB)
 #define glVertexAttribPointer          MANGLE(VertexAttribPointer)
 #define glVertexAttribPointerNV                MANGLE(VertexAttribPointerNV)
index c0941aa80448a065fb37ac9940c67ff714628319..d3f01a2b6c42a82a8667b55c4a7599756dccdd13 100644 (file)
@@ -46,9 +46,9 @@ extern "C" {
 /*************************************************************/
 
 /* Header file version number, required by OpenGL ABI for Linux */
-/* glext.h last updated 2008/11/14 */
+/* glext.h last updated 2009/03/04 */
 /* Current version at http://www.opengl.org/registry/ */
-#define GL_GLEXT_VERSION 44
+#define GL_GLEXT_VERSION 46
 
 #ifndef GL_VERSION_1_2
 #define GL_UNSIGNED_BYTE_3_3_2            0x8032
@@ -3862,6 +3862,22 @@ extern "C" {
 #define GL_TRANSFORM_FEEDBACK_BINDING_NV  0x8E25
 #endif
 
+#ifndef GL_ATI_meminfo
+#define GL_VBO_FREE_MEMORY_ATI            0x87FB
+#define GL_TEXTURE_FREE_MEMORY_ATI        0x87FC
+#define GL_RENDERBUFFER_FREE_MEMORY_ATI   0x87FD
+#endif
+
+#ifndef GL_AMD_performance_monitor
+#define GL_COUNTER_TYPE_AMD               0x8BC0
+#define GL_COUNTER_RANGE_AMD              0x8BC1
+#define GL_UNSIGNED_INT64_AMD             0x8BC2
+#define GL_PERCENTAGE_AMD                 0x8BC3
+#define GL_PERFMON_RESULT_AVAILABLE_AMD   0x8BC4
+#define GL_PERFMON_RESULT_SIZE_AMD        0x8BC5
+#define GL_PERFMON_RESULT_AMD             0x8BC6
+#endif
+
 
 /*************************************************************/
 
@@ -5268,10 +5284,10 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divi
 #ifndef GL_ARB_map_buffer_range
 #define GL_ARB_map_buffer_range 1
 #ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMapBufferRange (GLenum, GLintptr, GLsizeiptr, GLbitfield);
+GLAPI GLvoid* APIENTRY glMapBufferRange (GLenum, GLintptr, GLsizeiptr, GLbitfield);
 GLAPI void APIENTRY glFlushMappedBufferRange (GLenum, GLintptr, GLsizeiptr);
 #endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
 typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
 #endif
 
@@ -8011,6 +8027,22 @@ typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void);
 
 #ifndef GL_NV_present_video
 #define GL_NV_present_video 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLuint, GLenum, GLuint, GLuint);
+GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint);
+GLAPI void APIENTRY glGetVideoivNV (GLuint, GLenum, GLint *);
+GLAPI void APIENTRY glGetVideouivNV (GLuint, GLenum, GLuint *);
+GLAPI void APIENTRY glGetVideoi64vNV (GLuint, GLenum, GLint64EXT *);
+GLAPI void APIENTRY glGetVideoui64vNV (GLuint, GLenum, GLuint64EXT *);
+GLAPI void APIENTRY glVideoParameterivNV (GLuint, GLenum, const GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
+typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
+typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params);
+typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params);
+typedef void (APIENTRYP PFNGLVIDEOPARAMETERIVNVPROC) (GLuint video_slot, GLenum pname, const GLint *params);
 #endif
 
 #ifndef GL_EXT_transform_feedback
@@ -8451,6 +8483,38 @@ typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void);
 typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id);
 #endif
 
+#ifndef GL_ATI_meminfo
+#define GL_ATI_meminfo 1
+#endif
+
+#ifndef GL_AMD_performance_monitor
+#define GL_AMD_performance_monitor 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *, GLsizei, GLuint *);
+GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint, GLint *, GLint *, GLsizei, GLuint *);
+GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint, GLsizei, GLsizei *, GLchar *);
+GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint, GLuint, GLsizei, GLsizei *, GLchar *);
+GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint, GLuint, GLenum, void *);
+GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei, GLuint *);
+GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei, GLuint *);
+GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint, GLboolean, GLuint, GLint, GLuint *);
+GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint);
+GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint);
+GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint, GLenum, GLsizei, GLuint *, GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
+typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
+typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+
 
 #ifdef __cplusplus
 }
index 022378fb9d78d0a289e507266f55ad423f2244c2..9fdb9cfdfa976adb3fee0db777fa2d5166c852bd 100644 (file)
@@ -74,23 +74,9 @@ extern "C" {
 #  define __cdecl
 #  define GLUT_DEFINED___CDECL
 # endif
-# ifndef _CRTIMP
-#  ifdef _NTSDK
-    /* Definition compatible with NT SDK */
-#   define _CRTIMP
-#  else
-    /* Current definition */
-#   ifdef _DLL
-#    define _CRTIMP __declspec(dllimport)
-#   else
-#    define _CRTIMP
-#   endif
-#  endif
-#  define GLUT_DEFINED__CRTIMP
-# endif
-# ifndef GLUT_BUILDING_LIB
-extern _CRTIMP void __cdecl exit(int);
-# endif
+#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
+#include <stdlib.h>
+#endif
 
 /* GLUT callback calling convention for Win32. */
 # define GLUTCALLBACK __cdecl
@@ -122,7 +108,7 @@ extern _CRTIMP void __cdecl exit(int);
 #  define GLUTAPIENTRY
 #  define GLUTAPIENTRYV
 #  define GLUTCALLBACK
-#  define GLUTAPI __attribute__((visibility("default")))
+#  define GLUTAPI extern __attribute__((visibility("default")))
 
 #else
 
index 27cc1be7ff3c3cf9ec1a67eb29bad0457d60f972..a726b932340090f328d8c1e5f0623282937682a0 100644 (file)
@@ -78,6 +78,7 @@ typedef struct __DRIswrastExtensionRec                __DRIswrastExtension;
 typedef struct __DRIbufferRec                  __DRIbuffer;
 typedef struct __DRIdri2ExtensionRec           __DRIdri2Extension;
 typedef struct __DRIdri2LoaderExtensionRec     __DRIdri2LoaderExtension;
+typedef struct __DRI2flushExtensionRec __DRI2flushExtension;
 
 /*@}*/
 
@@ -245,6 +246,16 @@ struct __DRItexBufferExtensionRec {
                         __DRIdrawable *pDraw);
 };
 
+/**
+ * Used by drivers that implement DRI2
+ */
+#define __DRI2_FLUSH "DRI2_Flush"
+#define __DRI2_FLUSH_VERSION 1
+struct __DRI2flushExtensionRec {
+    __DRIextension base;
+    void (*flush)(__DRIdrawable *drawable);
+};
+
 
 /**
  * XML document describing the configuration options supported by the
diff --git a/include/GL/wglext.h b/include/GL/wglext.h
new file mode 100644 (file)
index 0000000..d54e0a4
--- /dev/null
@@ -0,0 +1,813 @@
+#ifndef __wglext_h_
+#define __wglext_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007 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.
+*/
+
+#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+#ifndef APIENTRYP
+#define APIENTRYP APIENTRY *
+#endif
+#ifndef GLAPI
+#define GLAPI extern
+#endif
+
+/*************************************************************/
+
+/* Header file version number */
+/* wglext.h last updated 2009/03/03 */
+/* Current version at http://www.opengl.org/registry/ */
+#define WGL_WGLEXT_VERSION 12
+
+#ifndef WGL_ARB_buffer_region
+#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
+#define WGL_BACK_COLOR_BUFFER_BIT_ARB  0x00000002
+#define WGL_DEPTH_BUFFER_BIT_ARB       0x00000004
+#define WGL_STENCIL_BUFFER_BIT_ARB     0x00000008
+#endif
+
+#ifndef WGL_ARB_multisample
+#define WGL_SAMPLE_BUFFERS_ARB         0x2041
+#define WGL_SAMPLES_ARB                0x2042
+#endif
+
+#ifndef WGL_ARB_extensions_string
+#endif
+
+#ifndef WGL_ARB_pixel_format
+#define WGL_NUMBER_PIXEL_FORMATS_ARB   0x2000
+#define WGL_DRAW_TO_WINDOW_ARB         0x2001
+#define WGL_DRAW_TO_BITMAP_ARB         0x2002
+#define WGL_ACCELERATION_ARB           0x2003
+#define WGL_NEED_PALETTE_ARB           0x2004
+#define WGL_NEED_SYSTEM_PALETTE_ARB    0x2005
+#define WGL_SWAP_LAYER_BUFFERS_ARB     0x2006
+#define WGL_SWAP_METHOD_ARB            0x2007
+#define WGL_NUMBER_OVERLAYS_ARB        0x2008
+#define WGL_NUMBER_UNDERLAYS_ARB       0x2009
+#define WGL_TRANSPARENT_ARB            0x200A
+#define WGL_TRANSPARENT_RED_VALUE_ARB  0x2037
+#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
+#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
+#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
+#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
+#define WGL_SHARE_DEPTH_ARB            0x200C
+#define WGL_SHARE_STENCIL_ARB          0x200D
+#define WGL_SHARE_ACCUM_ARB            0x200E
+#define WGL_SUPPORT_GDI_ARB            0x200F
+#define WGL_SUPPORT_OPENGL_ARB         0x2010
+#define WGL_DOUBLE_BUFFER_ARB          0x2011
+#define WGL_STEREO_ARB                 0x2012
+#define WGL_PIXEL_TYPE_ARB             0x2013
+#define WGL_COLOR_BITS_ARB             0x2014
+#define WGL_RED_BITS_ARB               0x2015
+#define WGL_RED_SHIFT_ARB              0x2016
+#define WGL_GREEN_BITS_ARB             0x2017
+#define WGL_GREEN_SHIFT_ARB            0x2018
+#define WGL_BLUE_BITS_ARB              0x2019
+#define WGL_BLUE_SHIFT_ARB             0x201A
+#define WGL_ALPHA_BITS_ARB             0x201B
+#define WGL_ALPHA_SHIFT_ARB            0x201C
+#define WGL_ACCUM_BITS_ARB             0x201D
+#define WGL_ACCUM_RED_BITS_ARB         0x201E
+#define WGL_ACCUM_GREEN_BITS_ARB       0x201F
+#define WGL_ACCUM_BLUE_BITS_ARB        0x2020
+#define WGL_ACCUM_ALPHA_BITS_ARB       0x2021
+#define WGL_DEPTH_BITS_ARB             0x2022
+#define WGL_STENCIL_BITS_ARB           0x2023
+#define WGL_AUX_BUFFERS_ARB            0x2024
+#define WGL_NO_ACCELERATION_ARB        0x2025
+#define WGL_GENERIC_ACCELERATION_ARB   0x2026
+#define WGL_FULL_ACCELERATION_ARB      0x2027
+#define WGL_SWAP_EXCHANGE_ARB          0x2028
+#define WGL_SWAP_COPY_ARB              0x2029
+#define WGL_SWAP_UNDEFINED_ARB         0x202A
+#define WGL_TYPE_RGBA_ARB              0x202B
+#define WGL_TYPE_COLORINDEX_ARB        0x202C
+#endif
+
+#ifndef WGL_ARB_make_current_read
+#define ERROR_INVALID_PIXEL_TYPE_ARB   0x2043
+#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
+#endif
+
+#ifndef WGL_ARB_pbuffer
+#define WGL_DRAW_TO_PBUFFER_ARB        0x202D
+#define WGL_MAX_PBUFFER_PIXELS_ARB     0x202E
+#define WGL_MAX_PBUFFER_WIDTH_ARB      0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_ARB     0x2030
+#define WGL_PBUFFER_LARGEST_ARB        0x2033
+#define WGL_PBUFFER_WIDTH_ARB          0x2034
+#define WGL_PBUFFER_HEIGHT_ARB         0x2035
+#define WGL_PBUFFER_LOST_ARB           0x2036
+#endif
+
+#ifndef WGL_ARB_render_texture
+#define WGL_BIND_TO_TEXTURE_RGB_ARB    0x2070
+#define WGL_BIND_TO_TEXTURE_RGBA_ARB   0x2071
+#define WGL_TEXTURE_FORMAT_ARB         0x2072
+#define WGL_TEXTURE_TARGET_ARB         0x2073
+#define WGL_MIPMAP_TEXTURE_ARB         0x2074
+#define WGL_TEXTURE_RGB_ARB            0x2075
+#define WGL_TEXTURE_RGBA_ARB           0x2076
+#define WGL_NO_TEXTURE_ARB             0x2077
+#define WGL_TEXTURE_CUBE_MAP_ARB       0x2078
+#define WGL_TEXTURE_1D_ARB             0x2079
+#define WGL_TEXTURE_2D_ARB             0x207A
+#define WGL_MIPMAP_LEVEL_ARB           0x207B
+#define WGL_CUBE_MAP_FACE_ARB          0x207C
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
+#define WGL_FRONT_LEFT_ARB             0x2083
+#define WGL_FRONT_RIGHT_ARB            0x2084
+#define WGL_BACK_LEFT_ARB              0x2085
+#define WGL_BACK_RIGHT_ARB             0x2086
+#define WGL_AUX0_ARB                   0x2087
+#define WGL_AUX1_ARB                   0x2088
+#define WGL_AUX2_ARB                   0x2089
+#define WGL_AUX3_ARB                   0x208A
+#define WGL_AUX4_ARB                   0x208B
+#define WGL_AUX5_ARB                   0x208C
+#define WGL_AUX6_ARB                   0x208D
+#define WGL_AUX7_ARB                   0x208E
+#define WGL_AUX8_ARB                   0x208F
+#define WGL_AUX9_ARB                   0x2090
+#endif
+
+#ifndef WGL_ARB_pixel_format_float
+#define WGL_TYPE_RGBA_FLOAT_ARB        0x21A0
+#endif
+
+#ifndef WGL_ARB_create_context
+#define WGL_CONTEXT_DEBUG_BIT_ARB      0x0001
+#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
+#define WGL_CONTEXT_MAJOR_VERSION_ARB  0x2091
+#define WGL_CONTEXT_MINOR_VERSION_ARB  0x2092
+#define WGL_CONTEXT_LAYER_PLANE_ARB    0x2093
+#define WGL_CONTEXT_FLAGS_ARB          0x2094
+#define ERROR_INVALID_VERSION_ARB      0x2095
+#endif
+
+#ifndef WGL_EXT_make_current_read
+#define ERROR_INVALID_PIXEL_TYPE_EXT   0x2043
+#endif
+
+#ifndef WGL_EXT_pixel_format
+#define WGL_NUMBER_PIXEL_FORMATS_EXT   0x2000
+#define WGL_DRAW_TO_WINDOW_EXT         0x2001
+#define WGL_DRAW_TO_BITMAP_EXT         0x2002
+#define WGL_ACCELERATION_EXT           0x2003
+#define WGL_NEED_PALETTE_EXT           0x2004
+#define WGL_NEED_SYSTEM_PALETTE_EXT    0x2005
+#define WGL_SWAP_LAYER_BUFFERS_EXT     0x2006
+#define WGL_SWAP_METHOD_EXT            0x2007
+#define WGL_NUMBER_OVERLAYS_EXT        0x2008
+#define WGL_NUMBER_UNDERLAYS_EXT       0x2009
+#define WGL_TRANSPARENT_EXT            0x200A
+#define WGL_TRANSPARENT_VALUE_EXT      0x200B
+#define WGL_SHARE_DEPTH_EXT            0x200C
+#define WGL_SHARE_STENCIL_EXT          0x200D
+#define WGL_SHARE_ACCUM_EXT            0x200E
+#define WGL_SUPPORT_GDI_EXT            0x200F
+#define WGL_SUPPORT_OPENGL_EXT         0x2010
+#define WGL_DOUBLE_BUFFER_EXT          0x2011
+#define WGL_STEREO_EXT                 0x2012
+#define WGL_PIXEL_TYPE_EXT             0x2013
+#define WGL_COLOR_BITS_EXT             0x2014
+#define WGL_RED_BITS_EXT               0x2015
+#define WGL_RED_SHIFT_EXT              0x2016
+#define WGL_GREEN_BITS_EXT             0x2017
+#define WGL_GREEN_SHIFT_EXT            0x2018
+#define WGL_BLUE_BITS_EXT              0x2019
+#define WGL_BLUE_SHIFT_EXT             0x201A
+#define WGL_ALPHA_BITS_EXT             0x201B
+#define WGL_ALPHA_SHIFT_EXT            0x201C
+#define WGL_ACCUM_BITS_EXT             0x201D
+#define WGL_ACCUM_RED_BITS_EXT         0x201E
+#define WGL_ACCUM_GREEN_BITS_EXT       0x201F
+#define WGL_ACCUM_BLUE_BITS_EXT        0x2020
+#define WGL_ACCUM_ALPHA_BITS_EXT       0x2021
+#define WGL_DEPTH_BITS_EXT             0x2022
+#define WGL_STENCIL_BITS_EXT           0x2023
+#define WGL_AUX_BUFFERS_EXT            0x2024
+#define WGL_NO_ACCELERATION_EXT        0x2025
+#define WGL_GENERIC_ACCELERATION_EXT   0x2026
+#define WGL_FULL_ACCELERATION_EXT      0x2027
+#define WGL_SWAP_EXCHANGE_EXT          0x2028
+#define WGL_SWAP_COPY_EXT              0x2029
+#define WGL_SWAP_UNDEFINED_EXT         0x202A
+#define WGL_TYPE_RGBA_EXT              0x202B
+#define WGL_TYPE_COLORINDEX_EXT        0x202C
+#endif
+
+#ifndef WGL_EXT_pbuffer
+#define WGL_DRAW_TO_PBUFFER_EXT        0x202D
+#define WGL_MAX_PBUFFER_PIXELS_EXT     0x202E
+#define WGL_MAX_PBUFFER_WIDTH_EXT      0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_EXT     0x2030
+#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT  0x2031
+#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
+#define WGL_PBUFFER_LARGEST_EXT        0x2033
+#define WGL_PBUFFER_WIDTH_EXT          0x2034
+#define WGL_PBUFFER_HEIGHT_EXT         0x2035
+#endif
+
+#ifndef WGL_EXT_depth_float
+#define WGL_DEPTH_FLOAT_EXT            0x2040
+#endif
+
+#ifndef WGL_3DFX_multisample
+#define WGL_SAMPLE_BUFFERS_3DFX        0x2060
+#define WGL_SAMPLES_3DFX               0x2061
+#endif
+
+#ifndef WGL_EXT_multisample
+#define WGL_SAMPLE_BUFFERS_EXT         0x2041
+#define WGL_SAMPLES_EXT                0x2042
+#endif
+
+#ifndef WGL_I3D_digital_video_control
+#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
+#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
+#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
+#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
+#endif
+
+#ifndef WGL_I3D_gamma
+#define WGL_GAMMA_TABLE_SIZE_I3D       0x204E
+#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D  0x204F
+#endif
+
+#ifndef WGL_I3D_genlock
+#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
+#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
+#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
+#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
+#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
+#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
+#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
+#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
+#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
+#endif
+
+#ifndef WGL_I3D_image_buffer
+#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
+#define WGL_IMAGE_BUFFER_LOCK_I3D      0x00000002
+#endif
+
+#ifndef WGL_I3D_swap_frame_lock
+#endif
+
+#ifndef WGL_NV_render_depth_texture
+#define WGL_BIND_TO_TEXTURE_DEPTH_NV   0x20A3
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
+#define WGL_DEPTH_TEXTURE_FORMAT_NV    0x20A5
+#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
+#define WGL_DEPTH_COMPONENT_NV         0x20A7
+#endif
+
+#ifndef WGL_NV_render_texture_rectangle
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
+#define WGL_TEXTURE_RECTANGLE_NV       0x20A2
+#endif
+
+#ifndef WGL_ATI_pixel_format_float
+#define WGL_TYPE_RGBA_FLOAT_ATI        0x21A0
+#endif
+
+#ifndef WGL_NV_float_buffer
+#define WGL_FLOAT_COMPONENTS_NV        0x20B0
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
+#define WGL_TEXTURE_FLOAT_R_NV         0x20B5
+#define WGL_TEXTURE_FLOAT_RG_NV        0x20B6
+#define WGL_TEXTURE_FLOAT_RGB_NV       0x20B7
+#define WGL_TEXTURE_FLOAT_RGBA_NV      0x20B8
+#endif
+
+#ifndef WGL_3DL_stereo_control
+#define WGL_STEREO_EMITTER_ENABLE_3DL  0x2055
+#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
+#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
+#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
+#endif
+
+#ifndef WGL_EXT_pixel_format_packed_float
+#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
+#endif
+
+#ifndef WGL_EXT_framebuffer_sRGB
+#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
+#endif
+
+#ifndef WGL_NV_present_video
+#define WGL_NUM_VIDEO_SLOTS_NV         0x20F0
+#endif
+
+#ifndef WGL_NV_video_out
+#define WGL_BIND_TO_VIDEO_RGB_NV       0x20C0
+#define WGL_BIND_TO_VIDEO_RGBA_NV      0x20C1
+#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
+#define WGL_VIDEO_OUT_COLOR_NV         0x20C3
+#define WGL_VIDEO_OUT_ALPHA_NV         0x20C4
+#define WGL_VIDEO_OUT_DEPTH_NV         0x20C5
+#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
+#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
+#define WGL_VIDEO_OUT_FRAME            0x20C8
+#define WGL_VIDEO_OUT_FIELD_1          0x20C9
+#define WGL_VIDEO_OUT_FIELD_2          0x20CA
+#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
+#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
+#endif
+
+#ifndef WGL_NV_swap_group
+#endif
+
+#ifndef WGL_NV_gpu_affinity
+#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
+#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
+#endif
+
+#ifndef WGL_AMD_gpu_association
+#define WGL_GPU_VENDOR_AMD             0x1F00
+#define WGL_GPU_RENDERER_STRING_AMD    0x1F01
+#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
+#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
+#define WGL_GPU_RAM_AMD                0x21A3
+#define WGL_GPU_CLOCK_AMD              0x21A4
+#define WGL_GPU_NUM_PIPES_AMD          0x21A5
+#define WGL_GPU_NUM_SIMD_AMD           0x21A6
+#define WGL_GPU_NUM_RB_AMD             0x21A7
+#define WGL_GPU_NUM_SPI_AMD            0x21A8
+#endif
+
+
+/*************************************************************/
+
+#ifndef WGL_ARB_pbuffer
+DECLARE_HANDLE(HPBUFFERARB);
+#endif
+#ifndef WGL_EXT_pbuffer
+DECLARE_HANDLE(HPBUFFEREXT);
+#endif
+#ifndef WGL_NV_present_video
+DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
+#endif
+#ifndef WGL_NV_video_out
+DECLARE_HANDLE(HPVIDEODEV);
+#endif
+#ifndef WGL_NV_gpu_affinity
+DECLARE_HANDLE(HPGPUNV);
+DECLARE_HANDLE(HGPUNV);
+
+typedef struct _GPU_DEVICE {
+    DWORD  cb;
+    CHAR   DeviceName[32];
+    CHAR   DeviceString[128];
+    DWORD  Flags;
+    RECT   rcVirtualScreen;
+} GPU_DEVICE, *PGPU_DEVICE;
+#endif
+
+#ifndef WGL_ARB_buffer_region
+#define WGL_ARB_buffer_region 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern HANDLE WINAPI wglCreateBufferRegionARB (HDC, int, UINT);
+extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE);
+extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE, int, int, int, int);
+extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE, int, int, int, int, int, int);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
+typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
+typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
+typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
+#endif
+
+#ifndef WGL_ARB_multisample
+#define WGL_ARB_multisample 1
+#endif
+
+#ifndef WGL_ARB_extensions_string
+#define WGL_ARB_extensions_string 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern const char * WINAPI wglGetExtensionsStringARB (HDC);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
+#endif
+
+#ifndef WGL_ARB_pixel_format
+#define WGL_ARB_pixel_format 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC, int, int, UINT, const int *, int *);
+extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC, int, int, UINT, const int *, FLOAT *);
+extern BOOL WINAPI wglChoosePixelFormatARB (HDC, const int *, const FLOAT *, UINT, int *, UINT *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
+typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#endif
+
+#ifndef WGL_ARB_make_current_read
+#define WGL_ARB_make_current_read 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglMakeContextCurrentARB (HDC, HDC, HGLRC);
+extern HDC WINAPI wglGetCurrentReadDCARB (void);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
+#endif
+
+#ifndef WGL_ARB_pbuffer
+#define WGL_ARB_pbuffer 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC, int, int, int, const int *);
+extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB);
+extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB, HDC);
+extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB);
+extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB, int, int *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
+typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
+typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
+#endif
+
+#ifndef WGL_ARB_render_texture
+#define WGL_ARB_render_texture 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB, int);
+extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB, int);
+extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB, const int *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
+#endif
+
+#ifndef WGL_ARB_pixel_format_float
+#define WGL_ARB_pixel_format_float 1
+#endif
+
+#ifndef WGL_ARB_create_context
+#define WGL_ARB_create_context 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern HGLRC WINAPI wglCreateContextAttribsARB (HDC, HGLRC, const int *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
+#endif
+
+#ifndef WGL_EXT_display_color_table
+#define WGL_EXT_display_color_table 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort);
+extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *, GLuint);
+extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort);
+extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
+typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+#endif
+
+#ifndef WGL_EXT_extensions_string
+#define WGL_EXT_extensions_string 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern const char * WINAPI wglGetExtensionsStringEXT (void);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
+#endif
+
+#ifndef WGL_EXT_make_current_read
+#define WGL_EXT_make_current_read 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglMakeContextCurrentEXT (HDC, HDC, HGLRC);
+extern HDC WINAPI wglGetCurrentReadDCEXT (void);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
+#endif
+
+#ifndef WGL_EXT_pbuffer
+#define WGL_EXT_pbuffer 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC, int, int, int, const int *);
+extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT);
+extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT, HDC);
+extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT);
+extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT, int, int *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
+typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
+typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
+#endif
+
+#ifndef WGL_EXT_pixel_format
+#define WGL_EXT_pixel_format 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC, int, int, UINT, int *, int *);
+extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC, int, int, UINT, int *, FLOAT *);
+extern BOOL WINAPI wglChoosePixelFormatEXT (HDC, const int *, const FLOAT *, UINT, int *, UINT *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
+typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#endif
+
+#ifndef WGL_EXT_swap_control
+#define WGL_EXT_swap_control 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglSwapIntervalEXT (int);
+extern int WINAPI wglGetSwapIntervalEXT (void);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
+typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
+#endif
+
+#ifndef WGL_EXT_depth_float
+#define WGL_EXT_depth_float 1
+#endif
+
+#ifndef WGL_NV_vertex_array_range
+#define WGL_NV_vertex_array_range 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern void* WINAPI wglAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat);
+extern void WINAPI wglFreeMemoryNV (void *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
+typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
+#endif
+
+#ifndef WGL_3DFX_multisample
+#define WGL_3DFX_multisample 1
+#endif
+
+#ifndef WGL_EXT_multisample
+#define WGL_EXT_multisample 1
+#endif
+
+#ifndef WGL_OML_sync_control
+#define WGL_OML_sync_control 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetSyncValuesOML (HDC, INT64 *, INT64 *, INT64 *);
+extern BOOL WINAPI wglGetMscRateOML (HDC, INT32 *, INT32 *);
+extern INT64 WINAPI wglSwapBuffersMscOML (HDC, INT64, INT64, INT64);
+extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC, int, INT64, INT64, INT64);
+extern BOOL WINAPI wglWaitForMscOML (HDC, INT64, INT64, INT64, INT64 *, INT64 *, INT64 *);
+extern BOOL WINAPI wglWaitForSbcOML (HDC, INT64, INT64 *, INT64 *, INT64 *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
+typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
+typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
+typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
+typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
+typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
+#endif
+
+#ifndef WGL_I3D_digital_video_control
+#define WGL_I3D_digital_video_control 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC, int, int *);
+extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC, int, const int *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
+typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
+#endif
+
+#ifndef WGL_I3D_gamma
+#define WGL_I3D_gamma 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC, int, int *);
+extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC, int, const int *);
+extern BOOL WINAPI wglGetGammaTableI3D (HDC, int, USHORT *, USHORT *, USHORT *);
+extern BOOL WINAPI wglSetGammaTableI3D (HDC, int, const USHORT *, const USHORT *, const USHORT *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
+typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
+typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
+typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
+#endif
+
+#ifndef WGL_I3D_genlock
+#define WGL_I3D_genlock 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglEnableGenlockI3D (HDC);
+extern BOOL WINAPI wglDisableGenlockI3D (HDC);
+extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC, BOOL *);
+extern BOOL WINAPI wglGenlockSourceI3D (HDC, UINT);
+extern BOOL WINAPI wglGetGenlockSourceI3D (HDC, UINT *);
+extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC, UINT);
+extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC, UINT *);
+extern BOOL WINAPI wglGenlockSampleRateI3D (HDC, UINT);
+extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC, UINT *);
+extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC, UINT);
+extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC, UINT *);
+extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC, UINT *, UINT *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
+typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
+typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
+#endif
+
+#ifndef WGL_I3D_image_buffer
+#define WGL_I3D_image_buffer 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern LPVOID WINAPI wglCreateImageBufferI3D (HDC, DWORD, UINT);
+extern BOOL WINAPI wglDestroyImageBufferI3D (HDC, LPVOID);
+extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC, const HANDLE *, const LPVOID *, const DWORD *, UINT);
+extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC, const LPVOID *, UINT);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
+typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
+typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
+typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
+#endif
+
+#ifndef WGL_I3D_swap_frame_lock
+#define WGL_I3D_swap_frame_lock 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglEnableFrameLockI3D (void);
+extern BOOL WINAPI wglDisableFrameLockI3D (void);
+extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *);
+extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
+#endif
+
+#ifndef WGL_I3D_swap_frame_usage
+#define WGL_I3D_swap_frame_usage 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetFrameUsageI3D (float *);
+extern BOOL WINAPI wglBeginFrameTrackingI3D (void);
+extern BOOL WINAPI wglEndFrameTrackingI3D (void);
+extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *, DWORD *, float *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
+typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
+#endif
+
+#ifndef WGL_ATI_pixel_format_float
+#define WGL_ATI_pixel_format_float 1
+#endif
+
+#ifndef WGL_NV_float_buffer
+#define WGL_NV_float_buffer 1
+#endif
+
+#ifndef WGL_EXT_pixel_format_packed_float
+#define WGL_EXT_pixel_format_packed_float 1
+#endif
+
+#ifndef WGL_EXT_framebuffer_sRGB
+#define WGL_EXT_framebuffer_sRGB 1
+#endif
+
+#ifndef WGL_NV_present_video
+#define WGL_NV_present_video 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern int WINAPI wglEnumerateVideoDevicesNV (HDC, HVIDEOOUTPUTDEVICENV *);
+extern BOOL WINAPI wglBindVideoDeviceNV (HDC, unsigned int, HVIDEOOUTPUTDEVICENV, const int *);
+extern BOOL WINAPI wglQueryCurrentContextNV (int, int *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
+typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
+typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
+#endif
+
+#ifndef WGL_NV_video_out
+#define WGL_NV_video_out 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetVideoDeviceNV (HDC, int, HPVIDEODEV *);
+extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV);
+extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV, HPBUFFERARB, int);
+extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB, int);
+extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB, int, unsigned long *, BOOL);
+extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV, unsigned long *, unsigned long *);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
+typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
+typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
+typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
+typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
+typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
+#endif
+
+#ifndef WGL_NV_swap_group
+#define WGL_NV_swap_group 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglJoinSwapGroupNV (HDC, GLuint);
+extern BOOL WINAPI wglBindSwapBarrierNV (GLuint, GLuint);
+extern BOOL WINAPI wglQuerySwapGroupNV (HDC, GLuint *, GLuint *);
+extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC, GLuint *, GLuint *);
+extern BOOL WINAPI wglQueryFrameCountNV (HDC, GLuint *);
+extern BOOL WINAPI wglResetFrameCountNV (HDC);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
+typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
+typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
+typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
+typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
+#endif
+
+#ifndef WGL_NV_gpu_affinity
+#define WGL_NV_gpu_affinity 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglEnumGpusNV (UINT, HGPUNV *);
+extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV, UINT, PGPU_DEVICE);
+extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *);
+extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC, UINT, HGPUNV *);
+extern BOOL WINAPI wglDeleteDCNV (HDC);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
+typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
+typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
+typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
+typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
+#endif
+
+#ifndef WGL_AMD_gpu_association
+#define WGL_AMD_gpu_association 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern UINT WINAPI wglGetGPUIDsAMD (UINT, UINT *);
+extern INT WINAPI wglGetGPUInfoAMD (UINT, int, GLenum, UINT, void *);
+extern UINT WINAPI wglGetContextGPUIDAMD (HGLRC);
+extern HGLRC WINAPI wglCreateAssociatedContextAMD (UINT);
+extern HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT, HGLRC, const int *);
+extern BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC);
+extern BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC);
+extern HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
+extern VOID WINAPI wglBlitContextFramebufferAMD (HGLRC, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
+typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
+typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
+typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
+typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
+typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
+typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
+typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
+typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index 6484c761fc5b253876fe7b017e094b9c8fe56103..71ebe5e0f37013c6819b148533a566c93dbcbb52 100644 (file)
@@ -3,6 +3,10 @@ SConscript([
     'demos/SConscript',
     'redbook/SConscript',
     'samples/SConscript',
+    'tests/SConscript',
     'trivial/SConscript',
     'vp/SConscript',
+    'vpglsl/SConscript',
+    'fp/SConscript',
+    'wgl/SConscript',
 ])
index 401bfb49684864ec016e32ef3b293d260952ab9c..7b7a12bf88dc6a1af79b2e90167fd365e5a51482 100644 (file)
@@ -92,6 +92,7 @@ static void Redisplay( void )
         GLfloat seconds = (t - T0) / 1000.0;
         GLfloat fps = Frames / seconds;
         printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+         fflush(stdout);
         T0 = t;
         Frames = 0;
       }
index a84491d34fea0972d28904b32840e58181b4f92f..275c85105ede20ba13bd7d7744dd434f964314bc 100644 (file)
@@ -105,6 +105,7 @@ static void Redisplay (void)
                        GLfloat seconds = (GLfloat) (t - t0) / 1000.0f;
                        GLfloat fps = frames / seconds;
                        printf ("%d frames in %6.3f seconds = %6.3f FPS\n", frames, seconds, fps);
+                        fflush(stdout);
                        t0 = t;
                        frames = 0;
                }
index b3bdd64f68da6d4b4a438beac721739ba0f23cb5..26db42aed5e7fe24d012f53d23dbcf2dd5704c7f 100644 (file)
@@ -39,6 +39,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <GL/glew.h>
 #include "GL/glut.h"
 #include "readtex.h"
 
@@ -49,6 +50,45 @@ static GLboolean use_vertex_arrays = GL_FALSE;
 static GLboolean anim = GL_TRUE;
 static GLboolean NoClear = GL_FALSE;
 static GLint FrameParity = 0;
+static GLenum FilterIndex = 0;
+static GLint ClampIndex = 0;
+
+
+static struct {
+   GLenum mode;
+   const char *name;
+} ClampModes[] = {
+   { GL_CLAMP_TO_EDGE, "GL_CLAMP_TO_EDGE" },
+   { GL_CLAMP_TO_BORDER, "GL_CLAMP_TO_BORDER" },
+   { GL_CLAMP, "GL_CLAMP" },
+   { GL_REPEAT, "GL_REPEAT" }
+};
+
+#define NUM_CLAMP_MODES (sizeof(ClampModes) / sizeof(ClampModes[0]))
+
+
+static struct {
+   GLenum mag_mode, min_mode;
+   const char *name;
+} FilterModes[] = {
+   { GL_NEAREST, GL_NEAREST, "GL_NEAREST, GL_NEAREST" },
+   { GL_NEAREST, GL_LINEAR, "GL_NEAREST, GL_LINEAR" },
+   { GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST, "GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST" },
+   { GL_NEAREST, GL_NEAREST_MIPMAP_LINEAR, "GL_NEAREST, GL_NEAREST_MIPMAP_LINEAR" },
+   { GL_NEAREST, GL_LINEAR_MIPMAP_NEAREST, "GL_NEAREST, GL_LINEAR_MIPMAP_NEAREST" },
+   { GL_NEAREST, GL_LINEAR_MIPMAP_LINEAR, "GL_NEAREST, GL_LINEAR_MIPMAP_LINEAR" },
+
+   { GL_LINEAR, GL_NEAREST, "GL_LINEAR, GL_NEAREST" },
+   { GL_LINEAR, GL_LINEAR, "GL_LINEAR, GL_LINEAR" },
+   { GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, "GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST" },
+   { GL_LINEAR, GL_NEAREST_MIPMAP_LINEAR, "GL_LINEAR, GL_NEAREST_MIPMAP_LINEAR" },
+   { GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, "GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST" },
+   { GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, "GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR" }
+};
+
+#define NUM_FILTER_MODES (sizeof(FilterModes) / sizeof(FilterModes[0]))
+
+
 
 #define eps1 0.99
 #define br   20.0  /* box radius */
@@ -158,6 +198,8 @@ static void draw_skybox( void )
 
 static void draw( void )
 {
+   GLenum wrap;
+
    if (NoClear) {
       /* This demonstrates how we can avoid calling glClear.
        * This method only works if every pixel in the window is painted for
@@ -183,6 +225,16 @@ static void draw( void )
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    }
 
+   glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER,
+                   FilterModes[FilterIndex].min_mode);
+   glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER,
+                   FilterModes[FilterIndex].mag_mode);
+
+   wrap = ClampModes[ClampIndex].mode;
+   glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, wrap);
+   glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, wrap);
+   glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, wrap);
+
    glPushMatrix(); /*MODELVIEW*/
       glTranslatef( 0.0, 0.0, -EyeDist );
 
@@ -256,6 +308,14 @@ static void key(unsigned char k, int x, int y)
          else
             glutIdleFunc(NULL);
          break;
+      case 'f':
+         FilterIndex = (FilterIndex + 1) % NUM_FILTER_MODES;
+         printf("Tex filter: %s\n", FilterModes[FilterIndex].name);
+         break;
+      case 'c':
+         ClampIndex = (ClampIndex + 1) % NUM_CLAMP_MODES;
+         printf("Tex wrap mode: %s\n", ClampModes[ClampIndex].name);
+         break;
       case 'm':
          mode = !mode;
          set_mode(mode);
@@ -321,7 +381,7 @@ static void reshape(int width, int height)
 static void init_checkers( void )
 {
 #define CUBE_TEX_SIZE 64
-   GLubyte image[CUBE_TEX_SIZE][CUBE_TEX_SIZE][3];
+   GLubyte image[CUBE_TEX_SIZE][CUBE_TEX_SIZE][4];
    static const GLubyte colors[6][3] = {
       { 255,   0,   0 },       /* face 0 - red */
       {   0, 255, 255 },       /* face 1 - cyan */
@@ -348,21 +408,25 @@ static void init_checkers( void )
       for (i = 0; i < CUBE_TEX_SIZE; i++) {
          for (j = 0; j < CUBE_TEX_SIZE; j++) {
             if ((i/4 + j/4) & 1) {
-               image[i][j][0] = colors[f][0];
+               image[i][j][0] = colors[f][2];
                image[i][j][1] = colors[f][1];
-               image[i][j][2] = colors[f][2];
+               image[i][j][2] = colors[f][0];
+               image[i][j][3] = 255;
             }
             else {
                image[i][j][0] = 255;
                image[i][j][1] = 255;
                image[i][j][2] = 255;
+               image[i][j][3] = 255;
             }
          }
       }
 
-      glTexImage2D(targets[f], 0, GL_RGB, CUBE_TEX_SIZE, CUBE_TEX_SIZE, 0,
-                   GL_RGB, GL_UNSIGNED_BYTE, image);
+      glTexImage2D(targets[f], 0, GL_RGBA8, CUBE_TEX_SIZE, CUBE_TEX_SIZE, 0,
+                   GL_BGRA, GL_UNSIGNED_BYTE, image);
    }
+
+   glGenerateMipmapEXT(GL_TEXTURE_CUBE_MAP_ARB);
 }
 
 
@@ -431,32 +495,30 @@ static void load_envmaps(void)
 
 static void init( GLboolean useImageFiles )
 {
-   GLenum filter;
-
-   /* check for extension */
+   /* check for extensions */
    {
       char *exten = (char *) glGetString(GL_EXTENSIONS);
       if (!strstr(exten, "GL_ARB_texture_cube_map")) {
          printf("Sorry, this demo requires GL_ARB_texture_cube_map\n");
          exit(0);
       }
+
+      /* Needed for glGenerateMipmapEXT
+       */
+      if (!strstr(exten, "GL_EXT_framebuffer_object")) {
+         printf("Sorry, this demo requires GL_EXT_framebuffer_object\n");
+         exit(0);
+      }
    }
    printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
 
    if (useImageFiles) {
       load_envmaps();
-      filter = GL_LINEAR;
    }
    else {
       init_checkers();
-      filter = GL_NEAREST;
    }
 
-   glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, filter);
-   glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, filter);
-   glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-   glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
    glEnable(GL_TEXTURE_CUBE_MAP_ARB);
    glEnable(GL_DEPTH_TEST);
 
@@ -472,6 +534,8 @@ static void usage(void)
    printf("keys:\n");
    printf("  SPACE - toggle animation\n");
    printf("  CURSOR KEYS - rotation\n");
+   printf("  c - toggle texture clamp/wrap mode\n");
+   printf("  f - toggle texture filter mode\n");
    printf("  m - toggle texgen reflection mode\n");
    printf("  z/Z - change viewing distance\n");
 }
@@ -502,6 +566,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize(600, 500);
    glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
    glutCreateWindow("Texture Cube Mapping");
+   glewInit();
    glutReshapeFunc( reshape );
    glutKeyboardFunc( key );
    glutSpecialFunc( specialkey );
index 14fd1e68629b15e2877e6d11adaf3f23c8f8c434..3cf311e7782ce139d56c65fa4fd3fef5018231a0 100644 (file)
@@ -386,7 +386,10 @@ DrawPositionedPiston(const Engine *eng, float crankAngle)
    glPushMatrix();
       glRotatef(-90, 1, 0, 0);
       glTranslatef(0, 0, pos);
-      DrawPiston(eng);
+      if (eng->PistonList)
+         glCallList(eng->PistonList);
+      else
+         DrawPiston(eng);
    glPopMatrix();
 }
 
@@ -961,6 +964,28 @@ Draw(void)
         glEnable(GL_TEXTURE_2D);
    }
 
+   /* also print out a periodic fps to stdout.  useful for trying to
+    * figure out the performance impact of rendering the string above
+    * with glBitmap.
+    */
+   {
+      static GLint T0 = 0;
+      static GLint Frames = 0;
+      GLint t = glutGet(GLUT_ELAPSED_TIME);
+      
+      Frames++;
+         
+      if (t - T0 >= 5000) {
+         GLfloat seconds = (t - T0) / 1000.0;
+         GLfloat fps = Frames / seconds;
+         printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+         fflush(stdout);
+         T0 = t;
+         Frames = 0;
+      }
+   }
+
+
    glutSwapBuffers();
 }
 
index e79b5cc1970c1e802c2b42f647c436451113726f..41a13cc9f468b8e0940389f9d7b84e5510194319 100644 (file)
@@ -105,6 +105,7 @@ Redisplay(void)
          GLfloat fps = frames / seconds;
          printf("%d frames in %6.3f seconds = %6.3f FPS\n",
                 frames, seconds, fps);
+         fflush(stdout);
          t0 = t;
          frames = 0;
       }
index 35bde04417b17f3526907f442fb0a3bf6ccd2f23..2dcf32f92ff64460414506c6d171c8c86df72625 100644 (file)
@@ -314,6 +314,7 @@ draw(void)
          GLfloat seconds = (t - T0) / 1000.0;
          GLfloat fps = Frames / seconds;
          printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+         fflush(stdout);
          T0 = t;
          Frames = 0;
       }
index 2a9fefefb53fded73397f3223c8bb36767ee6de3..6016162d6f74c6973bf80113269a7af87c587c4e 100644 (file)
@@ -219,6 +219,7 @@ draw(void)
       GLfloat seconds = (t - T0) / 1000.0;
       GLfloat fps = Frames / seconds;
       printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+      fflush(stdout);
       T0 = t;
       Frames = 0;
       if ((t >= 999.0 * autoexit) && (autoexit)) {
index 8363f2abc6d361ceb44fbde121cb40bf871093ef..8fe405e80760e32d8c1d7c9f4330223b1f0d900f 100644 (file)
@@ -905,6 +905,7 @@ draw (void)
            GLfloat seconds = (t - T0) / 1000.0;
            GLfloat fps = Frames / seconds;
            printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
+            fflush(stdout);
            T0 = t;
            Frames = 0;
        }
index b2126e32678416c86d239151316f564120d48d18..69694b23a09bc5cb44782a435da30761a39214fa 100644 (file)
@@ -132,6 +132,7 @@ static void Display( void )
          GLfloat seconds = (t - T0) / 1000.0;
          GLfloat fps = Frames / seconds;
          printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
+         fflush(stdout);
          T0 = t;
          Frames = 0;
       }
index 4ee129281645101cbd9d0c687229d3c8da975fc0..e972b62673ff01b15421c1a7f78da85c42a87dd2 100644 (file)
@@ -65,6 +65,7 @@ static void Redisplay (void)
       GLfloat seconds = (GLfloat) (t - t0) / 1000.0f;
       GLfloat fps = frames / seconds;
       printf ("%d frames in %6.3f seconds = %6.3f FPS\n", frames, seconds, fps);
+      fflush(stdout);
       t0 = t;
       frames = 0;
    }
index 393741cc9d66dad503e702a8fbf638b7a6a3b169..e280d8f507c553d2d4201cf9176b6ef4d8325950 100644 (file)
@@ -69,6 +69,7 @@
 #define NO_STIPPLE     0x08000000
 #define POLYGON_FILL   0x10000000
 #define POLYGON_LINE   0x20000000
+#define POLYGON_POINT  0x40000000
 
 #define LIGHT_MASK             (LIT|UNLIT|REFLECT)
 #define FILTER_MASK            (POINT_FILTER|LINEAR_FILTER)
@@ -81,7 +82,7 @@
 #define SHADE_MASK             (SHADE_SMOOTH|SHADE_FLAT)
 #define FOG_MASK               (FOG|NO_FOG)
 #define STIPPLE_MASK           (STIPPLE|NO_STIPPLE)
-#define POLYGON_MASK           (POLYGON_FILL|POLYGON_LINE)
+#define POLYGON_MASK           (POLYGON_FILL|POLYGON_LINE|POLYGON_POINT)
 
 #define MAXVERTS 10000
 static GLint maxverts = MAXVERTS;
@@ -147,7 +148,7 @@ static void read_surface( char *filename )
 static void print_flags( const char *msg, GLuint flags ) 
 {
    fprintf(stderr, 
-          "%s (0x%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+          "%s (0x%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
           msg, flags,
           (flags & GLVERTEX) ? "glVertex, " : "",
           (flags & DRAW_ARRAYS) ? "glDrawArrays, " : "",
@@ -166,7 +167,8 @@ static void print_flags( const char *msg, GLuint flags )
           (flags & MATERIALS) ? "materials, " : "",
           (flags & FOG) ? "fog, " : "",
           (flags & STIPPLE) ? "stipple, " : "",
-          (flags & POLYGON_LINE) ? "polygon mode line, " : "");
+          (flags & POLYGON_LINE) ? "polygon mode line, " : "",
+          (flags & POLYGON_POINT) ? "polygon mode point, " : "");
 }
 
 
@@ -711,9 +713,12 @@ static void ModeMenu(int m)
       if (m & POLYGON_FILL) {
         glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
       }
-      else {
+      else if (m & POLYGON_LINE) {
         glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
       }
+      else {
+        glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
+      }
    }
 
 #ifdef GL_EXT_vertex_array
@@ -1089,6 +1094,7 @@ int main(int argc, char **argv)
    glutAddMenuEntry("", 0);
    glutAddMenuEntry("Polygon Mode Fill",     POLYGON_FILL);
    glutAddMenuEntry("Polygon Mode Line",     POLYGON_LINE);
+   glutAddMenuEntry("Polygon Mode Points",   POLYGON_POINT);
    glutAddMenuEntry("", 0);
    glutAddMenuEntry("Point Filtered",        POINT_FILTER);
    glutAddMenuEntry("Linear Filtered",       LINEAR_FILTER);
index 0bec0663bc2835d9162110e0c569f4d7253dad54..b72af12885d24c13643f0d3da30dc9b5431a0f7e 100644 (file)
@@ -401,6 +401,7 @@ DrawWindow(void)
          GLfloat seconds = (t - t0) / 1000.0;
          GLfloat fps = frames / seconds;
          printf("%d frames in %g seconds = %g FPS\n", frames, seconds, fps);
+         fflush(stdout);
          t0 = t;
          frames = 0;
       }
index 4d4656e722b1e225f7b0cbbbf73492a6f455dc0b..f65ac4ce36c74b3fd34c680533aae10f1083d0b2 100644 (file)
@@ -47,7 +47,10 @@ static void Idle( void )
 }
 
 /*static int max( int a, int b ) { return a > b ? a : b; }*/
+
+#ifndef min
 static int min( int a, int b ) { return a < b ? a : b; }
+#endif
 
 static void DrawObject()
 {
@@ -150,6 +153,7 @@ static void Display( void )
 
       GLfloat fps = Frames / seconds;
       printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+      fflush(stdout);
 
       drift_increment = 2.2 * seconds / Frames;
       T0 = t;
index e3b0303975911fd6d856ff9f4a67335a267c1c83..0e6089bced54e977eefff53845d16e28b5cc9686 100644 (file)
@@ -79,6 +79,7 @@ static void Display( void )
          GLfloat seconds = (t - T0) / 1000.0;
          GLfloat fps = Frames / seconds;
          printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
+         fflush(stdout);
          T0 = t;
          Frames = 0;
       }
index ef6644cce27cdd13a1a162da6c40bfa567c3ed84..681928cf26022a227224d70eab79fdcf3ad35829 100755 (executable)
@@ -8,7 +8,7 @@ TOP = ../..
 include $(TOP)/configs/current
 
 
-LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
 
 SOURCES = \
        tri-tex.c \
diff --git a/progs/fp/SConscript b/progs/fp/SConscript
new file mode 100644 (file)
index 0000000..5537997
--- /dev/null
@@ -0,0 +1,17 @@
+Import('env')
+
+if not env['GLUT']:
+    Return()
+
+env = env.Clone()
+
+env.Prepend(CPPPATH = [
+       '../util',
+])
+
+env.Prepend(LIBS = ['$GLUT_LIB'])
+
+env.Program(
+        target = 'fp-tri',
+        source = ['fp-tri.c'],
+    )
index 843f897871b4f865a652499ab2ddc014955ed342..bc490c05201f08f32a6b37340959edd6d5be7000 100644 (file)
@@ -2,10 +2,19 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
+
+#ifndef WIN32
 #include <unistd.h>
 #include <signal.h>
+#endif
+
+#include <GL/glew.h>
+#include <GL/glut.h>
+
+#include "readtex.c"
+
+
+#define TEXTURE_FILE "../images/bw.rgb"
 
 unsigned show_fps = 0;
 unsigned int frame_cnt = 0;
@@ -15,11 +24,14 @@ static const char *filename = NULL;
 static void usage(char *name)
 {
    fprintf(stderr, "usage: %s [ options ] shader_filename\n", name);
+#ifndef WIN32
    fprintf(stderr, "\n" );
    fprintf(stderr, "options:\n");
    fprintf(stderr, "    -fps  show frames per second\n");
+#endif
 }
 
+#ifndef WIN32
 void alarmhandler (int sig)
 {
    if (sig == SIGALRM) {
@@ -31,6 +43,7 @@ void alarmhandler (int sig)
    signal(SIGALRM, alarmhandler);
    alarm(5);
 }
+#endif
 
 static void args(int argc, char *argv[])
 {
@@ -57,6 +70,7 @@ static void args(int argc, char *argv[])
 
 static void Init( void )
 {
+   GLuint Texture;
    GLint errno;
    GLuint prognum;
    char buf[4096];
@@ -99,7 +113,70 @@ static void Init( void )
    }
    glEnable(GL_FRAGMENT_PROGRAM_ARB);
 
-   glClearColor(.3, .3, .3, 0);
+
+   /* Load texture */
+   glGenTextures(1, &Texture);
+   glBindTexture(GL_TEXTURE_2D, Texture);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+   if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
+      printf("Error: couldn't load texture image file %s\n", TEXTURE_FILE);
+      exit(1);
+   }
+
+
+   glGenTextures(1, &Texture);
+   glActiveTextureARB(GL_TEXTURE0_ARB + 1);
+   glBindTexture(GL_TEXTURE_2D, Texture);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+   {
+      GLubyte data[32][32];
+      int width = 32;
+      int height = 32;
+      int i;
+      int j;
+
+      for (i = 0; i < 32; i++)
+         for (j = 0; j < 32; j++)
+        {
+           /**
+            ** +-----------+
+            ** |     W     |
+            ** |  +-----+  |
+            ** |  |     |  |
+            ** |  |  B  |  |
+            ** |  |     |  |
+            ** |  +-----+  |
+            ** |           |
+            ** +-----------+
+            **/
+           int i2 = i - height / 2;
+           int j2 = j - width / 2;
+           int h8 = height / 8;
+           int w8 = width / 8;
+           if ( -h8 <= i2 && i2 <= h8 && -w8 <= j2 && j2 <= w8 ) {
+              data[i][j] = 0x00;
+           } else if ( -2 * h8 <= i2 && i2 <= 2 * h8 && -2 * w8 <= j2 && j2 <= 2 * w8 ) {
+              data[i][j] = 0x55;
+           } else if ( -3 * h8 <= i2 && i2 <= 3 * h8 && -3 * w8 <= j2 && j2 <= 3 * w8 ) {
+              data[i][j] = 0xaa;
+           } else {
+              data[i][j] = 0xff;
+           }
+        }
+
+      glTexImage2D( GL_TEXTURE_2D, 0,
+                    GL_ALPHA8,
+                    32, 32, 0,
+                    GL_ALPHA, GL_UNSIGNED_BYTE, data );
+   }
+
+
+   glClearColor(.1, .3, .5, 0);
 }
 
 static void Reshape(int width, int height)
@@ -142,7 +219,6 @@ static void Display(void)
    glEnd();
 
    glFlush();
-
    if (show_fps) {
       ++frame_cnt;
       glutPostRedisplay();
@@ -158,14 +234,17 @@ int main(int argc, char **argv)
    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH);
    args(argc, argv);
    glutCreateWindow(filename);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Display);
    Init();
+#ifndef WIN32
    if (show_fps) {
       signal(SIGALRM, alarmhandler);
       alarm(5);
    }
+#endif
    glutMainLoop();
    return 0;
 }
diff --git a/progs/fp/kill-pos.txt b/progs/fp/kill-pos.txt
new file mode 100644 (file)
index 0000000..5ff4f6f
--- /dev/null
@@ -0,0 +1,9 @@
+!!ARBfp1.0
+TEMP R0;
+SUB R0.xy, fragment.position, {125}.x;
+MOV R0.zw, {0}.x;
+DP3 R0, R0, R0;
+SUB R0.x, R0, {10000}.x;
+KIL -R0.x;
+MOV result.color, fragment.color;
+END
index 27fac12a3a502add3e8602df04a982e564554eed..1875897d781ae5795723085ff44539cafaa2630c 100644 (file)
@@ -1,3 +1,4 @@
 !!ARBfp1.0
-MUL result.color, fragment.position, {.005}.x;
+MOV result.color, {0}.x;
+MUL result.color.xy, fragment.position, {.005}.x;
 END
diff --git a/progs/fp/tex-pos-kil-1.txt b/progs/fp/tex-pos-kil-1.txt
new file mode 100644 (file)
index 0000000..3f01e79
--- /dev/null
@@ -0,0 +1,7 @@
+!!ARBfp1.0
+TEMP R0;
+MUL R0, fragment.position, {0.03125}.x;
+TEX R0, R0, texture[1], 2D;
+KIL -R0;
+MOV result.color, fragment.color;
+END
diff --git a/progs/fp/tex-pos-kil.txt b/progs/fp/tex-pos-kil.txt
new file mode 100644 (file)
index 0000000..b7aaa9f
--- /dev/null
@@ -0,0 +1,8 @@
+!!ARBfp1.0
+TEMP R0;
+MUL R0, fragment.position, {0.008}.x;
+TEX R0, R0, texture[0], 2D;
+SUB R0, R0, {0.25}.x;
+KIL R0.xyzz;
+MOV result.color, fragment.color;
+END
diff --git a/progs/fp/tex-pos.txt b/progs/fp/tex-pos.txt
new file mode 100644 (file)
index 0000000..b969f42
--- /dev/null
@@ -0,0 +1,6 @@
+!!ARBfp1.0
+TEMP R0;
+MOV R0, {0.0}.x;
+MUL R0.xy, fragment.position, {0.008}.x;
+TEX result.color, R0, texture[0], 2D;
+END
diff --git a/progs/fp/tex.txt b/progs/fp/tex.txt
new file mode 100644 (file)
index 0000000..b3a885d
--- /dev/null
@@ -0,0 +1,3 @@
+!!ARBfp1.0
+TEX result.color, fragment.color, texture[0], 2D;
+END
index 7a51c8cf6f97a2be1e10df9b936b70f17b51d8d3..5fdb4ef16d4e63354e6e90eecd017770708d7ebe 100644 (file)
@@ -18,6 +18,7 @@ samplers
 samplers_array
 shaderutil.c
 shaderutil.h
+shadow_sampler
 skinning
 texdemo1
 toyball
index 7099eeadbd96448dfe7d2de317ef9ec84bb254d8..80612770332e7a436e70b2488ead871a2fb81d8d 100644 (file)
@@ -25,6 +25,7 @@ PROGS = \
        pointcoord \
        samplers \
        samplers_array \
+       shadow_sampler \
        skinning \
        texdemo1 \
        toyball \
diff --git a/progs/glsl/shadow_sampler.c b/progs/glsl/shadow_sampler.c
new file mode 100644 (file)
index 0000000..2902b53
--- /dev/null
@@ -0,0 +1,341 @@
+/**
+ * Test shadow2DRectProj() and shadow2D() functions.
+ * Brian Paul
+ * 11 April 2007
+ */
+
+#define GL_GLEXT_PROTOTYPES
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <GL/gl.h>
+#include <GL/glut.h>
+#include <GL/glext.h>
+#include "extfuncs.h"
+
+
+/** Use GL_RECTANGLE texture (with projective texcoords)? */
+#define USE_RECT 01
+
+#define TEXSIZE 16
+
+
+static char *FragProgFile = NULL;
+static char *VertProgFile = NULL;
+
+static GLuint fragShader;
+static GLuint vertShader;
+static GLuint program;
+
+static GLint uTexture2D;
+static GLint uTextureRect;
+
+static GLint win = 0;
+
+static GLenum Filter = GL_LINEAR;
+
+static void
+CheckError(int line)
+{
+   GLenum err = glGetError();
+   if (err) {
+      printf("GL Error %s (0x%x) at line %d\n",
+             gluErrorString(err), (int) err, line);
+   }
+}
+
+
+static void
+PrintString(const char *s)
+{
+   while (*s) {
+      glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
+      s++;
+   }
+}
+
+
+static void
+Redisplay(void)
+{
+   CheckError(__LINE__);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glPushMatrix();
+
+   CheckError(__LINE__);
+   glUseProgram_func(program);
+   CheckError(__LINE__);
+
+   glBegin(GL_POLYGON);
+#if USE_RECT
+   /* scale coords by two to test projection */
+   glTexCoord4f(        0,         0,   0, 2.0);  glVertex2f(-1, -1);
+   glTexCoord4f(2*TEXSIZE,         0, 2*1, 2.0);  glVertex2f( 1, -1);
+   glTexCoord4f(2*TEXSIZE, 2*TEXSIZE, 2*1, 2.0);  glVertex2f( 1,  1);
+   glTexCoord4f(        0, 2*TEXSIZE,   0, 2.0);  glVertex2f(-1,  1);
+#else
+   glTexCoord3f(0, 0, 0);  glVertex2f(-1, -1);
+   glTexCoord3f(1, 0, 1);  glVertex2f( 1, -1);
+   glTexCoord3f(1, 1, 1);  glVertex2f( 1,  1);
+   glTexCoord3f(0, 1, 0);  glVertex2f(-1,  1);
+#endif
+   glEnd();
+
+   glPopMatrix();
+
+   glUseProgram_func(0);
+   glWindowPos2iARB(80, 20);
+   PrintString("white   black   white   black");
+
+   glutSwapBuffers();
+}
+
+
+static void
+Reshape(int width, int height)
+{
+   glViewport(0, 0, width, height);
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
+   glTranslatef(0.0f, 0.0f, -8.0f);
+}
+
+
+static void
+CleanUp(void)
+{
+   glDeleteShader_func(fragShader);
+   glDeleteShader_func(vertShader);
+   glDeleteProgram_func(program);
+   glutDestroyWindow(win);
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+  (void) x;
+  (void) y;
+
+   switch(key) {
+   case 27:
+      CleanUp();
+      exit(0);
+      break;
+   }
+   glutPostRedisplay();
+}
+
+
+static void
+MakeTexture(void)
+{
+   GLfloat image[TEXSIZE][TEXSIZE];
+   GLuint i, j;
+
+   for (i = 0; i < TEXSIZE; i++) {
+      for (j = 0; j < TEXSIZE; j++) {
+         if (j < (TEXSIZE / 2)) {
+            image[i][j] = 0.25;
+         }
+         else {
+            image[i][j] = 0.75;
+         }
+      }
+   }
+
+   glActiveTexture(GL_TEXTURE0); /* unit 0 */
+   glBindTexture(GL_TEXTURE_2D, 42);
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, TEXSIZE, TEXSIZE, 0,
+                GL_DEPTH_COMPONENT, GL_FLOAT, image);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
+                   GL_COMPARE_R_TO_TEXTURE_ARB);
+   CheckError(__LINE__);
+
+   glActiveTexture(GL_TEXTURE1); /* unit 1 */
+   glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 43);
+   glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_DEPTH_COMPONENT,
+                TEXSIZE, 10, 0,/*16x10*/
+                GL_DEPTH_COMPONENT, GL_FLOAT, image);
+   glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, Filter);
+   glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, Filter);
+   glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_COMPARE_MODE_ARB,
+                   GL_COMPARE_R_TO_TEXTURE_ARB);
+   CheckError(__LINE__);
+}
+
+
+static void
+LoadAndCompileShader(GLuint shader, const char *text)
+{
+   GLint stat;
+   glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
+   glCompileShader_func(shader);
+   glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
+   if (!stat) {
+      GLchar log[1000];
+      GLsizei len;
+      glGetShaderInfoLog_func(shader, 1000, &len, log);
+      fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
+      exit(1);
+   }
+}
+
+
+/**
+ * Read a shader from a file.
+ */
+static void
+ReadShader(GLuint shader, const char *filename)
+{
+   const int max = 100*1000;
+   int n;
+   char *buffer = (char*) malloc(max);
+   FILE *f = fopen(filename, "r");
+   if (!f) {
+      fprintf(stderr, "fslight: Unable to open shader file %s\n", filename);
+      exit(1);
+   }
+
+   n = fread(buffer, 1, max, f);
+   printf("fslight: read %d bytes from shader file %s\n", n, filename);
+   if (n > 0) {
+      buffer[n] = 0;
+      LoadAndCompileShader(shader, buffer);
+   }
+
+   fclose(f);
+   free(buffer);
+}
+
+
+static void
+CheckLink(GLuint prog)
+{
+   GLint stat;
+   glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
+   if (!stat) {
+      GLchar log[1000];
+      GLsizei len;
+      glGetProgramInfoLog_func(prog, 1000, &len, log);
+      fprintf(stderr, "Linker error:\n%s\n", log);
+   }
+}
+
+
+static void
+Init(void)
+{
+   static const char *fragShaderText =
+      "uniform sampler2DShadow shadowTex2D; \n"
+      "uniform sampler2DRectShadow shadowTexRect; \n"
+      "void main() {\n"
+#if USE_RECT
+      "   gl_FragColor = shadow2DRectProj(shadowTexRect, gl_TexCoord[0]); \n"
+#else
+      "   gl_FragColor = shadow2D(shadowTex2D, gl_TexCoord[0].xyz); \n"
+#endif
+      "}\n";
+   static const char *vertShaderText =
+      "void main() {\n"
+      "   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
+      "   gl_TexCoord[0] = gl_MultiTexCoord0; \n"
+      "}\n";
+   const char *version;
+
+#if USE_RECT
+   if (!glutExtensionSupported("GL_ARB_texture_rectangle")) {
+      printf("This program requires GL_ARB_texture_rectangle\n");
+      exit(1);
+   }
+#endif
+
+   version = (const char *) glGetString(GL_VERSION);
+   if (version[0] != '2' || version[1] != '.') {
+      printf("This program requires OpenGL 2.x, found %s\n", version);
+      exit(1);
+   }
+   printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
+
+   GetExtensionFuncs();
+
+   fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
+   if (FragProgFile)
+      ReadShader(fragShader, FragProgFile);
+   else
+      LoadAndCompileShader(fragShader, fragShaderText);
+
+   vertShader = glCreateShader_func(GL_VERTEX_SHADER);
+   if (VertProgFile)
+      ReadShader(vertShader, VertProgFile);
+   else
+      LoadAndCompileShader(vertShader, vertShaderText);
+
+   program = glCreateProgram_func();
+   glAttachShader_func(program, fragShader);
+   glAttachShader_func(program, vertShader);
+   glLinkProgram_func(program);
+   CheckLink(program);
+   glUseProgram_func(program);
+
+   uTexture2D = glGetUniformLocation_func(program, "shadowTex2D");
+   uTextureRect = glGetUniformLocation_func(program, "shadowTexRect");
+   printf("uTexture2D %d  uTextureRect %d\n", uTexture2D, uTextureRect);
+   if (uTexture2D >= 0) {
+      glUniform1i_func(uTexture2D, 0);  /* use texture unit 0 */
+   }
+   if (uTextureRect >= 0) {
+      glUniform1i_func(uTextureRect, 1);  /* use texture unit 0 */
+   }
+   CheckError(__LINE__);
+
+   glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
+   glColor3f(1, 1, 1);
+
+   MakeTexture();
+   CheckError(__LINE__);
+}
+
+
+static void
+ParseOptions(int argc, char *argv[])
+{
+   int i;
+   for (i = 1; i < argc; i++) {
+      if (strcmp(argv[i], "-fs") == 0) {
+         FragProgFile = argv[i+1];
+      }
+      else if (strcmp(argv[i], "-vs") == 0) {
+         VertProgFile = argv[i+1];
+      }
+   }
+}
+
+
+int
+main(int argc, char *argv[])
+{
+   glutInit(&argc, argv);
+   glutInitWindowPosition( 0, 0);
+   glutInitWindowSize(400, 300);
+   glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
+   win = glutCreateWindow(argv[0]);
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutDisplayFunc(Redisplay);
+   ParseOptions(argc, argv);
+   Init();
+   glutMainLoop();
+   return 0;
+}
+
+
index c5b9e28dab14d91b5c6c2247e1678fc733435a3e..0ed3a885c26727ba5f9afc7a491a6aeb64329db9 100644 (file)
@@ -14,7 +14,9 @@ arbvpwarpmesh
 arraytexture
 blendminmax
 blendsquare
+blendxor
 bufferobj
+bumpmap
 bug_3050
 bug_3101
 bug_3195
@@ -59,6 +61,8 @@ readtex.h
 seccolor
 sharedtex
 shader_api
+shaderutil.c
+shaderutil.h
 stencil_twoside
 stencil_wrap
 stencilwrap
index 34c9ab1dcef28a3038b71a9840e2fdc408080d28..58ea5690df6e41d0909eb3d61c9e2a265d1c0111 100644 (file)
@@ -8,7 +8,7 @@ TOP = ../..
 include $(TOP)/configs/current
 
 
-LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
 
 SOURCES = \
        afsmultiarb.c \
@@ -28,6 +28,7 @@ SOURCES = \
        blendsquare.c \
        blendxor.c \
        bufferobj.c \
+       bumpmap.c \
        bug_3050.c \
        bug_3101.c \
        bug_3195.c \
@@ -54,7 +55,10 @@ SOURCES = \
        jkrahntest.c \
        lineclip.c \
        manytex.c \
+       mapbufrange.c \
+       mapvbo.c \
        minmag.c \
+       mipgen.c \
        mipmap_limits.c \
        mipmap_view.c \
        multipal.c \
@@ -145,6 +149,12 @@ afsmultiarb: afsmultiarb.o readtex.o
 afsmultiarb.o: afsmultiarb.c readtex.h
        $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) afsmultiarb.c -o $@
 
+bumpmap: bumpmap.o readtex.o
+       $(CC) $(CFLAGS) $(LDFLAGS) bumpmap.o readtex.o $(LIBS) -o $@
+
+bumpmap.o: bumpmap.c readtex.h
+       $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) bumpmap.c -o $@
+
 drawbuffers: drawbuffers.o
        $(APP_CC) $(CFLAGS) $(LDFLAGS) drawbuffers.o $(LIBS) -o $@
 
@@ -175,6 +185,11 @@ mipmap_view: mipmap_view.o readtex.o
 mipmap_view.o: mipmap_view.c readtex.h
        $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
 
+mipmap_limits: mipmap_limits.o readtex.o
+       $(APP_CC) $(CFLAGS) mipmap_limits.o readtex.o $(LIBS) -o $@
+
+mipmap_limits.o: mipmap_limits.c readtex.h
+       $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
 
 fillrate: fillrate.o readtex.o
        $(APP_CC) $(CFLAGS) fillrate.o readtex.o $(LIBS) -o $@
diff --git a/progs/tests/SConscript b/progs/tests/SConscript
new file mode 100644 (file)
index 0000000..cfeb9d1
--- /dev/null
@@ -0,0 +1,134 @@
+Import('*')
+
+if not env['GLUT']:
+    Return()
+
+env = env.Clone()
+
+env.Prepend(CPPPATH = [
+       '../util',
+])
+
+env.Prepend(LIBS = [
+       util,
+       '$GLUT_LIB'
+])
+
+if env['platform'] == 'windows':
+    env.Append(CPPDEFINES = ['NOMINMAX'])
+    env.Prepend(LIBS = ['winmm'])
+
+linux_progs = [
+    'api_speed',
+]
+
+glx_progs = [
+    'auxbuffer',
+    'getprocaddress',
+    'jkrahntest',
+    'sharedtex',
+    'texcompress2',
+    'texobjshare',
+]
+
+mesa_progs = [
+    'debugger',
+]
+
+progs = [
+    'afsmultiarb',
+    'antialias',
+    'arbfpspec',
+    'arbfptest1',
+    'arbfptexture',
+    'arbfptrig',
+    'arbnpot-mipmap',
+    'arbnpot',
+    'arbvptest1',
+    'arbvptest3',
+    'arbvptorus',
+    'arbvpwarpmesh',
+    'arraytexture',
+    'blendminmax',
+    'blendsquare',
+    'blendxor',
+    'bufferobj',
+    'bug_3050',
+    'bug_3101',
+    'bug_3195',
+    'bug_texstore_i8',
+    'calibrate_rast',
+    'copypixrate',
+    'crossbar',
+    'cva',
+    'dinoshade',
+    'drawbuffers',
+    'exactrast',
+    'ext422square',
+    'fbotest1',
+    'fbotest2',
+    'fbotexture',
+    'fillrate',
+    'floattex',
+    'fog',
+    'fogcoord',
+    'fptest1',
+    'fptexture',
+    'interleave',
+    'invert',
+    'lineclip',
+    'manytex',
+    'mapbufrange',
+    'mapvbo',
+    'minmag',
+    'mipgen',
+    'mipmap_limits',
+    'mipmap_view',
+    'multipal',
+    'multitexarray',
+    'multiwindow',
+    'no_s3tc',
+    'packedpixels',
+    'pbo',
+    'prog_parameter',
+    'projtex',
+    'quads',
+    'random',
+    'readrate',
+    'rubberband',
+    'seccolor',
+    'shader_api',
+    'stencil_twoside',
+    'stencil_wrap',
+    'stencilwrap',
+    'subtex',
+    'subtexrate',
+    'tex1d',
+    'texcmp',
+    'texfilt',
+    'texgenmix',
+    'texline',
+    'texrect',
+    'texwrap',
+    'unfilledclip',
+    'vao-01',
+    'vao-02',
+    'vparray',
+    'vpeval',
+    'vptest1',
+    'vptest2',
+    'vptest3',
+    'vptorus',
+    'vpwarpmesh',
+    'yuvrect',
+    'yuvsquare',
+    'zcomp',
+    'zdrawpix',
+    'zreaddraw',
+]
+
+for prog in progs:
+    env.Program(
+        target = prog,
+        source = prog + '.c',
+    )
index c026ecd4ce2fb41206dfd561aa94fa5f3d1bae9e..162ab19493c64a4f4255aaa1b0ec5aa373a031c1 100644 (file)
@@ -11,7 +11,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "readtex.h"
@@ -442,6 +442,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 300, 300 );
    glutInitWindowPosition( 0, 0 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
+   glewInit();
    glutCreateWindow(argv[0] );
 
    Init( argc, argv );
index f23b5aff3248e2fa822743da46e5bb4b87aa9c92..656bf2471fe3df76cfbd46b5a2b658968a1f7b18 100644 (file)
@@ -9,6 +9,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -29,7 +30,7 @@ PrintString(const char *s)
 
 
 static void
-Polygon( GLint verts, GLfloat radius, GLfloat z )
+doPolygon( GLint verts, GLfloat radius, GLfloat z )
 {
    int i;
    for (i = 0; i < verts; i++) {
@@ -47,33 +48,33 @@ DrawObject( void )
    glLineWidth(3.0);
    glColor3f(1, 1, 1);
    glBegin(GL_LINE_LOOP);
-   Polygon(12, 1.2, 0);
+   doPolygon(12, 1.2, 0);
    glEnd();
 
    glLineWidth(1.0);
    glColor3f(1, 1, 1);
    glBegin(GL_LINE_LOOP);
-   Polygon(12, 1.1, 0);
+   doPolygon(12, 1.1, 0);
    glEnd();
 
    glColor3f(1, 0, 0);
    glBegin(GL_POLYGON);
-   Polygon(12, 0.4, 0.3);
+   doPolygon(12, 0.4, 0.3);
    glEnd();
 
    glColor3f(0, 1, 0);
    glBegin(GL_POLYGON);
-   Polygon(12, 0.6, 0.2);
+   doPolygon(12, 0.6, 0.2);
    glEnd();
 
    glColor3f(0, 0, 1);
    glBegin(GL_POLYGON);
-   Polygon(12, 0.8, 0.1);
+   doPolygon(12, 0.8, 0.1);
    glEnd();
 
    glColor3f(1, 1, 1);
    glBegin(GL_POLYGON);
-   Polygon(12, 1.0, 0);
+   doPolygon(12, 1.0, 0);
    glEnd();
 }
 
@@ -225,6 +226,7 @@ main( int argc, char *argv[] )
    glutInitDisplayMode( GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE |
                         GLUT_DEPTH | GLUT_MULTISAMPLE );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index aed65b35fe3e139c137c2dd2aaf2a946a4bcf9f5..28e28e61d8ba74d5d5bb853d0032ddf8e18dcba8 100644 (file)
@@ -37,9 +37,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/gl.h>
-#include <GL/glext.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #define inline __inline__
@@ -127,6 +125,7 @@ int main( int argc, char *argv[] )
    glutInitDisplayMode( GLUT_RGB );
 
    glutCreateWindow( argv[0] );
+   glewInit();
 
    if ( argc > 1 ) {
       count = strtoul( argv[1], NULL, 0 );
index eac2a9100f5f460f1480fd0266d492ae2d251807..550e9543406c0f74cd9be962981ae5c9248b6f96 100644 (file)
@@ -8,7 +8,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static float Xrot = 0.0, Yrot = 0.0, Zrot = 0.0;
@@ -180,6 +180,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index 7949f87eddb2ce5b5cd61bcaa6a735243b1d730d..e7237b76a87231faa7e3033fd53bdd8dadc313f8 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -201,6 +201,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index a854908c311600304f18a9bca63a01794887f800..f66b060cbb2de96a9e0886650c15354498055875 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "readtex.c"
@@ -143,6 +143,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index 26b68c6b4128ac781c9cc7342858f6fb551e1526..95f008a078dbd96037dd707de656888a8c000b0b 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "readtex.c"
@@ -146,6 +146,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index 4ed84e7aceed63103793336903ca00130cac3463..700ec0b09d0239f0c014ddbde5581219e11262c9 100644 (file)
@@ -46,6 +46,7 @@
  */
 #include <stdlib.h>
 #include <stdio.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 GLubyte mipmapImage32[40][46][3];
@@ -175,6 +176,7 @@ int main(int argc, char** argv)
     glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
     glutInitWindowSize (500, 500);
     glutCreateWindow (argv[0]);
+    glewInit();
     myinit();
     glutReshapeFunc (myReshape);
     glutDisplayFunc(display);
index 05ba85dad9e2ef7909ed659ab97e02cc7ce63436..c51a5416413d88aaa9d91de91e9b00f5e6128018 100644 (file)
@@ -8,6 +8,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include "../util/readtex.c"
 
@@ -188,6 +189,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 400, 400 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 0ebd3987f5816a4eb87031a727c1b91cdd07f915..3a6d71a42bd7541c66a4355511a4631b297e7069 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static void Display( void )
@@ -155,6 +155,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 6437062900e5bfad764d198caf173f82bb557321..56de7b46963eb1956b9e4248da7c7bb57b25b358 100644 (file)
@@ -4,7 +4,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static float Zrot = 0.0;
@@ -118,6 +118,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 9d19ef90da551db6b454199862347d47eb666464..f1f84d87749f80cdf12d1638917b87fd28597e57 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static float Xrot = 0.0, Yrot = 0.0, Zrot = 0.0;
@@ -174,6 +174,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index 3dfe94f7596709ac7a4a156f943bffa77f751218..973a157409928b279880a7b5ae4ee59304c044eb 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static float Xrot = -60.0, Yrot = 0.0, Zrot = 0.0;
@@ -234,6 +234,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index 48c622be302ddbac697a457456ae5f05202a8bea..6c0484df0de69d70c7b78ce65c95ddf9430de882 100644 (file)
@@ -34,6 +34,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <GL/glext.h>
 
@@ -326,6 +327,7 @@ int main(int argc, char *argv[])
    glutInitWindowSize(350, 350);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    glutCreateWindow("Array texture test");
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutSpecialFunc(SpecialKey);
index 2aab1a39d290e5e562e59b42bfd984cb882ac83c..7297f41b78718409dd90a485557b1d23422a6844 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Width = 400;
@@ -200,6 +201,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow( "GL_EXT_blend_minmax test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 1694866a55742fd0b63b26c4ef298b844dd61e46..3ee3ae2230c13539f790cc7ad56b2d73d3e2ae08 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Width = 400;
@@ -169,6 +170,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow( "GL_NV_blend_square test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 8961a827eabb7ce6ea00fadb5fa8be502f90631b..d6dcb8b848667af9348c6b816d8f93384fc2f9ff 100644 (file)
@@ -3,10 +3,10 @@
  *
  */
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include "readtex.c"
 
@@ -183,6 +183,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutSpecialFunc(SpecialKey);
index d1a85392e1ec469d430a252d7e67c95d0be7a2ee..1d97b060efc3f1bc3626b421a84695c5f8ecebfe 100644 (file)
@@ -6,18 +6,19 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #define NUM_OBJECTS 10
 
 struct object
 {
-   GLuint BufferID;
+   GLuint VertexBufferID;
+   GLuint ColorBufferID;
    GLuint ElementsBufferID;
    GLuint NumVerts;
    GLuint VertexOffset;
@@ -47,7 +48,7 @@ static void CheckError(int line)
 
 static void DrawObject( const struct object *obj )
 {
-   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
    glVertexPointer(3, GL_FLOAT, obj->VertexStride, (void *) obj->VertexOffset);
    glEnable(GL_VERTEX_ARRAY);
 
@@ -62,6 +63,7 @@ static void DrawObject( const struct object *obj )
       glPopClientAttrib();
    }
 #endif
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->ColorBufferID);
    glColorPointer(3, GL_FLOAT, obj->ColorStride, (void *) obj->ColorOffset);
    glEnable(GL_COLOR_ARRAY);
 
@@ -92,7 +94,7 @@ static void Display( void )
    glClear( GL_COLOR_BUFFER_BIT );
 
    for (i = 0; i < NumObjects; i++) {
-      float x = 5.0 * ((float) i / (NumObjects-1) - 0.5);
+      float x = 7.0 * ((float) i / (NumObjects-1) - 0.5);
       glPushMatrix();
       glTranslatef(x, 0, 0);
       glRotatef(Xrot, 1, 0, 0);
@@ -125,8 +127,11 @@ static void Reshape( int width, int height )
 static void FreeBuffers(void)
 {
    int i;
-   for (i = 0; i < NUM_OBJECTS; i++)
-      glDeleteBuffersARB(1, &Objects[i].BufferID);
+   for (i = 0; i < NUM_OBJECTS; i++) {
+      glDeleteBuffersARB(1, &Objects[i].VertexBufferID);
+      glDeleteBuffersARB(1, &Objects[i].ColorBufferID);
+      glDeleteBuffersARB(1, &Objects[i].ElementsBufferID);
+   }
 }
 
 
@@ -182,7 +187,9 @@ static void SpecialKey( int key, int x, int y )
 }
 
 
-
+/*
+ * Non-interleaved position/color data.
+ */
 static void MakeObject1(struct object *obj)
 {
    GLfloat *v, *c;
@@ -193,10 +200,11 @@ static void MakeObject1(struct object *obj)
    for (i = 0; i < 500; i++)
       buffer[i] = i & 0xff;
 
-   obj->BufferID = 0;
-   glGenBuffersARB(1, &obj->BufferID);
-   assert(obj->BufferID != 0);
-   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
+   obj->VertexBufferID = 0;
+   glGenBuffersARB(1, &obj->VertexBufferID);
+   obj->ColorBufferID = obj->VertexBufferID;
+   assert(obj->VertexBufferID != 0);
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
    glBufferDataARB(GL_ARRAY_BUFFER_ARB, 500, buffer, GL_STATIC_DRAW_ARB);
 
    for (i = 0; i < 500; i++)
@@ -257,13 +265,18 @@ static void MakeObject1(struct object *obj)
 }
 
 
+/*
+ * Interleaved position/color data.
+ */
 static void MakeObject2(struct object *obj)
 {
    GLfloat *v;
    int start = 40; /* bytes, to test non-zero array offsets */
 
-   glGenBuffersARB(1, &obj->BufferID);
-   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
+   glGenBuffersARB(1, &obj->VertexBufferID);
+   obj->ColorBufferID = obj->VertexBufferID;
+
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
    glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, NULL, GL_STATIC_DRAW_ARB);
    v = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
 
@@ -287,6 +300,9 @@ static void MakeObject2(struct object *obj)
 }
 
 
+/*
+ * Use an index buffer and glDrawElements().
+ */
 static void MakeObject3(struct object *obj)
 {
    GLfloat vertexData[1000];
@@ -314,8 +330,10 @@ static void MakeObject3(struct object *obj)
    bytes = obj->NumVerts * (3 + 3) * sizeof(GLfloat);
 
    /* Don't use glMap/UnmapBuffer for this object */
-   glGenBuffersARB(1, &obj->BufferID);
-   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
+   glGenBuffersARB(1, &obj->VertexBufferID);
+   obj->ColorBufferID = obj->VertexBufferID;
+
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
    glBufferDataARB(GL_ARRAY_BUFFER_ARB, bytes, vertexData, GL_STATIC_DRAW_ARB);
 
    /* Setup a buffer of indices to test the ELEMENTS path */
@@ -332,6 +350,46 @@ static void MakeObject3(struct object *obj)
 }
 
 
+/*
+ * Vertex and color data in different buffers.
+ */
+static void MakeObject4(struct object *obj)
+{
+   static const GLfloat vertexData[] = {
+      0,   -1,  0,
+      0.5,  0,  0,
+      0,    1,  0,
+      -0.5, 0,  0
+   };
+   static const GLfloat colorData[] = {
+      1,    1,   1,
+      1,    1,   0,
+      .5,  .5,   0,
+      1,    1,   0
+   };
+
+   obj->VertexOffset = 0;
+   obj->VertexStride = 0;
+   obj->ColorOffset = 0;
+   obj->ColorStride = 0;
+   obj->NumVerts = 4;
+
+   glGenBuffersARB(1, &obj->VertexBufferID);
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
+   glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(vertexData), vertexData,
+                   GL_STATIC_DRAW_ARB);
+
+   glGenBuffersARB(1, &obj->ColorBufferID);
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->ColorBufferID);
+   glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(colorData), colorData,
+                   GL_STATIC_DRAW_ARB);
+
+   /* Setup a buffer of indices to test the ELEMENTS path */
+   obj->ElementsBufferID = 0;
+   obj->NumElements = 0;
+}
+
+
 
 static void Init( void )
 {
@@ -358,7 +416,8 @@ static void Init( void )
    MakeObject1(Objects + 0);
    MakeObject2(Objects + 1);
    MakeObject3(Objects + 2);
-   NumObjects = 3;
+   MakeObject4(Objects + 3);
+   NumObjects = 4;
 }
 
 
@@ -369,6 +428,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 600, 300 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index 4ea7b80f231b50f60ca1ab9cb6cc69b85503a9c2..a04e40eaf6efab754caf7aff735967203ed62d60 100644 (file)
@@ -39,6 +39,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Width = 400;
@@ -154,6 +155,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow( "Bug #3050 Test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 761dcbb9513164cf6c0a9c2b2f2637d4b9ab953f..06a97761557555b2be934ee2d2145aae2104edae 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Width = 400;
@@ -119,6 +120,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow( "Bug #3101 Test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 4aceae04abe191049d80f84ad9d6a9f410ec2b59..a075b94e3706fa8af5bc7f972be8d9432162431b 100644 (file)
@@ -36,6 +36,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <GL/glext.h>
 
@@ -264,6 +265,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 350, 350 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow( "Bug #3195 Test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index f8dac210f7a87d9cd694f375b949d5ff6a45532e..10e5eba7c5e0eace8764ae987d90d7752ca192bb 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static GLenum Target = GL_TEXTURE_2D;
@@ -180,6 +181,7 @@ int main(int argc, char **argv)
        glutInitDisplayMode(type);
 
        win = glutCreateWindow("Tex test");
+        glewInit();
        if (!win) {
                exit(1);
        }
diff --git a/progs/tests/bumpmap.c b/progs/tests/bumpmap.c
new file mode 100644 (file)
index 0000000..1b7ec2c
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * VA LINUX SYSTEM, IBM 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.
+ */
+
+/**
+ * Simple test for testing ATI_envmap_bumpmap support.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <GL/glut.h>
+
+#include "readtex.h"
+
+static PFNGLGETTEXBUMPPARAMETERFVATIPROC glGetTexBumpParameterfvATI_func = NULL;
+static PFNGLGETTEXBUMPPARAMETERIVATIPROC glGetTexBumpParameterivATI_func = NULL;
+static PFNGLTEXBUMPPARAMETERFVATIPROC glTexBumpParameterfvATI_func = NULL;
+
+static const char *TexFile = "../images/arch.rgb";
+
+static const GLfloat Near = 5.0, Far = 25.0;
+
+static void Display( void )
+{
+   /* together with the construction of dudv map, do fixed translation
+      in y direction (up), some cosine deformation in x and more
+      deformation in y dir */
+   GLfloat bumpMatrix[4] = {0.1, 0.0, 0.2, 0.1};
+
+
+   glClearColor(0.2, 0.2, 0.8, 0);
+   glClear( GL_COLOR_BUFFER_BIT );
+
+   glPushMatrix();
+
+   /* this is the base map */
+   glActiveTexture( GL_TEXTURE0 );
+   glEnable( GL_TEXTURE_2D );
+   glBindTexture( GL_TEXTURE_2D, 1 );
+   glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
+   glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE );
+   glTexEnvf( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE );
+
+   /* bump map */
+   glActiveTexture( GL_TEXTURE1 );
+   glEnable( GL_TEXTURE_2D );
+   glBindTexture( GL_TEXTURE_2D, 2 );
+   glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
+   glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_BUMP_ENVMAP_ATI );
+   glTexEnvf( GL_TEXTURE_ENV, GL_BUMP_TARGET_ATI, GL_TEXTURE0);
+
+   glTexBumpParameterfvATI_func(GL_BUMP_ROT_MATRIX_ATI, bumpMatrix);
+
+   glCallList(1);
+
+   glPopMatrix();
+
+   glutSwapBuffers();
+}
+
+
+static void Reshape( int width, int height )
+{
+   GLfloat ar = (float) width / (float) height;
+   glViewport( 0, 0, width, height );
+   glMatrixMode( GL_PROJECTION );
+   glLoadIdentity();
+   glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
+   glMatrixMode( GL_MODELVIEW );
+   glLoadIdentity();
+   glTranslatef( 0.0, 0.0, -6.0 );
+}
+
+
+static void Key( unsigned char key, int x, int y )
+{
+   (void) x;
+   (void) y;
+   switch (key) {
+      case 27:
+         exit(0);
+         break;
+   }
+   glutPostRedisplay();
+}
+
+
+static void Init( void )
+{
+   const char * const ver_string = (const char * const)
+       glGetString( GL_VERSION );
+   GLfloat temp[16][16][2];
+   GLubyte *image = NULL;
+   GLint imgWidth, imgHeight;
+   GLenum imgFormat;
+   GLint i,j;
+   GLint param, paramArray[16];
+   GLfloat paramMat[4];
+
+   printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+   printf("GL_VERSION = %s\n", ver_string);
+
+   if ( !glutExtensionSupported("GL_ATI_envmap_bumpmap")) {
+      printf("\nSorry, this program requires GL_ATI_envmap_bumpmap\n");
+      exit(1);
+   }
+
+   glGetTexBumpParameterfvATI_func = glutGetProcAddress("glGetTexBumpParameterfvATI");
+   glGetTexBumpParameterivATI_func = glutGetProcAddress("glGetTexBumpParameterivATI");
+   glTexBumpParameterfvATI_func = glutGetProcAddress("glTexBumpParameterfvATI");
+
+   glGetTexBumpParameterivATI_func(GL_BUMP_ROT_MATRIX_SIZE_ATI, &param);
+   printf("BUMP_ROT_MATRIX_SIZE_ATI = %d\n", param);
+   glGetTexBumpParameterivATI_func(GL_BUMP_NUM_TEX_UNITS_ATI, &param);
+   printf("BUMP_NUM_TEX_UNITS_ATI = %d\n", param);
+   glGetTexBumpParameterfvATI_func(GL_BUMP_ROT_MATRIX_ATI, paramMat);
+   printf("initial rot matrix %f %f %f %f\n", paramMat[0], paramMat[1], paramMat[2], paramMat[3]);
+   glGetTexBumpParameterivATI_func(GL_BUMP_TEX_UNITS_ATI, paramArray);
+   printf("units supporting bump mapping: ");
+   for (i = 0; i < param; i++)
+      printf("%d ", paramArray[i] - GL_TEXTURE0);
+   printf("\n");
+
+   image = LoadRGBImage(TexFile, &imgWidth, &imgHeight, &imgFormat);
+   if (!image) {
+      printf("Couldn't read %s\n", TexFile);
+      exit(0);
+   }
+
+   glBindTexture( GL_TEXTURE_2D, 1 );
+   glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
+   glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
+   glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
+   glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
+   glTexImage2D( GL_TEXTURE_2D, 0, imgFormat, imgWidth, imgHeight, 0,
+                imgFormat, GL_UNSIGNED_BYTE, image );
+
+   for (j = 0; j < 16; j++) {
+      for (i = 0; i < 16; i++) {
+         temp[j][i][0] = cos((float)(i) * 3.1415 / 16.0);
+         temp[j][i][1] = -0.5;
+      }
+   }
+   glBindTexture( GL_TEXTURE_2D, 2 );
+   glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+   glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+   glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
+   glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
+   glTexImage2D( GL_TEXTURE_2D, 0, GL_DU8DV8_ATI, 16, 16, 0,
+                GL_DUDV_ATI, GL_FLOAT, temp );
+
+
+   glNewList( 1, GL_COMPILE );
+   glBegin(GL_QUADS);
+   glColor3f( 0.9, 0.0, 0.0 );
+   glMultiTexCoord2f( GL_TEXTURE0, 0.0, 0.0 );
+   glMultiTexCoord2f( GL_TEXTURE1, 0.0, 0.0 );
+   glVertex2f(-1, -1);
+   glMultiTexCoord2f( GL_TEXTURE0, 1.0, 0.0 );
+   glMultiTexCoord2f( GL_TEXTURE1, 1.0, 0.0 );
+   glVertex2f( 1, -1);
+   glMultiTexCoord2f( GL_TEXTURE0, 1.0, 1.0 );
+   glMultiTexCoord2f( GL_TEXTURE1, 1.0, 1.0 );
+   glVertex2f( 1,  1);
+   glMultiTexCoord2f( GL_TEXTURE0, 0.0, 1.0 );
+   glMultiTexCoord2f( GL_TEXTURE1, 0.0, 1.0 );
+   glVertex2f(-1,  1);
+   glEnd();
+   glEndList();
+}
+
+
+int main( int argc, char *argv[] )
+{
+   glutInit( &argc, argv );
+   glutInitWindowPosition( 0, 0 );
+   glutInitWindowSize( 400, 400 );
+   glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
+   glutCreateWindow( "GL_ATI_envmap_bumpmap test" );
+   glutReshapeFunc( Reshape );
+   glutKeyboardFunc( Key );
+   glutDisplayFunc( Display );
+   Init();
+   glutMainLoop();
+   return 0;
+}
index 37d8ac85e54727074405b7a340c2bb8e4371217a..5d89ff79c5532f40e950f4f035725cf735e7f515 100644 (file)
@@ -19,6 +19,7 @@
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -386,6 +387,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Draw);
index 142315364c6b3b6fc62937fdbc3e5976a6cec8a8..aa4acfc18b5303078e2e1e30ce05d79eade84c4f 100644 (file)
@@ -5,11 +5,11 @@
  * 26 Jan 2006
  */
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static GLint WinWidth = 1000, WinHeight = 800;
@@ -260,6 +260,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(WinWidth, WinHeight);
    glutInitDisplayMode(mode);
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutSpecialFunc(SpecialKey);
index 12aabb1c9ad2141796d2222a994ff3e841016929..3dd21372f9a80f3d2458e059952eb4e214f474a1 100644 (file)
@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static const GLint tests[][8] = {
@@ -226,6 +227,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow( "GL_ARB_texture_env_crossbar test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index a9393aef0ca5fcf1b959111fc2b1144e04efd32a..80483900cb7d077bb80aed85de9c9438533546f4 100644 (file)
@@ -15,6 +15,7 @@
 #include <windows.h>
 #endif
 #define GL_GLEXT_LEGACY
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <GL/glext.h>
 
@@ -129,6 +130,7 @@ int main( int argc, char **argv )
    glutInitWindowSize( 250, 250 );
    glutInitWindowPosition( 100, 100 );
    glutCreateWindow( "CVA Test" );
+   glewInit();
 
    /* Make sure the server supports GL 1.2 vertex arrays.
     */
index 4c6955bcfc64c9d7c69e65f6902ec7d7e7cd3c24..1c2f9bebca6a29c815555632ffdd6c85ecee3c6b 100644 (file)
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -81,6 +81,7 @@ find_line_column(const GLubyte *string, const GLubyte *pos,
 #define NV_FRAGMENT_PROGRAM   4
 
 
+
 struct breakpoint {
    enum {PIXEL, LINE} type;
    int x, y;
@@ -101,7 +102,7 @@ static void Debugger2(GLenum target, GLvoid *data)
 {
    static GLuint skipCount = 0;
    const GLubyte *ln;
-   GLint pos, line, column;
+   GLint pos = 0, line, column;
    GLint id;
    int progType;
    GLint len;
@@ -721,6 +722,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 200, 200 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index 44115b9209d67631d2cd59f28f7a2ba15189981f..fb7c3f4535c88ed8daada7af5ac299140a5b8f6c 100644 (file)
@@ -43,6 +43,7 @@
 #include <windows.h>
 #endif
 #define GL_GLEXT_LEGACY
+#include <GL/glew.h>    /* OpenGL Utility Toolkit header */
 #include <GL/glut.h>    /* OpenGL Utility Toolkit header */
 
 /* Some <math.h> files do not define M_PI... */
@@ -823,6 +824,7 @@ main(int argc, char **argv)
 #endif
 
   glutCreateWindow("Shadowy Leapin' Lizards");
+  glewInit();
 
   if (glutGet(GLUT_WINDOW_STENCIL_SIZE) <= 1) {
     printf("dinoshade: Sorry, I need at least 2 bits of stencil.\n");
index 5e89569380a48da3730b20808845698157ae2004..d75a870c26bcf32778beefde5edaa3a337e53151 100644 (file)
@@ -7,11 +7,11 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include "extfuncs.h"
 
@@ -294,6 +294,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Display);
index 56c0c79c3fadb1d459bc8c4d51e463ab85474035..63b8336d97321c9132f397cf372fff2c7024c899 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Width = 400, Height = 400;
@@ -34,14 +35,14 @@ static float Xtrans = 0, Ytrans = 0;
 static float Step = 0.125;
 
 enum {
-   POINTS,
-   HLINES,
-   VLINES,
-   QUADS,
+   MODE_POINTS,
+   MODE_HLINES,
+   MODE_VLINES,
+   MODE_QUADS,
    NUM_MODES
 };
 
-static int Mode = POINTS;
+static int Mode = MODE_POINTS;
 
 
 static void
@@ -58,7 +59,7 @@ Draw(void)
    glPushMatrix();
    glTranslatef(tx + Xtrans, ty + Ytrans, 0);
 
-   if (Mode == POINTS) {
+   if (Mode == MODE_POINTS) {
       glBegin(GL_POINTS);
       for (j = 0; j < Height; j += 2) {
          for (i = 0; i < Width; i += 2) {
@@ -67,7 +68,7 @@ Draw(void)
       }
       glEnd();
    }
-   else if (Mode == HLINES) {
+   else if (Mode == MODE_HLINES) {
       glBegin(GL_LINES);
       for (i = 0; i < Height; i += 2) {
          glVertex2f(0,     i);
@@ -75,7 +76,7 @@ Draw(void)
       }
       glEnd();
    }
-   else if (Mode == VLINES) {
+   else if (Mode == MODE_VLINES) {
       glBegin(GL_LINES);
       for (i = 0; i < Width; i += 2) {
          glVertex2f(i, 0     );
@@ -83,7 +84,7 @@ Draw(void)
       }
       glEnd();
    }
-   else if (Mode == QUADS) {
+   else if (Mode == MODE_QUADS) {
       glBegin(GL_QUADS);
       for (j = 0; j < Height; j += 4) {
          for (i = 0; i < Width; i += 4) {
@@ -189,6 +190,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutSpecialFunc(SpecialKey);
index 6533514d697a045af088c3aca2063957e792145f..89e99f02926ea82fa7138d4bc12f477f904c5cca 100644 (file)
@@ -12,7 +12,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <assert.h>
 
@@ -249,6 +249,7 @@ int main( int argc, char *argv[] )
    glutInitWindowPosition( 0, 0 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow(argv[0] );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index ab2757c3c3d7ced2fd796c7b54573a5c0d477950..8dac21494e6b00da9b243d15e2244ecda659dea2 100644 (file)
@@ -6,11 +6,11 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Win;
@@ -202,6 +202,7 @@ main( int argc, char *argv[] )
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 5283c7e1fd6673b9c6b18b4d9ed0f9c5866dcb8f..f9c506193f64196e27c5fd391b10905fd43f2939 100644 (file)
@@ -6,11 +6,11 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Win = 0;
@@ -191,6 +191,7 @@ main( int argc, char *argv[] )
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 1f7c45fc794d04d815f2a23cb92746a6f78e6967..50a4b00afce361a7830f185d1c56e2200b51a62b 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <assert.h>
 #include <stdio.h>
 static int Win = 0;
 static int Width = 400, Height = 400;
 
-static GLenum TexTarget = GL_TEXTURE_2D; /*GL_TEXTURE_RECTANGLE_ARB;*/
+#if 1
+static GLenum TexTarget = GL_TEXTURE_2D;
 static int TexWidth = 512, TexHeight = 512;
-/*static int TexWidth = 600, TexHeight = 600;*/
+static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */
+#else
+static GLenum TexTarget = GL_TEXTURE_RECTANGLE_ARB;
+static int TexWidth = 200, TexHeight = 200;
+static GLenum TexIntFormat = GL_RGB5; /* either GL_RGB or GL_RGBA */
+#endif
+static GLuint TextureLevel = 0;  /* which texture level to render to */
 
 static GLuint MyFB;
 static GLuint TexObj;
@@ -38,8 +45,6 @@ static GLfloat Rot = 0.0;
 static GLboolean UsePackedDepthStencil = GL_FALSE;
 static GLboolean UsePackedDepthStencilBoth = GL_FALSE;
 static GLboolean Use_ARB_fbo = GL_FALSE;
-static GLuint TextureLevel = 0;  /* which texture level to render to */
-static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */
 static GLboolean Cull = GL_FALSE;
 static GLboolean Wireframe = GL_FALSE;
 
@@ -404,8 +409,12 @@ AttachDepthAndStencilBuffers(GLuint fbo,
          return GL_FALSE;
 
       status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
-      if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
+      if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+         glDeleteRenderbuffersEXT(1, depthRbOut);
+         *depthRbOut = 0;
+         glDeleteRenderbuffersEXT(1, &rb);
          return GL_FALSE;
+      }
 
       *stencilRbOut = rb;
    }
@@ -554,15 +563,17 @@ Init(void)
       /* make two image levels */
       glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0,
                    GL_RGBA, GL_UNSIGNED_BYTE, NULL);
-      glTexImage2D(TexTarget, 1, TexIntFormat, TexWidth/2, TexHeight/2, 0,
-                   GL_RGBA, GL_UNSIGNED_BYTE, NULL);
-      TexWidth = TexWidth >> TextureLevel;
-      TexHeight = TexHeight >> TextureLevel;
+      if (TexTarget == GL_TEXTURE_2D) {
+         glTexImage2D(TexTarget, 1, TexIntFormat, TexWidth/2, TexHeight/2, 0,
+                      GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+         TexWidth = TexWidth >> TextureLevel;
+         TexHeight = TexHeight >> TextureLevel;
+         glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel);
+      }
 
       glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
       glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
       glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel);
-      glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel);
       glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    }
 
@@ -576,7 +587,7 @@ Usage(void)
    printf("Usage:\n");
    printf("  -ds  Use combined depth/stencil renderbuffer\n");
    printf("  -arb Try GL_ARB_framebuffer_object's mismatched buffer sizes\n");
-   printf("  -ds2 Tye GL_ARB_framebuffer_object's GL_DEPTH_STENCIL_ATTACHMENT\n");
+   printf("  -ds2 Try GL_ARB_framebuffer_object's GL_DEPTH_STENCIL_ATTACHMENT\n");
    printf("Keys:\n");
    printf("  a    Toggle animation\n");
    printf("  s/s  Step/rotate\n");
@@ -594,6 +605,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Display);
index 8fe636c364be9ce9ec68f4387369c99bbc717887..1e58df281e10144cd07ee1868349962d49e1c70f 100644 (file)
@@ -6,10 +6,10 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include "readtex.h"
 
@@ -194,6 +194,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Draw);
index dd6d882089c33cd4de714a4884f0a8e77c065c8e..dd99d836c64fdb74b47dfd8a52a8a3d82db00d44 100644 (file)
@@ -8,6 +8,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include "extfuncs.h"
 #include "readtex.h"
@@ -230,6 +231,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(400, 400);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Draw);
index ecd9f533f990405deed129b96b61a4805328e4c0..b6cea8c080aa139b56255ba90a6690739c3fedd7 100644 (file)
  * Test to exercise fog modes and for comparison with GL_EXT_fog_coord.
  */
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Width = 600;
@@ -190,6 +190,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 89355742aad7931c511b22973c66ea53413cc8fd..7822d33b09f591c77dde0f695a285a426250dfe5 100644 (file)
@@ -3,10 +3,10 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Width = 600;
@@ -93,6 +93,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 095190a8aefa709cc54a9873cc19028b15ce5ac4..2b8f8d0f5ec30529025039fdc491a5a2a073502f 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -216,6 +216,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index f57ad6282829ff083713e597c58bbd1ae3d672da..332e07182dcc2c893c31e5622bafe15fc38a639f 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "../util/readtex.c"
@@ -141,6 +141,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index e98b3ed046900e06ab067756d473722712e65c46..47bf9dfbe5ece9dbb04ff21fe469d5246eb07046 100644 (file)
@@ -36,6 +36,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Width = 400;
@@ -386,6 +387,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow( "glInterleavedArrays test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 750592ed79f2efd71c3e8e2d1761b15b716642d3..63099fbd22105063e8a9836a5a22966a74c4dbef 100644 (file)
@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "readtex.h"
@@ -186,6 +187,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow( "GL_MESA_pack_invert test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 098f5e92ebdcf47444e1fbb2d4f4acecab00aac0..bb688c04a5fc65acf904dbb5b9b21e83fa46d688 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int win_width, win_height;
@@ -164,6 +165,7 @@ main(int argc, char *argv[])
        glutInitWindowSize(win_width, win_height);
        glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
        glutCreateWindow(argv[0]);
+        glewInit();
        glutReshapeFunc(reshape);
        glutKeyboardFunc(key);
        glutDisplayFunc(display);
index 83c86766571013bd0129cc278b885820e544dfbc..52e7e1de44a9f6e457bec43317ca82023ea0f99e 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -336,6 +337,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( WinWidth, WinHeight );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
diff --git a/progs/tests/mapbufrange.c b/progs/tests/mapbufrange.c
new file mode 100644 (file)
index 0000000..0021bb2
--- /dev/null
@@ -0,0 +1,205 @@
+/*
+ * Test glMapBuffer() and glMapBufferRange()
+ *
+ * Fill a VBO with vertex data to draw several colored quads.
+ * On each redraw, update the geometry for just one rect in the VBO.
+ *
+ * Brian Paul
+ * 4 March 2009
+ */
+
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <GL/glew.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+
+static GLuint Win;
+static const GLuint NumRects = 10;
+static GLuint BufferID;
+static GLboolean Anim = GL_TRUE;
+static GLboolean UseBufferRange = GL_FALSE;
+
+
+
+static const float RectData[] = {
+   /* vertex */    /* color */
+    0, -1, 0,      1,  0,  0,
+    1,  0, 0,      1,  1,  0,
+    0,  1, 0,      0,  1,  1,
+   -1,  0, 0,      1,  0,  1
+};
+
+
+/**
+ * The buffer contains vertex positions (float[3]) and colors (float[3])
+ * for 'NumRects' quads.
+ * This function updates/rotates one quad in the buffer.
+ */
+static void
+UpdateRect(int r, float angle)
+{
+   float *rect;
+   int i;
+
+   assert(r < NumRects);
+
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, BufferID);
+   if (UseBufferRange) {
+      GLintptr offset = r * sizeof(RectData);
+      GLsizeiptr length = sizeof(RectData);
+      GLbitfield access = GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT;
+      float *buf = (float *) glMapBufferRange(GL_ARRAY_BUFFER_ARB,
+                                              offset, length, access);
+      rect = buf;
+   }
+   else {
+      /* map whole buffer */
+      float *buf = (float *)
+         glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
+      rect = buf + r * 24;
+   }
+
+   /* set rect verts/colors */
+   memcpy(rect, RectData, sizeof(RectData));
+
+   /* loop over four verts, updating vertices */
+   for (i = 0; i < 4; i++) {
+      float x = 0.2 * RectData[i*6+0];
+      float y = 0.2 * RectData[i*6+1];
+      float xpos = -2.5 + 0.5 * r;
+      float ypos = 0.0;
+
+      /* translate and rotate vert */
+      rect[i * 6 + 0] = xpos + x * cos(angle) + y * sin(angle);
+      rect[i * 6 + 1] = ypos + x * sin(angle) - y * cos(angle);
+   }
+
+   glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
+}
+
+
+static void
+LoadBuffer(void)
+{
+   static int frame = 0;
+   float angle = glutGet(GLUT_ELAPSED_TIME) * 0.001;
+   UpdateRect(frame % NumRects, angle);
+   frame++;
+}
+
+
+static void
+Draw(void)
+{
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, BufferID);
+   glVertexPointer(3, GL_FLOAT, 24, 0);
+   glEnable(GL_VERTEX_ARRAY);
+
+   glColorPointer(3, GL_FLOAT, 24, (void*) 12);
+   glEnable(GL_COLOR_ARRAY);
+
+   glDrawArrays(GL_QUADS, 0, NumRects * 4);
+
+   if (0)
+      glFinish();
+}
+
+
+static void
+Display(void)
+{
+   glClear(GL_COLOR_BUFFER_BIT);
+   Draw();
+   glutSwapBuffers();
+}
+
+
+static void
+Reshape(int width, int height)
+{
+   glViewport(0, 0, width, height);
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glOrtho(-3.0, 3.0, -1.0, 1.0, -1.0, 1.0);
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
+}
+
+
+static void
+Idle(void)
+{
+   LoadBuffer();
+   glutPostRedisplay();
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+   (void) x;
+   (void) y;
+   if (key == 'a') {
+      Anim = !Anim;
+      glutIdleFunc(Anim ? Idle : NULL);
+   }
+   else if (key == 's') {
+      LoadBuffer();
+   }
+   else if (key == 27) {
+      glutDestroyWindow(Win);
+      exit(0);
+   }
+   glutPostRedisplay();
+}
+
+
+static void
+Init(void)
+{
+   GLuint BufferSize = NumRects * sizeof(RectData);
+   float *buf;
+
+   if (!glutExtensionSupported("GL_ARB_vertex_buffer_object")) {
+      printf("GL_ARB_vertex_buffer_object not found!\n");
+      exit(0);
+   }
+
+   UseBufferRange = glutExtensionSupported("GL_ARB_map_buffer_range");
+   printf("Use GL_ARB_map_buffer_range: %c\n", "NY"[UseBufferRange]);
+
+   printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+
+   /* initially load buffer with zeros */
+   buf = (float *) calloc(1, BufferSize);
+
+   glGenBuffersARB(1, &BufferID);
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, BufferID);
+   glBufferDataARB(GL_ARRAY_BUFFER_ARB, BufferSize, buf, GL_DYNAMIC_DRAW_ARB);
+
+   free(buf);
+}
+
+
+int
+main(int argc, char *argv[])
+{
+   glutInit(&argc, argv);
+   glutInitWindowSize(800, 200);
+   glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
+   Win = glutCreateWindow(argv[0]);
+   glewInit();
+   glewInit();
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutDisplayFunc(Display);
+   glutIdleFunc(Anim ? Idle : NULL);
+   Init();
+   glutMainLoop();
+   return 0;
+}
diff --git a/progs/tests/mapvbo.c b/progs/tests/mapvbo.c
new file mode 100644 (file)
index 0000000..c392e76
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Test glMapBuffer() call immediately after glDrawArrays().
+ * See details below.
+ *
+ * NOTE: Do not use freeglut with this test!  It calls the Display()
+ * callback twice right away instead of just once.
+ *
+ * Brian Paul
+ * 27 Feb 2009
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+
+static GLuint BufferID;
+
+
+static GLuint Win;
+
+
+
+
+/*
+ * Create VBO (position and color) and load with data.
+ */
+static void
+SetupBuffers(void)
+{
+   static const GLfloat data[] = {
+      /* vertex */     /* color */
+      0, -1,  0,      1,    1,   0,
+      1,  0,  0,      1,    1,   0,
+      0,  1,  0,      1,    1,   0,
+      -1, 0,  0,      1,    1,   0
+   };
+
+   glGenBuffersARB(1, &BufferID);
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, BufferID);
+   glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(data), data,
+                   GL_STATIC_DRAW_ARB);
+}
+
+
+static void
+Draw(void)
+{
+   static int count = 1;
+
+   printf("Draw Frame %d\n", count);
+   count++;
+
+   glBindBufferARB(GL_ARRAY_BUFFER_ARB, BufferID);
+   glVertexPointer(3, GL_FLOAT, 24, 0);
+   glEnable(GL_VERTEX_ARRAY);
+
+   glColorPointer(3, GL_FLOAT, 24, (void*) 12);
+   glEnable(GL_COLOR_ARRAY);
+
+   glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+   if (0)
+      glFinish();
+
+   /* Immediately map the color buffer and change something.
+    * This should not effect the first glDrawArrays above, but the
+    * next time we draw we should see a black vertex.
+    */
+   if (1) {
+      GLfloat *m = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB,
+                                              GL_WRITE_ONLY_ARB);
+      m[3] = m[4] = m[5] = 0.0f; /* black vertex */
+      glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
+   }
+}
+
+
+static void Display( void )
+{
+   glClear( GL_COLOR_BUFFER_BIT );
+   Draw();
+   glutSwapBuffers();
+}
+
+
+static void Reshape( int width, int height )
+{
+   float ar = (float) width / (float) height;
+   glViewport( 0, 0, width, height );
+   glMatrixMode( GL_PROJECTION );
+   glLoadIdentity();
+   glFrustum( -ar, ar, -1.0, 1.0, 5.0, 25.0 );
+   glMatrixMode( GL_MODELVIEW );
+   glLoadIdentity();
+   glTranslatef( 0.0, 0.0, -15.0 );
+}
+
+
+static void Key( unsigned char key, int x, int y )
+{
+   (void) x;
+   (void) y;
+   if (key == 27) {
+      glutDestroyWindow(Win);
+      exit(0);
+   }
+   glutPostRedisplay();
+}
+
+
+static void Init( void )
+{
+   if (!glutExtensionSupported("GL_ARB_vertex_buffer_object")) {
+      printf("GL_ARB_vertex_buffer_object not found!\n");
+      exit(0);
+   }
+   printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+
+   SetupBuffers();
+}
+
+
+int main( int argc, char *argv[] )
+{
+   glutInit( &argc, argv );
+   glutInitWindowPosition( 0, 0 );
+   glutInitWindowSize( 300, 300 );
+   glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
+   Win = glutCreateWindow(argv[0]);
+   glewInit();
+   glutReshapeFunc( Reshape );
+   glutKeyboardFunc( Key );
+   glutDisplayFunc( Display );
+   Init();
+   glutMainLoop();
+   return 0;
+}
index 78ef9db03acf775c48a8a9418c29e93bc3d8e802..03019f94faa6c276747d6a52cfc167ada46ccfe2 100644 (file)
@@ -17,6 +17,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -189,6 +190,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(redraw);
diff --git a/progs/tests/mipgen.c b/progs/tests/mipgen.c
new file mode 100644 (file)
index 0000000..088f643
--- /dev/null
@@ -0,0 +1,207 @@
+/* Test GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL
+ * Brian Paul
+ * 10 May 2006
+ */
+
+
+/* Copyright (c) Mark J. Kilgard, 1994. */
+
+/*
+ * (c) Copyright 1993, Silicon Graphics, Inc.
+ * ALL RIGHTS RESERVED
+ * Permission to use, copy, modify, and distribute this software for
+ * any purpose and without fee is hereby granted, provided that the above
+ * copyright notice appear in all copies and that both the copyright notice
+ * and this permission notice appear in supporting documentation, and that
+ * the name of Silicon Graphics, Inc. not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.
+ *
+ * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
+ * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
+ * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
+ * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
+ * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
+ * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
+ * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
+ * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
+ * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
+ * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * US Government Users Restricted Rights
+ * Use, duplication, or disclosure by the Government is subject to
+ * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
+ * clause at DFARS 252.227-7013 and/or in similar or successor
+ * clauses in the FAR or the DOD or NASA FAR Supplement.
+ * Unpublished-- rights reserved under the copyright laws of the
+ * United States.  Contractor/manufacturer is Silicon Graphics,
+ * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
+ *
+ * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+
+#include "readtex.h"
+
+
+static GLfloat LodBias = 6.0;   /* make smallest miplevel visible */
+static GLuint texImage;
+
+#define WIDTH 2
+#define HEIGHT 2
+
+static void
+InitValues(void)
+{
+   LodBias = 6.0;               /* make smallest miplevel visible */
+}
+
+
+static void MakeImage(void)
+{
+   const GLubyte color0[4] = { 0xff, 0x80, 0x20, 0xff };
+   const GLubyte color1[4] = { 0x10, 0x20, 0x40, 0xff };
+
+   GLubyte img[WIDTH*HEIGHT*3];
+   int i, j;
+   for (i = 0; i < HEIGHT; i++) {
+      for (j = 0; j < WIDTH; j++) {
+         int k = (i * WIDTH + j) * 3;
+         int p = ((i+j)%2);
+         if (p == 0) {
+            img[k + 0] = color0[0];
+            img[k + 1] = color0[1];
+            img[k + 2] = color0[2];
+         }
+         else {
+            img[k + 0] = color1[0];
+            img[k + 1] = color1[1];
+            img[k + 2] = color1[2];
+         }
+      }
+   }
+   
+   glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0,
+                GL_RGB, GL_UNSIGNED_BYTE, img);
+   glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
+}
+
+
+
+static void myinit(void)
+{
+   InitValues();
+
+   glShadeModel(GL_FLAT);
+
+   glTranslatef(0.0, 0.0, -3.6);
+
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+   glGenTextures(1, &texImage);
+   glBindTexture(GL_TEXTURE_2D, texImage);
+   MakeImage();
+
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
+   glEnable(GL_TEXTURE_2D);
+
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
+
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, -1);
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 1);
+
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+                   GL_NEAREST_MIPMAP_NEAREST);
+}
+
+
+
+static void display(void)
+{
+   GLfloat tcm = 1.0;
+   glBindTexture(GL_TEXTURE_2D, texImage);
+
+   printf("Bias=%.2g\n", LodBias);
+   fflush(stdout);
+
+   glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias);
+
+   glClear(GL_COLOR_BUFFER_BIT);
+   glBegin(GL_QUADS);
+   glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
+   glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0);
+   glTexCoord2f(tcm * 3000.0, tcm); glVertex3f(3000.0, 1.0, -6000.0);
+   glTexCoord2f(tcm * 3000.0, 0.0); glVertex3f(3000.0, -1.0, -6000.0);
+   glEnd();
+   glFlush();
+}
+
+static void myReshape(int w, int h)
+{
+   glViewport(0, 0, w, h);
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0);
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
+}
+
+static void
+key(unsigned char k, int x, int y)
+{
+  (void) x;
+  (void) y;
+  switch (k) {
+  case 'l':
+     LodBias -= 0.25;
+     break;
+  case 'L':
+     LodBias += 0.25;
+     break;
+  case ' ':
+     InitValues();
+     break;
+  case 27:  /* Escape */
+    exit(0);
+    break;
+  default:
+    return;
+  }
+  glutPostRedisplay();
+}
+
+
+static void usage(void)
+{
+   printf("usage:\n");
+   printf("  l/L    decrease/increase GL_TEXTURE_LOD_BIAS\n");
+   printf("  SPACE  reset values\n");
+}
+
+
+int main(int argc, char** argv)
+{
+    glutInit(&argc, argv);
+    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB );
+    glutInitWindowSize (600, 600);
+    glutCreateWindow (argv[0]);
+    glewInit();
+    myinit();
+    glutReshapeFunc (myReshape);
+    glutDisplayFunc(display);
+    glutKeyboardFunc(key);
+    usage();
+    glutMainLoop();
+    return 0;             /* ANSI C requires main to return int. */
+}
index 8bdad826f7c56e16032b27698bc03f30017e3310..5b899cd1551cf6a3cb4cfee7e655796f49902228 100644 (file)
  */
 #include <stdlib.h>
 #include <stdio.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
-static GLint BaseLevel = 0, MaxLevel = 8;
+#include "readtex.h"
+
+#define TEXTURE_FILE "../images/girl.rgb"
+
+static GLint BaseLevel = 0, MaxLevel = 9;
 static GLfloat MinLod = -1, MaxLod = 9;
 static GLfloat LodBias = 0.0;
 static GLboolean NearestFilter = GL_TRUE;
+static GLuint texImage, texColor, texCurrent;
 
 
 static void
 InitValues(void)
 {
    BaseLevel = 0;
-   MaxLevel = 8;
+   MaxLevel = 9;
    MinLod = -1;
    MaxLod = 9;
    LodBias = 0.0;
@@ -74,7 +80,7 @@ InitValues(void)
 static void MakeImage(int level, int width, int height, const GLubyte color[4])
 {
    const int makeStripes = 0;
-   GLubyte img[256*256*3];
+   GLubyte img[512*512*3];
    int i, j;
    for (i = 0; i < height; i++) {
       for (j = 0; j < width; j++) {
@@ -98,87 +104,138 @@ static void MakeImage(int level, int width, int height, const GLubyte color[4])
 }
 
 
-static void makeImages(void)
+static void makeImages(int image)
 {
-   static const GLubyte colors[8][3] = {
-      {128, 128, 128 },
-      { 0, 255, 255 },
-      { 255, 255, 0 },
-      { 255, 0, 255 },
-      { 255, 0, 0 },
-      { 0, 255, 0 },
-      { 0, 0, 255 },
-      { 255, 255, 255 }
-   };
-   int i, sz = 128;
-
-   for (i = 0; i < 8; i++) {
-      MakeImage(i, sz, sz, colors[i]);
-      sz /= 2;
+#define WIDTH 512
+#define HEIGHT 512
+   if (glutExtensionSupported("GL_SGIS_generate_mipmap") && image) {
+      /* test auto mipmap generation */
+      GLint width, height, i;
+      GLenum format;
+      GLubyte *image = LoadRGBImage(TEXTURE_FILE, &width, &height, &format);
+      if (!image) {
+         printf("Error: could not load texture image %s\n", TEXTURE_FILE);
+         exit(1);
+      }
+      /* resize */
+      if (width != WIDTH || height != HEIGHT) {
+         GLubyte *newImage = malloc(WIDTH * HEIGHT * 4);
+         gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image,
+               WIDTH, HEIGHT, GL_UNSIGNED_BYTE, newImage);
+         free(image);
+         image = newImage;
+      }
+      printf("Using GL_SGIS_generate_mipmap\n");
+      glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
+      glTexImage2D(GL_TEXTURE_2D, 0, format, WIDTH, HEIGHT, 0,
+            format, GL_UNSIGNED_BYTE, image);
+      glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
+      free(image);
+
+      /* make sure mipmap was really generated correctly */
+      width = WIDTH; height = HEIGHT;
+      for (i = 0; i < 10; i++) {
+         GLint w, h;
+         glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_WIDTH, &w);
+         glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_HEIGHT, &h);
+         printf("Level %d size: %d x %d\n", i, w, h);
+         width /= 2;
+         height /= 2;
+      }
+   } else {
+      static const GLubyte colors[10][3] = {
+         {128, 128, 128 },
+         { 0, 255, 255 },
+         { 255, 255, 0 },
+         { 255, 0, 255 },
+         { 255, 0, 0 },
+         { 0, 255, 0 },
+         { 0, 0, 255 },
+         { 0, 255, 255 },
+         { 255, 255, 0 },
+         { 255, 255, 255 }
+      };
+      int i, sz = 512;
+
+      for (i = 0; i < 10; i++) {
+         MakeImage(i, sz, sz, colors[i]);
+         printf("Level %d size: %d x %d\n", i, sz, sz);
+         sz /= 2;
+      }
    }
 }
 
 static void myinit(void)
 {
-    InitValues();
+   InitValues();
+
+   glEnable(GL_DEPTH_TEST);
+   glDepthFunc(GL_LESS);
+   glShadeModel(GL_FLAT);
 
-    glEnable(GL_DEPTH_TEST);
-    glDepthFunc(GL_LESS);
-    glShadeModel(GL_FLAT);
+   glTranslatef(0.0, 0.0, -3.6);
 
-    glTranslatef(0.0, 0.0, -3.6);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+   glGenTextures(1, &texImage);
+   glBindTexture(GL_TEXTURE_2D, texImage);
+   makeImages(1);
+   glGenTextures(1, &texColor);
+   glBindTexture(GL_TEXTURE_2D, texColor);
+   makeImages(0);
 
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-    makeImages();
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
-    glEnable(GL_TEXTURE_2D);
+   texCurrent = texImage;
+
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
+   glEnable(GL_TEXTURE_2D);
 }
 
 static void display(void)
 {
-   GLfloat tcm = 4.0;
-    printf("BASE_LEVEL=%d  MAX_LEVEL=%d  MIN_LOD=%.2g  MAX_LOD=%.2g  Bias=%.2g  Filter=%s\n",
-           BaseLevel, MaxLevel, MinLod, MaxLod, LodBias,
-           NearestFilter ? "NEAREST" : "LINEAR");
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel);
-
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, MinLod);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, MaxLod);
-
-    if (NearestFilter) {
-       glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-       glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
-                       GL_NEAREST_MIPMAP_NEAREST);
-    }
-    else {
-       glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-       glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
-                       GL_LINEAR_MIPMAP_LINEAR);
-    }
-
-    glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias);
-
-    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-    glBegin(GL_QUADS);
-    glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
-    glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0);
-    glTexCoord2f(tcm, tcm); glVertex3f(3000.0, 1.0, -6000.0);
-    glTexCoord2f(tcm, 0.0); glVertex3f(3000.0, -1.0, -6000.0);
-    glEnd();
-    glFlush();
+   GLfloat tcm = 1.0;
+   glBindTexture(GL_TEXTURE_2D, texCurrent);
+
+   printf("BASE_LEVEL=%d  MAX_LEVEL=%d  MIN_LOD=%.2g  MAX_LOD=%.2g  Bias=%.2g  Filter=%s\n",
+         BaseLevel, MaxLevel, MinLod, MaxLod, LodBias,
+         NearestFilter ? "NEAREST" : "LINEAR");
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel);
+
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, MinLod);
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, MaxLod);
+
+   if (NearestFilter) {
+      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+            GL_NEAREST_MIPMAP_NEAREST);
+   }
+   else {
+      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+            GL_LINEAR_MIPMAP_LINEAR);
+   }
+
+   glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias);
+
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+   glBegin(GL_QUADS);
+   glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
+   glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0);
+   glTexCoord2f(tcm * 3000.0, tcm); glVertex3f(3000.0, 1.0, -6000.0);
+   glTexCoord2f(tcm * 3000.0, 0.0); glVertex3f(3000.0, -1.0, -6000.0);
+   glEnd();
+   glFlush();
 }
 
 static void myReshape(int w, int h)
 {
-    glViewport(0, 0, w, h);
-    glMatrixMode(GL_PROJECTION);
-    glLoadIdentity();
-    gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0);
-    glMatrixMode(GL_MODELVIEW);
-    glLoadIdentity();
+   glViewport(0, 0, w, h);
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0);
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
 }
 
 static void
@@ -228,6 +285,12 @@ key(unsigned char k, int x, int y)
   case 'f':
      NearestFilter = !NearestFilter;
      break;
+  case 't':
+     if (texCurrent == texColor)
+        texCurrent = texImage;
+     else
+        texCurrent = texColor;
+     break;
   case ' ':
      InitValues();
      break;
@@ -250,6 +313,7 @@ static void usage(void)
    printf("  x/X    decrease/increase GL_TEXTURE_MAX_LOD\n");
    printf("  l/L    decrease/increase GL_TEXTURE_LOD_BIAS\n");
    printf("  f      toggle nearest/linear filtering\n");
+   printf("  t      toggle texture color/image\n");
    printf("  SPACE  reset values\n");
 }
 
@@ -260,6 +324,7 @@ int main(int argc, char** argv)
     glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
     glutInitWindowSize (600, 600);
     glutCreateWindow (argv[0]);
+    glewInit();
     myinit();
     glutReshapeFunc (myReshape);
     glutDisplayFunc(display);
index 54607b89398daf3a277a03f194b195d89e57d7c8..16f3584f703b7455cf1735221f309976e337f58d 100644 (file)
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <GL/glext.h>
 
@@ -242,6 +243,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(WinWidth, WinHeight);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Display);
index 7bd44735659b4f4819a927ce750e74442667d138..4a940169780bcb30c026ec5a18dd9ed090e3a911 100644 (file)
@@ -13,6 +13,7 @@
 #include <windows.h>
 #endif
 #define GL_GLEXT_LEGACY
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "../util/readtex.c"   /* I know, this is a hack. */
@@ -350,6 +351,7 @@ int main( int argc, char *argv[] )
    glutInitWindowPosition( 0, 0 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow(argv[0] );
+   glewInit();
 
    Init( argc, argv );
 
index b4fab004a637d81a0dcfa15181454b38556c300e..518fee2992c3d968e1c2fcc767bda75eb4e2aecc 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include "GL/glew.h"
 #include "GL/glut.h"
 
 static GLuint Window = 0;
@@ -221,6 +222,7 @@ int main( int argc, char *argv[] )
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
 
    Window = glutCreateWindow("Texture Objects");
+   glewInit();
    if (!Window) {
       exit(1);
    }
index b069bea91ccdffa457c6974fc576271dfabc3859..6db552d195a55c36057f4e801bb0ff35857780b4 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -145,6 +146,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 400, 400 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    Window[0] = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display0 );
@@ -155,6 +157,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 400, 400 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    Window[1] = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display1 );
index d3383ff98af58ea0e47ffd2658e62642973e8437..31cfb40b9d3492ad8ea01acf1c015d2a7e58061b 100644 (file)
@@ -38,6 +38,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <GL/glext.h>
 
@@ -59,6 +60,7 @@ main( int argc, char ** argv )
    glutInitWindowPosition( 0, 0 );
    glutInitWindowSize( 300, 300 );
    glutCreateWindow( "No S3TC Test" );
+   glewInit();
 
    gl_version = strtod( (const char *) glGetString( GL_VERSION ), NULL );
    if ( ! glutExtensionSupported( "GL_ARB_texture_compression" )
index 67ffe0882590131cc1d9ad1b1aef527838d35870..1703b271cb03011f40ff27ce072160cea78e1953 100644 (file)
@@ -8,6 +8,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -333,6 +334,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(700, 800);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Draw);
index b31b36cc12177f8c5f4611917ce0f25fcff3646d..9974486db39211de3faee5425e309108785b2aaf 100644 (file)
@@ -5,12 +5,12 @@
  * 11 March 2004
  */
 
-#define GL_GLEXT_PROTOTYPES
 
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "../util/readtex.c"  /* a hack, I know */
@@ -287,6 +287,7 @@ main( int argc, char *argv[] )
    glutInitWindowSize( 750, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow(argv[0]);
+   glewInit();
    Init();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
index 96697e5bda684a1b5b637179b64694e1921d5a0c..6dd956c4023570aa143b2c5e16de6be88ddf916c 100644 (file)
@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #ifndef GL_EXT_gpu_program_parameters
@@ -274,6 +275,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB );
    glutCreateWindow( "Program Parameters Test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index e3ef948ab6a4cce611830bd795631ae2840a6e73..800d81ecd67d180499b508f35031881e256b215e 100644 (file)
@@ -18,6 +18,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #if 0
 #include "texture.h"
@@ -1005,6 +1006,7 @@ main(int argc, char **argv)
 
   glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
   (void) glutCreateWindow("projtex");
+  glewInit();
 
   loadTexture = loadImageTextures;
   drawObject = drawCube;
index 1bf57e6337d22a9b050283137978bcec5bf4a39e..2098b51ccd21f3e2923047af2cb1b9117e5c6576 100644 (file)
@@ -3,10 +3,10 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #define NUM_QUADS 20
@@ -19,7 +19,7 @@ static GLuint Vbuffer = 0;
 
 static GLfloat buf[NUM_QUADS * 6 * 4];
 
-static GLboolean SwapBuffers = GL_TRUE;
+static GLboolean doSwapBuffers = GL_TRUE;
 
 static GLint Frames = 0, T0 = 0;
 
@@ -48,7 +48,7 @@ Draw(void)
 
    glPopMatrix();
 
-   if (SwapBuffers)
+   if (doSwapBuffers)
       glutSwapBuffers();
    /*
    else
@@ -91,7 +91,7 @@ Key(unsigned char key, int x, int y)
    (void) y;
    switch (key) {
       case 's':
-         SwapBuffers = !SwapBuffers;
+         doSwapBuffers = !doSwapBuffers;
          break;
       case 'a':
          Anim = !Anim;
@@ -246,6 +246,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(600, 600);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutSpecialFunc(SpecialKey);
index d52c338e0e112577286e039851512266d055c638..4023674c05f7e5e43251801f1a549b2b9ff20cde 100644 (file)
@@ -5,13 +5,13 @@
  * 21 June 2007
  */
 
-#define GL_GLEXT_PROTOTYPES
 
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Win;
@@ -445,6 +445,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    ParseArgs(argc, argv);
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
index 42ae62d48a96324b5e29c829573abdb300d234fa..6bdda049071cd0087900855eb70191eebec4a09a 100644 (file)
@@ -7,11 +7,11 @@
  * gcc readrate.c -L/usr/X11R6/lib -lglut -lGLU -lGL -lX11 -o readrate
  */
 
-#define GL_GLEXT_PROTOTYPES
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 /* Hack, to test drawing instead of reading */
@@ -275,6 +275,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(MAX_WIDTH, MAX_HEIGHT);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutSpecialFunc(SpecialKey);
index a8e64bc091617f548482aefa5e3596ddb048d42b..866a0f519e50aa513f909af68b26c288942d2696 100644 (file)
@@ -2,10 +2,10 @@
  * Test rubber-band selection box w/ logicops and blend.
  */
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include "readtex.c"
 
@@ -232,6 +232,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutSpecialFunc(SpecialKey);
index 77fd40647ba63cf761a5a02503e2fa8b047d17e1..f1ba314ef077ddc183d5bd0d8994caa3d693fe09 100644 (file)
@@ -3,10 +3,10 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Width = 600;
@@ -136,6 +136,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 679f9137c82465ddbff9bbf53d68ad3bcf1018f6..a513ca6ba1f5e7dd8917b7df2be16c3561261aa9 100644 (file)
@@ -5,7 +5,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static void assert_test(const char *file, int line, int cond, const char *msg)
@@ -323,6 +323,7 @@ int main(int argc, char **argv)
 {
    glutInit(&argc, argv);
    glutCreateWindow("Mesa bug demo");
+   glewInit();
 
    RUN_TEST(test_uniform_size_type);
    RUN_TEST(test_attrib_size_type);
index 8826c46fc265515a804b1cef2f259fd626ac6703..1e18ca6b5eafec199d0c779635db7ef99eb787d1 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int use20syntax = 1;
@@ -288,6 +289,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL );
    glutCreateWindow( "GL_ATI_separate_stencil test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 88cf3809caf5ae344be0547cc1452720912fa9db..28307fef4f034c55e8eb34cb96a9db5e6ea470bf 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int Width = 550;
@@ -248,6 +249,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL );
    glutCreateWindow( "GL_EXT_stencil_wrap test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 753375d0f3abda2041e0385020be056f383387be..2e219fd8b503dace5fb74c870a756b943ccf64a4 100644 (file)
@@ -8,6 +8,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 GLboolean wrapping;
@@ -272,6 +273,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 400, 400 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_STENCIL );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 81ceb085aafff3e895c0d392bd5daeecf942bcaa..86b737c01fa05efb119ef6928429e6e06a146593 100644 (file)
@@ -9,6 +9,7 @@
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "GL/glew.h"
 #include "GL/glut.h"
 
 static GLuint Window = 0;
@@ -207,6 +208,7 @@ int main( int argc, char *argv[] )
    glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
 
    Window = glutCreateWindow("Texture Objects");
+   glewInit();
    if (!Window) {
       exit(1);
    }
index 568b68d552dc6a613d13ee9fc5773a89a3347cbd..4bda970d067bb9c48cc160fef7b1618c0ea984f7 100644 (file)
@@ -5,11 +5,11 @@
  * 26 Jan 2006
  */
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static GLint WinWidth = 1024, WinHeight = 512;
@@ -337,6 +337,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(WinWidth, WinHeight);
    glutInitDisplayMode(mode);
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutSpecialFunc(SpecialKey);
index 1fab849dd3e9362b31c9efb279fe92c7f02e6bf9..4abe1068c7b9c20372f49e2654b50b9c300c7676 100644 (file)
@@ -7,6 +7,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include "GL/glew.h"
 #include "GL/glut.h"
 
 static GLuint Window = 0;
@@ -124,6 +125,7 @@ int main( int argc, char *argv[] )
    glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
 
    Window = glutCreateWindow("Texture Objects");
+   glewInit();
    if (!Window) {
       exit(1);
    }
index 6e822fb6895f49abdf45773f71ec33cd517edb1a..52c504a31880d3dac72dc573fb598d248c403d99 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
-#define GL_GLEXT_PROTOTYPES 1
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "readtex.c" /* I know, this is a hack. */
@@ -371,6 +371,7 @@ int main( int argc, char *argv[] )
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
 
    if (glutCreateWindow(argv[0]) <= 0) {
+      glewInit();
       printf("Couldn't create window\n");
       exit(0);
    }
index e2eed756b627e6932572ee80fd1bcab8b6492a99..3e8e9908cbe0d2c3c56c589379047ca07dbab6a3 100644 (file)
@@ -3,9 +3,9 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
 #include <assert.h>
 #include <stdio.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <GL/glx.h>
 #include "readtex.c"
@@ -258,6 +258,7 @@ main( int argc, char *argv[] )
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
 
    glutCreateWindow(argv[0]);
+   glewInit();
 
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
index 6ee4bc4eae3370e7d3a9fb57f3d882308794b63d..fa919dba6240b2e8b9d20d53848ac44a70556b65 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 const GLenum filter_modes[] = {
@@ -219,8 +220,8 @@ static void Init( void )
 static void generate_tunnel( unsigned num_segs, GLfloat ** pos_data,
                             GLfloat ** tex_data )
 {
-   const GLfloat far = 20.0f;
-   const GLfloat near = -90.0f;
+   const GLfloat far_distance = 20.0f;
+   const GLfloat near_distance = -90.0f;
    const GLfloat far_tex = 30.0f;
    const GLfloat near_tex = 0.0f;
    const GLfloat angle_step = (2 * M_PI) / num_segs;
@@ -241,12 +242,12 @@ static void generate_tunnel( unsigned num_segs, GLfloat ** pos_data,
    for ( i = 0 ; i < num_segs ; i++ ) {
       position[0] = 2.5 * sinf( angle );
       position[1] = 2.5 * cosf( angle );
-      position[2] = (i & 1) ? far : near;
+      position[2] = (i & 1) ? far_distance : near_distance;
       position[3] = 1.0f;
 
       position[4] = position[0];
       position[5] = position[1];
-      position[6] = (i & 1) ? near : far;
+      position[6] = (i & 1) ? near_distance : far_distance;
       position[7] = 1.0f;
 
       position += 8;
@@ -264,12 +265,12 @@ static void generate_tunnel( unsigned num_segs, GLfloat ** pos_data,
 
       position[0] = 2.5 * sinf( angle );
       position[1] = 2.5 * cosf( angle );
-      position[2] = (i & 1) ? near : far;
+      position[2] = (i & 1) ? near_distance : far_distance;
       position[3] = 1.0f;
 
       position[4] = position[0];
       position[5] = position[1];
-      position[6] = (i & 1) ? far : near;
+      position[6] = (i & 1) ? far_distance : near_distance;
       position[7] = 1.0f;
 
       position += 8;
@@ -381,6 +382,7 @@ int main( int argc, char ** argv )
    glutInitWindowSize( 800, 600 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow( "Texture Filter Test" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index be8f6775c707297a4fdffd5dbdf4d6ae304c1538..008da8625e20848a0651eea9370ed6f6b02821e2 100644 (file)
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #undef max
@@ -618,6 +619,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( winWidth, winHeight );
    glutInitWindowPosition( 0, 0 );
    glutCreateWindow( "Mixed texgen/non-texgen texture coordinate test" );
+   glewInit();
 
    initialize();
    instructions();
index 76dfccd9b1ac5e4b0a8557417b796191722614ce..1803832b47e6ddadc75d9dd44080def92042856d 100644 (file)
@@ -9,6 +9,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include "../util/readtex.c"   /* I know, this is a hack. */
 
@@ -263,6 +264,7 @@ int main( int argc, char *argv[] )
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
 
    glutCreateWindow(argv[0] );
+   glewInit();
 
    Init(argc, argv);
 
index 43edc491801c3a9398b56ce504ab73d3c247634c..10061ee5869e6ededeb146ea1bf091bb02f7e6c1 100644 (file)
@@ -6,11 +6,11 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include "readtex.h"
 
@@ -328,6 +328,7 @@ int main( int argc, char *argv[] )
    glutInitWindowPosition( 0, 0 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow(argv[0] );
+   glewInit();
 
    Init( argc, argv );
 
index 8143256f8ae6406e5806119c1d035aacfd15e841..12f045b72e0d08b419334a387794c4ec5fa53282 100644 (file)
@@ -8,10 +8,10 @@
  */
 
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -294,6 +294,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 1000, 270 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index f25e52616aaa53432f64c2b635beb24033ad5012..db6fffa3e8953f6701a8f4303826f7df3deea1f8 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static int win_width, win_height;
@@ -194,6 +195,7 @@ main(int argc, char *argv[])
        glutInitWindowSize(win_width, win_height);
        glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
        glutCreateWindow(argv[0]);
+        glewInit();
        glutReshapeFunc(reshape);
        glutKeyboardFunc(key);
        glutDisplayFunc(display);
index c2d70885f05f3d4516c4c48427a26604f6d1aca1..117fae8bd9e3abf64776bd7c5b89edec9b11b3d7 100644 (file)
@@ -49,6 +49,7 @@ typedef void (* PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays);
 typedef GLboolean (* PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);
 
 #else
+#include <GL/glew.h>
 #include <GL/glut.h>
 #endif
 
@@ -166,6 +167,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB );
    glutCreateWindow( "GL_APPLE_vertex_array_object demo" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 993bc368d401418026a3cf02f69f9f427ce9f598..7764ed51061df7e2c09bff9a0109b26fcbec8ff9 100644 (file)
@@ -49,6 +49,7 @@ typedef void (* PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays);
 typedef GLboolean (* PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);
 
 #else
+#include <GL/glew.h>
 #include <GL/glut.h>
 #endif
 
@@ -194,6 +195,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB );
    glutCreateWindow( "GL_APPLE_vertex_array_object demo" );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 580a670f8e10e444c0ce95d7cd7b59555eefa0c3..9c2fad97d9d90012ddcd960263aac149dac3e21c 100644 (file)
@@ -12,7 +12,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include "GL/glew.h"
 #include "GL/glut.h"
 
 #define MAXVERTS 10000
@@ -280,6 +280,7 @@ int main(int argc, char **argv)
    glutInitWindowPosition(0, 0);
    glutInitWindowSize(400, 400);
    if (glutCreateWindow("Isosurface") <= 0) {
+      glewInit();
       exit(0);
    }
    glutReshapeFunc(Reshape);
index 8b6996d3b5cf33745a848ba090ab36c40d84deac..f07737f9736aafd6d96128f22eef2bf6fb82c5d9 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -222,6 +222,7 @@ main(int argc, char **argv)
     glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
     glutInitWindowPosition(0, 0);
     glutCreateWindow(argv[0]);
+    glewInit();
     myinit(argc, argv);
     glutReshapeFunc(myReshape);
     glutDisplayFunc(display);
index 560df2c3fdcf91030b60f087e8e129ef8f686b5c..516291929230e7d2dd1a989305177b559b45afbc 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -161,6 +161,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 2158e07f04247577131614844e2e855d0119a7f4..4161b03a673583467f5799f9c590036627233a7f 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -140,6 +140,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 50, 50 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 2c5c8000408d71c81cc80317b70d2a2629da333e..4e4bfee31dc95a9453bb22cdac4cd35b7e9c9f0f 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static float Zrot = 0.0;
@@ -111,6 +111,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
index 764dea4ec22b445b235ee3302a95312609055532..e61ffdac217cc6f866e4c2103155a2bb9b718bed 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static float Xrot = 0.0, Yrot = 0.0, Zrot = 0.0;
@@ -162,6 +162,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index 56aa8200ec8caa6f25dba537a78b763550568b84..80204ea1361863101d809190c4a56dca65323da8 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static float Xrot = -60.0, Yrot = 0.0, Zrot = 0.0;
@@ -224,6 +224,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutSpecialFunc( SpecialKey );
index acef406097020ea07ec72937b35947a0c60c88b1..aab2f80ed9a47e8061a2d71136817ef76704e08f 100644 (file)
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "../util/readtex.c"   /* I know, this is a hack. */
@@ -180,6 +180,7 @@ int main( int argc, char *argv[] )
    glutInitWindowPosition( 0, 0 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow(argv[0] );
+   glewInit();
 
    Init( argc, argv );
 
index 3601e7a31c705ad9581e9489860b620510f30cf4..658528b799660e065c9b52cfbd94eb9eafd2e9c5 100644 (file)
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "../util/readtex.c"   /* I know, this is a hack. */
@@ -219,6 +219,7 @@ int main( int argc, char *argv[] )
    glutInitWindowPosition( 0, 0 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow(argv[0] );
+   glewInit();
 
    Init( argc, argv );
 
index b53079d07fca1d461879bc198fcf65b58ca66eb2..15e35f17b09729baa86026bc15382602045e14cb 100644 (file)
@@ -2,10 +2,10 @@
  * Test Z compositing with glDrawPixels(GL_DEPTH_COMPONENT) and stencil test.
  */
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include "../util/showbuffer.c"
 
@@ -211,6 +211,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(Width, Height);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutSpecialFunc(SpecialKey);
index dd222e7dd0b18d5e1ccf1f97e2b41a28c4c605bd..ba7da571ebf54f3d71a53cba284d2102c09f1fd2 100644 (file)
  * Press 'd' to view the Z buffer as a grayscale image.
  */
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include "../util/showbuffer.c"
 
@@ -180,6 +180,7 @@ main(int argc, char *argv[])
    glutInitWindowSize(400, 400);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    Win = glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutSpecialFunc(SpecialKey);
index e2dacbf7f2fe1e11f4debb0a882920f6941fe4ea..3d8c557b37062411389dd6016e350ff1006cc871 100644 (file)
@@ -8,7 +8,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static GLint WinWidth = 500, WinHeight = 500;
@@ -107,6 +107,7 @@ int main(int argc, char *argv[])
    glutInitWindowSize(WinWidth, WinHeight);
    glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Display);
index d77f120b96bdb5bbe09478a797437ed0e0e5339f..aec4c94527d9e42f7d666fb821dbd78e5c5da5c3 100644 (file)
@@ -9,6 +9,7 @@ dlist-dangling
 dlist-degenerate
 dlist-edgeflag
 dlist-edgeflag-dangling
+draw2arrays
 drawarrays
 drawelements
 drawrange
@@ -58,11 +59,13 @@ quad-tex-2d
 quad-tex-3d
 quad-tex-alpha
 quad-tex-pbo
+quad-tex-sub
 quad-unfilled
 quad-unfilled-clip
 quad-unfilled-stipple
 quads
 quadstrip
+quadstrip-clip
 quadstrip-cont
 quadstrip-flat
 readtex.c
@@ -83,12 +86,15 @@ tri-dlist
 tri-edgeflag
 tri-fbo
 tri-fbo-tex
+tri-fbo-tex-mip
 tri-flat
 tri-flat-clip
 tri-fog
 tri-fp
 tri-fp-const-imm
 tri-lit
+tri-logicop-none
+tri-logicop-xor
 tri-mask-tri
 tri-orig
 tri-query
@@ -102,12 +108,14 @@ tri-tri
 tri-unfilled
 tri-unfilled-clip
 tri-unfilled-edgeflag
+tri-unfilled-fog
 tri-unfilled-smooth
 tri-unfilled-tri
 tri-unfilled-tri-lit
 tri-unfilled-userclip
 tri-unfilled-userclip-stip
 tri-userclip
+tri-viewport
 tri-z
 tri-z-eq
 trifan
index dce96f6bc8c39b62b8644e64f484ea76b164d712..082387d86ea1f4e9a57a0ae34d893f82b35eb0d9 100644 (file)
@@ -23,6 +23,7 @@ SOURCES = \
        dlist-edgeflag.c \
        dlist-degenerate.c \
        drawarrays.c \
+       draw2arrays.c \
        drawelements.c \
        drawrange.c \
        flat-clip.c \
@@ -69,11 +70,13 @@ SOURCES = \
        quad-tex-3d.c \
        quad-tex-alpha.c \
        quad-tex-pbo.c \
+       quad-tex-sub.c \
        quad-unfilled-clip.c \
        quad-unfilled-stipple.c \
        quad-unfilled.c \
        quad.c \
        quads.c \
+       quadstrip-clip.c \
        quadstrip-cont.c \
        quadstrip-flat.c \
        quadstrip.c \
@@ -88,8 +91,11 @@ SOURCES = \
        tri-clip.c \
        tri-cull-both.c \
        tri-cull.c \
+       tri-logicop-none.c \
+       tri-logicop-xor.c \
        tri-dlist.c \
        tri-edgeflag.c \
+       tri-fbo-tex-mip.c \
        tri-fbo-tex.c \
        tri-fbo.c \
        tri-flat-clip.c \
@@ -108,6 +114,7 @@ SOURCES = \
        tri-tex.c \
        tri-tex-3d.c \
        tri-tri.c \
+       tri-unfilled-fog.c \
        tri-unfilled-edgeflag.c \
        tri-unfilled-clip.c \
        tri-unfilled-smooth.c \
@@ -117,6 +124,7 @@ SOURCES = \
        tri-unfilled-userclip.c \
        tri-unfilled.c \
        tri-userclip.c \
+       tri-viewport.c \
        tri-z-eq.c \
        tri-z.c \
        tri.c \
index 76826d9be08a94f8fd8323831789a72ed390e496..6a9ffafe5096d90cb4e06fa7a851d037e09f0fd6 100644 (file)
@@ -19,6 +19,7 @@ progs = [
        'dlist-edgeflag',
        'dlist-degenerate',
        'drawarrays',
+       'draw2arrays',
        'drawelements',
        'drawrange',
        'flat-clip',
@@ -65,11 +66,13 @@ progs = [
        'quad-tex-3d',
        'quad-tex-alpha',
        'quad-tex-pbo',
+       'quad-tex-sub',
        'quad-unfilled-clip',
        'quad-unfilled-stipple',
        'quad-unfilled',
        'quad',
        'quads',
+       'quadstrip-clip',
        'quadstrip-cont',
        'quadstrip-flat',
        'quadstrip',
@@ -86,6 +89,7 @@ progs = [
        'tri-cull',
        'tri-dlist',
        'tri-edgeflag',
+       'tri-fbo-tex-mip',
        'tri-fbo-tex',
        'tri-fbo',
        'tri-flat-clip',
@@ -94,15 +98,19 @@ progs = [
        'tri-fp',
        'tri-fp-const-imm',
        'tri-lit',
+       'tri-logicop-none',
+       'tri-logicop-xor',
        'tri-mask-tri',
        'tri-orig',
        'tri-query',
        'tri-repeat',
        'tri-scissor-tri',
        'tri-stencil',
+       'tri-stipple',
        'tri-tex',
        'tri-tex-3d',
        'tri-tri',
+       'tri-unfilled-fog',
        'tri-unfilled-edgeflag',
        'tri-unfilled-clip',
        'tri-unfilled-smooth',
@@ -112,6 +120,7 @@ progs = [
        'tri-unfilled-userclip',
        'tri-unfilled',
        'tri-userclip',
+       'tri-viewport',
        'tri-z-eq',
        'tri-z',
        'tri',
index 16bd83339b805d7117e92c95473a8f6c2fbe18bc..f3a67dbe8a81aed3bf3c297a307c4172bda88235 100644 (file)
@@ -118,7 +118,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 9f9490c6c877405e9350499a77c3f3b13c39999b..9c618d492f34a70fb9bc80a12dd2e770aa7d6237 100644 (file)
@@ -72,6 +72,24 @@ static void Draw(void)
       glClearColor((sin(f)+1)/2.0,(cos(f)+1)/2.0,0.5,1); 
       glClear(GL_COLOR_BUFFER_BIT); 
       glutSwapBuffers();
+
+      {
+         static GLint T0 = 0;
+         static GLint Frames = 0;
+         GLint t = glutGet(GLUT_ELAPSED_TIME);
+
+         Frames++;
+
+         if (t - T0 >= 5000) {
+            GLfloat seconds = (t - T0) / 1000.0;
+            GLfloat fps = Frames / seconds;
+            printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+            fflush(stdout);
+            T0 = t;
+            Frames = 0;
+         }
+      }
+
    }
    glutPostRedisplay();
 }
@@ -91,13 +109,13 @@ int main(int argc, char **argv)
        exit(1);
     }
 
-    glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+    glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
 
     type = GLUT_RGB | GLUT_ALPHA;
     type |= GLUT_DOUBLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index da4fff0459010e9611ff589f2458bee8cbade5bd..37cfd54fbe2cdb0e0b7b153855da9b4b282e647f 100644 (file)
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 901048555a978ebcf6a6f24a30c61c1f2f932ca8..44d5b1b2c5f12db43b6842adc87a2d9f47c338fa 100644 (file)
@@ -106,7 +106,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 00a75078444eaa4518499d1b786692d9ac60aecd..64054ec96c1ea56637354211dcd6d736efdb2b3f 100644 (file)
@@ -135,7 +135,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 08fae549c31b0b1f4879d7c043611ea0b0515322..1b66244cabf919c0bf84d3a889e060a9c9d9b8af 100644 (file)
@@ -140,7 +140,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index ae799dc35579d8b8da82f426d8768aa2dc6f314f..350100681e50d80b9ec470fddf2480ae8c0e8007 100644 (file)
@@ -144,7 +144,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
diff --git a/progs/trivial/draw2arrays.c b/progs/trivial/draw2arrays.c
new file mode 100644 (file)
index 0000000..95a8998
--- /dev/null
@@ -0,0 +1,117 @@
+/* Basic VBO */
+
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+
+GLfloat pos[][3] =
+   { {  0.9, -0.9, 0.0 },
+     {  0.9,  0.9, 0.0 },
+     { -0.9,  0.9, 0.0 },
+     { -0.9, -0.9, 0.0 } };
+
+GLubyte color[][4] = 
+{ { 0x00, 0x00, 0xff, 0x00 },
+  { 0x00, 0xff, 0x00, 0x00 },
+  { 0xff, 0x00, 0x00, 0x00 },
+  { 0xff, 0xff, 0xff, 0x00 } };
+
+static void Init( void )
+{
+   GLint errno;
+   GLuint prognum;
+   
+   static const char *prog1 =
+      "!!ARBvp1.0\n"
+      "MOV  result.color, vertex.color;\n"
+      "MOV  result.position, vertex.position;\n"
+      "END\n";
+
+   glGenProgramsARB(1, &prognum);
+   glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
+   glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
+                     strlen(prog1), (const GLubyte *) prog1);
+
+   assert(glIsProgramARB(prognum));
+   errno = glGetError();
+   printf("glGetError = %d\n", errno);
+   if (errno != GL_NO_ERROR)
+   {
+      GLint errorpos;
+
+      glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
+      printf("errorpos: %d\n", errorpos);
+      printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
+   }
+
+
+   glEnableClientState( GL_VERTEX_ARRAY );
+   glEnableClientState( GL_COLOR_ARRAY );
+
+   glVertexPointer( 3, GL_FLOAT, sizeof(pos[0]), pos );
+   glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(color[0]), color );
+
+}
+
+
+
+static void Display( void )
+{
+   glClearColor(0.3, 0.3, 0.3, 1);
+   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+
+   glEnable(GL_VERTEX_PROGRAM_ARB);
+
+//   glDrawArrays( GL_TRIANGLES, 0, 3 );
+   glDrawArrays( GL_TRIANGLES, 1, 3 );
+
+   glFlush(); 
+}
+
+
+static void Reshape( int width, int height )
+{
+   glViewport( 0, 0, width, height );
+   glMatrixMode( GL_PROJECTION );
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
+   glMatrixMode( GL_MODELVIEW );
+   glLoadIdentity();
+   /*glTranslatef( 0.0, 0.0, -15.0 );*/
+}
+
+
+static void Key( unsigned char key, int x, int y )
+{
+   (void) x;
+   (void) y;
+   switch (key) {
+      case 27:
+         exit(0);
+         break;
+   }
+   glutPostRedisplay();
+}
+
+
+
+
+int main( int argc, char *argv[] )
+{
+   glutInit( &argc, argv );
+   glutInitWindowPosition( 0, 0 );
+   glutInitWindowSize( 250, 250 );
+   glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
+   glutCreateWindow(argv[0]);
+   glewInit();
+   glutReshapeFunc( Reshape );
+   glutKeyboardFunc( Key );
+   glutDisplayFunc( Display );
+   Init();
+   glutMainLoop();
+   return 0;
+}
index fd79d049c4f0fc1ff74b280fe0d98c08f95023fb..bcee32e25fcc3ab75e8fef243a579e08539b5840 100644 (file)
@@ -126,7 +126,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 038004b4c4aae2d028ef626698bef877f68670fb..98218731304ee7b40a57453d4525d14e299231e2 100644 (file)
@@ -122,7 +122,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 09e5e1fe089313fc11103a50944f263236aa9c62..28d96c797b073c77a47a32e1a3b0141f9bc74000 100644 (file)
@@ -134,7 +134,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 5c9c1b3b291e2cd2b93da6ecea2f9ab14e1c2401..1b9f059729c462c1fb733b7d2c13479836cf9ec4 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index a6ee44fbd0f5600ea5bbde3ad03fcb3f02272233..9f144a6e9a3db9493d14151cf8c597df3dc7cda6 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index cebea5f4812a374f0816a0d6b55aaea5ac6d8342..7588faeb98f530691a14c92ab1ccfbe7036586d9 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index ecfd28cac7106c9650ec38f49c62ea77f5eba96b..77d8228188c0919f87b392d664dd0c4ef3b20075 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 543b1f67f341f44b509eb40f5429f7e38b33aeb1..f20505378cb917f39935d61c11e481ec3cab461d 100644 (file)
@@ -133,7 +133,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index de5f9274e4147a1ce20617764b5480ada2287150..7ccbce3750a48eaecbcbf07c2489513382f09da1 100644 (file)
@@ -131,7 +131,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 211056720fee893ea42ffafeb526dc54560fce22..fbeca985b900621b4e6535bdd489ebaa43f70b8a 100644 (file)
@@ -122,7 +122,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index fab7d1ea0226661267e428073e380a51eea48587..5863df654b89d0d1dbbf792e72b48cbc0c14fb5d 100644 (file)
@@ -122,7 +122,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index acab0f4e1cf1beb9daf108a07c3029a8b87dd92b..dae27c31d4492812b7531bd6d4b7c000dec990ce 100644 (file)
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index b691437346a6b343d321f691e1d6ff163f3983b5..ee79f15019420e2dfb56c9d663195ccd4c4f6496 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 53dfa554e980b569dbd187f4315bdba16ba46ef6..c6307d59941c1585e88f986e24fe462bc9b33a87 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 5933d1a136f21f98ebc55a46d5e0c27103017cd2..2b40b5f1b8eae74e2ae158fa644a631f2490b8a5 100644 (file)
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 06dd1c1087244a0f7cd99fcf3b1387355d4cbe8f..865a752796ce2dffe1014f73cc86858b7fab3c21 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 41ad25c1b3d669605f303d53db035aa516bf17e1..f2a29a9d376dbb62db4a74d5986d34b7a93ff59d 100644 (file)
@@ -139,7 +139,7 @@ main(int argc, char **argv)
     glutInitWindowPosition(0, 0);
     glutInitWindowSize( 250, 250);
     glutInitDisplayMode(type);
-    if (glutCreateWindow("tri-long-fixedfunc") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
     glewInit();
index 7fec54e1db93f3440744645c9e21aeba4bdb59fc..6aaee0d1a5f515ad15ea9cc061612c6d6d64c6e6 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 583bdca1b71a3317415a5b70a83e2dd32d89e234..2f8226ee273af90c9fd7f0c0ea0e771be0cf8429 100644 (file)
@@ -160,7 +160,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 55cbcaec70b1d1870aba34ad14a2722d938e6b98..63f83badf8c504bd6a90a40649e7c2a26f8ea865 100644 (file)
@@ -131,7 +131,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 265b20097b1cfe682ab936b29522865cc0911829..725edae49ec3a337114328b8472f7c3ed323c906 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 8dabfb6ca64eb6809577aee17332164aec805ffc..3c472c1b91e1a61ca6408246e23b18561662c2eb 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 72c2a29a0d26dbce9f2ffb77cf23d53ad82b2d4d..d58a3a358f8cddf0b8997171fbc260598ff03f52 100644 (file)
@@ -126,7 +126,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index d3a14a516a4ff2508107c47121f359f098a2e81c..74249eb4999a54688d7a88188e683145bda03f4f 100644 (file)
@@ -130,7 +130,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index a847d6828a7d59724a5e137d640c3c79e79dd80d..82098bc1bbc925735abc2536e2cc534052f5ff9e 100644 (file)
@@ -126,7 +126,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index ae092a830ab2e61289c230274a4cd696da25ae76..5cc8523f815aa0925341ce74fd855f2414049351 100644 (file)
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 2f254de48158fa881811bc661bcf6a187df4effb..8944f148d094f5112162b25b852d004c9f824e27 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 3e0f3d949483df11f8199901064b27a69bea00e8..6559adf4af832deab999279bcafea25e70656c4b 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 1e8056c474b5d525977d965c573c1bb28072323c..0e4f4c947c3787ea18ee3db25f8002502a7c9123 100644 (file)
@@ -137,7 +137,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 504fef3dc593ff770a0144c27f499804f9d924e4..fd3522a89a22540bfcae8c3d7c80c66a4dd373e9 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 83047408573f19320a4ff5f3843426b4876b64f4..29fb2774deb0ceb33841af9d4d78f5fa86758981 100644 (file)
@@ -129,7 +129,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index bd8be7c43e3088f1696dd6dc44464b512261f838..570eb6bc715da62809bef3ff41463ebf81b15f4c 100644 (file)
@@ -134,7 +134,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 90943d908ff377f7c765cfaa8dffa032f22fd05b..2c4946a13a6c070d02b347c9626b59a1305fd319 100644 (file)
@@ -142,7 +142,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 1ad44cdcaec771697431a3e5bc2dae8b316bc170..40762825bd102165a9a040feec77bc899d4da9b6 100644 (file)
@@ -155,7 +155,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index d5db21469e61dacee1f759df01cc4dae762c9db6..b4b138b4b44537be5de5d8d2ce79564e5a3c447e 100644 (file)
@@ -143,7 +143,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 97c9fc54d866d2ff62c657a4ad498c7903d8be5c..ed6f4a07330aa4c1fe1037da70cb425dcc751395 100644 (file)
@@ -173,7 +173,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    win = glutCreateWindow("First Tri");
+    win = glutCreateWindow(*argv);
     if (!win) {
        exit(1);
     }
index ca7ea91d2f36b43c15cfab22b1bd91400c998585..84acb35fd8278af7487512665d69e5b7ddc36100 100644 (file)
@@ -164,7 +164,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index cd73f013eb049306dc9ff46e2c632cf684b16dcc..be24255a3e25bf5991ba6aec0de00c7aa72f09dc 100644 (file)
@@ -156,7 +156,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index c6f60f51fa645561c255c18f253254c4133d6cd6..dcb4ae0e7f85f101447b0ae4e2a21241ce4ff714 100644 (file)
@@ -167,7 +167,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
diff --git a/progs/trivial/quad-tex-sub.c b/progs/trivial/quad-tex-sub.c
new file mode 100644 (file)
index 0000000..aabbb9e
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the name of
+ * Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
+ * ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+
+
+#define CI_OFFSET_1 16
+#define CI_OFFSET_2 32
+
+#define SIZE 16
+GLenum doubleBuffer;
+GLint line = 0;
+
+static void MakeImage()
+{
+   GLubyte tex2d[SIZE][SIZE][3];
+   GLint s, t;
+
+   for (s = 0; s < SIZE; s++) {
+      for (t = 0; t < SIZE; t++) {
+         tex2d[t][s][0] = s*255/(SIZE-1);
+         tex2d[t][s][1] = t*255/(SIZE-1);
+         tex2d[t][s][2] = 0*255/(SIZE-1);
+      }
+   }
+
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
+                SIZE, SIZE,
+                0,
+                GL_RGB, GL_UNSIGNED_BYTE, tex2d);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+   glEnable(GL_TEXTURE_2D);
+}
+
+static void UpdateLine()
+{
+   GLubyte tex[SIZE][3];
+   GLubyte b = 0;
+   GLint s, t;
+
+   t = line % SIZE;
+   if (line % (SIZE * 2) < SIZE)
+      b = 255;
+   else
+      b = 0;
+
+   for (s = 0; s < SIZE; s++) {
+      tex[s][0] = s*255/(SIZE-1);
+      tex[s][1] = t*255/(SIZE-1);
+      tex[s][2] = b;
+   }
+
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+   glTexSubImage2D(GL_TEXTURE_2D, 0,
+                   0, t,
+                   SIZE, 1,
+                   GL_RGB, GL_UNSIGNED_BYTE, tex);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+}
+
+static void Init(void)
+{
+   fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
+   fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
+   fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+
+   glClearColor(0.0, 0.0, 1.0, 0.0);
+
+   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+   MakeImage();
+   UpdateLine();
+   line++;
+}
+
+static void Reshape(int width, int height)
+{
+
+    glViewport(0, 0, (GLint)width, (GLint)height);
+
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity();
+    glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
+    glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+   switch (key) {
+   case 27:
+      exit(1);
+   default:
+      UpdateLine();
+      line++;
+      break;
+   }
+
+   glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glBegin(GL_QUADS);
+   glTexCoord2f(1,0);
+   glVertex3f( 0.9, -0.9, -30.0);
+   glTexCoord2f(1,1);
+   glVertex3f( 0.9,  0.9, -30.0);
+   glTexCoord2f(0,1);
+   glVertex3f(-0.9,  0.9, -30.0);
+   glTexCoord2f(0,0);
+   glVertex3f(-0.9,  -0.9, -30.0);
+   glEnd();
+
+   glFlush();
+
+   if (doubleBuffer) {
+      glutSwapBuffers();
+   }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+   GLint i;
+
+   doubleBuffer = GL_FALSE;
+
+   for (i = 1; i < argc; i++) {
+      if (strcmp(argv[i], "-sb") == 0) {
+         doubleBuffer = GL_FALSE;
+      } else if (strcmp(argv[i], "-db") == 0) {
+         doubleBuffer = GL_TRUE;
+      } else {
+         fprintf(stderr, "%s (Bad option).\n", argv[i]);
+         return GL_FALSE;
+      }
+   }
+   return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+   GLenum type;
+
+   glutInit(&argc, argv);
+
+   if (Args(argc, argv) == GL_FALSE) {
+      exit(1);
+   }
+
+   glutInitWindowPosition(0, 0);
+   glutInitWindowSize(250, 250);
+
+   type = GLUT_RGB | GLUT_ALPHA;
+   type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+   glutInitDisplayMode(type);
+
+   if (glutCreateWindow(*argv) == GL_FALSE) {
+      exit(1);
+   }
+
+   glewInit();
+
+   Init();
+
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutDisplayFunc(Draw);
+   glutMainLoop();
+   return 0;
+}
index e298bd455bf9d2002d54a247a7c84e6974dc7b33..e25a34bda858735bdaebf78f66f60cfb3d692a33 100644 (file)
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 2036aacbaab2cc666039a798bad3182e87cb0198..d33e5918bce34b5dea23d1279a70558bebc7d860 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 9d0087ce08d12a6d21dcf71cdf008a32555ea381..b60af3e7f562ee69bdab242159406744d0bfb27c 100644 (file)
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 85424b7b3881c006b26022c08bf5dcdbe2fa19d8..c4773ec7dabe885dcb2dd357d5fb5fe8a35cee8d 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 307a9e0720999cf1daae66d818f5f503a9fc7d7d..5bc622144eda01351e3a12cf75f22900c38116c8 100644 (file)
@@ -142,7 +142,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
diff --git a/progs/trivial/quadstrip-clip.c b/progs/trivial/quadstrip-clip.c
new file mode 100644 (file)
index 0000000..82a6d4e
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the name of
+ * Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
+ * ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <GL/glut.h>
+
+GLenum doubleBuffer;
+
+static void Init(void)
+{
+   fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
+   fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
+   fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+
+   glClearColor(0.0, 0.0, 1.0, 0.0);
+}
+
+static void Reshape(int width, int height)
+{
+   glViewport(0, 0, (GLint)width, (GLint)height);
+
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
+   glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+   switch (key) {
+      case 27:
+         exit(1);
+   }
+
+   glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glBegin(GL_QUAD_STRIP);
+   glColor3f(1,1,1);
+   glVertex3f( 1.9, -0.9, -30.0);
+   glVertex3f( 0.9, 0.9, -30.0);
+
+   glColor3f(1,0,0);
+   glVertex3f( 0.1, -0.8, -30.0);
+   glVertex3f( 0.1, 0.8, -30.0);
+
+   glColor3f(0,1,0);
+   glVertex3f(-0.1,  -0.9, -30.0);
+   glVertex3f(-0.1,  0.9, -30.0);
+
+   glColor3f(0,0,0);
+   glVertex3f(-0.9,  -0.8, -30.0);
+   glVertex3f(-0.9,  0.8, -30.0);
+   glEnd();
+
+   glFlush();
+
+   if (doubleBuffer) {
+      glutSwapBuffers();
+   }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+   GLint i;
+
+   doubleBuffer = GL_FALSE;
+
+   for (i = 1; i < argc; i++) {
+      if (strcmp(argv[i], "-sb") == 0) {
+         doubleBuffer = GL_FALSE;
+      } else if (strcmp(argv[i], "-db") == 0) {
+         doubleBuffer = GL_TRUE;
+      } else {
+         fprintf(stderr, "%s (Bad option).\n", argv[i]);
+         return GL_FALSE;
+      }
+   }
+   return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+   GLenum type;
+
+   glutInit(&argc, argv);
+
+   if (Args(argc, argv) == GL_FALSE) {
+      exit(1);
+   }
+
+   glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+
+   type = GLUT_RGB | GLUT_ALPHA;
+   type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+   glutInitDisplayMode(type);
+
+   if (glutCreateWindow(*argv) == GL_FALSE) {
+      exit(1);
+   }
+
+   Init();
+
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutDisplayFunc(Draw);
+   glutMainLoop();
+   return 0;
+}
index c6c8f69f8cae3fe00015071b49d5f8e850a9caa6..62208dfae7594a32d3685729834e427a15dacde9 100644 (file)
@@ -147,7 +147,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index d02135f702a603ae3ba81027654aeb1d518579e1..9011ee0873fb03ee930d0668482a9e538361d978 100644 (file)
@@ -136,7 +136,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index ff8644be09eecbb212fb8b9f8847b836f6b88104..6923afc04b58caf3fd0fc1d07a812a3c77aca588 100644 (file)
@@ -130,7 +130,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 776f39dcc35591d0c97026d1525261ce24a06aba..382d7b2102948906fe71923246126262b5999537 100644 (file)
@@ -165,7 +165,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 90cfdbe199d36b1a0b0a5e9f6bf0cad9bd493cbf..1a653713bbf796219f09b6e4d1536496299552e3 100644 (file)
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index d2d72d0b62faa775ab73b74b4f5d8f5fdc37f83a..db831e3d6e03b42879edc99a5af6c29808d00894 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 25ea77cfa759b4946ad1404f1b12c505bf47f788..a3908e38e9d69db6411631bf1fbd23236faeaa10 100644 (file)
@@ -129,7 +129,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index f30445cdba1c751da2c878f9946363c407199f6d..0d31086c8552afdc7edcea13a0f00cb7be9561a5 100644 (file)
@@ -143,7 +143,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 51b5865ae5ca1786bffa964317b88236c054df54..73c5583cfdd42f0dda9cf7856c6817b53c86eea0 100644 (file)
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 2eead8411558e15bcaeaf1318f4fc88adec79fd5..c6bcf444e42956b23f7727cf9294fe9e86ff3db4 100644 (file)
@@ -158,7 +158,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index c21c4714adf15067dda859cb7484295bb85f3583..1c0e320f61aee5d573c5f82383013111cbba2444 100644 (file)
@@ -136,7 +136,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 41899c2eb4f869226a6ac78435fd86336db48e81..e1278dd64905660d07bbd669b00fc5d1ad4e24b8 100644 (file)
@@ -123,7 +123,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
diff --git a/progs/trivial/tri-fbo-tex-mip.c b/progs/trivial/tri-fbo-tex-mip.c
new file mode 100644 (file)
index 0000000..0744369
--- /dev/null
@@ -0,0 +1,261 @@
+/* Framebuffer object test */
+
+
+#include <GL/glew.h>
+#include <GL/glut.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+/* For debug */
+
+
+static int Win = 0;
+static int Width = 512, Height = 512;
+
+static GLenum TexTarget = GL_TEXTURE_2D;
+static int TexWidth = 512, TexHeight = 512;
+
+static GLuint MyFB;
+static GLuint TexObj;
+static GLboolean Anim = GL_FALSE;
+static GLfloat Rot = 0.0;
+static GLuint TextureLevel = 4;  /* which texture level to render to */
+static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */
+
+
+static void
+CheckError(int line)
+{
+   GLenum err = glGetError();
+   if (err) {
+      printf("GL Error 0x%x at line %d\n", (int) err, line);
+   }
+}
+
+
+static void
+Idle(void)
+{
+   Rot = glutGet(GLUT_ELAPSED_TIME) * 0.1;
+   glutPostRedisplay();
+}
+
+
+static void
+RenderTexture(void)
+{
+   GLenum status;
+
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
+   glTranslatef(0.0, 0.0, -15.0);
+
+   if (1) {
+      /* draw to texture image */
+      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
+
+      status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+      if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+         printf("Framebuffer incomplete!!!\n");
+      }
+
+      glViewport(0, 0,
+                 TexWidth / (1 << TextureLevel),
+                 TexHeight / (1 << TextureLevel));
+      glClearColor(0.5, 0.5, 1.0, 0.0);
+      glClear(GL_COLOR_BUFFER_BIT);
+      
+      CheckError(__LINE__);
+
+      glBegin(GL_POLYGON);
+      glColor3f(1, 0, 0);
+      glVertex2f(-1, -1);
+      glColor3f(0, 1, 0);
+      glVertex2f(1, -1);
+      glColor3f(0, 0, 1);
+      glVertex2f(0, 1);
+      glEnd();
+
+      /* Bind normal framebuffer */
+      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+   }
+   else {
+   }
+
+   CheckError(__LINE__);
+}
+
+
+
+static void
+Display(void)
+{
+   float ar = (float) Width / (float) Height;
+
+   RenderTexture();
+   
+   /* draw textured quad in the window */
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
+   glTranslatef(0.0, 0.0, -7.0);
+
+   glViewport(0, 0, Width, Height);
+
+   glClearColor(0.25, 0.25, 0.25, 0);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   glPushMatrix();
+   glRotatef(Rot, 0, 1, 0);
+   glEnable(TexTarget);
+   glBindTexture(TexTarget, TexObj);
+
+   {
+      glBegin(GL_POLYGON);
+      glColor3f(0.25, 0.25, 0.25);
+      glTexCoord2f(0, 0);
+      glVertex2f(-1, -1);
+      glTexCoord2f(1, 0);
+      glVertex2f(1, -1);
+      glColor3f(1.0, 1.0, 1.0);
+      glTexCoord2f(1, 1);
+      glVertex2f(1, 1);
+      glTexCoord2f(0, 1);
+      glVertex2f(-1, 1);
+      glEnd();
+   }
+
+   glPopMatrix();
+   glDisable(TexTarget);
+
+   glutSwapBuffers();
+   CheckError(__LINE__);
+}
+
+
+static void
+Reshape(int width, int height)
+{
+   glViewport(0, 0, width, height);
+   Width = width;
+   Height = height;
+}
+
+
+static void
+CleanUp(void)
+{
+   glDeleteFramebuffersEXT(1, &MyFB);
+
+   glDeleteTextures(1, &TexObj);
+
+   glutDestroyWindow(Win);
+
+   exit(0);
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+   (void) x;
+   (void) y;
+   switch (key) {
+      case 'a':
+         Anim = !Anim;
+         if (Anim)
+            glutIdleFunc(Idle);
+         else
+            glutIdleFunc(NULL);
+         break;
+      case 's':
+         Rot += 2.0;
+         break;
+      case 27:
+         CleanUp();
+         break;
+   }
+   glutPostRedisplay();
+}
+
+
+static void
+Init(int argc, char *argv[])
+{
+   if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
+      printf("GL_EXT_framebuffer_object not found!\n");
+      exit(0);
+   }
+
+   printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+
+
+   /* Make texture object/image */
+   glGenTextures(1, &TexObj);
+   glBindTexture(TexTarget, TexObj);
+   glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+   glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+   glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel);
+   glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel);
+
+   glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0,
+                GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+   glTexImage2D(TexTarget, TextureLevel, TexIntFormat,
+                TexWidth / (1 << TextureLevel), TexHeight / (1 << TextureLevel), 0,
+                GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+
+
+   glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+
+
+
+   /* gen framebuffer id, delete it, do some assertions, just for testing */
+   glGenFramebuffersEXT(1, &MyFB);
+   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
+   assert(glIsFramebufferEXT(MyFB));
+
+
+   CheckError(__LINE__);
+
+   /* Render color to texture */
+   glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+                             TexTarget, TexObj, TextureLevel);
+
+
+
+   CheckError(__LINE__);
+
+   /* bind regular framebuffer */
+   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+
+
+}
+
+
+int
+main(int argc, char *argv[])
+{
+   glutInit(&argc, argv);
+   glutInitWindowPosition(0, 0);
+   glutInitWindowSize(Width, Height);
+   glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
+   Win = glutCreateWindow(argv[0]);
+   glewInit();
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutDisplayFunc(Display);
+   if (Anim)
+      glutIdleFunc(Idle);
+   Init(argc, argv);
+   glutMainLoop();
+   return 0;
+}
index 253f9310db48e71d7ea25e0f5bd6d6019ce26054..72b4cf3683dbd3fd2dd10a28b9efd846a3efde4a 100644 (file)
@@ -1,12 +1,4 @@
-/*
- * Test GL_EXT_framebuffer_object render-to-texture
- *
- * Draw a teapot into a texture image with stenciling.
- * Then draw a textured quad using that texture.
- *
- * Brian Paul
- * 18 Apr 2005
- */
+/* Framebuffer object test */
 
 
 #include <GL/glew.h>
index 155b0c4f8d40fb85ebc3a28dfc2f6043ebb43824..3235100385cc5b23b1b0563871f8d6dc4e756bab 100644 (file)
@@ -123,7 +123,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 0583a2a99a1160cb0bd8e986fe07dc16b907028f..a7fdaa1f469c2827e776aeb87bdb6098a62821b9 100644 (file)
@@ -123,7 +123,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 75f3262ecf4becbb61fe03c65a5260e395f5f5c4..0099a90ad6cc36e32b86ccb63ca9173520dfc87e 100644 (file)
@@ -42,6 +42,15 @@ static void Init(void)
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
+
+    glEnable(GL_FOG);
+    glFogi(GL_FOG_MODE, GL_LINEAR);
+    glFogf(GL_FOG_START, 25);
+    glFogf(GL_FOG_END, 35);
+#if 0
+    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    glEnable (GL_BLEND);
+#endif
 }
 
 static void Reshape(int width, int height)
@@ -70,26 +79,26 @@ static void Key(unsigned char key, int x, int y)
 
 static void Draw(void)
 {
-   glClear(GL_COLOR_BUFFER_BIT); 
+   glClear(GL_COLOR_BUFFER_BIT);
 
    glEnable(GL_FOG);
 
    glBegin(GL_TRIANGLES);
-   glColor3f(0,0,.7); 
+   glColor3f(1,1,1);
    glVertex3f( 0.9, -0.9, -30.0);
-   glColor3f(.8,0,0); 
+   glColor3f(1,1,1);
    glVertex3f( 0.9,  0.9, -30.0);
-   glColor3f(0,.9,0); 
-   glVertex3f(-0.9,  0.0, -30.0);
+   glColor3f(1,1,1);
+   glVertex3f(-0.9,  0.0, -40.0);
    glEnd();
 
 #if 0
    glBegin(GL_TRIANGLES);
-   glColor3f(0,0,.7); 
+   glColor3f(0,0,.7);
    glVertex3f(-0.9, -0.9, -30.0);
-   glColor3f(.8,0,0); 
+   glColor3f(.8,0,0);
    glVertex3f(-0.9,  0.9, -30.0);
-   glColor3f(0,.9,0); 
+   glColor3f(0,.9,0);
    glVertex3f( 0.9,  0.0, -30.0);
    glEnd();
 #endif
@@ -138,7 +147,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 9e2c63a22af02e2fbe0f9cc7ebee45a984452818..2b1499903c1630fd87b4e43813012c59d5970a74 100644 (file)
@@ -155,7 +155,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index fcf57f5a85ff77e7c81d469de5e299e0bf6a27c2..b30f9b73e0f3e067fa8c66aa6cf73c63e3ea8abf 100644 (file)
@@ -153,7 +153,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 22f199c9828c537b0013b7f880db2d56ac46024b..91fac1a5981806ed300f7fd3f86ad5b35457c805 100644 (file)
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
diff --git a/progs/trivial/tri-logicop-none.c b/progs/trivial/tri-logicop-none.c
new file mode 100644 (file)
index 0000000..aba3614
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the name of
+ * Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
+ * ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <GL/glut.h>
+
+
+#define CI_OFFSET_1 16
+#define CI_OFFSET_2 32
+
+
+GLenum doubleBuffer = 1;
+int win;
+
+static void Init(void)
+{
+   fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
+   fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
+   fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+
+   glClearColor(0.3, 0.1, 0.3, 0.0);
+}
+
+static void Reshape(int width, int height)
+{
+
+   glViewport(0, 0, (GLint)width, (GLint)height);
+
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
+   glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+   switch (key) {
+      case 27:
+         exit(0);
+      default:
+         glutPostRedisplay();
+         return;
+   }
+}
+
+static void Draw(void)
+{
+   glClear(GL_COLOR_BUFFER_BIT); 
+
+   glBegin(GL_TRIANGLES);
+   glColor3f(.8,0,0); 
+   glVertex3f(-0.9, -0.9, -30.0);
+   glColor3f(0,.9,0); 
+   glVertex3f( 0.9, -0.9, -30.0);
+   glColor3f(0,0,.7); 
+   glVertex3f( 0.0,  0.9, -30.0);
+   glEnd();
+
+
+   glLineWidth(4.0);
+
+   glBegin(GL_LINES);
+   glColor3f(.1,.7,.1); 
+   glVertex3f( 0.5, -0.5, -30.0);
+   glVertex3f( 0.5,  0.5, -30.0);
+
+   glColor3f(.1,.1,.8); 
+   glVertex3f( 0.5,  0.5, -30.0);
+   glVertex3f(-0.5,  0.5, -30.0);
+
+   glColor3f(.5,.1,.1); 
+   glVertex3f(-0.5,  0.5, -30.0);
+   glVertex3f(-0.5, -0.5, -30.0);
+
+   glColor3f(.8,.8,.8);
+   glVertex3f(-0.5, -0.5, -30.0);
+   glVertex3f( 0.5, -0.5, -30.0);
+   glEnd();
+
+//   glLineWidth(12.0);
+
+   /* Redraw parts of the lines:
+    */
+   glBegin(GL_LINES);
+   glColor3f(.1,.7,.1); 
+   glVertex3f( 0.5, -0.2, -30.0);
+   glVertex3f( 0.5,  0.2, -30.0);
+
+   glColor3f(.1,.1,.8); 
+   glVertex3f( 0.2,  0.5, -30.0);
+   glVertex3f(-0.2,  0.5, -30.0);
+
+   glColor3f(.5,.1,.1); 
+   glVertex3f(-0.5,  0.2, -30.0);
+   glVertex3f(-0.5, -0.2, -30.0);
+
+   glColor3f(.8,.8,.8);
+   glVertex3f(-0.2, -0.5, -30.0);
+   glVertex3f( 0.2, -0.5, -30.0);
+   glEnd();
+
+
+   glFlush();
+
+   if (doubleBuffer) {
+      glutSwapBuffers();
+   }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+   GLint i;
+
+   for (i = 1; i < argc; i++) {
+      if (strcmp(argv[i], "-sb") == 0) {
+         doubleBuffer = GL_FALSE;
+      } else if (strcmp(argv[i], "-db") == 0) {
+         doubleBuffer = GL_TRUE;
+      } else {
+         fprintf(stderr, "%s (Bad option).\n", argv[i]);
+         return GL_FALSE;
+      }
+   }
+   return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+   GLenum type;
+
+   glutInit(&argc, argv);
+
+   if (Args(argc, argv) == GL_FALSE) {
+      exit(1);
+   }
+
+   glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+
+   type = GLUT_RGB | GLUT_ALPHA;
+   type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+   glutInitDisplayMode(type);
+
+   win = glutCreateWindow(*argv);
+   if (!win) {
+      exit(1);
+   }
+
+   Init();
+
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutDisplayFunc(Draw);
+   glutMainLoop();
+   return 0;
+}
diff --git a/progs/trivial/tri-logicop-xor.c b/progs/trivial/tri-logicop-xor.c
new file mode 100644 (file)
index 0000000..e2c94f9
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the name of
+ * Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
+ * ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <GL/glut.h>
+
+
+#define CI_OFFSET_1 16
+#define CI_OFFSET_2 32
+
+
+GLenum doubleBuffer = 1;
+int win;
+
+static void Init(void)
+{
+   fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
+   fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
+   fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+
+   glClearColor(0.3, 0.1, 0.3, 0.0);
+}
+
+static void Reshape(int width, int height)
+{
+
+   glViewport(0, 0, (GLint)width, (GLint)height);
+
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
+   glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+   switch (key) {
+      case 27:
+         exit(0);
+      default:
+         glutPostRedisplay();
+         return;
+   }
+}
+
+static void Draw(void)
+{
+   glClear(GL_COLOR_BUFFER_BIT); 
+
+   glBegin(GL_TRIANGLES);
+   glColor3f(.8,0,0); 
+   glVertex3f(-0.9, -0.9, -30.0);
+   glColor3f(0,.9,0); 
+   glVertex3f( 0.9, -0.9, -30.0);
+   glColor3f(0,0,.7); 
+   glVertex3f( 0.0,  0.9, -30.0);
+   glEnd();
+
+
+   glLineWidth(4.0);
+
+   glEnable(GL_BLEND);
+   glEnable(GL_COLOR_LOGIC_OP);
+   glLogicOp(GL_XOR);
+
+   glBegin(GL_LINES);
+   glColor3f(.1,.7,.1); 
+   glVertex3f( 0.5, -0.5, -30.0);
+   glVertex3f( 0.5,  0.5, -30.0);
+
+   glColor3f(.1,.1,.8); 
+   glVertex3f( 0.5,  0.5, -30.0);
+   glVertex3f(-0.5,  0.5, -30.0);
+
+   glColor3f(.5,.1,.1); 
+   glVertex3f(-0.5,  0.5, -30.0);
+   glVertex3f(-0.5, -0.5, -30.0);
+
+   glColor3f(.8,.8,.8);
+   glVertex3f(-0.5, -0.5, -30.0);
+   glVertex3f( 0.5, -0.5, -30.0);
+   glEnd();
+
+//   glLineWidth(12.0);
+
+   /* Redraw parts of the lines to remove them:
+    */
+   glBegin(GL_LINES);
+   glColor3f(.1,.7,.1); 
+   glVertex3f( 0.5, -0.2, -30.0);
+   glVertex3f( 0.5,  0.2, -30.0);
+
+   glColor3f(.1,.1,.8); 
+   glVertex3f( 0.2,  0.5, -30.0);
+   glVertex3f(-0.2,  0.5, -30.0);
+
+   glColor3f(.5,.1,.1); 
+   glVertex3f(-0.5,  0.2, -30.0);
+   glVertex3f(-0.5, -0.2, -30.0);
+
+   glColor3f(.8,.8,.8);
+   glVertex3f(-0.2, -0.5, -30.0);
+   glVertex3f( 0.2, -0.5, -30.0);
+   glEnd();
+
+
+
+   glDisable(GL_COLOR_LOGIC_OP);
+   glDisable(GL_BLEND);
+
+   glFlush();
+
+   if (doubleBuffer) {
+      glutSwapBuffers();
+   }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+   GLint i;
+
+   for (i = 1; i < argc; i++) {
+      if (strcmp(argv[i], "-sb") == 0) {
+         doubleBuffer = GL_FALSE;
+      } else if (strcmp(argv[i], "-db") == 0) {
+         doubleBuffer = GL_TRUE;
+      } else {
+         fprintf(stderr, "%s (Bad option).\n", argv[i]);
+         return GL_FALSE;
+      }
+   }
+   return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+   GLenum type;
+
+   glutInit(&argc, argv);
+
+   if (Args(argc, argv) == GL_FALSE) {
+      exit(1);
+   }
+
+   glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+
+   type = GLUT_RGB | GLUT_ALPHA;
+   type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+   glutInitDisplayMode(type);
+
+   win = glutCreateWindow(*argv);
+   if (!win) {
+      exit(1);
+   }
+
+   Init();
+
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutDisplayFunc(Draw);
+   glutMainLoop();
+   return 0;
+}
index 8333f7ed8ab8820835916ac27b04701caf1483b2..449125a4db75738f9d10c5ee0d69ff31027fd516 100644 (file)
@@ -143,7 +143,7 @@ int main(int argc, char **argv)
 
    glutInitWindowPosition(100, 0); glutInitWindowSize(Width, Height);
    glutInitDisplayMode(type);
-   Win = glutCreateWindow("First Tri");
+   Win = glutCreateWindow(*argv);
    Init();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
index d5e6742ce1aaa79fa5ded689284c28db592fa505..6861ff6e492c04a0c70dff7ceccd91f6913b4717 100644 (file)
@@ -122,7 +122,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 25cfcb8e148f5fbe74f14873c2ef47a2c6ccc2a2..9b319ba2a7d7ac651037664d08b600e148d6f91d 100644 (file)
@@ -144,7 +144,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index e894269e84b4b3a6ebf7e5d13daa66a87cf38f07..a271fab54cc46be4fe927675668f6fe99489a5e4 100644 (file)
@@ -104,7 +104,7 @@ int main(int argc, char **argv)
     type |= GLUT_DOUBLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index dcc6d282dc24a20d3da2d356ef94f446e392ea55..2b5536ecd6570e9cd330b682d8e936a7caad333d 100644 (file)
@@ -137,7 +137,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index ef9ea63048ff370dcba9216828581b7e1df6f858..9102888abd0a4da0bee618bce9a6d36f1a65a3d5 100644 (file)
@@ -122,7 +122,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 7686e16aef185f6a81803aebe39e56448bb66d3e..9f68bca9149f95339600eee36c4099c08e1a0377 100644 (file)
@@ -144,7 +144,7 @@ int main(int argc, char **argv)
     type = GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH | GLUT_STENCIL;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("Stencil Test") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 887de550e2c2b7d54e9de976602de825f0166e28..33e6dd16a7e41a2c15178929376f5df1c06d4d1a 100644 (file)
@@ -137,7 +137,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 50f6a754189843b1cf7709c72219cf2e1c8e6b4d..4f276af653f8bfda468c8de78cdb4a4138f610aa 100644 (file)
@@ -157,7 +157,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index a0d75b4a3318b300381a657ade97b8093d71eee6..1dbbe6aa5869bb191b972fa816f70131b1bebd60 100644 (file)
@@ -154,7 +154,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 06a0528eb87f66bd097fbae10b85c4c012606593..8b0c2dafefeaa174124f614b5521d89103699831 100644 (file)
@@ -131,7 +131,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index df161df3fb82928140a2be94690c7de5448c9d50..438899dc1a0e9d69e9ae5136eb75b3e4cd87fed3 100644 (file)
@@ -123,7 +123,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 31f41f6220bfe6594d5e1223aad08fe7044ac1e2..78c5ae8e9cd417aa0a1cc1fb75da20a094fc6584 100644 (file)
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
diff --git a/progs/trivial/tri-unfilled-fog.c b/progs/trivial/tri-unfilled-fog.c
new file mode 100644 (file)
index 0000000..113b8d0
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the name of
+ * Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
+ * ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <GL/glut.h>
+
+
+#define CI_OFFSET_1 16
+#define CI_OFFSET_2 32
+
+GLint Width = 250, Height = 250;
+
+GLenum doubleBuffer;
+
+static void Init(void)
+{
+   fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
+   fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
+   fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+
+   glClearColor(0.0, 0.0, 1.0, 0.0);
+}
+
+static void Reshape(int width, int height)
+{
+   glViewport(0, 0, (GLint)width, (GLint)height);
+
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
+   glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+   switch (key) {
+      case 27:
+         exit(1);
+   }
+
+   glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+   glClear(GL_COLOR_BUFFER_BIT); 
+
+   glEnable(GL_FOG);
+
+   glPolygonMode(GL_FRONT, GL_FILL);
+   glPolygonMode(GL_BACK, GL_FILL);
+
+   glBegin(GL_TRIANGLES);
+   glColor3f(0,0,.7); 
+   glVertex3f( 0.7, -0.7, -30.0);
+   glColor3f(.8,0,0); 
+   glVertex3f( 0.7,  0.7, -30.0);
+   glColor3f(0,.9,0); 
+   glVertex3f(-0.7,  0.0, -30.0);
+   glEnd();
+
+   glPolygonMode(GL_FRONT, GL_LINE);
+   glPolygonMode(GL_BACK, GL_LINE);
+
+   glBegin(GL_TRIANGLES);
+   glColor3f(0,0,.7); 
+   glVertex3f( 0.9, -0.9, -30.0);
+   glColor3f(.8,0,0); 
+   glVertex3f( 0.9,  0.9, -30.0);
+   glColor3f(0,.9,0); 
+   glVertex3f(-0.9,  0.0, -30.0);
+   glEnd();
+
+   glDisable(GL_FOG);
+
+   glFlush();
+
+   if (doubleBuffer) {
+      glutSwapBuffers();
+   }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+   GLint i;
+
+   doubleBuffer = GL_FALSE;
+
+   for (i = 1; i < argc; i++) {
+      if (strcmp(argv[i], "-sb") == 0) {
+         doubleBuffer = GL_FALSE;
+      } else if (strcmp(argv[i], "-db") == 0) {
+         doubleBuffer = GL_TRUE;
+      } else {
+         fprintf(stderr, "%s (Bad option).\n", argv[i]);
+         return GL_FALSE;
+      }
+   }
+   return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+   GLenum type;
+
+   glutInit(&argc, argv);
+
+   if (Args(argc, argv) == GL_FALSE) {
+      exit(1);
+   }
+
+   glutInitWindowPosition(100, 0); glutInitWindowSize(Width, Height);
+
+   type = GLUT_RGB;
+   type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+   glutInitDisplayMode(type);
+
+   if (glutCreateWindow(*argv) == GL_FALSE) {
+      exit(1);
+   }
+
+   Init();
+
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutDisplayFunc(Draw);
+   glutMainLoop();
+   return 0;
+}
index 71ac453d60348dc151e48368e9871c5ed1b5c49c..b0502801552ed4a37095e120a5fc3c21f60d7a8c 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index f70c1cd9d4dac0a89cd90300b061999b764811e9..9306af849a41f9dcebc20c8164db62f0a7277255 100644 (file)
@@ -136,7 +136,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index f9e1d0098841dd9fefa68c7f7614aacaa6c8cc2e..775c3530b7e02d54cc82c973a3368cefc84d3e2c 100644 (file)
@@ -164,7 +164,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index d9a9faeb9f5cd4ab16e299b41369e66b73760fe2..ce789255fd93cd768fff2a61e8fcb9ece76658b5 100644 (file)
@@ -161,7 +161,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 4aefa85032f824e38d879431229795cc38fb4a74..6835b53c0f506eba8ccf25e6a703caeb0ef4ea30 100644 (file)
@@ -133,7 +133,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 9201f9d433cefc5c69cac6bba1813450e3a0f833..aab5abc2303a8fb5fa98b92faf19aec4882eb4c8 100644 (file)
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 1e44823db5a7433a96a988f70e6f8550a24bb9b6..4f50d083c2d84d4469580f9b1602bdec4b6646a4 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index ccf631dff80c5f1a564f1f11a148043d93c7ef6e..43d19cebab576abb576e2c6e32fb2181115b4917 100644 (file)
@@ -126,7 +126,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
diff --git a/progs/trivial/tri-viewport.c b/progs/trivial/tri-viewport.c
new file mode 100644 (file)
index 0000000..3205b9e
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the name of
+ * Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
+ * ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <GL/glut.h>
+
+GLenum doubleBuffer = 1;
+int win;
+
+static void Init(void)
+{
+   fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
+   fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
+   fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+
+   glClearColor(0.3, 0.1, 0.3, 0.0);
+}
+
+static void Reshape(int width, int height)
+{
+   glViewport(width / -2.0, height / -2.0, width, height);
+
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+   switch (key) {
+      case 27:
+         exit(0);
+      default:
+         glutPostRedisplay();
+         return;
+   }
+}
+
+static void Draw(void)
+{
+   glClear(GL_COLOR_BUFFER_BIT); 
+
+   glBegin(GL_TRIANGLES);
+   glColor3f(.8,0,0); 
+   glVertex3f(-0.9,  0.9, -30.0);
+   glColor3f(0,.9,0); 
+   glVertex3f( 0.9,  0.9, -30.0);
+   glColor3f(0,0,.7); 
+   glVertex3f( 0.0, -0.9, -30.0);
+   glEnd();
+
+   glFlush();
+
+   if (doubleBuffer) {
+      glutSwapBuffers();
+   }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+   GLint i;
+
+   for (i = 1; i < argc; i++) {
+      if (strcmp(argv[i], "-sb") == 0) {
+         doubleBuffer = GL_FALSE;
+      } else if (strcmp(argv[i], "-db") == 0) {
+         doubleBuffer = GL_TRUE;
+      } else {
+         fprintf(stderr, "%s (Bad option).\n", argv[i]);
+         return GL_FALSE;
+      }
+   }
+   return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+   GLenum type;
+
+   glutInit(&argc, argv);
+
+   if (Args(argc, argv) == GL_FALSE) {
+      exit(1);
+   }
+
+   glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+
+   type = GLUT_RGB | GLUT_ALPHA;
+   type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+   glutInitDisplayMode(type);
+
+   win = glutCreateWindow(*argv);
+   if (!win) {
+      exit(1);
+   }
+
+   Init();
+
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutDisplayFunc(Draw);
+   glutMainLoop();
+   return 0;
+}
index 4bd998616603fd7cddf74e235a0ae71d16a22516..e7d4184bdb0513138d5e9277f8bda77d2870e74c 100644 (file)
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index ad5f31a5588057bcd089482163d551097333df0f..4ec55ac080a4f47bd1fd1197234939ac2125a623 100644 (file)
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index d3c6b59ea5d1924d565a1a440ccf03a566db4208..d99d5872a90ed4812a5cff859cd0e8f9e3d222ac 100644 (file)
@@ -41,28 +41,28 @@ static void Init(void)
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
 
-    glClearColor(0.3, 0.1, 0.3, 0.0);
+   glClearColor(0.3, 0.1, 0.3, 0.0);
 }
 
 static void Reshape(int width, int height)
 {
 
-    glViewport(0, 0, (GLint)width, (GLint)height);
+   glViewport(0, 0, (GLint)width, (GLint)height);
 
-    glMatrixMode(GL_PROJECTION);
-    glLoadIdentity();
-    glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
-    glMatrixMode(GL_MODELVIEW);
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
+   glMatrixMode(GL_MODELVIEW);
 }
 
 static void Key(unsigned char key, int x, int y)
 {
    switch (key) {
-   case 27:
-      exit(0);
-   default:
-      glutPostRedisplay();
-      return;
+      case 27:
+         exit(0);
+      default:
+         glutPostRedisplay();
+         return;
    }
 }
 
@@ -88,47 +88,47 @@ static void Draw(void)
 
 static GLenum Args(int argc, char **argv)
 {
-    GLint i;
-
-    for (i = 1; i < argc; i++) {
-        if (strcmp(argv[i], "-sb") == 0) {
-           doubleBuffer = GL_FALSE;
-       } else if (strcmp(argv[i], "-db") == 0) {
-           doubleBuffer = GL_TRUE;
-       } else {
-           fprintf(stderr, "%s (Bad option).\n", argv[i]);
-           return GL_FALSE;
-       }
-    }
-    return GL_TRUE;
+   GLint i;
+
+   for (i = 1; i < argc; i++) {
+      if (strcmp(argv[i], "-sb") == 0) {
+         doubleBuffer = GL_FALSE;
+      } else if (strcmp(argv[i], "-db") == 0) {
+         doubleBuffer = GL_TRUE;
+      } else {
+         fprintf(stderr, "%s (Bad option).\n", argv[i]);
+         return GL_FALSE;
+      }
+   }
+   return GL_TRUE;
 }
 
 int main(int argc, char **argv)
 {
-    GLenum type;
+   GLenum type;
 
-    glutInit(&argc, argv);
+   glutInit(&argc, argv);
 
-    if (Args(argc, argv) == GL_FALSE) {
-       exit(1);
-    }
+   if (Args(argc, argv) == GL_FALSE) {
+      exit(1);
+   }
 
-    glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+   glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
 
-    type = GLUT_RGB | GLUT_ALPHA;
-    type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
-    glutInitDisplayMode(type);
+   type = GLUT_RGB | GLUT_ALPHA;
+   type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+   glutInitDisplayMode(type);
 
-    win = glutCreateWindow("First Tri");
-    if (!win) {
-       exit(1);
-    }
+   win = glutCreateWindow(*argv);
+   if (!win) {
+      exit(1);
+   }
 
-    Init();
+   Init();
 
-    glutReshapeFunc(Reshape);
-    glutKeyboardFunc(Key);
-    glutDisplayFunc(Draw);
-    glutMainLoop();
-    return 0;
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutDisplayFunc(Draw);
+   glutMainLoop();
+   return 0;
 }
index 04042fac704e8e7753af94e5542f6c2cd849207a..ec7a50a75e0eed6e24bfe5aaa53176552ce24a2c 100644 (file)
@@ -126,7 +126,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 25224412cc9a2a963d4c9e3f5d36209763b0f2c4..4887b5a30c5d3e678de777be0238c2924ad3f63f 100644 (file)
@@ -130,7 +130,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 737eccdcae764c2c352fbf2dc4436a6d0bfa64cd..cf75d4cf08f233794d2c22224c2da14ace8915d8 100644 (file)
@@ -126,7 +126,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 8e7454108c0820d90b7bfd71ce56ab8b5866a6f5..491fe5b3df224f42d58630be76383acb40c26dc3 100644 (file)
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index ecb0424393e43e7a0f0b1b691cc610440c7c70d0..ee9854dc94a9fefabe44976e29d73b62a2b0f570 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index f95c66a62aae5fc8f97870fceefec817a9a08644..eeab676ea9077f63f272526202708ac0b3182bac 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index e048233e67c976af2e5485d0a1c045898a55fe09..49bb432b9df770ac9804bdb3a099c00f0e216501 100644 (file)
@@ -134,7 +134,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 51ea4f23251818eab61a1eef94e2cdd20c6b7e67..023e6475c0d06c0a5d8e863dd619c856e4d4d525 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 430a4d3964c11f0c942d7ff8aa2f82ee453dec0b..42bf9806b19ef7ecd93a75f6e3d9f3d03006cc2a 100644 (file)
@@ -142,7 +142,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 57fd2cdbbd1f7547770f987b4e412d5dd3673ca4..8290226675ecbd3894d0630028d5b09c7b36e89c 100644 (file)
@@ -175,7 +175,7 @@ int main(int argc, char **argv)
     type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
     glutInitDisplayMode(type);
 
-    if (glutCreateWindow("First Tri") == GL_FALSE) {
+    if (glutCreateWindow(*argv) == GL_FALSE) {
        exit(1);
     }
 
index 37d5fcd0d3a83f94a9be3f4eee6fdd250ab899cb..8e923b6eb47126952e9dd5cf2caa2b858bcc5d50 100644 (file)
@@ -102,9 +102,15 @@ static rawImageRec *RawImageOpen(const char *fileName)
       fprintf(stderr, "Out of memory!\n");
       return NULL;
    }
-   if ((raw->file = fopen(fileName, "rb")) == NULL) {
-      perror(fileName);
-      return NULL;
+   raw->file = fopen(fileName, "rb");
+   if (raw->file == NULL) {
+      const char *baseName = strrchr(fileName, '/');
+      if(baseName)
+         raw->file = fopen(baseName + 1, "rb");
+      if(raw->file == NULL) {
+         perror(fileName);
+         return NULL;
+      }
    }
 
    fread(raw, 1, 12, raw->file);
diff --git a/progs/vp/addimm.txt b/progs/vp/addimm.txt
new file mode 100644 (file)
index 0000000..f5796d7
--- /dev/null
@@ -0,0 +1,5 @@
+!!ARBvp1.0
+TEMP R0;
+ADD result.color, vertex.color, {.5}.x;
+MOV  result.position, vertex.position;
+END
diff --git a/progs/vp/arl-static.txt b/progs/vp/arl-static.txt
new file mode 100644 (file)
index 0000000..aea87b7
--- /dev/null
@@ -0,0 +1,7 @@
+!!ARBvp1.0
+PARAM arr[5]  = { {.0,.1,.2,.3}, {.4,.5,.6,.7}, {.8,.9,.10,.1}, {.12,.3,.4,.14}, {.5,.8,.1,.9},  {.2,0,.4,.1}, {.6,.1,.8,.9}};
+ADDRESS addr;
+ARL addr.x, {3}.x;
+MOV result.color, arr[addr.x];
+MOV result.position, vertex.position;
+END
diff --git a/progs/vp/arl-unused.txt b/progs/vp/arl-unused.txt
new file mode 100644 (file)
index 0000000..7bdbb8e
--- /dev/null
@@ -0,0 +1,7 @@
+!!ARBvp1.0
+PARAM arr[5]  = { {.0,.1,.2,.3}, {.4,.5,.6,.7}, {.8,.9,.10,.1}, {.12,.3,.4,.14}, {.5,.8,.1,.9},  {.2,0,.4,.1}, {.6,.1,.8,.9}};
+ADDRESS addr;
+ARL addr.x, {3}.x;  # not actually used
+MOV result.color, arr[3];
+MOV result.position, vertex.position;
+END
diff --git a/progs/vp/exp-no-w.txt b/progs/vp/exp-no-w.txt
new file mode 100644 (file)
index 0000000..98ed4b7
--- /dev/null
@@ -0,0 +1,6 @@
+!!ARBvp1.0
+TEMP R0;
+EXP R0, vertex.color.x;
+SUB result.color, R0.z, {1.0}.x;
+MOV result.position, vertex.position;
+END
diff --git a/progs/vp/msk.txt b/progs/vp/msk.txt
new file mode 100644 (file)
index 0000000..9e925ac
--- /dev/null
@@ -0,0 +1,7 @@
+!!ARBvp1.0
+TEMP R0;
+MOV R0.xz, vertex.color; 
+MOV R0.yw, {0.5}.x;
+MOV result.color, R0;
+MOV  result.position, vertex.position;
+END
diff --git a/progs/vp/psiz-mul.txt b/progs/vp/psiz-mul.txt
new file mode 100644 (file)
index 0000000..a74df66
--- /dev/null
@@ -0,0 +1,6 @@
+!!ARBvp1.0
+MOV result.color, vertex.color; 
+MUL result.pointsize, vertex.color.x, {10.0}.x; 
+MOV  result.position, vertex.position;
+END
+
index 87cb12b98466f3d93d79d8054e084fde8113b3fd..97995accdd180012563df4919c34e9361c38d16a 100644 (file)
 
 static const char *filename = NULL;
 static GLuint nr_steps = 4;
+static GLuint prim = GL_TRIANGLES;
+static GLfloat psz = 1.0;
+static GLboolean pointsmooth = 0;
+static GLboolean program_point_size = 0;
 
 static void usage( char *name )
 {
@@ -186,6 +190,14 @@ static void subdiv( union vert *v0,
    }
 }
 
+static void enable( GLenum value, GLboolean flag )
+{
+   if (flag)
+      glEnable(value);
+   else
+      glDisable(value);
+}
+
 /** Assignment */
 #define ASSIGN_3V( V, V0, V1, V2 )  \
 do {                                \
@@ -198,8 +210,12 @@ static void Display( void )
 {
    glClearColor(0.3, 0.3, 0.3, 1);
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+   glPointSize(psz);
+
+   enable( GL_POINT_SMOOTH, pointsmooth );
+   enable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB, program_point_size );
 
-   glBegin(GL_TRIANGLES);
+   glBegin(prim);
 
 
    {
@@ -243,9 +259,40 @@ static void Key( unsigned char key, int x, int y )
    (void) x;
    (void) y;
    switch (key) {
-      case 27:
-         exit(0);
-         break;
+   case 'p':
+      prim = GL_POINTS;
+      break;
+   case 't':
+      prim = GL_TRIANGLES;
+      break;
+   case 's':
+      psz += .5;
+      break;
+   case 'S':
+      if (psz > .5)
+         psz -= .5;
+      break;
+   case 'm':
+      pointsmooth = !pointsmooth;
+      break;
+   case 'z':
+      program_point_size = !program_point_size;
+      break;
+   case '+':
+      nr_steps++;
+      break; 
+   case '-':
+      if (nr_steps) 
+         nr_steps--;
+      break;
+   case ' ':
+      psz = 1.0;
+      prim = GL_TRIANGLES;
+      nr_steps = 4;
+      break;
+   case 27:
+      exit(0);
+      break;
    }
    glutPostRedisplay();
 }
index 313b4dfa2279b66a83bbae54666ed88154c97e1c..3982aca5650574fd5a948cba9fd147f13f1b3406 100644 (file)
@@ -7,7 +7,7 @@
 TOP = ../..
 include $(TOP)/configs/current
 
-LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB)  -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
 
 SOURCES = \
        vp-tris.c
diff --git a/progs/vpglsl/mov.glsl b/progs/vpglsl/mov.glsl
new file mode 100644 (file)
index 0000000..63b16f4
--- /dev/null
@@ -0,0 +1,5 @@
+
+void main() {
+    gl_FrontColor = gl_Color;
+    gl_Position = gl_Vertex;
+}
index 9108d3f1978f5f9dbe2fd8e5b9b972d43ab180c0..9ae410bf98436b84e61bada10fe2b49ff91ec977 100644 (file)
@@ -4,7 +4,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#define GL_GLEXT_PROTOTYPES
+
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static const char *filename = NULL;
@@ -99,27 +100,29 @@ static void setup_uniforms()
 
    }
 
-   GLuint loc1f = glGetUniformLocationARB(program, "KernelValue1f");
-   GLuint loc2f = glGetUniformLocationARB(program, "KernelValue2f");
-   GLuint loc4f = glGetUniformLocationARB(program, "KernelValue4f");
-   GLfloat vecKer[] =
-      { 1.0, 0.0, 0.0,  0.25,
-        0.0, 1.0, 0.0,  0.25,
-        0.0, 0.0, 1.0,  0.25,
-        0.0, 0.0, 0.0,  0.25,
-        0.5, 0.0, 0.0,  0.35,
-        0.0, 0.5, 0.0,  0.35,
-        0.0, 0.0, 0.5,  0.35,
-        0.0, 0.0, 0.0,  0.35
-      };
-   if (loc1f >= 0)
-      glUniform1fv(loc1f, 16, vecKer);
-
-   if (loc2f >= 0)
-      glUniform2fv(loc2f, 8, vecKer);
-
-   if (loc4f >= 0)
-      glUniform4fv(loc4f, 4, vecKer);
+   {
+      GLuint loc1f = glGetUniformLocationARB(program, "KernelValue1f");
+      GLuint loc2f = glGetUniformLocationARB(program, "KernelValue2f");
+      GLuint loc4f = glGetUniformLocationARB(program, "KernelValue4f");
+      GLfloat vecKer[] =
+         { 1.0, 0.0, 0.0,  0.25,
+           0.0, 1.0, 0.0,  0.25,
+           0.0, 0.0, 1.0,  0.25,
+           0.0, 0.0, 0.0,  0.25,
+           0.5, 0.0, 0.0,  0.35,
+           0.0, 0.5, 0.0,  0.35,
+           0.0, 0.0, 0.5,  0.35,
+           0.0, 0.0, 0.0,  0.35
+         };
+      if (loc1f >= 0)
+         glUniform1fv(loc1f, 16, vecKer);
+
+      if (loc2f >= 0)
+         glUniform2fv(loc2f, 8, vecKer);
+
+      if (loc4f >= 0)
+         glUniform4fv(loc4f, 4, vecKer);
+   }
 }
 
 static void prepare_shaders()
@@ -303,6 +306,7 @@ int main( int argc, char *argv[] )
    glutInitWindowSize( 250, 250 );
    glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
diff --git a/progs/wgl/SConscript b/progs/wgl/SConscript
new file mode 100644 (file)
index 0000000..b7cf35b
--- /dev/null
@@ -0,0 +1,23 @@
+Import('*')
+
+if env['platform'] != 'windows':
+    Return()
+
+env = env.Clone()
+
+env.Append(LIBS = [
+    'kernel32',
+    'user32',
+    'gdi32',
+])
+
+progs = [
+    'sharedtex_mt',
+    'wglthreads',
+]
+
+for prog in progs:
+    env.Program(
+        target = prog,
+        source = prog + '/' + prog + '.c',
+    )
diff --git a/progs/wgl/sharedtex_mt/sharedtex_mt.c b/progs/wgl/sharedtex_mt/sharedtex_mt.c
new file mode 100644 (file)
index 0000000..137c9c1
--- /dev/null
@@ -0,0 +1,540 @@
+/*
+ * Test sharing of display lists and texture objects between GLX contests.
+ * Brian Paul
+ * Summer 2000
+ *
+ *
+ * Copyright (C) 2000  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Modified 2009 for multithreading by Thomas Hellstrom.
+ *
+ * Port to windows by Michal Krol.
+ */
+
+
+#include <windows.h>
+#include <GL/gl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#pragma comment(lib, "opengl32.lib")
+
+struct thread_init_arg {
+   int id;
+};
+
+struct window {
+   CRITICAL_SECTION drawMutex;
+   HDC hDC;
+   HWND Win;
+   HGLRC Context;
+   float Angle;
+   int Id;
+};
+
+
+#define MAX_WINDOWS 20
+static struct window Windows[MAX_WINDOWS];
+static int NumWindows = 0;
+static HANDLE terminate = NULL;
+static HGLRC gCtx = NULL;
+static HDC gHDC = NULL;
+static GLuint Textures[3];
+
+
+
+static void
+Error(const char *msg)
+{
+   fprintf(stderr, "Error - %s\n", msg);
+   exit(1);
+}
+
+static void
+Resize(struct window *h, unsigned int width, unsigned int height);
+
+static LRESULT CALLBACK
+WndProc(HWND hWnd,
+        UINT uMsg,
+        WPARAM wParam,
+        LPARAM lParam )
+{
+   switch (uMsg) {
+   case WM_KEYDOWN:
+      SetEvent(terminate);
+      break;
+   case WM_SIZE:
+      {
+         LONG index = GetWindowLong(hWnd, GWL_USERDATA);
+
+         if (index >= 0 && index < MAX_WINDOWS) {
+            RECT r;
+
+            GetClientRect(hWnd, &r);
+            Resize(&Windows[index], r.right, r.bottom);
+         }
+      }
+      break;
+   case WM_CREATE:
+      {
+         CREATESTRUCT *pcs = (CREATESTRUCT *) lParam;
+
+         SetWindowLong(hWnd, GWL_USERDATA, (LONG) pcs->lpCreateParams);
+      }
+      break;
+   case WM_DESTROY:
+      PostQuitMessage(0);
+      break;
+   default:
+      return DefWindowProc(hWnd, uMsg, wParam, lParam);
+   }
+
+   return 0;
+}
+
+static int
+initMainthread(void)
+{
+   WNDCLASS wc = {0};
+   HWND win;
+   PIXELFORMATDESCRIPTOR pfd = {0};
+   int visinfo;
+
+   wc.lpfnWndProc = WndProc;
+   wc.lpszClassName = "sharedtex_mt.hidden";
+   wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
+   RegisterClass(&wc);
+
+   win = CreateWindowEx(0,
+                        wc.lpszClassName,
+                        "sharedtex_mt.hidden",
+                        WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+                        CW_USEDEFAULT,
+                        CW_USEDEFAULT,
+                        CW_USEDEFAULT,
+                        CW_USEDEFAULT,
+                        NULL,
+                        NULL,
+                        wc.hInstance,
+                        (LPVOID) -1);
+   if (!win) {
+      Error("Couldn't create window");
+   }
+
+   gHDC = GetDC(win);
+   if (!gHDC) {
+      Error("Couldn't obtain HDC");
+   }
+
+   pfd.cColorBits = 24;
+   pfd.cDepthBits = 24;
+   pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
+   pfd.iLayerType = PFD_MAIN_PLANE;
+   pfd.iPixelType = PFD_TYPE_RGBA;
+   pfd.nSize = sizeof(pfd);
+   pfd.nVersion = 1;
+
+   visinfo = ChoosePixelFormat(gHDC, &pfd);
+   if (!visinfo) {
+      Error("Unable to find RGB, Z, double-buffered visual");
+   }
+
+   SetPixelFormat(gHDC, visinfo, &pfd);
+   gCtx = wglCreateContext(gHDC);
+   if (!gCtx) {
+      Error("Couldn't create WGL context");
+   }
+
+   return 0;
+}
+
+static struct window *
+AddWindow(int xpos, int ypos, HGLRC sCtx)
+{
+   struct window *win = &Windows[NumWindows];
+   WNDCLASS wc = {0};
+   PIXELFORMATDESCRIPTOR pfd = {0};
+   int visinfo;
+   int width = 300, height = 300;
+
+   if (NumWindows >= MAX_WINDOWS)
+      return NULL;
+
+   memset(win, 0, sizeof(*win));
+   InitializeCriticalSection(&win->drawMutex);
+   win->Angle = 0.0;
+   win->Id = NumWindows++;
+
+   wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
+   wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+   wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+   wc.lpfnWndProc = WndProc;
+   wc.lpszClassName = "sharedtex_mt";
+   wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
+   RegisterClass(&wc);
+
+   win->Win = CreateWindowEx(0,
+                             wc.lpszClassName,
+                             "sharedtex_mt",
+                             WS_SIZEBOX | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+                             xpos,
+                             ypos,
+                             width,
+                             height,
+                             NULL,
+                             NULL,
+                             wc.hInstance,
+                             (LPVOID) win->Id);
+   if (!win->Win) {
+      Error("Couldn't create window");
+   }
+
+   win->hDC = GetDC(win->Win);
+   if (!win->hDC) {
+      Error("Couldn't obtain HDC");
+   }
+
+   pfd.cColorBits = 24;
+   pfd.cDepthBits = 24;
+   pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
+   pfd.iLayerType = PFD_MAIN_PLANE;
+   pfd.iPixelType = PFD_TYPE_RGBA;
+   pfd.nSize = sizeof(pfd);
+   pfd.nVersion = 1;
+
+   visinfo = ChoosePixelFormat(win->hDC, &pfd);
+   if (!visinfo) {
+      Error("Unable to find RGB, Z, double-buffered visual");
+   }
+
+   SetPixelFormat(win->hDC, visinfo, &pfd);
+   win->Context = wglCreateContext(win->hDC);
+   if (!win->Context) {
+      Error("Couldn't create WGL context");
+   }
+
+   if (sCtx) {
+      wglShareLists(sCtx, win->Context);
+   }
+
+   ShowWindow(win->Win, SW_SHOW);
+
+   return win;
+}
+
+
+static void
+InitGLstuff(void)
+
+{
+   glGenTextures(3, Textures);
+
+   /* setup first texture object */
+   {
+      GLubyte image[16][16][4];
+      GLint i, j;
+      glBindTexture(GL_TEXTURE_2D, Textures[0]);
+
+      /* red/white checkerboard */
+      for (i = 0; i < 16; i++) {
+         for (j = 0; j < 16; j++) {
+            if ((i ^ j) & 1) {
+               image[i][j][0] = 255;
+               image[i][j][1] = 255;
+               image[i][j][2] = 255;
+               image[i][j][3] = 255;
+            }
+            else {
+               image[i][j][0] = 255;
+               image[i][j][1] = 0;
+               image[i][j][2] = 0;
+               image[i][j][3] = 255;
+            }
+         }
+      }
+
+      glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA,
+                   GL_UNSIGNED_BYTE, image);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+   }
+
+   /* setup second texture object */
+   {
+      GLubyte image[8][8][3];
+      GLint i, j;
+      glBindTexture(GL_TEXTURE_2D, Textures[1]);
+
+      /* green/yellow checkerboard */
+      for (i = 0; i < 8; i++) {
+         for (j = 0; j < 8; j++) {
+            if ((i ^ j) & 1) {
+               image[i][j][0] = 0;
+               image[i][j][1] = 255;
+               image[i][j][2] = 0;
+            }
+            else {
+               image[i][j][0] = 255;
+               image[i][j][1] = 255;
+               image[i][j][2] = 0;
+            }
+         }
+      }
+
+      glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
+      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB,
+                   GL_UNSIGNED_BYTE, image);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+   }
+
+   /* setup second texture object */
+   {
+      GLubyte image[4][4][3];
+      GLint i, j;
+      glBindTexture(GL_TEXTURE_2D, Textures[2]);
+
+      /* blue/gray checkerboard */
+      for (i = 0; i < 4; i++) {
+         for (j = 0; j < 4; j++) {
+            if ((i ^ j) & 1) {
+               image[i][j][0] = 0;
+               image[i][j][1] = 0;
+               image[i][j][2] = 255;
+            }
+            else {
+               image[i][j][0] = 200;
+               image[i][j][1] = 200;
+               image[i][j][2] = 200;
+            }
+         }
+      }
+
+      glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
+      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0, GL_RGB,
+                   GL_UNSIGNED_BYTE, image);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+   }
+
+   /* Now make the cube object display list */
+
+   printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
+   printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION));
+   printf("GL_VENDOR: %s\n", (char *) glGetString(GL_VENDOR));
+}
+
+static void
+Redraw(struct window *h)
+{
+   EnterCriticalSection(&h->drawMutex);
+   if (!wglMakeCurrent(h->hDC, h->Context)) {
+      LeaveCriticalSection(&h->drawMutex);
+      Error("wglMakeCurrent failed in Redraw");
+      return;
+   }
+
+   h->Angle += 1.0;
+
+   glShadeModel(GL_FLAT);
+   glClearColor(0.25, 0.25, 0.25, 1.0);
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glEnable(GL_TEXTURE_2D);
+   glEnable(GL_DEPTH_TEST);
+   glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+
+   glColor3f(1, 1, 1);
+
+   glPushMatrix();
+   if (h->Id == 0)
+      glRotatef(h->Angle, 0, 1, -1);
+   else if (h->Id == 1)
+      glRotatef(-(h->Angle), 0, 1, -1);
+   else if (h->Id == 2)
+      glRotatef(h->Angle, 0, 1, 1);
+   else if (h->Id == 3)
+      glRotatef(-(h->Angle), 0, 1, 1);
+   glBindTexture(GL_TEXTURE_2D, Textures[0]);
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f(-1,  1, -1);
+   glTexCoord2f(1, 1);  glVertex3f(-1,  1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(-1, -1,  1);
+   glEnd();
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f(1,  1, -1);
+   glTexCoord2f(1, 1);  glVertex3f(1,  1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(1, -1,  1);
+   glEnd();
+
+   glBindTexture(GL_TEXTURE_2D, Textures[1]);
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, -1, -1);
+   glTexCoord2f(1, 1);  glVertex3f( 1, -1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(-1, -1,  1);
+   glEnd();
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(-1, 1, -1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, 1, -1);
+   glTexCoord2f(1, 1);  glVertex3f( 1, 1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(-1, 1,  1);
+   glEnd();
+
+   glBindTexture(GL_TEXTURE_2D, Textures[2]);
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, -1, -1);
+   glTexCoord2f(1, 1);  glVertex3f( 1,  1, -1);
+   glTexCoord2f(0, 1);  glVertex3f(-1,  1, -1);
+   glEnd();
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, 1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, -1, 1);
+   glTexCoord2f(1, 1);  glVertex3f( 1,  1, 1);
+   glTexCoord2f(0, 1);  glVertex3f(-1,  1, 1);
+   glEnd();
+
+   glPopMatrix();
+
+   SwapBuffers(h->hDC);
+
+   if (!wglMakeCurrent(NULL, NULL)) {
+      Error("wglMakeCurrent failed in Redraw");
+   }
+   LeaveCriticalSection(&h->drawMutex);
+}
+
+static DWORD WINAPI
+threadRunner (void *arg)
+{
+   struct thread_init_arg *tia = (struct thread_init_arg *) arg;
+   struct window *win;
+
+   win = &Windows[tia->id];
+
+   while (1) {
+      MSG msg;
+
+      /* wait 1 ms for signal either to exit or process messages */
+      switch (MsgWaitForMultipleObjects(1, &terminate, FALSE, 1, QS_ALLINPUT)) {
+      case WAIT_OBJECT_0:
+         SendMessage(win->Win, WM_CLOSE, 0, 0);
+         break;
+      case WAIT_OBJECT_0 + 1:
+         break;
+      }
+
+      while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+         if (msg.message == WM_QUIT) {
+            return 0;
+         }
+         TranslateMessage(&msg);
+         DispatchMessage(&msg);
+      }
+
+      Redraw(win);
+   }
+
+   return 0;
+}
+
+static void
+Resize(struct window *h, unsigned int width, unsigned int height)
+{
+   EnterCriticalSection(&h->drawMutex);
+
+   if (!wglMakeCurrent(h->hDC, h->Context)) {
+      LeaveCriticalSection(&h->drawMutex);
+      Error("wglMakeCurrent failed in Resize()");
+      return;
+   }
+
+   glViewport(0, 0, width, height);
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glFrustum(-1, 1, -1, 1, 2, 10);
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
+   glTranslatef(0, 0, -4.5);
+   if (!wglMakeCurrent(NULL, NULL)) {
+      Error("wglMakeCurrent failed in Resize()");
+   }
+   LeaveCriticalSection(&h->drawMutex);
+}
+
+int
+main(int argc, char *argv[])
+{
+   struct thread_init_arg tia[MAX_WINDOWS];
+   struct window *h[MAX_WINDOWS];
+   HANDLE threads[MAX_WINDOWS];
+   int i;
+
+   terminate = CreateEvent(NULL, TRUE, FALSE, NULL);
+
+   if (initMainthread())
+      return -1;
+
+   /* four windows and contexts sharing display lists and texture objects */
+   h[0] = AddWindow( 10,  10, gCtx);
+   h[1] = AddWindow(330,  10, gCtx);
+   h[2] = AddWindow( 10, 350, gCtx);
+   h[3] = AddWindow(330, 350, gCtx);
+
+   if (!wglMakeCurrent(gHDC, gCtx)) {
+      Error("wglMakeCurrent failed for init thread.");
+      return -1;
+   }
+
+   InitGLstuff();
+
+   for (i = 0; i < NumWindows; i++) {
+      DWORD id;
+
+      tia[i].id = i;
+      threads[i] = CreateThread(NULL, 0, threadRunner, &tia[i], 0, &id);
+   }
+
+   while (1) {
+      MSG msg;
+
+      /* wait 1 ms for signal either to exit or process messages */
+      switch (MsgWaitForMultipleObjects(NumWindows, threads, TRUE, 1, QS_ALLINPUT)) {
+      case WAIT_OBJECT_0:
+         return 0;
+      }
+
+      while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+         if (msg.message == WM_QUIT) {
+            return 0;
+         }
+         TranslateMessage(&msg);
+         DispatchMessage(&msg);
+      }
+   }
+
+   return 0;
+}
diff --git a/progs/wgl/wglthreads/wglthreads.c b/progs/wgl/wglthreads/wglthreads.c
new file mode 100644 (file)
index 0000000..32f3e45
--- /dev/null
@@ -0,0 +1,614 @@
+/*
+ * Copyright (C) 2000  Brian Paul   All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Port to windows done by Michal Krol.
+ */
+
+
+/*
+ * This program tests WGL thread safety.
+ * Command line options:
+ *  -h                       Print usage
+ *  -l                       Enable application-side locking
+ *  -n <num threads>         Number of threads to create (default is 2)
+ *  -t                       Use texture mapping
+ *  -s                       Force single-threaded.
+ *
+ * Brian Paul  20 July 2000
+ */
+
+
+/*
+ * Notes:
+ * - Each thread gets its own WGL context.
+ *
+ * - The WGL contexts share texture objects.
+ *
+ * - When 't' is pressed to update the texture image, the window/thread which
+ *   has input focus is signalled to change the texture.  The other threads
+ *   should see the updated texture the next time they call glBindTexture.
+ */
+
+
+#include <assert.h>
+#include <windows.h>
+#include <GL/gl.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#pragma comment(lib, "opengl32.lib")
+
+
+/*
+ * Each window/thread/context:
+ */
+struct winthread {
+   int Index;
+   HANDLE Thread;
+   HWND Win;
+   HDC hDC;
+   HGLRC Context;
+   float Angle;
+   int WinWidth, WinHeight;
+   GLboolean NewSize;
+   HANDLE hEventInitialised;
+   GLboolean MakeNewTexture;
+   HANDLE hEventRedraw;
+};
+
+
+#define MAX_WINTHREADS 100
+static struct winthread WinThreads[MAX_WINTHREADS];
+static int NumWinThreads = 2;
+static HANDLE ExitEvent = NULL;
+
+static GLboolean Locking = 0;
+static GLboolean Texture = GL_FALSE;
+static GLboolean SingleThreaded = GL_FALSE;
+static GLuint TexObj = 12;
+static GLboolean Animate = GL_TRUE;
+
+static CRITICAL_SECTION Mutex;
+
+
+static void
+Error(const char *msg)
+{
+   fprintf(stderr, "Error: %s\n", msg);
+   exit(1);
+}
+
+
+static void
+signal_redraw(void)
+{
+   int i;
+
+   for (i = 0; i < NumWinThreads; i++) {
+      SetEvent(WinThreads[i].hEventRedraw);
+   }
+}
+
+
+static void
+MakeNewTexture(struct winthread *wt)
+{
+#define TEX_SIZE 128
+   static float step = 0.0;
+   GLfloat image[TEX_SIZE][TEX_SIZE][4];
+   GLint width;
+   int i, j;
+
+   for (j = 0; j < TEX_SIZE; j++) {
+      for (i = 0; i < TEX_SIZE; i++) {
+         float dt = 5.0 * (j - 0.5 * TEX_SIZE) / TEX_SIZE;
+         float ds = 5.0 * (i - 0.5 * TEX_SIZE) / TEX_SIZE;
+         float r = dt * dt + ds * ds + step;
+         image[j][i][0] = 
+         image[j][i][1] = 
+         image[j][i][2] = 0.75 + 0.25 * cos(r);
+         image[j][i][3] = 1.0;
+      }
+   }
+
+   step += 0.5;
+
+   glBindTexture(GL_TEXTURE_2D, TexObj);
+
+   glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
+   if (width) {
+      assert(width == TEX_SIZE);
+      /* sub-tex replace */
+      glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TEX_SIZE, TEX_SIZE,
+                   GL_RGBA, GL_FLOAT, image);
+   }
+   else {
+      /* create new */
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TEX_SIZE, TEX_SIZE, 0, 
+                   GL_RGBA, GL_FLOAT, image);
+   }
+}
+
+
+
+/* draw a colored cube */
+static void
+draw_object(void)
+{
+   glPushMatrix();
+   glScalef(0.75, 0.75, 0.75);
+
+   glColor3f(1, 0, 0);
+
+   if (Texture) {
+      glBindTexture(GL_TEXTURE_2D, TexObj);
+      glEnable(GL_TEXTURE_2D);
+   }
+   else {
+      glDisable(GL_TEXTURE_2D);
+   }
+
+   glBegin(GL_QUADS);
+
+   /* -X */
+   glColor3f(0, 1, 1);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f(-1,  1, -1);
+   glTexCoord2f(1, 1);  glVertex3f(-1,  1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(-1, -1,  1);
+
+   /* +X */
+   glColor3f(1, 0, 0);
+   glTexCoord2f(0, 0);  glVertex3f(1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f(1,  1, -1);
+   glTexCoord2f(1, 1);  glVertex3f(1,  1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(1, -1,  1);
+
+   /* -Y */
+   glColor3f(1, 0, 1);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, -1, -1);
+   glTexCoord2f(1, 1);  glVertex3f( 1, -1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(-1, -1,  1);
+
+   /* +Y */
+   glColor3f(0, 1, 0);
+   glTexCoord2f(0, 0);  glVertex3f(-1, 1, -1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, 1, -1);
+   glTexCoord2f(1, 1);  glVertex3f( 1, 1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(-1, 1,  1);
+
+   /* -Z */
+   glColor3f(1, 1, 0);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, -1, -1);
+   glTexCoord2f(1, 1);  glVertex3f( 1,  1, -1);
+   glTexCoord2f(0, 1);  glVertex3f(-1,  1, -1);
+
+   /* +Y */
+   glColor3f(0, 0, 1);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, 1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, -1, 1);
+   glTexCoord2f(1, 1);  glVertex3f( 1,  1, 1);
+   glTexCoord2f(0, 1);  glVertex3f(-1,  1, 1);
+
+   glEnd();
+
+   glPopMatrix();
+}
+
+
+/* signal resize of given window */
+static void
+resize(struct winthread *wt, int w, int h)
+{
+   wt->NewSize = GL_TRUE;
+   wt->WinWidth = w;
+   wt->WinHeight = h;
+   if (!Animate)
+      SetEvent(wt->hEventRedraw);
+}
+
+
+/*
+ * We have an instance of this for each thread.
+ */
+static void
+draw_loop(struct winthread *wt)
+{
+   while (1) {
+      GLboolean draw = Animate;
+      MSG msg;
+
+      if (Animate) {
+         /* wait 5 ms for signal either to exit or process messages */
+         switch (MsgWaitForMultipleObjects(1, &ExitEvent, FALSE, 5, QS_ALLINPUT)) {
+         case WAIT_OBJECT_0:
+            SendMessage(wt->Win, WM_CLOSE, 0, 0);
+            break;
+         case WAIT_OBJECT_0 + 1:
+            break;
+         }
+      }
+      else {
+         HANDLE events[2];
+
+         events[0] = wt->hEventRedraw;
+         events[1] = ExitEvent;
+
+         /* wait for signal either to draw, exit or process messages */
+         switch (MsgWaitForMultipleObjects(2, events, FALSE, INFINITE, QS_ALLINPUT)) {
+         case WAIT_OBJECT_0:
+            draw = GL_TRUE;
+            break;
+         case WAIT_OBJECT_0 + 1:
+            SendMessage(wt->Win, WM_CLOSE, 0, 0);
+            break;
+         case WAIT_OBJECT_0 + 2:
+            break;
+         }
+      }
+
+      while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+         if (msg.message == WM_QUIT) {
+            return;
+         }
+         TranslateMessage(&msg);
+         DispatchMessage(&msg);
+      }
+
+      if (!draw)
+         continue;
+
+      if (Locking)
+         EnterCriticalSection(&Mutex);
+
+      wglMakeCurrent(wt->hDC, wt->Context);
+
+      if (Locking)
+         LeaveCriticalSection(&Mutex);
+
+      glEnable(GL_DEPTH_TEST);
+
+      if (wt->NewSize) {
+         GLfloat w = (float) wt->WinWidth / (float) wt->WinHeight;
+         glViewport(0, 0, wt->WinWidth, wt->WinHeight);
+         glMatrixMode(GL_PROJECTION);
+         glLoadIdentity();
+         glFrustum(-w, w, -1.0, 1.0, 1.5, 10);
+         glMatrixMode(GL_MODELVIEW);
+         glLoadIdentity();
+         glTranslatef(0, 0, -2.5);
+         wt->NewSize = GL_FALSE;
+      }
+
+      if (wt->MakeNewTexture) {
+         MakeNewTexture(wt);
+         wt->MakeNewTexture = GL_FALSE;
+      }
+
+      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+      glPushMatrix();
+         glRotatef(wt->Angle, 0, 1, 0);
+         glRotatef(wt->Angle, 1, 0, 0);
+         glScalef(0.7, 0.7, 0.7);
+         draw_object();
+      glPopMatrix();
+
+      if (Locking)
+         EnterCriticalSection(&Mutex);
+      SwapBuffers(wt->hDC);
+      if (Locking)
+         LeaveCriticalSection(&Mutex);
+
+      wt->Angle += 1.0;
+   }
+}
+
+
+static void
+keypress(WPARAM keySym, struct winthread *wt)
+{
+   switch (keySym) {
+   case VK_ESCAPE:
+      /* tell all threads to exit */
+      SetEvent(ExitEvent);
+      /*printf("exit draw_loop %d\n", wt->Index);*/
+      return;
+   case 't':
+   case 'T':
+      if (Texture) {
+         wt->MakeNewTexture = GL_TRUE;
+         if (!Animate)
+            signal_redraw();
+      }
+      break;
+   case 'a':
+   case 'A':
+      Animate = !Animate;
+      if (Animate)
+         signal_redraw();
+      break;
+   case 's':
+   case 'S':
+      if (!Animate)
+         signal_redraw();
+      break;
+   default:
+      ; /* nop */
+   }
+}
+
+
+static LRESULT CALLBACK
+WndProc(HWND hWnd,
+        UINT uMsg,
+        WPARAM wParam,
+        LPARAM lParam )
+{
+   int i;
+
+   switch (uMsg) {
+   case WM_KEYDOWN:
+      for (i = 0; i < NumWinThreads; i++) {
+         struct winthread *wt = &WinThreads[i];
+
+         if (hWnd == wt->Win) {
+            keypress(wParam, wt);
+            break;
+         }
+      }
+      break;
+   case WM_SIZE:
+      for (i = 0; i < NumWinThreads; i++) {
+         struct winthread *wt = &WinThreads[i];
+
+         if (hWnd == wt->Win) {
+            RECT r;
+
+            GetClientRect(hWnd, &r);
+            resize(wt, r.right, r.bottom);
+            break;
+         }
+      }
+      break;
+   case WM_DESTROY:
+      PostQuitMessage(0);
+      break;
+   default:
+      return DefWindowProc(hWnd, uMsg, wParam, lParam);
+   }
+
+   return 0;
+}
+
+/*
+ * we'll call this once for each thread, before the threads are created.
+ */
+static void
+create_window(struct winthread *wt, HGLRC shareCtx)
+{
+   WNDCLASS wc = {0};
+   int width = 160, height = 160;
+   int xpos = (wt->Index % 8) * (width + 10);
+   int ypos = (wt->Index / 8) * (width + 20);
+   HWND win;
+   HDC hdc;
+   PIXELFORMATDESCRIPTOR pfd = {0};
+   int visinfo;
+   HGLRC ctx;
+
+   wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
+   wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+   wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+   wc.lpfnWndProc = WndProc;
+   wc.lpszClassName = "wglthreads";
+   wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
+   RegisterClass(&wc);
+
+   win = CreateWindowEx(0,
+                        wc.lpszClassName,
+                        "wglthreads",
+                        WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+                        xpos,
+                        ypos,
+                        width,
+                        height,
+                        NULL,
+                        NULL,
+                        wc.hInstance,
+                        (LPVOID) wt);
+   if (!win) {
+      Error("Couldn't create window");
+   }
+
+   hdc = GetDC(win);
+   if (!hdc) {
+      Error("Couldn't obtain HDC");
+   }
+
+   pfd.cColorBits = 24;
+   pfd.cDepthBits = 24;
+   pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
+   pfd.iLayerType = PFD_MAIN_PLANE;
+   pfd.iPixelType = PFD_TYPE_RGBA;
+   pfd.nSize = sizeof(pfd);
+   pfd.nVersion = 1;
+
+   visinfo = ChoosePixelFormat(hdc, &pfd);
+   if (!visinfo) {
+      Error("Unable to find RGB, Z, double-buffered visual");
+   }
+
+   SetPixelFormat(hdc, visinfo, &pfd);
+   ctx = wglCreateContext(hdc);
+   if (!ctx) {
+      Error("Couldn't create WGL context");
+   }
+
+   if (shareCtx) {
+      wglShareLists(shareCtx, ctx);
+   }
+
+   /* save the info for this window/context */
+   wt->Win = win;
+   wt->hDC = hdc;
+   wt->Context = ctx;
+   wt->Angle = 0.0;
+   wt->WinWidth = width;
+   wt->WinHeight = height;
+   wt->NewSize = GL_TRUE;
+
+   printf("wglthreads: %d: GL_RENDERER = %s\n", wt->Index, (char *) glGetString(GL_RENDERER));
+
+   if (Texture/* && wt->Index == 0*/) {
+      MakeNewTexture(wt);
+   }
+}
+
+
+/*
+ * Called by pthread_create()
+ */
+static DWORD WINAPI
+ThreadProc(void *p)
+{
+   struct winthread *wt = (struct winthread *) p;
+   HGLRC share;
+
+   share = (Texture && wt->Index > 0) ? WinThreads[0].Context : 0;
+   create_window(wt, share);
+   SetEvent(wt->hEventInitialised);
+
+   draw_loop(wt);
+   return 0;
+}
+
+
+static void
+usage(void)
+{
+   printf("wglthreads: test of GL thread safety (any key = exit)\n");
+   printf("Usage:\n");
+   printf("  wglthreads [options]\n");
+   printf("Options:\n");
+   printf("   -h  Show this usage screen\n");
+   printf("   -n NUMTHREADS  Number of threads to create\n");
+   printf("   -l  Use application-side locking\n");
+   printf("   -t  Enable texturing\n");
+   printf("   -s  Force single-threaded\n");
+   printf("Keyboard:\n");
+   printf("   Esc  Exit\n");
+   printf("   t    Change texture image (requires -t option)\n");
+   printf("   a    Toggle animation\n");
+   printf("   s    Step rotation (when not animating)\n");
+}
+
+
+int
+main(int argc, char *argv[])
+{
+   int i;
+
+   for (i = 1; i < argc; i++) {
+      if (strcmp(argv[i], "-h") == 0) {
+         usage();
+      }
+      else if (strcmp(argv[i], "-l") == 0) {
+         Locking = 1;
+      }
+      else if (strcmp(argv[i], "-t") == 0) {
+         Texture = 1;
+      }
+      else if (strcmp(argv[i], "-n") == 0 && i + 1 < argc) {
+         NumWinThreads = atoi(argv[i + 1]);
+         if (NumWinThreads < 1)
+            NumWinThreads = 1;
+         else if (NumWinThreads > MAX_WINTHREADS)
+            NumWinThreads = MAX_WINTHREADS;
+         i++;
+      }
+      else if (strcmp(argv[i], "-s") == 0) {
+         SingleThreaded = GL_TRUE;
+      }
+      else {
+         usage();
+         exit(1);
+      }
+   }
+
+   if (SingleThreaded)
+      printf("wglthreads: Forcing single-threaded, no other threads will be created.\n");
+   
+   if (Locking)
+      printf("wglthreads: Using explicit locks around WGL calls.\n");
+   else
+      printf("wglthreads: No explict locking.\n");
+
+   InitializeCriticalSection(&Mutex);
+   ExitEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+
+   if (SingleThreaded) {
+      NumWinThreads = 1;
+
+      WinThreads[0].Index = 0;
+      WinThreads[0].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
+      WinThreads[0].hEventRedraw = CreateEvent(NULL, FALSE, FALSE, NULL);
+
+      ThreadProc((void*) &WinThreads[0]);
+   }
+   else {
+      HANDLE threads[MAX_WINTHREADS];
+
+      printf("wglthreads: creating threads\n");
+
+      /* Create the threads */
+      for (i = 0; i < NumWinThreads; i++) {
+         DWORD id;
+
+         WinThreads[i].Index = i;
+         WinThreads[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
+         WinThreads[i].hEventRedraw = CreateEvent(NULL, FALSE, FALSE, NULL);
+         WinThreads[i].Thread = CreateThread(NULL,
+                                             0,
+                                             ThreadProc,
+                                             (void*) &WinThreads[i],
+                                             0,
+                                             &id);
+         printf("wglthreads: Created thread %p\n", (void *) WinThreads[i].Thread);
+
+         WaitForSingleObject(WinThreads[i].hEventInitialised, INFINITE);
+
+         threads[i] = WinThreads[i].Thread;
+      }
+
+      /* Wait for all threads to finish. */
+      WaitForMultipleObjects(NumWinThreads, threads, TRUE, INFINITE);
+   }
+
+   return 0;
+}
index 084dee5d8446abd85faaa7ca90870988956e525b..92446dd9fc3e4b81d867c967db2b7839f1112a3e 100644 (file)
@@ -18,6 +18,7 @@ overlay
 pbdemo
 pbinfo
 sharedtex
+sharedtex_mt
 texture_from_pixmap
 wincopy
 xdemo
index 8d248fb0a925756544fc0a155ca620baef8390f4..bb353e318c9315029c402382ce8e42417d601983 100644 (file)
@@ -31,6 +31,7 @@ PROGS = \
        pbinfo \
        pbdemo \
        sharedtex \
+        sharedtex_mt \
        texture_from_pixmap \
        wincopy \
        xfont \
index 95cd1af400415ecaee824f9f7d5a6a16300e4778..34167d339f391011df039e5e318596c6c7e01855 100644 (file)
@@ -112,6 +112,7 @@ int main(int argc, char *argv[])
        int attrib[14];
        GLint last_val = -1, count = 0;
        Window winGL;
+       GLXContext context;
        int dummy;
        Atom wmDelete;
        enum sync_type waitforsync = none;
@@ -185,7 +186,6 @@ int main(int argc, char *argv[])
                attrib[10] = None;
        }
 
-       GLXContext context;
        pvi = glXChooseVisual(disp, DefaultScreen(disp), attrib);
        if (!pvi) {
                fprintf(stderr, "failed to choose visual, exiting\n");
index 9db4df2c8b8d660786762633f7fce2495cf18416..e1abd22ceefa22f1c4c035f988e12fc2dfff3a69 100644 (file)
@@ -178,6 +178,7 @@ int main( int argc, char *argv[] )
    glColor3f( 0.0, 1.0, 1.0 );
    glRectf( -0.75, -0.75, 0.75, 0.75 );
    glFlush();
+   glXWaitGL();
 
    XMapWindow( dpy, win );
 
index cfea555210af8c615803a4347baa6260f0ef2eca..ee357f32a402c3e1411501136131c28c08b6cdb1 100644 (file)
@@ -286,7 +286,7 @@ EventLoop(void)
                         XLookupString(&event.xkey, buf, sizeof(buf), &keySym, &stat);
                         switch (keySym) {
                            case XK_Escape:
-                              exit(0);
+                              return;
                               break;
                            case XK_d:
                            case XK_D:
diff --git a/progs/xdemos/sharedtex_mt.c b/progs/xdemos/sharedtex_mt.c
new file mode 100644 (file)
index 0000000..07c1bfc
--- /dev/null
@@ -0,0 +1,486 @@
+/* $Id: sharedtex.c,v 1.2 2002/01/16 14:32:46 joukj Exp $ */
+
+/*
+ * Test sharing of display lists and texture objects between GLX contests.
+ * Brian Paul
+ * Summer 2000
+ *
+ *
+ * Copyright (C) 2000  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Modified 2009 for multithreading by Thomas Hellstrom.
+ */
+
+
+#include <GL/gl.h>
+#include <GL/glx.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <pthread.h>
+#include <X11/X.h>
+
+struct thread_init_arg {
+   int id;
+};
+
+struct window {
+   pthread_mutex_t drawMutex;
+   char DisplayName[1000];
+   Display *Dpy;
+   Window Win;
+   GLXContext Context;
+   float Angle;
+   int Id;
+   XVisualInfo *visInfo;
+};
+
+
+#define MAX_WINDOWS 20
+static struct window Windows[MAX_WINDOWS];
+static int NumWindows = 0;
+static int terminate = 0;
+static GLXContext gCtx;
+static Display *gDpy;
+static GLuint Textures[3];
+
+
+
+static void
+Error(const char *display, const char *msg)
+{
+   fprintf(stderr, "Error on display %s - %s\n", display, msg);
+   exit(1);
+}
+
+
+static int
+initMainthread(Display *dpy, const char *displayName)
+{
+   int scrnum;
+   XVisualInfo *visinfo;
+   int attrib[] = { GLX_RGBA,
+                   GLX_RED_SIZE, 1,
+                   GLX_GREEN_SIZE, 1,
+                   GLX_BLUE_SIZE, 1,
+                   GLX_DOUBLEBUFFER,
+                    GLX_DEPTH_SIZE, 1,
+                   None };
+
+   scrnum = DefaultScreen(dpy);
+   visinfo = glXChooseVisual(dpy, scrnum, attrib);
+   if (!visinfo) {
+      Error(displayName, "Unable to find RGB, double-buffered visual");
+      return -1;
+   }
+   gCtx = glXCreateContext(dpy, visinfo, NULL, True);
+   if (!gCtx) {
+      Error(displayName, "Couldn't create GLX context");
+      return -1;
+   }
+   return 0;
+}
+
+static struct window *
+AddWindow(Display *dpy, const char *displayName, int xpos, int ypos,
+          GLXContext sCtx)
+{
+   Window win;
+   GLXContext ctx;
+   int attrib[] = { GLX_RGBA,
+                   GLX_RED_SIZE, 1,
+                   GLX_GREEN_SIZE, 1,
+                   GLX_BLUE_SIZE, 1,
+                   GLX_DOUBLEBUFFER,
+                    GLX_DEPTH_SIZE, 1,
+                   None };
+   int scrnum;
+   XSetWindowAttributes attr;
+   unsigned long mask;
+   Window root;
+   XVisualInfo *visinfo;
+   int width = 300, height = 300;
+
+   if (NumWindows >= MAX_WINDOWS)
+      return NULL;
+
+   scrnum = DefaultScreen(dpy);
+   root = RootWindow(dpy, scrnum);
+
+   visinfo = glXChooseVisual(dpy, scrnum, attrib);
+   if (!visinfo) {
+      Error(displayName, "Unable to find RGB, double-buffered visual");
+      return NULL;
+   }
+
+   /* window attributes */
+   attr.background_pixel = 0;
+   attr.border_pixel = 0;
+   attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
+   attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
+   mask = CWBorderPixel | CWColormap | CWEventMask;
+
+   win = XCreateWindow(dpy, root, xpos, ypos, width, height,
+                      0, visinfo->depth, InputOutput,
+                      visinfo->visual, mask, &attr);
+   if (!win) {
+      Error(displayName, "Couldn't create window");
+      return NULL;
+   }
+
+   {
+      XSizeHints sizehints;
+      sizehints.x = xpos;
+      sizehints.y = ypos;
+      sizehints.width  = width;
+      sizehints.height = height;
+      sizehints.flags = USSize | USPosition;
+      XSetNormalHints(dpy, win, &sizehints);
+      XSetStandardProperties(dpy, win, displayName, displayName,
+                            None, (char **)NULL, 0, &sizehints);
+   }
+
+
+   ctx = glXCreateContext(dpy, visinfo,
+                          sCtx ? sCtx : NULL, True);
+
+   if (!ctx) {
+      Error(displayName, "Couldn't create GLX context");
+      return NULL;
+   }
+
+   XMapWindow(dpy, win);
+
+   /* save the info for this window */
+   {
+      static int id = 0;
+      struct window *h = &Windows[NumWindows];
+      strcpy(h->DisplayName, displayName);
+      h->Dpy = dpy;
+      h->Win = win;
+      h->Context = ctx;
+      h->Angle = 0.0;
+      h->Id = id++;
+      h->visInfo = visinfo;
+      pthread_mutex_init(&h->drawMutex, NULL);
+      NumWindows++;
+      return &Windows[NumWindows-1];
+   }
+}
+
+
+static void
+InitGLstuff(void)
+
+{
+   glGenTextures(3, Textures);
+
+   /* setup first texture object */
+   {
+      GLubyte image[16][16][4];
+      GLint i, j;
+      glBindTexture(GL_TEXTURE_2D, Textures[0]);
+
+      /* red/white checkerboard */
+      for (i = 0; i < 16; i++) {
+         for (j = 0; j < 16; j++) {
+            if ((i ^ j) & 1) {
+               image[i][j][0] = 255;
+               image[i][j][1] = 255;
+               image[i][j][2] = 255;
+               image[i][j][3] = 255;
+            }
+            else {
+               image[i][j][0] = 255;
+               image[i][j][1] = 0;
+               image[i][j][2] = 0;
+               image[i][j][3] = 255;
+            }
+         }
+      }
+
+      glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA,
+                   GL_UNSIGNED_BYTE, image);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+   }
+
+   /* setup second texture object */
+   {
+      GLubyte image[8][8][3];
+      GLint i, j;
+      glBindTexture(GL_TEXTURE_2D, Textures[1]);
+
+      /* green/yellow checkerboard */
+      for (i = 0; i < 8; i++) {
+         for (j = 0; j < 8; j++) {
+            if ((i ^ j) & 1) {
+               image[i][j][0] = 0;
+               image[i][j][1] = 255;
+               image[i][j][2] = 0;
+            }
+            else {
+               image[i][j][0] = 255;
+               image[i][j][1] = 255;
+               image[i][j][2] = 0;
+            }
+         }
+      }
+
+      glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
+      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB,
+                   GL_UNSIGNED_BYTE, image);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+   }
+
+   /* setup second texture object */
+   {
+      GLubyte image[4][4][3];
+      GLint i, j;
+      glBindTexture(GL_TEXTURE_2D, Textures[2]);
+
+      /* blue/gray checkerboard */
+      for (i = 0; i < 4; i++) {
+         for (j = 0; j < 4; j++) {
+            if ((i ^ j) & 1) {
+               image[i][j][0] = 0;
+               image[i][j][1] = 0;
+               image[i][j][2] = 255;
+            }
+            else {
+               image[i][j][0] = 200;
+               image[i][j][1] = 200;
+               image[i][j][2] = 200;
+            }
+         }
+      }
+
+      glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
+      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0, GL_RGB,
+                   GL_UNSIGNED_BYTE, image);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+   }
+
+   /* Now make the cube object display list */
+
+   printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
+   printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION));
+   printf("GL_VENDOR: %s\n", (char *) glGetString(GL_VENDOR));
+}
+
+static void
+Redraw(struct window *h)
+{
+   pthread_mutex_lock(&h->drawMutex);
+   if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) {
+      Error(h->DisplayName, "glXMakeCurrent failed in Redraw");
+      pthread_mutex_unlock(&h->drawMutex);
+      return;
+   }
+
+   h->Angle += 1.0;
+
+   glShadeModel(GL_FLAT);
+   glClearColor(0.25, 0.25, 0.25, 1.0);
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glEnable(GL_TEXTURE_2D);
+   glEnable(GL_DEPTH_TEST);
+   glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+
+   glColor3f(1, 1, 1);
+
+   glPushMatrix();
+   if (h->Id == 0)
+      glRotatef(h->Angle, 0, 1, -1);
+   else if (h->Id == 1)
+      glRotatef(-(h->Angle), 0, 1, -1);
+   else if (h->Id == 2)
+      glRotatef(h->Angle, 0, 1, 1);
+   else if (h->Id == 3)
+      glRotatef(-(h->Angle), 0, 1, 1);
+   glBindTexture(GL_TEXTURE_2D, Textures[0]);
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f(-1,  1, -1);
+   glTexCoord2f(1, 1);  glVertex3f(-1,  1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(-1, -1,  1);
+   glEnd();
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f(1,  1, -1);
+   glTexCoord2f(1, 1);  glVertex3f(1,  1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(1, -1,  1);
+   glEnd();
+
+   glBindTexture(GL_TEXTURE_2D, Textures[1]);
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, -1, -1);
+   glTexCoord2f(1, 1);  glVertex3f( 1, -1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(-1, -1,  1);
+   glEnd();
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(-1, 1, -1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, 1, -1);
+   glTexCoord2f(1, 1);  glVertex3f( 1, 1,  1);
+   glTexCoord2f(0, 1);  glVertex3f(-1, 1,  1);
+   glEnd();
+
+   glBindTexture(GL_TEXTURE_2D, Textures[2]);
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, -1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, -1, -1);
+   glTexCoord2f(1, 1);  glVertex3f( 1,  1, -1);
+   glTexCoord2f(0, 1);  glVertex3f(-1,  1, -1);
+   glEnd();
+   glBegin(GL_POLYGON);
+   glTexCoord2f(0, 0);  glVertex3f(-1, -1, 1);
+   glTexCoord2f(1, 0);  glVertex3f( 1, -1, 1);
+   glTexCoord2f(1, 1);  glVertex3f( 1,  1, 1);
+   glTexCoord2f(0, 1);  glVertex3f(-1,  1, 1);
+   glEnd();
+
+   glPopMatrix();
+
+   glXSwapBuffers(h->Dpy, h->Win);
+
+   if (!glXMakeCurrent(h->Dpy, None, NULL)) {
+      Error(h->DisplayName, "glXMakeCurrent failed in Redraw");
+   }
+   pthread_mutex_unlock(&h->drawMutex);
+}
+
+static void *threadRunner (void *arg)
+{
+   struct thread_init_arg *tia = (struct thread_init_arg *) arg;
+   struct window *win;
+
+   win = &Windows[tia->id];
+
+   while(!terminate) {
+      usleep(1000);
+      Redraw(win);
+   }
+
+   return NULL;
+}
+
+static void
+Resize(struct window *h, unsigned int width, unsigned int height)
+{
+   pthread_mutex_lock(&h->drawMutex);
+
+   if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) {
+      Error(h->DisplayName, "glXMakeCurrent failed in Resize()");
+      pthread_mutex_unlock(&h->drawMutex);
+      return;
+   }
+
+   glViewport(0, 0, width, height);
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glFrustum(-1, 1, -1, 1, 2, 10);
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
+   glTranslatef(0, 0, -4.5);
+   if (!glXMakeCurrent(h->Dpy, None, NULL)) {
+      Error(h->DisplayName, "glXMakeCurrent failed in Resize()");
+   }
+   pthread_mutex_unlock(&h->drawMutex);
+}
+
+
+static void
+EventLoop(void)
+{
+   while (1) {
+      int i;
+      XEvent event;
+      XNextEvent(gDpy, &event);
+      for (i = 0; i < NumWindows; i++) {
+        struct window *h = &Windows[i];
+        if (event.xany.window == h->Win) {
+           switch (event.type) {
+           case Expose:
+              Redraw(h);
+              break;
+           case ConfigureNotify:
+              Resize(h, event.xconfigure.width, event.xconfigure.height);
+              break;
+           case KeyPress:
+              terminate = 1;
+              return;
+           default:
+              /*no-op*/ ;
+           }
+        }
+      }
+   }
+}
+
+int
+main(int argc, char *argv[])
+{
+   const char *dpyName = XDisplayName(NULL);
+   pthread_t t0, t1, t2, t3;
+   struct thread_init_arg tia0, tia1, tia2, tia3;
+   struct window *h0, *h1, *h2, *h3;
+
+   XInitThreads();
+
+   gDpy = XOpenDisplay(dpyName);
+   if (!gDpy) {
+      Error(dpyName, "Unable to open display");
+      return -1;
+   }
+
+   if (initMainthread(gDpy, dpyName))
+      return -1;
+
+   /* four windows and contexts sharing display lists and texture objects */
+   h0 = AddWindow(gDpy, dpyName,  10,  10, gCtx);
+   h1 = AddWindow(gDpy, dpyName, 330,  10, gCtx);
+   h2 = AddWindow(gDpy, dpyName,  10, 350, gCtx);
+   h3 = AddWindow(gDpy, dpyName, 330, 350, gCtx);
+
+   if (!glXMakeCurrent(gDpy, h0->Win, gCtx)) {
+      Error(dpyName, "glXMakeCurrent failed for init thread.");
+      return -1;
+   }
+
+   InitGLstuff();
+
+   tia0.id = 0;
+   pthread_create(&t0, NULL, threadRunner, &tia0);
+   tia1.id = 1;
+   pthread_create(&t1, NULL, threadRunner, &tia1);
+   tia2.id = 2;
+   pthread_create(&t2, NULL, threadRunner, &tia2);
+   tia3.id = 3;
+   pthread_create(&t3, NULL, threadRunner, &tia3);
+   EventLoop();
+   return 0;
+}
index fc1ed08e478529595fc7e0d14081144a0e20c7f7..ecdeef06fdfaf71048b8968e25640b84e878053d 100644 (file)
@@ -330,9 +330,14 @@ def generate(env):
             ]
         if env['machine'] == 'x86_64':
             cflags += ['-m64']
+        # See also:
+        # - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
         cflags += [
+            '-Werror=declaration-after-statement',
             '-Wall',
             '-Wmissing-prototypes',
+            '-Wmissing-field-initializers',
+            '-Wpointer-arith',
             '-Wno-long-long',
             '-ffast-math',
             '-std=gnu99',
@@ -347,6 +352,7 @@ def generate(env):
               '/Od', # disable optimizations
               '/Oi', # enable intrinsic functions
               '/Oy-', # disable frame pointer omission
+              '/GL-', # disable whole program optimization
             ]
         else:
             cflags += [
@@ -437,9 +443,14 @@ def generate(env):
             linkflags += ['-m32']
         if env['machine'] == 'x86_64':
             linkflags += ['-m64']
-    if platform == 'winddk':
+    if platform == 'windows' and msvc:
         # See also:
         # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
+        linkflags += [
+            '/fixed:no',
+            '/incremental:no',
+        ]
+    if platform == 'winddk':
         linkflags += [
             '/merge:_PAGE=PAGE',
             '/merge:_TEXT=.text',
@@ -467,7 +478,7 @@ def generate(env):
 
             '/entry:DrvEnableDriver',
         ]
-        if env['profile']:
+        if env['debug'] or env['profile']:
             linkflags += [
                 '/MAP', # http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
             ]
index 23231966731573b9a90532ed9d2cfdd686af0e53..01a374e3633b11b8092d2c5fc43ac67937c7c18e 100644 (file)
@@ -405,17 +405,19 @@ def generate(env):
             ]
         if env['machine'] == 'x86_64':
             ccflags += ['-m64']
+        # See also:
+        # - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
         ccflags += [
+            '-Werror=declaration-after-statement',
             '-Wall',
             '-Wmissing-prototypes',
+            '-Wmissing-field-initializers',
+            '-Wpointer-arith',
             '-Wno-long-long',
             '-ffast-math',
-            '-pedantic',
+            '-std=gnu99',
             '-fmessage-length=0', # be nice to Eclipse
         ]
-        cflags += [
-            '-Wmissing-prototypes',
-        ]
     if msvc:
         # See also:
         # - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
@@ -425,6 +427,7 @@ def generate(env):
               '/Od', # disable optimizations
               '/Oi', # enable intrinsic functions
               '/Oy-', # disable frame pointer omission
+              '/GL-', # disable whole program optimization
             ]
         else:
             ccflags += [
@@ -516,9 +519,14 @@ def generate(env):
             linkflags += ['-m32']
         if env['machine'] == 'x86_64':
             linkflags += ['-m64']
-    if platform == 'winddk':
+    if platform == 'windows' and msvc:
         # See also:
         # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
+        linkflags += [
+            '/fixed:no',
+            '/incremental:no',
+        ]
+    if platform == 'winddk':
         linkflags += [
             '/merge:_PAGE=PAGE',
             '/merge:_TEXT=.text',
@@ -546,7 +554,7 @@ def generate(env):
 
             '/entry:DrvEnableDriver',
         ]
-        if env['profile']:
+        if env['debug'] or env['profile']:
             linkflags += [
                 '/MAP', # http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
             ]
index 8ba70ba7a60a8d40f39c1641cf3bfce9b49184bc..155caa413c884439e191a389a6a90fc966e582c9 100644 (file)
@@ -267,15 +267,17 @@ glx_token_to_visual_class(int visual_type)
       return None;
    }
 }
-static GLboolean
+static int
 get_fbconfig_attribs(Display *dpy, GLXFBConfig fbconfig,
                     struct visual_attribs *attribs)
 {
    int visual_type;
+   int fbconfig_id;
 
    memset(attribs, 0, sizeof(struct visual_attribs));
 
-   /* We don't use the GLX_FBCONFIG_ID here */
+   glXGetFBConfigAttrib(dpy, fbconfig, GLX_FBCONFIG_ID, &fbconfig_id);
+
    glXGetFBConfigAttrib(dpy, fbconfig, GLX_VISUAL_ID, &attribs->id);
 
 #if 0
@@ -294,11 +296,11 @@ get_fbconfig_attribs(Display *dpy, GLXFBConfig fbconfig,
    glXGetFBConfigAttrib(dpy, fbconfig, GLX_LEVEL, &attribs->level);
    glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, &attribs->render_type);
    if (!(attribs->render_type & GLX_RGBA_BIT))
-      return GL_FALSE;
+      return 0;
 
    glXGetFBConfigAttrib(dpy, fbconfig, GLX_DOUBLEBUFFER, &attribs->doubleBuffer);
    if (!attribs->doubleBuffer)
-      return GL_FALSE;
+      return 0;
 
    glXGetFBConfigAttrib(dpy, fbconfig, GLX_STEREO, &attribs->stereo);
    glXGetFBConfigAttrib(dpy, fbconfig, GLX_AUX_BUFFERS, &attribs->auxBuffers);
@@ -332,7 +334,12 @@ get_fbconfig_attribs(Display *dpy, GLXFBConfig fbconfig,
 
    glXGetFBConfigAttrib(dpy, fbconfig, GLX_CONFIG_CAVEAT, &attribs->visualCaveat);
 
-   return GL_TRUE;
+   if (attribs->id == 0) {
+      attribs->id = fbconfig_id;
+      return EGL_PBUFFER_BIT | EGL_PIXMAP_BIT;
+   }
+
+   return EGL_WINDOW_BIT;
 }
 
 #endif
@@ -344,6 +351,7 @@ create_configs(_EGLDisplay *disp, struct GLX_egl_driver *GLX_drv)
    int numVisuals;
    long mask;
    int i;
+   int egl_configs = 1;
    struct visual_attribs attribs;
 
    GLX_drv->fbconfigs = NULL;
@@ -359,13 +367,15 @@ create_configs(_EGLDisplay *disp, struct GLX_egl_driver *GLX_drv)
 
    for (i = 0; i < numVisuals; i++) {
       struct GLX_egl_config *config;
+      int bit;
 
-      if (!get_fbconfig_attribs(disp->Xdpy, GLX_drv->fbconfigs[i], &attribs))
+      bit = get_fbconfig_attribs(disp->Xdpy, GLX_drv->fbconfigs[i], &attribs);
+      if (!bit)
          continue;
 
       config = CALLOC_STRUCT(GLX_egl_config);
 
-      _eglInitConfig(&config->Base, i+1);
+      _eglInitConfig(&config->Base, (i+1));
       SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, attribs.id);
       SET_CONFIG_ATTRIB(&config->Base, EGL_BUFFER_SIZE, attribs.bufferSize);
       SET_CONFIG_ATTRIB(&config->Base, EGL_RED_SIZE, attribs.redSize);
@@ -378,8 +388,7 @@ create_configs(_EGLDisplay *disp, struct GLX_egl_driver *GLX_drv)
       SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLE_BUFFERS, attribs.numMultisample);
       SET_CONFIG_ATTRIB(&config->Base, EGL_CONFORMANT, all_apis);
       SET_CONFIG_ATTRIB(&config->Base, EGL_RENDERABLE_TYPE, all_apis);
-      SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE,
-                        (EGL_WINDOW_BIT | EGL_PBUFFER_BIT | EGL_PIXMAP_BIT));
+      SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE, bit);
 
       /* XXX possibly other things to init... */
 
@@ -403,7 +412,7 @@ xvisual:
 
       config = CALLOC_STRUCT(GLX_egl_config);
 
-      _eglInitConfig(&config->Base, i+1);
+      _eglInitConfig(&config->Base, (i+1));
       SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, attribs.id);
       SET_CONFIG_ATTRIB(&config->Base, EGL_BUFFER_SIZE, attribs.bufferSize);
       SET_CONFIG_ATTRIB(&config->Base, EGL_RED_SIZE, attribs.redSize);
@@ -788,7 +797,20 @@ GLX_eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
 static _EGLProc
 GLX_eglGetProcAddress(const char *procname)
 {
-   return (_EGLProc)glXGetProcAddress((const GLubyte *)procname);   
+   /* This is a bit of a hack to get at the gallium/Mesa state tracker
+    * function st_get_proc_address().  This will probably change at
+    * some point.
+    */
+   _EGLProc (*get_proc_addr)(const char *procname);
+   get_proc_addr = dlsym(NULL, "st_get_proc_address");
+   if (get_proc_addr)
+      return get_proc_addr(procname);
+
+   get_proc_addr = glXGetProcAddress((const GLubyte *)procname);
+   if (get_proc_addr)
+      return get_proc_addr(procname);
+
+   return (_EGLProc)dlsym(NULL, procname);
 }
 
 
index 89b4a200bcd9750c99763cb78e66964646f0aad9..5ee246dc3f5205b10509eaac222e2c04524a17dc 100644 (file)
@@ -46,8 +46,6 @@ OBJECTS = $(SOURCES:.c=.o)
 # Undefined for now
 LOCAL_CFLAGS = -D_EGL_PLATFORM_X=1
 
-LIBS = -lX11
-
 
 .c.o:
        $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@
@@ -63,7 +61,8 @@ library: $(TOP)/$(LIB_DIR)/libEGL.so
 $(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS)
        $(MKLIB) -o EGL -linker '$(CC)' -ldflags '$(LDFLAGS)' \
                -major 1 -minor 0 \
-               -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS)
+               -install $(TOP)/$(LIB_DIR) \
+               $(EGL_LIB_DEPS) $(OBJECTS)
 
 install:
        $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
index b19988f49a918a1116636544aeb63554d248de70..f2f32585c7352a89a0c754f2ce59d60c46b0647f 100644 (file)
@@ -133,6 +133,9 @@ _eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list)
       config->Attrib[i] = EGL_DONT_CARE;
    }
 
+   /* by default choose windows unless otherwise specified */
+   config->Attrib[EGL_SURFACE_TYPE - FIRST_ATTRIB] = EGL_WINDOW_BIT;
+
    for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
       const EGLint attr = attrib_list[i];
       if (attr >= EGL_BUFFER_SIZE &&
index 875314f6c31bdbc7628b8262fad3aaf04c3d1260..79ca767f7e641e79e1482abce3568bb3dd78c31b 100644 (file)
@@ -1,26 +1,12 @@
+# src/gallium/Makefile
 TOP = ../..
 include $(TOP)/configs/current
 
-
 SUBDIRS = $(GALLIUM_DIRS)
-# Note winsys/ needs to be built after src/mesa
-
-
-default: subdirs
-
 
-subdirs:
+default install clean:
        @for dir in $(SUBDIRS) ; do \
                if [ -d $$dir ] ; then \
-                       (cd $$dir && $(MAKE)) || exit 1 ; \
+                       (cd $$dir && $(MAKE) $@) || exit 1; \
                fi \
        done
-
-
-clean:
-       rm -f `find . -name \*.[oa]`
-       rm -f `find . -name depend`
-
-
-# Dummy install target
-install:
index 655e949ca2daa1068af26c4efd7fbce531c07d71..98487d43bd646f4da3024fc93069da43acc5a364 100644 (file)
@@ -1,64 +1,66 @@
-# -*-makefile-*-
+# src/gallium/Makefile.template
 
-
-# We still have a dependency on the "dri" buffer manager.  Most likely
-# the interface can be reused in non-dri environments, and also as a
-# frontend to simpler memory managers.
+# Template makefile for gallium libraries.
+#
+# Usage:
+#   The minimum that the including makefile needs to define
+#   is TOP, LIBNAME and one of of the *_SOURCES.
 #
-COMMON_SOURCES = 
+# Optional defines:
+#   LIBRARY_INCLUDES are appended to the list of includes directories.
+#   LIBRARY_DEFINES is not used for makedepend, but for compilation.
 
-OBJECTS = $(C_SOURCES:.c=.o) \
-          $(CPP_SOURCES:.cpp=.o) \
-         $(ASM_SOURCES:.S=.o) 
+### Basic defines ###
 
+OBJECTS = $(C_SOURCES:.c=.o) \
+       $(CPP_SOURCES:.cpp=.o) \
+       $(ASM_SOURCES:.S=.o)
 
-### Include directories
 INCLUDES = \
        -I. \
        -I$(TOP)/src/gallium/include \
        -I$(TOP)/src/gallium/auxiliary \
        -I$(TOP)/src/gallium/drivers \
-       -I$(TOP)/include \
-        $(DRIVER_INCLUDES)
-
-
-##### RULES #####
-
-.c.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.cpp.o:
-       $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.S.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES)  $< -o $@
+       -I$(GALLIUM)/src/gallium/include \
+       -I$(GALLIUM)/src/gallium/auxiliary \
+       -I$(GALLIUM)/src/gallium/drivers \
+       $(LIBRARY_INCLUDES)
 
 
 ##### TARGETS #####
 
-default: depend symlinks lib$(LIBNAME).a
-
+default: depend lib$(LIBNAME).a
 
 lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/gallium/Makefile.template
-       $(TOP)/bin/mklib -o $(LIBNAME) -static $(OBJECTS) $(DRIVER_LIBS)
-
+       $(MKLIB) -o $(LIBNAME) -static $(OBJECTS)
 
 depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
        rm -f depend
        touch depend
-       $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) \
-               $(ASM_SOURCES) 2> /dev/null
-
+       $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) 2> /dev/null
 
 # Emacs tags
 tags:
        etags `find . -name \*.[ch]` `find ../include`
 
-
 # Remove .o and backup files
-clean::
-       -rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
-       -rm -f depend depend.bak
+clean:
+       rm -f $(OBJECTS) lib$(LIBNAME).a depend depend.bak
+
+# Dummy target
+install:
+       @echo -n ""
+
+##### RULES #####
+
+.c.o:
+       $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@
+
+.cpp.o:
+       $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(LIBRARY_DEFINES) $< -o $@
+
+.S.o:
+       $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES)  $< -o $@
 
 
-include depend
+sinclude depend
index eaa0f2fe4e8a195d732e67eff0dff42232ab06eb..5446eb68a985f445980df4a975591ce0c3bb0a15 100644 (file)
@@ -1,20 +1,12 @@
+# src/gallium/auxiliary/Makefile
 TOP = ../../..
 include $(TOP)/configs/current
 
-
 SUBDIRS = $(GALLIUM_AUXILIARY_DIRS)
 
-
-default: subdirs
-
-
-subdirs:
+default install clean:
        @for dir in $(SUBDIRS) ; do \
                if [ -d $$dir ] ; then \
-                       (cd $$dir && $(MAKE)) || exit 1 ; \
+                       (cd $$dir && $(MAKE) $@) || exit 1; \
                fi \
        done
-
-
-clean:
-       rm -f `find . -name \*.[oa]`
index 6bd66020887e55b425098eb802aba073899eb904..8726afcd949b5671c89d57804d7519564b520620 100644 (file)
@@ -9,6 +9,3 @@ C_SOURCES = \
        cso_hash.c
 
 include ../../Makefile.template
-
-symlinks:
-
index 6b1754ea00230d7da6b431ec79286fcf74e210fe..0bc77a572879c12a1602d2ffca689b64f90e47be 100644 (file)
@@ -28,7 +28,7 @@
 /* Authors:  Zack Rusin <zack@tungstengraphics.com>
  */
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 #include "util/u_memory.h"
 
index a9157aad7116d3fdce0c30b8a05f4a8c4f9bec86..f388bf5d951782a9b1cda9511416afd7ea5cd97a 100644 (file)
@@ -37,7 +37,6 @@
 
 #include "pipe/p_state.h"
 #include "util/u_memory.h"
-#include "pipe/p_inlines.h"
 #include "tgsi/tgsi_parse.h"
 
 #include "cso_cache/cso_context.h"
index 4e7664f9bf0316b49e146857a0f726b71877e022..288cef7b6faea8472a5687dfe36d564cb8c28556 100644 (file)
@@ -30,7 +30,7 @@
   *   Zack Rusin <zack@tungstengraphics.com>
   */
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "util/u_memory.h"
 
 #include "cso_hash.h"
index bdbf5a08ede4b3279ffa26070878582689d1dc5f..5041dcc072bfd7a2e350af91254447e977a8cc7d 100644 (file)
@@ -43,8 +43,4 @@ C_SOURCES = \
        draw_vs_ppc.c  \
        draw_vs_sse.c 
 
-
 include ../../Makefile.template
-
-symlinks:
-
index 7bd4a2e22185601fa116d41a6366ef6572212ac0..a4f1fcddc1a0cd6f9de25be4bd0c21c791f5da4e 100644 (file)
@@ -127,7 +127,7 @@ void draw_set_rasterizer_state( struct draw_context *draw,
 
    draw->rasterizer = raster;
    draw->bypass_clipping =
-      ((draw->rasterizer && draw->rasterizer->bypass_clipping) ||
+      ((draw->rasterizer && draw->rasterizer->bypass_vs_clip_and_viewport) ||
        draw->driver.bypass_clipping);
 }
 
@@ -138,8 +138,9 @@ void draw_set_driver_clipping( struct draw_context *draw,
    draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
 
    draw->driver.bypass_clipping = bypass_clipping;
-   draw->bypass_clipping = (draw->rasterizer->bypass_clipping || 
-                            draw->driver.bypass_clipping);
+   draw->bypass_clipping =
+      ((draw->rasterizer && draw->rasterizer->bypass_vs_clip_and_viewport) ||
+       draw->driver.bypass_clipping);
 }
 
 
index 20841bb5d69b0abda50c61354e803f399ad72cb0..ca69f0b95e5ff8ca8c4152b1f14cad206d3df1df 100644 (file)
@@ -32,7 +32,6 @@
  */
 
 
-#include "pipe/p_inlines.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
@@ -410,7 +409,7 @@ aaline_create_texture(struct aaline_stage *aaline)
     * texels which are zero.  Special case the 1x1 and 2x2 levels.
     */
    for (level = 0; level <= MAX_TEXTURE_LEVEL; level++) {
-      struct pipe_surface *surface;
+      struct pipe_transfer *transfer;
       const uint size = aaline->texture->width[level];
       ubyte *data;
       uint i, j;
@@ -419,9 +418,9 @@ aaline_create_texture(struct aaline_stage *aaline)
 
       /* This texture is new, no need to flush. 
        */
-      surface = screen->get_tex_surface(screen, aaline->texture, 0, level, 0,
-                                        PIPE_BUFFER_USAGE_CPU_WRITE);
-      data = screen->surface_map(screen, surface, PIPE_BUFFER_USAGE_CPU_WRITE);
+      transfer = screen->get_tex_transfer(screen, aaline->texture, 0, level, 0,
+                                         PIPE_TRANSFER_WRITE, 0, 0, size, size);
+      data = screen->transfer_map(screen, transfer);
       if (data == NULL)
          return FALSE;
 
@@ -440,13 +439,13 @@ aaline_create_texture(struct aaline_stage *aaline)
             else {
                d = 255;
             }
-            data[i * surface->stride + j] = d;
+            data[i * transfer->stride + j] = d;
          }
       }
 
       /* unmap */
-      screen->surface_unmap(screen, surface);
-      screen->tex_surface_release(screen, &surface);
+      screen->transfer_unmap(screen, transfer);
+      screen->tex_transfer_destroy(transfer);
    }
    return TRUE;
 }
@@ -728,7 +727,7 @@ aaline_destroy(struct draw_stage *stage)
       aaline->pipe->delete_sampler_state(aaline->pipe, aaline->sampler_cso);
 
    if (aaline->texture)
-      pipe_texture_release(&aaline->texture);
+      pipe_texture_reference(&aaline->texture, NULL);
 
    draw_free_temp_verts( stage );
 
index 2c1cacbdb4768de78351abdaadc1307fd7a6cd36..5008086cf2614e9c5d69104356222257cfe4ee65 100644 (file)
@@ -38,7 +38,6 @@
  */
 
 
-#include "pipe/p_inlines.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
index a0f9716dac2e10df009eda6cc199bd9186cb3658..04e59152c5c528dff8e12a051b354366dc804ea6 100644 (file)
@@ -34,7 +34,6 @@
  */
 
 
-#include "pipe/p_inlines.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
@@ -372,7 +371,7 @@ pstip_update_texture(struct pstip_stage *pstip)
    static const uint bit31 = 1 << 31;
    struct pipe_context *pipe = pstip->pipe;
    struct pipe_screen *screen = pipe->screen;
-   struct pipe_surface *surface;
+   struct pipe_transfer *transfer;
    const uint *stipple = pstip->state.stipple->stipple;
    uint i, j;
    ubyte *data;
@@ -381,10 +380,9 @@ pstip_update_texture(struct pstip_stage *pstip)
     */
    pipe->flush( pipe, PIPE_FLUSH_TEXTURE_CACHE, NULL );
 
-   surface = screen->get_tex_surface(screen, pstip->texture, 0, 0, 0,
-                                     PIPE_BUFFER_USAGE_CPU_WRITE);
-   data = screen->surface_map(screen, surface,
-                              PIPE_BUFFER_USAGE_CPU_WRITE);
+   transfer = screen->get_tex_transfer(screen, pstip->texture, 0, 0, 0,
+                                       PIPE_TRANSFER_WRITE, 0, 0, 32, 32);
+   data = screen->transfer_map(screen, transfer);
 
    /*
     * Load alpha texture.
@@ -396,18 +394,18 @@ pstip_update_texture(struct pstip_stage *pstip)
       for (j = 0; j < 32; j++) {
          if (stipple[i] & (bit31 >> j)) {
             /* fragment "on" */
-            data[i * surface->stride + j] = 0;
+            data[i * transfer->stride + j] = 0;
          }
          else {
             /* fragment "off" */
-            data[i * surface->stride + j] = 255;
+            data[i * transfer->stride + j] = 255;
          }
       }
    }
 
    /* unmap */
-   screen->surface_unmap(screen, surface);
-   screen->tex_surface_release(screen, &surface);
+   screen->transfer_unmap(screen, transfer);
+   screen->tex_transfer_destroy(transfer);
 }
 
 
@@ -573,7 +571,7 @@ pstip_destroy(struct draw_stage *stage)
 
    pstip->pipe->delete_sampler_state(pstip->pipe, pstip->sampler_cso);
 
-   pipe_texture_release(&pstip->texture);
+   pipe_texture_reference(&pstip->texture, NULL);
 
    draw_free_temp_verts( stage );
    FREE( stage );
index 9153bc2f8652b81959722b112989e74390577f5c..12325d30d61686ad595b2d35c49e57149d8c99cf 100644 (file)
  * \file
  * Vertex buffer drawing stage.
  * 
- * \author José Fonseca <jrfonsec@tungstengraphics.com>
+ * \author Jose Fonseca <jrfonsec@tungstengraphics.com>
  * \author Keith Whitwell <keith@tungstengraphics.com>
  */
 
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
@@ -93,7 +93,6 @@ vbuf_stage( struct draw_stage *stage )
 }
 
 
-static void vbuf_flush_indices( struct vbuf_stage *vbuf );
 static void vbuf_flush_vertices( struct vbuf_stage *vbuf );
 static void vbuf_alloc_vertices( struct vbuf_stage *vbuf );
 
@@ -109,13 +108,12 @@ overflow( void *map, void *ptr, unsigned bytes, unsigned bufsz )
 static INLINE void 
 check_space( struct vbuf_stage *vbuf, unsigned nr )
 {
-   if (vbuf->nr_vertices + nr > vbuf->max_vertices ) {
-      vbuf_flush_vertices(vbuf);
-      vbuf_alloc_vertices(vbuf);
+   if (vbuf->nr_vertices + nr > vbuf->max_vertices ||
+       vbuf->nr_indices + nr > vbuf->max_indices)
+   {
+      vbuf_flush_vertices( vbuf );
+      vbuf_alloc_vertices( vbuf );
    }
-
-   if (vbuf->nr_indices + nr > vbuf->max_indices )
-      vbuf_flush_indices(vbuf);
 }
 
 
@@ -202,7 +200,7 @@ vbuf_point( struct draw_stage *stage,
  * will be flushed if needed and a new one allocated.
  */
 static void
-vbuf_set_prim( struct vbuf_stage *vbuf, uint prim )
+vbuf_start_prim( struct vbuf_stage *vbuf, uint prim )
 {
    struct translate_key hw_key;
    unsigned dst_offset;
@@ -217,11 +215,7 @@ vbuf_set_prim( struct vbuf_stage *vbuf, uint prim )
     * state change.
     */
    vbuf->vinfo = vbuf->render->get_vertex_info(vbuf->render);
-
-   if (vbuf->vertex_size != vbuf->vinfo->size * sizeof(float)) {
-      vbuf_flush_vertices(vbuf);
-      vbuf->vertex_size = vbuf->vinfo->size * sizeof(float);
-   }
+   vbuf->vertex_size = vbuf->vinfo->size * sizeof(float);
 
    /* Translate from pipeline vertices to hw vertices.
     */
@@ -294,8 +288,8 @@ vbuf_set_prim( struct vbuf_stage *vbuf, uint prim )
 
    /* Allocate new buffer?
     */
-   if (!vbuf->vertices)
-      vbuf_alloc_vertices(vbuf);
+   assert(vbuf->vertices == NULL);
+   vbuf_alloc_vertices(vbuf);
 }
 
 
@@ -305,9 +299,9 @@ vbuf_first_tri( struct draw_stage *stage,
 {
    struct vbuf_stage *vbuf = vbuf_stage( stage );
 
-   vbuf_flush_indices( vbuf );   
+   vbuf_flush_vertices( vbuf );
+   vbuf_start_prim(vbuf, PIPE_PRIM_TRIANGLES);
    stage->tri = vbuf_tri;
-   vbuf_set_prim(vbuf, PIPE_PRIM_TRIANGLES);
    stage->tri( stage, prim );
 }
 
@@ -318,9 +312,9 @@ vbuf_first_line( struct draw_stage *stage,
 {
    struct vbuf_stage *vbuf = vbuf_stage( stage );
 
-   vbuf_flush_indices( vbuf );
+   vbuf_flush_vertices( vbuf );
+   vbuf_start_prim(vbuf, PIPE_PRIM_LINES);
    stage->line = vbuf_line;
-   vbuf_set_prim(vbuf, PIPE_PRIM_LINES);
    stage->line( stage, prim );
 }
 
@@ -331,53 +325,42 @@ vbuf_first_point( struct draw_stage *stage,
 {
    struct vbuf_stage *vbuf = vbuf_stage( stage );
 
-   vbuf_flush_indices( vbuf );
+   vbuf_flush_vertices(vbuf);
+   vbuf_start_prim(vbuf, PIPE_PRIM_POINTS);
    stage->point = vbuf_point;
-   vbuf_set_prim(vbuf, PIPE_PRIM_POINTS);
    stage->point( stage, prim );
 }
 
 
-static void 
-vbuf_flush_indices( struct vbuf_stage *vbuf ) 
-{
-   if(!vbuf->nr_indices)
-      return;
-   
-   assert((uint) (vbuf->vertex_ptr - vbuf->vertices) == 
-          vbuf->nr_vertices * vbuf->vertex_size / sizeof(unsigned));
-
-   vbuf->render->draw(vbuf->render, vbuf->indices, vbuf->nr_indices);
-   
-   vbuf->nr_indices = 0;
-}
-
 
 /**
  * Flush existing vertex buffer and allocate a new one.
- * 
- * XXX: We separate flush-on-index-full and flush-on-vb-full, but may 
- * raise issues uploading vertices if the hardware wants to flush when
- * we flush.
  */
 static void 
 vbuf_flush_vertices( struct vbuf_stage *vbuf )
 {
-   if(vbuf->vertices) {      
-      vbuf_flush_indices(vbuf);
-      
+   if(vbuf->vertices) {
+
+      vbuf->render->unmap_vertices( vbuf->render, 0, vbuf->nr_vertices - 1 );
+
+      if (vbuf->nr_indices) 
+      {
+         vbuf->render->draw(vbuf->render, 
+                            vbuf->indices, 
+                            vbuf->nr_indices );
+   
+         vbuf->nr_indices = 0;
+      }
+     
       /* Reset temporary vertices ids */
       if(vbuf->nr_vertices)
         draw_reset_vertex_ids( vbuf->stage.draw );
       
       /* Free the vertex buffer */
-      vbuf->render->release_vertices(vbuf->render,
-                                     vbuf->vertices,
-                                     vbuf->vertex_size,
-                                     vbuf->nr_vertices);
+      vbuf->render->release_vertices( vbuf->render );
+
       vbuf->max_vertices = vbuf->nr_vertices = 0;
       vbuf->vertex_ptr = vbuf->vertices = NULL;
-      
    }
 }
    
@@ -402,9 +385,12 @@ vbuf_alloc_vertices( struct vbuf_stage *vbuf )
     * and it will flush itself if necessary to do so.  If this does
     * fail, we are basically without usable hardware.
     */
-   vbuf->vertices = (uint *) vbuf->render->allocate_vertices(vbuf->render,
-                                                            (ushort) vbuf->vertex_size,
-                                                            (ushort) vbuf->max_vertices);
+   vbuf->render->allocate_vertices(vbuf->render,
+                                   (ushort) vbuf->vertex_size,
+                                   (ushort) vbuf->max_vertices);
+
+   vbuf->vertices = (uint *) vbuf->render->map_vertices( vbuf->render );
+   
    vbuf->vertex_ptr = vbuf->vertices;
 }
 
@@ -415,14 +401,11 @@ vbuf_flush( struct draw_stage *stage, unsigned flags )
 {
    struct vbuf_stage *vbuf = vbuf_stage( stage );
 
-   vbuf_flush_indices( vbuf );
+   vbuf_flush_vertices( vbuf );
 
    stage->point = vbuf_first_point;
    stage->line = vbuf_first_line;
    stage->tri = vbuf_first_tri;
-
-   if (flags & DRAW_FLUSH_BACKEND)
-      vbuf_flush_vertices( vbuf );
 }
 
 
index 4e5ffa09305eb89fdf2c3ac40d1547335c84a624..9ea0cbe5990b4931f7ed86453b05f174b0a474ec 100644 (file)
@@ -87,7 +87,7 @@ draw_pt_arrays(struct draw_context *draw,
          opt |= PT_CLIPTEST;
       }
       
-      if (!draw->rasterizer->bypass_vs) {
+      if (!draw->rasterizer->bypass_vs_clip_and_viewport) {
          opt |= PT_SHADE;
       }
    }
index c02f229110ade71949ddcd9ef4a7f37da4559dae..6f3e1e0289b1e99c5f4dc37f3eaf794248a0b4b5 100644 (file)
@@ -173,9 +173,7 @@ void draw_pt_emit( struct pt_emit *emit,
 
 void draw_pt_emit_linear( struct pt_emit *emit,
                           const float (*vertex_data)[4],
-                          unsigned vertex_count,
                           unsigned stride,
-                          unsigned start,
                           unsigned count );
 
 void draw_pt_emit_destroy( struct pt_emit *emit );
@@ -217,7 +215,7 @@ boolean draw_pt_post_vs_run( struct pt_post_vs *pvs,
 
 void draw_pt_post_vs_prepare( struct pt_post_vs *pvs,
                              boolean bypass_clipping,
-                             boolean identity_viewport,
+                             boolean bypass_viewport,
                              boolean opengl );
 
 struct pt_post_vs *draw_pt_post_vs_create( struct draw_context *draw );
index 232dfdaed2d71e23a65dd1b6d94599148f5e08e3..064e16c295ca4df2e9c8dd7dbcc2fed36e849fe5 100644 (file)
@@ -165,6 +165,9 @@ void draw_pt_emit( struct pt_emit *emit,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
+   if (vertex_count == 0)
+      return;
+
    if (vertex_count >= UNDEFINED_VERTEX_ID) {
       assert(0);
       return;
@@ -178,9 +181,11 @@ void draw_pt_emit( struct pt_emit *emit,
       return;
    }
 
-   hw_verts = render->allocate_vertices(render,
-                                       (ushort)translate->key.output_stride,
-                                       (ushort)vertex_count);
+   render->allocate_vertices(render,
+                             (ushort)translate->key.output_stride,
+                             (ushort)vertex_count);
+
+   hw_verts = render->map_vertices( render );
    if (!hw_verts) {
       assert(0);
       return;
@@ -201,22 +206,21 @@ void draw_pt_emit( struct pt_emit *emit,
                   vertex_count,
                   hw_verts );
 
+   render->unmap_vertices( render, 
+                           0, 
+                           vertex_count - 1 );
+
    render->draw(render,
                elts,
                count);
 
-   render->release_vertices(render,
-                           hw_verts,
-                           translate->key.output_stride,
-                           vertex_count);
+   render->release_vertices(render);
 }
 
 
 void draw_pt_emit_linear(struct pt_emit *emit,
                          const float (*vertex_data)[4],
-                         unsigned vertex_count,
                          unsigned stride,
-                         unsigned start,
                          unsigned count)
 {
    struct draw_context *draw = emit->draw;
@@ -231,26 +235,23 @@ void draw_pt_emit_linear(struct pt_emit *emit,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
-   if (count >= UNDEFINED_VERTEX_ID) {
-      assert(0);
-      return;
-   }
+   if (count >= UNDEFINED_VERTEX_ID)
+      goto fail;
 
    /* XXX: and work out some way to coordinate the render primitive
     * between vbuf.c and here...
     */
-   if (!draw->render->set_primitive(draw->render, emit->prim)) {
-      assert(0);
-      return;
-   }
+   if (!draw->render->set_primitive(draw->render, emit->prim)) 
+      goto fail;
 
-   hw_verts = render->allocate_vertices(render,
-                                       (ushort)translate->key.output_stride,
-                                       (ushort)count);
-   if (!hw_verts) {
-      assert(0);
-      return;
-   }
+   if (!render->allocate_vertices(render,
+                                  (ushort)translate->key.output_stride,
+                                  (ushort)count))
+      goto fail;
+
+   hw_verts = render->map_vertices( render );
+   if (!hw_verts)
+      goto fail;
 
    translate->set_buffer(translate, 0,
                         vertex_data, stride);
@@ -261,12 +262,12 @@ void draw_pt_emit_linear(struct pt_emit *emit,
 
    translate->run(translate,
                   0,
-                  vertex_count,
+                  count,
                   hw_verts);
 
    if (0) {
       unsigned i;
-      for (i = 0; i < vertex_count; i++) {
+      for (i = 0; i < count; i++) {
          debug_printf("\n\n%s vertex %d:\n", __FUNCTION__, i);
          draw_dump_emitted_vertex( emit->vinfo, 
                                    (const uint8_t *)hw_verts + 
@@ -274,13 +275,17 @@ void draw_pt_emit_linear(struct pt_emit *emit,
       }
    }
 
+   render->unmap_vertices( render, 0, count - 1 );
+
+   render->draw_arrays(render, 0, count);
+
+   render->release_vertices(render);
 
-   render->draw_arrays(render, start, count);
+   return;
 
-   render->release_vertices(render,
-                           hw_verts,
-                           translate->key.output_stride,
-                           vertex_count);
+fail:
+   assert(0);
+   return;
 }
 
 struct pt_emit *draw_pt_emit_create( struct draw_context *draw )
index dcb7744b177fa8316bc18afea768c2c7f21e4c18..6b7d02a19bc031843bf5734874abf1cffc7d8bb9 100644 (file)
@@ -234,9 +234,11 @@ static void fetch_emit_run( struct draw_pt_middle_end *middle,
       return;
    }
 
-   hw_verts = draw->render->allocate_vertices( draw->render,
-                                               (ushort)feme->translate->key.output_stride,
-                                               (ushort)fetch_count );
+   draw->render->allocate_vertices( draw->render,
+                                    (ushort)feme->translate->key.output_stride,
+                                    (ushort)fetch_count );
+
+   hw_verts = draw->render->map_vertices( draw->render );
    if (!hw_verts) {
       assert(0);
       return;
@@ -259,6 +261,10 @@ static void fetch_emit_run( struct draw_pt_middle_end *middle,
       }
    }
 
+   draw->render->unmap_vertices( draw->render, 
+                                 0, 
+                                 (ushort)(fetch_count - 1) );
+
    /* XXX: Draw arrays path to avoid re-emitting index list again and
     * again.
     */
@@ -268,10 +274,7 @@ static void fetch_emit_run( struct draw_pt_middle_end *middle,
 
    /* Done -- that was easy, wasn't it: 
     */
-   draw->render->release_vertices( draw->render, 
-                                   hw_verts, 
-                                   feme->translate->key.output_stride, 
-                                   fetch_count );
+   draw->render->release_vertices( draw->render );
 
 }
 
@@ -288,18 +291,17 @@ static void fetch_emit_run_linear( struct draw_pt_middle_end *middle,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
-   if (count >= UNDEFINED_VERTEX_ID) {
-      assert(0);
-      return;
-   }
+   if (count >= UNDEFINED_VERTEX_ID) 
+      goto fail;
 
-   hw_verts = draw->render->allocate_vertices( draw->render,
-                                               (ushort)feme->translate->key.output_stride,
-                                               (ushort)count );
-   if (!hw_verts) {
-      assert(0);
-      return;
-   }
+   if (!draw->render->allocate_vertices( draw->render,
+                                         (ushort)feme->translate->key.output_stride,
+                                         (ushort)count )) 
+      goto fail;
+
+   hw_verts = draw->render->map_vertices( draw->render );
+   if (!hw_verts) 
+      goto fail;
 
    /* Single routine to fetch vertices and emit HW verts.
     */
@@ -317,20 +319,21 @@ static void fetch_emit_run_linear( struct draw_pt_middle_end *middle,
       }
    }
 
+   draw->render->unmap_vertices( draw->render, 0, count - 1 );
+
    /* XXX: Draw arrays path to avoid re-emitting index list again and
     * again.
     */
-   draw->render->draw_arrays( draw->render,
-                              0, /*start*/
-                              count );
+   draw->render->draw_arrays( draw->render, 0, count );
 
    /* Done -- that was easy, wasn't it:
     */
-   draw->render->release_vertices( draw->render,
-                                   hw_verts,
-                                   feme->translate->key.output_stride,
-                                   count );
+   draw->render->release_vertices( draw->render );
+   return;
 
+fail:
+   assert(0);
+   return;
 }
 
 
@@ -351,9 +354,12 @@ static boolean fetch_emit_run_linear_elts( struct draw_pt_middle_end *middle,
    if (count >= UNDEFINED_VERTEX_ID)
       return FALSE;
 
-   hw_verts = draw->render->allocate_vertices( draw->render,
-                                               (ushort)feme->translate->key.output_stride,
-                                               (ushort)count );
+   if (!draw->render->allocate_vertices( draw->render,
+                                         (ushort)feme->translate->key.output_stride,
+                                         (ushort)count ))
+      return FALSE;
+
+   hw_verts = draw->render->map_vertices( draw->render );
    if (!hw_verts) 
       return FALSE;
 
@@ -364,6 +370,8 @@ static boolean fetch_emit_run_linear_elts( struct draw_pt_middle_end *middle,
                          count,
                          hw_verts );
 
+   draw->render->unmap_vertices( draw->render, 0, (ushort)(count - 1) );
+
    /* XXX: Draw arrays path to avoid re-emitting index list again and
     * again.
     */
@@ -373,10 +381,7 @@ static boolean fetch_emit_run_linear_elts( struct draw_pt_middle_end *middle,
 
    /* Done -- that was easy, wasn't it:
     */
-   draw->render->release_vertices( draw->render,
-                                   hw_verts,
-                                   feme->translate->key.output_stride,
-                                   count );
+   draw->render->release_vertices( draw->render );
 
    return TRUE;
 }
index 84ffe3296af3e31577430f8afb679ac1dfed321c..44147aed9be33b0081452ba77461151d1e7d1588 100644 (file)
@@ -101,7 +101,8 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
    fse->key.nr_elements = MAX2(fse->key.nr_outputs,     /* outputs - translate to hw format */
                                fse->key.nr_inputs);     /* inputs - fetch from api format */
 
-   fse->key.viewport = !draw->identity_viewport;
+   fse->key.viewport = (!draw->rasterizer->bypass_vs_clip_and_viewport &&
+                        !draw->identity_viewport);
    fse->key.clip = !draw->bypass_clipping;
    fse->key.const_vbuffers = 0;
 
@@ -234,19 +235,17 @@ static void fse_run_linear( struct draw_pt_middle_end *middle,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
-   if (count >= UNDEFINED_VERTEX_ID) {
-      assert(0);
-      return;
-   }
+   if (count >= UNDEFINED_VERTEX_ID) 
+      goto fail;
 
-   hw_verts = draw->render->allocate_vertices( draw->render,
-                                               (ushort)fse->key.output_stride,
-                                               (ushort)count );
+   if (!draw->render->allocate_vertices( draw->render,
+                                         (ushort)fse->key.output_stride,
+                                         (ushort)count ))
+      goto fail;
 
-   if (!hw_verts) {
-      assert(0);
-      return;
-   }
+   hw_verts = draw->render->map_vertices( draw->render );
+   if (!hw_verts)
+      goto fail;
 
    /* Single routine to fetch vertices, run shader and emit HW verts.
     * Clipping is done elsewhere -- either by the API or on hardware,
@@ -256,13 +255,7 @@ static void fse_run_linear( struct draw_pt_middle_end *middle,
                             start, count,
                             hw_verts );
 
-   /* Draw arrays path to avoid re-emitting index list again and
-    * again.
-    */
-   draw->render->draw_arrays( draw->render,
-                              0,
-                              count );
-   
+
    if (0) {
       unsigned i;
       for (i = 0; i < count; i++) {
@@ -274,12 +267,24 @@ static void fse_run_linear( struct draw_pt_middle_end *middle,
                                    (const uint8_t *)hw_verts + fse->key.output_stride * i );
       }
    }
+   
+   draw->render->unmap_vertices( draw->render, 0, (ushort)(count - 1) );
 
+   /* Draw arrays path to avoid re-emitting index list again and
+    * again.
+    */
+   draw->render->draw_arrays( draw->render,
+                              0,
+                              count );
+   
+
+   draw->render->release_vertices( draw->render );
+
+   return;
 
-   draw->render->release_vertices( draw->render, 
-                                  hw_verts, 
-                                  fse->key.output_stride, 
-                                  count );
+fail:
+   assert(0);
+   return;
 }
 
 
@@ -298,18 +303,17 @@ fse_run(struct draw_pt_middle_end *middle,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
-   if (fetch_count >= UNDEFINED_VERTEX_ID) {
-      assert(0);
-      return;
-   }
+   if (fetch_count >= UNDEFINED_VERTEX_ID) 
+      goto fail;
 
-   hw_verts = draw->render->allocate_vertices( draw->render,
-                                               (ushort)fse->key.output_stride,
-                                               (ushort)fetch_count );
-   if (!hw_verts) {
-      assert(0);
-      return;
-   }
+   if (!draw->render->allocate_vertices( draw->render,
+                                         (ushort)fse->key.output_stride,
+                                         (ushort)fetch_count ))
+      goto fail;
+
+   hw_verts = draw->render->map_vertices( draw->render ); 
+   if (!hw_verts) 
+      goto fail;
          
                                        
    /* Single routine to fetch vertices, run shader and emit HW verts.
@@ -319,9 +323,6 @@ fse_run(struct draw_pt_middle_end *middle,
                           fetch_count,
                           hw_verts );
 
-   draw->render->draw( draw->render, 
-                       draw_elts, 
-                       draw_count );
 
    if (0) {
       unsigned i;
@@ -333,12 +334,19 @@ fse_run(struct draw_pt_middle_end *middle,
       }
    }
 
+   draw->render->unmap_vertices( draw->render, 0, (ushort)(fetch_count - 1) );
+   
+   draw->render->draw( draw->render, 
+                       draw_elts, 
+                       draw_count );
+
 
-   draw->render->release_vertices( draw->render, 
-                                   hw_verts, 
-                                   fse->key.output_stride, 
-                                   fetch_count );
+   draw->render->release_vertices( draw->render );
+   return;
 
+fail:
+   assert(0);
+   return;
 }
 
 
@@ -360,13 +368,14 @@ static boolean fse_run_linear_elts( struct draw_pt_middle_end *middle,
    if (count >= UNDEFINED_VERTEX_ID)
       return FALSE;
 
-   hw_verts = draw->render->allocate_vertices( draw->render,
-                                               (ushort)fse->key.output_stride,
-                                               (ushort)count );
+   if (!draw->render->allocate_vertices( draw->render,
+                                         (ushort)fse->key.output_stride,
+                                         (ushort)count ))
+      return FALSE;
 
-   if (!hw_verts) {
+   hw_verts = draw->render->map_vertices( draw->render );
+   if (!hw_verts) 
       return FALSE;
-   }
 
    /* Single routine to fetch vertices, run shader and emit HW verts.
     * Clipping is done elsewhere -- either by the API or on hardware,
@@ -382,11 +391,9 @@ static boolean fse_run_linear_elts( struct draw_pt_middle_end *middle,
                        draw_count );
    
 
+   draw->render->unmap_vertices( draw->render, 0, (ushort)(count - 1) );
 
-   draw->render->release_vertices( draw->render, 
-                                  hw_verts, 
-                                  fse->key.output_stride, 
-                                  count );
+   draw->render->release_vertices( draw->render );
 
    return TRUE;
 }
index ec3b41c320a1b7b6e06bb643b5088ce035e56b8e..11ac90fc56354b05f2223ebdc3e74fd55606b895 100644 (file)
@@ -84,7 +84,8 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
     */
    draw_pt_post_vs_prepare( fpme->post_vs,
                            (boolean)draw->bypass_clipping,
-                           (boolean)draw->identity_viewport,
+                           (boolean)(draw->identity_viewport ||
+                                      draw->rasterizer->bypass_vs_clip_and_viewport),
                            (boolean)draw->rasterizer->gl_rasterization_rules );
                            
 
@@ -140,9 +141,9 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
                      (char *)pipeline_verts );
 
    /* Run the shader, note that this overwrites the data[] parts of
-    * the pipeline verts.  If there is no shader, ie a bypass shader,
-    * then the inputs == outputs, and are already in the correct
-    * place.
+    * the pipeline verts.  If there is no shader, eg if
+    * bypass_vs_clip_and_viewport, then the inputs == outputs, and are
+    * already in the correct place.
     */
    if (opt & PT_SHADE)
    {
@@ -216,9 +217,9 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
                              (char *)pipeline_verts );
 
    /* Run the shader, note that this overwrites the data[] parts of
-    * the pipeline verts.  If there is no shader, ie a bypass shader,
-    * then the inputs == outputs, and are already in the correct
-    * place.
+    * the pipeline verts.  If there is no shader, ie if
+    * bypass_vs_clip_and_viewport, then the inputs == outputs, and are
+    * already in the correct place.
     */
    if (opt & PT_SHADE)
    {
@@ -251,9 +252,7 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
    else {
       draw_pt_emit_linear( fpme->emit,
                            (const float (*)[4])pipeline_verts->data,
-                           count,
                            fpme->vertex_size,
-                           0, /*start*/
                            count );
    }
 
@@ -288,9 +287,9 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle
                              (char *)pipeline_verts );
 
    /* Run the shader, note that this overwrites the data[] parts of
-    * the pipeline verts.  If there is no shader, ie a bypass shader,
-    * then the inputs == outputs, and are already in the correct
-    * place.
+    * the pipeline verts.  If there is no shader, ie if
+    * bypass_vs_clip_and_viewport, then the inputs == outputs, and are
+    * already in the correct place.
     */
    if (opt & PT_SHADE)
    {
index 96dc706b99839d4b71c83a2fc20d3f63b89ee294..00d7197b132985eb967972e42a86edea7b3c4a33 100644 (file)
@@ -200,11 +200,11 @@ boolean draw_pt_post_vs_run( struct pt_post_vs *pvs,
 
 void draw_pt_post_vs_prepare( struct pt_post_vs *pvs,
                              boolean bypass_clipping,
-                             boolean identity_viewport,
+                             boolean bypass_viewport,
                              boolean opengl )
 {
    if (bypass_clipping) {
-      if (identity_viewport)
+      if (bypass_viewport)
         pvs->run = post_vs_none;
       else
         pvs->run = post_vs_viewport;
index a1c4c14445b44267c4494130d492b1948619b020..cccd3bf4358d4ac5e97c21cfd1daf80829a0ebb5 100644 (file)
@@ -80,9 +80,14 @@ struct vbuf_render {
     * Hardware renderers will use ttm memory, others will just malloc
     * something.
     */
-   void *(*allocate_vertices)( struct vbuf_render *,
-                              ushort vertex_size,
-                              ushort nr_vertices );
+   boolean (*allocate_vertices)( struct vbuf_render *,
+                                 ushort vertex_size,
+                                 ushort nr_vertices );
+   
+   void *(*map_vertices)( struct vbuf_render * );
+   void (*unmap_vertices)( struct vbuf_render *, 
+                           ushort min_index,
+                           ushort max_index );
 
    /**
     * Notify the renderer of the current primitive when it changes.
@@ -109,10 +114,7 @@ struct vbuf_render {
    /**
     * Called when vbuf is done with this set of vertices:
     */
-   void (*release_vertices)( struct vbuf_render *,
-                            void *vertices, 
-                            unsigned vertex_size,
-                            unsigned vertices_used );
+   void (*release_vertices)( struct vbuf_render * );
 
    void (*destroy)( struct vbuf_render * );
 };
index 0c693a4a65ca486967c19a2f2ccc05c5c16a5616..9e37a26c1e2577f1c0c690657be1ca3910a75b8a 100644 (file)
@@ -32,7 +32,7 @@
 #include "util/u_memory.h"
 #include "util/u_math.h"
 #include "pipe/p_shader_tokens.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "tgsi/tgsi_parse.h"
 #include "tgsi/tgsi_util.h"
 #include "tgsi/tgsi_exec.h"
@@ -143,7 +143,7 @@ static struct x86_reg get_reg_ptr(struct aos_compilation *cp,
       return x86_make_disp(aos_get_x86(cp, 1, X86_CONSTANTS), idx * 4 * sizeof(float));
 
    default:
-      ERROR(cp, "unknown reg file");
+      AOS_ERROR(cp, "unknown reg file");
       return x86_make_reg(0,0);
    }
 }
@@ -177,7 +177,7 @@ static void spill( struct aos_compilation *cp, unsigned idx )
        (cp->xmm[idx].file != TGSI_FILE_INPUT && /* inputs are fetched into xmm & set dirty */
         cp->xmm[idx].file != TGSI_FILE_OUTPUT &&
         cp->xmm[idx].file != TGSI_FILE_TEMPORARY)) {
-      ERROR(cp, "invalid spill");
+      AOS_ERROR(cp, "invalid spill");
       return;
    }
    else {
@@ -284,6 +284,15 @@ void aos_release_xmm_reg( struct aos_compilation *cp,
 }
 
 
+static void aos_soft_release_xmm( struct aos_compilation *cp,
+                                  struct x86_reg reg )
+{
+   if (reg.file == file_XMM) {
+      assert(cp->xmm[reg.idx].last_used == cp->insn_counter);
+      cp->xmm[reg.idx].last_used = cp->insn_counter - 1;
+   }
+}
+
 
      
 /* Mark an xmm reg as holding the current copy of a shader reg.
@@ -534,7 +543,7 @@ static struct x86_reg fetch_src( struct aos_compilation *cp,
       switch (swizzle) {
       case TGSI_EXTSWIZZLE_ZERO:
       case TGSI_EXTSWIZZLE_ONE:
-         ERROR(cp, "not supporting full swizzles yet in tgsi_aos_sse2");
+         AOS_ERROR(cp, "not supporting full swizzles yet in tgsi_aos_sse2");
          break;
 
       default:
@@ -555,7 +564,7 @@ static struct x86_reg fetch_src( struct aos_compilation *cp,
          break;
 
       default:
-         ERROR(cp, "unsupported sign-mode");
+         AOS_ERROR(cp, "unsupported sign-mode");
          break;
       }
    }
@@ -584,15 +593,17 @@ static struct x86_reg fetch_src( struct aos_compilation *cp,
          sse_mulps(cp->func, dst, tmp);
 
          aos_release_xmm_reg(cp, tmp.idx);
+         aos_soft_release_xmm(cp, imm_swz);
       }
       else if (negs) {
          struct x86_reg imm_negs = aos_get_internal_xmm(cp, IMM_NEGS);
          sse_mulps(cp->func, dst, imm_negs);
+         aos_soft_release_xmm(cp, imm_negs);
       }
 
 
       if (abs && abs != 0xf) {
-         ERROR(cp, "unsupported partial abs");
+         AOS_ERROR(cp, "unsupported partial abs");
       }
       else if (abs) {
          struct x86_reg neg = aos_get_internal(cp, IMM_NEGS);
@@ -603,8 +614,10 @@ static struct x86_reg fetch_src( struct aos_compilation *cp,
          sse_maxps(cp->func, dst, tmp);
 
          aos_release_xmm_reg(cp, tmp.idx);
+         aos_soft_release_xmm(cp, neg);
       }
 
+      aos_soft_release_xmm(cp, arg0);
       return dst;
    }
       
@@ -657,7 +670,7 @@ static void x87_fld_src( struct aos_compilation *cp,
       break;
 
    default:
-      ERROR(cp, "unsupported sign-mode");
+      AOS_ERROR(cp, "unsupported sign-mode");
       break;
    }
 }
@@ -1559,7 +1572,6 @@ static boolean emit_RCP( struct aos_compilation *cp, const struct tgsi_full_inst
  */
 static boolean emit_RSQ( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
 {
-
    if (0) {
       struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
       struct x86_reg r = aos_get_xmm_reg(cp);
@@ -1568,21 +1580,30 @@ static boolean emit_RSQ( struct aos_compilation *cp, const struct tgsi_full_inst
       return TRUE;
    }
    else {
-      struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]);
-      struct x86_reg r = aos_get_xmm_reg(cp);
+      struct x86_reg arg0           = fetch_src(cp, &op->FullSrcRegisters[0]);
+      struct x86_reg r              = aos_get_xmm_reg(cp);
 
       struct x86_reg neg_half       = get_reg_ptr( cp, AOS_FILE_INTERNAL, IMM_RSQ );
       struct x86_reg one_point_five = x86_make_disp( neg_half, 4 );
       struct x86_reg src            = get_xmm_writable( cp, arg0 );
-      
-      sse_rsqrtss( cp->func, r, src  );             /* rsqrtss(a) */
-      sse_mulss(   cp->func, src, neg_half  );      /* -.5 * a */
-      sse_mulss(   cp->func, src,  r );             /* -.5 * a * r */
-      sse_mulss(   cp->func, src,  r );             /* -.5 * a * r * r */
-      sse_addss(   cp->func, src, one_point_five ); /* 1.5 - .5 * a * r * r */
-      sse_mulss(   cp->func, r,  src );             /* r * (1.5 - .5 * a * r * r) */
+      struct x86_reg neg            = aos_get_internal(cp, IMM_NEGS);
+      struct x86_reg tmp            = aos_get_xmm_reg(cp);
+
+      sse_movaps(cp->func, tmp, src);
+      sse_mulps(cp->func, tmp, neg);
+      sse_maxps(cp->func, tmp, src);
+   
+      sse_rsqrtss( cp->func, r, tmp  );             /* rsqrtss(a) */
+      sse_mulss(   cp->func, tmp, neg_half  );      /* -.5 * a */
+      sse_mulss(   cp->func, tmp,  r );             /* -.5 * a * r */
+      sse_mulss(   cp->func, tmp,  r );             /* -.5 * a * r * r */
+      sse_addss(   cp->func, tmp, one_point_five ); /* 1.5 - .5 * a * r * r */
+      sse_mulss(   cp->func, r,  tmp );             /* r * (1.5 - .5 * a * r * r) */
 
       store_scalar_dest(cp, &op->FullDstRegisters[0], r);
+
+      aos_release_xmm_reg(cp, tmp.idx);
+
       return TRUE;
    }
 }
index 264387517b082fd6d78c1e19f846765d9eb05fa1..2cf72ddf7b152150662a5dec5d4dd2921a900493 100644 (file)
@@ -204,7 +204,7 @@ struct x86_reg aos_get_internal_xmm( struct aos_compilation *cp,
                                      unsigned imm );
 
 
-#define ERROR(cp, msg)                                                  \
+#define AOS_ERROR(cp, msg)                                                  \
 do {                                                                    \
    if (0) debug_printf("%s: x86 translation failed: %s\n", __FUNCTION__, msg); \
    cp->error = 1;                                                       \
index 39f75b50b760bbb9350dc0dbf65c90513a32f3f2..a6eb37d12806daa9522f7c32028cf6e9c2c25339 100644 (file)
@@ -199,7 +199,7 @@ static boolean load_input( struct aos_compilation *cp,
       emit_load_R8G8B8A8_UNORM(cp, dataXMM, src);
       break;
    default:
-      ERROR(cp, "unhandled input format");
+      AOS_ERROR(cp, "unhandled input format");
       return FALSE;
    }
 
@@ -410,7 +410,7 @@ static boolean emit_output( struct aos_compilation *cp,
       }
       break;
    default:
-      ERROR(cp, "unhandled output format");
+      AOS_ERROR(cp, "unhandled output format");
       return FALSE;
    }
 
index e1e5cabcf55c842d05f805303a7291bd406c8e90..4984ce985c6c843fa509fda5fff881258a399e96 100644 (file)
@@ -30,7 +30,7 @@
 #include "gallivm_p.h"
 
 #include "pipe/p_shader_tokens.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 #include <llvm/BasicBlock.h>
 #include <llvm/Module.h>
index 8fa61d265ea210f4ca7cf1a2994a8fc409268244..f2ebc3f410abdc3e4d84db9fe9a51e5a91db4151 100644 (file)
@@ -4,13 +4,13 @@ include $(TOP)/configs/current
 LIBNAME = indices
 
 C_SOURCES = \
-       u_indices_gen.c 
+       u_indices_gen.c \
+       u_unfilled_gen.c 
 
 include ../../Makefile.template
 
 u_indices_gen.c: u_indices_gen.py
        python $< > $@
 
-
-symlinks:
-
+u_unfilled_gen.c: u_unfilled_gen.py
+       python $< > $@
index 65a43a9f6488516af2dfbf8bfe64e975d374c069..e5f7ee9484571ea91917ad6cbfdee60d5c1ce130 100644 (file)
@@ -7,11 +7,20 @@ env.CodeGenerate(
        command = 'python $SCRIPT > $TARGET'
 )
 
+env.CodeGenerate(
+       target = 'u_unfilled_gen.c', 
+       script = 'u_unfilled_gen.py', 
+       source = [],
+       command = 'python $SCRIPT > $TARGET'
+)
+
 indices = env.ConvenienceLibrary(
        target = 'indices',
        source = [
 #               'u_indices.c',
+#               'u_unfilled_indices.c',
                'u_indices_gen.c',
+               'u_unfilled_gen.c',
        ])
 
 auxiliaries.insert(0, indices)
index abf5a3037d1f5b9aecd1e0867850ee1288fc83b8..be522c6725284de7b9a7f3d51f34e48812cf025d 100644 (file)
@@ -80,4 +80,27 @@ int u_index_generator( unsigned hw_mask,
                        u_generate_func *out_generate );
 
 
+void u_unfilled_init( void );
+
+int u_unfilled_translator( unsigned prim,
+                           unsigned in_index_size,
+                           unsigned nr,
+                           unsigned unfilled_mode,
+                           unsigned *out_prim,
+                           unsigned *out_index_size,
+                           unsigned *out_nr,
+                           u_translate_func *out_translate );
+
+int u_unfilled_generator( unsigned prim,
+                          unsigned start,
+                          unsigned nr,
+                          unsigned unfilled_mode,
+                          unsigned *out_prim,
+                          unsigned *out_index_size,
+                          unsigned *out_nr,
+                          u_generate_func *out_generate );
+
+
+
+
 #endif
index 4c05b3eedb3763fba90fb01fa57d1ccee8c55d50..3c981e5d7f4a808a51c3f8e4c1707fdf932ca9bb 100644 (file)
@@ -34,7 +34,7 @@
 #include "indices/u_indices.h"
 #include "indices/u_indices_priv.h"
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 
index 0dc58d0cd0ea2a5455465afa6946bd066c0d50d9..af63d099302a411049fb35e455069a4c7a606a41 100644 (file)
@@ -72,7 +72,7 @@ def prolog():
 #include "indices/u_indices.h"
 #include "indices/u_indices_priv.h"
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 
diff --git a/src/gallium/auxiliary/indices/u_unfilled_gen.c b/src/gallium/auxiliary/indices/u_unfilled_gen.c
new file mode 100644 (file)
index 0000000..fd082eb
--- /dev/null
@@ -0,0 +1,1152 @@
+/* File automatically generated by u_unfilled_gen.py */
+
+/*
+ * 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
+ * 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
+ * VMWARE 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
+ * Functions to translate and generate index lists
+ */
+
+#include "indices/u_indices.h"
+#include "indices/u_indices_priv.h"
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+#include "pipe/p_defines.h"
+#include "util/u_memory.h"
+
+
+static unsigned out_size_idx( unsigned index_size )
+{
+   switch (index_size) {
+   case 4: return OUT_UINT;
+   case 2: return OUT_USHORT;
+   default: assert(0); return OUT_USHORT;
+   }
+}
+
+static unsigned in_size_idx( unsigned index_size )
+{
+   switch (index_size) {
+   case 4: return IN_UINT;
+   case 2: return IN_USHORT;
+   case 1: return IN_UBYTE;
+   default: assert(0); return IN_UBYTE;
+   }
+}
+
+
+static u_generate_func generate_line[OUT_COUNT][PRIM_COUNT];
+static u_translate_func translate_line[IN_COUNT][OUT_COUNT][PRIM_COUNT];
+
+
+static void generate_tris_ushort(
+    unsigned nr,
+    void *_out )
+{
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i+=3) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1);
+      (out+j)[0] = (ushort)(i);
+      (out+j)[1] = (ushort)(i+1);
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)(i+1);
+      (out+j+2)[1] = (ushort)(i+2);
+      debug_printf("  line %d %d\n", (int)i+2, (int)i);
+      (out+j+4)[0] = (ushort)(i+2);
+      (out+j+4)[1] = (ushort)(i);
+   }
+}
+static void generate_tristrip_ushort(
+    unsigned nr,
+    void *_out )
+{
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
+      (out+j)[0] = (ushort)(i);
+      (out+j)[1] = (ushort)(i+1/*+(i&1)*/);
+      debug_printf("  line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
+      (out+j+2)[0] = (ushort)(i+1/*+(i&1)*/);
+      (out+j+2)[1] = (ushort)(i+2/*-(i&1)*/);
+      debug_printf("  line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
+      (out+j+4)[0] = (ushort)(i+2/*-(i&1)*/);
+      (out+j+4)[1] = (ushort)(i);
+   }
+}
+static void generate_trifan_ushort(
+    unsigned nr,
+    void *_out )
+{
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (ushort)(0);
+      (out+j)[1] = (ushort)(i+1);
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)(i+1);
+      (out+j+2)[1] = (ushort)(i+2);
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (ushort)(i+2);
+      (out+j+4)[1] = (ushort)(0);
+   }
+}
+static void generate_quads_ushort(
+    unsigned nr,
+    void *_out )
+{
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=4) { 
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j)[0] = (ushort)(i+0);
+      (out+j)[1] = (ushort)(i+1);
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)(i+1);
+      (out+j+2)[1] = (ushort)(i+2);
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+3);
+      (out+j+4)[0] = (ushort)(i+2);
+      (out+j+4)[1] = (ushort)(i+3);
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+0);
+      (out+j+6)[0] = (ushort)(i+3);
+      (out+j+6)[1] = (ushort)(i+0);
+   }
+}
+static void generate_quadstrip_ushort(
+    unsigned nr,
+    void *_out )
+{
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=2) { 
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+0);
+      (out+j)[0] = (ushort)(i+2);
+      (out+j)[1] = (ushort)(i+0);
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j+2)[0] = (ushort)(i+0);
+      (out+j+2)[1] = (ushort)(i+1);
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+3);
+      (out+j+4)[0] = (ushort)(i+1);
+      (out+j+4)[1] = (ushort)(i+3);
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+2);
+      (out+j+6)[0] = (ushort)(i+3);
+      (out+j+6)[1] = (ushort)(i+2);
+   }
+}
+static void generate_polygon_ushort(
+    unsigned nr,
+    void *_out )
+{
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (ushort)(0);
+      (out+j)[1] = (ushort)(i+1);
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)(i+1);
+      (out+j+2)[1] = (ushort)(i+2);
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (ushort)(i+2);
+      (out+j+4)[1] = (ushort)(0);
+   }
+}
+static void generate_tris_uint(
+    unsigned nr,
+    void *_out )
+{
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i+=3) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1);
+      (out+j)[0] = (uint)(i);
+      (out+j)[1] = (uint)(i+1);
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)(i+1);
+      (out+j+2)[1] = (uint)(i+2);
+      debug_printf("  line %d %d\n", (int)i+2, (int)i);
+      (out+j+4)[0] = (uint)(i+2);
+      (out+j+4)[1] = (uint)(i);
+   }
+}
+static void generate_tristrip_uint(
+    unsigned nr,
+    void *_out )
+{
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
+      (out+j)[0] = (uint)(i);
+      (out+j)[1] = (uint)(i+1/*+(i&1)*/);
+      debug_printf("  line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
+      (out+j+2)[0] = (uint)(i+1/*+(i&1)*/);
+      (out+j+2)[1] = (uint)(i+2/*-(i&1)*/);
+      debug_printf("  line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
+      (out+j+4)[0] = (uint)(i+2/*-(i&1)*/);
+      (out+j+4)[1] = (uint)(i);
+   }
+}
+static void generate_trifan_uint(
+    unsigned nr,
+    void *_out )
+{
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (uint)(0);
+      (out+j)[1] = (uint)(i+1);
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)(i+1);
+      (out+j+2)[1] = (uint)(i+2);
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (uint)(i+2);
+      (out+j+4)[1] = (uint)(0);
+   }
+}
+static void generate_quads_uint(
+    unsigned nr,
+    void *_out )
+{
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=4) { 
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j)[0] = (uint)(i+0);
+      (out+j)[1] = (uint)(i+1);
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)(i+1);
+      (out+j+2)[1] = (uint)(i+2);
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+3);
+      (out+j+4)[0] = (uint)(i+2);
+      (out+j+4)[1] = (uint)(i+3);
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+0);
+      (out+j+6)[0] = (uint)(i+3);
+      (out+j+6)[1] = (uint)(i+0);
+   }
+}
+static void generate_quadstrip_uint(
+    unsigned nr,
+    void *_out )
+{
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=2) { 
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+0);
+      (out+j)[0] = (uint)(i+2);
+      (out+j)[1] = (uint)(i+0);
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j+2)[0] = (uint)(i+0);
+      (out+j+2)[1] = (uint)(i+1);
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+3);
+      (out+j+4)[0] = (uint)(i+1);
+      (out+j+4)[1] = (uint)(i+3);
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+2);
+      (out+j+6)[0] = (uint)(i+3);
+      (out+j+6)[1] = (uint)(i+2);
+   }
+}
+static void generate_polygon_uint(
+    unsigned nr,
+    void *_out )
+{
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (uint)(0);
+      (out+j)[1] = (uint)(i+1);
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)(i+1);
+      (out+j+2)[1] = (uint)(i+2);
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (uint)(i+2);
+      (out+j+4)[1] = (uint)(0);
+   }
+}
+static void translate_tris_ubyte2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i+=3) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1);
+      (out+j)[0] = (ushort)in[i];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[i];
+   }
+}
+static void translate_tristrip_ubyte2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
+      (out+j)[0] = (ushort)in[i];
+      (out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
+      (out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
+      (out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
+      (out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
+      (out+j+4)[1] = (ushort)in[i];
+   }
+}
+static void translate_trifan_ubyte2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (ushort)in[0];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[0];
+   }
+}
+static void translate_quads_ubyte2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=4) { 
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j)[0] = (ushort)in[i+0];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+3);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+0);
+      (out+j+6)[0] = (ushort)in[i+3];
+      (out+j+6)[1] = (ushort)in[i+0];
+   }
+}
+static void translate_quadstrip_ubyte2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=2) { 
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+0);
+      (out+j)[0] = (ushort)in[i+2];
+      (out+j)[1] = (ushort)in[i+0];
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j+2)[0] = (ushort)in[i+0];
+      (out+j+2)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+3);
+      (out+j+4)[0] = (ushort)in[i+1];
+      (out+j+4)[1] = (ushort)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+2);
+      (out+j+6)[0] = (ushort)in[i+3];
+      (out+j+6)[1] = (ushort)in[i+2];
+   }
+}
+static void translate_polygon_ubyte2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (ushort)in[0];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[0];
+   }
+}
+static void translate_tris_ubyte2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i+=3) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1);
+      (out+j)[0] = (uint)in[i];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[i];
+   }
+}
+static void translate_tristrip_ubyte2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
+      (out+j)[0] = (uint)in[i];
+      (out+j)[1] = (uint)in[i+1/*+(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
+      (out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
+      (out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
+      (out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
+      (out+j+4)[1] = (uint)in[i];
+   }
+}
+static void translate_trifan_ubyte2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (uint)in[0];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[0];
+   }
+}
+static void translate_quads_ubyte2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=4) { 
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j)[0] = (uint)in[i+0];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+3);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+0);
+      (out+j+6)[0] = (uint)in[i+3];
+      (out+j+6)[1] = (uint)in[i+0];
+   }
+}
+static void translate_quadstrip_ubyte2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=2) { 
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+0);
+      (out+j)[0] = (uint)in[i+2];
+      (out+j)[1] = (uint)in[i+0];
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j+2)[0] = (uint)in[i+0];
+      (out+j+2)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+3);
+      (out+j+4)[0] = (uint)in[i+1];
+      (out+j+4)[1] = (uint)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+2);
+      (out+j+6)[0] = (uint)in[i+3];
+      (out+j+6)[1] = (uint)in[i+2];
+   }
+}
+static void translate_polygon_ubyte2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ubyte*in = (const ubyte*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (uint)in[0];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[0];
+   }
+}
+static void translate_tris_ushort2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i+=3) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1);
+      (out+j)[0] = (ushort)in[i];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[i];
+   }
+}
+static void translate_tristrip_ushort2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
+      (out+j)[0] = (ushort)in[i];
+      (out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
+      (out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
+      (out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
+      (out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
+      (out+j+4)[1] = (ushort)in[i];
+   }
+}
+static void translate_trifan_ushort2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (ushort)in[0];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[0];
+   }
+}
+static void translate_quads_ushort2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=4) { 
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j)[0] = (ushort)in[i+0];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+3);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+0);
+      (out+j+6)[0] = (ushort)in[i+3];
+      (out+j+6)[1] = (ushort)in[i+0];
+   }
+}
+static void translate_quadstrip_ushort2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=2) { 
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+0);
+      (out+j)[0] = (ushort)in[i+2];
+      (out+j)[1] = (ushort)in[i+0];
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j+2)[0] = (ushort)in[i+0];
+      (out+j+2)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+3);
+      (out+j+4)[0] = (ushort)in[i+1];
+      (out+j+4)[1] = (ushort)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+2);
+      (out+j+6)[0] = (ushort)in[i+3];
+      (out+j+6)[1] = (ushort)in[i+2];
+   }
+}
+static void translate_polygon_ushort2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (ushort)in[0];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[0];
+   }
+}
+static void translate_tris_ushort2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i+=3) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1);
+      (out+j)[0] = (uint)in[i];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[i];
+   }
+}
+static void translate_tristrip_ushort2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
+      (out+j)[0] = (uint)in[i];
+      (out+j)[1] = (uint)in[i+1/*+(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
+      (out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
+      (out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
+      (out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
+      (out+j+4)[1] = (uint)in[i];
+   }
+}
+static void translate_trifan_ushort2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (uint)in[0];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[0];
+   }
+}
+static void translate_quads_ushort2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=4) { 
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j)[0] = (uint)in[i+0];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+3);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+0);
+      (out+j+6)[0] = (uint)in[i+3];
+      (out+j+6)[1] = (uint)in[i+0];
+   }
+}
+static void translate_quadstrip_ushort2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=2) { 
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+0);
+      (out+j)[0] = (uint)in[i+2];
+      (out+j)[1] = (uint)in[i+0];
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j+2)[0] = (uint)in[i+0];
+      (out+j+2)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+3);
+      (out+j+4)[0] = (uint)in[i+1];
+      (out+j+4)[1] = (uint)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+2);
+      (out+j+6)[0] = (uint)in[i+3];
+      (out+j+6)[1] = (uint)in[i+2];
+   }
+}
+static void translate_polygon_ushort2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const ushort*in = (const ushort*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (uint)in[0];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[0];
+   }
+}
+static void translate_tris_uint2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i+=3) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1);
+      (out+j)[0] = (ushort)in[i];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[i];
+   }
+}
+static void translate_tristrip_uint2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
+      (out+j)[0] = (ushort)in[i];
+      (out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
+      (out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
+      (out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
+      (out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
+      (out+j+4)[1] = (ushort)in[i];
+   }
+}
+static void translate_trifan_uint2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (ushort)in[0];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[0];
+   }
+}
+static void translate_quads_uint2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=4) { 
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j)[0] = (ushort)in[i+0];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+3);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+0);
+      (out+j+6)[0] = (ushort)in[i+3];
+      (out+j+6)[1] = (ushort)in[i+0];
+   }
+}
+static void translate_quadstrip_uint2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=2) { 
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+0);
+      (out+j)[0] = (ushort)in[i+2];
+      (out+j)[1] = (ushort)in[i+0];
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j+2)[0] = (ushort)in[i+0];
+      (out+j+2)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+3);
+      (out+j+4)[0] = (ushort)in[i+1];
+      (out+j+4)[1] = (ushort)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+2);
+      (out+j+6)[0] = (ushort)in[i+3];
+      (out+j+6)[1] = (ushort)in[i+2];
+   }
+}
+static void translate_polygon_uint2ushort(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  ushort *out = (ushort*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (ushort)in[0];
+      (out+j)[1] = (ushort)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (ushort)in[i+1];
+      (out+j+2)[1] = (ushort)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (ushort)in[i+2];
+      (out+j+4)[1] = (ushort)in[0];
+   }
+}
+static void translate_tris_uint2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i+=3) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1);
+      (out+j)[0] = (uint)in[i];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[i];
+   }
+}
+static void translate_tristrip_uint2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
+      (out+j)[0] = (uint)in[i];
+      (out+j)[1] = (uint)in[i+1/*+(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
+      (out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
+      (out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
+      debug_printf("  line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
+      (out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
+      (out+j+4)[1] = (uint)in[i];
+   }
+}
+static void translate_trifan_uint2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (uint)in[0];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[0];
+   }
+}
+static void translate_quads_uint2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=4) { 
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j)[0] = (uint)in[i+0];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+3);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+0);
+      (out+j+6)[0] = (uint)in[i+3];
+      (out+j+6)[1] = (uint)in[i+0];
+   }
+}
+static void translate_quadstrip_uint2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=8, i+=2) { 
+      debug_printf("  line %d %d\n", (int)i+2, (int)i+0);
+      (out+j)[0] = (uint)in[i+2];
+      (out+j)[1] = (uint)in[i+0];
+      debug_printf("  line %d %d\n", (int)i+0, (int)i+1);
+      (out+j+2)[0] = (uint)in[i+0];
+      (out+j+2)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+3);
+      (out+j+4)[0] = (uint)in[i+1];
+      (out+j+4)[1] = (uint)in[i+3];
+      debug_printf("  line %d %d\n", (int)i+3, (int)i+2);
+      (out+j+6)[0] = (uint)in[i+3];
+      (out+j+6)[1] = (uint)in[i+2];
+   }
+}
+static void translate_polygon_uint2uint(
+    const void * _in,
+    unsigned nr,
+    void *_out )
+{
+  const uint*in = (const uint*)_in;
+  uint *out = (uint*)_out;
+  unsigned i, j;
+  (void)j;
+  for (j = i = 0; j < nr; j+=6, i++) { 
+      debug_printf("  line %d %d\n", (int)0, (int)i+1);
+      (out+j)[0] = (uint)in[0];
+      (out+j)[1] = (uint)in[i+1];
+      debug_printf("  line %d %d\n", (int)i+1, (int)i+2);
+      (out+j+2)[0] = (uint)in[i+1];
+      (out+j+2)[1] = (uint)in[i+2];
+      debug_printf("  line %d %d\n", (int)i+2, (int)0);
+      (out+j+4)[0] = (uint)in[i+2];
+      (out+j+4)[1] = (uint)in[0];
+   }
+}
+void u_unfilled_init( void )
+{
+  static int firsttime = 1;
+  if (!firsttime) return;
+  firsttime = 0;
+generate_line[OUT_USHORT][PIPE_PRIM_TRIANGLES] = generate_tris_ushort;
+generate_line[OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = generate_trifan_ushort;
+generate_line[OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = generate_tristrip_ushort;
+generate_line[OUT_USHORT][PIPE_PRIM_QUADS] = generate_quads_ushort;
+generate_line[OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = generate_quadstrip_ushort;
+generate_line[OUT_USHORT][PIPE_PRIM_POLYGON] = generate_polygon_ushort;
+generate_line[OUT_UINT][PIPE_PRIM_TRIANGLES] = generate_tris_uint;
+generate_line[OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = generate_trifan_uint;
+generate_line[OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = generate_tristrip_uint;
+generate_line[OUT_UINT][PIPE_PRIM_QUADS] = generate_quads_uint;
+generate_line[OUT_UINT][PIPE_PRIM_QUAD_STRIP] = generate_quadstrip_uint;
+generate_line[OUT_UINT][PIPE_PRIM_POLYGON] = generate_polygon_uint;
+translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_TRIANGLES] = translate_tris_ubyte2ushort;
+translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ubyte2ushort;
+translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ubyte2ushort;
+translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_QUADS] = translate_quads_ubyte2ushort;
+translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ubyte2ushort;
+translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_POLYGON] = translate_polygon_ubyte2ushort;
+translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_TRIANGLES] = translate_tris_ubyte2uint;
+translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ubyte2uint;
+translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ubyte2uint;
+translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_QUADS] = translate_quads_ubyte2uint;
+translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ubyte2uint;
+translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_POLYGON] = translate_polygon_ubyte2uint;
+translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_TRIANGLES] = translate_tris_ushort2ushort;
+translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ushort2ushort;
+translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ushort2ushort;
+translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_QUADS] = translate_quads_ushort2ushort;
+translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ushort2ushort;
+translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_POLYGON] = translate_polygon_ushort2ushort;
+translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_TRIANGLES] = translate_tris_ushort2uint;
+translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ushort2uint;
+translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ushort2uint;
+translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_QUADS] = translate_quads_ushort2uint;
+translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ushort2uint;
+translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_POLYGON] = translate_polygon_ushort2uint;
+translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_TRIANGLES] = translate_tris_uint2ushort;
+translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_uint2ushort;
+translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_uint2ushort;
+translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_QUADS] = translate_quads_uint2ushort;
+translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_uint2ushort;
+translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_POLYGON] = translate_polygon_uint2ushort;
+translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_TRIANGLES] = translate_tris_uint2uint;
+translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_uint2uint;
+translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_uint2uint;
+translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_QUADS] = translate_quads_uint2uint;
+translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_uint2uint;
+translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_POLYGON] = translate_polygon_uint2uint;
+}
+#include "indices/u_unfilled_indices.c"
diff --git a/src/gallium/auxiliary/indices/u_unfilled_gen.py b/src/gallium/auxiliary/indices/u_unfilled_gen.py
new file mode 100644 (file)
index 0000000..d0344fe
--- /dev/null
@@ -0,0 +1,247 @@
+#!/usr/bin/env python
+copyright = '''
+/*
+ * 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
+ * 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
+ * VMWARE 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.
+ */
+'''
+
+GENERATE, UBYTE, USHORT, UINT = 'generate', 'ubyte', 'ushort', 'uint'
+FIRST, LAST = 'first', 'last'
+
+INTYPES = (GENERATE, UBYTE, USHORT, UINT)
+OUTTYPES = (USHORT, UINT)
+PRIMS=('tris', 
+       'trifan', 
+       'tristrip', 
+       'quads', 
+       'quadstrip', 
+       'polygon')
+
+LONGPRIMS=('PIPE_PRIM_TRIANGLES', 
+           'PIPE_PRIM_TRIANGLE_FAN', 
+           'PIPE_PRIM_TRIANGLE_STRIP', 
+           'PIPE_PRIM_QUADS', 
+           'PIPE_PRIM_QUAD_STRIP', 
+           'PIPE_PRIM_POLYGON')
+
+longprim = dict(zip(PRIMS, LONGPRIMS))
+intype_idx = dict(ubyte='IN_UBYTE', ushort='IN_USHORT', uint='IN_UINT')
+outtype_idx = dict(ushort='OUT_USHORT', uint='OUT_UINT')
+
+
+def prolog():
+    print '''/* File automatically generated by u_unfilled_gen.py */'''
+    print copyright
+    print r'''
+
+/**
+ * @file
+ * Functions to translate and generate index lists
+ */
+
+#include "indices/u_indices.h"
+#include "indices/u_indices_priv.h"
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+#include "pipe/p_defines.h"
+#include "util/u_memory.h"
+
+
+static unsigned out_size_idx( unsigned index_size )
+{
+   switch (index_size) {
+   case 4: return OUT_UINT;
+   case 2: return OUT_USHORT;
+   default: assert(0); return OUT_USHORT;
+   }
+}
+
+static unsigned in_size_idx( unsigned index_size )
+{
+   switch (index_size) {
+   case 4: return IN_UINT;
+   case 2: return IN_USHORT;
+   case 1: return IN_UBYTE;
+   default: assert(0); return IN_UBYTE;
+   }
+}
+
+
+static u_generate_func generate_line[OUT_COUNT][PRIM_COUNT];
+static u_translate_func translate_line[IN_COUNT][OUT_COUNT][PRIM_COUNT];
+
+'''
+
+def vert( intype, outtype, v0 ):
+    if intype == GENERATE:
+        return '(' + outtype + ')(' + v0 + ')'
+    else:
+        return '(' + outtype + ')in[' + v0 + ']'
+
+def line( intype, outtype, ptr, v0, v1 ):
+    print '      debug_printf("  line %d %d\\n", (int)' + v0 + ', (int)' + v1 + ');'
+    print '      (' + ptr + ')[0] = ' + vert( intype, outtype, v0 ) + ';'
+    print '      (' + ptr + ')[1] = ' + vert( intype, outtype, v1 ) + ';'
+
+# XXX: have the opportunity here to avoid over-drawing shared lines in
+# tristrips, fans, etc, by integrating this into the calling functions
+# and only emitting each line at most once.
+# 
+def do_tri( intype, outtype, ptr, v0, v1, v2 ):
+    line( intype, outtype, ptr, v0, v1 )
+    line( intype, outtype, ptr + '+2', v1, v2 )
+    line( intype, outtype, ptr + '+4', v2, v0 )
+
+def do_quad( intype, outtype, ptr, v0, v1, v2, v3 ):
+    line( intype, outtype, ptr, v0, v1 )
+    line( intype, outtype, ptr + '+2', v1, v2 )
+    line( intype, outtype, ptr + '+4', v2, v3 )
+    line( intype, outtype, ptr + '+6', v3, v0 )
+
+def name(intype, outtype, prim):
+    if intype == GENERATE:
+        return 'generate_' + prim + '_' + outtype
+    else:
+        return 'translate_' + prim + '_' + intype + '2' + outtype
+
+def preamble(intype, outtype, prim):
+    print 'static void ' + name( intype, outtype, prim ) + '('
+    if intype != GENERATE:
+        print '    const void * _in,'
+    print '    unsigned nr,'
+    print '    void *_out )'
+    print '{'
+    if intype != GENERATE:
+        print '  const ' + intype + '*in = (const ' + intype + '*)_in;'
+    print '  ' + outtype + ' *out = (' + outtype + '*)_out;'
+    print '  unsigned i, j;'
+    print '  (void)j;'
+
+def postamble():
+    print '}'
+
+
+def tris(intype, outtype):
+    preamble(intype, outtype, prim='tris')
+    print '  for (j = i = 0; j < nr; j+=6, i+=3) { '
+    do_tri( intype, outtype, 'out+j',  'i', 'i+1', 'i+2' );
+    print '   }'
+    postamble()
+
+
+def tristrip(intype, outtype):
+    preamble(intype, outtype, prim='tristrip')
+    print '  for (j = i = 0; j < nr; j+=6, i++) { '
+    do_tri( intype, outtype, 'out+j',  'i', 'i+1/*+(i&1)*/', 'i+2/*-(i&1)*/' );
+    print '   }'
+    postamble()
+
+
+def trifan(intype, outtype):
+    preamble(intype, outtype, prim='trifan')
+    print '  for (j = i = 0; j < nr; j+=6, i++) { '
+    do_tri( intype, outtype, 'out+j',  '0', 'i+1', 'i+2' );
+    print '   }'
+    postamble()
+
+
+
+def polygon(intype, outtype):
+    preamble(intype, outtype, prim='polygon')
+    print '  for (j = i = 0; j < nr; j+=6, i++) { '
+    do_tri( intype, outtype, 'out+j',  '0', 'i+1', 'i+2' );
+    print '   }'
+    postamble()
+
+
+def quads(intype, outtype):
+    preamble(intype, outtype, prim='quads')
+    print '  for (j = i = 0; j < nr; j+=8, i+=4) { '
+    do_quad( intype, outtype, 'out+j', 'i+0', 'i+1', 'i+2', 'i+3' );
+    print '   }'
+    postamble()
+
+
+def quadstrip(intype, outtype):
+    preamble(intype, outtype, prim='quadstrip')
+    print '  for (j = i = 0; j < nr; j+=8, i+=2) { '
+    do_quad( intype, outtype, 'out+j', 'i+2', 'i+0', 'i+1', 'i+3' );
+    print '   }'
+    postamble()
+
+
+def emit_funcs():
+    for intype in INTYPES:
+        for outtype in OUTTYPES:
+            tris(intype, outtype)
+            tristrip(intype, outtype)
+            trifan(intype, outtype)
+            quads(intype, outtype)
+            quadstrip(intype, outtype)
+            polygon(intype, outtype)
+
+def init(intype, outtype, prim):
+    if intype == GENERATE:
+        print ('generate_line[' + 
+               outtype_idx[outtype] + 
+               '][' + longprim[prim] + 
+               '] = ' + name( intype, outtype, prim ) + ';')
+    else:
+        print ('translate_line[' + 
+               intype_idx[intype] + 
+               '][' + outtype_idx[outtype] + 
+               '][' + longprim[prim] + 
+               '] = ' + name( intype, outtype, prim ) + ';')
+
+
+def emit_all_inits():
+    for intype in INTYPES:
+        for outtype in OUTTYPES:
+            for prim in PRIMS:
+                init(intype, outtype, prim)
+
+def emit_init():
+    print 'void u_unfilled_init( void )'
+    print '{'
+    print '  static int firsttime = 1;'
+    print '  if (!firsttime) return;'
+    print '  firsttime = 0;'
+    emit_all_inits()
+    print '}'
+
+
+    
+
+def epilog():
+    print '#include "indices/u_unfilled_indices.c"'
+
+
+def main():
+    prolog()
+    emit_funcs()
+    emit_init()
+    epilog()
+
+
+if __name__ == '__main__':
+    main()
diff --git a/src/gallium/auxiliary/indices/u_unfilled_indices.c b/src/gallium/auxiliary/indices/u_unfilled_indices.c
new file mode 100644 (file)
index 0000000..26c5d4d
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * 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
+ * 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
+ * VMWARE 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 "u_indices.h"
+#include "u_indices_priv.h"
+
+
+static void translate_ubyte_ushort( const void *in,
+                                    unsigned nr,
+                                    void *out )
+{
+   const ubyte *in_ub = (const ubyte *)in;
+   ushort *out_us = (ushort *)out;
+   unsigned i;
+   for (i = 0; i < nr; i++)
+      out_us[i] = (ushort) in_ub[i];
+}
+
+static void translate_memcpy_ushort( const void *in,
+                                     unsigned nr,
+                                     void *out )
+{
+   memcpy(out, in, nr*sizeof(short));
+}
+                              
+static void translate_memcpy_uint( const void *in,
+                                   unsigned nr,
+                                   void *out )
+{
+   memcpy(out, in, nr*sizeof(int));
+}
+
+
+static void generate_linear_ushort( unsigned nr,
+                                    void *out )
+{
+   ushort *out_us = (ushort *)out;
+   unsigned i;
+   for (i = 0; i < nr; i++)
+      out_us[i] = (ushort) i;
+}
+                              
+static void generate_linear_uint( unsigned nr,
+                                  void *out )
+{
+   unsigned *out_ui = (unsigned *)out;
+   unsigned i;
+   for (i = 0; i < nr; i++)
+      out_ui[i] = i;
+}
+
+
+static unsigned nr_lines( unsigned prim,
+                          unsigned nr )
+{
+   switch (prim) {
+   case PIPE_PRIM_TRIANGLES:
+      return (nr / 3) * 6; 
+   case PIPE_PRIM_TRIANGLE_STRIP:
+      return (nr - 2) * 6;
+   case PIPE_PRIM_TRIANGLE_FAN:
+      return (nr - 2)  * 6;
+   case PIPE_PRIM_QUADS:
+      return (nr / 4) * 8;
+   case PIPE_PRIM_QUAD_STRIP:
+      return (nr - 2) / 2 * 8;
+   case PIPE_PRIM_POLYGON:
+      return (nr - 2) * 6;
+   default:
+      assert(0);
+      return 0;
+   }
+}
+                              
+
+
+int u_unfilled_translator( unsigned prim,
+                        unsigned in_index_size,
+                        unsigned nr,
+                        unsigned unfilled_mode,
+                        unsigned *out_prim,
+                        unsigned *out_index_size,
+                        unsigned *out_nr,
+                        u_translate_func *out_translate )
+{
+   unsigned in_idx;
+   unsigned out_idx;
+
+   u_unfilled_init();
+
+   in_idx = in_size_idx(in_index_size);
+   *out_index_size = (in_index_size == 4) ? 4 : 2;
+   out_idx = out_size_idx(*out_index_size);
+
+   if (unfilled_mode == PIPE_POLYGON_MODE_POINT) 
+   {
+      *out_prim = PIPE_PRIM_POINTS;
+      *out_nr = nr;
+
+      switch (in_index_size)
+      {
+      case 1:
+         *out_translate = translate_ubyte_ushort;
+         return U_TRANSLATE_NORMAL;
+      case 2:
+         *out_translate = translate_memcpy_uint;
+         return U_TRANSLATE_MEMCPY;
+      case 4:
+         *out_translate = translate_memcpy_ushort;
+         return U_TRANSLATE_MEMCPY;
+      default:
+         *out_translate = translate_memcpy_uint;
+         *out_nr = 0;
+         assert(0);
+         return U_TRANSLATE_ERROR;
+      }
+   }
+   else {
+      assert(unfilled_mode == PIPE_POLYGON_MODE_LINE);
+      *out_prim = PIPE_PRIM_LINES;
+      *out_translate = translate_line[in_idx][out_idx][prim];
+      *out_nr = nr_lines( prim, nr );
+      return U_TRANSLATE_NORMAL;
+   }
+}
+
+
+
+int u_unfilled_generator( unsigned prim,
+                          unsigned start,
+                          unsigned nr,
+                          unsigned unfilled_mode,
+                          unsigned *out_prim,
+                          unsigned *out_index_size,
+                          unsigned *out_nr,
+                          u_generate_func *out_generate )
+{
+   unsigned out_idx;
+
+   u_unfilled_init();
+
+   *out_index_size = ((start + nr) > 0xfffe) ? 4 : 2;
+   out_idx = out_size_idx(*out_index_size);
+
+   if (unfilled_mode == PIPE_POLYGON_MODE_POINT) {
+
+      if (*out_index_size == 4)
+         *out_generate = generate_linear_uint;
+      else
+         *out_generate = generate_linear_ushort;
+
+      *out_prim = PIPE_PRIM_POINTS;
+      *out_nr = nr;
+      return U_GENERATE_LINEAR;
+   }
+   else {
+      assert(unfilled_mode == PIPE_POLYGON_MODE_LINE);
+      *out_prim = PIPE_PRIM_LINES;
+      *out_generate = generate_line[out_idx][prim];
+      *out_nr = nr_lines( prim, nr );
+
+      return U_GENERATE_REUSABLE;
+   }
+}
+
index 3b501c51dffcdb2210947682c663d78b61c0731d..1c00ba8d986d36b6c62e885be7521f48ff6d9091 100644 (file)
@@ -17,6 +17,3 @@ C_SOURCES = \
        pb_validate.c
 
 include ../../Makefile.template
-
-symlinks:
-
index d8f1f02d681b792f40c8f8fa8200983528767760..2a1315922a8cfb3e76d9cc112f166ad34999d2d2 100644 (file)
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_error.h"
 #include "pipe/p_state.h"
-#include "pipe/p_inlines.h"
 
 
 #ifdef __cplusplus
@@ -159,7 +158,7 @@ pb_map(struct pb_buffer *buf,
    assert(buf);
    if(!buf)
       return NULL;
-   assert(buf->base.refcount > 0);
+   assert(p_atomic_read(&buf->base.reference.count) > 0);
    return buf->vtbl->map(buf, flags);
 }
 
@@ -170,7 +169,7 @@ pb_unmap(struct pb_buffer *buf)
    assert(buf);
    if(!buf)
       return;
-   assert(buf->base.refcount > 0);
+   assert(p_atomic_read(&buf->base.reference.count) > 0);
    buf->vtbl->unmap(buf);
 }
 
@@ -186,7 +185,7 @@ pb_get_base_buffer( struct pb_buffer *buf,
       offset = 0;
       return;
    }
-   assert(buf->base.refcount > 0);
+   assert(p_atomic_read(&buf->base.reference.count) > 0);
    assert(buf->vtbl->get_base_buffer);
    buf->vtbl->get_base_buffer(buf, base_buf, offset);
    assert(*base_buf);
@@ -222,29 +221,18 @@ pb_destroy(struct pb_buffer *buf)
    assert(buf);
    if(!buf)
       return;
-   assert(buf->base.refcount == 0);
+   assert(p_atomic_read(&buf->base.reference.count) == 0);
    buf->vtbl->destroy(buf);
 }
 
-
-/* XXX: thread safety issues!
- */
 static INLINE void
 pb_reference(struct pb_buffer **dst,
              struct pb_buffer *src)
 {
-   if (src) {
-      assert(src->base.refcount);
-      src->base.refcount++;
-   }
-
-   if (*dst) {
-      assert((*dst)->base.refcount);
-      if(--(*dst)->base.refcount == 0)
-         pb_destroy( *dst );
-   }
+   struct pb_buffer *old = *dst;
 
-   *dst = src;
+   if (pipe_reference((struct pipe_reference**)dst, &src->base.reference))
+      pb_destroy( old );
 }
 
 
index f9e62264368e7b83625bb096462f14b678c06564..1bdf7a0b2da7c89e211483ee656200c6510fa1ef 100644 (file)
 
 #include "pipe/p_config.h"
 
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
 #include <unistd.h>
 #include <sched.h>
 #endif
 
 #include "pipe/p_compiler.h"
 #include "pipe/p_error.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_thread.h"
 #include "util/u_memory.h"
 #include "util/u_double_list.h"
@@ -66,8 +66,12 @@ struct fenced_buffer_list
    struct pb_fence_ops *ops;
    
    size_t numDelayed;
-   
    struct list_head delayed;
+   
+#ifdef DEBUG
+   size_t numUnfenced;
+   struct list_head unfenced;
+#endif
 };
 
 
@@ -111,12 +115,15 @@ _fenced_buffer_add(struct fenced_buffer *fenced_buf)
 {
    struct fenced_buffer_list *fenced_list = fenced_buf->list;
 
-   assert(fenced_buf->base.base.refcount);
+   assert(p_atomic_read(&fenced_buf->base.base.reference.count));
    assert(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
    assert(fenced_buf->fence);
 
-   assert(!fenced_buf->head.prev);
-   assert(!fenced_buf->head.next);
+#ifdef DEBUG
+   LIST_DEL(&fenced_buf->head);
+   assert(fenced_list->numUnfenced);
+   --fenced_list->numUnfenced;
+#endif
    LIST_ADDTAIL(&fenced_buf->head, &fenced_list->delayed);
    ++fenced_list->numDelayed;
 }
@@ -128,8 +135,19 @@ _fenced_buffer_add(struct fenced_buffer *fenced_buf)
 static INLINE void
 _fenced_buffer_destroy(struct fenced_buffer *fenced_buf)
 {
-   assert(!fenced_buf->base.base.refcount);
+   struct fenced_buffer_list *fenced_list = fenced_buf->list;
+   
+   assert(p_atomic_read(&fenced_buf->base.base.reference.count) == 0);
    assert(!fenced_buf->fence);
+#ifdef DEBUG
+   assert(fenced_buf->head.prev);
+   assert(fenced_buf->head.next);
+   LIST_DEL(&fenced_buf->head);
+   assert(fenced_list->numUnfenced);
+   --fenced_list->numUnfenced;
+#else
+   (void)fenced_list;
+#endif
    pb_reference(&fenced_buf->buffer, NULL);
    FREE(fenced_buf);
 }
@@ -149,16 +167,21 @@ _fenced_buffer_remove(struct fenced_buffer_list *fenced_list,
    
    assert(fenced_buf->head.prev);
    assert(fenced_buf->head.next);
-   LIST_DEL(&fenced_buf->head);
-#ifdef DEBUG
-   fenced_buf->head.prev = NULL;
-   fenced_buf->head.next = NULL;
-#endif
    
+   LIST_DEL(&fenced_buf->head);
    assert(fenced_list->numDelayed);
    --fenced_list->numDelayed;
    
-   if(!fenced_buf->base.base.refcount)
+#ifdef DEBUG
+   LIST_ADDTAIL(&fenced_buf->head, &fenced_list->unfenced);
+   ++fenced_list->numUnfenced;
+#endif
+   
+   /**
+    * FIXME!!!
+    */
+
+   if(!p_atomic_read(&fenced_buf->base.base.reference.count))
       _fenced_buffer_destroy(fenced_buf);
 }
 
@@ -234,7 +257,7 @@ fenced_buffer_destroy(struct pb_buffer *buf)
    struct fenced_buffer_list *fenced_list = fenced_buf->list;
 
    pipe_mutex_lock(fenced_list->mutex);
-   assert(fenced_buf->base.base.refcount == 0);
+   assert(p_atomic_read(&fenced_buf->base.base.reference.count) == 0);
    if (fenced_buf->fence) {
       struct pb_fence_ops *ops = fenced_list->ops;
       if(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) {
@@ -265,16 +288,26 @@ fenced_buffer_map(struct pb_buffer *buf,
                   unsigned flags)
 {
    struct fenced_buffer *fenced_buf = fenced_buffer(buf);
+   struct fenced_buffer_list *fenced_list = fenced_buf->list;
+   struct pb_fence_ops *ops = fenced_list->ops;
    void *map;
 
-   assert(flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE);
-   assert(!(flags & ~PIPE_BUFFER_USAGE_CPU_READ_WRITE));
-   flags &= PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+   assert(!(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE));
    
-   /* Check for GPU read/write access */
-   if(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_WRITE) {
-      /* Wait for the GPU to finish writing */
-      _fenced_buffer_finish(fenced_buf);
+   /* Serialize writes */
+   if((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_WRITE) ||
+      ((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ) && (flags & PIPE_BUFFER_USAGE_CPU_WRITE))) {
+      if(flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
+         /* Don't wait for the GPU to finish writing */
+         if(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0)
+            _fenced_buffer_remove(fenced_list, fenced_buf);
+         else
+            return NULL;
+      }
+      else {
+         /* Wait for the GPU to finish writing */
+         _fenced_buffer_finish(fenced_buf);
+      }
    }
 
 #if 0
@@ -288,7 +321,7 @@ fenced_buffer_map(struct pb_buffer *buf,
    map = pb_map(fenced_buf->buffer, flags);
    if(map) {
       ++fenced_buf->mapcount;
-      fenced_buf->flags |= flags;
+      fenced_buf->flags |= flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE;
    }
 
    return map;
@@ -432,7 +465,7 @@ fenced_buffer_create(struct fenced_buffer_list *fenced_list,
       return NULL;
    }
    
-   buf->base.base.refcount = 1;
+   pipe_reference_init(&buf->base.base.reference, 1);
    buf->base.base.alignment = buffer->base.alignment;
    buf->base.base.usage = buffer->base.usage;
    buf->base.base.size = buffer->base.size;
@@ -441,6 +474,13 @@ fenced_buffer_create(struct fenced_buffer_list *fenced_list,
    buf->buffer = buffer;
    buf->list = fenced_list;
    
+#ifdef DEBUG
+   pipe_mutex_lock(fenced_list->mutex);
+   LIST_ADDTAIL(&buf->head, &fenced_list->unfenced);
+   ++fenced_list->numUnfenced;
+   pipe_mutex_unlock(fenced_list->mutex);
+#endif
+
    return &buf->base;
 }
 
@@ -457,9 +497,13 @@ fenced_buffer_list_create(struct pb_fence_ops *ops)
    fenced_list->ops = ops;
 
    LIST_INITHEAD(&fenced_list->delayed);
-
    fenced_list->numDelayed = 0;
    
+#ifdef DEBUG
+   LIST_INITHEAD(&fenced_list->unfenced);
+   fenced_list->numUnfenced = 0;
+#endif
+
    pipe_mutex_init(fenced_list->mutex);
 
    return fenced_list;
@@ -476,6 +520,51 @@ fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list,
 }
 
 
+#ifdef DEBUG
+void
+fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list)
+{
+   struct pb_fence_ops *ops = fenced_list->ops;
+   struct list_head *curr, *next;
+   struct fenced_buffer *fenced_buf;
+
+   pipe_mutex_lock(fenced_list->mutex);
+
+   debug_printf("%10s %7s %10s %s\n",
+                "buffer", "reference.count", "fence", "signalled");
+   
+   curr = fenced_list->unfenced.next;
+   next = curr->next;
+   while(curr != &fenced_list->unfenced) {
+      fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
+      assert(!fenced_buf->fence);
+      debug_printf("%10p %7u\n",
+                   fenced_buf,
+                   fenced_buf->base.base.reference.count);
+      curr = next; 
+      next = curr->next;
+   }
+   
+   curr = fenced_list->delayed.next;
+   next = curr->next;
+   while(curr != &fenced_list->delayed) {
+      int signaled;
+      fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
+      signaled = ops->fence_signalled(ops, fenced_buf->fence, 0);
+      debug_printf("%10p %7u %10p %s\n",
+                   fenced_buf,
+                   fenced_buf->base.base.reference.count,
+                   fenced_buf->fence,
+                   signaled == 0 ? "y" : "n");
+      curr = next; 
+      next = curr->next;
+   }
+   
+   pipe_mutex_unlock(fenced_list->mutex);
+}
+#endif
+
+
 void
 fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
 {
@@ -484,13 +573,17 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
    /* Wait on outstanding fences */
    while (fenced_list->numDelayed) {
       pipe_mutex_unlock(fenced_list->mutex);
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
       sched_yield();
 #endif
       _fenced_buffer_list_check_free(fenced_list, 1);
       pipe_mutex_lock(fenced_list->mutex);
    }
 
+#ifdef DEBUG
+   //assert(!fenced_list->numUnfenced);
+#endif
+      
    pipe_mutex_unlock(fenced_list->mutex);
    
    fenced_list->ops->destroy(fenced_list->ops);
index d1c9d4c17dff7b4bc4044816146d456eee86d460..034ca1e024abead7c209727e85655fbd735cad27 100644 (file)
@@ -51,7 +51,7 @@
 #define PB_BUFFER_FENCED_H_
 
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 
 #ifdef __cplusplus
@@ -114,6 +114,13 @@ void
 fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list, 
                               int wait);
 
+
+#ifdef DEBUG
+void
+fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list);
+#endif
+
+
 void
 fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list);
 
index 53f497cfb04bee56053a4c320cea016713b3df54..689fd74771fcfa5072d3e6b43773470dcb17d40f 100644 (file)
@@ -34,7 +34,7 @@
  */
 
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "util/u_memory.h"
 #include "pb_buffer.h"
 #include "pb_bufmgr.h"
@@ -132,7 +132,7 @@ pb_malloc_buffer_create(size_t size,
    if(!buf)
       return NULL;
 
-   buf->base.base.refcount = 1;
+   pipe_reference_init(&buf->base.base.reference, 1);
    buf->base.base.alignment = desc->alignment;
    buf->base.base.usage = desc->usage;
    buf->base.base.size = size;
index fec8db91c7160bed46659c91a89e772b0208403c..74077f82774924dcfec730ba492215e2ca4ea054 100644 (file)
@@ -200,10 +200,11 @@ pb_ondemand_manager_create(struct pb_manager *provider);
 /** 
  * Debug buffer manager to detect buffer under- and overflows.
  *
- * Band size should be a multiple of the largest alignment
+ * Under/overflow sizes should be a multiple of the largest alignment
  */
 struct pb_manager *
-pb_debug_manager_create(struct pb_manager *provider, size_t band_size); 
+pb_debug_manager_create(struct pb_manager *provider,
+                        size_t underflow_size, size_t overflow_size); 
 
 
 #ifdef __cplusplus
index c956924cc7653df3c72dc9981f3e57baec7a662d..db67d46c56168a89c383e31301234b8e2aaeb9a0 100644 (file)
@@ -34,7 +34,7 @@
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "util/u_memory.h"
 
 #include "pb_buffer.h"
index a1688537134b4d983153e09e2cb3526cf622e78b..010a2ecc1fa7109990e08bd7b190f422d50b3f47 100644 (file)
@@ -35,7 +35,7 @@
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_thread.h"
 #include "util/u_memory.h"
 #include "util/u_double_list.h"
@@ -112,7 +112,7 @@ _pb_cache_buffer_destroy(struct pb_cache_buffer *buf)
    LIST_DEL(&buf->head);
    assert(mgr->numDelayed);
    --mgr->numDelayed;
-   assert(!buf->base.base.refcount);
+   assert(p_atomic_read(&buf->base.base.reference.count) == 0);
    pb_reference(&buf->buffer, NULL);
    FREE(buf);
 }
@@ -153,7 +153,7 @@ pb_cache_buffer_destroy(struct pb_buffer *_buf)
    struct pb_cache_manager *mgr = buf->mgr;
 
    pipe_mutex_lock(mgr->mutex);
-   assert(buf->base.base.refcount == 0);
+   assert(p_atomic_read(&buf->base.base.reference.count) == 0);
    
    _pb_cache_buffer_list_check_free(mgr);
    
@@ -293,7 +293,8 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
    if(buf) {
       LIST_DEL(&buf->head);
       pipe_mutex_unlock(mgr->mutex);
-      ++buf->base.base.refcount;
+      /* Increase refcount */
+      pb_reference((struct pb_buffer**)&buf, &buf->base);
       return &buf->base;
    }
    
@@ -309,12 +310,12 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
       return NULL;
    }
    
-   assert(buf->buffer->base.refcount >= 1);
+   assert(p_atomic_read(&buf->buffer->base.reference.count) >= 1);
    assert(pb_check_alignment(desc->alignment, buf->buffer->base.alignment));
    assert(pb_check_usage(desc->usage, buf->buffer->base.usage));
    assert(buf->buffer->base.size >= size);
    
-   buf->base.base.refcount = 1;
+   pipe_reference_init(&buf->base.base.reference, 1);
    buf->base.base.alignment = buf->buffer->base.alignment;
    buf->base.base.usage = buf->buffer->base.usage;
    buf->base.base.size = buf->buffer->base.size;
index 26d9c24aec22e7c33e7f53cd426c240e3c5c5c5c..478682dbee9418abb5f9948bfd2f6e1972644ba0 100644 (file)
@@ -34,7 +34,7 @@
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_thread.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
@@ -78,7 +78,8 @@ struct pb_debug_manager
 
    struct pb_manager *provider;
 
-   size_t band_size;
+   size_t underflow_size;
+   size_t overflow_size;
 };
 
 
@@ -205,9 +206,9 @@ pb_debug_buffer_check(struct pb_debug_buffer *buf)
 static void
 pb_debug_buffer_destroy(struct pb_buffer *_buf)
 {
-   struct pb_debug_buffer *buf = pb_debug_buffer(_buf);  
+   struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
    
-   assert(!buf->base.base.refcount);
+   assert(p_atomic_read(&buf->base.base.reference.count) == 0);
    
    pb_debug_buffer_check(buf);
 
@@ -301,7 +302,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
    if(!buf)
       return NULL;
    
-   real_size = size + 2*mgr->band_size;
+   real_size = mgr->underflow_size + size + mgr->overflow_size;
    real_desc = *desc;
    real_desc.usage |= PIPE_BUFFER_USAGE_CPU_WRITE;
    real_desc.usage |= PIPE_BUFFER_USAGE_CPU_READ;
@@ -314,12 +315,12 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
       return NULL;
    }
    
-   assert(buf->buffer->base.refcount >= 1);
+   assert(p_atomic_read(&buf->buffer->base.reference.count) >= 1);
    assert(pb_check_alignment(real_desc.alignment, buf->buffer->base.alignment));
    assert(pb_check_usage(real_desc.usage, buf->buffer->base.usage));
    assert(buf->buffer->base.size >= real_size);
    
-   buf->base.base.refcount = 1;
+   pipe_reference_init(&buf->base.base.reference, 1);
    buf->base.base.alignment = desc->alignment;
    buf->base.base.usage = desc->usage;
    buf->base.base.size = size;
@@ -327,7 +328,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
    buf->base.vtbl = &pb_debug_buffer_vtbl;
    buf->mgr = mgr;
 
-   buf->underflow_size = mgr->band_size;
+   buf->underflow_size = mgr->underflow_size;
    buf->overflow_size = buf->buffer->base.size - buf->underflow_size - size;
    
    pb_debug_buffer_fill(buf);
@@ -356,7 +357,8 @@ pb_debug_manager_destroy(struct pb_manager *_mgr)
 
 
 struct pb_manager *
-pb_debug_manager_create(struct pb_manager *provider, size_t band_size) 
+pb_debug_manager_create(struct pb_manager *provider, 
+                        size_t underflow_size, size_t overflow_size) 
 {
    struct pb_debug_manager *mgr;
 
@@ -371,7 +373,8 @@ pb_debug_manager_create(struct pb_manager *provider, size_t band_size)
    mgr->base.create_buffer = pb_debug_manager_create_buffer;
    mgr->base.flush = pb_debug_manager_flush;
    mgr->provider = provider;
-   mgr->band_size = band_size;
+   mgr->underflow_size = underflow_size;
+   mgr->overflow_size = overflow_size;
       
    return &mgr->base;
 }
@@ -381,7 +384,8 @@ pb_debug_manager_create(struct pb_manager *provider, size_t band_size)
 
 
 struct pb_manager *
-pb_debug_manager_create(struct pb_manager *provider, size_t band_size) 
+pb_debug_manager_create(struct pb_manager *provider, 
+                        size_t underflow_size, size_t overflow_size) 
 {
    return provider;
 }
index 47e9fee53389049335442fd1557ad31543318f2c..144db5669b63aa7663b98561e1b03096677acde3 100644 (file)
@@ -34,7 +34,7 @@
  */
 
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "util/u_memory.h"
 
 #include "pb_buffer.h"
@@ -79,6 +79,10 @@ fenced_bufmgr_create_buffer(struct pb_manager *mgr,
       
       buf = fenced_mgr->provider->create_buffer(fenced_mgr->provider, size, desc);
       if(!buf) {
+#if 0
+         fenced_buffer_list_dump(fenced_mgr->fenced_list);
+#endif
+         
          /* give up */
          return NULL;
       }
index 2f5a5d8ea0728e9f4845e335518b3d8bb1f8677f..fb18dcc5dcae37471e7a6608eeab6d5336ebef6e 100644 (file)
@@ -34,7 +34,7 @@
 
 
 #include "pipe/p_defines.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_thread.h"
 #include "util/u_memory.h"
 #include "util/u_double_list.h"
@@ -97,11 +97,11 @@ mm_buffer_destroy(struct pb_buffer *buf)
    struct mm_buffer *mm_buf = mm_buffer(buf);
    struct mm_pb_manager *mm = mm_buf->mgr;
    
-   assert(buf->base.refcount == 0);
+   assert(p_atomic_read(&mm_buf->base.base.reference.count) == 0);
    
    pipe_mutex_lock(mm->mutex);
    u_mmFreeMem(mm_buf->block);
-   FREE(buf);
+   FREE(mm_buf);
    pipe_mutex_unlock(mm->mutex);
 }
 
@@ -189,7 +189,7 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
       return NULL;
    }
 
-   mm_buf->base.base.refcount = 1;
+   pipe_reference_init(&mm_buf->base.base.reference, 1);
    mm_buf->base.base.alignment = desc->alignment;
    mm_buf->base.base.usage = desc->usage;
    mm_buf->base.base.size = size;
@@ -204,13 +204,9 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
 #if 0
       mmDumpMemInfo(mm->heap);
 #endif
-      
-      mm_buf->block = u_mmAllocMem(mm->heap, size, mm->align2, 0);
-      if(!mm_buf->block) {
-         FREE(mm_buf);
-         pipe_mutex_unlock(mm->mutex);
-         return NULL;
-      }
+      FREE(mm_buf);
+      pipe_mutex_unlock(mm->mutex);
+      return NULL;
    }
    
    /* Some sanity checks */
index ba02a84e62de0b99ae6a9609205df7884ab6215c..4f7e6b1c4df6d0f5777cf17b585c5649aa13ba39 100644 (file)
@@ -34,7 +34,7 @@
  */
 
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "util/u_memory.h"
 #include "pb_buffer.h"
 #include "pb_bufmgr.h"
@@ -242,7 +242,7 @@ pb_ondemand_manager_create_buffer(struct pb_manager *_mgr,
    if(!buf)
       return NULL;
 
-   buf->base.base.refcount = 1;
+   pipe_reference_init(&buf->base.base.reference, 1);
    buf->base.base.alignment = desc->alignment;
    buf->base.base.usage = desc->usage;
    buf->base.base.size = size;
index a6ff37653e90e3be9c75891c6a6fde4c38361e50..75b95e132e8d5987db273fce0ee4e422b69b4b2e 100644 (file)
@@ -36,7 +36,7 @@
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_thread.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
@@ -108,7 +108,7 @@ pool_buffer_destroy(struct pb_buffer *buf)
    struct pool_buffer *pool_buf = pool_buffer(buf);
    struct pool_pb_manager *pool = pool_buf->mgr;
    
-   assert(pool_buf->base.base.refcount == 0);
+   assert(p_atomic_read(&pool_buf->base.base.reference.count) == 0);
 
    pipe_mutex_lock(pool->mutex);
    LIST_ADD(&pool_buf->head, &pool->free);
@@ -216,8 +216,8 @@ pool_bufmgr_create_buffer(struct pb_manager *mgr,
    pipe_mutex_unlock(pool->mutex);
    
    pool_buf = LIST_ENTRY(struct pool_buffer, item, head);
-   assert(pool_buf->base.base.refcount == 0);
-   pool_buf->base.base.refcount = 1;
+   assert(p_atomic_read(&pool_buf->base.base.reference.count) == 0);
+   pipe_reference_init(&pool_buf->base.base.reference, 1);
    pool_buf->base.base.alignment = desc->alignment;
    pool_buf->base.base.usage = desc->usage;
    
@@ -295,7 +295,7 @@ pool_bufmgr_create(struct pb_manager *provider,
 
    pool_buf = pool->bufs;
    for (i = 0; i < numBufs; ++i) {
-      pool_buf->base.base.refcount = 0;
+      pipe_reference_init(&pool_buf->base.base.reference, 0);
       pool_buf->base.base.alignment = 0;
       pool_buf->base.base.usage = 0;
       pool_buf->base.base.size = bufSize;
index 9b9fedccb4b79e5f2085d44db00f322a006f967a..a431fd5211e439b7a45a1dab8410d22eb9fc5414 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "pipe/p_compiler.h"
 #include "pipe/p_error.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_thread.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
@@ -202,7 +202,7 @@ pb_slab_buffer_destroy(struct pb_buffer *_buf)
 
    pipe_mutex_lock(mgr->mutex);
    
-   assert(buf->base.base.refcount == 0);
+   assert(p_atomic_read(&buf->base.base.reference.count) == 0);
    
    buf->mapCount = 0;
 
@@ -340,7 +340,7 @@ pb_slab_create(struct pb_slab_manager *mgr)
 
    buf = slab->buffers;
    for (i=0; i < numBuffers; ++i) {
-      buf->base.base.refcount = 0;
+      pipe_reference_init(&buf->base.base.reference, 0);
       buf->base.base.size = mgr->bufSize;
       buf->base.base.alignment = 0;
       buf->base.base.usage = 0;
@@ -419,7 +419,7 @@ pb_slab_manager_create_buffer(struct pb_manager *_mgr,
    pipe_mutex_unlock(mgr->mutex);
    buf = LIST_ENTRY(struct pb_slab_buffer, list, head);
    
-   ++buf->base.base.refcount;
+   pipe_reference_init(&buf->base.base.reference, 1);
    buf->base.base.alignment = desc->alignment;
    buf->base.base.usage = desc->usage;
    
index 94532bb4cec85978adcfdc140828c90bf85f1c4f..150fd5061812e804387c2aba7589750e5d958414 100644 (file)
@@ -36,7 +36,7 @@
 #include "pipe/p_compiler.h"
 #include "pipe/p_error.h"
 #include "util/u_memory.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 #include "pb_buffer.h"
 #include "pb_buffer_fenced.h"
index 252dc5274abb2a5c9094a4647b579eba4b78abcd..ab8ea464c6e27d5360318e6e27189c9ba54fd7a2 100644 (file)
@@ -11,6 +11,3 @@ C_SOURCES = \
        rtasm_ppc_spe.c
 
 include ../../Makefile.template
-
-symlinks:
-
index 5499018b21934d026dfad9a06e834133630de3f2..03bdd472386f00717057f3ffbc7fe43da8dac09c 100644 (file)
@@ -26,7 +26,7 @@
  **************************************************************************/
 
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "rtasm_cpu.h"
 
 
index be7433baf87c6a96ca87eaceca45ab00e571ab9b..1f0923b68319b3b8fdf51b12ba22e7371ddc9e94 100644 (file)
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_thread.h"
 #include "util/u_memory.h"
 
 #include "rtasm_execmem.h"
 
+#if defined(PIPE_OS_BSD)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
 
-#if defined(PIPE_OS_LINUX)
+
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
 
 
 /*
@@ -114,7 +118,7 @@ rtasm_exec_free(void *addr)
 }
 
 
-#else /* PIPE_OS_LINUX */
+#else /* PIPE_OS_LINUX || PIPE_OS_BSD */
 
 /*
  * Just use regular memory.
@@ -134,4 +138,4 @@ rtasm_exec_free(void *addr)
 }
 
 
-#endif /* PIPE_OS_LINUX */
+#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */
index 1bb90262051689bac94388b12b02539d87dea043..e3586482db4800c380b30c8d2452ddb55ddc9569 100644 (file)
@@ -38,7 +38,7 @@
 
 #include <stdio.h>
 #include "util/u_memory.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "rtasm_execmem.h"
 #include "rtasm_ppc.h"
 
index 99ee74cf14bee4a414a9cd2819d2f497a6626c38..57fcf6de2abc2aa745d02292f8be3cabd8f9408d 100644 (file)
@@ -26,7 +26,7 @@
 #if defined(PIPE_ARCH_X86)
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "util/u_pointer.h"
 
 #include "rtasm_execmem.h"
index 516d1756cf95686d39a75e3616a06c33c3d75561..a7d111b6891fc96c2081de0f297fb6308ca3cdcd 100644 (file)
@@ -7,6 +7,3 @@ C_SOURCES = \
        sct.c
 
 include ../../Makefile.template
-
-symlinks:
-
index 49bb7ea92e2611cc849617c162417f2827fc0908..722d2b7e66e05a8e7cadb70e5d5a6e4ee236f072 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "util/u_memory.h"
 #include "pipe/p_state.h"
-#include "pipe/p_inlines.h"
 #include "sct.h"
 
 
@@ -372,7 +371,7 @@ sct_flush_textures(struct surface_context_tracker *sct,
 
    for (tl = ci->textures_used; tl; tl = next) {
       next = tl->next;
-      pipe_texture_release(&tl->texture);
+      pipe_texture_reference(&tl->texture, NULL);
       FREE(tl);
    }
    ci->textures_used = NULL;
index d7df9490cfa3047b6e42d926b86366c047b1d7a6..b4900e8dbaa2f91e4a1ad942e1fd0700d075d22b 100644 (file)
@@ -19,6 +19,3 @@ C_SOURCES = \
        tgsi_util.c
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
new file mode 100644 (file)
index 0000000..b83abd4
--- /dev/null
@@ -0,0 +1,1036 @@
+TGSI Instruction Specification
+==============================
+==============================
+
+
+1  Instruction Set Operations
+=============================
+
+
+1.1  GL_NV_vertex_program
+-------------------------
+
+
+1.1.1  ARL - Address Register Load
+
+  dst.x = floor(src.x)
+  dst.y = floor(src.y)
+  dst.z = floor(src.z)
+  dst.w = floor(src.w)
+
+
+1.1.2  MOV - Move
+
+  dst.x = src.x
+  dst.y = src.y
+  dst.z = src.z
+  dst.w = src.w
+
+
+1.1.3  LIT - Light Coefficients
+
+  dst.x = 1.0
+  dst.y = max(src.x, 0.0)
+  dst.z = (src.x > 0.0) ? pow(max(src.y, 0.0), clamp(src.w, -128.0, 128.0)) : 0.0
+  dst.w = 1.0
+
+
+1.1.4  RCP - Reciprocal
+
+  dst.x = 1.0 / src.x
+  dst.y = 1.0 / src.x
+  dst.z = 1.0 / src.x
+  dst.w = 1.0 / src.x
+
+
+1.1.5  RSQ - Reciprocal Square Root
+
+  dst.x = 1.0 / sqrt(abs(src.x))
+  dst.y = 1.0 / sqrt(abs(src.x))
+  dst.z = 1.0 / sqrt(abs(src.x))
+  dst.w = 1.0 / sqrt(abs(src.x))
+
+
+1.1.6  EXP - Approximate Exponential Base 2
+
+  dst.x = pow(2.0, floor(src.x))
+  dst.y = src.x - floor(src.x)
+  dst.z = pow(2.0, src.x)
+  dst.w = 1.0
+
+
+1.1.7  LOG - Approximate Logarithm Base 2
+
+  dst.x = floor(lg2(abs(src.x)))
+  dst.y = abs(src.x) / pow(2.0, floor(lg2(abs(src.x))))
+  dst.z = lg2(abs(src.x))
+  dst.w = 1.0
+
+
+1.1.8  MUL - Multiply
+
+  dst.x = src0.x * src1.x
+  dst.y = src0.y * src1.y
+  dst.z = src0.z * src1.z
+  dst.w = src0.w * src1.w
+
+
+1.1.9  ADD - Add
+
+  dst.x = src0.x + src1.x
+  dst.y = src0.y + src1.y
+  dst.z = src0.z + src1.z
+  dst.w = src0.w + src1.w
+
+
+1.1.10  DP3 - 3-component Dot Product
+
+  dst.x = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z
+  dst.y = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z
+  dst.z = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z
+  dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z
+
+
+1.1.11  DP4 - 4-component Dot Product
+
+  dst.x = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w
+  dst.y = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w
+  dst.z = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w
+  dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w
+
+
+1.1.12  DST - Distance Vector
+
+  dst.x = 1.0
+  dst.y = src0.y * src1.y
+  dst.z = src0.z
+  dst.w = src1.w
+
+
+1.1.13  MIN - Minimum
+
+  dst.x = min(src0.x, src1.x)
+  dst.y = min(src0.y, src1.y)
+  dst.z = min(src0.z, src1.z)
+  dst.w = min(src0.w, src1.w)
+
+
+1.1.14  MAX - Maximum
+
+  dst.x = max(src0.x, src1.x)
+  dst.y = max(src0.y, src1.y)
+  dst.z = max(src0.z, src1.z)
+  dst.w = max(src0.w, src1.w)
+
+
+1.1.15  SLT - Set On Less Than
+
+  dst.x = (src0.x < src1.x) ? 1.0 : 0.0
+  dst.y = (src0.y < src1.y) ? 1.0 : 0.0
+  dst.z = (src0.z < src1.z) ? 1.0 : 0.0
+  dst.w = (src0.w < src1.w) ? 1.0 : 0.0
+
+
+1.1.16  SGE - Set On Greater Equal Than
+
+  dst.x = (src0.x >= src1.x) ? 1.0 : 0.0
+  dst.y = (src0.y >= src1.y) ? 1.0 : 0.0
+  dst.z = (src0.z >= src1.z) ? 1.0 : 0.0
+  dst.w = (src0.w >= src1.w) ? 1.0 : 0.0
+
+
+1.1.17  MAD - Multiply And Add
+
+  dst.x = src0.x * src1.x + src2.x
+  dst.y = src0.y * src1.y + src2.y
+  dst.z = src0.z * src1.z + src2.z
+  dst.w = src0.w * src1.w + src2.w
+
+
+1.2  GL_ATI_fragment_shader
+---------------------------
+
+
+1.2.1  SUB - Subtract
+
+  dst.x = src0.x - src1.x
+  dst.y = src0.y - src1.y
+  dst.z = src0.z - src1.z
+  dst.w = src0.w - src1.w
+
+
+1.2.2  DOT3 - 3-component Dot Product
+
+  Alias for DP3.
+
+
+1.2.3  DOT4 - 4-component Dot Product
+
+  Alias for DP4.
+
+
+1.2.4  LERP - Linear Interpolate
+
+  dst.x = src0.x * (src1.x - src2.x) + src2.x
+  dst.y = src0.y * (src1.y - src2.y) + src2.y
+  dst.z = src0.z * (src1.z - src2.z) + src2.z
+  dst.w = src0.w * (src1.w - src2.w) + src2.w
+
+
+1.2.5  CND - Condition
+
+  dst.x = (src2.x > 0.5) ? src0.x : src1.x
+  dst.y = (src2.y > 0.5) ? src0.y : src1.y
+  dst.z = (src2.z > 0.5) ? src0.z : src1.z
+  dst.w = (src2.w > 0.5) ? src0.w : src1.w
+
+
+1.2.6  CND0 - Condition Zero
+
+  dst.x = (src2.x >= 0.0) ? src0.x : src1.x
+  dst.y = (src2.y >= 0.0) ? src0.y : src1.y
+  dst.z = (src2.z >= 0.0) ? src0.z : src1.z
+  dst.w = (src2.w >= 0.0) ? src0.w : src1.w
+
+
+1.2.7  DOT2ADD - 2-component Dot Product And Add
+
+  dst.x = src0.x * src1.x + src0.y * src1.y + src2.x
+  dst.y = src0.x * src1.x + src0.y * src1.y + src2.x
+  dst.z = src0.x * src1.x + src0.y * src1.y + src2.x
+  dst.w = src0.x * src1.x + src0.y * src1.y + src2.x
+
+
+1.3  GL_EXT_vertex_shader
+-------------------------
+
+
+1.3.1  INDEX - Array Lookup
+
+  Considered for removal from language.
+
+
+1.3.2  NEGATE - Negate
+
+  Considered for removal from language.
+
+
+1.3.3  MADD - Multiply And Add
+
+  Alias for MAD.
+
+
+1.3.4  FRAC - Fraction
+
+  dst.x = src.x - floor(src.x)
+  dst.y = src.y - floor(src.y)
+  dst.z = src.z - floor(src.z)
+  dst.w = src.w - floor(src.w)
+
+
+1.3.5  SETGE - Set On Greater Equal
+
+  Alias for SGE.
+
+
+1.3.6  SETLT - Set On Less Than
+
+  Alias for SLT.
+
+
+1.3.7  CLAMP - Clamp
+
+  dst.x = clamp(src0.x, src1.x, src2.x)
+  dst.y = clamp(src0.y, src1.y, src2.y)
+  dst.z = clamp(src0.z, src1.z, src2.z)
+  dst.w = clamp(src0.w, src1.w, src2.w)
+
+
+1.3.8  FLOOR - Floor
+
+  dst.x = floor(src.x)
+  dst.y = floor(src.y)
+  dst.z = floor(src.z)
+  dst.w = floor(src.w)
+
+
+1.3.9  ROUND - Round
+
+  dst.x = round(src.x)
+  dst.y = round(src.y)
+  dst.z = round(src.z)
+  dst.w = round(src.w)
+
+
+1.3.10  EXPBASE2 - Exponent Base 2
+
+  dst.x = pow(2.0, src.x)
+  dst.y = pow(2.0, src.x)
+  dst.z = pow(2.0, src.x)
+  dst.w = pow(2.0, src.x)
+
+
+1.3.11  LOGBASE2 - Logarithm Base 2
+
+  dst.x = lg2(src.x)
+  dst.y = lg2(src.x)
+  dst.z = lg2(src.x)
+  dst.w = lg2(src.x)
+
+
+1.3.12  POWER - Power
+
+  dst.x = pow(src0.x, src1.x)
+  dst.y = pow(src0.x, src1.x)
+  dst.z = pow(src0.x, src1.x)
+  dst.w = pow(src0.x, src1.x)
+
+
+1.3.13  RECIP - Reciprocal
+
+  Alias for RCP.
+
+
+1.3.14  RECIPSQRT - Reciprocal Square Root
+
+  Alias for RSQ.
+
+
+1.3.15  CROSSPRODUCT - Cross Product
+
+  dst.x = src0.y * src1.z - src1.y * src0.z
+  dst.y = src0.z * src1.x - src1.z * src0.x
+  dst.z = src0.x * src1.y - src1.x * src0.y
+  dst.w = 1.0
+
+
+1.3.16  MULTIPLYMATRIX - Multiply Matrix
+
+  Considered for removal from language.
+
+
+1.4  GL_NV_vertex_program1_1
+----------------------------
+
+
+1.4.1  ABS - Absolute
+
+  dst.x = abs(src.x)
+  dst.y = abs(src.y)
+  dst.z = abs(src.z)
+  dst.w = abs(src.w)
+
+
+1.4.2  RCC - Reciprocal Clamped
+
+  dst.x = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020)
+  dst.y = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020)
+  dst.z = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020)
+  dst.w = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020)
+
+
+1.4.3  DPH - Homogeneous Dot Product
+
+  dst.x = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
+  dst.y = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
+  dst.z = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
+  dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
+
+
+1.5  GL_NV_fragment_program
+---------------------------
+
+
+1.5.1  COS - Cosine
+
+  dst.x = cos(src.x)
+  dst.y = cos(src.x)
+  dst.z = cos(src.x)
+  dst.w = cos(src.w)
+
+
+1.5.2  DDX - Derivative Relative To X
+
+  dst.x = partialx(src.x)
+  dst.y = partialx(src.y)
+  dst.z = partialx(src.z)
+  dst.w = partialx(src.w)
+
+
+1.5.3  DDY - Derivative Relative To Y
+
+  dst.x = partialy(src.x)
+  dst.y = partialy(src.y)
+  dst.z = partialy(src.z)
+  dst.w = partialy(src.w)
+
+
+1.5.4  EX2 - Exponential Base 2
+
+  Alias for EXPBASE2.
+
+
+1.5.5  FLR - Floor
+
+  Alias for FLOOR.
+
+
+1.5.6  FRC - Fraction
+
+  Alias for FRAC.
+
+
+1.5.7  KILP - Predicated Discard
+
+  TBD
+
+
+1.5.8  LG2 - Logarithm Base 2
+
+  Alias for LOGBASE2.
+
+
+1.5.9  LRP - Linear Interpolate
+
+  Alias for LERP.
+
+
+1.5.10  PK2H - Pack Two 16-bit Floats
+
+  TBD
+
+
+1.5.11  PK2US - Pack Two Unsigned 16-bit Scalars
+
+  TBD
+
+
+1.5.12  PK4B - Pack Four Signed 8-bit Scalars
+
+  TBD
+
+
+1.5.13  PK4UB - Pack Four Unsigned 8-bit Scalars
+
+  TBD
+
+
+1.5.14  POW - Power
+
+  Alias for POWER.
+
+
+1.5.15  RFL - Reflection Vector
+
+  dst.x = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.x - src1.x
+  dst.y = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.y - src1.y
+  dst.z = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.z - src1.z
+  dst.w = 1.0
+
+
+1.5.16  SEQ - Set On Equal
+
+  dst.x = (src0.x == src1.x) ? 1.0 : 0.0
+  dst.y = (src0.y == src1.y) ? 1.0 : 0.0
+  dst.z = (src0.z == src1.z) ? 1.0 : 0.0
+  dst.w = (src0.w == src1.w) ? 1.0 : 0.0
+
+
+1.5.17  SFL - Set On False
+
+  dst.x = 0.0
+  dst.y = 0.0
+  dst.z = 0.0
+  dst.w = 0.0
+
+
+1.5.18  SGT - Set On Greater Than
+
+  dst.x = (src0.x > src1.x) ? 1.0 : 0.0
+  dst.y = (src0.y > src1.y) ? 1.0 : 0.0
+  dst.z = (src0.z > src1.z) ? 1.0 : 0.0
+  dst.w = (src0.w > src1.w) ? 1.0 : 0.0
+
+
+1.5.19  SIN - Sine
+
+  dst.x = sin(src.x)
+  dst.y = sin(src.x)
+  dst.z = sin(src.x)
+  dst.w = sin(src.w)
+
+
+1.5.20  SLE - Set On Less Equal Than
+
+  dst.x = (src0.x <= src1.x) ? 1.0 : 0.0
+  dst.y = (src0.y <= src1.y) ? 1.0 : 0.0
+  dst.z = (src0.z <= src1.z) ? 1.0 : 0.0
+  dst.w = (src0.w <= src1.w) ? 1.0 : 0.0
+
+
+1.5.21  SNE - Set On Not Equal
+
+  dst.x = (src0.x != src1.x) ? 1.0 : 0.0
+  dst.y = (src0.y != src1.y) ? 1.0 : 0.0
+  dst.z = (src0.z != src1.z) ? 1.0 : 0.0
+  dst.w = (src0.w != src1.w) ? 1.0 : 0.0
+
+
+1.5.22  STR - Set On True
+
+  dst.x = 1.0
+  dst.y = 1.0
+  dst.z = 1.0
+  dst.w = 1.0
+
+
+1.5.23  TEX - Texture Lookup
+
+  TBD
+
+
+1.5.24  TXD - Texture Lookup with Derivatives
+
+  TBD
+
+
+1.5.25  TXP - Projective Texture Lookup
+
+  TBD
+
+
+1.5.26  UP2H - Unpack Two 16-Bit Floats
+
+  TBD
+
+
+1.5.27  UP2US - Unpack Two Unsigned 16-Bit Scalars
+
+  TBD
+
+
+1.5.28  UP4B - Unpack Four Signed 8-Bit Values
+
+  TBD
+
+
+1.5.29  UP4UB - Unpack Four Unsigned 8-Bit Scalars
+
+  TBD
+
+
+1.5.30  X2D - 2D Coordinate Transformation
+
+  dst.x = src0.x + src1.x * src2.x + src1.y * src2.y
+  dst.y = src0.y + src1.x * src2.z + src1.y * src2.w
+  dst.z = src0.x + src1.x * src2.x + src1.y * src2.y
+  dst.w = src0.y + src1.x * src2.z + src1.y * src2.w
+
+
+1.6  GL_NV_vertex_program2
+--------------------------
+
+
+1.6.1  ARA - Address Register Add
+
+  TBD
+
+
+1.6.2  ARR - Address Register Load With Round
+
+  dst.x = round(src.x)
+  dst.y = round(src.y)
+  dst.z = round(src.z)
+  dst.w = round(src.w)
+
+
+1.6.3  BRA - Branch
+
+  TBD
+
+
+1.6.4  CAL - Subroutine Call
+
+  push(pc)
+  pc = target
+
+
+1.6.5  RET - Subroutine Call Return
+
+  pc = pop()
+
+
+1.6.6  SSG - Set Sign
+
+  dst.x = (src.x > 0.0) ? 1.0 : (src.x < 0.0) ? -1.0 : 0.0
+  dst.y = (src.y > 0.0) ? 1.0 : (src.y < 0.0) ? -1.0 : 0.0
+  dst.z = (src.z > 0.0) ? 1.0 : (src.z < 0.0) ? -1.0 : 0.0
+  dst.w = (src.w > 0.0) ? 1.0 : (src.w < 0.0) ? -1.0 : 0.0
+
+
+1.7  GL_ARB_vertex_program
+--------------------------
+
+
+1.7.1  SWZ - Extended Swizzle
+
+  dst.x = src.x
+  dst.y = src.y
+  dst.z = src.z
+  dst.w = src.w
+
+
+1.7.2  XPD - Cross Product
+
+  Alias for CROSSPRODUCT.
+
+
+1.8  GL_ARB_fragment_program
+----------------------------
+
+
+1.8.1  CMP - Compare
+
+  dst.x = (src0.x < 0.0) ? src1.x : src2.x
+  dst.y = (src0.y < 0.0) ? src1.y : src2.y
+  dst.z = (src0.z < 0.0) ? src1.z : src2.z
+  dst.w = (src0.w < 0.0) ? src1.w : src2.w
+
+
+1.8.2  KIL - Conditional Discard
+
+  TBD
+
+
+1.8.3  SCS - Sine Cosine
+
+  dst.x = cos(src.x)
+  dst.y = sin(src.x)
+  dst.z = 0.0
+  dst.y = 1.0
+
+
+1.8.4  TXB - Texture Lookup With Bias
+
+  TBD
+
+
+1.9  GL_NV_fragment_program2
+----------------------------
+
+
+1.9.1  NRM - 3-component Vector Normalise
+
+  dst.x = src.x / (src.x * src.x + src.y * src.y + src.z * src.z)
+  dst.y = src.y / (src.x * src.x + src.y * src.y + src.z * src.z)
+  dst.z = src.z / (src.x * src.x + src.y * src.y + src.z * src.z)
+  dst.w = 1.0
+
+
+1.9.2  DIV - Divide
+
+  dst.x = src0.x / src1.x
+  dst.y = src0.y / src1.y
+  dst.z = src0.z / src1.z
+  dst.w = src0.w / src1.w
+
+
+1.9.3  DP2 - 2-component Dot Product
+
+  dst.x = src0.x * src1.x + src0.y * src1.y
+  dst.y = src0.x * src1.x + src0.y * src1.y
+  dst.z = src0.x * src1.x + src0.y * src1.y
+  dst.w = src0.x * src1.x + src0.y * src1.y
+
+
+1.9.4  DP2A - 2-component Dot Product And Add
+
+  Alias for DOT2ADD.
+
+
+1.9.5  TXL - Texture Lookup With LOD
+
+  TBD
+
+
+1.9.6  BRK - Break
+
+  TBD
+
+
+1.9.7  IF - If
+
+  TBD
+
+
+1.9.8  LOOP - Loop
+
+  TBD
+
+
+1.9.9  REP - Repeat
+
+  TBD
+
+
+1.9.10  ELSE - Else
+
+  TBD
+
+
+1.9.11  ENDIF - End If
+
+  TBD
+
+
+1.9.12  ENDLOOP - End Loop
+
+  TBD
+
+
+1.9.13  ENDREP - End Repeat
+
+  TBD
+
+
+1.10  GL_NV_vertex_program3
+---------------------------
+
+
+1.10.1  PUSHA - Push Address Register On Stack
+
+  push(src.x)
+  push(src.y)
+  push(src.z)
+  push(src.w)
+
+
+1.10.2  POPA - Pop Address Register From Stack
+
+  dst.w = pop()
+  dst.z = pop()
+  dst.y = pop()
+  dst.x = pop()
+
+
+1.11  GL_NV_gpu_program4
+------------------------
+
+
+1.11.1  CEIL - Ceiling
+
+  dst.x = ceil(src.x)
+  dst.y = ceil(src.y)
+  dst.z = ceil(src.z)
+  dst.w = ceil(src.w)
+
+
+1.11.2  I2F - Integer To Float
+
+  dst.x = (float) src.x
+  dst.y = (float) src.y
+  dst.z = (float) src.z
+  dst.w = (float) src.w
+
+
+1.11.3  NOT - Bitwise Not
+
+  dst.x = ~src.x
+  dst.y = ~src.y
+  dst.z = ~src.z
+  dst.w = ~src.w
+
+
+1.11.4  TRUNC - Truncate
+
+  dst.x = trunc(src.x)
+  dst.y = trunc(src.y)
+  dst.z = trunc(src.z)
+  dst.w = trunc(src.w)
+
+
+1.11.5  SHL - Shift Left
+
+  dst.x = src0.x << src1.x
+  dst.y = src0.y << src1.x
+  dst.z = src0.z << src1.x
+  dst.w = src0.w << src1.x
+
+
+1.11.6  SHR - Shift Right
+
+  dst.x = src0.x >> src1.x
+  dst.y = src0.y >> src1.x
+  dst.z = src0.z >> src1.x
+  dst.w = src0.w >> src1.x
+
+
+1.11.7  AND - Bitwise And
+
+  dst.x = src0.x & src1.x
+  dst.y = src0.y & src1.y
+  dst.z = src0.z & src1.z
+  dst.w = src0.w & src1.w
+
+
+1.11.8  OR - Bitwise Or
+
+  dst.x = src0.x | src1.x
+  dst.y = src0.y | src1.y
+  dst.z = src0.z | src1.z
+  dst.w = src0.w | src1.w
+
+
+1.11.9  MOD - Modulus
+
+  dst.x = src0.x % src1.x
+  dst.y = src0.y % src1.y
+  dst.z = src0.z % src1.z
+  dst.w = src0.w % src1.w
+
+
+1.11.10  XOR - Bitwise Xor
+
+  dst.x = src0.x ^ src1.x
+  dst.y = src0.y ^ src1.y
+  dst.z = src0.z ^ src1.z
+  dst.w = src0.w ^ src1.w
+
+
+1.11.11  SAD - Sum Of Absolute Differences
+
+  dst.x = abs(src0.x - src1.x) + src2.x
+  dst.y = abs(src0.y - src1.y) + src2.y
+  dst.z = abs(src0.z - src1.z) + src2.z
+  dst.w = abs(src0.w - src1.w) + src2.w
+
+
+1.11.12  TXF - Texel Fetch
+
+  TBD
+
+
+1.11.13  TXQ - Texture Size Query
+
+  TBD
+
+
+1.11.14  CONT - Continue
+
+  TBD
+
+
+1.12  GL_NV_geometry_program4
+-----------------------------
+
+
+1.12.1  EMIT - Emit
+
+  TBD
+
+
+1.12.2  ENDPRIM - End Primitive
+
+  TBD
+
+
+1.13  GLSL
+----------
+
+
+1.13.1  BGNLOOP2 - Begin Loop
+
+  TBD
+
+
+1.13.2  BGNSUB - Begin Subroutine
+
+  TBD
+
+
+1.13.3  ENDLOOP2 - End Loop
+
+  TBD
+
+
+1.13.4  ENDSUB - End Subroutine
+
+  TBD
+
+
+1.13.5  INT - Truncate
+
+  Alias for TRUNC.
+
+
+1.13.6  NOISE1 - 1D Noise
+
+  TBD
+
+
+1.13.7  NOISE2 - 2D Noise
+
+  TBD
+
+
+1.13.8  NOISE3 - 3D Noise
+
+  TBD
+
+
+1.13.9  NOISE4 - 4D Noise
+
+  TBD
+
+
+1.13.10  NOP - No Operation
+
+  Do nothing.
+
+
+1.14  ps_1_1
+------------
+
+
+1.14.1  TEXKILL - Conditional Discard
+
+  Alias for KIL.
+
+
+1.15  ps_1_4
+------------
+
+
+1.15.1  TEXLD - Texture Lookup
+
+  Alias for TEX.
+
+
+1.16  ps_2_0
+------------
+
+
+1.16.1  M4X4 - Multiply Matrix
+
+  Alias for MULTIPLYMATRIX.
+
+
+1.16.2  M4X3 - Multiply Matrix
+
+  Considered for removal from language.
+
+
+1.16.3  M3X4 - Multiply Matrix
+
+  Considered for removal from language.
+
+
+1.16.4  M3X3 - Multiply Matrix
+
+  Considered for removal from language.
+
+
+1.16.5  M3X2 - Multiply Matrix
+
+  Considered for removal from language.
+
+
+1.16.6  CRS - Cross Product
+
+  Alias for XPD.
+
+
+1.16.7  NRM4 - 4-component Vector Normalise
+
+  dst.x = src.x / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
+  dst.y = src.y / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
+  dst.z = src.z / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
+  dst.w = src.w / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
+
+
+1.16.8  SINCOS - Sine Cosine
+
+  Alias for SCS.
+
+
+1.16.9  TEXLDB - Texture Lookup With Bias
+
+  Alias for TXB.
+
+
+1.16.10  DP2ADD - 2-component Dot Product And Add
+
+  Alias for DP2A.
+
+
+1.17  ps_2_x
+------------
+
+
+1.17.1  CALL - Subroutine Call
+
+  Alias for CAL.
+
+
+1.17.2  CALLNZ - Subroutine Call If Not Zero
+
+  TBD
+
+
+1.17.3  IFC - If
+
+  TBD
+
+
+1.17.4  BREAK - Break
+
+  Alias for BRK.
+
+
+1.17.5  BREAKC - Break Conditional
+
+  TBD
+
+
+1.17.6  DSX - Derivative Relative To X
+
+  Alias for DDX.
+
+
+1.17.7  DSY - Derivative Relative To Y
+
+  Alias for DDY.
+
+
+1.17.8  TEXLDD - Texture Lookup with Derivatives
+
+  Alias for TXD.
+
+
+1.18  vs_1_1
+------------
+
+
+1.18.1  EXPP - Approximate Exponential Base 2
+
+  Alias for EXP.
+
+
+1.18.2  LOGP - Logarithm Base 2
+
+  Alias for LG2.
+
+
+1.19  vs_2_0
+------------
+
+
+1.19.1  SGN - Set Sign
+
+  Alias for SSG.
+
+
+1.19.2  MOVA - Move Address Register
+
+  Alias for ARR.
+
index 17886540cf79ba92baea68fafcd329be4beafa98..a1891a140ac5956fba402b6f8abae74bbebf33a0 100644 (file)
@@ -25,7 +25,7 @@
  * 
  **************************************************************************/
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_shader_tokens.h"
 #include "tgsi_build.h"
 #include "tgsi_parse.h"
index ab2b1f2c58adb0ba8ff84ba94281ae1d68e1543e..a784b7cc3c1b213f60cbf84f87cd803c895738c4 100644 (file)
@@ -25,7 +25,7 @@
  * 
  **************************************************************************/
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "util/u_string.h"
 #include "tgsi_dump.h"
 #include "tgsi_info.h"
@@ -245,8 +245,12 @@ iter_declaration(
       }
    }
 
-   TXT( ", " );
-   ENM( decl->Declaration.Interpolate, interpolate_names );
+   if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT &&
+       decl->Declaration.File == TGSI_FILE_INPUT)
+   {
+      TXT( ", " );
+      ENM( decl->Declaration.Interpolate, interpolate_names );
+   }
 
    if (decl->Declaration.Centroid) {
       TXT( ", CENTROID" );
index 2ecf1e2f14b2859b1f1a5ae70b3a2981d1157ea5..3dc61c48ca371428730738608e0e97e729527a63 100644 (file)
@@ -25,7 +25,7 @@
  * 
  **************************************************************************/
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "util/u_string.h"
 #include "tgsi_dump_c.h"
 #include "tgsi_build.h"
index ab641efb6032b07082167a7c2545463d210b9385..ba807e498f18cdf07d44d7a1a634d178fef092c1 100644 (file)
@@ -485,6 +485,32 @@ micro_f2ut(
 }
 #endif
 
+static void
+micro_float_clamp(union tgsi_exec_channel *dst,
+                  const union tgsi_exec_channel *src)
+{
+   uint i;
+
+   for (i = 0; i < 4; i++) {
+      if (src->f[i] > 0.0f) {
+         if (src->f[i] > 1.884467e+019f)
+            dst->f[i] = 1.884467e+019f;
+         else if (src->f[i] < 5.42101e-020f)
+            dst->f[i] = 5.42101e-020f;
+         else
+            dst->f[i] = src->f[i];
+      }
+      else {
+         if (src->f[i] < -1.884467e+019f)
+            dst->f[i] = -1.884467e+019f;
+         else if (src->f[i] > -5.42101e-020f)
+            dst->f[i] = -5.42101e-020f;
+         else
+            dst->f[i] = src->f[i];
+      }
+   }
+}
+
 static void
 micro_flr(
    union tgsi_exec_channel *dst,
@@ -507,20 +533,6 @@ micro_frc(
    dst->f[3] = src->f[3] - floorf( src->f[3] );
 }
 
-static void
-micro_ge(
-   union tgsi_exec_channel *dst,
-   const union tgsi_exec_channel *src0,
-   const union tgsi_exec_channel *src1,
-   const union tgsi_exec_channel *src2,
-   const union tgsi_exec_channel *src3 )
-{
-   dst->f[0] = src0->f[0] >= src1->f[0] ? src2->f[0] : src3->f[0];
-   dst->f[1] = src0->f[1] >= src1->f[1] ? src2->f[1] : src3->f[1];
-   dst->f[2] = src0->f[2] >= src1->f[2] ? src2->f[2] : src3->f[2];
-   dst->f[3] = src0->f[3] >= src1->f[3] ? src2->f[3] : src3->f[3];
-}
-
 static void
 micro_i2f(
    union tgsi_exec_channel *dst,
@@ -1614,6 +1626,7 @@ exec_tex(struct tgsi_exec_machine *mach,
 
    switch (inst->InstructionExtTexture.Texture) {
    case TGSI_TEXTURE_1D:
+   case TGSI_TEXTURE_SHADOW1D:
 
       FETCH(&r[0], 0, CHAN_X);
 
@@ -1636,6 +1649,8 @@ exec_tex(struct tgsi_exec_machine *mach,
 
    case TGSI_TEXTURE_2D:
    case TGSI_TEXTURE_RECT:
+   case TGSI_TEXTURE_SHADOW2D:
+   case TGSI_TEXTURE_SHADOWRECT:
 
       FETCH(&r[0], 0, CHAN_X);
       FETCH(&r[1], 0, CHAN_Y);
@@ -1826,12 +1841,14 @@ exec_instruction(
    int *pc )
 {
    uint chan_index;
-   union tgsi_exec_channel r[8];
+   union tgsi_exec_channel r[10];
 
    (*pc)++;
 
    switch (inst->Instruction.Opcode) {
    case TGSI_OPCODE_ARL:
+   /* TGSI_OPCODE_FLOOR */
+   /* TGSI_OPCODE_FLR */
       FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
          FETCH( &r[0], 0, chan_index );
          micro_flr( &r[0], &r[0] );
@@ -1849,31 +1866,31 @@ exec_instruction(
 
    case TGSI_OPCODE_LIT:
       if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) {
-        STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X );
+         STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X );
       }
 
       if (IS_CHANNEL_ENABLED( *inst, CHAN_Y ) || IS_CHANNEL_ENABLED( *inst, CHAN_Z )) {
-        FETCH( &r[0], 0, CHAN_X );
-        if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) {
-           micro_max( &r[0], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
-           STORE( &r[0], 0, CHAN_Y );
-        }
+         FETCH( &r[0], 0, CHAN_X );
+         if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) {
+            micro_max( &r[0], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
+            STORE( &r[0], 0, CHAN_Y );
+         }
 
-        if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) {
-           FETCH( &r[1], 0, CHAN_Y );
-           micro_max( &r[1], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
+         if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) {
+            FETCH( &r[1], 0, CHAN_Y );
+            micro_max( &r[1], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
 
-           FETCH( &r[2], 0, CHAN_W );
-           micro_min( &r[2], &r[2], &mach->Temps[TEMP_128_I].xyzw[TEMP_128_C] );
-           micro_max( &r[2], &r[2], &mach->Temps[TEMP_M128_I].xyzw[TEMP_M128_C] );
-           micro_pow( &r[1], &r[1], &r[2] );
-           micro_lt( &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
-           STORE( &r[0], 0, CHAN_Z );
-        }
+            FETCH( &r[2], 0, CHAN_W );
+            micro_min( &r[2], &r[2], &mach->Temps[TEMP_128_I].xyzw[TEMP_128_C] );
+            micro_max( &r[2], &r[2], &mach->Temps[TEMP_M128_I].xyzw[TEMP_M128_C] );
+            micro_pow( &r[1], &r[1], &r[2] );
+            micro_lt( &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
+            STORE( &r[0], 0, CHAN_Z );
+         }
       }
 
       if (IS_CHANNEL_ENABLED( *inst, CHAN_W )) {
-        STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W );
+         STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W );
       }
       break;
 
@@ -1882,17 +1899,18 @@ exec_instruction(
       FETCH( &r[0], 0, CHAN_X );
       micro_div( &r[0], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &r[0] );
       FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
-        STORE( &r[0], 0, chan_index );
+         STORE( &r[0], 0, chan_index );
       }
       break;
 
    case TGSI_OPCODE_RSQ:
    /* TGSI_OPCODE_RECIPSQRT */
       FETCH( &r[0], 0, CHAN_X );
+      micro_abs( &r[0], &r[0] );
       micro_sqrt( &r[0], &r[0] );
       micro_div( &r[0], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &r[0] );
       FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
-        STORE( &r[0], 0, chan_index );
+         STORE( &r[0], 0, chan_index );
       }
       break;
 
@@ -2005,30 +2023,30 @@ exec_instruction(
        micro_add( &r[0], &r[0], &r[1] );
 
       FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
-        STORE( &r[0], 0, chan_index );
+         STORE( &r[0], 0, chan_index );
       }
       break;
 
    case TGSI_OPCODE_DST:
       if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) {
-        STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X );
+         STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X );
       }
 
       if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) {
-        FETCH( &r[0], 0, CHAN_Y );
-        FETCH( &r[1], 1, CHAN_Y);
-        micro_mul( &r[0], &r[0], &r[1] );
-        STORE( &r[0], 0, CHAN_Y );
+         FETCH( &r[0], 0, CHAN_Y );
+         FETCH( &r[1], 1, CHAN_Y);
+         micro_mul( &r[0], &r[0], &r[1] );
+         STORE( &r[0], 0, CHAN_Y );
       }
 
       if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) {
-        FETCH( &r[0], 0, CHAN_Z );
-        STORE( &r[0], 0, CHAN_Z );
+         FETCH( &r[0], 0, CHAN_Z );
+         STORE( &r[0], 0, CHAN_Z );
       }
 
       if (IS_CHANNEL_ENABLED( *inst, CHAN_W )) {
-        FETCH( &r[0], 1, CHAN_W );
-        STORE( &r[0], 0, CHAN_W );
+         FETCH( &r[0], 1, CHAN_W );
+         STORE( &r[0], 0, CHAN_W );
       }
       break;
 
@@ -2071,7 +2089,7 @@ exec_instruction(
       FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
          FETCH( &r[0], 0, chan_index );
          FETCH( &r[1], 1, chan_index );
-         micro_ge( &r[0], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
+         micro_le( &r[0], &r[1], &r[0], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
          STORE( &r[0], 0, chan_index );
       }
       break;
@@ -2115,15 +2133,27 @@ exec_instruction(
       break;
 
    case TGSI_OPCODE_CND:
-      assert (0);
+      FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+         FETCH(&r[0], 0, chan_index);
+         FETCH(&r[1], 1, chan_index);
+         FETCH(&r[2], 2, chan_index);
+         micro_lt(&r[0], &mach->Temps[TEMP_HALF_I].xyzw[TEMP_HALF_C], &r[2], &r[0], &r[1]);
+         STORE(&r[0], 0, chan_index);
+      }
       break;
 
    case TGSI_OPCODE_CND0:
-      assert (0);
+      FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+         FETCH(&r[0], 0, chan_index);
+         FETCH(&r[1], 1, chan_index);
+         FETCH(&r[2], 2, chan_index);
+         micro_le(&r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[2], &r[0], &r[1]);
+         STORE(&r[0], 0, chan_index);
+      }
       break;
 
    case TGSI_OPCODE_DOT2ADD:
-      /* TGSI_OPCODE_DP2A */
+   /* TGSI_OPCODE_DP2A */
       FETCH( &r[0], 0, CHAN_X );
       FETCH( &r[1], 1, CHAN_X );
       micro_mul( &r[0], &r[0], &r[1] );
@@ -2142,10 +2172,12 @@ exec_instruction(
       break;
 
    case TGSI_OPCODE_INDEX:
+      /* XXX: considered for removal */
       assert (0);
       break;
 
    case TGSI_OPCODE_NEGATE:
+      /* XXX: considered for removal */
       assert (0);
       break;
 
@@ -2159,15 +2191,13 @@ exec_instruction(
       break;
 
    case TGSI_OPCODE_CLAMP:
-      assert (0);
-      break;
-
-   case TGSI_OPCODE_FLOOR:
-   /* TGSI_OPCODE_FLR */
-      FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
-         FETCH( &r[0], 0, chan_index );
-         micro_flr( &r[0], &r[0] );
-         STORE( &r[0], 0, chan_index );
+      FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+         FETCH(&r[0], 0, chan_index);
+         FETCH(&r[1], 1, chan_index);
+         micro_max(&r[0], &r[0], &r[1]);
+         FETCH(&r[1], 2, chan_index);
+         micro_min(&r[0], &r[0], &r[1]);
+         STORE(&r[0], 0, chan_index);
       }
       break;
 
@@ -2181,7 +2211,7 @@ exec_instruction(
       break;
 
    case TGSI_OPCODE_EXPBASE2:
-    /* TGSI_OPCODE_EX2 */
+   /* TGSI_OPCODE_EX2 */
       FETCH(&r[0], 0, CHAN_X);
 
 #if FAST_MATH
@@ -2191,7 +2221,7 @@ exec_instruction(
 #endif
 
       FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
-        STORE( &r[0], 0, chan_index );
+         STORE( &r[0], 0, chan_index );
       }
       break;
 
@@ -2205,19 +2235,19 @@ exec_instruction(
       break;
 
    case TGSI_OPCODE_POWER:
-      /* TGSI_OPCODE_POW */
+   /* TGSI_OPCODE_POW */
       FETCH(&r[0], 0, CHAN_X);
       FETCH(&r[1], 1, CHAN_X);
 
       micro_pow( &r[0], &r[0], &r[1] );
 
       FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
-        STORE( &r[0], 0, chan_index );
+         STORE( &r[0], 0, chan_index );
       }
       break;
 
    case TGSI_OPCODE_CROSSPRODUCT:
-      /* TGSI_OPCODE_XPD */
+   /* TGSI_OPCODE_XPD */
       FETCH(&r[0], 0, CHAN_Y);
       FETCH(&r[1], 1, CHAN_Z);
 
@@ -2260,6 +2290,7 @@ exec_instruction(
       break;
 
     case TGSI_OPCODE_MULTIPLYMATRIX:
+       /* XXX: considered for removal */
        assert (0);
        break;
 
@@ -2274,7 +2305,12 @@ exec_instruction(
        break;
 
    case TGSI_OPCODE_RCC:
-      assert (0);
+      FETCH(&r[0], 0, CHAN_X);
+      micro_div(&r[0], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &r[0]);
+      micro_float_clamp(&r[0], &r[0]);
+      FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+         STORE(&r[0], 0, chan_index);
+      }
       break;
 
    case TGSI_OPCODE_DPH:
@@ -2300,7 +2336,7 @@ exec_instruction(
       micro_add( &r[0], &r[0], &r[1] );
 
       FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
-        STORE( &r[0], 0, chan_index );
+         STORE( &r[0], 0, chan_index );
       }
       break;
 
@@ -2310,7 +2346,7 @@ exec_instruction(
       micro_cos( &r[0], &r[0] );
 
       FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
-        STORE( &r[0], 0, chan_index );
+         STORE( &r[0], 0, chan_index );
       }
       break;
 
@@ -2355,7 +2391,52 @@ exec_instruction(
       break;
 
    case TGSI_OPCODE_RFL:
-      assert (0);
+      if (IS_CHANNEL_ENABLED(*inst, CHAN_X) ||
+          IS_CHANNEL_ENABLED(*inst, CHAN_Y) ||
+          IS_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+         /* r0 = dp3(src0, src0) */
+         FETCH(&r[2], 0, CHAN_X);
+         micro_mul(&r[0], &r[2], &r[2]);
+         FETCH(&r[4], 0, CHAN_Y);
+         micro_mul(&r[8], &r[4], &r[4]);
+         micro_add(&r[0], &r[0], &r[8]);
+         FETCH(&r[6], 0, CHAN_Z);
+         micro_mul(&r[8], &r[6], &r[6]);
+         micro_add(&r[0], &r[0], &r[8]);
+
+         /* r1 = dp3(src0, src1) */
+         FETCH(&r[3], 1, CHAN_X);
+         micro_mul(&r[1], &r[2], &r[3]);
+         FETCH(&r[5], 1, CHAN_Y);
+         micro_mul(&r[8], &r[4], &r[5]);
+         micro_add(&r[1], &r[1], &r[8]);
+         FETCH(&r[7], 1, CHAN_Z);
+         micro_mul(&r[8], &r[6], &r[7]);
+         micro_add(&r[1], &r[1], &r[8]);
+
+         /* r1 = 2 * r1 / r0 */
+         micro_add(&r[1], &r[1], &r[1]);
+         micro_div(&r[1], &r[1], &r[0]);
+
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) {
+            micro_mul(&r[2], &r[2], &r[1]);
+            micro_sub(&r[2], &r[2], &r[3]);
+            STORE(&r[2], 0, CHAN_X);
+         }
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) {
+            micro_mul(&r[4], &r[4], &r[1]);
+            micro_sub(&r[4], &r[4], &r[5]);
+            STORE(&r[4], 0, CHAN_Y);
+         }
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+            micro_mul(&r[6], &r[6], &r[1]);
+            micro_sub(&r[6], &r[6], &r[7]);
+            STORE(&r[6], 0, CHAN_Z);
+         }
+      }
+      if (IS_CHANNEL_ENABLED(*inst, CHAN_W)) {
+         STORE(&mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W);
+      }
       break;
 
    case TGSI_OPCODE_SEQ:
@@ -2370,7 +2451,9 @@ exec_instruction(
       break;
 
    case TGSI_OPCODE_SFL:
-      assert (0);
+      FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+         STORE(&mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], 0, chan_index);
+      }
       break;
 
    case TGSI_OPCODE_SGT:
@@ -2409,7 +2492,9 @@ exec_instruction(
       break;
 
    case TGSI_OPCODE_STR:
-      assert (0);
+      FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+         STORE(&mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, chan_index);
+      }
       break;
 
    case TGSI_OPCODE_TEX:
@@ -2466,7 +2551,40 @@ exec_instruction(
       break;
 
    case TGSI_OPCODE_X2D:
-      assert (0);
+      FETCH(&r[0], 1, CHAN_X);
+      FETCH(&r[1], 1, CHAN_Y);
+      if (IS_CHANNEL_ENABLED(*inst, CHAN_X) ||
+          IS_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+         FETCH(&r[2], 2, CHAN_X);
+         micro_mul(&r[2], &r[2], &r[0]);
+         FETCH(&r[3], 2, CHAN_Y);
+         micro_mul(&r[3], &r[3], &r[1]);
+         micro_add(&r[2], &r[2], &r[3]);
+         FETCH(&r[3], 0, CHAN_X);
+         micro_add(&r[2], &r[2], &r[3]);
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) {
+            STORE(&r[2], 0, CHAN_X);
+         }
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+            STORE(&r[2], 0, CHAN_Z);
+         }
+      }
+      if (IS_CHANNEL_ENABLED(*inst, CHAN_Y) ||
+          IS_CHANNEL_ENABLED(*inst, CHAN_W)) {
+         FETCH(&r[2], 2, CHAN_Z);
+         micro_mul(&r[2], &r[2], &r[0]);
+         FETCH(&r[3], 2, CHAN_W);
+         micro_mul(&r[3], &r[3], &r[1]);
+         micro_add(&r[2], &r[2], &r[3]);
+         FETCH(&r[3], 0, CHAN_Y);
+         micro_add(&r[2], &r[2], &r[3]);
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) {
+            STORE(&r[2], 0, CHAN_Y);
+         }
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_W)) {
+            STORE(&r[2], 0, CHAN_W);
+         }
+      }
       break;
 
    case TGSI_OPCODE_ARA:
@@ -2551,14 +2669,14 @@ exec_instruction(
    case TGSI_OPCODE_SCS:
       if( IS_CHANNEL_ENABLED( *inst, CHAN_X ) || IS_CHANNEL_ENABLED( *inst, CHAN_Y ) ) {
          FETCH( &r[0], 0, CHAN_X );
-      }
-      if( IS_CHANNEL_ENABLED( *inst, CHAN_X ) ) {
-         micro_cos( &r[1], &r[0] );
-         STORE( &r[1], 0, CHAN_X );
-      }
-      if( IS_CHANNEL_ENABLED( *inst, CHAN_Y ) ) {
-         micro_sin( &r[1], &r[0] );
-         STORE( &r[1], 0, CHAN_Y );
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) {
+            micro_cos(&r[1], &r[0]);
+            STORE(&r[1], 0, CHAN_X);
+         }
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) {
+            micro_sin(&r[1], &r[0]);
+            STORE(&r[1], 0, CHAN_Y);
+         }
       }
       if( IS_CHANNEL_ENABLED( *inst, CHAN_Z ) ) {
          STORE( &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], 0, CHAN_Z );
@@ -2570,32 +2688,36 @@ exec_instruction(
 
    case TGSI_OPCODE_NRM:
       /* 3-component vector normalize */
-      {
-         union tgsi_exec_channel tmp, dot;
-
-         /* tmp = dp3(src0, src0): */
-         FETCH( &r[0], 0, CHAN_X );
-         micro_mul( &tmp, &r[0], &r[0] );
-
-         FETCH( &r[1], 0, CHAN_Y );
-         micro_mul( &dot, &r[1], &r[1] );
-         micro_add( &tmp, &tmp, &dot );
-
-         FETCH( &r[2], 0, CHAN_Z );
-         micro_mul( &dot, &r[2], &r[2] );
-         micro_add( &tmp, &tmp, &dot );
-
-         /* tmp = 1 / sqrt(tmp) */
-         micro_sqrt( &tmp, &tmp );
-         micro_div( &tmp, &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &tmp );
-
-         /* note: w channel is undefined */
-         FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
-            /* chan = chan * tmp */
-            micro_mul( &r[chan_index], &tmp, &r[chan_index] );
-            STORE( &r[chan_index], 0, chan_index );
+      if(IS_CHANNEL_ENABLED(*inst, CHAN_X) ||
+         IS_CHANNEL_ENABLED(*inst, CHAN_Y) ||
+         IS_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+         /* r3 = sqrt(dp3(src0, src0)) */
+         FETCH(&r[0], 0, CHAN_X);
+         micro_mul(&r[3], &r[0], &r[0]);
+         FETCH(&r[1], 0, CHAN_Y);
+         micro_mul(&r[4], &r[1], &r[1]);
+         micro_add(&r[3], &r[3], &r[4]);
+         FETCH(&r[2], 0, CHAN_Z);
+         micro_mul(&r[4], &r[2], &r[2]);
+         micro_add(&r[3], &r[3], &r[4]);
+         micro_sqrt(&r[3], &r[3]);
+
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) {
+            micro_div(&r[0], &r[0], &r[3]);
+            STORE(&r[0], 0, CHAN_X);
+         }
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) {
+            micro_div(&r[1], &r[1], &r[3]);
+            STORE(&r[1], 0, CHAN_Y);
+         }
+         if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+            micro_div(&r[2], &r[2], &r[3]);
+            STORE(&r[2], 0, CHAN_Z);
          }
       }
+      if (IS_CHANNEL_ENABLED(*inst, CHAN_W)) {
+         STORE(&mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W);
+      }
       break;
 
    case TGSI_OPCODE_NRM4:
@@ -2956,5 +3078,3 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach )
 
    return ~mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];
 }
-
-
index 68c7a6b7f58749b158662cf56a3ea40703f1a8d2..2b8a6f0fb190c39b17f4205d56168fabeba9bbdd 100644 (file)
@@ -25,7 +25,7 @@
  * 
  **************************************************************************/
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "tgsi_info.h"
 
 static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
index 5371a88b96410f58e3443a1ee1824d0b413844a1..d88c2558d81dcfd6541a7d255a8b0515719129dd 100644 (file)
@@ -25,7 +25,7 @@
  * 
  **************************************************************************/
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "tgsi_iterate.h"
 
 boolean
index d374b16f9a15992a4993b49fe281acad95126994..0081f74ffc491074f6cc7846943faec10af7e125 100644 (file)
@@ -25,7 +25,7 @@
  * 
  **************************************************************************/
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_shader_tokens.h"
 #include "tgsi_parse.h"
 #include "tgsi_build.h"
@@ -154,10 +154,17 @@ tgsi_parse_token(
 
       switch (imm->Immediate.DataType) {
       case TGSI_IMM_FLOAT32:
-         imm->u.Pointer = MALLOC(
-            sizeof( struct tgsi_immediate_float32 ) * (imm->Immediate.NrTokens - 1) );
-         for( i = 0; i < imm->Immediate.NrTokens - 1; i++ ) {
-            next_token( ctx, (struct tgsi_immediate_float32 *) &imm->u.ImmediateFloat32[i] );
+         {
+            uint imm_count = imm->Immediate.NrTokens - 1;
+            struct tgsi_immediate_float32 *data;
+
+            data = (struct tgsi_immediate_float32 *) MALLOC(sizeof(struct tgsi_immediate_float32) * imm_count);
+            if (data) {
+               for (i = 0; i < imm_count; i++) {
+                  next_token(ctx, &data[i]);
+               }
+               imm->u.ImmediateFloat32 = data;
+            }
          }
          break;
 
index f365030e52677f365754e87f358275d9034532ec..0c64ae5713100db80969b05529326239710f1542 100644 (file)
@@ -33,7 +33,7 @@
 
 #if defined(PIPE_ARCH_PPC)
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_shader_tokens.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
index bc7b941b7853901ee7dd6ef5d37009b07c9e977a..6f1f5c2b4b0b624216283d2c9d5b14389f5881c8 100644 (file)
  * 
  **************************************************************************/
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "tgsi_sanity.h"
 #include "tgsi_info.h"
 #include "tgsi_iterate.h"
 
-#define MAX_REGISTERS 256
-
 typedef uint reg_flag;
 
 #define BITS_IN_REG_FLAG (sizeof( reg_flag ) * 8)
 
+#define MAX_REGISTERS 256
+#define MAX_REG_FLAGS ((MAX_REGISTERS + BITS_IN_REG_FLAG - 1) / BITS_IN_REG_FLAG)
+
 struct sanity_check_ctx
 {
    struct tgsi_iterate_context iter;
 
-   reg_flag regs_decl[TGSI_FILE_COUNT][MAX_REGISTERS / BITS_IN_REG_FLAG];
-   reg_flag regs_used[TGSI_FILE_COUNT][MAX_REGISTERS / BITS_IN_REG_FLAG];
+   reg_flag regs_decl[TGSI_FILE_COUNT][MAX_REG_FLAGS];
+   reg_flag regs_used[TGSI_FILE_COUNT][MAX_REG_FLAGS];
    boolean regs_ind_used[TGSI_FILE_COUNT];
    uint num_imms;
    uint num_instructions;
@@ -89,7 +90,7 @@ check_file_name(
    uint file )
 {
    if (file <= TGSI_FILE_NULL || file >= TGSI_FILE_COUNT) {
-      report_error( ctx, "Invalid register file name" );
+      report_error( ctx, "(%u): Invalid register file name", file );
       return FALSE;
    }
    return TRUE;
@@ -113,7 +114,7 @@ is_any_register_declared(
 {
    uint i;
 
-   for (i = 0; i < MAX_REGISTERS / BITS_IN_REG_FLAG; i++)
+   for (i = 0; i < MAX_REG_FLAGS; i++)
       if (ctx->regs_decl[file][i])
          return TRUE;
    return FALSE;
@@ -162,9 +163,8 @@ check_register_usage(
       ctx->regs_ind_used[file] = TRUE;
    }
    else {
-      if (index < 0 || index > MAX_REGISTERS) {
-         report_error( ctx, "%s[%i]: Invalid index %s",
-                       file_names[file], index, name );
+      if (index < 0 || index >= MAX_REGISTERS) {
+         report_error( ctx, "%s[%d]: Invalid %s index", file_names[file], index, name );
          return FALSE;
       }
 
@@ -193,15 +193,15 @@ iter_instruction(
 
    info = tgsi_get_opcode_info( inst->Instruction.Opcode );
    if (info == NULL) {
-      report_error( ctx, "Invalid instruction opcode" );
+      report_error( ctx, "(%u): Invalid instruction opcode", inst->Instruction.Opcode );
       return TRUE;
    }
 
    if (info->num_dst != inst->Instruction.NumDstRegs) {
-      report_error( ctx, "Invalid number of destination operands" );
+      report_error( ctx, "Invalid number of destination operands, should be %u", info->num_dst );
    }
    if (info->num_src != inst->Instruction.NumSrcRegs) {
-      report_error( ctx, "Invalid number of source operands" );
+      report_error( ctx, "Invalid number of source operands, should be %u", info->num_src );
    }
 
    /* Check destination and source registers' validity.
@@ -266,7 +266,7 @@ iter_declaration(
       return TRUE;
    for (i = decl->DeclarationRange.First; i <= decl->DeclarationRange.Last; i++) {
       if (is_register_declared( ctx, file, i ))
-         report_error( ctx, "The same register declared twice" );
+         report_error( ctx, "%s[%u]: The same register declared more than once", file_names[file], i );
       ctx->regs_decl[file][i / BITS_IN_REG_FLAG] |= (1 << (i % BITS_IN_REG_FLAG));
    }
 
@@ -295,7 +295,7 @@ iter_immediate(
    /* Check data type validity.
     */
    if (imm->Immediate.DataType != TGSI_IMM_FLOAT32) {
-      report_error( ctx, "Invalid immediate data type" );
+      report_error( ctx, "(%u): Invalid immediate data type", imm->Immediate.DataType );
       return TRUE;
    }
 
@@ -322,7 +322,7 @@ epilog(
 
       for (i = 0; i < MAX_REGISTERS; i++) {
          if (is_register_declared( ctx, file, i ) && !is_register_used( ctx, file, i ) && !ctx->regs_ind_used[file]) {
-            report_warning( ctx, "Register never used" );
+            report_warning( ctx, "%s[%u]: Register never used", file_names[file], i );
          }
       }
    }
index d02205a63ef76b471a559d64062099f1af60f011..c535788819f99f068effe3606a8ff59aad767348 100644 (file)
@@ -151,7 +151,14 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
          break;
 
       case TGSI_TOKEN_TYPE_IMMEDIATE:
-         info->immediate_count++;
+         {
+            uint reg = info->immediate_count++;
+            uint file = TGSI_FILE_IMMEDIATE;
+
+            info->file_mask[file] |= (1 << reg);
+            info->file_count[file]++;
+            info->file_max[file] = MAX2(info->file_max[file], (int)reg);
+         }
          break;
 
       default:
index 481ba89c5e7ff7c0d44fda5ab60385d75155fc5f..d70bcd03c5caec08f847cadc09e1ddb1bbbda736 100644 (file)
@@ -29,7 +29,7 @@
 
 #if defined(PIPE_ARCH_X86)
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_shader_tokens.h"
 #include "util/u_math.h"
 #if defined(PIPE_ARCH_SSE)
@@ -1575,6 +1575,7 @@ emit_instruction(
    case TGSI_OPCODE_RSQ:
    /* TGSI_OPCODE_RECIPSQRT */
       FETCH( func, *inst, 0, 0, CHAN_X );
+      emit_abs( func, 0 );
       emit_rsqrt( func, 1, 0 );
       FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
          STORE( func, *inst, 1, 0, chan_index );
index 1e822fbbea1bfc5f6b4c8534075c333f0ac15207..58fe07c11d1ac003e371001f85cfd1477d1e9c64 100644 (file)
@@ -25,7 +25,7 @@
  * 
  **************************************************************************/
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "tgsi_text.h"
 #include "tgsi_build.h"
 #include "tgsi_info.h"
index ea87da31e50dde5cd6da901e203a4826daddd69c..062c1be938a3852bde6572ddf855a7efe76739b6 100644 (file)
@@ -31,7 +31,7 @@
  * Authors:  Brian Paul
  */
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 #include "tgsi_transform.h"
 
index 50101a9bb0cafd5372388ecf58253f1ddfb7d918..71f8a6ca401262e6e92149c685e2b32bd3f27976 100644 (file)
@@ -25,7 +25,7 @@
  * 
  **************************************************************************/
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_shader_tokens.h"
 #include "tgsi_parse.h"
 #include "tgsi_build.h"
index ad2a5b705e4f5cf9f2b32c92653360d24b4c25be..3c82f8ae03763b7c27095517b89333933ddb6048 100644 (file)
@@ -10,6 +10,3 @@ C_SOURCES = \
         translate_cache.c
 
 include ../../Makefile.template
-
-symlinks:
-
index 44c23777218c28f8e6bd6af7bf54d18cf6ba7d20..160df8dfa71ec168dd19b84b5e2e214478e5d2f0 100644 (file)
@@ -4,7 +4,7 @@ include $(TOP)/configs/current
 LIBNAME = util
 
 C_SOURCES = \
-       p_debug.c \
+       u_debug.c \
        u_blit.c \
        u_cache.c \
        u_draw_quad.c \
@@ -27,6 +27,3 @@ C_SOURCES = \
        u_simple_screen.c
 
 include ../../Makefile.template
-
-symlinks:
-
index 35f683fb8e6a06f8bcf2fa7e402465e9c648d346..9d5dd006f08982fd92b472a9feb2aa5a4e6e74eb 100644 (file)
@@ -3,11 +3,13 @@ Import('*')
 util = env.ConvenienceLibrary(
        target = 'util',
        source = [
-               'p_debug.c',
-               'p_debug_mem.c',
-               'p_debug_prof.c',
+               'u_bitmask.c',
                'u_blit.c',
                'u_cache.c',
+               'u_debug.c',
+               'u_debug_memory.c',
+               'u_debug_profile.c',
+               'u_debug_stack.c',
                'u_draw_quad.c',
                'u_gen_mipmap.c',
                'u_handle_table.c',
diff --git a/src/gallium/auxiliary/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c
deleted file mode 100644 (file)
index f373f94..0000000
+++ /dev/null
@@ -1,782 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * Copyright (c) 2008 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
-
-#include "pipe/p_config.h" 
-
-#include <stdarg.h>
-
-
-#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
-
-#include <windows.h>
-#include <winddi.h>
-
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE)
-
-#include <stdio.h> 
-#include <stdlib.h> 
-#include <windows.h> 
-#include <types.h> 
-
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
-
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN      // Exclude rarely-used stuff from Windows headers
-#endif
-#include <windows.h>
-
-#else
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#endif
-
-#include "pipe/p_compiler.h" 
-#include "pipe/p_debug.h" 
-#include "pipe/p_format.h" 
-#include "pipe/p_state.h" 
-#include "pipe/p_inlines.h" 
-#include "util/u_memory.h" 
-#include "util/u_string.h" 
-#include "util/u_stream.h" 
-#include "util/u_math.h" 
-#include "util/u_tile.h" 
-
-
-#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
-static INLINE void 
-_EngDebugPrint(const char *format, ...)
-{
-   va_list ap;
-   va_start(ap, format);
-   EngDebugPrint("", (PCHAR)format, ap);
-   va_end(ap);
-}
-#endif
-
-
-void _debug_vprintf(const char *format, va_list ap)
-{
-#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
-   /* EngDebugPrint does not handle float point arguments, so we need to use
-    * our own vsnprintf implementation. It is also very slow, so buffer until
-    * we find a newline. */
-   static char buf[512] = {'\0'};
-   size_t len = strlen(buf);
-   int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
-   if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) {
-      _EngDebugPrint("%s", buf);
-      buf[0] = '\0';
-   }
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
-   /* EngDebugPrint does not handle float point arguments, so we need to use
-    * our own vsnprintf implementation. It is also very slow, so buffer until
-    * we find a newline. */
-   static char buf[512 + 1] = {'\0'};
-   size_t len = strlen(buf);
-   int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
-   if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) {
-      OutputDebugStringA(buf);
-      buf[0] = '\0';
-   }
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE)
-   wchar_t *wide_format;
-   long wide_str_len;   
-   char buf[512];   
-   int ret;   
-#if (_WIN32_WCE < 600)
-   ret = vsprintf(buf, format, ap);   
-   if(ret < 0){   
-       sprintf(buf, "Cant handle debug print!");   
-       ret = 25;
-   }
-#else
-   ret = vsprintf_s(buf, 512, format, ap);   
-   if(ret < 0){   
-       sprintf_s(buf, 512, "Cant handle debug print!");   
-       ret = 25;
-   }
-#endif
-   buf[ret] = '\0';   
-   /* Format is ascii - needs to be converted to wchar_t for printing */   
-   wide_str_len = MultiByteToWideChar(CP_ACP, 0, (const char *) buf, -1, NULL, 0);   
-   wide_format = (wchar_t *) malloc((wide_str_len+1) * sizeof(wchar_t));   
-   if (wide_format) {   
-      MultiByteToWideChar(CP_ACP, 0, (const char *) buf, -1,   
-            wide_format, wide_str_len);   
-      NKDbgPrintfW(wide_format, wide_format);   
-      free(wide_format);   
-   } 
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
-   /* TODO */
-#else /* !PIPE_SUBSYSTEM_WINDOWS */
-#ifdef DEBUG
-   vfprintf(stderr, format, ap);
-#endif
-#endif
-}
-
-
-#ifdef DEBUG
-void debug_print_blob( const char *name,
-                       const void *blob,
-                       unsigned size )
-{
-   const unsigned *ublob = (const unsigned *)blob;
-   unsigned i;
-
-   debug_printf("%s (%d dwords%s)\n", name, size/4,
-                size%4 ? "... plus a few bytes" : "");
-
-   for (i = 0; i < size/4; i++) {
-      debug_printf("%d:\t%08x\n", i, ublob[i]);
-   }
-}
-#endif
-
-
-void _debug_break(void) 
-{
-#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
-   __asm("int3");
-#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
-   _asm {int 3};
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
-   EngDebugBreak();
-#else
-   abort();
-#endif
-}
-
-
-#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
-static const char *
-find(const char *start, const char *end, char c) 
-{
-   const char *p;
-   for(p = start; !end || p != end; ++p) {
-      if(*p == c)
-        return p;
-      if(*p < 32)
-        break;
-   }
-   return NULL;
-}
-
-static int 
-compare(const char *start, const char *end, const char *s)
-{
-   const char *p, *q;
-   for(p = start, q = s; p != end && *q != '\0'; ++p, ++q) {
-      if(*p != *q)
-        return 0;
-   }
-   return p == end && *q == '\0';
-}
-
-static void 
-copy(char *dst, const char *start, const char *end, size_t n) 
-{
-   const char *p;
-   char *q;
-   for(p = start, q = dst, n = n - 1; p != end && n; ++p, ++q, --n)
-      *q = *p;
-   *q = '\0';
-}
-#endif
-
-
-static INLINE const char *
-_debug_get_option(const char *name)
-{
-#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
-   /* EngMapFile creates the file if it does not exists, so it must either be
-    * disabled on release versions (or put in a less conspicuous place). */
-#ifdef DEBUG
-   const char *result = NULL;
-   ULONG_PTR iFile = 0;
-   const void *pMap = NULL;
-   const char *sol, *eol, *sep;
-   static char output[1024];
-   
-   pMap = EngMapFile(L"\\??\\c:\\gallium.cfg", 0, &iFile);
-   if(pMap) {
-      sol = (const char *)pMap;
-      while(1) {
-        /* TODO: handle LF line endings */
-        eol = find(sol, NULL, '\r');
-        if(!eol || eol == sol)
-           break;
-        sep = find(sol, eol, '=');
-        if(!sep)
-           break;
-        if(compare(sol, sep, name)) {
-           copy(output, sep + 1, eol, sizeof(output));
-           result = output;
-           break;
-        }
-        sol = eol + 2;
-      }
-      EngUnmapFile(iFile);
-   }
-   return result;
-#else
-   return NULL;
-#endif
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) 
-   /* TODO: implement */
-   return NULL;
-#else
-   return getenv(name);
-#endif
-}
-
-const char *
-debug_get_option(const char *name, const char *dfault)
-{
-   const char *result;
-
-   result = _debug_get_option(name);
-   if(!result)
-      result = dfault;
-      
-   debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? result : "(null)");
-   
-   return result;
-}
-
-boolean
-debug_get_bool_option(const char *name, boolean dfault)
-{
-   const char *str = _debug_get_option(name);
-   boolean result;
-   
-   if(str == NULL)
-      result = dfault;
-   else if(!util_strcmp(str, "n"))
-      result = FALSE;
-   else if(!util_strcmp(str, "no"))
-      result = FALSE;
-   else if(!util_strcmp(str, "0"))
-      result = FALSE;
-   else if(!util_strcmp(str, "f"))
-      result = FALSE;
-   else if(!util_strcmp(str, "false"))
-      result = FALSE;
-   else
-      result = TRUE;
-
-   debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? "TRUE" : "FALSE");
-   
-   return result;
-}
-
-
-long
-debug_get_num_option(const char *name, long dfault)
-{
-   long result;
-   const char *str;
-   
-   str = _debug_get_option(name);
-   if(!str)
-      result = dfault;
-   else {
-      long sign;
-      char c;
-      c = *str++;
-      if(c == '-') {
-        sign = -1;
-        c = *str++;
-      } 
-      else {
-        sign = 1;
-      }
-      result = 0;
-      while('0' <= c && c <= '9') {
-        result = result*10 + (c - '0');
-        c = *str++;
-      }
-      result *= sign;
-   }
-   
-   debug_printf("%s: %s = %li\n", __FUNCTION__, name, result);
-
-   return result;
-}
-
-
-unsigned long
-debug_get_flags_option(const char *name, 
-                       const struct debug_named_value *flags,
-                       unsigned long dfault)
-{
-   unsigned long result;
-   const char *str;
-   
-   str = _debug_get_option(name);
-   if(!str)
-      result = dfault;
-   else if (!util_strcmp(str, "help")) {
-      result = dfault;
-      while (flags->name) {
-         debug_printf("%s: help for %s: %s [0x%lx]\n", __FUNCTION__, name, flags->name, flags->value);
-         flags++;
-      }
-   }
-   else {
-      result = 0;
-      while( flags->name ) {
-        if (!util_strcmp(str, "all") || util_strstr(str, flags->name ))
-           result |= flags->value;
-        ++flags;
-      }
-   }
-
-   if (str) {
-      debug_printf("%s: %s = 0x%lx (%s)\n", __FUNCTION__, name, result, str);
-   }
-   else {
-      debug_printf("%s: %s = 0x%lx\n", __FUNCTION__, name, result);
-   }
-
-   return result;
-}
-
-
-void _debug_assert_fail(const char *expr, 
-                        const char *file, 
-                        unsigned line, 
-                        const char *function) 
-{
-   _debug_printf("%s:%u:%s: Assertion `%s' failed.\n", file, line, function, expr);
-#if defined(PIPE_OS_WINDOWS) && !defined(PIPE_SUBSYSTEM_WINDOWS_USER)
-   if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", FALSE))
-#else
-   if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", TRUE))
-#endif
-      debug_break();
-   else
-      _debug_printf("continuing...\n");
-}
-
-
-const char *
-debug_dump_enum(const struct debug_named_value *names, 
-                unsigned long value)
-{
-   static char rest[64];
-   
-   while(names->name) {
-      if(names->value == value)
-        return names->name;
-      ++names;
-   }
-
-   util_snprintf(rest, sizeof(rest), "0x%08lx", value);
-   return rest;
-}
-
-
-const char *
-debug_dump_enum_noprefix(const struct debug_named_value *names, 
-                         const char *prefix,
-                         unsigned long value)
-{
-   static char rest[64];
-   
-   while(names->name) {
-      if(names->value == value) {
-         const char *name = names->name;
-         while (*name == *prefix) {
-            name++;
-            prefix++;
-         }
-         return name;
-      }
-      ++names;
-   }
-
-   
-
-   util_snprintf(rest, sizeof(rest), "0x%08lx", value);
-   return rest;
-}
-
-
-const char *
-debug_dump_flags(const struct debug_named_value *names, 
-                 unsigned long value)
-{
-   static char output[4096];
-   static char rest[256];
-   int first = 1;
-
-   output[0] = '\0';
-
-   while(names->name) {
-      if((names->value & value) == names->value) {
-        if (!first)
-           util_strncat(output, "|", sizeof(output));
-        else
-           first = 0;
-        util_strncat(output, names->name, sizeof(output));
-        value &= ~names->value;
-      }
-      ++names;
-   }
-   
-   if (value) {
-      if (!first)
-        util_strncat(output, "|", sizeof(output));
-      else
-        first = 0;
-      
-      util_snprintf(rest, sizeof(rest), "0x%08lx", value);
-      util_strncat(output, rest, sizeof(output));
-   }
-   
-   if(first)
-      return "0";
-   
-   return output;
-}
-
-
-static const struct debug_named_value pipe_format_names[] = {
-#ifdef DEBUG
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_NONE),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8R8G8B8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_X8R8G8B8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_B8G8R8A8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_B8G8R8X8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_A1R5G5B5_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_A4R4G4B4_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R5G6B5_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_A2B10G10R10_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_L8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_I8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8L8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_L16_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_YCBCR),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_YCBCR_REV),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_Z16_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_Z32_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_Z32_FLOAT),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_S8Z24_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_Z24S8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_X8Z24_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_Z24X8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_S8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R64_FLOAT),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R64G64_FLOAT),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R64G64B64_FLOAT),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R64G64B64A64_FLOAT),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32_FLOAT),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32_FLOAT),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32_FLOAT),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32A32_FLOAT),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32A32_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32A32_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32A32_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32A32_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16A16_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16A16_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16A16_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16A16_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8A8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8X8_UNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8A8_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8X8_USCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8A8_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8X8_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_B6G5R5_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8B8G8R8_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_X8B8G8R8_SNORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8A8_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8X8_SSCALED),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_L8_SRGB),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8L8_SRGB),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8_SRGB),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8A8_SRGB),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8X8_SRGB),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8R8G8B8_SRGB),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_X8R8G8B8_SRGB),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_B8G8R8A8_SRGB),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_B8G8R8X8_SRGB),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_X8UB8UG8SR8S_NORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_B6UG5SR5S_NORM),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT1_RGB),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT1_RGBA),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT3_RGBA),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT5_RGBA),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT1_SRGB),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT1_SRGBA),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT3_SRGBA),
-   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT5_SRGBA),
-#endif
-   DEBUG_NAMED_VALUE_END
-};
-
-#ifdef DEBUG
-void debug_print_format(const char *msg, unsigned fmt )
-{
-   debug_printf("%s: %s\n", msg, debug_dump_enum(pipe_format_names, fmt)); 
-}
-#endif
-
-const char *pf_name( enum pipe_format format )
-{
-   return debug_dump_enum(pipe_format_names, format);
-}
-
-
-#ifdef DEBUG
-void debug_dump_image(const char *prefix,
-                      unsigned format, unsigned cpp,
-                      unsigned width, unsigned height,
-                      unsigned stride,
-                      const void *data)     
-{
-#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
-   static unsigned no = 0; 
-   char filename[256];
-   WCHAR wfilename[sizeof(filename)];
-   ULONG_PTR iFile = 0;
-   struct {
-      unsigned format;
-      unsigned cpp;
-      unsigned width;
-      unsigned height;
-   } header;
-   unsigned char *pMap = NULL;
-   unsigned i;
-
-   util_snprintf(filename, sizeof(filename), "\\??\\c:\\%03u%s.raw", ++no, prefix);
-   for(i = 0; i < sizeof(filename); ++i)
-      wfilename[i] = (WCHAR)filename[i];
-   
-   pMap = (unsigned char *)EngMapFile(wfilename, sizeof(header) + height*width*cpp, &iFile);
-   if(!pMap)
-      return;
-   
-   header.format = format;
-   header.cpp = cpp;
-   header.width = width;
-   header.height = height;
-   memcpy(pMap, &header, sizeof(header));
-   pMap += sizeof(header);
-   
-   for(i = 0; i < height; ++i) {
-      memcpy(pMap, (unsigned char *)data + stride*i, cpp*width);
-      pMap += cpp*width;
-   }
-      
-   EngUnmapFile(iFile);
-#endif
-}
-
-void debug_dump_surface(const char *prefix,
-                        struct pipe_surface *surface)     
-{
-   unsigned surface_usage;
-   void *data;
-
-   if (!surface)
-      goto error1;
-
-   /* XXX: force mappable surface */
-   surface_usage = surface->usage;
-   surface->usage |= PIPE_BUFFER_USAGE_CPU_READ;
-   
-   data = pipe_surface_map(surface, 
-                           PIPE_BUFFER_USAGE_CPU_READ);
-   if(!data)
-      goto error2;
-   
-   debug_dump_image(prefix, 
-                    surface->format,
-                    surface->block.size, 
-                    surface->nblocksx,
-                    surface->nblocksy,
-                    surface->stride,
-                    data);
-   
-   pipe_surface_unmap(surface);
-error2:
-   surface->usage = surface_usage;
-error1:
-   ;
-}
-
-
-#pragma pack(push,2)
-struct bmp_file_header {
-   uint16_t bfType;
-   uint32_t bfSize;
-   uint16_t bfReserved1;
-   uint16_t bfReserved2;
-   uint32_t bfOffBits;
-};
-#pragma pack(pop)
-
-struct bmp_info_header {
-   uint32_t biSize;
-   int32_t biWidth;
-   int32_t biHeight;
-   uint16_t biPlanes;
-   uint16_t biBitCount;
-   uint32_t biCompression;
-   uint32_t biSizeImage;
-   int32_t biXPelsPerMeter;
-   int32_t biYPelsPerMeter;
-   uint32_t biClrUsed;
-   uint32_t biClrImportant;
-};
-
-struct bmp_rgb_quad {
-   uint8_t rgbBlue;
-   uint8_t rgbGreen;
-   uint8_t rgbRed;
-   uint8_t rgbAlpha;
-};
-
-void 
-debug_dump_surface_bmp(const char *filename,
-                       struct pipe_surface *surface)
-{
-#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
-   struct util_stream *stream;
-   unsigned surface_usage;
-   struct bmp_file_header bmfh;
-   struct bmp_info_header bmih;
-   float *rgba;
-   unsigned x, y;
-
-   if (!surface)
-      goto error1;
-
-   rgba = MALLOC(surface->width*4*sizeof(float));
-   if(!rgba)
-      goto error1;
-   
-   bmfh.bfType = 0x4d42;
-   bmfh.bfSize = 14 + 40 + surface->height*surface->width*4;
-   bmfh.bfReserved1 = 0;
-   bmfh.bfReserved2 = 0;
-   bmfh.bfOffBits = 14 + 40;
-   
-   bmih.biSize = 40;
-   bmih.biWidth = surface->width;
-   bmih.biHeight = surface->height;
-   bmih.biPlanes = 1;
-   bmih.biBitCount = 32;
-   bmih.biCompression = 0;
-   bmih.biSizeImage = surface->height*surface->width*4;
-   bmih.biXPelsPerMeter = 0;
-   bmih.biYPelsPerMeter = 0;
-   bmih.biClrUsed = 0;
-   bmih.biClrImportant = 0;
-   
-   stream = util_stream_create(filename, bmfh.bfSize);
-   if(!stream)
-      goto error2;
-   
-   util_stream_write(stream, &bmfh, 14);
-   util_stream_write(stream, &bmih, 40);
-   
-   /* XXX: force mappable surface */
-   surface_usage = surface->usage;
-   surface->usage |= PIPE_BUFFER_USAGE_CPU_READ;
-
-   y = surface->height;
-   while(y--) {
-      pipe_get_tile_rgba(surface,
-                         0, y, surface->width, 1,
-                         rgba);
-      for(x = 0; x < surface->width; ++x)
-      {
-         struct bmp_rgb_quad pixel;
-         pixel.rgbRed   = float_to_ubyte(rgba[x*4 + 0]);
-         pixel.rgbGreen = float_to_ubyte(rgba[x*4 + 1]);
-         pixel.rgbBlue  = float_to_ubyte(rgba[x*4 + 2]);
-         pixel.rgbAlpha = float_to_ubyte(rgba[x*4 + 3]);
-         util_stream_write(stream, &pixel, 4);
-      }  
-   }
-   
-   surface->usage = surface_usage;
-
-   util_stream_close(stream);
-error2:
-   FREE(rgba);
-error1:
-   ;
-#endif
-}
-
-#endif
diff --git a/src/gallium/auxiliary/util/p_debug_mem.c b/src/gallium/auxiliary/util/p_debug_mem.c
deleted file mode 100644 (file)
index 250fd60..0000000
+++ /dev/null
@@ -1,311 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
-/**
- * @file
- * Memory debugging.
- * 
- * @author José Fonseca <jrfonseca@tungstengraphics.com>
- */
-
-#include "pipe/p_config.h" 
-
-#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
-#include <windows.h>
-#include <winddi.h>
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
-#include <wdm.h>
-#else
-#include <stdio.h>
-#include <stdlib.h>
-#endif
-
-#include "pipe/p_debug.h" 
-#include "util/u_double_list.h" 
-
-
-#define DEBUG_MEMORY_MAGIC 0x6e34090aU 
-
-
-#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) && !defined(WINCE)
-#define real_malloc(_size) EngAllocMem(0, _size, 'D3AG')
-#define real_free(_ptr) EngFreeMem(_ptr)
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
-#define real_malloc(_size) ExAllocatePool(0, _size)
-#define real_free(_ptr) ExFreePool(_ptr)
-#else
-#define real_malloc(_size) malloc(_size)
-#define real_free(_ptr) free(_ptr)
-#endif
-
-
-struct debug_memory_header 
-{
-   struct list_head head;
-   
-   unsigned long no;
-   const char *file;
-   unsigned line;
-   const char *function;
-   size_t size;
-   unsigned magic;
-};
-
-struct debug_memory_footer
-{
-   unsigned magic;
-};
-
-
-static struct list_head list = { &list, &list };
-
-static unsigned long last_no = 0;
-
-
-static INLINE struct debug_memory_header *
-header_from_data(void *data)
-{
-   if(data)
-      return (struct debug_memory_header *)((char *)data - sizeof(struct debug_memory_header));
-   else
-      return NULL;
-}
-
-static INLINE void *
-data_from_header(struct debug_memory_header *hdr)
-{
-   if(hdr)
-      return (void *)((char *)hdr + sizeof(struct debug_memory_header));
-   else
-      return NULL;
-}
-
-static INLINE struct debug_memory_footer *
-footer_from_header(struct debug_memory_header *hdr)
-{
-   if(hdr)
-      return (struct debug_memory_footer *)((char *)hdr + sizeof(struct debug_memory_header) + hdr->size);
-   else
-      return NULL;
-}
-
-
-void *
-debug_malloc(const char *file, unsigned line, const char *function,
-             size_t size) 
-{
-   struct debug_memory_header *hdr;
-   struct debug_memory_footer *ftr;
-   
-   hdr = real_malloc(sizeof(*hdr) + size + sizeof(*ftr));
-   if(!hdr) {
-      debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
-                   file, line, function,
-                   (long unsigned)size);
-      return NULL;
-   }
-   hdr->no = last_no++;
-   hdr->file = file;
-   hdr->line = line;
-   hdr->function = function;
-   hdr->size = size;
-   hdr->magic = DEBUG_MEMORY_MAGIC;
-
-   ftr = footer_from_header(hdr);
-   ftr->magic = DEBUG_MEMORY_MAGIC;
-   
-   LIST_ADDTAIL(&hdr->head, &list);
-   
-   return data_from_header(hdr);
-}
-
-void
-debug_free(const char *file, unsigned line, const char *function,
-           void *ptr) 
-{
-   struct debug_memory_header *hdr;
-   struct debug_memory_footer *ftr;
-   
-   if(!ptr)
-      return;
-   
-   hdr = header_from_data(ptr);
-   if(hdr->magic != DEBUG_MEMORY_MAGIC) {
-      debug_printf("%s:%u:%s: freeing bad or corrupted memory %p\n",
-                   file, line, function,
-                   ptr);
-      debug_assert(0);
-      return;
-   }
-
-   ftr = footer_from_header(hdr);
-   if(ftr->magic != DEBUG_MEMORY_MAGIC) {
-      debug_printf("%s:%u:%s: buffer overflow %p\n",
-                   hdr->file, hdr->line, hdr->function,
-                   ptr);
-      debug_assert(0);
-   }
-
-   LIST_DEL(&hdr->head);
-   hdr->magic = 0;
-   ftr->magic = 0;
-   
-   real_free(hdr);
-}
-
-void *
-debug_calloc(const char *file, unsigned line, const char *function,
-             size_t count, size_t size )
-{
-   void *ptr = debug_malloc( file, line, function, count * size );
-   if( ptr )
-      memset( ptr, 0, count * size );
-   return ptr;
-}
-
-void *
-debug_realloc(const char *file, unsigned line, const char *function,
-              void *old_ptr, size_t old_size, size_t new_size )
-{
-   struct debug_memory_header *old_hdr, *new_hdr;
-   struct debug_memory_footer *old_ftr, *new_ftr;
-   void *new_ptr;
-   
-   if(!old_ptr)
-      return debug_malloc( file, line, function, new_size );
-   
-   if(!new_size) {
-      debug_free( file, line, function, old_ptr );
-      return NULL;
-   }
-   
-   old_hdr = header_from_data(old_ptr);
-   if(old_hdr->magic != DEBUG_MEMORY_MAGIC) {
-      debug_printf("%s:%u:%s: reallocating bad or corrupted memory %p\n",
-                   file, line, function,
-                   old_ptr);
-      debug_assert(0);
-      return NULL;
-   }
-   
-   old_ftr = footer_from_header(old_hdr);
-   if(old_ftr->magic != DEBUG_MEMORY_MAGIC) {
-      debug_printf("%s:%u:%s: buffer overflow %p\n",
-                   old_hdr->file, old_hdr->line, old_hdr->function,
-                   old_ptr);
-      debug_assert(0);
-   }
-
-   /* alloc new */
-   new_hdr = real_malloc(sizeof(*new_hdr) + new_size + sizeof(*new_ftr));
-   if(!new_hdr) {
-      debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
-                   file, line, function,
-                   (long unsigned)new_size);
-      return NULL;
-   }
-   new_hdr->no = old_hdr->no;
-   new_hdr->file = old_hdr->file;
-   new_hdr->line = old_hdr->line;
-   new_hdr->function = old_hdr->function;
-   new_hdr->size = new_size;
-   new_hdr->magic = DEBUG_MEMORY_MAGIC;
-   
-   new_ftr = footer_from_header(new_hdr);
-   new_ftr->magic = DEBUG_MEMORY_MAGIC;
-   
-   LIST_REPLACE(&old_hdr->head, &new_hdr->head);
-
-   /* copy data */
-   new_ptr = data_from_header(new_hdr);
-   memcpy( new_ptr, old_ptr, old_size < new_size ? old_size : new_size );
-
-   /* free old */
-   old_hdr->magic = 0;
-   old_ftr->magic = 0;
-   real_free(old_hdr);
-
-   return new_ptr;
-}
-
-unsigned long
-debug_memory_begin(void)
-{
-   return last_no;
-}
-
-void 
-debug_memory_end(unsigned long start_no)
-{
-   size_t total_size = 0;
-   struct list_head *entry;
-
-   if(start_no == last_no)
-      return;
-
-   entry = list.prev;
-   for (; entry != &list; entry = entry->prev) {
-      struct debug_memory_header *hdr;
-      void *ptr;
-      struct debug_memory_footer *ftr;
-
-      hdr = LIST_ENTRY(struct debug_memory_header, entry, head);
-      ptr = data_from_header(hdr);
-      ftr = footer_from_header(hdr);
-
-      if(hdr->magic != DEBUG_MEMORY_MAGIC) {
-         debug_printf("%s:%u:%s: bad or corrupted memory %p\n",
-                      hdr->file, hdr->line, hdr->function,
-                      ptr);
-         debug_assert(0);
-      }
-
-      if((start_no <= hdr->no && hdr->no < last_no) ||
-        (last_no < start_no && (hdr->no < last_no || start_no <= hdr->no))) {
-        debug_printf("%s:%u:%s: %u bytes at %p not freed\n",
-                     hdr->file, hdr->line, hdr->function,
-                     hdr->size, ptr);
-        total_size += hdr->size;
-      }
-
-      if(ftr->magic != DEBUG_MEMORY_MAGIC) {
-         debug_printf("%s:%u:%s: buffer overflow %p\n",
-                      hdr->file, hdr->line, hdr->function,
-                      ptr);
-         debug_assert(0);
-      }
-   }
-
-   if(total_size) {
-      debug_printf("Total of %u KB of system memory apparently leaked\n",
-                  (total_size + 1023)/1024);
-   }
-   else {
-      debug_printf("No memory leaks detected.\n");
-   }
-}
diff --git a/src/gallium/auxiliary/util/p_debug_prof.c b/src/gallium/auxiliary/util/p_debug_prof.c
deleted file mode 100644 (file)
index 5f9772e..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
-/**
- * @file
- * Poor-man profiling.
- * 
- * @author José Fonseca <jrfonseca@tungstengraphics.com>
- * 
- * @sa http://blogs.msdn.com/joshpoley/archive/2008/03/12/poor-man-s-profiler.aspx
- * @sa http://www.johnpanzer.com/aci_cuj/index.html
- */
-
-#include "pipe/p_config.h" 
-
-#if defined(PROFILE) && defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
-
-#include <windows.h>
-#include <winddi.h>
-
-#include "pipe/p_debug.h" 
-#include "util/u_string.h" 
-
-
-#define PROFILE_TABLE_SIZE (1024*1024)
-#define FILE_NAME_SIZE 256
-
-struct debug_profile_entry
-{
-   uintptr_t caller;
-   uintptr_t callee;
-   uint64_t samples;
-};
-
-static unsigned long enabled = 0;
-
-static WCHAR wFileName[FILE_NAME_SIZE] = L"\\??\\c:\\00000000.prof";
-static ULONG_PTR iFile = 0;
-
-static struct debug_profile_entry *table = NULL;
-static unsigned long free_table_entries = 0;
-static unsigned long max_table_entries = 0;
-
-uint64_t start_stamp = 0;
-uint64_t end_stamp = 0;
-
-
-static void
-debug_profile_entry(uintptr_t caller, uintptr_t callee, uint64_t samples)
-{
-   unsigned hash = ( caller + callee ) & PROFILE_TABLE_SIZE - 1;
-   
-   while(1) {
-      if(table[hash].caller == 0 && table[hash].callee == 0) {
-         table[hash].caller = caller;
-         table[hash].callee = callee;
-         table[hash].samples = samples;
-         --free_table_entries;
-         break;
-      }
-      else if(table[hash].caller == caller && table[hash].callee == callee) {
-         table[hash].samples += samples;
-         break;
-      }
-      else {
-         ++hash;
-      }
-   }
-}
-
-
-static uintptr_t caller_stack[1024];
-static unsigned last_caller = 0;
-
-
-static int64_t delta(void) {
-   int64_t result = end_stamp - start_stamp;
-   if(result > UINT64_C(0xffffffff))
-      result = 0;
-   return result;
-}
-
-
-static void __cdecl 
-debug_profile_enter(uintptr_t callee)
-{
-   uintptr_t caller = last_caller ? caller_stack[last_caller - 1] : 0;
-                
-   if (caller)
-      debug_profile_entry(caller, 0, delta());
-   debug_profile_entry(caller, callee, 1);
-   caller_stack[last_caller++] = callee;
-}
-
-
-static void __cdecl
-debug_profile_exit(uintptr_t callee)
-{
-   debug_profile_entry(callee, 0, delta());
-   if(last_caller)
-      --last_caller;
-}
-   
-   
-/**
- * Called at the start of every method or function.
- * 
- * @sa http://msdn.microsoft.com/en-us/library/c63a9b7h.aspx
- */
-void __declspec(naked) __cdecl 
-_penter(void) {
-   _asm {
-      push eax
-      mov eax, [enabled]
-      test eax, eax
-      jz skip
-
-      push edx
-      
-      rdtsc
-      mov dword ptr [end_stamp], eax
-      mov dword ptr [end_stamp+4], edx
-
-      xor eax, eax
-      mov [enabled], eax
-
-      mov eax, [esp+8]
-
-      push ebx
-      push ecx
-      push ebp
-      push edi
-      push esi
-
-      push eax
-      call debug_profile_enter
-      add esp, 4
-
-      pop esi
-      pop edi
-      pop ebp
-      pop ecx
-      pop ebx
-
-      mov eax, 1
-      mov [enabled], eax 
-
-      rdtsc
-      mov dword ptr [start_stamp], eax
-      mov dword ptr [start_stamp+4], edx
-      
-      pop edx
-skip:
-      pop eax
-      ret
-   }
-}
-
-
-/**
- * Called at the end of Calls the end of every method or function.
- * 
- * @sa http://msdn.microsoft.com/en-us/library/xc11y76y.aspx
- */
-void __declspec(naked) __cdecl 
-_pexit(void) {
-   _asm {
-      push eax
-      mov eax, [enabled]
-      test eax, eax
-      jz skip
-
-      push edx
-      
-      rdtsc
-      mov dword ptr [end_stamp], eax
-      mov dword ptr [end_stamp+4], edx
-
-      xor eax, eax
-      mov [enabled], eax
-
-      mov eax, [esp+8]
-
-      push ebx
-      push ecx
-      push ebp
-      push edi
-      push esi
-
-      push eax
-      call debug_profile_exit
-      add esp, 4
-
-      pop esi
-      pop edi
-      pop ebp
-      pop ecx
-      pop ebx
-
-      mov eax, 1
-      mov [enabled], eax 
-
-      rdtsc
-      mov dword ptr [start_stamp], eax
-      mov dword ptr [start_stamp+4], edx
-      
-      pop edx
-skip:
-      pop eax
-      ret
-   }
-}
-
-
-/**
- * Reference function for calibration. 
- */
-void __declspec(naked) 
-__debug_profile_reference(void) {
-   _asm {
-      call _penter
-      call _pexit
-      ret
-   }
-}
-
-
-void
-debug_profile_start(void)
-{
-   WCHAR *p;
-
-   // increment starting from the less significant digit
-   p = &wFileName[14];
-   while(1) {
-      if(*p == '9') {
-         *p-- = '0';
-      }
-      else {
-         *p += 1;
-         break;
-      }
-   }
-
-   table = EngMapFile(wFileName, 
-                      PROFILE_TABLE_SIZE*sizeof(struct debug_profile_entry), 
-                      &iFile);
-   if(table) {
-      unsigned i;
-      
-      free_table_entries = max_table_entries = PROFILE_TABLE_SIZE;
-      memset(table, 0, PROFILE_TABLE_SIZE*sizeof(struct debug_profile_entry));
-      
-      table[0].caller = (uintptr_t)&__debug_profile_reference;
-      table[0].callee = 0;
-      table[0].samples = 0;
-      --free_table_entries;
-
-      _asm {
-         push edx
-         push eax
-      
-         rdtsc
-         mov dword ptr [start_stamp], eax
-         mov dword ptr [start_stamp+4], edx
-         
-         pop edx
-         pop eax
-      }
-
-      last_caller = 0;
-      
-      enabled = 1;
-
-      for(i = 0; i < 8; ++i) {
-         _asm {
-            call __debug_profile_reference
-         }
-      }
-   }
-}
-
-
-void 
-debug_profile_stop(void)
-{
-   enabled = 0;
-
-   if(iFile)
-      EngUnmapFile(iFile);
-   iFile = 0;
-   table = NULL;
-   free_table_entries = max_table_entries = 0;
-}
-
-#endif /* PROFILE */
diff --git a/src/gallium/auxiliary/util/u_bitmask.c b/src/gallium/auxiliary/util/u_bitmask.c
new file mode 100644 (file)
index 0000000..77587c0
--- /dev/null
@@ -0,0 +1,320 @@
+/**************************************************************************
+ * 
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+/**
+ * @file
+ * Generic bitmask implementation.
+ *  
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+
+#include "util/u_memory.h"
+#include "util/u_bitmask.h"
+
+
+typedef uint32_t util_bitmask_word;  
+
+
+#define UTIL_BITMASK_INITIAL_WORDS 16
+#define UTIL_BITMASK_BITS_PER_BYTE 8
+#define UTIL_BITMASK_BITS_PER_WORD (sizeof(util_bitmask_word) * UTIL_BITMASK_BITS_PER_BYTE)
+
+
+struct util_bitmask
+{
+   util_bitmask_word *words;
+   
+   /** Number of bits we can currently hold */
+   unsigned size;
+   
+   /** Number of consecutive bits set at the start of the bitmask */
+   unsigned filled;
+};
+
+
+struct util_bitmask *
+util_bitmask_create(void)
+{
+   struct util_bitmask *bm;
+   
+   bm = MALLOC_STRUCT(util_bitmask);
+   if(!bm)
+      return NULL;
+   
+   bm->words = (util_bitmask_word *)CALLOC(UTIL_BITMASK_INITIAL_WORDS, sizeof(util_bitmask_word));
+   if(!bm->words) {
+      FREE(bm);
+      return NULL;
+   }
+   
+   bm->size = UTIL_BITMASK_INITIAL_WORDS * UTIL_BITMASK_BITS_PER_WORD;
+   bm->filled = 0;
+   
+   return bm;
+}
+
+
+/**
+ * Resize the bitmask if necessary 
+ */
+static INLINE boolean
+util_bitmask_resize(struct util_bitmask *bm,
+                    unsigned minimum_index)
+{
+   unsigned minimum_size = minimum_index + 1;
+   unsigned new_size;
+   util_bitmask_word *new_words;
+
+   /* Check integer overflow */
+   if(!minimum_size)
+      return FALSE;
+      
+   if(bm->size > minimum_size)
+      return TRUE;
+
+   assert(bm->size % UTIL_BITMASK_BITS_PER_WORD == 0);
+   new_size = bm->size;
+   while(!(new_size > minimum_size)) {
+      new_size *= 2;
+      /* Check integer overflow */
+      if(new_size < bm->size)
+         return FALSE;
+   }
+   assert(new_size);
+   assert(new_size % UTIL_BITMASK_BITS_PER_WORD == 0);
+   
+   new_words = (util_bitmask_word *)REALLOC((void *)bm->words,
+                                            bm->size / UTIL_BITMASK_BITS_PER_BYTE,
+                                            new_size / UTIL_BITMASK_BITS_PER_BYTE);
+   if(!new_words)
+      return FALSE;
+   
+   memset(new_words + bm->size/UTIL_BITMASK_BITS_PER_WORD, 
+          0, 
+          (new_size - bm->size)/UTIL_BITMASK_BITS_PER_BYTE);
+   
+   bm->size = new_size;
+   bm->words = new_words;
+   
+   return TRUE;
+}
+
+
+/**
+ * Lazily update the filled.
+ */
+static INLINE void
+util_bitmask_filled_set(struct util_bitmask *bm,
+                        unsigned index)
+{
+   assert(bm->filled <= bm->size);
+   assert(index <= bm->size);
+   
+   if(index == bm->filled) {
+      ++bm->filled;
+      assert(bm->filled <= bm->size);
+   }
+}
+
+static INLINE void
+util_bitmask_filled_unset(struct util_bitmask *bm,
+                          unsigned index)
+{
+   assert(bm->filled <= bm->size);
+   assert(index <= bm->size);
+   
+   if(index < bm->filled)
+      bm->filled = index;
+}
+
+
+unsigned
+util_bitmask_add(struct util_bitmask *bm)
+{
+   unsigned word;
+   unsigned bit;
+   util_bitmask_word mask;
+   
+   assert(bm);
+
+   /* linear search for an empty index */
+   word = bm->filled / UTIL_BITMASK_BITS_PER_WORD;
+   bit  = bm->filled % UTIL_BITMASK_BITS_PER_WORD;
+   mask = 1 << bit;
+   while(word < bm->size / UTIL_BITMASK_BITS_PER_WORD) {
+      while(bit < UTIL_BITMASK_BITS_PER_WORD) {
+         if(!(bm->words[word] & mask))
+            goto found;
+         ++bm->filled;
+         ++bit;
+         mask <<= 1;
+      }
+      ++word;
+      bit = 0;
+      mask = 1;
+   }
+found:
+   
+   /* grow the bitmask if necessary */
+   if(!util_bitmask_resize(bm, bm->filled))
+      return UTIL_BITMASK_INVALID_INDEX;
+
+   assert(!(bm->words[word] & mask));
+   bm->words[word] |= mask;
+
+   return bm->filled++;
+}
+
+
+unsigned
+util_bitmask_set(struct util_bitmask *bm, 
+                 unsigned index)
+{
+   unsigned word = index / UTIL_BITMASK_BITS_PER_WORD;
+   unsigned bit  = index % UTIL_BITMASK_BITS_PER_WORD;
+   util_bitmask_word mask = 1 << bit;
+   
+   assert(bm);
+   
+   /* grow the bitmask if necessary */
+   if(!util_bitmask_resize(bm, index))
+      return UTIL_BITMASK_INVALID_INDEX;
+
+   bm->words[word] |= mask;
+
+   util_bitmask_filled_set(bm, index);
+   
+   return index;
+}
+
+
+void
+util_bitmask_clear(struct util_bitmask *bm, 
+                   unsigned index)
+{
+   unsigned word = index / UTIL_BITMASK_BITS_PER_WORD;
+   unsigned bit  = index % UTIL_BITMASK_BITS_PER_WORD;
+   util_bitmask_word mask = 1 << bit;
+   
+   assert(bm);
+   
+   if(index >= bm->size)
+      return;
+
+   bm->words[word] &= ~mask;
+   
+   util_bitmask_filled_unset(bm, index);
+}
+
+
+boolean
+util_bitmask_get(struct util_bitmask *bm, 
+                 unsigned index)
+{
+   unsigned word = index / UTIL_BITMASK_BITS_PER_WORD;
+   unsigned bit  = index % UTIL_BITMASK_BITS_PER_WORD;
+   util_bitmask_word mask = 1 << bit;
+   
+   assert(bm);
+   
+   if(index < bm->filled) {
+      assert(bm->words[word] & mask);
+      return TRUE;
+   }
+
+   if(index > bm->size)
+      return FALSE;
+
+   if(bm->words[word] & mask) {
+      util_bitmask_filled_set(bm, index);
+      return TRUE;
+   }
+   else
+      return FALSE;
+}
+
+
+unsigned
+util_bitmask_get_next_index(struct util_bitmask *bm, 
+                            unsigned index)
+{
+   unsigned word = index / UTIL_BITMASK_BITS_PER_WORD;
+   unsigned bit  = index % UTIL_BITMASK_BITS_PER_WORD;
+   util_bitmask_word mask = 1 << bit;
+
+   if(index < bm->filled) {
+      assert(bm->words[word] & mask);
+      return index;
+   }
+
+   if(index >= bm->size) {
+      return UTIL_BITMASK_INVALID_INDEX;
+   }
+
+   /* Do a linear search */
+   while(word < bm->size / UTIL_BITMASK_BITS_PER_WORD) {
+      while(bit < UTIL_BITMASK_BITS_PER_WORD) {
+         if(bm->words[word] & mask) {
+            if(index == bm->filled) {
+               ++bm->filled;
+               assert(bm->filled <= bm->size);
+            }
+            return index;
+         }
+         ++index;
+         ++bit;
+         mask <<= 1;
+      }
+      ++word;
+      bit = 0;
+      mask = 1;
+   }
+   
+   return UTIL_BITMASK_INVALID_INDEX;
+}
+
+
+unsigned
+util_bitmask_get_first_index(struct util_bitmask *bm)
+{
+   return util_bitmask_get_next_index(bm, 0);
+}
+
+
+void
+util_bitmask_destroy(struct util_bitmask *bm)
+{
+   assert(bm);
+
+   FREE(bm->words);
+   FREE(bm);
+}
+
diff --git a/src/gallium/auxiliary/util/u_bitmask.h b/src/gallium/auxiliary/util/u_bitmask.h
new file mode 100644 (file)
index 0000000..87f1110
--- /dev/null
@@ -0,0 +1,114 @@
+/**************************************************************************
+ * 
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+/**
+ * @file
+ * Generic bitmask.
+ *  
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+#ifndef U_HANDLE_BITMASK_H_
+#define U_HANDLE_BITMASK_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define UTIL_BITMASK_INVALID_INDEX (~0U)
+   
+   
+/**
+ * Abstract data type to represent arbitrary set of bits.
+ */
+struct util_bitmask;
+
+
+struct util_bitmask *
+util_bitmask_create(void);
+
+
+/**
+ * Search a cleared bit and set it.
+ * 
+ * It searches for the first cleared bit.
+ * 
+ * Returns the bit index on success, or UTIL_BITMASK_INVALID_INDEX on out of 
+ * memory growing the bitmask.
+ */
+unsigned
+util_bitmask_add(struct util_bitmask *bm);
+
+/**
+ * Set a bit.
+ * 
+ * Returns the input index on success, or UTIL_BITMASK_INVALID_INDEX on out of 
+ * memory growing the bitmask.
+ */
+unsigned
+util_bitmask_set(struct util_bitmask *bm, 
+                 unsigned index);
+
+void
+util_bitmask_clear(struct util_bitmask *bm, 
+                   unsigned index);
+
+boolean
+util_bitmask_get(struct util_bitmask *bm, 
+                 unsigned index);
+
+
+void
+util_bitmask_destroy(struct util_bitmask *bm);
+
+
+/**
+ * Search for the first set bit.
+ * 
+ * Returns UTIL_BITMASK_INVALID_INDEX if a set bit cannot be found. 
+ */
+unsigned
+util_bitmask_get_first_index(struct util_bitmask *bm);
+
+
+/**
+ * Search for the first set bit, starting from the giving index.
+ * 
+ * Returns UTIL_BITMASK_INVALID_INDEX if a set bit cannot be found. 
+ */
+unsigned
+util_bitmask_get_next_index(struct util_bitmask *bm,
+                            unsigned index);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* U_HANDLE_BITMASK_H_ */
index 841e9c01e7ee3b8d83ee45d8d2ad3f08282a5604..deb68c43a6cebe0461e65aeef625d1322e659ca9 100644 (file)
 
 
 #include "pipe/p_context.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_inlines.h"
 #include "pipe/p_shader_tokens.h"
+#include "pipe/p_state.h"
 
 #include "util/u_blit.h"
 #include "util/u_draw_quad.h"
@@ -59,8 +60,6 @@ struct blit_state
    struct pipe_sampler_state sampler;
    struct pipe_viewport_state viewport;
 
-   struct pipe_shader_state vert_shader;
-   struct pipe_shader_state frag_shader;
    void *vs;
    void *fs;
 
@@ -103,8 +102,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
    memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer));
    ctx->rasterizer.front_winding = PIPE_WINDING_CW;
    ctx->rasterizer.cull_mode = PIPE_WINDING_NONE;
-   ctx->rasterizer.bypass_clipping = 1;
-   /*ctx->rasterizer.bypass_vs = 1;*/
+   ctx->rasterizer.bypass_vs_clip_and_viewport = 1;
    ctx->rasterizer.gl_rasterization_rules = 1;
 
    /* samplers */
@@ -117,28 +115,20 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
    ctx->sampler.mag_img_filter = 0; /* set later */
    ctx->sampler.normalized_coords = 1;
 
-   /* viewport (identity, we setup vertices in wincoords) */
-   ctx->viewport.scale[0] = 1.0;
-   ctx->viewport.scale[1] = 1.0;
-   ctx->viewport.scale[2] = 1.0;
-   ctx->viewport.scale[3] = 1.0;
-   ctx->viewport.translate[0] = 0.0;
-   ctx->viewport.translate[1] = 0.0;
-   ctx->viewport.translate[2] = 0.0;
-   ctx->viewport.translate[3] = 0.0;
-
-   /* vertex shader */
+
+   /* vertex shader - still required to provide the linkage between
+    * fragment shader input semantics and vertex_element/buffers.
+    */
    {
       const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
                                       TGSI_SEMANTIC_GENERIC };
       const uint semantic_indexes[] = { 0, 0 };
       ctx->vs = util_make_vertex_passthrough_shader(pipe, 2, semantic_names,
-                                                    semantic_indexes,
-                                                    &ctx->vert_shader);
+                                                    semantic_indexes);
    }
 
    /* fragment shader */
-   ctx->fs = util_make_fragment_tex_shader(pipe, &ctx->frag_shader);
+   ctx->fs = util_make_fragment_tex_shader(pipe);
    ctx->vbuf = NULL;
 
    /* init vertex data that doesn't change */
@@ -163,10 +153,7 @@ util_destroy_blit(struct blit_state *ctx)
    pipe->delete_vs_state(pipe, ctx->vs);
    pipe->delete_fs_state(pipe, ctx->fs);
 
-   FREE((void*) ctx->vert_shader.tokens);
-   FREE((void*) ctx->frag_shader.tokens);
-
-   pipe_buffer_reference(pipe->screen, &ctx->vbuf, NULL);
+   pipe_buffer_reference(&ctx->vbuf, NULL);
 
    FREE(ctx);
 }
@@ -199,7 +186,6 @@ static unsigned
 setup_vertex_data(struct blit_state *ctx,
                   float x0, float y0, float x1, float y1, float z)
 {
-   void *buf;
    unsigned offset;
 
    ctx->vertices[0][0][0] = x0;
@@ -228,12 +214,8 @@ setup_vertex_data(struct blit_state *ctx,
 
    offset = get_next_slot( ctx );
 
-   buf = pipe_buffer_map(ctx->pipe->screen, ctx->vbuf,
-                         PIPE_BUFFER_USAGE_CPU_WRITE);
-
-   memcpy((char *)buf + offset, ctx->vertices, sizeof(ctx->vertices));
-
-   pipe_buffer_unmap(ctx->pipe->screen, ctx->vbuf);
+   pipe_buffer_write(ctx->pipe->screen, ctx->vbuf,
+                     offset, sizeof(ctx->vertices), ctx->vertices);
 
    return offset;
 }
@@ -249,7 +231,6 @@ setup_vertex_data_tex(struct blit_state *ctx,
                       float s0, float t0, float s1, float t1,
                       float z)
 {
-   void *buf;
    unsigned offset;
 
    ctx->vertices[0][0][0] = x0;
@@ -278,12 +259,8 @@ setup_vertex_data_tex(struct blit_state *ctx,
 
    offset = get_next_slot( ctx );
 
-   buf = pipe_buffer_map(ctx->pipe->screen, ctx->vbuf,
-                         PIPE_BUFFER_USAGE_CPU_WRITE);
-
-   memcpy((char *)buf + offset, ctx->vertices, sizeof(ctx->vertices));
-
-   pipe_buffer_unmap(ctx->pipe->screen, ctx->vbuf);
+   pipe_buffer_write(ctx->pipe->screen, ctx->vbuf,
+                     offset, sizeof(ctx->vertices), ctx->vertices);
 
    return offset;
 }
@@ -337,7 +314,7 @@ util_blit_pixels(struct blit_state *ctx,
 
    if(dst->format == src->format && (dstX1 - dstX0) == srcW && (dstY1 - dstY0) == srcH) {
       /* FIXME: this will most surely fail for overlapping rectangles */
-      pipe->surface_copy(pipe, FALSE,
+      pipe->surface_copy(pipe,
                         dst, dstX0, dstY0,   /* dest */
                         src, srcX0, srcY0, /* src */
                         srcW, srcH);     /* size */
@@ -371,14 +348,14 @@ util_blit_pixels(struct blit_state *ctx,
                                      PIPE_BUFFER_USAGE_GPU_WRITE);
 
    /* load temp texture */
-   pipe->surface_copy(pipe, FALSE,
+   pipe->surface_copy(pipe,
                       texSurf, 0, 0,   /* dest */
                       src, srcLeft, srcTop, /* src */
                       srcW, srcH);     /* size */
 
    /* free the surface, update the texture if necessary.
     */
-   screen->tex_surface_release(screen, &texSurf);
+   pipe_surface_reference(&texSurf, NULL);
 
    /* save state (restored below) */
    cso_save_blend(ctx->cso);
@@ -389,13 +366,11 @@ util_blit_pixels(struct blit_state *ctx,
    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 */
    cso_set_blend(ctx->cso, &ctx->blend);
    cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil);
    cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
-   cso_set_viewport(ctx->cso, &ctx->viewport);
 
    /* sampler */
    ctx->sampler.min_img_filter = filter;
@@ -437,9 +412,8 @@ util_blit_pixels(struct blit_state *ctx,
    cso_restore_framebuffer(ctx->cso);
    cso_restore_fragment_shader(ctx->cso);
    cso_restore_vertex_shader(ctx->cso);
-   cso_restore_viewport(ctx->cso);
 
-   screen->texture_release(screen, &tex);
+   pipe_texture_reference(&tex, NULL);
 }
 
 
@@ -448,7 +422,7 @@ util_blit_pixels(struct blit_state *ctx,
  */
 void util_blit_flush( struct blit_state *ctx )
 {
-   pipe_buffer_reference(ctx->pipe->screen, &ctx->vbuf, NULL);
+   pipe_buffer_reference(&ctx->vbuf, NULL);
    ctx->vbuf_slot = 0;
 } 
 
@@ -471,8 +445,6 @@ util_blit_pixels_tex(struct blit_state *ctx,
                  int dstX1, int dstY1,
                  float z, uint filter)
 {
-   struct pipe_context *pipe = ctx->pipe;
-   struct pipe_screen *screen = pipe->screen;
    struct pipe_framebuffer_state fb;
    float s0, t0, s1, t1;
    unsigned offset;
@@ -488,8 +460,10 @@ util_blit_pixels_tex(struct blit_state *ctx,
    t0 = srcY0 / (float)tex->height[0];
    t1 = srcY1 / (float)tex->height[0];
 
-   assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
-                                      PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
+   assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format,
+                                                 PIPE_TEXTURE_2D,
+                                                 PIPE_TEXTURE_USAGE_RENDER_TARGET,
+                                                 0));
 
    /* save state (restored below) */
    cso_save_blend(ctx->cso);
@@ -500,13 +474,11 @@ util_blit_pixels_tex(struct blit_state *ctx,
    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 */
    cso_set_blend(ctx->cso, &ctx->blend);
    cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil);
    cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
-   cso_set_viewport(ctx->cso, &ctx->viewport);
 
    /* sampler */
    ctx->sampler.min_img_filter = filter;
@@ -551,5 +523,4 @@ util_blit_pixels_tex(struct blit_state *ctx,
    cso_restore_framebuffer(ctx->cso);
    cso_restore_fragment_shader(ctx->cso);
    cso_restore_vertex_shader(ctx->cso);
-   cso_restore_viewport(ctx->cso);
 }
index 0a1a64259f1e74d0c70686f4f50b81f8509ce7c2..41cd38171fad21f4423f112af9d8531b56cc1c54 100644 (file)
@@ -36,7 +36,7 @@
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 #include "util/u_math.h"
 #include "util/u_memory.h"
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
new file mode 100644 (file)
index 0000000..f96e27e
--- /dev/null
@@ -0,0 +1,798 @@
+/**************************************************************************
+ * 
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright (c) 2008 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+
+#include "pipe/p_config.h" 
+
+#include <stdarg.h>
+
+
+#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
+
+#include <windows.h>
+#include <winddi.h>
+
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE)
+
+#include <stdio.h> 
+#include <stdlib.h> 
+#include <windows.h> 
+#include <types.h> 
+
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN      // Exclude rarely-used stuff from Windows headers
+#endif
+#include <windows.h>
+#include <stdio.h>
+
+#else
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#endif
+
+#include "pipe/p_compiler.h" 
+#include "util/u_debug.h" 
+#include "pipe/p_format.h" 
+#include "pipe/p_state.h" 
+#include "pipe/p_inlines.h" 
+#include "util/u_memory.h" 
+#include "util/u_string.h" 
+#include "util/u_stream.h" 
+#include "util/u_math.h" 
+#include "util/u_tile.h" 
+
+
+#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
+static INLINE void 
+_EngDebugPrint(const char *format, ...)
+{
+   va_list ap;
+   va_start(ap, format);
+   EngDebugPrint("", (PCHAR)format, ap);
+   va_end(ap);
+}
+#endif
+
+
+void _debug_vprintf(const char *format, va_list ap)
+{
+#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
+   /* EngDebugPrint does not handle float point arguments, so we need to use
+    * our own vsnprintf implementation. It is also very slow, so buffer until
+    * we find a newline. */
+   static char buf[512] = {'\0'};
+   size_t len = strlen(buf);
+   int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
+   if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) {
+      _EngDebugPrint("%s", buf);
+      buf[0] = '\0';
+   }
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+   /* EngDebugPrint does not handle float point arguments, so we need to use
+    * our own vsnprintf implementation. It is also very slow, so buffer until
+    * we find a newline. */
+   static char buf[512 + 1] = {'\0'};
+   size_t len = strlen(buf);
+   int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
+   if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) {
+      OutputDebugStringA(buf);
+      buf[0] = '\0';
+   }
+   
+   if(GetConsoleWindow() && !IsDebuggerPresent()) {
+      vfprintf(stderr, format, ap);
+      fflush(stderr);
+   }
+   
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE)
+   wchar_t *wide_format;
+   long wide_str_len;   
+   char buf[512];   
+   int ret;   
+#if (_WIN32_WCE < 600)
+   ret = vsprintf(buf, format, ap);   
+   if(ret < 0){   
+       sprintf(buf, "Cant handle debug print!");   
+       ret = 25;
+   }
+#else
+   ret = vsprintf_s(buf, 512, format, ap);   
+   if(ret < 0){   
+       sprintf_s(buf, 512, "Cant handle debug print!");   
+       ret = 25;
+   }
+#endif
+   buf[ret] = '\0';   
+   /* Format is ascii - needs to be converted to wchar_t for printing */   
+   wide_str_len = MultiByteToWideChar(CP_ACP, 0, (const char *) buf, -1, NULL, 0);   
+   wide_format = (wchar_t *) malloc((wide_str_len+1) * sizeof(wchar_t));   
+   if (wide_format) {   
+      MultiByteToWideChar(CP_ACP, 0, (const char *) buf, -1,   
+            wide_format, wide_str_len);   
+      NKDbgPrintfW(wide_format, wide_format);   
+      free(wide_format);   
+   } 
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
+   /* TODO */
+#else /* !PIPE_SUBSYSTEM_WINDOWS */
+#ifdef DEBUG
+   vfprintf(stderr, format, ap);
+#endif
+#endif
+}
+
+
+#ifdef DEBUG
+void debug_print_blob( const char *name,
+                       const void *blob,
+                       unsigned size )
+{
+   const unsigned *ublob = (const unsigned *)blob;
+   unsigned i;
+
+   debug_printf("%s (%d dwords%s)\n", name, size/4,
+                size%4 ? "... plus a few bytes" : "");
+
+   for (i = 0; i < size/4; i++) {
+      debug_printf("%d:\t%08x\n", i, ublob[i]);
+   }
+}
+#endif
+
+
+void _debug_break(void) 
+{
+#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
+   __asm("int3");
+#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
+   _asm {int 3};
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
+   EngDebugBreak();
+#else
+   abort();
+#endif
+}
+
+
+#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
+static const char *
+find(const char *start, const char *end, char c) 
+{
+   const char *p;
+   for(p = start; !end || p != end; ++p) {
+      if(*p == c)
+        return p;
+      if(*p < 32)
+        break;
+   }
+   return NULL;
+}
+
+static int 
+compare(const char *start, const char *end, const char *s)
+{
+   const char *p, *q;
+   for(p = start, q = s; p != end && *q != '\0'; ++p, ++q) {
+      if(*p != *q)
+        return 0;
+   }
+   return p == end && *q == '\0';
+}
+
+static void 
+copy(char *dst, const char *start, const char *end, size_t n) 
+{
+   const char *p;
+   char *q;
+   for(p = start, q = dst, n = n - 1; p != end && n; ++p, ++q, --n)
+      *q = *p;
+   *q = '\0';
+}
+#endif
+
+
+static INLINE const char *
+_debug_get_option(const char *name)
+{
+#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
+   /* EngMapFile creates the file if it does not exists, so it must either be
+    * disabled on release versions (or put in a less conspicuous place). */
+#ifdef DEBUG
+   const char *result = NULL;
+   ULONG_PTR iFile = 0;
+   const void *pMap = NULL;
+   const char *sol, *eol, *sep;
+   static char output[1024];
+   
+   pMap = EngMapFile(L"\\??\\c:\\gallium.cfg", 0, &iFile);
+   if(pMap) {
+      sol = (const char *)pMap;
+      while(1) {
+        /* TODO: handle LF line endings */
+        eol = find(sol, NULL, '\r');
+        if(!eol || eol == sol)
+           break;
+        sep = find(sol, eol, '=');
+        if(!sep)
+           break;
+        if(compare(sol, sep, name)) {
+           copy(output, sep + 1, eol, sizeof(output));
+           result = output;
+           break;
+        }
+        sol = eol + 2;
+      }
+      EngUnmapFile(iFile);
+   }
+   return result;
+#else
+   return NULL;
+#endif
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) 
+   /* TODO: implement */
+   return NULL;
+#else
+   return getenv(name);
+#endif
+}
+
+const char *
+debug_get_option(const char *name, const char *dfault)
+{
+   const char *result;
+
+   result = _debug_get_option(name);
+   if(!result)
+      result = dfault;
+      
+   debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? result : "(null)");
+   
+   return result;
+}
+
+boolean
+debug_get_bool_option(const char *name, boolean dfault)
+{
+   const char *str = _debug_get_option(name);
+   boolean result;
+   
+   if(str == NULL)
+      result = dfault;
+   else if(!util_strcmp(str, "n"))
+      result = FALSE;
+   else if(!util_strcmp(str, "no"))
+      result = FALSE;
+   else if(!util_strcmp(str, "0"))
+      result = FALSE;
+   else if(!util_strcmp(str, "f"))
+      result = FALSE;
+   else if(!util_strcmp(str, "false"))
+      result = FALSE;
+   else
+      result = TRUE;
+
+   debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? "TRUE" : "FALSE");
+   
+   return result;
+}
+
+
+long
+debug_get_num_option(const char *name, long dfault)
+{
+   long result;
+   const char *str;
+   
+   str = _debug_get_option(name);
+   if(!str)
+      result = dfault;
+   else {
+      long sign;
+      char c;
+      c = *str++;
+      if(c == '-') {
+        sign = -1;
+        c = *str++;
+      } 
+      else {
+        sign = 1;
+      }
+      result = 0;
+      while('0' <= c && c <= '9') {
+        result = result*10 + (c - '0');
+        c = *str++;
+      }
+      result *= sign;
+   }
+   
+   debug_printf("%s: %s = %li\n", __FUNCTION__, name, result);
+
+   return result;
+}
+
+
+unsigned long
+debug_get_flags_option(const char *name, 
+                       const struct debug_named_value *flags,
+                       unsigned long dfault)
+{
+   unsigned long result;
+   const char *str;
+   
+   str = _debug_get_option(name);
+   if(!str)
+      result = dfault;
+   else if (!util_strcmp(str, "help")) {
+      result = dfault;
+      while (flags->name) {
+         debug_printf("%s: help for %s: %s [0x%lx]\n", __FUNCTION__, name, flags->name, flags->value);
+         flags++;
+      }
+   }
+   else {
+      result = 0;
+      while( flags->name ) {
+        if (!util_strcmp(str, "all") || util_strstr(str, flags->name ))
+           result |= flags->value;
+        ++flags;
+      }
+   }
+
+   if (str) {
+      debug_printf("%s: %s = 0x%lx (%s)\n", __FUNCTION__, name, result, str);
+   }
+   else {
+      debug_printf("%s: %s = 0x%lx\n", __FUNCTION__, name, result);
+   }
+
+   return result;
+}
+
+
+void _debug_assert_fail(const char *expr, 
+                        const char *file, 
+                        unsigned line, 
+                        const char *function) 
+{
+   _debug_printf("%s:%u:%s: Assertion `%s' failed.\n", file, line, function, expr);
+#if defined(PIPE_OS_WINDOWS) && !defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+   if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", FALSE))
+#else
+   if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", TRUE))
+#endif
+      debug_break();
+   else
+      _debug_printf("continuing...\n");
+}
+
+
+const char *
+debug_dump_enum(const struct debug_named_value *names, 
+                unsigned long value)
+{
+   static char rest[64];
+   
+   while(names->name) {
+      if(names->value == value)
+        return names->name;
+      ++names;
+   }
+
+   util_snprintf(rest, sizeof(rest), "0x%08lx", value);
+   return rest;
+}
+
+
+const char *
+debug_dump_enum_noprefix(const struct debug_named_value *names, 
+                         const char *prefix,
+                         unsigned long value)
+{
+   static char rest[64];
+   
+   while(names->name) {
+      if(names->value == value) {
+         const char *name = names->name;
+         while (*name == *prefix) {
+            name++;
+            prefix++;
+         }
+         return name;
+      }
+      ++names;
+   }
+
+   
+
+   util_snprintf(rest, sizeof(rest), "0x%08lx", value);
+   return rest;
+}
+
+
+const char *
+debug_dump_flags(const struct debug_named_value *names, 
+                 unsigned long value)
+{
+   static char output[4096];
+   static char rest[256];
+   int first = 1;
+
+   output[0] = '\0';
+
+   while(names->name) {
+      if((names->value & value) == names->value) {
+        if (!first)
+           util_strncat(output, "|", sizeof(output));
+        else
+           first = 0;
+        util_strncat(output, names->name, sizeof(output));
+        value &= ~names->value;
+      }
+      ++names;
+   }
+   
+   if (value) {
+      if (!first)
+        util_strncat(output, "|", sizeof(output));
+      else
+        first = 0;
+      
+      util_snprintf(rest, sizeof(rest), "0x%08lx", value);
+      util_strncat(output, rest, sizeof(output));
+   }
+   
+   if(first)
+      return "0";
+   
+   return output;
+}
+
+
+static const struct debug_named_value pipe_format_names[] = {
+#ifdef DEBUG
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_NONE),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8R8G8B8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_X8R8G8B8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_B8G8R8A8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_B8G8R8X8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_A1R5G5B5_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_A4R4G4B4_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R5G6B5_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_A2B10G10R10_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_L8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_I8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8L8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_L16_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_YCBCR),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_YCBCR_REV),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_Z16_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_Z32_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_Z32_FLOAT),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_S8Z24_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_Z24S8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_X8Z24_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_Z24X8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_S8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R64_FLOAT),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R64G64_FLOAT),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R64G64B64_FLOAT),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R64G64B64A64_FLOAT),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32_FLOAT),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32_FLOAT),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32_FLOAT),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32A32_FLOAT),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32A32_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32A32_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32A32_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R32G32B32A32_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16A16_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16A16_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16A16_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R16G16B16A16_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8A8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8X8_UNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8A8_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8X8_USCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8A8_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8X8_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_B6G5R5_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8B8G8R8_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_X8B8G8R8_SNORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8A8_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8X8_SSCALED),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_L8_SRGB),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8L8_SRGB),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8_SRGB),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8A8_SRGB),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_R8G8B8X8_SRGB),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_A8R8G8B8_SRGB),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_X8R8G8B8_SRGB),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_B8G8R8A8_SRGB),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_B8G8R8X8_SRGB),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_X8UB8UG8SR8S_NORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_B6UG5SR5S_NORM),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT1_RGB),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT1_RGBA),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT3_RGBA),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT5_RGBA),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT1_SRGB),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT1_SRGBA),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT3_SRGBA),
+   DEBUG_NAMED_VALUE(PIPE_FORMAT_DXT5_SRGBA),
+#endif
+   DEBUG_NAMED_VALUE_END
+};
+
+#ifdef DEBUG
+void debug_print_format(const char *msg, unsigned fmt )
+{
+   debug_printf("%s: %s\n", msg, debug_dump_enum(pipe_format_names, fmt)); 
+}
+#endif
+
+const char *pf_name( enum pipe_format format )
+{
+   return debug_dump_enum(pipe_format_names, format);
+}
+
+
+#ifdef DEBUG
+void debug_dump_image(const char *prefix,
+                      unsigned format, unsigned cpp,
+                      unsigned width, unsigned height,
+                      unsigned stride,
+                      const void *data)     
+{
+#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
+   static unsigned no = 0; 
+   char filename[256];
+   WCHAR wfilename[sizeof(filename)];
+   ULONG_PTR iFile = 0;
+   struct {
+      unsigned format;
+      unsigned cpp;
+      unsigned width;
+      unsigned height;
+   } header;
+   unsigned char *pMap = NULL;
+   unsigned i;
+
+   util_snprintf(filename, sizeof(filename), "\\??\\c:\\%03u%s.raw", ++no, prefix);
+   for(i = 0; i < sizeof(filename); ++i)
+      wfilename[i] = (WCHAR)filename[i];
+   
+   pMap = (unsigned char *)EngMapFile(wfilename, sizeof(header) + height*width*cpp, &iFile);
+   if(!pMap)
+      return;
+   
+   header.format = format;
+   header.cpp = cpp;
+   header.width = width;
+   header.height = height;
+   memcpy(pMap, &header, sizeof(header));
+   pMap += sizeof(header);
+   
+   for(i = 0; i < height; ++i) {
+      memcpy(pMap, (unsigned char *)data + stride*i, cpp*width);
+      pMap += cpp*width;
+   }
+      
+   EngUnmapFile(iFile);
+#endif
+}
+
+void debug_dump_surface(const char *prefix,
+                        struct pipe_surface *surface)     
+{
+   struct pipe_texture *texture;
+   struct pipe_screen *screen;
+   struct pipe_transfer *transfer;
+   void *data;
+
+   if (!surface)
+      return;
+
+   texture = surface->texture;
+   screen = texture->screen;
+
+   transfer = screen->get_tex_transfer(screen, texture, surface->face,
+                                       surface->level, surface->zslice,
+                                       PIPE_TRANSFER_READ, 0, 0, surface->width,
+                                       surface->height);
+   
+   data = screen->transfer_map(screen, transfer);
+   if(!data)
+      goto error;
+   
+   debug_dump_image(prefix, 
+                    transfer->format,
+                    transfer->block.size, 
+                    transfer->nblocksx,
+                    transfer->nblocksy,
+                    transfer->stride,
+                    data);
+   
+   screen->transfer_unmap(screen, transfer);
+error:
+   screen->tex_transfer_destroy(transfer);
+}
+
+
+#pragma pack(push,2)
+struct bmp_file_header {
+   uint16_t bfType;
+   uint32_t bfSize;
+   uint16_t bfReserved1;
+   uint16_t bfReserved2;
+   uint32_t bfOffBits;
+};
+#pragma pack(pop)
+
+struct bmp_info_header {
+   uint32_t biSize;
+   int32_t biWidth;
+   int32_t biHeight;
+   uint16_t biPlanes;
+   uint16_t biBitCount;
+   uint32_t biCompression;
+   uint32_t biSizeImage;
+   int32_t biXPelsPerMeter;
+   int32_t biYPelsPerMeter;
+   uint32_t biClrUsed;
+   uint32_t biClrImportant;
+};
+
+struct bmp_rgb_quad {
+   uint8_t rgbBlue;
+   uint8_t rgbGreen;
+   uint8_t rgbRed;
+   uint8_t rgbAlpha;
+};
+
+void 
+debug_dump_surface_bmp(const char *filename,
+                       struct pipe_surface *surface)
+{
+#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
+   struct pipe_texture *texture;
+   struct pipe_screen *screen;
+   struct util_stream *stream;
+   struct pipe_transfer *transfer;
+   struct bmp_file_header bmfh;
+   struct bmp_info_header bmih;
+   float *rgba;
+   unsigned x, y;
+
+   if (!surface)
+      goto error1;
+
+   rgba = MALLOC(surface->width*4*sizeof(float));
+   if(!rgba)
+      goto error1;
+   
+   bmfh.bfType = 0x4d42;
+   bmfh.bfSize = 14 + 40 + surface->height*surface->width*4;
+   bmfh.bfReserved1 = 0;
+   bmfh.bfReserved2 = 0;
+   bmfh.bfOffBits = 14 + 40;
+   
+   bmih.biSize = 40;
+   bmih.biWidth = surface->width;
+   bmih.biHeight = surface->height;
+   bmih.biPlanes = 1;
+   bmih.biBitCount = 32;
+   bmih.biCompression = 0;
+   bmih.biSizeImage = surface->height*surface->width*4;
+   bmih.biXPelsPerMeter = 0;
+   bmih.biYPelsPerMeter = 0;
+   bmih.biClrUsed = 0;
+   bmih.biClrImportant = 0;
+   
+   stream = util_stream_create(filename, bmfh.bfSize);
+   if(!stream)
+      goto error2;
+   
+   util_stream_write(stream, &bmfh, 14);
+   util_stream_write(stream, &bmih, 40);
+
+   texture = surface->texture;
+   screen = texture->screen;
+   
+   transfer = screen->get_tex_transfer(screen, texture, surface->face,
+                                       surface->level, surface->zslice,
+                                       PIPE_TRANSFER_READ, 0, 0, surface->width,
+                                       surface->height);
+
+   y = surface->height;
+   while(y--) {
+      pipe_get_tile_rgba(transfer,
+                         0, y, surface->width, 1,
+                         rgba);
+      for(x = 0; x < surface->width; ++x)
+      {
+         struct bmp_rgb_quad pixel;
+         pixel.rgbRed   = float_to_ubyte(rgba[x*4 + 0]);
+         pixel.rgbGreen = float_to_ubyte(rgba[x*4 + 1]);
+         pixel.rgbBlue  = float_to_ubyte(rgba[x*4 + 2]);
+         pixel.rgbAlpha = float_to_ubyte(rgba[x*4 + 3]);
+         util_stream_write(stream, &pixel, 4);
+      }  
+   }
+
+   screen->tex_transfer_destroy(transfer);
+   
+   util_stream_close(stream);
+error2:
+   FREE(rgba);
+error1:
+   ;
+#endif
+}
+
+#endif
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
new file mode 100644 (file)
index 0000000..7c82970
--- /dev/null
@@ -0,0 +1,361 @@
+/**************************************************************************
+ * 
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+/**
+ * @file
+ * Cross-platform debugging helpers.
+ * 
+ * For now it just has assert and printf replacements, but it might be extended 
+ * with stack trace reports and more advanced logging in the near future. 
+ * 
+ * @author Jose Fonseca <jrfonseca@tungstengraphics.com>
+ */
+
+#ifndef U_DEBUG_H_
+#define U_DEBUG_H_
+
+
+#include <stdarg.h>
+
+#include "pipe/p_compiler.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#if defined(DBG) || defined(DEBUG)
+#ifndef DEBUG
+#define DEBUG 1
+#endif
+#else
+#ifndef NDEBUG
+#define NDEBUG 1
+#endif
+#endif
+
+   
+/* MSVC bebore VC7 does not have the __FUNCTION__ macro */
+#if defined(_MSC_VER) && _MSC_VER < 1300
+#define __FUNCTION__ "???"
+#endif
+
+
+void _debug_vprintf(const char *format, va_list ap);
+   
+
+static INLINE void
+_debug_printf(const char *format, ...)
+{
+   va_list ap;
+   va_start(ap, format);
+   _debug_vprintf(format, ap);
+   va_end(ap);
+}
+
+
+/**
+ * Print debug messages.
+ *
+ * The actual channel used to output debug message is platform specific. To 
+ * avoid misformating or truncation, follow these rules of thumb:   
+ * - output whole lines
+ * - avoid outputing large strings (512 bytes is the current maximum length 
+ * that is guaranteed to be printed in all platforms)
+ */
+static INLINE void
+debug_printf(const char *format, ...)
+{
+#ifdef DEBUG
+   va_list ap;
+   va_start(ap, format);
+   _debug_vprintf(format, ap);
+   va_end(ap);
+#else
+   (void) format; /* silence warning */
+#endif
+}
+
+
+#ifdef DEBUG
+#define debug_vprintf(_format, _ap) _debug_vprintf(_format, _ap)
+#else
+#define debug_vprintf(_format, _ap) ((void)0)
+#endif
+
+
+#ifdef DEBUG
+/**
+ * Dump a blob in hex to the same place that debug_printf sends its
+ * messages.
+ */
+void debug_print_blob( const char *name, const void *blob, unsigned size );
+
+/* Print a message along with a prettified format string
+ */
+void debug_print_format(const char *msg, unsigned fmt );
+#else
+#define debug_print_blob(_name, _blob, _size) ((void)0)
+#define debug_print_format(_msg, _fmt) ((void)0)
+#endif
+
+
+void _debug_break(void);
+
+
+/**
+ * Hard-coded breakpoint.
+ */
+#ifdef DEBUG
+#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
+#define debug_break() __asm("int3")
+#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
+#define debug_break()  do { _asm {int 3} } while(0)
+#else
+#define debug_break() _debug_break()
+#endif
+#else /* !DEBUG */
+#define debug_break() ((void)0)
+#endif /* !DEBUG */
+
+
+long
+debug_get_num_option(const char *name, long dfault);
+
+void _debug_assert_fail(const char *expr, 
+                        const char *file, 
+                        unsigned line, 
+                        const char *function);
+
+
+/** 
+ * Assert macro
+ * 
+ * Do not expect that the assert call terminates -- errors must be handled 
+ * regardless of assert behavior.
+ */
+#ifdef DEBUG
+#define debug_assert(expr) ((expr) ? (void)0 : _debug_assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__))
+#else
+#define debug_assert(expr) ((void)(expr))
+#endif
+
+
+/** Override standard assert macro */
+#ifdef assert
+#undef assert
+#endif
+#define assert(expr) debug_assert(expr)
+
+
+/**
+ * Output the current function name.
+ */
+#ifdef DEBUG
+#define debug_checkpoint() \
+   _debug_printf("%s\n", __FUNCTION__)
+#else
+#define debug_checkpoint() \
+   ((void)0) 
+#endif
+
+
+/**
+ * Output the full source code position.
+ */
+#ifdef DEBUG
+#define debug_checkpoint_full() \
+   _debug_printf("%s:%u:%s", __FILE__, __LINE__, __FUNCTION__) 
+#else
+#define debug_checkpoint_full() \
+   ((void)0) 
+#endif
+
+
+/**
+ * Output a warning message. Muted on release version.
+ */
+#ifdef DEBUG
+#define debug_warning(__msg) \
+   _debug_printf("%s:%u:%s: warning: %s\n", __FILE__, __LINE__, __FUNCTION__, __msg)
+#else
+#define debug_warning(__msg) \
+   ((void)0) 
+#endif
+
+
+/**
+ * Output an error message. Not muted on release version.
+ */
+#ifdef DEBUG
+#define debug_error(__msg) \
+   _debug_printf("%s:%u:%s: error: %s\n", __FILE__, __LINE__, __FUNCTION__, __msg) 
+#else
+#define debug_error(__msg) \
+   _debug_printf("error: %s\n", __msg)
+#endif
+
+
+/**
+ * Used by debug_dump_enum and debug_dump_flags to describe symbols.
+ */
+struct debug_named_value
+{
+   const char *name;
+   unsigned long value;
+};
+
+
+/**
+ * Some C pre-processor magic to simplify creating named values.
+ * 
+ * Example:
+ * @code
+ * static const debug_named_value my_names[] = {
+ *    DEBUG_NAMED_VALUE(MY_ENUM_VALUE_X),
+ *    DEBUG_NAMED_VALUE(MY_ENUM_VALUE_Y),
+ *    DEBUG_NAMED_VALUE(MY_ENUM_VALUE_Z),
+ *    DEBUG_NAMED_VALUE_END
+ * };
+ * 
+ *    ...
+ *    debug_printf("%s = %s\n", 
+ *                 name,
+ *                 debug_dump_enum(my_names, my_value));
+ *    ...
+ * @endcode
+ */
+#define DEBUG_NAMED_VALUE(__symbol) {#__symbol, (unsigned long)__symbol} 
+#define DEBUG_NAMED_VALUE_END {NULL, 0} 
+
+
+/**
+ * Convert a enum value to a string.
+ */
+const char *
+debug_dump_enum(const struct debug_named_value *names, 
+                unsigned long value);
+
+const char *
+debug_dump_enum_noprefix(const struct debug_named_value *names, 
+                         const char *prefix,
+                         unsigned long value);
+
+
+/**
+ * Convert binary flags value to a string.
+ */
+const char *
+debug_dump_flags(const struct debug_named_value *names, 
+                 unsigned long value);
+
+
+/**
+ * Get option.
+ * 
+ * It is an alias for getenv on Linux. 
+ * 
+ * On Windows it reads C:\gallium.cfg, which is a text file with CR+LF line 
+ * endings with one option per line as
+ *  
+ *   NAME=value
+ * 
+ * This file must be terminated with an extra empty line.
+ */
+const char *
+debug_get_option(const char *name, const char *dfault);
+
+boolean
+debug_get_bool_option(const char *name, boolean dfault);
+
+long
+debug_get_num_option(const char *name, long dfault);
+
+unsigned long
+debug_get_flags_option(const char *name, 
+                       const struct debug_named_value *flags,
+                       unsigned long dfault);
+
+
+void *
+debug_malloc(const char *file, unsigned line, const char *function,
+             size_t size);
+
+void
+debug_free(const char *file, unsigned line, const char *function,
+           void *ptr);
+
+void *
+debug_calloc(const char *file, unsigned line, const char *function,
+             size_t count, size_t size );
+
+void *
+debug_realloc(const char *file, unsigned line, const char *function,
+              void *old_ptr, size_t old_size, size_t new_size );
+
+unsigned long
+debug_memory_begin(void);
+
+void 
+debug_memory_end(unsigned long beginning);
+
+
+#if defined(PROFILE) && defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
+
+void
+debug_profile_start(void);
+
+void 
+debug_profile_stop(void);
+
+#endif
+
+
+#ifdef DEBUG
+struct pipe_surface;
+void debug_dump_image(const char *prefix,
+                      unsigned format, unsigned cpp,
+                      unsigned width, unsigned height,
+                      unsigned stride,
+                      const void *data);
+void debug_dump_surface(const char *prefix,
+                        struct pipe_surface *surface);   
+void debug_dump_surface_bmp(const char *filename,
+                            struct pipe_surface *surface);
+#else
+#define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0)
+#define debug_dump_surface(prefix, surface) ((void)0)
+#define debug_dump_surface_bmp(filename, surface) ((void)0)
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* U_DEBUG_H_ */
diff --git a/src/gallium/auxiliary/util/u_debug_memory.c b/src/gallium/auxiliary/util/u_debug_memory.c
new file mode 100644 (file)
index 0000000..7623cb9
--- /dev/null
@@ -0,0 +1,324 @@
+/**************************************************************************
+ * 
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+/**
+ * @file
+ * Memory debugging.
+ * 
+ * @author José Fonseca <jrfonseca@tungstengraphics.com>
+ */
+
+#include "pipe/p_config.h" 
+
+#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
+#include <windows.h>
+#include <winddi.h>
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
+#include <wdm.h>
+#else
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+#include "util/u_debug.h" 
+#include "util/u_debug_stack.h" 
+#include "util/u_double_list.h" 
+
+
+#define DEBUG_MEMORY_MAGIC 0x6e34090aU 
+#define DEBUG_MEMORY_STACK 0 /* XXX: disabled until we have symbol lookup */
+
+
+#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) && !defined(WINCE)
+#define real_malloc(_size) EngAllocMem(0, _size, 'D3AG')
+#define real_free(_ptr) EngFreeMem(_ptr)
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
+#define real_malloc(_size) ExAllocatePool(0, _size)
+#define real_free(_ptr) ExFreePool(_ptr)
+#else
+#define real_malloc(_size) malloc(_size)
+#define real_free(_ptr) free(_ptr)
+#endif
+
+
+struct debug_memory_header 
+{
+   struct list_head head;
+   
+   unsigned long no;
+   const char *file;
+   unsigned line;
+   const char *function;
+#if DEBUG_MEMORY_STACK
+   struct debug_stack_frame backtrace[DEBUG_MEMORY_STACK];
+#endif
+   size_t size;
+   
+   unsigned magic;
+};
+
+struct debug_memory_footer
+{
+   unsigned magic;
+};
+
+
+static struct list_head list = { &list, &list };
+
+static unsigned long last_no = 0;
+
+
+static INLINE struct debug_memory_header *
+header_from_data(void *data)
+{
+   if(data)
+      return (struct debug_memory_header *)((char *)data - sizeof(struct debug_memory_header));
+   else
+      return NULL;
+}
+
+static INLINE void *
+data_from_header(struct debug_memory_header *hdr)
+{
+   if(hdr)
+      return (void *)((char *)hdr + sizeof(struct debug_memory_header));
+   else
+      return NULL;
+}
+
+static INLINE struct debug_memory_footer *
+footer_from_header(struct debug_memory_header *hdr)
+{
+   if(hdr)
+      return (struct debug_memory_footer *)((char *)hdr + sizeof(struct debug_memory_header) + hdr->size);
+   else
+      return NULL;
+}
+
+
+void *
+debug_malloc(const char *file, unsigned line, const char *function,
+             size_t size) 
+{
+   struct debug_memory_header *hdr;
+   struct debug_memory_footer *ftr;
+   
+   hdr = real_malloc(sizeof(*hdr) + size + sizeof(*ftr));
+   if(!hdr) {
+      debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
+                   file, line, function,
+                   (long unsigned)size);
+      return NULL;
+   }
+   hdr->no = last_no++;
+   hdr->file = file;
+   hdr->line = line;
+   hdr->function = function;
+   hdr->size = size;
+   hdr->magic = DEBUG_MEMORY_MAGIC;
+
+#if DEBUG_MEMORY_STACK
+   debug_backtrace_capture(hdr->backtrace, 0, DEBUG_MEMORY_STACK);
+#endif
+
+   ftr = footer_from_header(hdr);
+   ftr->magic = DEBUG_MEMORY_MAGIC;
+   
+   LIST_ADDTAIL(&hdr->head, &list);
+   
+   return data_from_header(hdr);
+}
+
+void
+debug_free(const char *file, unsigned line, const char *function,
+           void *ptr) 
+{
+   struct debug_memory_header *hdr;
+   struct debug_memory_footer *ftr;
+   
+   if(!ptr)
+      return;
+   
+   hdr = header_from_data(ptr);
+   if(hdr->magic != DEBUG_MEMORY_MAGIC) {
+      debug_printf("%s:%u:%s: freeing bad or corrupted memory %p\n",
+                   file, line, function,
+                   ptr);
+      debug_assert(0);
+      return;
+   }
+
+   ftr = footer_from_header(hdr);
+   if(ftr->magic != DEBUG_MEMORY_MAGIC) {
+      debug_printf("%s:%u:%s: buffer overflow %p\n",
+                   hdr->file, hdr->line, hdr->function,
+                   ptr);
+      debug_assert(0);
+   }
+
+   LIST_DEL(&hdr->head);
+   hdr->magic = 0;
+   ftr->magic = 0;
+   
+   real_free(hdr);
+}
+
+void *
+debug_calloc(const char *file, unsigned line, const char *function,
+             size_t count, size_t size )
+{
+   void *ptr = debug_malloc( file, line, function, count * size );
+   if( ptr )
+      memset( ptr, 0, count * size );
+   return ptr;
+}
+
+void *
+debug_realloc(const char *file, unsigned line, const char *function,
+              void *old_ptr, size_t old_size, size_t new_size )
+{
+   struct debug_memory_header *old_hdr, *new_hdr;
+   struct debug_memory_footer *old_ftr, *new_ftr;
+   void *new_ptr;
+   
+   if(!old_ptr)
+      return debug_malloc( file, line, function, new_size );
+   
+   if(!new_size) {
+      debug_free( file, line, function, old_ptr );
+      return NULL;
+   }
+   
+   old_hdr = header_from_data(old_ptr);
+   if(old_hdr->magic != DEBUG_MEMORY_MAGIC) {
+      debug_printf("%s:%u:%s: reallocating bad or corrupted memory %p\n",
+                   file, line, function,
+                   old_ptr);
+      debug_assert(0);
+      return NULL;
+   }
+   
+   old_ftr = footer_from_header(old_hdr);
+   if(old_ftr->magic != DEBUG_MEMORY_MAGIC) {
+      debug_printf("%s:%u:%s: buffer overflow %p\n",
+                   old_hdr->file, old_hdr->line, old_hdr->function,
+                   old_ptr);
+      debug_assert(0);
+   }
+
+   /* alloc new */
+   new_hdr = real_malloc(sizeof(*new_hdr) + new_size + sizeof(*new_ftr));
+   if(!new_hdr) {
+      debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
+                   file, line, function,
+                   (long unsigned)new_size);
+      return NULL;
+   }
+   new_hdr->no = old_hdr->no;
+   new_hdr->file = old_hdr->file;
+   new_hdr->line = old_hdr->line;
+   new_hdr->function = old_hdr->function;
+   new_hdr->size = new_size;
+   new_hdr->magic = DEBUG_MEMORY_MAGIC;
+   
+   new_ftr = footer_from_header(new_hdr);
+   new_ftr->magic = DEBUG_MEMORY_MAGIC;
+   
+   LIST_REPLACE(&old_hdr->head, &new_hdr->head);
+
+   /* copy data */
+   new_ptr = data_from_header(new_hdr);
+   memcpy( new_ptr, old_ptr, old_size < new_size ? old_size : new_size );
+
+   /* free old */
+   old_hdr->magic = 0;
+   old_ftr->magic = 0;
+   real_free(old_hdr);
+
+   return new_ptr;
+}
+
+unsigned long
+debug_memory_begin(void)
+{
+   return last_no;
+}
+
+void 
+debug_memory_end(unsigned long start_no)
+{
+   size_t total_size = 0;
+   struct list_head *entry;
+
+   if(start_no == last_no)
+      return;
+
+   entry = list.prev;
+   for (; entry != &list; entry = entry->prev) {
+      struct debug_memory_header *hdr;
+      void *ptr;
+      struct debug_memory_footer *ftr;
+
+      hdr = LIST_ENTRY(struct debug_memory_header, entry, head);
+      ptr = data_from_header(hdr);
+      ftr = footer_from_header(hdr);
+
+      if(hdr->magic != DEBUG_MEMORY_MAGIC) {
+         debug_printf("%s:%u:%s: bad or corrupted memory %p\n",
+                      hdr->file, hdr->line, hdr->function,
+                      ptr);
+         debug_assert(0);
+      }
+
+      if((start_no <= hdr->no && hdr->no < last_no) ||
+        (last_no < start_no && (hdr->no < last_no || start_no <= hdr->no))) {
+        debug_printf("%s:%u:%s: %u bytes at %p not freed\n",
+                     hdr->file, hdr->line, hdr->function,
+                     hdr->size, ptr);
+#if DEBUG_MEMORY_STACK
+        debug_backtrace_dump(hdr->backtrace, DEBUG_MEMORY_STACK);
+#endif
+        total_size += hdr->size;
+      }
+
+      if(ftr->magic != DEBUG_MEMORY_MAGIC) {
+         debug_printf("%s:%u:%s: buffer overflow %p\n",
+                      hdr->file, hdr->line, hdr->function,
+                      ptr);
+         debug_assert(0);
+      }
+   }
+
+   if(total_size) {
+      debug_printf("Total of %u KB of system memory apparently leaked\n",
+                  (total_size + 1023)/1024);
+   }
+   else {
+      debug_printf("No memory leaks detected.\n");
+   }
+}
diff --git a/src/gallium/auxiliary/util/u_debug_profile.c b/src/gallium/auxiliary/util/u_debug_profile.c
new file mode 100644 (file)
index 0000000..6d8b244
--- /dev/null
@@ -0,0 +1,320 @@
+/**************************************************************************
+ * 
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+/**
+ * @file
+ * Poor-man profiling.
+ * 
+ * @author José Fonseca <jrfonseca@tungstengraphics.com>
+ * 
+ * @sa http://blogs.msdn.com/joshpoley/archive/2008/03/12/poor-man-s-profiler.aspx
+ * @sa http://www.johnpanzer.com/aci_cuj/index.html
+ */
+
+#include "pipe/p_config.h" 
+
+#if defined(PROFILE) && defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
+
+#include <windows.h>
+#include <winddi.h>
+
+#include "util/u_debug.h" 
+#include "util/u_string.h" 
+
+
+#define PROFILE_TABLE_SIZE (1024*1024)
+#define FILE_NAME_SIZE 256
+
+struct debug_profile_entry
+{
+   uintptr_t caller;
+   uintptr_t callee;
+   uint64_t samples;
+};
+
+static unsigned long enabled = 0;
+
+static WCHAR wFileName[FILE_NAME_SIZE] = L"\\??\\c:\\00000000.prof";
+static ULONG_PTR iFile = 0;
+
+static struct debug_profile_entry *table = NULL;
+static unsigned long free_table_entries = 0;
+static unsigned long max_table_entries = 0;
+
+uint64_t start_stamp = 0;
+uint64_t end_stamp = 0;
+
+
+static void
+debug_profile_entry(uintptr_t caller, uintptr_t callee, uint64_t samples)
+{
+   unsigned hash = ( caller + callee ) & PROFILE_TABLE_SIZE - 1;
+   
+   while(1) {
+      if(table[hash].caller == 0 && table[hash].callee == 0) {
+         table[hash].caller = caller;
+         table[hash].callee = callee;
+         table[hash].samples = samples;
+         --free_table_entries;
+         break;
+      }
+      else if(table[hash].caller == caller && table[hash].callee == callee) {
+         table[hash].samples += samples;
+         break;
+      }
+      else {
+         ++hash;
+      }
+   }
+}
+
+
+static uintptr_t caller_stack[1024];
+static unsigned last_caller = 0;
+
+
+static int64_t delta(void) {
+   int64_t result = end_stamp - start_stamp;
+   if(result > UINT64_C(0xffffffff))
+      result = 0;
+   return result;
+}
+
+
+static void __cdecl 
+debug_profile_enter(uintptr_t callee)
+{
+   uintptr_t caller = last_caller ? caller_stack[last_caller - 1] : 0;
+                
+   if (caller)
+      debug_profile_entry(caller, 0, delta());
+   debug_profile_entry(caller, callee, 1);
+   caller_stack[last_caller++] = callee;
+}
+
+
+static void __cdecl
+debug_profile_exit(uintptr_t callee)
+{
+   debug_profile_entry(callee, 0, delta());
+   if(last_caller)
+      --last_caller;
+}
+   
+   
+/**
+ * Called at the start of every method or function.
+ * 
+ * @sa http://msdn.microsoft.com/en-us/library/c63a9b7h.aspx
+ */
+void __declspec(naked) __cdecl 
+_penter(void) {
+   _asm {
+      push eax
+      mov eax, [enabled]
+      test eax, eax
+      jz skip
+
+      push edx
+      
+      rdtsc
+      mov dword ptr [end_stamp], eax
+      mov dword ptr [end_stamp+4], edx
+
+      xor eax, eax
+      mov [enabled], eax
+
+      mov eax, [esp+8]
+
+      push ebx
+      push ecx
+      push ebp
+      push edi
+      push esi
+
+      push eax
+      call debug_profile_enter
+      add esp, 4
+
+      pop esi
+      pop edi
+      pop ebp
+      pop ecx
+      pop ebx
+
+      mov eax, 1
+      mov [enabled], eax 
+
+      rdtsc
+      mov dword ptr [start_stamp], eax
+      mov dword ptr [start_stamp+4], edx
+      
+      pop edx
+skip:
+      pop eax
+      ret
+   }
+}
+
+
+/**
+ * Called at the end of Calls the end of every method or function.
+ * 
+ * @sa http://msdn.microsoft.com/en-us/library/xc11y76y.aspx
+ */
+void __declspec(naked) __cdecl 
+_pexit(void) {
+   _asm {
+      push eax
+      mov eax, [enabled]
+      test eax, eax
+      jz skip
+
+      push edx
+      
+      rdtsc
+      mov dword ptr [end_stamp], eax
+      mov dword ptr [end_stamp+4], edx
+
+      xor eax, eax
+      mov [enabled], eax
+
+      mov eax, [esp+8]
+
+      push ebx
+      push ecx
+      push ebp
+      push edi
+      push esi
+
+      push eax
+      call debug_profile_exit
+      add esp, 4
+
+      pop esi
+      pop edi
+      pop ebp
+      pop ecx
+      pop ebx
+
+      mov eax, 1
+      mov [enabled], eax 
+
+      rdtsc
+      mov dword ptr [start_stamp], eax
+      mov dword ptr [start_stamp+4], edx
+      
+      pop edx
+skip:
+      pop eax
+      ret
+   }
+}
+
+
+/**
+ * Reference function for calibration. 
+ */
+void __declspec(naked) 
+__debug_profile_reference(void) {
+   _asm {
+      call _penter
+      call _pexit
+      ret
+   }
+}
+
+
+void
+debug_profile_start(void)
+{
+   WCHAR *p;
+
+   // increment starting from the less significant digit
+   p = &wFileName[14];
+   while(1) {
+      if(*p == '9') {
+         *p-- = '0';
+      }
+      else {
+         *p += 1;
+         break;
+      }
+   }
+
+   table = EngMapFile(wFileName, 
+                      PROFILE_TABLE_SIZE*sizeof(struct debug_profile_entry), 
+                      &iFile);
+   if(table) {
+      unsigned i;
+      
+      free_table_entries = max_table_entries = PROFILE_TABLE_SIZE;
+      memset(table, 0, PROFILE_TABLE_SIZE*sizeof(struct debug_profile_entry));
+      
+      table[0].caller = (uintptr_t)&__debug_profile_reference;
+      table[0].callee = 0;
+      table[0].samples = 0;
+      --free_table_entries;
+
+      _asm {
+         push edx
+         push eax
+      
+         rdtsc
+         mov dword ptr [start_stamp], eax
+         mov dword ptr [start_stamp+4], edx
+         
+         pop edx
+         pop eax
+      }
+
+      last_caller = 0;
+      
+      enabled = 1;
+
+      for(i = 0; i < 8; ++i) {
+         _asm {
+            call __debug_profile_reference
+         }
+      }
+   }
+}
+
+
+void 
+debug_profile_stop(void)
+{
+   enabled = 0;
+
+   if(iFile)
+      EngUnmapFile(iFile);
+   iFile = 0;
+   table = NULL;
+   free_table_entries = max_table_entries = 0;
+}
+
+#endif /* PROFILE */
diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c
new file mode 100644 (file)
index 0000000..76068a6
--- /dev/null
@@ -0,0 +1,97 @@
+/**************************************************************************
+ * 
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+/**
+ * @file
+ * Stack backtracing.
+ * 
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+#include "u_debug.h"
+#include "u_debug_stack.h"
+
+
+void
+debug_backtrace_capture(struct debug_stack_frame *backtrace,
+                        unsigned start_frame, 
+                        unsigned nr_frames)
+{
+   const void **frame_pointer = NULL;
+   unsigned i = 0;
+
+   if(!nr_frames)
+      return;
+
+#if defined(PIPE_CC_GCC)
+   frame_pointer = ((const void **)__builtin_frame_address(1));
+#elif defined(PIPE_CC_MSVC)
+   __asm {
+      mov frame_pointer, ebp
+   }
+   frame_pointer = (const void **)frame_pointer[0];
+#else
+   frame_pointer = NULL;
+#endif
+  
+   
+#ifdef PIPE_ARCH_X86
+   while(nr_frames) {
+      if(!frame_pointer)
+         break;
+      
+      if(start_frame)
+         --start_frame;
+      else {
+         backtrace[i++].function = frame_pointer[1];
+         --nr_frames;
+      }
+      
+      frame_pointer = (const void **)frame_pointer[0];
+   }
+#endif
+   
+   while(nr_frames) {
+      backtrace[i++].function = NULL;
+      --nr_frames;
+   }
+}
+   
+
+void
+debug_backtrace_dump(const struct debug_stack_frame *backtrace, 
+                     unsigned nr_frames)
+{
+   unsigned i;
+   
+   for(i = 0; i < nr_frames; ++i) {
+      if(!backtrace[i].function)
+         break;
+      debug_printf("\t%p\n", backtrace[i].function);
+   }
+}
+
diff --git a/src/gallium/auxiliary/util/u_debug_stack.h b/src/gallium/auxiliary/util/u_debug_stack.h
new file mode 100644 (file)
index 0000000..f50f04e
--- /dev/null
@@ -0,0 +1,65 @@
+/**************************************************************************
+ * 
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#ifndef U_DEBUG_STACK_H_
+#define U_DEBUG_STACK_H_
+
+
+/**
+ * @file
+ * Stack backtracing.
+ * 
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct debug_stack_frame 
+{
+   const void *function;
+};
+   
+
+void
+debug_backtrace_capture(struct debug_stack_frame *backtrace,
+                        unsigned start_frame, 
+                        unsigned nr_frames);
+
+void
+debug_backtrace_dump(const struct debug_stack_frame *backtrace, 
+                     unsigned nr_frames);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* U_DEBUG_STACK_H_ */
index f282f3d289154e0ca00168c4c4805259c739a057..4110485fb19e0e685b9e7112824c6ec20b79220a 100644 (file)
@@ -51,9 +51,11 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
    assert(num_attribs <= PIPE_MAX_ATTRIBS);
 
    /* tell pipe about the vertex buffer */
+   memset(&vbuffer, 0, sizeof(vbuffer));
    vbuffer.buffer = vbuf;
    vbuffer.stride = num_attribs * 4 * sizeof(float);  /* vertex size */
    vbuffer.buffer_offset = offset;
+   vbuffer.max_index = num_verts - 1;
    pipe->set_vertex_buffers(pipe, 1, &vbuffer);
 
    /* tell pipe about the vertex attributes */
@@ -127,6 +129,6 @@ util_draw_texquad(struct pipe_context *pipe,
          util_draw_vertex_buffer(pipe, vbuf, 0, PIPE_PRIM_TRIANGLE_FAN, 4, 2);
       }
 
-      pipe_buffer_reference(pipe->screen, &vbuf, NULL);
+      pipe_buffer_reference(&vbuf, NULL);
    }
 }
index 2b4cdab6cf3ca85583a5fb5c39c8140fdcfe2c51..b32ad1cbe98bc86513d14fa98ce96ccdba400001 100644 (file)
 
 
 #include "pipe/p_context.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_inlines.h"
 #include "pipe/p_shader_tokens.h"
+#include "pipe/p_state.h"
 
 #include "util/u_memory.h"
 #include "util/u_draw_quad.h"
@@ -61,10 +62,7 @@ struct gen_mipmap_state
    struct pipe_depth_stencil_alpha_state depthstencil;
    struct pipe_rasterizer_state rasterizer;
    struct pipe_sampler_state sampler;
-   struct pipe_viewport_state viewport;
 
-   struct pipe_shader_state vert_shader;
-   struct pipe_shader_state frag_shader;
    void *vs;
    void *fs;
 
@@ -78,15 +76,15 @@ struct gen_mipmap_state
 
 enum dtype
 {
-   UBYTE,
-   UBYTE_3_3_2,
-   USHORT,
-   USHORT_4_4_4_4,
-   USHORT_5_6_5,
-   USHORT_1_5_5_5_REV,
-   UINT,
-   FLOAT,
-   HALF_FLOAT
+   DTYPE_UBYTE,
+   DTYPE_UBYTE_3_3_2,
+   DTYPE_USHORT,
+   DTYPE_USHORT_4_4_4_4,
+   DTYPE_USHORT_5_6_5,
+   DTYPE_USHORT_1_5_5_5_REV,
+   DTYPE_UINT,
+   DTYPE_FLOAT,
+   DTYPE_HALF_FLOAT
 };
 
 
@@ -194,7 +192,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
    assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth);
    */
 
-   if (datatype == UBYTE && comps == 4) {
+   if (datatype == DTYPE_UBYTE && comps == 4) {
       uint i, j, k;
       const ubyte(*rowA)[4] = (const ubyte(*)[4]) srcRowA;
       const ubyte(*rowB)[4] = (const ubyte(*)[4]) srcRowB;
@@ -207,7 +205,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
       }
    }
-   else if (datatype == UBYTE && comps == 3) {
+   else if (datatype == DTYPE_UBYTE && comps == 3) {
       uint i, j, k;
       const ubyte(*rowA)[3] = (const ubyte(*)[3]) srcRowA;
       const ubyte(*rowB)[3] = (const ubyte(*)[3]) srcRowB;
@@ -219,7 +217,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
       }
    }
-   else if (datatype == UBYTE && comps == 2) {
+   else if (datatype == DTYPE_UBYTE && comps == 2) {
       uint i, j, k;
       const ubyte(*rowA)[2] = (const ubyte(*)[2]) srcRowA;
       const ubyte(*rowB)[2] = (const ubyte(*)[2]) srcRowB;
@@ -230,7 +228,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2;
       }
    }
-   else if (datatype == UBYTE && comps == 1) {
+   else if (datatype == DTYPE_UBYTE && comps == 1) {
       uint i, j, k;
       const ubyte *rowA = (const ubyte *) srcRowA;
       const ubyte *rowB = (const ubyte *) srcRowB;
@@ -241,7 +239,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
       }
    }
 
-   else if (datatype == USHORT && comps == 4) {
+   else if (datatype == DTYPE_USHORT && comps == 4) {
       uint i, j, k;
       const ushort(*rowA)[4] = (const ushort(*)[4]) srcRowA;
       const ushort(*rowB)[4] = (const ushort(*)[4]) srcRowB;
@@ -254,7 +252,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
       }
    }
-   else if (datatype == USHORT && comps == 3) {
+   else if (datatype == DTYPE_USHORT && comps == 3) {
       uint i, j, k;
       const ushort(*rowA)[3] = (const ushort(*)[3]) srcRowA;
       const ushort(*rowB)[3] = (const ushort(*)[3]) srcRowB;
@@ -266,7 +264,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
       }
    }
-   else if (datatype == USHORT && comps == 2) {
+   else if (datatype == DTYPE_USHORT && comps == 2) {
       uint i, j, k;
       const ushort(*rowA)[2] = (const ushort(*)[2]) srcRowA;
       const ushort(*rowB)[2] = (const ushort(*)[2]) srcRowB;
@@ -277,7 +275,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
       }
    }
-   else if (datatype == USHORT && comps == 1) {
+   else if (datatype == DTYPE_USHORT && comps == 1) {
       uint i, j, k;
       const ushort *rowA = (const ushort *) srcRowA;
       const ushort *rowB = (const ushort *) srcRowB;
@@ -288,7 +286,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
       }
    }
 
-   else if (datatype == FLOAT && comps == 4) {
+   else if (datatype == DTYPE_FLOAT && comps == 4) {
       uint i, j, k;
       const float(*rowA)[4] = (const float(*)[4]) srcRowA;
       const float(*rowB)[4] = (const float(*)[4]) srcRowB;
@@ -305,7 +303,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
                       rowB[j][3] + rowB[k][3]) * 0.25F;
       }
    }
-   else if (datatype == FLOAT && comps == 3) {
+   else if (datatype == DTYPE_FLOAT && comps == 3) {
       uint i, j, k;
       const float(*rowA)[3] = (const float(*)[3]) srcRowA;
       const float(*rowB)[3] = (const float(*)[3]) srcRowB;
@@ -320,7 +318,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
                       rowB[j][2] + rowB[k][2]) * 0.25F;
       }
    }
-   else if (datatype == FLOAT && comps == 2) {
+   else if (datatype == DTYPE_FLOAT && comps == 2) {
       uint i, j, k;
       const float(*rowA)[2] = (const float(*)[2]) srcRowA;
       const float(*rowB)[2] = (const float(*)[2]) srcRowB;
@@ -333,7 +331,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
                       rowB[j][1] + rowB[k][1]) * 0.25F;
       }
    }
-   else if (datatype == FLOAT && comps == 1) {
+   else if (datatype == DTYPE_FLOAT && comps == 1) {
       uint i, j, k;
       const float *rowA = (const float *) srcRowA;
       const float *rowB = (const float *) srcRowB;
@@ -345,7 +343,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
    }
 
 #if 0
-   else if (datatype == HALF_FLOAT && comps == 4) {
+   else if (datatype == HALF_DTYPE_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;
@@ -362,7 +360,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          }
       }
    }
-   else if (datatype == HALF_FLOAT && comps == 3) {
+   else if (datatype == DTYPE_HALF_FLOAT && comps == 3) {
       uint i, j, k, comp;
       const half_float(*rowA)[3] = (const half_float(*)[3]) srcRowA;
       const half_float(*rowB)[3] = (const half_float(*)[3]) srcRowB;
@@ -379,7 +377,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          }
       }
    }
-   else if (datatype == HALF_FLOAT && comps == 2) {
+   else if (datatype == DTYPE_HALF_FLOAT && comps == 2) {
       uint i, j, k, comp;
       const half_float(*rowA)[2] = (const half_float(*)[2]) srcRowA;
       const half_float(*rowB)[2] = (const half_float(*)[2]) srcRowB;
@@ -396,7 +394,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          }
       }
    }
-   else if (datatype == HALF_FLOAT && comps == 1) {
+   else if (datatype == DTYPE_HALF_FLOAT && comps == 1) {
       uint i, j, k;
       const half_float *rowA = (const half_float *) srcRowA;
       const half_float *rowB = (const half_float *) srcRowB;
@@ -413,7 +411,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
    }
 #endif
 
-   else if (datatype == UINT && comps == 1) {
+   else if (datatype == DTYPE_UINT && comps == 1) {
       uint i, j, k;
       const uint *rowA = (const uint *) srcRowA;
       const uint *rowB = (const uint *) srcRowB;
@@ -424,7 +422,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
       }
    }
 
-   else if (datatype == USHORT_5_6_5 && comps == 3) {
+   else if (datatype == DTYPE_USHORT_5_6_5 && comps == 3) {
       uint i, j, k;
       const ushort *rowA = (const ushort *) srcRowA;
       const ushort *rowB = (const ushort *) srcRowB;
@@ -449,7 +447,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          dst[i] = (blue << 11) | (green << 5) | red;
       }
    }
-   else if (datatype == USHORT_4_4_4_4 && comps == 4) {
+   else if (datatype == DTYPE_USHORT_4_4_4_4 && comps == 4) {
       uint i, j, k;
       const ushort *rowA = (const ushort *) srcRowA;
       const ushort *rowB = (const ushort *) srcRowB;
@@ -479,7 +477,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          dst[i] = (alpha << 12) | (blue << 8) | (green << 4) | red;
       }
    }
-   else if (datatype == USHORT_1_5_5_5_REV && comps == 4) {
+   else if (datatype == DTYPE_USHORT_1_5_5_5_REV && comps == 4) {
       uint i, j, k;
       const ushort *rowA = (const ushort *) srcRowA;
       const ushort *rowB = (const ushort *) srcRowB;
@@ -509,7 +507,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
          dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red;
       }
    }
-   else if (datatype == UBYTE_3_3_2 && comps == 3) {
+   else if (datatype == DTYPE_UBYTE_3_3_2 && comps == 3) {
       uint i, j, k;
       const ubyte *rowA = (const ubyte *) srcRowA;
       const ubyte *rowB = (const ubyte *) srcRowB;
@@ -570,7 +568,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
    assert(comps >= 1);
    assert(comps <= 4);
 
-   if ((datatype == UBYTE) && (comps == 4)) {
+   if ((datatype == DTYPE_UBYTE) && (comps == 4)) {
       DECLARE_ROW_POINTERS(ubyte, 4);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -581,7 +579,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_3D(3);
       }
    }
-   else if ((datatype == UBYTE) && (comps == 3)) {
+   else if ((datatype == DTYPE_UBYTE) && (comps == 3)) {
       DECLARE_ROW_POINTERS(ubyte, 3);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -591,7 +589,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_3D(2);
       }
    }
-   else if ((datatype == UBYTE) && (comps == 2)) {
+   else if ((datatype == DTYPE_UBYTE) && (comps == 2)) {
       DECLARE_ROW_POINTERS(ubyte, 2);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -600,7 +598,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_3D(1);
       }
    }
-   else if ((datatype == UBYTE) && (comps == 1)) {
+   else if ((datatype == DTYPE_UBYTE) && (comps == 1)) {
       DECLARE_ROW_POINTERS(ubyte, 1);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -608,7 +606,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_3D(0);
       }
    }
-   else if ((datatype == USHORT) && (comps == 4)) {
+   else if ((datatype == DTYPE_USHORT) && (comps == 4)) {
       DECLARE_ROW_POINTERS(ushort, 4);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -619,7 +617,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_3D(3);
       }
    }
-   else if ((datatype == USHORT) && (comps == 3)) {
+   else if ((datatype == DTYPE_USHORT) && (comps == 3)) {
       DECLARE_ROW_POINTERS(ushort, 3);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -629,7 +627,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_3D(2);
       }
    }
-   else if ((datatype == USHORT) && (comps == 2)) {
+   else if ((datatype == DTYPE_USHORT) && (comps == 2)) {
       DECLARE_ROW_POINTERS(ushort, 2);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -638,7 +636,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_3D(1);
       }
    }
-   else if ((datatype == USHORT) && (comps == 1)) {
+   else if ((datatype == DTYPE_USHORT) && (comps == 1)) {
       DECLARE_ROW_POINTERS(ushort, 1);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -646,7 +644,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_3D(0);
       }
    }
-   else if ((datatype == FLOAT) && (comps == 4)) {
+   else if ((datatype == DTYPE_FLOAT) && (comps == 4)) {
       DECLARE_ROW_POINTERS(float, 4);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -657,7 +655,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_F_3D(3);
       }
    }
-   else if ((datatype == FLOAT) && (comps == 3)) {
+   else if ((datatype == DTYPE_FLOAT) && (comps == 3)) {
       DECLARE_ROW_POINTERS(float, 3);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -667,7 +665,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_F_3D(2);
       }
    }
-   else if ((datatype == FLOAT) && (comps == 2)) {
+   else if ((datatype == DTYPE_FLOAT) && (comps == 2)) {
       DECLARE_ROW_POINTERS(float, 2);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -676,7 +674,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_F_3D(1);
       }
    }
-   else if ((datatype == FLOAT) && (comps == 1)) {
+   else if ((datatype == DTYPE_FLOAT) && (comps == 1)) {
       DECLARE_ROW_POINTERS(float, 1);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -684,7 +682,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_F_3D(0);
       }
    }
-   else if ((datatype == HALF_FLOAT) && (comps == 4)) {
+   else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 4)) {
       DECLARE_ROW_POINTERS(half_float, 4);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -695,7 +693,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_HF_3D(3);
       }
    }
-   else if ((datatype == HALF_FLOAT) && (comps == 3)) {
+   else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 3)) {
       DECLARE_ROW_POINTERS(half_float, 4);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -705,7 +703,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_HF_3D(2);
       }
    }
-   else if ((datatype == HALF_FLOAT) && (comps == 2)) {
+   else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 2)) {
       DECLARE_ROW_POINTERS(half_float, 4);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -714,7 +712,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_HF_3D(1);
       }
    }
-   else if ((datatype == HALF_FLOAT) && (comps == 1)) {
+   else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 1)) {
       DECLARE_ROW_POINTERS(half_float, 4);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -722,7 +720,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          FILTER_HF_3D(0);
       }
    }
-   else if ((datatype == UINT) && (comps == 1)) {
+   else if ((datatype == DTYPE_UINT) && (comps == 1)) {
       const uint *rowA = (const uint *) srcRowA;
       const uint *rowB = (const uint *) srcRowB;
       const uint *rowC = (const uint *) srcRowC;
@@ -738,7 +736,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          dst[i] = (float)((double) tmp * 0.125);
       }
    }
-   else if ((datatype == USHORT_5_6_5) && (comps == 3)) {
+   else if ((datatype == DTYPE_USHORT_5_6_5) && (comps == 3)) {
       DECLARE_ROW_POINTERS0(ushort);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -776,7 +774,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          dst[i] = (b << 11) | (g << 5) | r;
       }
    }
-   else if ((datatype == USHORT_4_4_4_4) && (comps == 4)) {
+   else if ((datatype == DTYPE_USHORT_4_4_4_4) && (comps == 4)) {
       DECLARE_ROW_POINTERS0(ushort);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -825,7 +823,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          dst[i] = (a << 12) | (b << 8) | (g << 4) | r;
       }
    }
-   else if ((datatype == USHORT_1_5_5_5_REV) && (comps == 4)) {
+   else if ((datatype == DTYPE_USHORT_1_5_5_5_REV) && (comps == 4)) {
       DECLARE_ROW_POINTERS0(ushort);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -874,7 +872,7 @@ do_row_3D(enum dtype datatype, uint comps, int srcWidth,
          dst[i] = (a << 15) | (b << 10) | (g << 5) | r;
       }
    }
-   else if ((datatype == UBYTE_3_3_2) && (comps == 3)) {
+   else if ((datatype == DTYPE_UBYTE_3_3_2) && (comps == 3)) {
       DECLARE_ROW_POINTERS0(ushort);
 
       for (i = j = 0, k = k0; i < (uint) dstWidth;
@@ -928,34 +926,34 @@ format_to_type_comps(enum pipe_format pformat,
    case PIPE_FORMAT_X8R8G8B8_UNORM:
    case PIPE_FORMAT_B8G8R8A8_UNORM:
    case PIPE_FORMAT_B8G8R8X8_UNORM:
-      *datatype = UBYTE;
+      *datatype = DTYPE_UBYTE;
       *comps = 4;
       return;
    case PIPE_FORMAT_A1R5G5B5_UNORM:
-      *datatype = USHORT_1_5_5_5_REV;
+      *datatype = DTYPE_USHORT_1_5_5_5_REV;
       *comps = 4;
       return;
    case PIPE_FORMAT_A4R4G4B4_UNORM:
-      *datatype = USHORT_4_4_4_4;
+      *datatype = DTYPE_USHORT_4_4_4_4;
       *comps = 4;
       return;
    case PIPE_FORMAT_R5G6B5_UNORM:
-      *datatype = USHORT_5_6_5;
+      *datatype = DTYPE_USHORT_5_6_5;
       *comps = 3;
       return;
    case PIPE_FORMAT_L8_UNORM:
    case PIPE_FORMAT_A8_UNORM:
    case PIPE_FORMAT_I8_UNORM:
-      *datatype = UBYTE;
+      *datatype = DTYPE_UBYTE;
       *comps = 1;
       return;
    case PIPE_FORMAT_A8L8_UNORM:
-      *datatype = UBYTE;
+      *datatype = DTYPE_UBYTE;
       *comps = 2;
       return;
    default:
       assert(0);
-      *datatype = UBYTE;
+      *datatype = DTYPE_UBYTE;
       *comps = 0;
       break;
    }
@@ -1116,31 +1114,30 @@ make_1d_mipmap(struct gen_mipmap_state *ctx,
 
    for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
       const uint srcLevel = dstLevel - 1;
-      struct pipe_surface *srcSurf, *dstSurf;
+      struct pipe_transfer *srcTrans, *dstTrans;
       void *srcMap, *dstMap;
       
-      srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice,
-                                        PIPE_BUFFER_USAGE_CPU_READ);
-
-      dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice,
-                                        PIPE_BUFFER_USAGE_CPU_WRITE);
-
-      srcMap = ((ubyte *) pipe_surface_map(srcSurf,
-                                           PIPE_BUFFER_USAGE_CPU_READ)
-                + srcSurf->offset);
-      dstMap = ((ubyte *) pipe_surface_map(dstSurf,
-                                           PIPE_BUFFER_USAGE_CPU_WRITE)
-                + dstSurf->offset);
+      srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
+                                          PIPE_TRANSFER_READ, 0, 0,
+                                          pt->width[srcLevel],
+                                          pt->height[srcLevel]);
+      dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
+                                          PIPE_TRANSFER_WRITE, 0, 0,
+                                          pt->width[dstLevel],
+                                          pt->height[dstLevel]);
+
+      srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
+      dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
 
       reduce_1d(pt->format,
-                srcSurf->width, srcMap,
-                dstSurf->width, dstMap);
+                srcTrans->width, srcMap,
+                dstTrans->width, dstMap);
 
-      pipe_surface_unmap(srcSurf);
-      pipe_surface_unmap(dstSurf);
+      screen->transfer_unmap(screen, srcTrans);
+      screen->transfer_unmap(screen, dstTrans);
 
-      pipe_surface_reference(&srcSurf, NULL);
-      pipe_surface_reference(&dstSurf, NULL);
+      screen->tex_transfer_destroy(srcTrans);
+      screen->tex_transfer_destroy(dstTrans);
    }
 }
 
@@ -1160,32 +1157,32 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
 
    for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
       const uint srcLevel = dstLevel - 1;
-      struct pipe_surface *srcSurf, *dstSurf;
+      struct pipe_transfer *srcTrans, *dstTrans;
       ubyte *srcMap, *dstMap;
       
-      srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice,
-                                        PIPE_BUFFER_USAGE_CPU_READ);
-      dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice,
-                                        PIPE_BUFFER_USAGE_CPU_WRITE);
-
-      srcMap = ((ubyte *) pipe_surface_map(srcSurf,
-                                           PIPE_BUFFER_USAGE_CPU_READ)
-                + srcSurf->offset);
-      dstMap = ((ubyte *) pipe_surface_map(dstSurf,
-                                           PIPE_BUFFER_USAGE_CPU_WRITE)
-                + dstSurf->offset);
+      srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
+                                          PIPE_TRANSFER_READ, 0, 0,
+                                          pt->width[srcLevel],
+                                          pt->height[srcLevel]);
+      dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
+                                          PIPE_TRANSFER_WRITE, 0, 0,
+                                          pt->width[dstLevel],
+                                          pt->height[dstLevel]);
+
+      srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
+      dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
 
       reduce_2d(pt->format,
-                srcSurf->width, srcSurf->height,
-                srcSurf->stride, srcMap,
-                dstSurf->width, dstSurf->height,
-                dstSurf->stride, dstMap);
+                srcTrans->width, srcTrans->height,
+                srcTrans->stride, srcMap,
+                dstTrans->width, dstTrans->height,
+                dstTrans->stride, dstMap);
 
-      pipe_surface_unmap(srcSurf);
-      pipe_surface_unmap(dstSurf);
+      screen->transfer_unmap(screen, srcTrans);
+      screen->transfer_unmap(screen, dstTrans);
 
-      pipe_surface_reference(&srcSurf, NULL);
-      pipe_surface_reference(&dstSurf, NULL);
+      screen->tex_transfer_destroy(srcTrans);
+      screen->tex_transfer_destroy(dstTrans);
    }
 }
 
@@ -1195,6 +1192,7 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
                struct pipe_texture *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;
@@ -1204,37 +1202,36 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
 
    for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
       const uint srcLevel = dstLevel - 1;
-      struct pipe_surface *srcSurf, *dstSurf;
+      struct pipe_transfer *srcTrans, *dstTrans;
       ubyte *srcMap, *dstMap;
       
-      srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice,
-                                        PIPE_BUFFER_USAGE_CPU_READ);
-      dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice,
-                                        PIPE_BUFFER_USAGE_CPU_WRITE);
-
-      srcMap = ((ubyte *) pipe_surface_map(srcSurf,
-                                           PIPE_BUFFER_USAGE_CPU_READ)
-                + srcSurf->offset);
-      dstMap = ((ubyte *) pipe_surface_map(dstSurf,
-                                           PIPE_BUFFER_USAGE_CPU_WRITE)
-                + dstSurf->offset);
+      srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
+                                          PIPE_TRANSFER_READ, 0, 0,
+                                          pt->width[srcLevel],
+                                          pt->height[srcLevel]);
+      dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
+                                          PIPE_TRANSFER_WRITE, 0, 0,
+                                          pt->width[dstLevel],
+                                          pt->height[dstLevel]);
+
+      srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
+      dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
 
-#if 0
       reduce_3d(pt->format,
-                srcSurf->width, srcSurf->height,
-                srcSurf->stride, srcMap,
-                dstSurf->width, dstSurf->height,
-                dstSurf->stride, dstMap);
-#else
-      (void) reduce_3d;
-#endif
+                srcTrans->width, srcTrans->height,
+                srcTrans->stride, srcMap,
+                dstTrans->width, dstTrans->height,
+                dstTrans->stride, dstMap);
 
-      pipe_surface_unmap(srcSurf);
-      pipe_surface_unmap(dstSurf);
+      screen->transfer_unmap(screen, srcTrans);
+      screen->transfer_unmap(screen, dstTrans);
 
-      pipe_surface_reference(&srcSurf, NULL);
-      pipe_surface_reference(&dstSurf, NULL);
+      screen->tex_transfer_destroy(srcTrans);
+      screen->tex_transfer_destroy(dstTrans);
    }
+#else
+   (void) reduce_3d;
+#endif
 }
 
 
@@ -1294,8 +1291,7 @@ util_create_gen_mipmap(struct pipe_context *pipe,
    memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer));
    ctx->rasterizer.front_winding = PIPE_WINDING_CW;
    ctx->rasterizer.cull_mode = PIPE_WINDING_NONE;
-   ctx->rasterizer.bypass_clipping = 1;
-   /*ctx->rasterizer.bypass_vs = 1;*/
+   ctx->rasterizer.bypass_vs_clip_and_viewport = 1;
    ctx->rasterizer.gl_rasterization_rules = 1;
 
    /* sampler state */
@@ -1306,28 +1302,19 @@ util_create_gen_mipmap(struct pipe_context *pipe,
    ctx->sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
    ctx->sampler.normalized_coords = 1;
 
-   /* viewport state (identity, verts are in wincoords) */
-   ctx->viewport.scale[0] = 1.0;
-   ctx->viewport.scale[1] = 1.0;
-   ctx->viewport.scale[2] = 1.0;
-   ctx->viewport.scale[3] = 1.0;
-   ctx->viewport.translate[0] = 0.0;
-   ctx->viewport.translate[1] = 0.0;
-   ctx->viewport.translate[2] = 0.0;
-   ctx->viewport.translate[3] = 0.0;
-
-   /* vertex shader */
+   /* vertex shader - still needed to specify mapping from fragment
+    * shader input semantics to vertex elements 
+    */
    {
       const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
                                       TGSI_SEMANTIC_GENERIC };
       const uint semantic_indexes[] = { 0, 0 };
       ctx->vs = util_make_vertex_passthrough_shader(pipe, 2, semantic_names,
-                                                    semantic_indexes,
-                                                    &ctx->vert_shader);
+                                                    semantic_indexes);
    }
 
    /* fragment shader */
-   ctx->fs = util_make_fragment_tex_shader(pipe, &ctx->frag_shader);
+   ctx->fs = util_make_fragment_tex_shader(pipe);
 
    /* vertex data that doesn't change */
    for (i = 0; i < 4; i++) {
@@ -1369,7 +1356,6 @@ get_next_slot(struct gen_mipmap_state *ctx)
 static unsigned
 set_vertex_data(struct gen_mipmap_state *ctx, float width, float height)
 {
-   void *buf;
    unsigned offset;
 
    ctx->vertices[0][0][0] = 0.0f; /*x*/
@@ -1394,12 +1380,8 @@ set_vertex_data(struct gen_mipmap_state *ctx, float width, float height)
 
    offset = get_next_slot( ctx );
 
-   buf = pipe_buffer_map(ctx->pipe->screen, ctx->vbuf,
-                         PIPE_BUFFER_USAGE_CPU_WRITE);
-
-   memcpy((char *)buf + offset, ctx->vertices, sizeof(ctx->vertices));
-
-   pipe_buffer_unmap(ctx->pipe->screen, ctx->vbuf);
+   pipe_buffer_write(ctx->pipe->screen, ctx->vbuf,
+                     offset, sizeof(ctx->vertices), ctx->vertices);
 
    return offset;
 }
@@ -1417,10 +1399,7 @@ util_destroy_gen_mipmap(struct gen_mipmap_state *ctx)
    pipe->delete_vs_state(pipe, ctx->vs);
    pipe->delete_fs_state(pipe, ctx->fs);
 
-   FREE((void*) ctx->vert_shader.tokens);
-   FREE((void*) ctx->frag_shader.tokens);
-
-   pipe_buffer_reference(pipe->screen, &ctx->vbuf, NULL);
+   pipe_buffer_reference(&ctx->vbuf, NULL);
 
    FREE(ctx);
 }
@@ -1432,7 +1411,7 @@ util_destroy_gen_mipmap(struct gen_mipmap_state *ctx)
  */
 void util_gen_mipmap_flush( struct gen_mipmap_state *ctx )
 {
-   pipe_buffer_reference(ctx->pipe->screen, &ctx->vbuf, NULL);
+   pipe_buffer_reference(&ctx->vbuf, NULL);
    ctx->vbuf_slot = 0;
 } 
 
@@ -1476,13 +1455,11 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
    cso_save_framebuffer(ctx->cso);
    cso_save_fragment_shader(ctx->cso);
    cso_save_vertex_shader(ctx->cso);
-   cso_save_viewport(ctx->cso);
 
    /* bind our state */
    cso_set_blend(ctx->cso, &ctx->blend);
    cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil);
    cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
-   cso_set_viewport(ctx->cso, &ctx->viewport);
 
    cso_set_fragment_shader_handle(ctx->cso, ctx->fs);
    cso_set_vertex_shader_handle(ctx->cso, ctx->vs);
@@ -1528,7 +1505,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
 
       cso_set_sampler_textures(ctx->cso, 1, &pt);
 
-      /* quad coords in window coords (bypassing clipping, viewport mapping) */
+      /* quad coords in window coords (bypassing vs, clip and viewport) */
       offset = set_vertex_data(ctx,
                                (float) pt->width[dstLevel],
                                (float) pt->height[dstLevel]);
@@ -1555,5 +1532,4 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
    cso_restore_framebuffer(ctx->cso);
    cso_restore_fragment_shader(ctx->cso);
    cso_restore_vertex_shader(ctx->cso);
-   cso_restore_viewport(ctx->cso);
 }
index 2d15932ce3bb847eb3a84156d86a127642967956..6da7353e259a92b565dbf6da3987d21bc0621d81 100644 (file)
@@ -34,7 +34,7 @@
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 #include "util/u_memory.h"
 #include "util/u_handle_table.h"
index 0bc8de9632cfe71fb698943b102aeb0e9260ea62..2f83e318e44e17b8bef316ec5c6783dfd73f1d7b 100644 (file)
@@ -39,7 +39,7 @@
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 #include "cso_cache/cso_hash.h"
 
index 01b17ddb1b31dcf4ec28885643cd75eaf8be538c..3f70809efdc6868e161be4aabf75f8d12178316d 100644 (file)
@@ -35,7 +35,7 @@
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_error.h"
 
 #include "cso_cache/cso_hash.h"
index e999cefe748c0a39d8ef9304a4e8a30b35ddcd86..6be365e53bbc3fd56c8ac3d3d9a4152aef004ba7 100644 (file)
@@ -1,5 +1,5 @@
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "u_linear.h"
 
 void
index ab6f39ac31f44bab94038acb44c714f66efb93f2..1ecde7a9125cc3bde03bcdde144d2d1ef7fe8dd8 100644 (file)
@@ -40,7 +40,7 @@
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 
 #ifdef __cplusplus
index 1a6b596421f0ed6960c6eb0176f9e7b6e5011599..0b18d043adb2a52cee9abc8961c3b17cd950b3b2 100644 (file)
@@ -36,7 +36,7 @@
 
 
 #include "util/u_pointer.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 
 #ifdef __cplusplus
@@ -52,11 +52,11 @@ extern "C" {
 #endif
 
 
-#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) && defined(DEBUG) 
+#if defined(PIPE_OS_WINDOWS) && defined(DEBUG) 
 
 /* memory debugging */
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 #define MALLOC( _size ) \
    debug_malloc( __FILE__, __LINE__, __FUNCTION__, _size )
@@ -191,9 +191,11 @@ align_free(void *ptr)
 #if defined(HAVE_POSIX_MEMALIGN)
    FREE(ptr);
 #else
-   void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
-   void *realAddr = *cubbyHole;
-   FREE(realAddr);
+   if (ptr) {
+      void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
+      void *realAddr = *cubbyHole;
+      FREE(realAddr);
+   }
 #endif /* defined(HAVE_POSIX_MEMALIGN) */
 }
 
index 45ce257b5e5102154e2007ea8643c9ea874c8acb..151a480d34d084f65a5dd3074ac6cf054a1d8dcf 100644 (file)
@@ -24,7 +24,7 @@
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 #include "util/u_memory.h"
 #include "util/u_mm.h"
index fe81a685be114b5be1dade934b92e459f98582ed..74259d453b119c22ca8b2adae8594e23a60dae93 100644 (file)
@@ -169,46 +169,35 @@ util_surface_copy(struct pipe_context *pipe,
                   unsigned w, unsigned h)
 {
    struct pipe_screen *screen = pipe->screen;
-   struct pipe_surface *new_src = NULL, *new_dst = NULL;
+   struct pipe_transfer *src_trans, *dst_trans;
    void *dst_map;
    const void *src_map;
 
-   assert(dst->block.size == src->block.size);
-   assert(dst->block.width == src->block.width);
-   assert(dst->block.height == src->block.height);
-
-   if ((src->usage & PIPE_BUFFER_USAGE_CPU_READ) == 0) {
-      /* Need to create new src surface which is CPU readable */
-      assert(src->texture);
-      if (!src->texture)
-         return;
-      new_src = screen->get_tex_surface(screen,
+   assert(src->texture && dst->texture);
+   if (!src->texture || !dst->texture)
+      return;
+   src_trans = screen->get_tex_transfer(screen,
                                         src->texture,
                                         src->face,
                                         src->level,
                                         src->zslice,
-                                        PIPE_BUFFER_USAGE_CPU_READ);
-      src = new_src;
-   }
+                                        PIPE_TRANSFER_READ,
+                                        src_x, src_y, w, h);
 
-   if ((dst->usage & PIPE_BUFFER_USAGE_CPU_WRITE) == 0) {
-      /* Need to create new dst surface which is CPU writable */
-      assert(dst->texture);
-      if (!dst->texture)
-         return;
-      new_dst = screen->get_tex_surface(screen,
+   dst_trans = screen->get_tex_transfer(screen,
                                         dst->texture,
                                         dst->face,
                                         dst->level,
                                         dst->zslice,
-                                        PIPE_BUFFER_USAGE_CPU_WRITE);
-      dst = new_dst;
-   }
+                                        PIPE_TRANSFER_WRITE,
+                                        dst_x, dst_y, w, h);
 
-   src_map = pipe->screen->surface_map(screen,
-                                       src, PIPE_BUFFER_USAGE_CPU_READ);
-   dst_map = pipe->screen->surface_map(screen,
-                                       dst, PIPE_BUFFER_USAGE_CPU_WRITE);
+   assert(dst_trans->block.size == src_trans->block.size);
+   assert(dst_trans->block.width == src_trans->block.width);
+   assert(dst_trans->block.height == src_trans->block.height);
+
+   src_map = pipe->screen->transfer_map(screen, src_trans);
+   dst_map = pipe->screen->transfer_map(screen, dst_trans);
 
    assert(src_map);
    assert(dst_map);
@@ -216,36 +205,25 @@ util_surface_copy(struct pipe_context *pipe,
    if (src_map && dst_map) {
       /* If do_flip, invert src_y position and pass negative src stride */
       pipe_copy_rect(dst_map,
-                     &dst->block,
-                     dst->stride,
-                     dst_x, dst_y,
+                     &dst_trans->block,
+                     dst_trans->stride,
+                     0, 0,
                      w, h,
                      src_map,
-                     do_flip ? -(int) src->stride : src->stride,
-                     src_x,
-                     do_flip ? src_y + h - 1 : src_y);
+                     do_flip ? -(int) src_trans->stride : src_trans->stride,
+                     0,
+                     do_flip ? h - 1 : 0);
    }
 
-   pipe->screen->surface_unmap(pipe->screen, src);
-   pipe->screen->surface_unmap(pipe->screen, dst);
+   pipe->screen->transfer_unmap(pipe->screen, src_trans);
+   pipe->screen->transfer_unmap(pipe->screen, dst_trans);
 
-   if (new_src)
-      screen->tex_surface_release(screen, &new_src);
-   if (new_dst)
-      screen->tex_surface_release(screen, &new_dst);
+   screen->tex_transfer_destroy(src_trans);
+   screen->tex_transfer_destroy(dst_trans);
 }
 
 
 
-static void *
-get_pointer(struct pipe_surface *dst, void *dst_map, unsigned x, unsigned y)
-{
-   return (char *)dst_map
-      + y / dst->block.height * dst->stride
-      + x / dst->block.width * dst->block.size;
-}
-
-
 #define UBYTE_TO_USHORT(B) ((B) | ((B) << 8))
 
 
@@ -260,42 +238,38 @@ util_surface_fill(struct pipe_context *pipe,
                   unsigned width, unsigned height, unsigned value)
 {
    struct pipe_screen *screen = pipe->screen;
-   struct pipe_surface *new_dst = NULL;
+   struct pipe_transfer *dst_trans;
    void *dst_map;
 
-   if ((dst->usage & PIPE_BUFFER_USAGE_CPU_WRITE) == 0) {
-      /* Need to create new dst surface which is CPU writable */
-      assert(dst->texture);
-      if (!dst->texture)
-         return;
-      new_dst = screen->get_tex_surface(screen,
+   assert(dst->texture);
+   if (!dst->texture)
+      return;
+   dst_trans = screen->get_tex_transfer(screen,
                                         dst->texture,
                                         dst->face,
                                         dst->level,
                                         dst->zslice,
-                                        PIPE_BUFFER_USAGE_CPU_WRITE);
-      dst = new_dst;
-   }
+                                        PIPE_TRANSFER_WRITE,
+                                        dstx, dsty, width, height);
 
-   dst_map = pipe->screen->surface_map(screen,
-                                       dst, PIPE_BUFFER_USAGE_CPU_WRITE);
+   dst_map = pipe->screen->transfer_map(screen, dst_trans);
 
    assert(dst_map);
 
    if (dst_map) {
-      assert(dst->stride > 0);
+      assert(dst_trans->stride > 0);
 
-      switch (dst->block.size) {
+      switch (dst_trans->block.size) {
       case 1:
       case 2:
       case 4:
-         pipe_fill_rect(dst_map, &dst->block, dst->stride,
-                        dstx, dsty, width, height, value);
+         pipe_fill_rect(dst_map, &dst_trans->block, dst_trans->stride,
+                        0, 0, width, height, value);
          break;
       case 8:
          {
             /* expand the 4-byte clear value to an 8-byte value */
-            ushort *row = (ushort *) get_pointer(dst, dst_map, dstx, dsty);
+            ushort *row = (ushort *) dst_map;
             ushort val0 = UBYTE_TO_USHORT((value >>  0) & 0xff);
             ushort val1 = UBYTE_TO_USHORT((value >>  8) & 0xff);
             ushort val2 = UBYTE_TO_USHORT((value >> 16) & 0xff);
@@ -312,7 +286,7 @@ util_surface_fill(struct pipe_context *pipe,
                   row[j*4+2] = val2;
                   row[j*4+3] = val3;
                }
-               row += dst->stride/2;
+               row += dst_trans->stride/2;
             }
          }
          break;
@@ -322,8 +296,6 @@ util_surface_fill(struct pipe_context *pipe,
       }
    }
 
-   pipe->screen->surface_unmap(pipe->screen, dst);
-
-   if (new_dst)
-      screen->tex_surface_release(screen, &new_dst);
+   pipe->screen->transfer_unmap(pipe->screen, dst_trans);
+   screen->tex_transfer_destroy(dst_trans);
 }
index 089bbbc48a812014be20e3fca2f3114e233fb248..8114b53cd0d3992976fa1a64f13851132e278a4f 100644 (file)
@@ -28,6 +28,7 @@
 #include "u_simple_screen.h"
 
 #include "pipe/p_screen.h"
+#include "pipe/p_state.h"
 #include "pipe/internal/p_winsys_screen.h"
 
 
@@ -37,8 +38,12 @@ pass_buffer_create(struct pipe_screen *screen,
                    unsigned usage,
                    unsigned size)
 {
-   return screen->winsys->buffer_create(screen->winsys,
-                                        alignment, usage, size);
+   struct pipe_buffer *buffer =
+      screen->winsys->buffer_create(screen->winsys, alignment, usage, size);
+
+   buffer->screen = screen;
+
+   return buffer;
 }
 
 static struct pipe_buffer *
@@ -46,8 +51,13 @@ pass_user_buffer_create(struct pipe_screen *screen,
                         void *ptr,
                         unsigned bytes)
 {
-   return screen->winsys->user_buffer_create(screen->winsys,
+   struct pipe_buffer *buffer =
+      screen->winsys->user_buffer_create(screen->winsys,
                                              ptr, bytes);
+
+   buffer->screen = screen;
+
+   return buffer;
 }
 
 static struct pipe_buffer *
@@ -57,9 +67,14 @@ pass_surface_buffer_create(struct pipe_screen *screen,
                            unsigned usage,
                            unsigned *stride)
 {
-   return screen->winsys->surface_buffer_create(screen->winsys,
+   struct pipe_buffer *buffer =
+      screen->winsys->surface_buffer_create(screen->winsys,
                                                 width, height,
                                                 format, usage, stride);
+
+   buffer->screen = screen;
+
+   return buffer;
 }
 
 static void *
@@ -79,10 +94,9 @@ pass_buffer_unmap(struct pipe_screen *screen,
 }
 
 static void
-pass_buffer_destroy(struct pipe_screen *screen,
-                    struct pipe_buffer *buf)
+pass_buffer_destroy(struct pipe_buffer *buf)
 {
-   screen->winsys->buffer_destroy(screen->winsys, buf);
+   buf->screen->winsys->buffer_destroy(buf);
 }
 
 
index 706155e99a7905ba605f2a6e8fdb10771385d9a5..e519c354d257de372b2794bb26e26d7798a913ea 100644 (file)
@@ -34,9 +34,8 @@
 
 
 #include "pipe/p_context.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_shader_tokens.h"
 
@@ -56,12 +55,11 @@ void *
 util_make_vertex_passthrough_shader(struct pipe_context *pipe,
                                     uint num_attribs,
                                     const uint *semantic_names,
-                                    const uint *semantic_indexes,
-                                    struct pipe_shader_state *shader)
+                                    const uint *semantic_indexes)
                                     
 {
-   uint maxTokens = 100;
-   struct tgsi_token *tokens;
+   struct pipe_shader_state shader;
+   struct tgsi_token tokens[100];
    struct tgsi_header *header;
    struct tgsi_processor *processor;
    struct tgsi_full_declaration decl;
@@ -69,8 +67,6 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe,
    const uint procType = TGSI_PROCESSOR_VERTEX;
    uint ti, i;
 
-   tokens = (struct tgsi_token *) MALLOC(maxTokens * sizeof(tokens[0]));
-
    /* shader header
     */
    *(struct tgsi_version *) &tokens[0] = tgsi_build_version();
@@ -97,7 +93,7 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe,
       ti += tgsi_build_full_declaration(&decl,
                                         &tokens[ti],
                                         header,
-                                        maxTokens - ti);
+                                        Elements(tokens) - ti);
    }
 
    /* declare outputs */
@@ -112,7 +108,7 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe,
       ti += tgsi_build_full_declaration(&decl,
                                         &tokens[ti],
                                         header,
-                                        maxTokens - ti);
+                                        Elements(tokens) - ti);
    }
 
    /* emit MOV instructions */
@@ -129,7 +125,7 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe,
       ti += tgsi_build_full_instruction(&inst,
                                         &tokens[ti],
                                         header,
-                                        maxTokens - ti );
+                                        Elements(tokens) - ti );
    }
 
    /* END instruction */
@@ -140,16 +136,15 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe,
    ti += tgsi_build_full_instruction(&inst,
                                      &tokens[ti],
                                      header,
-                                     maxTokens - ti );
+                                     Elements(tokens) - ti );
 
 #if 0 /*debug*/
    tgsi_dump(tokens, 0);
 #endif
 
-   shader->tokens = tokens;
-   /*shader->num_tokens = ti;*/
+   shader.tokens = tokens;
 
-   return pipe->create_vs_state(pipe, shader);
+   return pipe->create_vs_state(pipe, &shader);
 }
 
 
@@ -161,11 +156,10 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe,
  *  END;
  */
 void *
-util_make_fragment_tex_shader(struct pipe_context *pipe,
-                              struct pipe_shader_state *shader)
+util_make_fragment_tex_shader(struct pipe_context *pipe)
 {
-   uint maxTokens = 100;
-   struct tgsi_token *tokens;
+   struct pipe_shader_state shader;
+   struct tgsi_token tokens[100];
    struct tgsi_header *header;
    struct tgsi_processor *processor;
    struct tgsi_full_declaration decl;
@@ -173,8 +167,6 @@ util_make_fragment_tex_shader(struct pipe_context *pipe,
    const uint procType = TGSI_PROCESSOR_FRAGMENT;
    uint ti;
 
-   tokens = (struct tgsi_token *) MALLOC(maxTokens * sizeof(tokens[0]));
-
    /* shader header
     */
    *(struct tgsi_version *) &tokens[0] = tgsi_build_version();
@@ -200,7 +192,7 @@ util_make_fragment_tex_shader(struct pipe_context *pipe,
    ti += tgsi_build_full_declaration(&decl,
                                      &tokens[ti],
                                      header,
-                                     maxTokens - ti);
+                                     Elements(tokens) - ti);
 
    /* declare color[0] output */
    decl = tgsi_default_full_declaration();
@@ -213,7 +205,7 @@ util_make_fragment_tex_shader(struct pipe_context *pipe,
    ti += tgsi_build_full_declaration(&decl,
                                      &tokens[ti],
                                      header,
-                                     maxTokens - ti);
+                                     Elements(tokens) - ti);
 
    /* declare sampler */
    decl = tgsi_default_full_declaration();
@@ -223,7 +215,7 @@ util_make_fragment_tex_shader(struct pipe_context *pipe,
    ti += tgsi_build_full_declaration(&decl,
                                      &tokens[ti],
                                      header,
-                                     maxTokens - ti);
+                                     Elements(tokens) - ti);
 
    /* TEX instruction */
    inst = tgsi_default_full_instruction();
@@ -240,7 +232,7 @@ util_make_fragment_tex_shader(struct pipe_context *pipe,
    ti += tgsi_build_full_instruction(&inst,
                                      &tokens[ti],
                                      header,
-                                     maxTokens - ti );
+                                     Elements(tokens) - ti );
 
    /* END instruction */
    inst = tgsi_default_full_instruction();
@@ -250,16 +242,15 @@ util_make_fragment_tex_shader(struct pipe_context *pipe,
    ti += tgsi_build_full_instruction(&inst,
                                      &tokens[ti],
                                      header,
-                                     maxTokens - ti );
+                                     Elements(tokens) - ti );
 
 #if 0 /*debug*/
    tgsi_dump(tokens, 0);
 #endif
 
-   shader->tokens = tokens;
-   /*shader->num_tokens = ti;*/
+   shader.tokens = tokens;
 
-   return pipe->create_fs_state(pipe, shader);
+   return pipe->create_fs_state(pipe, &shader);
 }
 
 
@@ -270,11 +261,10 @@ util_make_fragment_tex_shader(struct pipe_context *pipe,
  * Make simple fragment color pass-through shader.
  */
 void *
-util_make_fragment_passthrough_shader(struct pipe_context *pipe,
-                                      struct pipe_shader_state *shader)
+util_make_fragment_passthrough_shader(struct pipe_context *pipe)
 {
-   uint maxTokens = 40;
-   struct tgsi_token *tokens;
+   struct pipe_shader_state shader;
+   struct tgsi_token tokens[40];
    struct tgsi_header *header;
    struct tgsi_processor *processor;
    struct tgsi_full_declaration decl;
@@ -282,8 +272,6 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe,
    const uint procType = TGSI_PROCESSOR_FRAGMENT;
    uint ti;
 
-   tokens = (struct tgsi_token *) MALLOC(maxTokens * sizeof(tokens[0]));
-
    /* shader header
     */
    *(struct tgsi_version *) &tokens[0] = tgsi_build_version();
@@ -307,7 +295,7 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe,
    ti += tgsi_build_full_declaration(&decl,
                                      &tokens[ti],
                                      header,
-                                     maxTokens - ti);
+                                     Elements(tokens) - ti);
 
    /* declare output */
    decl = tgsi_default_full_declaration();
@@ -320,7 +308,7 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe,
    ti += tgsi_build_full_declaration(&decl,
                                      &tokens[ti],
                                      header,
-                                     maxTokens - ti);
+                                     Elements(tokens) - ti);
 
 
    /* MOVE out[0], in[0]; */
@@ -335,7 +323,7 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe,
    ti += tgsi_build_full_instruction(&inst,
                                      &tokens[ti],
                                      header,
-                                     maxTokens - ti );
+                                     Elements(tokens) - ti );
 
    /* END instruction */
    inst = tgsi_default_full_instruction();
@@ -345,17 +333,17 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe,
    ti += tgsi_build_full_instruction(&inst,
                                      &tokens[ti],
                                      header,
-                                     maxTokens - ti );
+                                     Elements(tokens) - ti );
 
-   assert(ti < maxTokens);
+   assert(ti < Elements(tokens));
 
 #if 0 /*debug*/
    tgsi_dump(tokens, 0);
 #endif
 
-   shader->tokens = tokens;
-   /*shader->num_tokens = ti;*/
+   shader.tokens = tokens;
 
-   return pipe->create_fs_state(pipe, shader);
+   return pipe->create_fs_state(pipe, &shader);
 }
 
+
index 8ca4977d71565f80cf587b2129e25a7cab19f1dc..6f8d96af9bcbf17526ce8032b20f915e373f64b8 100644 (file)
@@ -46,18 +46,15 @@ extern void *
 util_make_vertex_passthrough_shader(struct pipe_context *pipe,
                                     uint num_attribs,
                                     const uint *semantic_names,
-                                    const uint *semantic_indexes,
-                                    struct pipe_shader_state *shader);
+                                    const uint *semantic_indexes);
 
 
 extern void *
-util_make_fragment_tex_shader(struct pipe_context *pipe,
-                              struct pipe_shader_state *shader);
+util_make_fragment_tex_shader(struct pipe_context *pipe);
 
 
 extern void *
-util_make_fragment_passthrough_shader(struct pipe_context *pipe,
-                                      struct pipe_shader_state *shader);
+util_make_fragment_passthrough_shader(struct pipe_context *pipe);
 
 
 #ifdef __cplusplus
index ca80bef0f3d228c13dc26d49e511fc279c2b6e19..0ead45a7491aaa16ea34f207a300852ee98a495e 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "pipe/p_config.h"
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)
 
 #include <stdio.h>
 
index 32f6b072a00d5876985e785493cdc466e3ef1500..d31ca9c029e257dd668c4a904bdfad3efb1661bb 100644 (file)
@@ -28,7 +28,6 @@
 /**
  * RGBA/float tile get/put functions.
  * Usable both by drivers and state trackers.
- * Surfaces should already be in a mapped state.
  */
 
 
 
 
 /**
- * Move raw block of pixels from surface to user memory.
- * This should be usable by any hw driver that has mappable surfaces.
+ * Move raw block of pixels from transfer object to user memory.
  */
 void
-pipe_get_tile_raw(struct pipe_surface *ps,
+pipe_get_tile_raw(struct pipe_transfer *pt,
                   uint x, uint y, uint w, uint h,
                   void *dst, int dst_stride)
 {
+   struct pipe_screen *screen = pt->texture->screen;
    const void *src;
 
    if (dst_stride == 0)
-      dst_stride = pf_get_nblocksx(&ps->block, w) * ps->block.size;
+      dst_stride = pf_get_nblocksx(&pt->block, w) * pt->block.size;
 
-   if (pipe_clip_tile(x, y, &w, &h, ps))
+   if (pipe_clip_tile(x, y, &w, &h, pt))
       return;
 
-   src = pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_READ);
+   src = screen->transfer_map(screen, pt);
    assert(src);
    if(!src)
       return;
 
-   pipe_copy_rect(dst, &ps->block, dst_stride, 0, 0, w, h, src, ps->stride, x, y);
+   pipe_copy_rect(dst, &pt->block, dst_stride, 0, 0, w, h, src, pt->stride, x, y);
 
-   pipe_surface_unmap(ps);
+   screen->transfer_unmap(screen, pt);
 }
 
 
 /**
- * Move raw block of pixels from user memory to surface.
- * This should be usable by any hw driver that has mappable surfaces.
+ * Move raw block of pixels from user memory to transfer object.
  */
 void
-pipe_put_tile_raw(struct pipe_surface *ps,
+pipe_put_tile_raw(struct pipe_transfer *pt,
                   uint x, uint y, uint w, uint h,
                   const void *src, int src_stride)
 {
+   struct pipe_screen *screen = pt->texture->screen;
    void *dst;
 
    if (src_stride == 0)
-      src_stride = pf_get_nblocksx(&ps->block, w) * ps->block.size;
+      src_stride = pf_get_nblocksx(&pt->block, w) * pt->block.size;
 
-   if (pipe_clip_tile(x, y, &w, &h, ps))
+   if (pipe_clip_tile(x, y, &w, &h, pt))
       return;
 
-   dst = pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_WRITE);
+   dst = screen->transfer_map(screen, pt);
    assert(dst);
    if(!dst)
       return;
 
-   pipe_copy_rect(dst, &ps->block, ps->stride, x, y, w, h, src, src_stride, 0, 0);
+   pipe_copy_rect(dst, &pt->block, pt->stride, x, y, w, h, src, src_stride, 0, 0);
 
-   pipe_surface_unmap(ps);
+   screen->transfer_unmap(screen, pt);
 }
 
 
@@ -883,6 +882,27 @@ ycbcr_get_tile_rgba(const ushort *src,
 }
 
 
+static void
+fake_get_tile_rgba(const ushort *src,
+                   unsigned w, unsigned h,
+                   float *p,
+                   unsigned dst_stride)
+{
+   unsigned i, j;
+
+   for (i = 0; i < h; i++) {
+      float *pRow = p;
+      for (j = 0; j < w; j++, pRow += 4) {
+         pRow[0] =
+         pRow[1] =
+         pRow[2] =
+         pRow[3] = (i ^ j) & 1 ? 1.0f : 0.0f;
+      }
+      p += dst_stride;
+   }
+}
+
+
 void
 pipe_tile_raw_to_rgba(enum pipe_format format,
                       void *src,
@@ -949,55 +969,56 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
       ycbcr_get_tile_rgba((ushort *) src, w, h, dst, dst_stride, TRUE);
       break;
    default:
-      assert(0);
+      debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(format));
+      fake_get_tile_rgba(src, w, h, dst, dst_stride);
    }
 }
 
 
 void
-pipe_get_tile_rgba(struct pipe_surface *ps,
+pipe_get_tile_rgba(struct pipe_transfer *pt,
                    uint x, uint y, uint w, uint h,
                    float *p)
 {
    unsigned dst_stride = w * 4;
    void *packed;
 
-   if (pipe_clip_tile(x, y, &w, &h, ps))
+   if (pipe_clip_tile(x, y, &w, &h, pt))
       return;
 
-   packed = MALLOC(pf_get_nblocks(&ps->block, w, h) * ps->block.size);
+   packed = MALLOC(pf_get_nblocks(&pt->block, w, h) * pt->block.size);
 
    if (!packed)
       return;
 
-   if(ps->format == PIPE_FORMAT_YCBCR || ps->format == PIPE_FORMAT_YCBCR_REV)
+   if(pt->format == PIPE_FORMAT_YCBCR || pt->format == PIPE_FORMAT_YCBCR_REV)
       assert((x & 1) == 0);
 
-   pipe_get_tile_raw(ps, x, y, w, h, packed, 0);
+   pipe_get_tile_raw(pt, x, y, w, h, packed, 0);
 
-   pipe_tile_raw_to_rgba(ps->format, packed, w, h, p, dst_stride);
+   pipe_tile_raw_to_rgba(pt->format, packed, w, h, p, dst_stride);
 
    FREE(packed);
 }
 
 
 void
-pipe_put_tile_rgba(struct pipe_surface *ps,
+pipe_put_tile_rgba(struct pipe_transfer *pt,
                    uint x, uint y, uint w, uint h,
                    const float *p)
 {
    unsigned src_stride = w * 4;
    void *packed;
 
-   if (pipe_clip_tile(x, y, &w, &h, ps))
+   if (pipe_clip_tile(x, y, &w, &h, pt))
       return;
 
-   packed = MALLOC(pf_get_nblocks(&ps->block, w, h) * ps->block.size);
+   packed = MALLOC(pf_get_nblocks(&pt->block, w, h) * pt->block.size);
 
    if (!packed)
       return;
 
-   switch (ps->format) {
+   switch (pt->format) {
    case PIPE_FORMAT_A8R8G8B8_UNORM:
       a8r8g8b8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
       break;
@@ -1051,10 +1072,10 @@ pipe_put_tile_rgba(struct pipe_surface *ps,
       /*z24s8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
       break;
    default:
-      assert(0);
+      debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(pt->format));
    }
 
-   pipe_put_tile_raw(ps, x, y, w, h, packed, 0);
+   pipe_put_tile_raw(pt, x, y, w, h, packed, 0);
 
    FREE(packed);
 }
@@ -1064,62 +1085,63 @@ pipe_put_tile_rgba(struct pipe_surface *ps,
  * Get a block of Z values, converted to 32-bit range.
  */
 void
-pipe_get_tile_z(struct pipe_surface *ps,
+pipe_get_tile_z(struct pipe_transfer *pt,
                 uint x, uint y, uint w, uint h,
                 uint *z)
 {
+   struct pipe_screen *screen = pt->texture->screen;
    const uint dstStride = w;
    ubyte *map;
    uint *pDest = z;
    uint i, j;
 
-   if (pipe_clip_tile(x, y, &w, &h, ps))
+   if (pipe_clip_tile(x, y, &w, &h, pt))
       return;
 
-   map = (ubyte *)pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_READ);
+   map = (ubyte *)screen->transfer_map(screen, pt);
    if (!map) {
       assert(0);
       return;
    }
 
-   switch (ps->format) {
+   switch (pt->format) {
    case PIPE_FORMAT_Z32_UNORM:
       {
-         const uint *pSrc
-            = (const uint *)(map  + y * ps->stride + x*4);
+         const uint *ptrc
+            = (const uint *)(map  + y * pt->stride + x*4);
          for (i = 0; i < h; i++) {
-            memcpy(pDest, pSrc, 4 * w);
+            memcpy(pDest, ptrc, 4 * w);
             pDest += dstStride;
-            pSrc += ps->stride/4;
+            ptrc += pt->stride/4;
          }
       }
       break;
    case PIPE_FORMAT_S8Z24_UNORM:
    case PIPE_FORMAT_X8Z24_UNORM:
       {
-         const uint *pSrc
-            = (const uint *)(map + y * ps->stride + x*4);
+         const uint *ptrc
+            = (const uint *)(map + y * pt->stride + x*4);
          for (i = 0; i < h; i++) {
             for (j = 0; j < w; j++) {
                /* convert 24-bit Z to 32-bit Z */
-               pDest[j] = (pSrc[j] << 8) | (pSrc[j] & 0xff);
+               pDest[j] = (ptrc[j] << 8) | (ptrc[j] & 0xff);
             }
             pDest += dstStride;
-            pSrc += ps->stride/4;
+            ptrc += pt->stride/4;
          }
       }
       break;
    case PIPE_FORMAT_Z16_UNORM:
       {
-         const ushort *pSrc
-            = (const ushort *)(map + y * ps->stride + x*2);
+         const ushort *ptrc
+            = (const ushort *)(map + y * pt->stride + x*2);
          for (i = 0; i < h; i++) {
             for (j = 0; j < w; j++) {
                /* convert 16-bit Z to 32-bit Z */
-               pDest[j] = (pSrc[j] << 16) | pSrc[j];
+               pDest[j] = (ptrc[j] << 16) | ptrc[j];
             }
             pDest += dstStride;
-            pSrc += ps->stride/2;
+            ptrc += pt->stride/2;
          }
       }
       break;
@@ -1127,64 +1149,65 @@ pipe_get_tile_z(struct pipe_surface *ps,
       assert(0);
    }
 
-   pipe_surface_unmap(ps);
+   screen->transfer_unmap(screen, pt);
 }
 
 
 void
-pipe_put_tile_z(struct pipe_surface *ps,
+pipe_put_tile_z(struct pipe_transfer *pt,
                 uint x, uint y, uint w, uint h,
                 const uint *zSrc)
 {
+   struct pipe_screen *screen = pt->texture->screen;
    const uint srcStride = w;
-   const uint *pSrc = zSrc;
+   const uint *ptrc = zSrc;
    ubyte *map;
    uint i, j;
 
-   if (pipe_clip_tile(x, y, &w, &h, ps))
+   if (pipe_clip_tile(x, y, &w, &h, pt))
       return;
 
-   map = (ubyte *)pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_WRITE);
+   map = (ubyte *)screen->transfer_map(screen, pt);
    if (!map) {
       assert(0);
       return;
    }
 
-   switch (ps->format) {
+   switch (pt->format) {
    case PIPE_FORMAT_Z32_UNORM:
       {
-         uint *pDest = (uint *) (map + y * ps->stride + x*4);
+         uint *pDest = (uint *) (map + y * pt->stride + x*4);
          for (i = 0; i < h; i++) {
-            memcpy(pDest, pSrc, 4 * w);
-            pDest += ps->stride/4;
-            pSrc += srcStride;
+            memcpy(pDest, ptrc, 4 * w);
+            pDest += pt->stride/4;
+            ptrc += srcStride;
          }
       }
       break;
    case PIPE_FORMAT_S8Z24_UNORM:
    case PIPE_FORMAT_X8Z24_UNORM:
       {
-         uint *pDest = (uint *) (map + y * ps->stride + x*4);
+         uint *pDest = (uint *) (map + y * pt->stride + x*4);
          for (i = 0; i < h; i++) {
             for (j = 0; j < w; j++) {
                /* convert 32-bit Z to 24-bit Z (0 stencil) */
-               pDest[j] = pSrc[j] >> 8;
+               pDest[j] = ptrc[j] >> 8;
             }
-            pDest += ps->stride/4;
-            pSrc += srcStride;
+            pDest += pt->stride/4;
+            ptrc += srcStride;
          }
       }
       break;
    case PIPE_FORMAT_Z16_UNORM:
       {
-         ushort *pDest = (ushort *) (map + y * ps->stride + x*2);
+         ushort *pDest = (ushort *) (map + y * pt->stride + x*2);
          for (i = 0; i < h; i++) {
             for (j = 0; j < w; j++) {
                /* convert 32-bit Z to 16-bit Z */
-               pDest[j] = pSrc[j] >> 16;
+               pDest[j] = ptrc[j] >> 16;
             }
-            pDest += ps->stride/2;
-            pSrc += srcStride;
+            pDest += pt->stride/2;
+            ptrc += srcStride;
          }
       }
       break;
@@ -1192,7 +1215,7 @@ pipe_put_tile_z(struct pipe_surface *ps,
       assert(0);
    }
 
-   pipe_surface_unmap(ps);
+   screen->transfer_unmap(screen, pt);
 }
 
 
index a8ac80530836930b860bb61d0471eb29bac8ee1e..1453af38b8a2aefc977927c1d3d92fe97d06d6c2 100644 (file)
 
 #include "pipe/p_compiler.h"
 
-struct pipe_surface;
+struct pipe_transfer;
 
 
 /**
- * Clip tile against surface dims.
+ * Clip tile against transfer dims.
  * \return TRUE if tile is totally clipped, FALSE otherwise
  */
 static INLINE boolean
-pipe_clip_tile(uint x, uint y, uint *w, uint *h, const struct pipe_surface *ps)
+pipe_clip_tile(uint x, uint y, uint *w, uint *h, const struct pipe_transfer *pt)
 {
-   if (x >= ps->width)
+   if (x >= pt->width)
       return TRUE;
-   if (y >= ps->height)
+   if (y >= pt->height)
       return TRUE;
-   if (x + *w > ps->width)
-      *w = ps->width - x;
-   if (y + *h > ps->height)
-      *h = ps->height - y;
+   if (x + *w > pt->width)
+      *w = pt->width - x;
+   if (y + *h > pt->height)
+      *h = pt->height - y;
    return FALSE;
 }
 
@@ -56,34 +56,34 @@ extern "C" {
 #endif
 
 void
-pipe_get_tile_raw(struct pipe_surface *ps,
+pipe_get_tile_raw(struct pipe_transfer *pt,
                   uint x, uint y, uint w, uint h,
                   void *p, int dst_stride);
 
 void
-pipe_put_tile_raw(struct pipe_surface *ps,
+pipe_put_tile_raw(struct pipe_transfer *pt,
                   uint x, uint y, uint w, uint h,
                   const void *p, int src_stride);
 
 
 void
-pipe_get_tile_rgba(struct pipe_surface *ps,
+pipe_get_tile_rgba(struct pipe_transfer *pt,
                    uint x, uint y, uint w, uint h,
                    float *p);
 
 void
-pipe_put_tile_rgba(struct pipe_surface *ps,
+pipe_put_tile_rgba(struct pipe_transfer *pt,
                    uint x, uint y, uint w, uint h,
                    const float *p);
 
 
 void
-pipe_get_tile_z(struct pipe_surface *ps,
+pipe_get_tile_z(struct pipe_transfer *pt,
                 uint x, uint y, uint w, uint h,
                 uint *z);
 
 void
-pipe_put_tile_z(struct pipe_surface *ps,
+pipe_put_tile_z(struct pipe_transfer *pt,
                 uint x, uint y, uint w, uint h,
                 const uint *z);
 
index dde2c74fa83ca8f0be4874eeac2129a3170d5ea6..357d9360c907458d8b18921c8e761b13ed84f593 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "pipe/p_config.h"
 
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
 #include <sys/time.h>
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
 #include <windows.h>
@@ -77,7 +77,7 @@ util_time_get_frequency(void)
 void 
 util_time_get(struct util_time *t)
 {
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
    gettimeofday(&t->tv, NULL);
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
    LONGLONG temp;
@@ -102,7 +102,7 @@ util_time_add(const struct util_time *t1,
               int64_t usecs,
               struct util_time *t2)
 {
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
    t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000;
    t2->tv.tv_usec = t1->tv.tv_usec + usecs % 1000000;
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
@@ -124,7 +124,7 @@ int64_t
 util_time_diff(const struct util_time *t1, 
                const struct util_time *t2)
 {
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
    return (t2->tv.tv_usec - t1->tv.tv_usec) + 
           (t2->tv.tv_sec - t1->tv.tv_sec)*1000000;
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
@@ -144,7 +144,7 @@ util_time_micros( void )
    
    util_time_get(&t1);
    
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
    return t1.tv.tv_usec + t1.tv.tv_sec*1000000LL;
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
    util_time_get_frequency();
@@ -166,7 +166,7 @@ static INLINE int
 util_time_compare(const struct util_time *t1, 
                   const struct util_time *t2)
 {
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
    if (t1->tv.tv_sec < t2->tv.tv_sec)
       return -1;
    else if(t1->tv.tv_sec > t2->tv.tv_sec)
index 35d97d16c739758674fd3f18eeb0224e5a8fecb4..4346ce1fa452cfa285268a1d7ba8b87b6b592d67 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "pipe/p_config.h"
 
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
 #include <time.h> /* timeval */
 #include <unistd.h> /* usleep */
 #endif
@@ -58,7 +58,7 @@ extern "C" {
  */
 struct util_time 
 {
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
    struct timeval tv;
 #else
    int64_t counter;
@@ -89,7 +89,7 @@ util_time_timeout(const struct util_time *start,
                   const struct util_time *end,
                   const struct util_time *curr);
 
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
 #define util_time_sleep usleep
 #else
 void
index f237e12d73502894c26a6c8b4fe8fa7ff9736ce6..77b2a3a1c875d54d42e100781a8ce9cb5a0ee837 100644 (file)
@@ -29,6 +29,7 @@
  * Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
  */
 
+#include "pipe/p_state.h"
 #include "pipe/internal/p_winsys_screen.h"
 #include "u_timed_winsys.h"
 #include "util/u_memory.h"
@@ -178,13 +179,13 @@ timed_buffer_unmap(struct pipe_winsys *winsys,
 
 
 static void
-timed_buffer_destroy(struct pipe_winsys *winsys,
-                         struct pipe_buffer *buf)
+timed_buffer_destroy(struct pipe_buffer *buf)
 {
+   struct pipe_winsys *winsys = buf->screen->winsys;
    struct pipe_winsys *backend = timed_winsys(winsys)->backend;
    uint64_t start = time_start();
 
-   backend->buffer_destroy( backend, buf );
+   backend->buffer_destroy( buf );
 
    time_finish(winsys, start, 4, __FUNCTION__);
 }
index 6161cb6ff8f459c4a32c6f8967267539c4909e18..9fe9b2c11d062d4b7f7eb0d33e443934a9f06800 100644 (file)
@@ -1,20 +1,12 @@
+# src/gallium/drivers/Makefile
 TOP = ../../..
 include $(TOP)/configs/current
 
+SUBDIRS = $(GALLIUM_DRIVERS_DIRS)
 
-SUBDIRS = $(GALLIUM_DRIVER_DIRS)
-
-
-default: subdirs
-
-
-subdirs:
+default install clean:
        @for dir in $(SUBDIRS) ; do \
                if [ -d $$dir ] ; then \
-                       (cd $$dir && $(MAKE)) || exit 1 ; \
+                       (cd $$dir && $(MAKE) $@) || exit 1; \
                fi \
        done
-
-
-clean:
-       rm -f `find . -name \*.[oa]`
index c2e276988cadf8d7927beb5c1d7c8f46a86929fc..edc06747ac1a45d2d117efef8d13054c6b65d917 100644 (file)
@@ -70,18 +70,12 @@ void
 cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps,
                    unsigned clearValue)
 {
-   struct pipe_screen *screen = pipe->screen;
    struct cell_context *cell = cell_context(pipe);
    uint surfIndex;
 
    if (cell->dirty)
       cell_update_derived(cell);
 
-
-   if (!cell->cbuf_map[0])
-      cell->cbuf_map[0] = screen->surface_map(screen, ps,
-                                              PIPE_BUFFER_USAGE_GPU_WRITE);
-
    if (ps == cell->framebuffer.zsbuf) {
       /* clear z/stencil buffer */
       surfIndex = 1;
index eb1397bb3fa2e3fbedbc1b932baa2822d07de3e0..5c3188e7f9dc1194feb8da5960bb3c9a83720c8f 100644 (file)
@@ -130,9 +130,6 @@ struct cell_context
    ubyte *cbuf_map[PIPE_MAX_COLOR_BUFS];
    ubyte *zsbuf_map;
 
-   struct pipe_surface *tex_surf;
-   uint *tex_map;
-
    uint dirty;
    uint dirty_textures;  /* bitmask of texture units */
    uint dirty_samplers;  /* bitmask of sampler units */
index 867b5dcaa094de37bd5e7abeb5145f535e181232..13125a9fa303b0b3b114b0627c86fd857fe9be55 100644 (file)
@@ -96,7 +96,7 @@ cell_add_buffer_to_list(struct cell_context *cell,
    struct cell_buffer_node *node = CALLOC_STRUCT(cell_buffer_node);
    /* create new list node which references the buffer, insert at head */
    if (node) {
-      pipe_buffer_reference(ps, &node->buffer, buffer);
+      pipe_buffer_reference(&node->buffer, buffer);
       node->next = list->head;
       list->head = node;
    }
@@ -127,10 +127,10 @@ cell_free_fenced_buffers(struct cell_context *cell,
          pipe_buffer_unmap(ps, node->buffer);
 #if 0
          printf("Unref buffer %p\n", node->buffer);
-         if (node->buffer->refcount == 1)
+         if (node->buffer->reference.count == 1)
             printf("   Delete!\n");
 #endif
-         pipe_buffer_reference(ps, &node->buffer, NULL);
+         pipe_buffer_reference(&node->buffer, NULL);
          FREE(node);
          node = next;
       }
@@ -153,16 +153,12 @@ cell_add_fenced_textures(struct cell_context *cell)
    for (i = 0; i < cell->num_textures; i++) {
       struct cell_texture *ct = cell->texture[i];
       if (ct) {
-         uint level;
-         for (level = 0; level < CELL_MAX_TEXTURE_LEVELS; level++) {
-            if (ct->tiled_buffer[level]) {
 #if 0
-               printf("Adding texture %p buffer %p to list\n",
-                      ct, ct->tiled_buffer[level]);
+         printf("Adding texture %p buffer %p to list\n",
+                ct, ct->tiled_buffer[level]);
 #endif
-               cell_add_buffer_to_list(cell, list, ct->tiled_buffer[level]);
-            }
-         }
+         if (ct->buffer)
+            cell_add_buffer_to_list(cell, list, ct->buffer);
       }
    }
 }
index ca358ed031eaa9c4f958e844c69f62a567bab3ef..ccd0fef6e84ef479702a91ad2b2cf43d849e35f8 100644 (file)
@@ -253,10 +253,13 @@ cell_set_sampler_textures(struct pipe_context *pipe,
    assert(num <= CELL_MAX_SAMPLERS);
 
    for (i = 0; i < CELL_MAX_SAMPLERS; i++) {
-      struct pipe_texture *new_tex = i < num ? texture[i] : NULL;
-      if ((struct pipe_texture *) cell->texture[i] != new_tex) {
+      struct cell_texture *new_tex = cell_texture(i < num ? texture[i] : NULL);
+      struct cell_texture *old_tex = cell->texture[i];
+      if (old_tex != new_tex) {
+
          pipe_texture_reference((struct pipe_texture **) &cell->texture[i],
-                                new_tex);
+                                (struct pipe_texture *) new_tex);
+
          changed |= (1 << i);
       }
    }
@@ -270,6 +273,70 @@ cell_set_sampler_textures(struct pipe_context *pipe,
 }
 
 
+/**
+ * Map color and z/stencil framebuffer surfaces.
+ */
+static void
+cell_map_surfaces(struct cell_context *cell)
+{
+   struct pipe_screen *screen = cell->pipe.screen;
+   uint i;
+
+   for (i = 0; i < 1; i++) {
+      struct pipe_surface *ps = cell->framebuffer.cbufs[i];
+      if (ps) {
+         struct cell_texture *ct = cell_texture(ps->texture);
+         cell->cbuf_map[i] = screen->buffer_map(screen,
+                                                ct->buffer,
+                                                (PIPE_BUFFER_USAGE_GPU_READ |
+                                                 PIPE_BUFFER_USAGE_GPU_WRITE));
+      }
+   }
+
+   {
+      struct pipe_surface *ps = cell->framebuffer.zsbuf;
+      if (ps) {
+         struct cell_texture *ct = cell_texture(ps->texture);
+         cell->zsbuf_map = screen->buffer_map(screen,
+                                              ct->buffer,
+                                              (PIPE_BUFFER_USAGE_GPU_READ |
+                                               PIPE_BUFFER_USAGE_GPU_WRITE));
+      }
+   }
+}
+
+
+/**
+ * Unmap color and z/stencil framebuffer surfaces.
+ */
+static void
+cell_unmap_surfaces(struct cell_context *cell)
+{
+   struct pipe_screen *screen = cell->pipe.screen;
+   uint i;
+
+   for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+      struct pipe_surface *ps = cell->framebuffer.cbufs[i];
+      if (ps && cell->cbuf_map[i]) {
+         struct cell_texture *ct = cell_texture(ps->texture);
+         assert(ps->texture);
+         assert(ct->buffer);
+
+         screen->buffer_unmap(screen, ct->buffer);
+         cell->cbuf_map[i] = NULL;
+      }
+   }
+
+   {
+      struct pipe_surface *ps = cell->framebuffer.zsbuf;
+      if (ps && cell->zsbuf_map) {
+         struct cell_texture *ct = cell_texture(ps->texture);
+         screen->buffer_unmap(screen, ct->buffer);
+         cell->zsbuf_map = NULL;
+      }
+   }
+}
+
 
 static void
 cell_set_framebuffer_state(struct pipe_context *pipe,
@@ -278,24 +345,10 @@ cell_set_framebuffer_state(struct pipe_context *pipe,
    struct cell_context *cell = cell_context(pipe);
 
    if (1 /*memcmp(&cell->framebuffer, fb, sizeof(*fb))*/) {
-      struct pipe_surface *csurf = fb->cbufs[0];
-      struct pipe_surface *zsurf = fb->zsbuf;
       uint i;
-      uint flags = (PIPE_BUFFER_USAGE_GPU_WRITE |
-                    PIPE_BUFFER_USAGE_GPU_READ);
 
       /* unmap old surfaces */
-      for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
-         if (cell->framebuffer.cbufs[i] && cell->cbuf_map[i]) {
-            pipe_surface_unmap(cell->framebuffer.cbufs[i]);
-            cell->cbuf_map[i] = NULL;
-         }
-      }
-
-      if (cell->framebuffer.zsbuf && cell->zsbuf_map) {
-         pipe_surface_unmap(cell->framebuffer.zsbuf);
-         cell->zsbuf_map = NULL;
-      }
+      cell_unmap_surfaces(cell);
 
       /* Finish any pending rendering to the current surface before
        * installing a new surface!
@@ -314,11 +367,7 @@ cell_set_framebuffer_state(struct pipe_context *pipe,
       pipe_surface_reference(&cell->framebuffer.zsbuf, fb->zsbuf);
 
       /* map new surfaces */
-      if (csurf)
-         cell->cbuf_map[0] = pipe_surface_map(csurf, flags);
-
-      if (zsurf)
-         cell->zsbuf_map = pipe_surface_map(zsurf, flags);
+      cell_map_surfaces(cell);
 
       cell->dirty |= CELL_NEW_FRAMEBUFFER;
    }
index ff529fe22cbda83765a165ea151f7ec8fecbadb3..9479c0898fd76c2f6a3b3a205b6d1ecde3d0f764 100644 (file)
@@ -287,19 +287,23 @@ cell_emit_state(struct cell_context *cell)
       for (i = 0;i < CELL_MAX_SAMPLERS; i++) {
          if (cell->dirty_textures & (1 << i)) {
             STATIC_ASSERT(sizeof(struct cell_command_texture) % 16 == 0);
-            struct cell_command_texture *texture
-               =  (struct cell_command_texture *)cell_batch_alloc16(cell, sizeof(*texture));
+            struct cell_command_texture *texture =
+               (struct cell_command_texture *)
+               cell_batch_alloc16(cell, sizeof(*texture));
+
             texture->opcode[0] = CELL_CMD_STATE_TEXTURE;
             texture->unit = i;
             if (cell->texture[i]) {
+               struct cell_texture *ct = cell->texture[i];
                uint level;
                for (level = 0; level < CELL_MAX_TEXTURE_LEVELS; level++) {
-                  texture->start[level] = cell->texture[i]->tiled_mapped[level];
-                  texture->width[level] = cell->texture[i]->base.width[level];
-                  texture->height[level] = cell->texture[i]->base.height[level];
-                  texture->depth[level] = cell->texture[i]->base.depth[level];
+                  texture->start[level] = (ct->mapped +
+                                           ct->level_offset[level]);
+                  texture->width[level] = ct->base.width[level];
+                  texture->height[level] = ct->base.height[level];
+                  texture->depth[level] = ct->base.depth[level];
                }
-               texture->target = cell->texture[i]->base.target;
+               texture->target = ct->base.target;
             }
             else {
                uint level;
index bf517ea563520fb41aa714a5a71d147b9d886811..6568c784fec1f0dfdc30348b2bb2199422bdf9f0 100644 (file)
@@ -193,9 +193,7 @@ cell_set_constant_buffer(struct pipe_context *pipe,
    draw_flush(cell->draw);
 
    /* note: reference counting */
-   pipe_buffer_reference(pipe->screen,
-                         &cell->constants[shader].buffer,
-                         buf->buffer);
+   pipe_buffer_reference(&cell->constants[shader].buffer, buf->buffer);
 
    if (shader == PIPE_SHADER_VERTEX)
       cell->dirty |= CELL_NEW_VS_CONSTANTS;
index c9203fee08785ee8245b625a1d717def82b8327d..ffb8595d828ed327ce12de8d001bee2e704dd863 100644 (file)
 #include "cell_surface.h"
 
 
+static void
+cell_surface_copy(struct pipe_context *pipe,
+                  struct pipe_surface *dest, unsigned destx, unsigned desty,
+                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
+                  unsigned width, unsigned height)
+{
+   util_surface_copy(pipe, FALSE,
+                     dest, destx, desty,
+                     src, srcx, srcy,
+                     width, height);
+}
+
 void
 cell_init_surface_functions(struct cell_context *cell)
 {
-   cell->pipe.surface_copy = util_surface_copy;
+   cell->pipe.surface_copy = cell_surface_copy;
    cell->pipe.surface_fill = util_surface_fill;
 }
index 9ba995ab7d36d82f04c7a78b8d4d0666d92070d1..e26594448f000e0e81a8a9237862eb4f9824ce01 100644 (file)
@@ -62,7 +62,7 @@ cell_texture_layout(struct cell_texture *ct)
 
    ct->buffer_size = 0;
 
-   for ( level = 0 ; level <= pt->last_level ; level++ ) {
+   for (level = 0; level <= pt->last_level; level++) {
       unsigned size;
       unsigned w_tile, h_tile;
 
@@ -90,7 +90,7 @@ cell_texture_layout(struct cell_texture *ct)
 
       ct->buffer_size += size;
 
-      width  = minify(width);
+      width = minify(width);
       height = minify(height);
       depth = minify(depth);
    }
@@ -101,18 +101,17 @@ static struct pipe_texture *
 cell_texture_create(struct pipe_screen *screen,
                     const struct pipe_texture *templat)
 {
-   struct pipe_winsys *ws = screen->winsys;
    struct cell_texture *ct = CALLOC_STRUCT(cell_texture);
    if (!ct)
       return NULL;
 
    ct->base = *templat;
-   ct->base.refcount = 1;
+   pipe_reference_init(&ct->base.reference, 1);
    ct->base.screen = screen;
 
    cell_texture_layout(ct);
 
-   ct->buffer = ws->buffer_create(ws, 32, PIPE_BUFFER_USAGE_PIXEL,
+   ct->buffer = screen->buffer_create(screen, 32, PIPE_BUFFER_USAGE_PIXEL,
                                    ct->buffer_size);
 
    if (!ct->buffer) {
@@ -125,42 +124,18 @@ cell_texture_create(struct pipe_screen *screen,
 
 
 static void
-cell_texture_release(struct pipe_screen *screen,
-                     struct pipe_texture **pt)
+cell_texture_destroy(struct pipe_texture *pt)
 {
-   if (!*pt)
-      return;
-
-   /*
-   DBG("%s %p refcount will be %d\n",
-       __FUNCTION__, (void *) *pt, (*pt)->refcount - 1);
-   */
-   if (--(*pt)->refcount <= 0) {
-      /* Delete this texture now.
-       * But note that the underlying pipe_buffer may linger...
-       */
-      struct cell_texture *ct = cell_texture(*pt);
-      uint i;
+   struct cell_texture *ct = cell_texture(pt);
 
-      /*
-      DBG("%s deleting %p\n", __FUNCTION__, (void *) ct);
-      */
+   if (ct->mapped) {
+      pipe_buffer_unmap(ct->buffer->screen, ct->buffer);
+      ct->mapped = NULL;
+   }
 
-      pipe_buffer_reference(screen, &ct->buffer, NULL);
+   pipe_buffer_reference(&ct->buffer, NULL);
 
-      for (i = 0; i < CELL_MAX_TEXTURE_LEVELS; i++) {
-         /* Unreference the tiled image buffer.
-          * It may not actually be deleted until a fence is hit.
-          */
-         if (ct->tiled_buffer[i]) {
-            ct->tiled_mapped[i] = NULL;
-            pipe_buffer_reference(screen, &ct->tiled_buffer[i], NULL);
-         }
-      }
-
-      FREE(ct);
-   }
-   *pt = NULL;
+   FREE(ct);
 }
 
 
@@ -294,103 +269,6 @@ untwiddle_image_uint(uint w, uint h, uint tile_size, uint *dst,
 }
 
 
-/**
- * Convert linear texture image data to tiled format for SPU usage.
- */
-static void
-cell_twiddle_texture(struct pipe_screen *screen,
-                     struct pipe_surface *surface)
-{
-   struct cell_texture *ct = cell_texture(surface->texture);
-   const uint level = surface->level;
-   const uint texWidth = ct->base.width[level];
-   const uint texHeight = ct->base.height[level];
-   const uint bufWidth = align(texWidth, TILE_SIZE);
-   const uint bufHeight = align(texHeight, TILE_SIZE);
-   const void *map = screen->surface_map(screen, surface, PIPE_BUFFER_USAGE_CPU_READ);
-   const uint *src = (const uint *) map;
-
-   switch (ct->base.format) {
-   case PIPE_FORMAT_A8R8G8B8_UNORM:
-   case PIPE_FORMAT_B8G8R8A8_UNORM:
-   case PIPE_FORMAT_S8Z24_UNORM:
-      {
-         int numFaces = ct->base.target == PIPE_TEXTURE_CUBE ? 6 : 1;
-         int offset = bufWidth * bufHeight * 4 * surface->face;
-         uint *dst;
-
-         if (!ct->tiled_buffer[level]) {
-            /* allocate buffer for tiled data now */
-            struct pipe_winsys *ws = screen->winsys;
-            uint bytes = bufWidth * bufHeight * 4 * numFaces;
-            ct->tiled_buffer[level] =
-               ws->buffer_create(ws, 16, PIPE_BUFFER_USAGE_PIXEL, bytes);
-            /* and map it */
-            ct->tiled_mapped[level] =
-               ws->buffer_map(ws, ct->tiled_buffer[level],
-                              PIPE_BUFFER_USAGE_GPU_READ);
-         }
-         dst = (uint *) ((ubyte *) ct->tiled_mapped[level] + offset);
-
-         twiddle_image_uint(texWidth, texHeight, TILE_SIZE, dst,
-                            surface->stride, src);
-      }
-      break;
-   default:
-      printf("Cell: twiddle unsupported texture format %s\n",
-             pf_name(ct->base.format));
-   }
-
-   screen->surface_unmap(screen, surface);
-}
-
-
-/**
- * Convert SPU tiled texture image data to linear format for app usage.
- */
-static void
-cell_untwiddle_texture(struct pipe_screen *screen,
-                     struct pipe_surface *surface)
-{
-   struct cell_texture *ct = cell_texture(surface->texture);
-   const uint level = surface->level;
-   const uint texWidth = ct->base.width[level];
-   const uint texHeight = ct->base.height[level];
-   const void *map = screen->surface_map(screen, surface, PIPE_BUFFER_USAGE_CPU_READ);
-   const uint *src = (const uint *) ((const ubyte *) map + surface->offset);
-
-   switch (ct->base.format) {
-   case PIPE_FORMAT_A8R8G8B8_UNORM:
-   case PIPE_FORMAT_B8G8R8A8_UNORM:
-   case PIPE_FORMAT_S8Z24_UNORM:
-      {
-         int numFaces = ct->base.target == PIPE_TEXTURE_CUBE ? 6 : 1;
-         int offset = surface->stride * texHeight * 4 * surface->face;
-         uint *dst;
-
-         if (!ct->untiled_data[level]) {
-            ct->untiled_data[level] =
-               align_malloc(surface->stride * texHeight * 4 * numFaces, 16);
-         }
-
-         dst = (uint *) ((ubyte *) ct->untiled_data[level] + offset);
-
-         untwiddle_image_uint(texWidth, texHeight, TILE_SIZE, dst,
-                              surface->stride, src);
-      }
-      break;
-   default:
-      {
-         ct->untiled_data[level] = NULL;
-         printf("Cell: untwiddle unsupported texture format %s\n",
-                pf_name(ct->base.format));
-      }
-   }
-
-   screen->surface_unmap(screen, surface);
-}
-
-
 static struct pipe_surface *
 cell_get_tex_surface(struct pipe_screen *screen,
                      struct pipe_texture *pt,
@@ -402,130 +280,223 @@ cell_get_tex_surface(struct pipe_screen *screen,
 
    ps = CALLOC_STRUCT(pipe_surface);
    if (ps) {
-      ps->refcount = 1;
+      pipe_reference_init(&ps->reference, 1);
       pipe_texture_reference(&ps->texture, pt);
       ps->format = pt->format;
-      ps->block = pt->block;
       ps->width = pt->width[level];
       ps->height = pt->height[level];
-      ps->nblocksx = pt->nblocksx[level];
-      ps->nblocksy = pt->nblocksy[level];
-      ps->stride = ct->stride[level];
       ps->offset = ct->level_offset[level];
-      ps->usage = usage;
-
       /* XXX may need to override usage flags (see sp_texture.c) */
-
-      pipe_texture_reference(&ps->texture, pt); 
+      ps->usage = usage;
       ps->face = face;
       ps->level = level;
       ps->zslice = zslice;
 
-      if (pt->target == PIPE_TEXTURE_CUBE || pt->target == PIPE_TEXTURE_3D) {
-         ps->offset += ((pt->target == PIPE_TEXTURE_CUBE) ? face : zslice) *
-            ps->nblocksy *
-            ps->stride;
+      if (pt->target == PIPE_TEXTURE_CUBE) {
+         ps->offset += face * pt->nblocksy[level] * ct->stride[level];
+      }
+      else if (pt->target == PIPE_TEXTURE_3D) {
+         ps->offset += zslice * pt->nblocksy[level] * ct->stride[level];
       }
       else {
          assert(face == 0);
          assert(zslice == 0);
       }
-
-      if (ps->usage & PIPE_BUFFER_USAGE_CPU_READ) {
-         /* convert from tiled to linear layout */
-         cell_untwiddle_texture(screen, ps);
-      }
    }
    return ps;
 }
 
 
 static void 
-cell_tex_surface_release(struct pipe_screen *screen, 
-                         struct pipe_surface **s)
+cell_tex_surface_destroy(struct pipe_surface *surf)
 {
-   struct cell_texture *ct = cell_texture((*s)->texture);
-   const uint level = (*s)->level;
-   struct pipe_surface *surf = *s;
-
-   if ((surf->usage & PIPE_BUFFER_USAGE_CPU_READ) && (ct->untiled_data[level]))
-   {
-      align_free(ct->untiled_data[level]);
-      ct->untiled_data[level] = NULL;
-   }
+   pipe_texture_reference(&surf->texture, NULL);
+   FREE(surf);
+}
 
-   if ((ct->base.tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) &&
-       (surf->usage & PIPE_BUFFER_USAGE_CPU_WRITE)) {
-      /* convert from linear to tiled layout */
-      cell_twiddle_texture(screen, surf);
+
+/**
+ * Create new pipe_transfer object.
+ * This is used by the user to put tex data into a texture (and get it
+ * back out for glGetTexImage).
+ */
+static struct pipe_transfer *
+cell_get_tex_transfer(struct pipe_screen *screen,
+                      struct pipe_texture *texture,
+                      unsigned face, unsigned level, unsigned zslice,
+                      enum pipe_transfer_usage usage,
+                      unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   struct cell_texture *ct = cell_texture(texture);
+   struct cell_transfer *ctrans;
+
+   assert(texture);
+   assert(level <= texture->last_level);
+
+   ctrans = CALLOC_STRUCT(cell_transfer);
+   if (ctrans) {
+      struct pipe_transfer *pt = &ctrans->base;
+      pipe_texture_reference(&pt->texture, texture);
+      pt->format = texture->format;
+      pt->block = texture->block;
+      pt->x = x;
+      pt->y = y;
+      pt->width = w;
+      pt->height = h;
+      pt->nblocksx = texture->nblocksx[level];
+      pt->nblocksy = texture->nblocksy[level];
+      pt->stride = ct->stride[level];
+      pt->usage = usage;
+      pt->face = face;
+      pt->level = level;
+      pt->zslice = zslice;
+
+      ctrans->offset = ct->level_offset[level];
+
+      if (texture->target == PIPE_TEXTURE_CUBE) {
+         ctrans->offset += face * pt->nblocksy * pt->stride;
+      }
+      else if (texture->target == PIPE_TEXTURE_3D) {
+         ctrans->offset += zslice * pt->nblocksy * pt->stride;
+      }
+      else {
+         assert(face == 0);
+         assert(zslice == 0);
+      }
+      return pt;
    }
+   return NULL;
+}
 
-   /* XXX if done rendering to teximage, re-tile */
 
-   if (--surf->refcount == 0) {
-      pipe_texture_reference(&surf->texture, NULL);
-      FREE(surf);
-   }
-   *s = NULL;
+static void 
+cell_tex_transfer_destroy(struct pipe_transfer *t)
+{
+   struct cell_transfer *transfer = cell_transfer(t);
+   /* Effectively do the texture_update work here - if texture images
+    * needed post-processing to put them into hardware layout, this is
+    * where it would happen.  For cell, nothing to do.
+    */
+   assert (transfer->base.texture);
+   pipe_texture_reference(&transfer->base.texture, NULL);
+   FREE(transfer);
 }
 
 
+/**
+ * Return pointer to texture image data in linear layout.
+ */
 static void *
-cell_surface_map(struct pipe_screen *screen,
-                 struct pipe_surface *surface,
-                 unsigned flags)
+cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer)
 {
-   ubyte *map;
-   struct cell_texture *ct = cell_texture(surface->texture);
-   const uint level = surface->level;
+   struct cell_transfer *ctrans = cell_transfer(transfer);
+   struct pipe_texture *pt = transfer->texture;
+   struct cell_texture *ct = cell_texture(pt);
+   const uint level = ctrans->base.level;
+   const uint texWidth = pt->width[level];
+   const uint texHeight = pt->height[level];
+   const uint stride = ct->stride[level];
+   unsigned flags = 0x0;
+   unsigned size;
 
-   assert(ct);
+   assert(transfer->texture);
 
-#if 0
-   if (flags & ~surface->usage) {
-      assert(0);
-      return NULL;
+   if (transfer->usage != PIPE_TRANSFER_READ) {
+      flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
    }
-#endif
 
-   map = pipe_buffer_map( screen, ct->buffer, flags );
-   if (map == NULL) {
-      return NULL;
+   if (transfer->usage != PIPE_TRANSFER_WRITE) {
+      flags |= PIPE_BUFFER_USAGE_CPU_READ;
+   }
+
+   if (!ct->mapped) {
+      /* map now */
+      ct->mapped = pipe_buffer_map(screen, ct->buffer, flags);
    }
-   else {
-      if ((surface->usage & PIPE_BUFFER_USAGE_CPU_READ) &&
-          (ct->untiled_data[level])) {
-         return (void *) ((ubyte *) ct->untiled_data[level] + surface->offset);
+
+   /*
+    * Create a buffer of ordinary memory for the linear texture.
+    * This is the memory that the user will read/write.
+    */
+   size = pt->nblocksx[level] * pt->nblocksy[level] * pt->block.size;
+
+   ctrans->map = align_malloc(size, 16);
+   if (!ctrans->map)
+      return NULL; /* out of memory */
+
+   if (transfer->usage & PIPE_TRANSFER_READ) {
+      /* need to untwiddle the texture to make a linear version */
+      const uint bpp = pf_get_size(ct->base.format);
+      if (bpp == 4) {
+         const uint *src = (uint *) (ct->mapped + ctrans->offset);
+         uint *dst = ctrans->map;
+         untwiddle_image_uint(texWidth, texHeight, TILE_SIZE,
+                              dst, stride, src);
       }
       else {
-         return (void *) (map + surface->offset);
+         // xxx fix
       }
    }
+
+   return ctrans->map;
 }
 
 
+/**
+ * Called when user is done reading/writing texture data.
+ * If new data was written, this is where we convert the linear data
+ * to tiled data.
+ */
 static void
-cell_surface_unmap(struct pipe_screen *screen,
-                   struct pipe_surface *surface)
+cell_transfer_unmap(struct pipe_screen *screen,
+                    struct pipe_transfer *transfer)
 {
-   struct cell_texture *ct = cell_texture(surface->texture);
+   struct cell_transfer *ctrans = cell_transfer(transfer);
+   struct pipe_texture *pt = transfer->texture;
+   struct cell_texture *ct = cell_texture(pt);
+   const uint level = ctrans->base.level;
+   const uint texWidth = pt->width[level];
+   const uint texHeight = pt->height[level];
+   const uint stride = ct->stride[level];
+
+   if (!ct->mapped) {
+      /* map now */
+      ct->mapped = pipe_buffer_map(screen, ct->buffer,
+                                   PIPE_BUFFER_USAGE_CPU_READ);
+   }
 
-   assert(ct);
+   if (transfer->usage & PIPE_TRANSFER_WRITE) {
+      /* The user wrote new texture data into the mapped buffer.
+       * We need to convert the new linear data into the twiddled/tiled format.
+       */
+      const uint bpp = pf_get_size(ct->base.format);
+      if (bpp == 4) {
+         const uint *src = ctrans->map;
+         uint *dst = (uint *) (ct->mapped + ctrans->offset);
+         twiddle_image_uint(texWidth, texHeight, TILE_SIZE, dst, stride, src);
+      }
+      else {
+         // xxx fix
+      }
+   }
 
-   pipe_buffer_unmap( screen, ct->buffer );
+   align_free(ctrans->map);
+   ctrans->map = NULL;
 }
 
 
-
 void
 cell_init_screen_texture_funcs(struct pipe_screen *screen)
 {
    screen->texture_create = cell_texture_create;
-   screen->texture_release = cell_texture_release;
+   screen->texture_destroy = cell_texture_destroy;
 
    screen->get_tex_surface = cell_get_tex_surface;
-   screen->tex_surface_release = cell_tex_surface_release;
+   screen->tex_surface_destroy = cell_tex_surface_destroy;
+
+   screen->get_tex_transfer = cell_get_tex_transfer;
+   screen->tex_transfer_destroy = cell_tex_transfer_destroy;
 
-   screen->surface_map = cell_surface_map;
-   screen->surface_unmap = cell_surface_unmap;
+   screen->transfer_map = cell_transfer_map;
+   screen->transfer_unmap = cell_transfer_unmap;
 }
index 7018b0c9bf75862d5c3bad78837e85c45fd82b56..3ffc0bfdb514392f0d3bc919046887c934afaec8 100644 (file)
@@ -43,16 +43,23 @@ struct cell_texture
    unsigned long level_offset[CELL_MAX_TEXTURE_LEVELS];
    unsigned long stride[CELL_MAX_TEXTURE_LEVELS];
 
-   /* The data is held here:
-    */
+   /** The tiled texture data is held in this buffer */
    struct pipe_buffer *buffer;
    unsigned long buffer_size;
 
-   /** Texture data in tiled layout is held here */
-   struct pipe_buffer *tiled_buffer[CELL_MAX_TEXTURE_LEVELS];
-   /** Mapped, tiled texture data */
-   void *tiled_mapped[CELL_MAX_TEXTURE_LEVELS];
-   void *untiled_data[CELL_MAX_TEXTURE_LEVELS];
+   /** The buffer above, mapped.  This is the memory from which the
+    * SPUs will fetch texels.  This texture data is in the tiled layout.
+    */
+   ubyte *mapped;
+};
+
+
+struct cell_transfer
+{
+   struct pipe_transfer base;
+
+   unsigned long offset;
+   void *map;
 };
 
 
@@ -64,6 +71,13 @@ cell_texture(struct pipe_texture *pt)
 }
 
 
+/** cast wrapper */
+static INLINE struct cell_transfer *
+cell_transfer(struct pipe_transfer *pt)
+{
+   return (struct cell_transfer *) pt;
+}
+
 
 extern void
 cell_init_screen_texture_funcs(struct pipe_screen *screen);
index ab54e796895dbc4225797cf1b70f1d5976432d6d..cfaffb52a8504359e7f734ea4f703c8d9f18ad73 100644 (file)
@@ -62,6 +62,7 @@ struct cell_vbuf_render
    uint vertex_size;     /**< in bytes */
    void *vertex_buffer;  /**< just for debug, really */
    uint vertex_buf;      /**< in [0, CELL_NUM_BUFFERS-1] */
+   uint vertex_buffer_size;  /**< size in bytes */
 };
 
 
@@ -82,24 +83,26 @@ cell_vbuf_get_vertex_info(struct vbuf_render *vbr)
 }
 
 
-static void *
+static boolean
 cell_vbuf_allocate_vertices(struct vbuf_render *vbr,
                             ushort vertex_size, ushort nr_vertices)
 {
    struct cell_vbuf_render *cvbr = cell_vbuf_render(vbr);
+   unsigned size = vertex_size * nr_vertices;
    /*printf("Alloc verts %u * %u\n", vertex_size, nr_vertices);*/
 
    assert(cvbr->vertex_buf == ~0);
    cvbr->vertex_buf = cell_get_empty_buffer(cvbr->cell);
    cvbr->vertex_buffer = cvbr->cell->buffer[cvbr->vertex_buf];
+   cvbr->vertex_buffer_size = size;
    cvbr->vertex_size = vertex_size;
-   return cvbr->vertex_buffer;
+
+   return cvbr->vertex_buffer != NULL;
 }
 
 
 static void
-cell_vbuf_release_vertices(struct vbuf_render *vbr, void *vertices, 
-                           unsigned vertex_size, unsigned vertices_used)
+cell_vbuf_release_vertices(struct vbuf_render *vbr)
 {
    struct cell_vbuf_render *cvbr = cell_vbuf_render(vbr);
    struct cell_context *cell = cvbr->cell;
@@ -127,11 +130,29 @@ cell_vbuf_release_vertices(struct vbuf_render *vbr, void *vertices,
    cvbr->vertex_buf = ~0;
    cell_flush_int(cell, 0x0);
 
-   assert(vertices == cvbr->vertex_buffer);
    cvbr->vertex_buffer = NULL;
 }
 
 
+static void *
+cell_vbuf_map_vertices(struct vbuf_render *vbr)
+{
+   struct cell_vbuf_render *cvbr = cell_vbuf_render(vbr);
+   return cvbr->vertex_buffer;
+}
+
+
+static void 
+cell_vbuf_unmap_vertices(struct vbuf_render *vbr, 
+                         ushort min_index,
+                         ushort max_index )
+{
+   struct cell_vbuf_render *cvbr = cell_vbuf_render(vbr);
+   assert( cvbr->vertex_buffer_size >= (max_index+1) * cvbr->vertex_size );
+   /* do nothing */
+}
+
+
 
 static boolean
 cell_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim)
@@ -295,6 +316,8 @@ cell_init_vbuf(struct cell_context *cell)
 
    cell->vbuf_render->base.get_vertex_info = cell_vbuf_get_vertex_info;
    cell->vbuf_render->base.allocate_vertices = cell_vbuf_allocate_vertices;
+   cell->vbuf_render->base.map_vertices = cell_vbuf_map_vertices;
+   cell->vbuf_render->base.unmap_vertices = cell_vbuf_unmap_vertices;
    cell->vbuf_render->base.set_primitive = cell_vbuf_set_primitive;
    cell->vbuf_render->base.draw = cell_vbuf_draw;
    cell->vbuf_render->base.release_vertices = cell_vbuf_release_vertices;
index 116453b79c527f9fe5029616b304871ab459c4d5..3cc52301da25b4071f2e6e81f0997f35fd2df4d1 100644 (file)
@@ -33,9 +33,10 @@ OLD_SOURCES = \
        spu_vertex_shader.c
 
 
-SPU_OBJECTS = $(SOURCES:.c=.o) \
+SPU_OBJECTS = $(SOURCES:.c=.o)
+
+SPU_ASM_OUT = $(SOURCES:.c=.s)
 
-SPU_ASM_OUT = $(SOURCES:.c=.s) \
 
 INCLUDE_DIRS = \
        -I$(TOP)/src/mesa \
index 0d9fcb9997066cc20ef1b2267369f80522f77355..d727268475e2a1a18a143cb89b23681e6d3afa56 100644 (file)
@@ -29,7 +29,6 @@
  * Triangle rendering within a tile.
  */
 
-#include <transpose_matrix4x4.h>
 #include "pipe/p_compiler.h"
 #include "pipe/p_format.h"
 #include "util/u_math.h"
@@ -71,6 +70,12 @@ struct vertex_header {
 #define MASK_ALL          0xf
 
 
+#define CHAN0 0
+#define CHAN1 1
+#define CHAN2 2
+#define CHAN3 3
+
+
 #define DEBUG_VERTS 0
 
 /**
@@ -144,99 +149,97 @@ struct setup_stage {
 static struct setup_stage setup;
 
 
-/**
- * Evaluate attribute coefficients (plane equations) to compute
- * attribute values for the four fragments in a quad.
- * Eg: four colors will be computed (in AoS format).
- */
-static INLINE void
-eval_coeff(uint slot, float x, float y, vector float w, vector float result[4])
+static INLINE vector float
+splatx(vector float v)
 {
-   switch (spu.vertex_info.attrib[slot].interp_mode) {
-   case INTERP_CONSTANT:
-      result[QUAD_TOP_LEFT] =
-      result[QUAD_TOP_RIGHT] =
-      result[QUAD_BOTTOM_LEFT] =
-      result[QUAD_BOTTOM_RIGHT] = setup.coef[slot].a0;
-      break;
-   case INTERP_LINEAR:
-      {
-         vector float dadx = setup.coef[slot].dadx;
-         vector float dady = setup.coef[slot].dady;
-         vector float topLeft =
-            spu_add(setup.coef[slot].a0,
-                    spu_add(spu_mul(spu_splats(x), dadx),
-                            spu_mul(spu_splats(y), dady)));
-
-         result[QUAD_TOP_LEFT] = topLeft;
-         result[QUAD_TOP_RIGHT] = spu_add(topLeft, dadx);
-         result[QUAD_BOTTOM_LEFT] = spu_add(topLeft, dady);
-         result[QUAD_BOTTOM_RIGHT] = spu_add(spu_add(topLeft, dadx), dady);
-      }
-      break;
-   case INTERP_PERSPECTIVE:
-      {
-         vector float dadx = setup.coef[slot].dadx;
-         vector float dady = setup.coef[slot].dady;
-         vector float topLeft =
-            spu_add(setup.coef[slot].a0,
-                    spu_add(spu_mul(spu_splats(x), dadx),
-                            spu_mul(spu_splats(y), dady)));
-
-         vector float wInv = spu_re(w);  /* 1.0 / w */
-
-         result[QUAD_TOP_LEFT] = spu_mul(topLeft, wInv);
-         result[QUAD_TOP_RIGHT] = spu_mul(spu_add(topLeft, dadx), wInv);
-         result[QUAD_BOTTOM_LEFT] = spu_mul(spu_add(topLeft, dady), wInv);
-         result[QUAD_BOTTOM_RIGHT] = spu_mul(spu_add(spu_add(topLeft, dadx), dady), wInv);
-      }
-      break;
-   case INTERP_POS:
-   case INTERP_NONE:
-      break;
-   default:
-      ASSERT(0);
-   }
+   return spu_splats(spu_extract(v, CHAN0));
 }
 
-
-/**
- * As above, but return 4 vectors in SOA format.
- * XXX this will all be re-written someday.
- */
-static INLINE void
-eval_coeff_soa(uint slot, float x, float y, vector float w, vector float result[4])
+static INLINE vector float
+splaty(vector float v)
 {
-   eval_coeff(slot, x, y, w, result);
-   _transpose_matrix4x4(result, result);
+   return spu_splats(spu_extract(v, CHAN1));
 }
 
+static INLINE vector float
+splatz(vector float v)
+{
+   return spu_splats(spu_extract(v, CHAN2));
+}
 
-/** Evalute coefficients to get Z for four pixels in a quad */
 static INLINE vector float
-eval_z(float x, float y)
+splatw(vector float v)
 {
-   const uint slot = 0;
-   const float dzdx = spu_extract(setup.coef[slot].dadx, 2);
-   const float dzdy = spu_extract(setup.coef[slot].dady, 2);
-   const float topLeft = spu_extract(setup.coef[slot].a0, 2) + x * dzdx + y * dzdy;
-   const vector float topLeftv = spu_splats(topLeft);
-   const vector float derivs = (vector float) { 0.0, dzdx, dzdy, dzdx + dzdy };
-   return spu_add(topLeftv, derivs);
+   return spu_splats(spu_extract(v, CHAN3));
 }
 
 
-/** Evalute coefficients to get W for four pixels in a quad */
-static INLINE vector float
-eval_w(float x, float y)
+/**
+ * Setup fragment shader inputs by evaluating triangle's vertex
+ * attribute coefficient info.
+ * \param x  quad x pos
+ * \param y  quad y pos
+ * \param fragZ  returns quad Z values
+ * \param fragInputs  returns fragment program inputs
+ * Note: this code could be incorporated into the fragment program
+ * itself to avoid the loop and switch.
+ */
+static void
+eval_inputs(float x, float y, vector float *fragZ, vector float fragInputs[])
 {
-   const uint slot = 0;
-   const float dwdx = spu_extract(setup.coef[slot].dadx, 3);
-   const float dwdy = spu_extract(setup.coef[slot].dady, 3);
-   const float topLeft = spu_extract(setup.coef[slot].a0, 3) + x * dwdx + y * dwdy;
-   const vector float topLeftv = spu_splats(topLeft);
-   const vector float derivs = (vector float) { 0.0, dwdx, dwdy, dwdx + dwdy };
-   return spu_add(topLeftv, derivs);
+   static const vector float deltaX = (const vector float) {0, 1, 0, 1};
+   static const vector float deltaY = (const vector float) {0, 0, 1, 1};
+
+   const uint posSlot = 0;
+   const vector float pos = setup.coef[posSlot].a0;
+   const vector float dposdx = setup.coef[posSlot].dadx;
+   const vector float dposdy = setup.coef[posSlot].dady;
+   const vector float fragX = spu_splats(x) + deltaX;
+   const vector float fragY = spu_splats(y) + deltaY;
+   vector float fragW, wInv;
+   uint i;
+
+   *fragZ = splatz(pos) + fragX * splatz(dposdx) + fragY * splatz(dposdy);
+   fragW =  splatw(pos) + fragX * splatw(dposdx) + fragY * splatw(dposdy);
+   wInv = spu_re(fragW);  /* 1 / w */
+
+   /* loop over fragment program inputs */
+   for (i = 0; i < spu.vertex_info.num_attribs; i++) {
+      uint attr = i + 1;
+      enum interp_mode interp = spu.vertex_info.attrib[attr].interp_mode;
+
+      /* constant term */
+      vector float a0 = setup.coef[attr].a0;
+      vector float r0 = splatx(a0);
+      vector float r1 = splaty(a0);
+      vector float r2 = splatz(a0);
+      vector float r3 = splatw(a0);
+
+      if (interp == INTERP_LINEAR || interp == INTERP_PERSPECTIVE) {
+         /* linear term */
+         vector float dadx = setup.coef[attr].dadx;
+         vector float dady = setup.coef[attr].dady;
+         /* Use SPU intrinsics here to get slightly better code.
+          * originally: r0 += fragX * splatx(dadx) + fragY * splatx(dady);
+          */
+         r0 = spu_madd(fragX, splatx(dadx), spu_madd(fragY, splatx(dady), r0));
+         r1 = spu_madd(fragX, splaty(dadx), spu_madd(fragY, splaty(dady), r1));
+         r2 = spu_madd(fragX, splatz(dadx), spu_madd(fragY, splatz(dady), r2));
+         r3 = spu_madd(fragX, splatw(dadx), spu_madd(fragY, splatw(dady), r3));
+         if (interp == INTERP_PERSPECTIVE) {
+            /* perspective term */
+            r0 *= wInv;
+            r1 *= wInv;
+            r2 *= wInv;
+            r3 *= wInv;
+         }
+      }
+      fragInputs[CHAN0] = r0;
+      fragInputs[CHAN1] = r1;
+      fragInputs[CHAN2] = r2;
+      fragInputs[CHAN3] = r3;
+      fragInputs += 4;
+   }
 }
 
 
@@ -262,19 +265,11 @@ emit_quad( int x, int y, mask_t mask)
           * Run fragment shader, execute per-fragment ops, update fb/tile.
           */
          vector float inputs[4*4], outputs[2*4];
-         vector float fragZ = eval_z((float) x, (float) y);
-         vector float fragW = eval_w((float) x, (float) y);
          vector unsigned int kill_mask;
+         vector float fragZ;
+
+         eval_inputs((float) x, (float) y, &fragZ, inputs);
 
-         /* setup inputs */
-#if 0
-         eval_coeff_soa(1, (float) x, (float) y, fragW, inputs);
-#else
-         uint i;
-         for (i = 0; i < spu.vertex_info.num_attribs; i++) {
-            eval_coeff_soa(i+1, (float) x, (float) y, fragW, inputs + i * 4);
-         }
-#endif
          ASSERT(spu.fragment_program);
          ASSERT(spu.fragment_ops);
 
index b8a0d4a265f27b4b0085ca1e174cef629f74f05c..af25dd3718a1e04cfcfc9f042b2622b6665b3522 100644 (file)
@@ -1,7 +1,7 @@
 
 #include "cell/common.h"
 #include "pipe/p_shader_tokens.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "tgsi/tgsi_parse.h"
 //#include "tgsi_build.h"
 #include "tgsi/tgsi_util.h"
index f08b8df07a16ff65a244d1d1671207363eb00c3c..dfb7f5dcf602e52d3c99bee6c84457c2c4453484 100644 (file)
@@ -9,6 +9,3 @@ C_SOURCES = \
        fo_context.c 
 
 include ../../Makefile.template
-
-symlinks:
-
index 0742b27b8fd829b60c3c5a8a7a50381a30ac3d6d..fcad717cf8349b16c0e154ae9cbd3e933b2ae38e 100644 (file)
@@ -145,7 +145,7 @@ struct pipe_context *failover_create( struct pipe_context *hw,
 
 #if 0
    failover->pipe.texture_create = hw->texture_create;
-   failover->pipe.texture_release = hw->texture_release;
+   failover->pipe.texture_destroy = hw->texture_destroy;
    failover->pipe.get_tex_surface = hw->get_tex_surface;
    failover->pipe.texture_update = hw->texture_update;
 #endif
index 6a7970663222c7bf241eb9fe06794836246136a0..c8eb92629943cbdc509c0355228a048682f25c47 100644 (file)
@@ -28,8 +28,6 @@
 /* Authors:  Keith Whitwell <keith@tungstengraphics.com>
  */
 
-#include "pipe/p_inlines.h"
-
 #include "fo_context.h"
 
 
index 41a61a0020b513a0f5cc365c41f5533050cb2279..12821c5a76179383b19006a8ca8456a5d1cd5eda 100644 (file)
@@ -26,6 +26,3 @@ C_SOURCES = \
        i915_surface.c 
 
 include ../../Makefile.template
-
-symlinks:
-
index a300b61c3b9abbeec20b2bd9b4a73a3c9453a0a4..e08582efaba2d870a9a20d05d870ca5c49a40a7d 100644 (file)
@@ -31,7 +31,7 @@
 #include "i915_debug.h"
 #include "i915_batch.h"
 #include "pipe/internal/p_winsys_screen.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 
 static void
index d92bdc1bc657c5f1bbd7acbf63577f78a83b5f31..961c1bf213478c3e61d3ab4c4d79eececbb805a6 100644 (file)
@@ -321,16 +321,27 @@ static uint
 translate_tex_src_target(struct i915_fp_compile *p, uint tex)
 {
    switch (tex) {
+   case TGSI_TEXTURE_SHADOW1D:
+      /* fall-through */
    case TGSI_TEXTURE_1D:
       return D0_SAMPLE_TYPE_2D;
+
+   case TGSI_TEXTURE_SHADOW2D:
+      /* fall-through */
    case TGSI_TEXTURE_2D:
       return D0_SAMPLE_TYPE_2D;
+
+   case TGSI_TEXTURE_SHADOWRECT:
+      /* fall-through */
    case TGSI_TEXTURE_RECT:
       return D0_SAMPLE_TYPE_2D;
+
    case TGSI_TEXTURE_3D:
       return D0_SAMPLE_TYPE_VOLUME;
+
    case TGSI_TEXTURE_CUBE:
       return D0_SAMPLE_TYPE_CUBE;
+
    default:
       i915_program_error(p, "TexSrc type");
       return 0;
index f49f6d6ed16954a2f9f6a47c245b9aafd0bf1606..9bdd91f288171704b4a3c2edaafc42bf5eaa2352 100644 (file)
@@ -40,7 +40,7 @@
 
 #include "draw/draw_context.h"
 #include "draw/draw_vbuf.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_inlines.h"
 #include "pipe/internal/p_winsys_screen.h"
 #include "util/u_math.h"
@@ -62,7 +62,7 @@ struct i915_vbuf_render {
    struct i915_context *i915;   
 
    /** Vertex size in bytes */
-   unsigned vertex_size;
+   size_t vertex_size;
 
    /** Software primitive */
    unsigned prim;
@@ -79,6 +79,7 @@ struct i915_vbuf_render {
    size_t vbo_offset;
    void *vbo_ptr;
    size_t vbo_alloc_size;
+   size_t vbo_max_used;
 };
 
 
@@ -108,7 +109,7 @@ i915_vbuf_render_get_vertex_info( struct vbuf_render *render )
 }
 
 
-static void *
+static boolean
 i915_vbuf_render_allocate_vertices( struct vbuf_render *render,
                                     ushort vertex_size,
                                     ushort nr_vertices )
@@ -124,7 +125,8 @@ i915_vbuf_render_allocate_vertices( struct vbuf_render *render,
    if (i915_render->vbo_size > size + i915_render->vbo_offset && !i915->vbo_flushed) {
    } else {
       i915->vbo_flushed = 0;
-      pipe_buffer_reference(screen, &i915_render->vbo, NULL);
+      if (i915_render->vbo)
+         pipe_buffer_reference(&i915_render->vbo, NULL);
    }
 
    if (!i915_render->vbo) {
@@ -134,19 +136,49 @@ i915_vbuf_render_allocate_vertices( struct vbuf_render *render,
                                             64,
                                             I915_BUFFER_USAGE_LIT_VERTEX,
                                             i915_render->vbo_size);
-      i915_render->vbo_ptr = pipe_buffer_map(screen,
-                                             i915_render->vbo,
-                                             PIPE_BUFFER_USAGE_CPU_WRITE);
-      pipe_buffer_unmap(screen, i915_render->vbo);
+
    }
 
+   i915_render->vertex_size = vertex_size;
    i915->vbo = i915_render->vbo;
    i915->vbo_offset = i915_render->vbo_offset;
    i915->dirty |= I915_NEW_VBO;
 
+   if (!i915_render->vbo)
+      return FALSE;
+   return TRUE;
+}
+
+
+static void *
+i915_vbuf_render_map_vertices( struct vbuf_render *render )
+{
+   struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
+   struct i915_context *i915 = i915_render->i915;
+   struct pipe_screen *screen = i915->pipe.screen;
+
+   if (i915->vbo_flushed)
+      debug_printf("%s bad vbo flush occured stalling on hw\n");
+
+   i915_render->vbo_ptr = pipe_buffer_map(screen,
+                                          i915_render->vbo,
+                                          PIPE_BUFFER_USAGE_CPU_WRITE);
+
    return (unsigned char *)i915_render->vbo_ptr + i915->vbo_offset;
 }
 
+static void
+i915_vbuf_render_unmap_vertices( struct vbuf_render *render,
+                                 ushort min_index,
+                                 ushort max_index )
+{
+   struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
+   struct i915_context *i915 = i915_render->i915;
+   struct pipe_screen *screen = i915->pipe.screen;
+
+   i915_render->vbo_max_used = MAX2(i915_render->vbo_max_used, i915_render->vertex_size * (max_index + 1));
+   pipe_buffer_unmap(screen, i915_render->vbo);
+}
 
 static boolean
 i915_vbuf_render_set_primitive( struct vbuf_render *render, 
@@ -454,18 +486,15 @@ out:
 
 
 static void
-i915_vbuf_render_release_vertices( struct vbuf_render *render,
-                                  void *vertices, 
-                                  unsigned vertex_size,
-                                  unsigned vertices_used )
+i915_vbuf_render_release_vertices( struct vbuf_render *render )
 {
    struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
    struct i915_context *i915 = i915_render->i915;
-   size_t size = (size_t)vertex_size * (size_t)vertices_used;
 
    assert(i915->vbo);
 
-   i915_render->vbo_offset += size;
+   i915_render->vbo_offset += i915_render->vbo_max_used;
+   i915_render->vbo_max_used = 0;
    i915->vbo = NULL;
    i915->dirty |= I915_NEW_VBO;
 }
@@ -499,6 +528,8 @@ i915_vbuf_render_create( struct i915_context *i915 )
 
    i915_render->base.get_vertex_info = i915_vbuf_render_get_vertex_info;
    i915_render->base.allocate_vertices = i915_vbuf_render_allocate_vertices;
+   i915_render->base.map_vertices = i915_vbuf_render_map_vertices;
+   i915_render->base.unmap_vertices = i915_vbuf_render_unmap_vertices;
    i915_render->base.set_primitive = i915_vbuf_render_set_primitive;
    i915_render->base.draw = i915_vbuf_render_draw;
    i915_render->base.draw_arrays = i915_vbuf_render_draw_arrays;
index 39e48105b3e6d3ca61133e236706f29396c7f782..f4aa8e60d81bfc48f1c2c0d894cae8412a02f861 100644 (file)
@@ -36,6 +36,7 @@
 #include "i915_context.h"
 #include "i915_screen.h"
 #include "i915_texture.h"
+#include "i915_winsys.h"
 
 
 static const char *
@@ -204,17 +205,71 @@ i915_destroy_screen( struct pipe_screen *screen )
 }
 
 
+static struct pipe_transfer*
+i915_get_tex_transfer(struct pipe_screen *screen,
+                      struct pipe_texture *texture,
+                      unsigned face, unsigned level, unsigned zslice,
+                      enum pipe_transfer_usage usage, unsigned x, unsigned y,
+                      unsigned w, unsigned h)
+{
+   struct i915_texture *tex = (struct i915_texture *)texture;
+   struct i915_transfer *trans;
+   unsigned offset;  /* in bytes */
+
+   if (texture->target == PIPE_TEXTURE_CUBE) {
+      offset = tex->image_offset[level][face];
+   }
+   else if (texture->target == PIPE_TEXTURE_3D) {
+      offset = tex->image_offset[level][zslice];
+   }
+   else {
+      offset = tex->image_offset[level][0];
+      assert(face == 0);
+      assert(zslice == 0);
+   }
+
+   trans = CALLOC_STRUCT(i915_transfer);
+   if (trans) {
+      pipe_texture_reference(&trans->base.texture, texture);
+      trans->base.format = trans->base.format;
+      trans->base.width = w;
+      trans->base.height = h;
+      trans->base.block = texture->block;
+      trans->base.nblocksx = texture->nblocksx[level];
+      trans->base.nblocksy = texture->nblocksy[level];
+      trans->base.stride = tex->stride;
+      trans->offset = offset;
+      trans->base.usage = usage;
+   }
+   return &trans->base;
+}
+
+static void
+i915_tex_transfer_destroy(struct pipe_transfer *trans)
+{
+   pipe_texture_reference(&trans->texture, NULL);
+   FREE(trans);
+}
+
 static void *
-i915_surface_map( struct pipe_screen *screen,
-                  struct pipe_surface *surface,
-                  unsigned flags )
+i915_transfer_map( struct pipe_screen *screen,
+                   struct pipe_transfer *transfer )
 {
-   struct i915_texture *tex = (struct i915_texture *)surface->texture;
-   char *map = pipe_buffer_map( screen, tex->buffer, flags );
+   struct i915_texture *tex = (struct i915_texture *)transfer->texture;
+   char *map;
+   unsigned flags = 0;
+
+   if (transfer->usage != PIPE_TRANSFER_WRITE)
+      flags |= PIPE_BUFFER_USAGE_CPU_READ;
+
+   if (transfer->usage != PIPE_TRANSFER_READ)
+      flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
+
+   map = pipe_buffer_map( screen, tex->buffer, flags );
    if (map == NULL)
       return NULL;
 
-   if (surface->texture &&
+   if (transfer->texture &&
        (flags & PIPE_BUFFER_USAGE_CPU_WRITE)) 
    {
       /* Do something to notify contexts of a texture change.  
@@ -222,14 +277,16 @@ i915_surface_map( struct pipe_screen *screen,
       /* i915_screen(screen)->timestamp++; */
    }
    
-   return map + surface->offset;
+   return map + i915_transfer(transfer)->offset +
+      transfer->y / transfer->block.height * transfer->stride +
+      transfer->x / transfer->block.width * transfer->block.size;
 }
 
 static void
-i915_surface_unmap(struct pipe_screen *screen,
-                   struct pipe_surface *surface)
+i915_transfer_unmap(struct pipe_screen *screen,
+                    struct pipe_transfer *transfer)
 {
-   struct i915_texture *tex = (struct i915_texture *)surface->texture;
+   struct i915_texture *tex = (struct i915_texture *)transfer->texture;
    pipe_buffer_unmap( screen, tex->buffer );
 }
 
@@ -278,8 +335,10 @@ i915_create_screen(struct pipe_winsys *winsys, uint pci_id)
    i915screen->screen.get_param = i915_get_param;
    i915screen->screen.get_paramf = i915_get_paramf;
    i915screen->screen.is_format_supported = i915_is_format_supported;
-   i915screen->screen.surface_map = i915_surface_map;
-   i915screen->screen.surface_unmap = i915_surface_unmap;
+   i915screen->screen.get_tex_transfer = i915_get_tex_transfer;
+   i915screen->screen.tex_transfer_destroy = i915_tex_transfer_destroy;
+   i915screen->screen.transfer_map = i915_transfer_map;
+   i915screen->screen.transfer_unmap = i915_transfer_unmap;
 
    i915_init_screen_texture_functions(&i915screen->screen);
    u_simple_screen_init(&i915screen->screen);
index 73b0ff05ce7df76859ac5013ffc2dd085e98e1ba..5284c325951d2d36135653ed8418b510f540f3bb 100644 (file)
@@ -50,16 +50,29 @@ struct i915_screen
 };
 
 
-/** cast wrapper */
+/**
+ * Subclass of pipe_transfer
+ */
+struct i915_transfer
+{
+   struct pipe_transfer base;
+
+   unsigned offset;
+};
+
+
+/** cast wrappers */
 static INLINE struct i915_screen *
 i915_screen(struct pipe_screen *pscreen)
 {
    return (struct i915_screen *) pscreen;
 }
 
-
-extern struct pipe_screen *
-i915_create_screen(struct pipe_winsys *winsys, uint pci_id);
+static INLINE struct i915_transfer *
+i915_transfer( struct pipe_transfer *transfer )
+{
+   return (struct i915_transfer *)transfer;
+}
 
 
 #ifdef __cplusplus
index 6558cf1c3e5bb90a5afa2f9c9375d346e88d9927..1e1fb968b47336e40e8bdd5ecb0ad0ea6f52a47a 100644 (file)
@@ -211,11 +211,9 @@ i915_emit_hardware_state(struct i915_context *i915 )
       struct pipe_surface *depth_surface = i915->framebuffer.zsbuf;
 
       if (cbuf_surface) {
-        unsigned cpitch = cbuf_surface->stride;
         unsigned ctile = BUF_3D_USE_FENCE;
          struct i915_texture *tex = (struct i915_texture *)
                                     cbuf_surface->texture;
-         struct pipe_buffer *buffer = tex->buffer;
          assert(tex);
 
         if (tex && tex->tiled) {
@@ -225,7 +223,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
         OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
 
         OUT_BATCH(BUF_3D_ID_COLOR_BACK |
-                  BUF_3D_PITCH(cpitch) |  /* pitch in bytes */
+                  BUF_3D_PITCH(tex->stride) |  /* pitch in bytes */
                   ctile);
 
         OUT_RELOC(tex->buffer,
@@ -236,11 +234,9 @@ i915_emit_hardware_state(struct i915_context *i915 )
       /* What happens if no zbuf??
        */
       if (depth_surface) {
-        unsigned zpitch = depth_surface->stride;
         unsigned ztile = BUF_3D_USE_FENCE;
          struct i915_texture *tex = (struct i915_texture *)
                                     depth_surface->texture;
-         struct pipe_buffer *buffer = tex->buffer;
          assert(tex);
 
         if (tex && tex->tiled) {
@@ -250,7 +246,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
         OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
 
         OUT_BATCH(BUF_3D_ID_DEPTH |
-                  BUF_3D_PITCH(zpitch) |  /* pitch in bytes */
+                  BUF_3D_PITCH(tex->stride) |  /* pitch in bytes */
                   ztile);
 
         OUT_RELOC(tex->buffer,
index c09c10601b4b449a52534f4bb02c119fc7ed3f46..3667ed1afa7f019ade0a9ade6c9ec44fb3ec6661 100644 (file)
@@ -116,7 +116,7 @@ static void update_sampler(struct i915_context *i915,
            ws == PIPE_TEX_WRAP_CLAMP_TO_BORDER ||
            wt == PIPE_TEX_WRAP_CLAMP_TO_BORDER || 
            wr == PIPE_TEX_WRAP_CLAMP_TO_BORDER)) {
-         if (i915->strict_conformance) {
+         if (i915->conformance_mode > 0) {
             assert(0);
             /*             sampler->fallback = true; */
             /* TODO */
index 94e2deaf6155db422209ffe88ac951104df56283..09b2c499b8f3cefa7c90d199178743f87870b899 100644 (file)
  */
 static void
 i915_surface_copy(struct pipe_context *pipe,
-                  boolean do_flip,
                  struct pipe_surface *dst,
                  unsigned dstx, unsigned dsty,
                  struct pipe_surface *src,
                  unsigned srcx, unsigned srcy, unsigned width, unsigned height)
 {
-   assert( dst != src );
-   assert( dst->block.size == src->block.size );
-   assert( dst->block.width == src->block.height );
-   assert( dst->block.height == src->block.height );
+   struct i915_texture *dst_tex = (struct i915_texture *)dst->texture;
+   struct i915_texture *src_tex = (struct i915_texture *)src->texture;
 
-   if (0) {
-      void *dst_map = pipe->screen->surface_map( pipe->screen,
-                                                 dst,
-                                                 PIPE_BUFFER_USAGE_CPU_WRITE );
-      
-      const void *src_map = pipe->screen->surface_map( pipe->screen,
-                                                       src,
-                                                       PIPE_BUFFER_USAGE_CPU_READ );
-      
-      pipe_copy_rect(dst_map,
-                     &dst->block,
-                     dst->stride,
-                     dstx, dsty,
-                     width, height,
-                     src_map,
-                     do_flip ? -(int) src->stride : src->stride,
-                     srcx, do_flip ? height - 1 - srcy : srcy);
+   assert( dst != src );
+   assert( dst_tex->base.block.size == src_tex->base.block.size );
+   assert( dst_tex->base.block.width == src_tex->base.block.height );
+   assert( dst_tex->base.block.height == src_tex->base.block.height );
+   assert( dst_tex->base.block.width == 1 );
+   assert( dst_tex->base.block.height == 1 );
 
-      pipe->screen->surface_unmap(pipe->screen, src);
-      pipe->screen->surface_unmap(pipe->screen, dst);
-   }
-   else {
-      struct i915_texture *dst_tex = (struct i915_texture *)dst->texture;
-      struct i915_texture *src_tex = (struct i915_texture *)src->texture;
-      assert(dst->block.width == 1);
-      assert(dst->block.height == 1);
-      i915_copy_blit( i915_context(pipe),
-                      do_flip,
-                      dst->block.size,
-                     (unsigned short) src->stride, src_tex->buffer, src->offset,
-                     (unsigned short) dst->stride, dst_tex->buffer, dst->offset,
-                     (short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height );
-   }
+   i915_copy_blit( i915_context(pipe),
+                   FALSE,
+                   dst_tex->base.block.size,
+                   (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 );
 }
 
 
@@ -94,27 +71,18 @@ i915_surface_fill(struct pipe_context *pipe,
                  unsigned dstx, unsigned dsty,
                  unsigned width, unsigned height, unsigned value)
 {
-   if (0) {
-      void *dst_map = pipe->screen->surface_map( pipe->screen,
-                                                 dst,
-                                                 PIPE_BUFFER_USAGE_CPU_WRITE );
+   struct i915_texture *tex = (struct i915_texture *)dst->texture;
 
-      pipe_fill_rect(dst_map, &dst->block, dst->stride, dstx, dsty, width, height, value);
+   assert(tex->base.block.width == 1);
+   assert(tex->base.block.height == 1);
 
-      pipe->screen->surface_unmap(pipe->screen, dst);
-   }
-   else {
-      struct i915_texture *tex = (struct i915_texture *)dst->texture;
-      assert(dst->block.width == 1);
-      assert(dst->block.height == 1);
-      i915_fill_blit( i915_context(pipe),
-                     dst->block.size,
-                     (unsigned short) dst->stride,
-                     tex->buffer, dst->offset,
-                     (short) dstx, (short) dsty,
-                     (short) width, (short) height,
-                     value );
-   }
+   i915_fill_blit( i915_context(pipe),
+                   tex->base.block.size,
+                   (unsigned short) tex->stride,
+                   tex->buffer, dst->offset,
+                   (short) dstx, (short) dsty,
+                   (short) width, (short) height,
+                   value );
 }
 
 
index b2ca3a2286bd0c132ecae580825c4b6254a05edf..39aca9f8173f8e4d457908247f114f6c67ccdcab 100644 (file)
@@ -42,6 +42,7 @@
 #include "i915_texture.h"
 #include "i915_debug.h"
 #include "i915_screen.h"
+#include "i915_winsys.h"
 
 /*
  * Helper function and arrays
@@ -581,7 +582,6 @@ i915_texture_create(struct pipe_screen *screen,
                     const struct pipe_texture *templat)
 {
    struct i915_screen *i915screen = i915_screen(screen);
-   struct pipe_winsys *ws = screen->winsys;
    struct i915_texture *tex = CALLOC_STRUCT(i915_texture);
    size_t tex_size;
 
@@ -589,7 +589,7 @@ i915_texture_create(struct pipe_screen *screen,
       return NULL;
 
    tex->base = *templat;
-   tex->base.refcount = 1;
+   pipe_reference_init(&tex->base.reference, 1);
    tex->base.screen = screen;
 
    tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width[0]);
@@ -605,7 +605,7 @@ i915_texture_create(struct pipe_screen *screen,
 
    tex_size = tex->stride * tex->total_nblocksy;
 
-   tex->buffer = ws->buffer_create(ws, 64,
+   tex->buffer = screen->buffer_create(screen, 64,
                                     PIPE_BUFFER_USAGE_PIXEL,
                                     tex_size);
 
@@ -628,33 +628,22 @@ fail:
 
 
 static void
-i915_texture_release(struct pipe_screen *screen,
-                     struct pipe_texture **pt)
+i915_texture_destroy(struct pipe_texture *pt)
 {
-   if (!*pt)
-      return;
+   struct i915_texture *tex = (struct i915_texture *)pt;
+   uint i;
 
    /*
-   DBG("%s %p refcount will be %d\n",
-       __FUNCTION__, (void *) *pt, (*pt)->refcount - 1);
+     DBG("%s deleting %p\n", __FUNCTION__, (void *) tex);
    */
-   if (--(*pt)->refcount <= 0) {
-      struct i915_texture *tex = (struct i915_texture *)*pt;
-      uint i;
-
-      /*
-      DBG("%s deleting %p\n", __FUNCTION__, (void *) tex);
-      */
 
-      pipe_buffer_reference(screen, &tex->buffer, NULL);
+   pipe_buffer_reference(&tex->buffer, NULL);
 
-      for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
-         if (tex->image_offset[i])
-            FREE(tex->image_offset[i]);
+   for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
+      if (tex->image_offset[i])
+         FREE(tex->image_offset[i]);
 
-      FREE(tex);
-   }
-   *pt = NULL;
+   FREE(tex);
 }
 
 static struct pipe_surface *
@@ -681,15 +670,11 @@ i915_get_tex_surface(struct pipe_screen *screen,
 
    ps = CALLOC_STRUCT(pipe_surface);
    if (ps) {
-      ps->refcount = 1;
+      pipe_reference_init(&ps->reference, 1);
       pipe_texture_reference(&ps->texture, pt);
       ps->format = pt->format;
       ps->width = pt->width[level];
       ps->height = pt->height[level];
-      ps->block = pt->block;
-      ps->nblocksx = pt->nblocksx[level];
-      ps->nblocksy = pt->nblocksy[level];
-      ps->stride = tex->stride;
       ps->offset = offset;
       ps->usage = flags;
       ps->status = PIPE_SURFACE_STATUS_DEFINED;
@@ -718,7 +703,7 @@ i915_texture_blanket(struct pipe_screen * screen,
       return NULL;
 
    tex->base = *base;
-   tex->base.refcount = 1;
+   pipe_reference_init(&tex->base.reference, 1);
    tex->base.screen = screen;
 
    tex->stride = stride[0];
@@ -726,7 +711,7 @@ i915_texture_blanket(struct pipe_screen * screen,
    i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1);
    i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
 
-   pipe_buffer_reference(screen, &tex->buffer, buffer);
+   pipe_buffer_reference(&tex->buffer, buffer);
 
    return &tex->base;
 }
@@ -738,34 +723,43 @@ i915_init_texture_functions(struct i915_context *i915)
 }
 
 static void
-i915_tex_surface_release(struct pipe_screen *screen,
-                         struct pipe_surface **surface)
+i915_tex_surface_destroy(struct pipe_surface *surf)
 {
-   struct pipe_surface *surf = *surface;
-
-   if (--surf->refcount == 0) {
-
-      /* This really should not be possible, but it's actually
-       * happening quite a bit...  Will fix.
-       */
-      if (surf->status == PIPE_SURFACE_STATUS_CLEAR) {
-         debug_printf("XXX destroying a surface with pending clears...\n");
-         assert(0);
-      }
-
-      pipe_texture_reference(&surf->texture, NULL);
-      FREE(surf);
+   /* This really should not be possible, but it's actually
+    * happening quite a bit...  Will fix.
+    */
+   if (surf->status == PIPE_SURFACE_STATUS_CLEAR) {
+      debug_printf("XXX destroying a surface with pending clears...\n");
+      assert(0);
    }
 
-   *surface = NULL;
+   pipe_texture_reference(&surf->texture, NULL);
+   FREE(surf);
 }
 
 void
 i915_init_screen_texture_functions(struct pipe_screen *screen)
 {
    screen->texture_create = i915_texture_create;
-   screen->texture_release = i915_texture_release;
+   screen->texture_destroy = i915_texture_destroy;
    screen->get_tex_surface = i915_get_tex_surface;
    screen->texture_blanket = i915_texture_blanket;
-   screen->tex_surface_release = i915_tex_surface_release;
+   screen->tex_surface_destroy = i915_tex_surface_destroy;
+}
+
+boolean i915_get_texture_buffer( struct pipe_texture *texture,
+                                 struct pipe_buffer **buf,
+                                 unsigned *stride )
+{
+   struct i915_texture *tex = (struct i915_texture *)texture;
+
+   if (!tex)
+      return FALSE;
+
+   pipe_buffer_reference(buf, tex->buffer);
+
+   if (stride)
+      *stride = tex->stride;
+
+   return TRUE;
 }
index 81904c2a742c1da1c2a958471fe41035621b47ad..ff5b34f193ab33498cd0b95409cc678e9240cd88 100644 (file)
@@ -30,7 +30,8 @@
  * This is the interface that i915simple requires any window system
  * hosting it to implement.  This is the only include file in i915simple
  * which is public.
- * 
+ *
+ * This isn't currently true as the winsys needs i915_batchbuffer.h
  */
 
 #ifndef I915_WINSYS_H
@@ -45,10 +46,9 @@ extern "C" {
 #endif
 
    
-/* Pipe drivers are (meant to be!) independent of both GL and the
- * window system.  The window system provides a buffer manager and a
- * set of additional hooks for things like command buffer submission,
- * etc.
+/* Pipe drivers are independent of both GL and the window system.
+ * The window system provides a buffer manager and a set of additional
+ * hooks for things like command buffer submission, etc.
  *
  * There clearly has to be some agreement between the window system
  * driver and the hardware driver about the format of command buffers,
@@ -56,6 +56,7 @@ extern "C" {
  */
 
 struct i915_batchbuffer;
+struct pipe_texture;
 struct pipe_buffer;
 struct pipe_fence_handle;
 struct pipe_winsys;
@@ -64,7 +65,7 @@ struct pipe_screen;
 
 /**
  * Additional winsys interface for i915simple.
- * 
+ *
  * It is an over-simple batchbuffer mechanism.  Will want to improve the
  * performance of this, perhaps based on the cmdstream stuff.  It
  * would be pretty impossible to implement swz on top of this
@@ -110,12 +111,33 @@ struct i915_winsys {
 #define I915_BUFFER_USAGE_LIT_VERTEX  (PIPE_BUFFER_USAGE_CUSTOM << 0)
 
 
-struct pipe_context *i915_create_context( struct pipe_screen *,
-                                          struct pipe_winsys *,
-                                          struct i915_winsys * );
+/**
+ * Create i915 pipe_screen.
+ */
+struct pipe_screen *i915_create_screen( struct pipe_winsys *winsys,
+                                        uint pci_id );
+
+/**
+ * Create a i915 pipe_context.
+ */
+struct pipe_context *i915_create_context( struct pipe_screen *screen,
+                                          struct pipe_winsys *winsys,
+                                          struct i915_winsys *i915 );
+
+/**
+ * Used for the winsys to get the buffer used for a texture
+ * and also the stride used for the texture.
+ *
+ * Buffer is referenced for you so you need to unref after use.
+ *
+ * This is needed for example kms.
+ */
+boolean i915_get_texture_buffer( struct pipe_texture *texture,
+                                 struct pipe_buffer **buf,
+                                 unsigned *stride );
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif 
+#endif
index e97146e57ca7c0d0c481610b86f06fe2e1347469..19182afa75d1cb15ef97f4b934cc58edc69691b6 100644 (file)
@@ -50,5 +50,3 @@ C_SOURCES = \
        brw_wm_surface_state.c
 
 include ../../Makefile.template
-
-symlinks:
index 4a94ddefa6a17731acc2e7ae5c52c1b8b14018f4..4adfb0c02f525754088683a2e2ea94e4d22472b7 100644 (file)
@@ -30,7 +30,7 @@
   */
     
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 #include "brw_eu.h"
 
index 0a95dce1940c264a553b87bd6ec3ae2ad0780ed5..511779dbfa04a9c00aa9080087958ace904064dd 100644 (file)
@@ -41,7 +41,6 @@
  */
 static void
 brw_surface_copy(struct pipe_context *pipe,
-                 boolean do_flip,
                  struct pipe_surface *dst,
                  unsigned dstx, unsigned dsty,
                  struct pipe_surface *src,
@@ -64,11 +63,11 @@ brw_surface_copy(struct pipe_context *pipe,
       pipe_copy_rect(dst_map,
                      &dst->block,
                      dst->stride,
-                     dstx, dsty, 
-                     width, height, 
-                     src_map, 
-                     do_flip ? -(int) src->stride : src->stride, 
-                     srcx, do_flip ? height - 1 - srcy : srcy);
+                     dstx, dsty,
+                     width, height,
+                     src_map,
+                     src->stride,
+                     srcx, srcy);
 
       pipe->screen->surface_unmap(pipe->screen, src);
       pipe->screen->surface_unmap(pipe->screen, dst);
@@ -79,7 +78,7 @@ brw_surface_copy(struct pipe_context *pipe,
       assert(dst->block.width == 1);
       assert(dst->block.height == 1);
       brw_copy_blit(brw_context(pipe),
-                    do_flip,
+                    FALSE,
                     dst->block.size,
                     (short) src->stride/src->block.size, src_tex->buffer, src->offset, FALSE,
                     (short) dst->stride/dst->block.size, dst_tex->buffer, dst->offset, FALSE,
index 448229ed4ee329719a0b59f1c32fff247c664cf6..c921c0d38bedac1beaa6c3752f649a2b01d4c5cb 100644 (file)
@@ -284,18 +284,17 @@ static struct pipe_texture *
 brw_texture_create_screen(struct pipe_screen *screen,
                           const struct pipe_texture *templat)
 {
-   struct pipe_winsys *ws = screen->winsys;
    struct brw_texture *tex = CALLOC_STRUCT(brw_texture);
 
    if (tex) {
       tex->base = *templat;
-      tex->base.refcount = 1;
+      pipe_reference_init(&tex->base.reference, 1);
 
       tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width[0]);
       tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height[0]);
    
       if (brw_miptree_layout(tex))
-        tex->buffer = ws->buffer_create(ws, 64,
+        tex->buffer = screen->buffer_create(screen, 64,
                                           PIPE_BUFFER_USAGE_PIXEL,
                                           tex->stride *
                                           tex->total_nblocksy);
@@ -311,33 +310,22 @@ brw_texture_create_screen(struct pipe_screen *screen,
 
 
 static void
-brw_texture_release_screen(struct pipe_screen *screen,
-                           struct pipe_texture **pt)
+brw_texture_destroy_screen(struct pipe_texture *pt)
 {
-   if (!*pt)
-      return;
+   struct brw_texture *tex = (struct brw_texture *)pt;
+   uint i;
 
    /*
-   DBG("%s %p refcount will be %d\n",
-       __FUNCTION__, (void *) *pt, (*pt)->refcount - 1);
+     DBG("%s deleting %p\n", __FUNCTION__, (void *) tex);
    */
-   if (--(*pt)->refcount <= 0) {
-      struct brw_texture *tex = (struct brw_texture *)*pt;
-      uint i;
-
-      /*
-      DBG("%s deleting %p\n", __FUNCTION__, (void *) tex);
-      */
 
-      pipe_buffer_reference(screen, &tex->buffer, NULL);
+   pipe_buffer_reference(&tex->buffer, NULL);
 
-      for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
-         if (tex->image_offset[i])
-            free(tex->image_offset[i]);
+   for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
+      if (tex->image_offset[i])
+         free(tex->image_offset[i]);
 
-      free(tex);
-   }
-   *pt = NULL;
+   free(tex);
 }
 
 
@@ -365,7 +353,7 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
 
    ps = CALLOC_STRUCT(pipe_surface);
    if (ps) {
-      ps->refcount = 1;
+      pipe_reference_init(&ps->reference, 1);
       pipe_texture_reference(&ps->texture, pt);
       ps->format = pt->format;
       ps->width = pt->width[level];
@@ -392,7 +380,7 @@ void
 brw_init_screen_texture_funcs(struct pipe_screen *screen)
 {
    screen->texture_create  = brw_texture_create_screen;
-   screen->texture_release = brw_texture_release_screen;
+   screen->texture_destroy = brw_texture_destroy_screen;
    screen->get_tex_surface = brw_get_tex_surface_screen;
 }
 
index 1bab5bfdb3a9e5f5cf19f5bf6e6e8a3f726c48f0..b5b9e0e7026bc57f9d4ed4b7b34cde8b57a85101 100644 (file)
@@ -242,7 +242,7 @@ static void upload_wm_surfaces(struct brw_context *brw )
       const struct brw_texture *texUnit = brw->attribs.Texture[i];
 
       if (texUnit &&
-         texUnit->base.refcount/*(texUnit->refcount > 0) == really used */) {
+         texUnit->base.reference.count/*(texUnit->reference.count > 0) == really used */) {
 
         brw_update_texture_surface(brw, i);
 
index 4ae4ff494043cc7a67d369d9f6d8ca4294c2fdd9..97859110b5fa33c0d46da06d3c866bc105d97c78 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __NOUVEAU_STATEOBJ_H__
 #define __NOUVEAU_STATEOBJ_H__
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 struct nouveau_stateobj_reloc {
        struct pipe_buffer *bo;
@@ -16,7 +16,7 @@ struct nouveau_stateobj_reloc {
 };
 
 struct nouveau_stateobj {
-       int refcount;
+       struct pipe_reference reference;
 
        unsigned *push;
        struct nouveau_stateobj_reloc *reloc;
@@ -32,7 +32,7 @@ so_new(unsigned push, unsigned reloc)
        struct nouveau_stateobj *so;
 
        so = MALLOC(sizeof(struct nouveau_stateobj));
-       so->refcount = 0;
+       pipe_reference_init(&so->reference, 1);
        so->push = MALLOC(sizeof(unsigned) * push);
        so->reloc = MALLOC(sizeof(struct nouveau_stateobj_reloc) * reloc);
 
@@ -47,17 +47,11 @@ so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso)
 {
        struct nouveau_stateobj *so = *pso;
 
-       if (ref) {
-               ref->refcount++;
-       }
-
-       if (so && --so->refcount <= 0) {
+        if (pipe_reference((struct pipe_reference**)pso, &ref->reference)) {
                free(so->push);
                free(so->reloc);
                free(so);
        }
-
-       *pso = ref;
 }
 
 static INLINE void
index b86c4b933888e0720ba93969f309785b50a9d519..ff7dd1c51c8fc5bcbe98ab60a47b769c07143f30 100644 (file)
 
 #define NOUVEAU_TEXTURE_USAGE_LINEAR (1 << 16)
 
-#define NOUVEAU_BUFFER_USAGE_TEXTURE (1 << 16)
-#define NOUVEAU_BUFFER_USAGE_ZETA    (1 << 17)
+#define NOUVEAU_BUFFER_USAGE_TEXTURE  (1 << 16)
+#define NOUVEAU_BUFFER_USAGE_ZETA     (1 << 17)
+#define NOUVEAU_BUFFER_USAGE_TRANSFER (1 << 18)
 
 struct nouveau_winsys {
-       struct nouveau_context *nv;
+       struct pipe_winsys *ws;
 
        struct nouveau_channel *channel;
 
index 4ed62dae95d5468bfaaf24c159550d998a57b592..7c14bacb1deb207dbe639260643a56815f993587 100644 (file)
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv04
 
-DRIVER_SOURCES = \
+C_SOURCES = \
        nv04_surface_2d.c \
        nv04_clear.c \
        nv04_context.c \
@@ -15,15 +15,7 @@ DRIVER_SOURCES = \
        nv04_state.c \
        nv04_state_emit.c \
        nv04_surface.c \
+       nv04_transfer.c \
        nv04_vbo.c
 
-C_SOURCES = \
-       $(COMMON_SOURCES) \
-       $(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
index 993c5ef5dd261400d06dea51248dc62a81a9fbf4..85dc017fbc4260b4aeaf6186811743e002319266 100644 (file)
@@ -41,23 +41,20 @@ nv04_miptree_layout(struct nv04_miptree *nv04mt)
 static struct pipe_texture *
 nv04_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
 {
-       struct pipe_winsys *ws = pscreen->winsys;
        struct nv04_miptree *mt;
 
        mt = MALLOC(sizeof(struct nv04_miptree));
        if (!mt)
                return NULL;
        mt->base = *pt;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = pscreen;
-       mt->shadow_tex = NULL;
-       mt->shadow_surface = NULL;
 
        //mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
 
        nv04_miptree_layout(mt);
 
-       mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL |
+       mt->buffer = pscreen->buffer_create(pscreen, 256, PIPE_BUFFER_USAGE_PIXEL |
                                                NOUVEAU_BUFFER_USAGE_TEXTURE,
                                                mt->total_size);
        if (!mt->buffer) {
@@ -85,38 +82,27 @@ nv04_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
                return NULL;
 
        mt->base = *pt;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = pscreen;
        mt->level[0].pitch = stride[0];
        mt->level[0].image_offset = CALLOC(1, sizeof(unsigned));
 
-       pipe_buffer_reference(pscreen, &mt->buffer, pb);
+       pipe_buffer_reference(&mt->buffer, pb);
        return &mt->base;
 }
 
 static void
-nv04_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt)
+nv04_miptree_destroy(struct pipe_texture *pt)
 {
-       struct pipe_texture *pt = *ppt;
        struct nv04_miptree *mt = (struct nv04_miptree *)pt;
        int l;
 
-       *ppt = NULL;
-       if (--pt->refcount)
-               return;
-
-       pipe_buffer_reference(pscreen, &mt->buffer, NULL);
+       pipe_buffer_reference(&mt->buffer, NULL);
        for (l = 0; l <= pt->last_level; l++) {
                if (mt->level[l].image_offset)
                        FREE(mt->level[l].image_offset);
        }
 
-       if (mt->shadow_tex) {
-               assert(mt->shadow_surface);
-               pscreen->tex_surface_release(pscreen, &mt->shadow_surface);
-               nv04_miptree_release(pscreen, &mt->shadow_tex);
-       }
-
        FREE(mt);
 }
 
@@ -126,41 +112,31 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
                         unsigned flags)
 {
        struct nv04_miptree *nv04mt = (struct nv04_miptree *)pt;
-       struct pipe_surface *ps;
+       struct nv04_surface *ns;
 
-       ps = CALLOC_STRUCT(pipe_surface);
-       if (!ps)
+       ns = CALLOC_STRUCT(nv04_surface);
+       if (!ns)
                return NULL;
-       pipe_texture_reference(&ps->texture, pt);
-       ps->format = pt->format;
-       ps->width = pt->width[level];
-       ps->height = pt->height[level];
-       ps->block = pt->block;
-       ps->nblocksx = pt->nblocksx[level];
-       ps->nblocksy = pt->nblocksy[level];
-       ps->stride = nv04mt->level[level].pitch;
-       ps->usage = flags;
-       ps->status = PIPE_SURFACE_STATUS_DEFINED;
-       ps->refcount = 1;
-       ps->face = face;
-       ps->level = level;
-       ps->zslice = zslice;
-
-       ps->offset = nv04mt->level[level].image_offset;
-
-       return ps;
+       pipe_texture_reference(&ns->base.texture, pt);
+       ns->base.format = pt->format;
+       ns->base.width = pt->width[level];
+       ns->base.height = pt->height[level];
+       ns->base.usage = flags;
+       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
+       pipe_reference_init(&ns->base.reference, 1);
+       ns->base.face = face;
+       ns->base.level = level;
+       ns->base.zslice = zslice;
+       ns->pitch = nv04mt->level[level].pitch;
+
+       ns->base.offset = nv04mt->level[level].image_offset;
+
+       return &ns->base;
 }
 
 static void
-nv04_miptree_surface_del(struct pipe_screen *pscreen,
-                        struct pipe_surface **psurface)
+nv04_miptree_surface_del(struct pipe_surface *ps)
 {
-       struct pipe_surface *ps = *psurface;
-
-       *psurface = NULL;
-       if (--ps->refcount > 0)
-               return;
-
        pipe_texture_reference(&ps->texture, NULL);
        FREE(ps);
 }
@@ -170,8 +146,8 @@ nv04_screen_init_miptree_functions(struct pipe_screen *pscreen)
 {
        pscreen->texture_create = nv04_miptree_create;
        pscreen->texture_blanket = nv04_miptree_blanket;
-       pscreen->texture_release = nv04_miptree_release;
+       pscreen->texture_destroy = nv04_miptree_destroy;
        pscreen->get_tex_surface = nv04_miptree_surface_new;
-       pscreen->tex_surface_release = nv04_miptree_surface_del;
+       pscreen->tex_surface_destroy = nv04_miptree_surface_del;
 }
 
index 18a8872ae380d7f9b24eddc8f90071d808967456..f6458232ae58833c1287fa429b00d4368a5224ea 100644 (file)
@@ -1,5 +1,5 @@
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_inlines.h"
 #include "pipe/internal/p_winsys_screen.h"
 #include "pipe/p_compiler.h"
@@ -51,7 +51,7 @@ nv04_vbuf_render_get_vertex_info( struct vbuf_render *render )
 }
 
 
-static void *
+static boolean
 nv04_vbuf_render_allocate_vertices( struct vbuf_render *render,
                ushort vertex_size,
                ushort nr_vertices )
@@ -61,9 +61,22 @@ nv04_vbuf_render_allocate_vertices( struct vbuf_render *render,
        nv04_render->buffer = (unsigned char*) MALLOC(VERTEX_BUFFER_SIZE);
        assert(!nv04_render->buffer);
 
+       return nv04_render->buffer ? TRUE : FALSE;
+}
+
+static void *
+nv04_vbuf_render_map_vertices( struct vbuf_render *render )
+{
+       struct nv04_vbuf_render *nv04_render = nv04_vbuf_render(render);
        return nv04_render->buffer;
 }
 
+static void
+nv04_vbuf_render_unmap_vertices( struct vbuf_render *render,
+               ushort min_index,
+               ushort max_index )
+{
+}
 
 static boolean 
 nv04_vbuf_render_set_primitive( struct vbuf_render *render, 
@@ -244,10 +257,7 @@ nv04_vbuf_render_draw( struct vbuf_render *render,
 
 
 static void
-nv04_vbuf_render_release_vertices( struct vbuf_render *render,
-               void *vertices, 
-               unsigned vertex_size,
-               unsigned vertices_used )
+nv04_vbuf_render_release_vertices( struct vbuf_render *render )
 {
        struct nv04_vbuf_render *nv04_render = nv04_vbuf_render(render);
 
@@ -278,6 +288,8 @@ nv04_vbuf_render_create( struct nv04_context *nv04 )
        nv04_render->base.max_indices = 65536; 
        nv04_render->base.get_vertex_info = nv04_vbuf_render_get_vertex_info;
        nv04_render->base.allocate_vertices = nv04_vbuf_render_allocate_vertices;
+       nv04_render->base.map_vertices = nv04_vbuf_render_map_vertices;
+       nv04_render->base.unmap_vertices = nv04_vbuf_render_unmap_vertices;
        nv04_render->base.set_primitive = nv04_vbuf_render_set_primitive;
        nv04_render->base.draw = nv04_vbuf_render_draw;
        nv04_render->base.release_vertices = nv04_vbuf_render_release_vertices;
index 9ef38bc244c162d3c7fd3cca79dacee1bec6be7d..f9f6d974264588e2e4d9cba92ca93f0fbcc06c55 100644 (file)
@@ -119,28 +119,6 @@ nv04_screen_is_format_supported(struct pipe_screen *screen,
        return FALSE;
 }
 
-static void *
-nv04_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
-                unsigned flags )
-{
-       void *map;
-       struct nv04_miptree *nv04mt = (struct nv04_miptree *)surface->texture;
-
-       map = pipe_buffer_map(screen, nv04mt->buffer, flags);
-       if (!map)
-               return NULL;
-
-       return map + surface->offset;
-}
-
-static void
-nv04_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
-{
-       struct nv04_miptree *nv04mt = (struct nv04_miptree *)surface->texture;
-
-       pipe_buffer_unmap(screen, nv04mt->buffer);
-}
-
 static void
 nv04_screen_destroy(struct pipe_screen *pscreen)
 {
@@ -226,10 +204,8 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 
        screen->pipe.is_format_supported = nv04_screen_is_format_supported;
 
-       screen->pipe.surface_map = nv04_surface_map;
-       screen->pipe.surface_unmap = nv04_surface_unmap;
-
        nv04_screen_init_miptree_functions(&screen->pipe);
+       nv04_screen_init_transfer_functions(&screen->pipe);
        u_simple_screen_init(&screen->pipe);
 
        return &screen->pipe;
index 540aec907bf1fd899763302f5f68351e3ae9f116..ee6fb6db44a2aed3c8fc45dfbc0f0c5b840243b1 100644 (file)
@@ -24,4 +24,7 @@ nv04_screen(struct pipe_screen *screen)
        return (struct nv04_screen *)screen;
 }
 
+void
+nv04_screen_init_transfer_functions(struct pipe_screen *pscreen);
+
 #endif
index 15d4685ec1a870dc5f300bf326b6f09764ed8f94..0d51439e3ffc9f4df2476562c96b37ffe67c1a77 100644 (file)
@@ -35,9 +35,6 @@ struct nv04_miptree {
        struct pipe_buffer *buffer;
        uint total_size;
 
-       struct pipe_texture *shadow_tex;
-       struct pipe_surface *shadow_surface;
-
        struct {
                uint pitch;
                uint image_offset;
index bd8ef1adbff38e54397da68c436091aec5ecc1e8..eb2c1c57c67dbad4b196d2618c2b8bc68df66733 100644 (file)
@@ -93,7 +93,7 @@ static void nv04_emit_sampler(struct nv04_context *nv04, int unit)
 static void nv04_state_emit_framebuffer(struct nv04_context* nv04)
 {
        struct pipe_framebuffer_state* fb = nv04->framebuffer;
-       struct pipe_surface *rt, *zeta;
+       struct nv04_surface *rt, *zeta;
        uint32_t rt_format, w, h;
        int colour_format = 0, zeta_format = 0;
        struct nv04_miptree *nv04mt = 0;
@@ -101,7 +101,7 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04)
        w = fb->cbufs[0]->width;
        h = fb->cbufs[0]->height;
        colour_format = fb->cbufs[0]->format;
-       rt = fb->cbufs[0];
+       rt = (struct nv04_surface *)fb->cbufs[0];
 
        if (fb->zsbuf) {
                if (colour_format) {
@@ -113,7 +113,7 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04)
                }
 
                zeta_format = fb->zsbuf->format;
-               zeta = fb->zsbuf;
+               zeta = (struct nv04_surface *)fb->zsbuf;
        }
 
        switch (colour_format) {
@@ -131,13 +131,13 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04)
        BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_FORMAT, 1);
        OUT_RING(rt_format);
 
-       nv04mt = (struct nv04_miptree *)rt->texture;
+       nv04mt = (struct nv04_miptree *)rt->base.texture;
        /* FIXME pitches have to be aligned ! */
        BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_PITCH, 2);
-       OUT_RING(rt->stride|(zeta->stride<<16));
+       OUT_RING(rt->pitch|(zeta->pitch<<16));
        OUT_RELOCl(nv04mt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
        if (fb->zsbuf) {
-               nv04mt = (struct nv04_miptree *)zeta->texture;
+               nv04mt = (struct nv04_miptree *)zeta->base.texture;
                BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA, 1);
                OUT_RELOCl(nv04mt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
        }
@@ -202,8 +202,11 @@ nv04_emit_hw_state(struct nv04_context *nv04)
         */
 
        /* Render target */
+       unsigned rt_pitch = ((struct nv04_surface *)nv04->rt)->pitch;
+       unsigned zeta_pitch = ((struct nv04_surface *)nv04->zeta)->pitch;
+
        BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_PITCH, 2);
-       OUT_RING(nv04->rt->stride|(nv04->zeta->stride<<16));
+       OUT_RING(rt_pitch|(zeta_pitch<<16));
        OUT_RELOCl(nv04->rt, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
        if (nv04->zeta) {
                BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA, 1);
index 14abf166798b08aad4f6509465f7d890ef9cb49a..0387ff4e78b4db5232bc2079678563d100d11c04 100644 (file)
@@ -33,7 +33,7 @@
 #include "util/u_tile.h"
 
 static void
-nv04_surface_copy(struct pipe_context *pipe, boolean do_flip,
+nv04_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -41,15 +41,6 @@ nv04_surface_copy(struct pipe_context *pipe, boolean do_flip,
        struct nv04_context *nv04 = nv04_context(pipe);
        struct nv04_surface_2d *eng2d = nv04->screen->eng2d;
 
-       if (do_flip) {
-               desty += height;
-               while (height--) {
-                       eng2d->copy(eng2d, dest, destx, desty--, src,
-                                   srcx, srcy++, width, 1);
-               }
-               return;
-       }
-
        eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
 }
 
index 230cfd17dd915c4f066d7657ed4210c7dcc36add..f3a8d7efeed48ecd6ab430f973c2847d7eb0f03b 100644 (file)
@@ -101,6 +101,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
        struct nouveau_grobj *sifm = ctx->sifm;
        struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
        struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
+       const unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
        const unsigned max_w = 1024;
        const unsigned max_h = 1024;
        const unsigned sub_w = w > max_w ? max_w : w;
@@ -110,6 +111,8 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
 
        /* POT or GTFO */
        assert(!(w & (w - 1)) && !(h & (h - 1)));
+       /* That's the way she likes it */
+       assert(src_pitch == ((struct nv04_surface *)dst)->pitch);
 
        BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_DMA_IMAGE, 1);
        OUT_RELOCo(chan, dst_bo,
@@ -130,7 +133,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
          for (cx = 0; cx < w; cx += sub_w) {
            BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1);
            OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(cx, cy) *
-                            dst->block.size, NOUVEAU_BO_GART |
+                            dst->texture->block.size, NOUVEAU_BO_GART |
                             NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
 
            BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9);
@@ -146,11 +149,11 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
 
            BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_SIZE, 4);
            OUT_RING  (chan, sub_h << 16 | sub_w);
-           OUT_RING  (chan, src->stride |
+           OUT_RING  (chan, src_pitch |
                             NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER |
                             NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE);
-           OUT_RELOCl(chan, src_bo, src->offset + cy * src->stride +
-                            cx * src->block.size, NOUVEAU_BO_GART |
+           OUT_RELOCl(chan, src_bo, src->offset + cy * src_pitch +
+                            cx * src->texture->block.size, NOUVEAU_BO_GART |
                             NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
            OUT_RING  (chan, 0);
          }
@@ -168,10 +171,12 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx,
        struct nouveau_grobj *m2mf = ctx->m2mf;
        struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
        struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
-       unsigned dst_offset, src_offset;
-
-       dst_offset = dst->offset + (dy * dst->stride) + (dx * dst->block.size);
-       src_offset = src->offset + (sy * src->stride) + (sx * src->block.size);
+       unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
+       unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
+       unsigned dst_offset = dst->offset + dy * dst_pitch +
+                             dx * dst->texture->block.size;
+       unsigned src_offset = src->offset + sy * src_pitch +
+                             sx * src->texture->block.size;
 
        WAIT_RING (chan, 3 + ((h / 2047) + 1) * 9);
        BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN, 2);
@@ -188,16 +193,16 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx,
                           NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD);
                OUT_RELOCl(chan, dst_bo, dst_offset,
                           NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_WR);
-               OUT_RING  (chan, src->stride);
-               OUT_RING  (chan, dst->stride);
-               OUT_RING  (chan, w * src->block.size);
+               OUT_RING  (chan, src_pitch);
+               OUT_RING  (chan, dst_pitch);
+               OUT_RING  (chan, w * src->texture->block.size);
                OUT_RING  (chan, count);
                OUT_RING  (chan, 0x0101);
                OUT_RING  (chan, 0);
 
                h -= count;
-               src_offset += src->stride * count;
-               dst_offset += dst->stride * count;
+               src_offset += src_pitch * count;
+               dst_offset += dst_pitch * count;
        }
 
        return 0;
@@ -213,6 +218,8 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
        struct nouveau_grobj *blit = ctx->blit;
        struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
        struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
+       unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
+       unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
        int format;
 
        format = nv04_surface_format(dst->format);
@@ -225,7 +232,7 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
        OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
        BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_FORMAT, 4);
        OUT_RING  (chan, format);
-       OUT_RING  (chan, (dst->stride << 16) | src->stride);
+       OUT_RING  (chan, (dst_pitch << 16) | src_pitch);
        OUT_RELOCl(chan, src_bo, src->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
        OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
 
@@ -242,6 +249,8 @@ nv04_surface_copy(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
                  int dx, int dy, struct pipe_surface *src, int sx, int sy,
                  int w, int h)
 {
+       unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
+       unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
        int src_linear = src->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR;
        int dst_linear = dst->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR;
 
@@ -257,7 +266,8 @@ nv04_surface_copy(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
         * to NV_MEMORY_TO_MEMORY_FORMAT in this case.
         */
        if ((src->offset & 63) || (dst->offset & 63) ||
-           (src->stride & 63) || (dst->stride & 63)) {
+           (src_pitch & 63) || (dst_pitch & 63) ||
+           debug_get_bool_option("NOUVEAU_NO_COPYBLIT", FALSE)) {
                nv04_surface_copy_m2mf(ctx, dst, dx, dy, src, sx, sy, w, h);
                return;
        }
@@ -273,6 +283,7 @@ nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
        struct nouveau_grobj *surf2d = ctx->surf2d;
        struct nouveau_grobj *rect = ctx->rect;
        struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
+       unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
        int cs2d_format, gdirect_format;
 
        cs2d_format = nv04_surface_format(dst->format);
@@ -287,7 +298,7 @@ nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
        OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
        BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_FORMAT, 4);
        OUT_RING  (chan, cs2d_format);
-       OUT_RING  (chan, (dst->stride << 16) | dst->stride);
+       OUT_RING  (chan, (dst_pitch << 16) | dst_pitch);
        OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
        OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
 
@@ -426,13 +437,21 @@ nv04_surface_2d_init(struct nouveau_winsys *nvws)
                return NULL;
        }
 
-       if (chan->device->chipset < 0x10) {
-               class = NV04_SCALED_IMAGE_FROM_MEMORY;
-       } else
-       if (chan->device->chipset < 0x40) {
+       switch (chan->device->chipset & 0xf0) {
+       case 0x10:
+       case 0x20:
                class = NV10_SCALED_IMAGE_FROM_MEMORY;
-       } else {
+               break;
+       case 0x30:
+               class = NV30_SCALED_IMAGE_FROM_MEMORY;
+               break;
+       case 0x40:
+       case 0x60:
                class = NV40_SCALED_IMAGE_FROM_MEMORY;
+               break;
+       default:
+               class = NV04_SCALED_IMAGE_FROM_MEMORY;
+               break;
        }
 
        ret = nouveau_grobj_alloc(chan, handle++, class, &ctx->sifm);
index 21b8f8696063e7963e858fb358b581a6a73e111d..82ce7189c8bf5f9e7fa281455e34574ed40759a7 100644 (file)
@@ -1,6 +1,11 @@
 #ifndef __NV04_SURFACE_2D_H__
 #define __NV04_SURFACE_2D_H__
 
+struct nv04_surface {
+       struct pipe_surface base;
+       unsigned pitch;
+};
+
 struct nv04_surface_2d {
        struct nouveau_winsys *nvws;
        struct nouveau_notifier *ntfy;
diff --git a/src/gallium/drivers/nv04/nv04_transfer.c b/src/gallium/drivers/nv04/nv04_transfer.c
new file mode 100644 (file)
index 0000000..e925a44
--- /dev/null
@@ -0,0 +1,196 @@
+#include <pipe/p_state.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
+#include <nouveau/nouveau_winsys.h>
+#include "nv04_context.h"
+#include "nv04_screen.h"
+#include "nv04_state.h"
+
+struct nv04_transfer {
+       struct pipe_transfer base;
+       struct pipe_surface *surface;
+       bool direct;
+};
+
+static unsigned nv04_usage_tx_to_buf(unsigned tx_usage)
+{
+       switch (tx_usage) {
+               case PIPE_TRANSFER_READ:
+                       return PIPE_BUFFER_USAGE_CPU_READ;
+               case PIPE_TRANSFER_WRITE:
+                       return PIPE_BUFFER_USAGE_CPU_WRITE;
+               case PIPE_TRANSFER_READ_WRITE:
+                       return PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+               default:
+                       assert(0);
+       }
+
+       return -1;
+}
+
+static void
+nv04_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
+                             struct pipe_texture *template)
+{
+       memset(template, 0, sizeof(struct pipe_texture));
+       template->target = pt->target;
+       template->format = pt->format;
+       template->width[0] = pt->width[level];
+       template->height[0] = pt->height[level];
+       template->depth[0] = 1;
+       template->block = pt->block;
+       template->nblocksx[0] = pt->nblocksx[level];
+       template->nblocksy[0] = pt->nblocksx[level];
+       template->last_level = 0;
+       template->compressed = pt->compressed;
+       template->nr_samples = pt->nr_samples;
+
+       template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
+                             NOUVEAU_TEXTURE_USAGE_LINEAR;
+}
+
+static struct pipe_transfer *
+nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+                 unsigned face, unsigned level, unsigned zslice,
+                 enum pipe_transfer_usage usage,
+                 unsigned x, unsigned y, unsigned w, unsigned h)
+{
+       struct nv04_miptree *mt = (struct nv04_miptree *)pt;
+       struct nv04_transfer *tx;
+       struct pipe_texture tx_tex_template, *tx_tex;
+
+       tx = CALLOC_STRUCT(nv04_transfer);
+       if (!tx)
+               return NULL;
+
+       pipe_texture_reference(&tx->base.texture, pt);
+       tx->base.format = pt->format;
+       tx->base.x = x;
+       tx->base.y = y;
+       tx->base.width = w;
+       tx->base.height = h;
+       tx->base.block = pt->block;
+       tx->base.nblocksx = pt->nblocksx[level];
+       tx->base.nblocksy = pt->nblocksy[level];
+       tx->base.stride = mt->level[level].pitch;
+       tx->base.usage = usage;
+       tx->base.face = face;
+       tx->base.level = level;
+       tx->base.zslice = zslice;
+
+       /* Direct access to texture */
+       if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
+            debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+           pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
+       {
+               tx->direct = true;
+               tx->surface = pscreen->get_tex_surface(pscreen, pt,
+                                                      0, 0, 0,
+                                                      nv04_usage_tx_to_buf(usage));
+               return &tx->base;
+       }
+
+       tx->direct = false;
+
+       nv04_compatible_transfer_tex(pt, level, &tx_tex_template);
+
+       tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
+       if (!tx_tex)
+       {
+               FREE(tx);
+               return NULL;
+       }
+
+       tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
+                                              face, level, zslice,
+                                              nv04_usage_tx_to_buf(usage));
+
+       pipe_texture_reference(&tx_tex, NULL);
+
+       if (!tx->surface)
+       {
+               pipe_surface_reference(&tx->surface, NULL);
+               FREE(tx);
+               return NULL;
+       }
+
+       if (usage != PIPE_TRANSFER_WRITE) {
+               struct nv04_screen *nvscreen = nv04_screen(pscreen);
+               struct pipe_surface *src;
+
+               src = pscreen->get_tex_surface(pscreen, pt,
+                                              face, level, zslice,
+                                              PIPE_BUFFER_USAGE_GPU_READ);
+
+               /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+               /* TODO: Check if SIFM can un-swizzle */
+               nvscreen->eng2d->copy(nvscreen->eng2d,
+                                     tx->surface, 0, 0,
+                                     src, 0, 0,
+                                     src->width, src->height);
+
+               pipe_surface_reference(&src, NULL);
+       }
+
+       return &tx->base;
+}
+
+static void
+nv04_transfer_del(struct pipe_transfer *ptx)
+{
+       struct nv04_transfer *tx = (struct nv04_transfer *)ptx;
+
+       if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) {
+               struct pipe_screen *pscreen = ptx->texture->screen;
+               struct nv04_screen *nvscreen = nv04_screen(pscreen);
+               struct pipe_surface *dst;
+
+               dst = pscreen->get_tex_surface(pscreen, ptx->texture,
+                                              ptx->face, ptx->level, ptx->zslice,
+                                              PIPE_BUFFER_USAGE_GPU_WRITE);
+
+               /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+               nvscreen->eng2d->copy(nvscreen->eng2d,
+                                     dst, 0, 0,
+                                     tx->surface, 0, 0,
+                                     dst->width, dst->height);
+
+               pipe_surface_reference(&dst, NULL);
+       }
+
+       pipe_surface_reference(&tx->surface, NULL);
+       pipe_texture_reference(&ptx->texture, NULL);
+       FREE(ptx);
+}
+
+static void *
+nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv04_transfer *tx = (struct nv04_transfer *)ptx;
+       struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
+       struct nv04_miptree *mt = (struct nv04_miptree *)tx->surface->texture;
+       void *map = pipe_buffer_map(pscreen, mt->buffer,
+                                   nv04_usage_tx_to_buf(ptx->usage));
+
+       return map + ns->base.offset +
+              ptx->y * ns->pitch + ptx->x * ptx->block.size;
+}
+
+static void
+nv04_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv04_transfer *tx = (struct nv04_transfer *)ptx;
+       struct nv04_miptree *mt = (struct nv04_miptree *)tx->surface->texture;
+
+       pipe_buffer_unmap(pscreen, mt->buffer);
+}
+
+void
+nv04_screen_init_transfer_functions(struct pipe_screen *pscreen)
+{
+       pscreen->get_tex_transfer = nv04_transfer_new;
+       pscreen->tex_transfer_destroy = nv04_transfer_del;
+       pscreen->transfer_map = nv04_transfer_map;
+       pscreen->transfer_unmap = nv04_transfer_unmap;
+}
index 4ba7ce586d6c995d6cd37edac957d504ef1f3e62..62677f5194a35dc4b9759de7a8b0a74b47134b4d 100644 (file)
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv10
 
-DRIVER_SOURCES = \
+C_SOURCES = \
        nv10_clear.c \
        nv10_context.c \
        nv10_fragprog.c \
@@ -14,15 +14,7 @@ DRIVER_SOURCES = \
        nv10_state.c \
        nv10_state_emit.c \
        nv10_surface.c \
+       nv10_transfer.c \
        nv10_vbo.c
 
-C_SOURCES = \
-       $(COMMON_SOURCES) \
-       $(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
index 9616135461792c4a433465034f8b91419d09a0e6..bb3a1c0f19e83ba74e065813bdd5dc17fcb10f10 100644 (file)
@@ -66,31 +66,30 @@ nv10_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
                return NULL;
 
        mt->base = *pt;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = pscreen;
        mt->level[0].pitch = stride[0];
        mt->level[0].image_offset = CALLOC(1, sizeof(unsigned));
 
-       pipe_buffer_reference(pscreen, &mt->buffer, pb);
+       pipe_buffer_reference(&mt->buffer, pb);
        return &mt->base;
 }
 
 static struct pipe_texture *
 nv10_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
 {
-       struct pipe_winsys *ws = screen->winsys;
        struct nv10_miptree *mt;
 
        mt = MALLOC(sizeof(struct nv10_miptree));
        if (!mt)
                return NULL;
        mt->base = *pt;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = screen;
 
        nv10_miptree_layout(mt);
 
-       mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL,
+       mt->buffer = screen->buffer_create(screen, 256, PIPE_BUFFER_USAGE_PIXEL,
                                           mt->total_size);
        if (!mt->buffer) {
                FREE(mt);
@@ -101,22 +100,17 @@ nv10_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
 }
 
 static void
-nv10_miptree_release(struct pipe_screen *screen, struct pipe_texture **pt)
+nv10_miptree_destroy(struct pipe_texture *pt)
 {
-       struct pipe_texture *mt = *pt;
-
-       *pt = NULL;
-       if (--mt->refcount <= 0) {
-               struct nv10_miptree *nv10mt = (struct nv10_miptree *)mt;
-               int l;
-
-               pipe_buffer_reference(screen, &nv10mt->buffer, NULL);
-               for (l = 0; l <= mt->last_level; l++) {
-                       if (nv10mt->level[l].image_offset)
-                               FREE(nv10mt->level[l].image_offset);
-               }
-               FREE(nv10mt);
-       }
+       struct nv10_miptree *nv10mt = (struct nv10_miptree *)pt;
+        int l;
+
+        pipe_buffer_reference(&nv10mt->buffer, NULL);
+        for (l = 0; l <= pt->last_level; l++) {
+               if (nv10mt->level[l].image_offset)
+                       FREE(nv10mt->level[l].image_offset);
+        }
+        FREE(nv10mt);
 }
 
 static void
@@ -131,35 +125,35 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
                         unsigned face, unsigned level, unsigned zslice,
                         unsigned flags)
 {
-       struct pipe_winsys *ws = screen->winsys;
        struct nv10_miptree *nv10mt = (struct nv10_miptree *)pt;
-       struct pipe_surface *ps;
+       struct nv04_surface *ns;
 
-       ps = CALLOC_STRUCT(pipe_surface);
-       if (!ps)
+       ns = CALLOC_STRUCT(nv04_surface);
+       if (!ns)
                return NULL;
-       pipe_texture_reference(&ps->texture, pt);
-       ps->format = pt->format;
-       ps->width = pt->width[level];
-       ps->height = pt->height[level];
-       ps->block = pt->block;
-       ps->nblocksx = pt->nblocksx[level];
-       ps->nblocksy = pt->nblocksy[level];
-       ps->stride = nv10mt->level[level].pitch;
-       ps->refcount = 1;
+       pipe_texture_reference(&ns->base.texture, pt);
+       ns->base.format = pt->format;
+       ns->base.width = pt->width[level];
+       ns->base.height = pt->height[level];
+       ns->base.usage = flags;
+       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
+       pipe_reference_init(&ns->base.reference, 1);
+       ns->base.face = face;
+       ns->base.level = level;
+       ns->base.zslice = zslice;
+       ns->pitch = nv10mt->level[level].pitch;
 
        if (pt->target == PIPE_TEXTURE_CUBE) {
-               ps->offset = nv10mt->level[level].image_offset[face];
+               ns->base.offset = nv10mt->level[level].image_offset[face];
        } else {
-               ps->offset = nv10mt->level[level].image_offset[0];
+               ns->base.offset = nv10mt->level[level].image_offset[0];
        }
 
-       return ps;
+       return &ns->base;
 }
 
 static void
-nv10_miptree_surface_release(struct pipe_screen *screen,
-                            struct pipe_surface **surface)
+nv10_miptree_surface_destroy(struct pipe_surface *surface)
 {
 }
 
@@ -167,8 +161,8 @@ void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen)
 {
        pscreen->texture_create = nv10_miptree_create;
        pscreen->texture_blanket = nv10_miptree_blanket;
-       pscreen->texture_release = nv10_miptree_release;
+       pscreen->texture_destroy = nv10_miptree_destroy;
        pscreen->get_tex_surface = nv10_miptree_surface_get;
-       pscreen->tex_surface_release = nv10_miptree_surface_release;
+       pscreen->tex_surface_destroy = nv10_miptree_surface_destroy;
 }
 
index 7435d873154d311b7b18d6add6c010255cfe7582..089c236302a5c02d637581b823a8132cce028248 100644 (file)
@@ -38,7 +38,7 @@
  */
 
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_inlines.h"
 #include "pipe/internal/p_winsys_screen.h"
 
@@ -99,27 +99,50 @@ nv10_vbuf_render_get_vertex_info( struct vbuf_render *render )
        return &nv10->vertex_info;
 }
 
-
-static void *
+static boolean
 nv10_vbuf_render_allocate_vertices( struct vbuf_render *render,
                ushort vertex_size,
                ushort nr_vertices )
 {
        struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render);
        struct nv10_context *nv10 = nv10_render->nv10;
-       struct pipe_winsys *winsys = nv10->pipe.winsys;
+       struct pipe_screen *screen = nv10->pipe.screen;
        size_t size = (size_t)vertex_size * (size_t)nr_vertices;
 
        assert(!nv10_render->buffer);
-       nv10_render->buffer = winsys->buffer_create(winsys, 64, PIPE_BUFFER_USAGE_VERTEX, size);
+       nv10_render->buffer = screen->buffer_create(screen, 64, PIPE_BUFFER_USAGE_VERTEX, size);
 
        nv10->dirty |= NV10_NEW_VTXARRAYS;
 
+       if (nv10_render->buffer)
+               return FALSE;
+       return TRUE;
+}
+
+static void *
+nv10_vbuf_render_map_vertices( struct vbuf_render *render )
+{
+       struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render);
+       struct nv10_context *nv10 = nv10_render->nv10;
+       struct pipe_winsys *winsys = nv10->pipe.winsys;
+
        return winsys->buffer_map(winsys, 
                        nv10_render->buffer, 
                        PIPE_BUFFER_USAGE_CPU_WRITE);
 }
 
+static void
+nv10_vbuf_render_unmap_vertices( struct vbuf_render *render,
+               ushort min_index,
+               ushort max_index )
+{
+       struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render);
+       struct nv10_context *nv10 = nv10_render->nv10;
+       struct pipe_winsys *winsys = nv10->pipe.winsys;
+
+       assert(!nv10_render->buffer);
+       winsys->buffer_unmap(winsys, nv10_render->buffer);
+}
 
 static boolean
 nv10_vbuf_render_set_primitive( struct vbuf_render *render, 
@@ -176,19 +199,14 @@ nv10_vbuf_render_draw( struct vbuf_render *render,
 
 
 static void
-nv10_vbuf_render_release_vertices( struct vbuf_render *render,
-               void *vertices, 
-               unsigned vertex_size,
-               unsigned vertices_used )
+nv10_vbuf_render_release_vertices( struct vbuf_render *render )
 {
        struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render);
        struct nv10_context *nv10 = nv10_render->nv10;
-       struct pipe_winsys *winsys = nv10->pipe.winsys;
        struct pipe_screen *pscreen = &nv10->screen->pipe;
 
        assert(nv10_render->buffer);
-       winsys->buffer_unmap(winsys, nv10_render->buffer);
-       pipe_buffer_reference(pscreen, &nv10_render->buffer, NULL);
+       pipe_buffer_reference(&nv10_render->buffer, NULL);
 }
 
 
@@ -214,6 +232,8 @@ nv10_vbuf_render_create( struct nv10_context *nv10 )
        nv10_render->base.max_indices = 1024;
        nv10_render->base.get_vertex_info = nv10_vbuf_render_get_vertex_info;
        nv10_render->base.allocate_vertices = nv10_vbuf_render_allocate_vertices;
+       nv10_render->base.map_vertices = nv10_vbuf_render_map_vertices;
+       nv10_render->base.unmap_vertices = nv10_vbuf_render_unmap_vertices;
        nv10_render->base.set_primitive = nv10_vbuf_render_set_primitive;
        nv10_render->base.draw = nv10_vbuf_render_draw;
        nv10_render->base.release_vertices = nv10_vbuf_render_release_vertices;
index f417b06c944e68e3a9d37e63fcb87508eac2520b..6532a93c7ba10de5860fc390813b5d54483a8649 100644 (file)
@@ -116,30 +116,6 @@ nv10_screen_is_format_supported(struct pipe_screen *screen,
        return FALSE;
 }
 
-static void *
-nv10_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
-                unsigned flags )
-{
-       struct pipe_winsys *ws = screen->winsys;
-       void *map;
-        struct nv10_miptree *nv10mt = (struct nv10_miptree *)surface->texture;
-
-       map = ws->buffer_map(ws, nv10mt->buffer, flags);
-       if (!map)
-               return NULL;
-
-       return map + surface->offset;
-}
-
-static void
-nv10_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
-{
-       struct pipe_winsys *ws = screen->winsys;
-        struct nv10_miptree *nv10mt = (struct nv10_miptree *)surface->texture;
-
-       ws->buffer_unmap(ws, nv10mt->buffer);
-}
-
 static void
 nv10_screen_destroy(struct pipe_screen *pscreen)
 {
@@ -215,10 +191,8 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 
        screen->pipe.is_format_supported = nv10_screen_is_format_supported;
 
-       screen->pipe.surface_map = nv10_surface_map;
-       screen->pipe.surface_unmap = nv10_surface_unmap;
-
        nv10_screen_init_miptree_functions(&screen->pipe);
+       nv10_screen_init_transfer_functions(&screen->pipe);
        u_simple_screen_init(&screen->pipe);
 
        return &screen->pipe;
index 60102a369a94f2a545e43e06c2ecc3db7b179156..ad829ee3fd4d9b68a81eb1e905aceb75c4c67f84 100644 (file)
@@ -21,4 +21,8 @@ nv10_screen(struct pipe_screen *screen)
        return (struct nv10_screen *)screen;
 }
 
+
+void
+nv10_screen_init_transfer_functions(struct pipe_screen *pscreen);
+
 #endif
index 5dec618b9333202657505f2dddfdcfb884f8279e..d8691ef9c67ebdaed9872953914a307dba87658a 100644 (file)
@@ -103,7 +103,7 @@ static void nv10_state_emit_scissor(struct nv10_context* nv10)
 static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
 {
        struct pipe_framebuffer_state* fb = nv10->framebuffer;
-       struct pipe_surface *rt, *zeta = NULL;
+       struct nv04_surface *rt, *zeta = NULL;
        uint32_t rt_format, w, h;
        int colour_format = 0, zeta_format = 0;
         struct nv10_miptree *nv10mt = 0;
@@ -111,7 +111,7 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
        w = fb->cbufs[0]->width;
        h = fb->cbufs[0]->height;
        colour_format = fb->cbufs[0]->format;
-       rt = fb->cbufs[0];
+       rt = (struct nv04_surface *)fb->cbufs[0];
 
        if (fb->zsbuf) {
                if (colour_format) {
@@ -123,7 +123,7 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
                }
 
                zeta_format = fb->zsbuf->format;
-               zeta = fb->zsbuf;
+               zeta = (struct nv04_surface *)fb->zsbuf;
        }
 
        rt_format = NV10TCL_RT_FORMAT_TYPE_LINEAR;
@@ -142,18 +142,18 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
 
        if (zeta) {
                BEGIN_RING(celsius, NV10TCL_RT_PITCH, 1);
-               OUT_RING  (rt->stride | (zeta->stride << 16));
+               OUT_RING  (rt->pitch | (zeta->pitch << 16));
        } else {
                BEGIN_RING(celsius, NV10TCL_RT_PITCH, 1);
-               OUT_RING  (rt->stride | (rt->stride << 16));
+               OUT_RING  (rt->pitch | (rt->pitch << 16));
        }
 
-       nv10mt = (struct nv10_miptree *)rt->texture;
+       nv10mt = (struct nv10_miptree *)rt->base.texture;
        nv10->rt[0] = nv10mt->buffer;
 
        if (zeta_format)
        {
-               nv10mt = (struct nv10_miptree *)zeta->texture;
+               nv10mt = (struct nv10_miptree *)zeta->base.texture;
                nv10->zeta = nv10mt->buffer;
        }
 
index 253815106383871cd48221dc78c05956e7b7b564..5b52246a9caa4bd41df50fef03e09555c1ecb230 100644 (file)
@@ -33,7 +33,7 @@
 #include "util/u_tile.h"
 
 static void
-nv10_surface_copy(struct pipe_context *pipe, boolean do_flip,
+nv10_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -41,15 +41,6 @@ nv10_surface_copy(struct pipe_context *pipe, boolean do_flip,
        struct nv10_context *nv10 = nv10_context(pipe);
        struct nv04_surface_2d *eng2d = nv10->screen->eng2d;
 
-       if (do_flip) {
-               desty += height;
-               while (height--) {
-                       eng2d->copy(eng2d, dest, destx, desty--, src,
-                                   srcx, srcy++, width, 1);
-               }
-               return;
-       }
-
        eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
 }
 
diff --git a/src/gallium/drivers/nv10/nv10_transfer.c b/src/gallium/drivers/nv10/nv10_transfer.c
new file mode 100644 (file)
index 0000000..5a99225
--- /dev/null
@@ -0,0 +1,196 @@
+#include <pipe/p_state.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
+#include <nouveau/nouveau_winsys.h>
+#include "nv10_context.h"
+#include "nv10_screen.h"
+#include "nv10_state.h"
+
+struct nv10_transfer {
+       struct pipe_transfer base;
+       struct pipe_surface *surface;
+       bool direct;
+};
+
+static unsigned nv10_usage_tx_to_buf(unsigned tx_usage)
+{
+       switch (tx_usage) {
+               case PIPE_TRANSFER_READ:
+                       return PIPE_BUFFER_USAGE_CPU_READ;
+               case PIPE_TRANSFER_WRITE:
+                       return PIPE_BUFFER_USAGE_CPU_WRITE;
+               case PIPE_TRANSFER_READ_WRITE:
+                       return PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+               default:
+                       assert(0);
+       }
+
+       return -1;
+}
+
+static void
+nv10_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
+                             struct pipe_texture *template)
+{
+       memset(template, 0, sizeof(struct pipe_texture));
+       template->target = pt->target;
+       template->format = pt->format;
+       template->width[0] = pt->width[level];
+       template->height[0] = pt->height[level];
+       template->depth[0] = 1;
+       template->block = pt->block;
+       template->nblocksx[0] = pt->nblocksx[level];
+       template->nblocksy[0] = pt->nblocksx[level];
+       template->last_level = 0;
+       template->compressed = pt->compressed;
+       template->nr_samples = pt->nr_samples;
+
+       template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
+                             NOUVEAU_TEXTURE_USAGE_LINEAR;
+}
+
+static struct pipe_transfer *
+nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+                 unsigned face, unsigned level, unsigned zslice,
+                 enum pipe_transfer_usage usage,
+                 unsigned x, unsigned y, unsigned w, unsigned h)
+{
+       struct nv10_miptree *mt = (struct nv10_miptree *)pt;
+       struct nv10_transfer *tx;
+       struct pipe_texture tx_tex_template, *tx_tex;
+
+       tx = CALLOC_STRUCT(nv10_transfer);
+       if (!tx)
+               return NULL;
+
+       pipe_texture_reference(&tx->base.texture, pt);
+       tx->base.format = pt->format;
+       tx->base.x = x;
+       tx->base.y = y;
+       tx->base.width = w;
+       tx->base.height = h;
+       tx->base.block = pt->block;
+       tx->base.nblocksx = pt->nblocksx[level];
+       tx->base.nblocksy = pt->nblocksy[level];
+       tx->base.stride = mt->level[level].pitch;
+       tx->base.usage = usage;
+       tx->base.face = face;
+       tx->base.level = level;
+       tx->base.zslice = zslice;
+
+       /* Direct access to texture */
+       if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
+            debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+           pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
+       {
+               tx->direct = true;
+               tx->surface = pscreen->get_tex_surface(pscreen, pt,
+                                                      0, 0, 0,
+                                                      nv10_usage_tx_to_buf(usage));
+               return &tx->base;
+       }
+
+       tx->direct = false;
+
+       nv10_compatible_transfer_tex(pt, level, &tx_tex_template);
+
+       tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
+       if (!tx_tex)
+       {
+               FREE(tx);
+               return NULL;
+       }
+
+       tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
+                                              face, level, zslice,
+                                              nv10_usage_tx_to_buf(usage));
+
+       pipe_texture_reference(&tx_tex, NULL);
+
+       if (!tx->surface)
+       {
+               pipe_surface_reference(&tx->surface, NULL);
+               FREE(tx);
+               return NULL;
+       }
+
+       if (usage != PIPE_TRANSFER_WRITE) {
+               struct nv10_screen *nvscreen = nv10_screen(pscreen);
+               struct pipe_surface *src;
+
+               src = pscreen->get_tex_surface(pscreen, pt,
+                                              face, level, zslice,
+                                              PIPE_BUFFER_USAGE_GPU_READ);
+
+               /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+               /* TODO: Check if SIFM can un-swizzle */
+               nvscreen->eng2d->copy(nvscreen->eng2d,
+                                     tx->surface, 0, 0,
+                                     src, 0, 0,
+                                     src->width, src->height);
+
+               pipe_surface_reference(&src, NULL);
+       }
+
+       return &tx->base;
+}
+
+static void
+nv10_transfer_del(struct pipe_transfer *ptx)
+{
+       struct nv10_transfer *tx = (struct nv10_transfer *)ptx;
+
+       if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) {
+               struct pipe_screen *pscreen = ptx->texture->screen;
+               struct nv10_screen *nvscreen = nv10_screen(pscreen);
+               struct pipe_surface *dst;
+
+               dst = pscreen->get_tex_surface(pscreen, ptx->texture,
+                                              ptx->face, ptx->level, ptx->zslice,
+                                              PIPE_BUFFER_USAGE_GPU_WRITE);
+
+               /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+               nvscreen->eng2d->copy(nvscreen->eng2d,
+                                     dst, 0, 0,
+                                     tx->surface, 0, 0,
+                                     dst->width, dst->height);
+
+               pipe_surface_reference(&dst, NULL);
+       }
+
+       pipe_surface_reference(&tx->surface, NULL);
+       pipe_texture_reference(&ptx->texture, NULL);
+       FREE(ptx);
+}
+
+static void *
+nv10_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv10_transfer *tx = (struct nv10_transfer *)ptx;
+       struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
+       struct nv10_miptree *mt = (struct nv10_miptree *)tx->surface->texture;
+       void *map = pipe_buffer_map(pscreen, mt->buffer,
+                                   nv10_usage_tx_to_buf(ptx->usage));
+
+       return map + ns->base.offset +
+              ptx->y * ns->pitch + ptx->x * ptx->block.size;
+}
+
+static void
+nv10_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv10_transfer *tx = (struct nv10_transfer *)ptx;
+       struct nv10_miptree *mt = (struct nv10_miptree *)tx->surface->texture;
+
+       pipe_buffer_unmap(pscreen, mt->buffer);
+}
+
+void
+nv10_screen_init_transfer_functions(struct pipe_screen *pscreen)
+{
+       pscreen->get_tex_transfer = nv10_transfer_new;
+       pscreen->tex_transfer_destroy = nv10_transfer_del;
+       pscreen->transfer_map = nv10_transfer_map;
+       pscreen->transfer_unmap = nv10_transfer_unmap;
+}
index d777fd3d8b4825ad68c292119840ad92333bada5..1305f26c5911260c72e2d04a2840e536d106740a 100644 (file)
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv20
 
-DRIVER_SOURCES = \
+C_SOURCES = \
        nv20_clear.c \
        nv20_context.c \
        nv20_fragprog.c \
@@ -14,16 +14,8 @@ DRIVER_SOURCES = \
        nv20_state.c \
        nv20_state_emit.c \
        nv20_surface.c \
+       nv20_transfer.c \
        nv20_vbo.c
 #      nv20_vertprog.c
 
-C_SOURCES = \
-       $(COMMON_SOURCES) \
-       $(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
index ef7e9c5428ed9a2ee31a0a25fdd77db22da98b60..b2f29aff8d28a5d54231ec322f87f4d798d3e383 100644 (file)
@@ -9,10 +9,14 @@ static void
 nv20_miptree_layout(struct nv20_miptree *nv20mt)
 {
        struct pipe_texture *pt = &nv20mt->base;
-       boolean swizzled = FALSE;
        uint width = pt->width[0], height = pt->height[0];
        uint offset = 0;
        int nr_faces, l, f;
+       uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER |
+                                          PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
+                                          PIPE_TEXTURE_USAGE_RENDER_TARGET |
+                                          PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+                                          PIPE_TEXTURE_USAGE_PRIMARY);
 
        if (pt->target == PIPE_TEXTURE_CUBE) {
                nr_faces = 6;
@@ -26,25 +30,31 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt)
                pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
                pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
 
-               if (swizzled)
-                       nv20mt->level[l].pitch = pt->nblocksx[l] * pt->block.size;
+               if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
+                       nv20mt->level[l].pitch = align(pt->width[0] * pt->block.size, 64);
                else
-                       nv20mt->level[l].pitch = pt->nblocksx[0] * pt->block.size;
-               nv20mt->level[l].pitch = (nv20mt->level[l].pitch + 63) & ~63;
+                       nv20mt->level[l].pitch = pt->width[l] * pt->block.size;
 
                nv20mt->level[l].image_offset =
                        CALLOC(nr_faces, sizeof(unsigned));
 
                width  = MAX2(1, width  >> 1);
                height = MAX2(1, height >> 1);
-
        }
 
        for (f = 0; f < nr_faces; f++) {
-               for (l = 0; l <= pt->last_level; l++) {
+               for (l = 0; l < pt->last_level; l++) {
                        nv20mt->level[l].image_offset[f] = offset;
-                       offset += nv20mt->level[l].pitch * pt->height[l];
+
+                       if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) &&
+                           pt->width[l + 1] > 1 && pt->height[l + 1] > 1)
+                               offset += align(nv20mt->level[l].pitch * pt->height[l], 64);
+                       else
+                               offset += nv20mt->level[l].pitch * pt->height[l];
                }
+
+               nv20mt->level[l].image_offset[f] = offset;
+               offset += nv20mt->level[l].pitch * pt->height[l];
        }
 
        nv20mt->total_size = offset;
@@ -66,19 +76,18 @@ nv20_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
                return NULL;
 
        mt->base = *pt;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = pscreen;
        mt->level[0].pitch = stride[0];
        mt->level[0].image_offset = CALLOC(1, sizeof(unsigned));
 
-       pipe_buffer_reference(pscreen, &mt->buffer, pb);
+       pipe_buffer_reference(&mt->buffer, pb);
        return &mt->base;
 }
 
 static struct pipe_texture *
 nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
 {
-       struct pipe_winsys *ws = screen->winsys;
        struct nv20_miptree *mt;
        unsigned buf_usage = PIPE_BUFFER_USAGE_PIXEL |
                             NOUVEAU_BUFFER_USAGE_TEXTURE;
@@ -87,7 +96,7 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
        if (!mt)
                return NULL;
        mt->base = *pt;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = screen;
 
        /* Swizzled textures must be POT */
@@ -96,7 +105,8 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
                mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
        else
        if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
-                            PIPE_TEXTURE_USAGE_DISPLAY_TARGET))
+                            PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+                            PIPE_TEXTURE_USAGE_DEPTH_STENCIL))
                mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
        else
        if (pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC)
@@ -107,7 +117,11 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
                case PIPE_FORMAT_A8R8G8B8_UNORM:
                case PIPE_FORMAT_X8R8G8B8_UNORM:
                case PIPE_FORMAT_R16_SNORM:
+               {
+                       if (debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE))
+                               mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
                        break;
+               }
                default:
                        mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
                }
@@ -118,7 +132,7 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
 
        nv20_miptree_layout(mt);
 
-       mt->buffer = ws->buffer_create(ws, 256, buf_usage, mt->total_size);
+       mt->buffer = screen->buffer_create(screen, 256, buf_usage, mt->total_size);
        if (!mt->buffer) {
                FREE(mt);
                return NULL;
@@ -128,22 +142,16 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
 }
 
 static void
-nv20_miptree_release(struct pipe_screen *screen, struct pipe_texture **pt)
+nv20_miptree_destroy(struct pipe_texture *pt)
 {
-       struct pipe_texture *mt = *pt;
-
-       *pt = NULL;
-       if (--mt->refcount <= 0) {
-               struct nv20_miptree *nv20mt = (struct nv20_miptree *)mt;
-               int l;
+       struct nv20_miptree *nv20mt = (struct nv20_miptree *)pt;
+        int l;
 
-               pipe_buffer_reference(screen, &nv20mt->buffer, NULL);
-               for (l = 0; l <= mt->last_level; l++) {
-                       if (nv20mt->level[l].image_offset)
-                               FREE(nv20mt->level[l].image_offset);
-               }
-               FREE(nv20mt);
-       }
+        pipe_buffer_reference(&nv20mt->buffer, NULL);
+        for (l = 0; l <= pt->last_level; l++) {
+               if (nv20mt->level[l].image_offset)
+                       FREE(nv20mt->level[l].image_offset);
+        }
 }
 
 static struct pipe_surface *
@@ -152,45 +160,38 @@ nv20_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
                         unsigned flags)
 {
        struct nv20_miptree *nv20mt = (struct nv20_miptree *)pt;
-       struct pipe_surface *ps;
+       struct nv04_surface *ns;
 
-       ps = CALLOC_STRUCT(pipe_surface);
-       if (!ps)
+       ns = CALLOC_STRUCT(nv04_surface);
+       if (!ns)
                return NULL;
-       pipe_texture_reference(&ps->texture, pt);
-       ps->format = pt->format;
-       ps->width = pt->width[level];
-       ps->height = pt->height[level];
-       ps->block = pt->block;
-       ps->nblocksx = pt->nblocksx[level];
-       ps->nblocksy = pt->nblocksy[level];
-       ps->stride = nv20mt->level[level].pitch;
-       ps->usage = flags;
-       ps->status = PIPE_SURFACE_STATUS_DEFINED;
-       ps->refcount = 1;
+       pipe_texture_reference(&ns->base.texture, pt);
+       ns->base.format = pt->format;
+       ns->base.width = pt->width[level];
+       ns->base.height = pt->height[level];
+       ns->base.usage = flags;
+       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
+       pipe_reference_init(&ns->base.reference, 1);
+       ns->base.face = face;
+       ns->base.level = level;
+       ns->base.zslice = zslice;
+       ns->pitch = nv20mt->level[level].pitch;
 
        if (pt->target == PIPE_TEXTURE_CUBE) {
-               ps->offset = nv20mt->level[level].image_offset[face];
+               ns->base.offset = nv20mt->level[level].image_offset[face];
        } else
        if (pt->target == PIPE_TEXTURE_3D) {
-               ps->offset = nv20mt->level[level].image_offset[zslice];
+               ns->base.offset = nv20mt->level[level].image_offset[zslice];
        } else {
-               ps->offset = nv20mt->level[level].image_offset[0];
+               ns->base.offset = nv20mt->level[level].image_offset[0];
        }
 
-       return ps;
+       return &ns->base;
 }
 
 static void
-nv20_miptree_surface_release(struct pipe_screen *pscreen,
-                            struct pipe_surface **psurface)
+nv20_miptree_surface_destroy(struct pipe_surface *ps)
 {
-       struct pipe_surface *ps = *psurface;
-
-       *psurface = NULL;
-       if (--ps->refcount > 0)
-               return;
-
        pipe_texture_reference(&ps->texture, NULL);
        FREE(ps);
 }
@@ -199,8 +200,8 @@ void nv20_screen_init_miptree_functions(struct pipe_screen *pscreen)
 {
        pscreen->texture_create = nv20_miptree_create;
        pscreen->texture_blanket = nv20_miptree_blanket;
-       pscreen->texture_release = nv20_miptree_release;
+       pscreen->texture_destroy = nv20_miptree_destroy;
        pscreen->get_tex_surface = nv20_miptree_surface_get;
-       pscreen->tex_surface_release = nv20_miptree_surface_release;
+       pscreen->tex_surface_destroy = nv20_miptree_surface_destroy;
 }
 
index 4dd7052814ef6a144f4f7822d03c7e265adf3b28..8aa342cd2db5a180663d3541f32fe2378a94c1c8 100644 (file)
@@ -38,7 +38,7 @@
  */
 
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_inlines.h"
 #include "pipe/internal/p_winsys_screen.h"
 
@@ -109,18 +109,15 @@ nv20__allocate_mbuffer(struct nv20_vbuf_render *nv20_render, size_t size)
        return nv20_render->mbuffer;
 }
 
-static void *
+static void
 nv20__allocate_pbuffer(struct nv20_vbuf_render *nv20_render, size_t size)
 {
-       struct pipe_winsys *winsys = nv20_render->nv20->pipe.winsys;
-       nv20_render->pbuffer = winsys->buffer_create(winsys, 64,
+       struct pipe_screen *screen = nv20_render->nv20->pipe.screen;
+       nv20_render->pbuffer = screen->buffer_create(screen, 64,
                                        PIPE_BUFFER_USAGE_VERTEX, size);
-       return winsys->buffer_map(winsys,
-                       nv20_render->pbuffer,
-                       PIPE_BUFFER_USAGE_CPU_WRITE);
 }
 
-static void *
+static boolean
 nv20_vbuf_render_allocate_vertices( struct vbuf_render *render,
                ushort vertex_size,
                ushort nr_vertices )
@@ -137,15 +134,49 @@ nv20_vbuf_render_allocate_vertices( struct vbuf_render *render,
         * buffer, the data will be passed directly via the fifo.
         */
        /* XXX: Pipe vertex buffers don't work. */
-       if (0 && size > 16 * 1024)
-               buf = nv20__allocate_pbuffer(nv20_render, size);
-       else
+       if (0 && size > 16 * 1024) {
+               nv20__allocate_pbuffer(nv20_render, size);
+               /* umm yeah so this is ugly */
+               buf = nv20_render->pbuffer;
+       } else {
                buf = nv20__allocate_mbuffer(nv20_render, size);
+       }
 
        if (buf)
                nv20_render->nv20->dirty |= NV20_NEW_VTXARRAYS;
 
-       return buf;
+       return buf ? TRUE : FALSE;
+}
+
+static void *
+nv20_vbuf_render_map_vertices( struct vbuf_render *render )
+{
+       struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render);
+       struct pipe_winsys *winsys = nv20_render->nv20->pipe.winsys;
+
+       if (nv20_render->pbuffer) {
+               return winsys->buffer_map(winsys,
+                               nv20_render->pbuffer,
+                               PIPE_BUFFER_USAGE_CPU_WRITE);
+       } else if (nv20_render->mbuffer) {
+               return nv20_render->mbuffer;
+       } else
+               assert(0);
+
+       /* warnings be gone */
+       return NULL;
+}
+
+static void
+nv20_vbuf_render_unmap_vertices( struct vbuf_render *render,
+               ushort min_index,
+               ushort max_index )
+{
+       struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render);
+       struct pipe_winsys *winsys = nv20_render->nv20->pipe.winsys;
+
+       if (nv20_render->pbuffer)
+               winsys->buffer_unmap(winsys, nv20_render->pbuffer);
 }
 
 static boolean
@@ -323,19 +354,14 @@ nv20_vbuf_render_draw( struct vbuf_render *render,
 
 
 static void
-nv20_vbuf_render_release_vertices( struct vbuf_render *render,
-               void *vertices, 
-               unsigned vertex_size,
-               unsigned vertices_used )
+nv20_vbuf_render_release_vertices( struct vbuf_render *render )
 {
        struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render);
        struct nv20_context *nv20 = nv20_render->nv20;
-       struct pipe_winsys *winsys = nv20->pipe.winsys;
        struct pipe_screen *pscreen = &nv20->screen->pipe;
 
        if (nv20_render->pbuffer) {
-               winsys->buffer_unmap(winsys, nv20_render->pbuffer);
-               pipe_buffer_reference(pscreen, &nv20_render->pbuffer, NULL);
+               pipe_buffer_reference(&nv20_render->pbuffer, NULL);
        } else if (nv20_render->mbuffer) {
                FREE(nv20_render->mbuffer);
                nv20_render->mbuffer = NULL;
@@ -371,6 +397,8 @@ nv20_vbuf_render_create( struct nv20_context *nv20 )
        nv20_render->base.get_vertex_info = nv20_vbuf_render_get_vertex_info;
        nv20_render->base.allocate_vertices =
                                        nv20_vbuf_render_allocate_vertices;
+       nv20_render->base.map_vertices = nv20_vbuf_render_map_vertices;
+       nv20_render->base.unmap_vertices = nv20_vbuf_render_unmap_vertices;
        nv20_render->base.set_primitive = nv20_vbuf_render_set_primitive;
        nv20_render->base.draw = nv20_vbuf_render_draw;
        nv20_render->base.release_vertices = nv20_vbuf_render_release_vertices;
index 5f2b7b4f71f09677beb2daa87c911c9ab186c9d8..7760ae27c0ed566879d29b011f8343dafbf65bc9 100644 (file)
@@ -116,30 +116,6 @@ nv20_screen_is_format_supported(struct pipe_screen *screen,
        return FALSE;
 }
 
-static void *
-nv20_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
-                unsigned flags )
-{
-       struct pipe_winsys *ws = screen->winsys;
-       void *map;
-       struct nv20_miptree *nv20mt = (struct nv20_miptree *)surface->texture;
-
-       map = ws->buffer_map(ws, nv20mt->buffer, flags);
-       if (!map)
-               return NULL;
-
-       return map + surface->offset;
-}
-
-static void
-nv20_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
-{
-       struct pipe_winsys *ws = screen->winsys;
-       struct nv20_miptree *nv20mt = (struct nv20_miptree *)surface->texture;
-
-       ws->buffer_unmap(ws, nv20mt->buffer);
-}
-
 static void
 nv20_screen_destroy(struct pipe_screen *pscreen)
 {
@@ -211,10 +187,8 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 
        screen->pipe.is_format_supported = nv20_screen_is_format_supported;
 
-       screen->pipe.surface_map = nv20_surface_map;
-       screen->pipe.surface_unmap = nv20_surface_unmap;
-
        nv20_screen_init_miptree_functions(&screen->pipe);
+       nv20_screen_init_transfer_functions(&screen->pipe);
        u_simple_screen_init(&screen->pipe);
 
        return &screen->pipe;
index bf2f2c0d9fb64c2bbe3b77eef37c929227e80153..d9fce2bced890b282c8c6d80dd65663cb7a70454 100644 (file)
@@ -21,4 +21,8 @@ nv20_screen(struct pipe_screen *screen)
        return (struct nv20_screen *)screen;
 }
 
+
+void
+nv20_screen_init_transfer_functions(struct pipe_screen *pscreen);
+
 #endif
index 0f4df9ca317c6f46819ee3002b2a6b410160fb9c..4042f46d0530c6ad2008dbbe13f03ddcae9a1fcb 100644 (file)
@@ -109,7 +109,7 @@ static void nv20_state_emit_scissor(struct nv20_context* nv20)
 static void nv20_state_emit_framebuffer(struct nv20_context* nv20)
 {
        struct pipe_framebuffer_state* fb = nv20->framebuffer;
-       struct pipe_surface *rt, *zeta = NULL;
+       struct nv04_surface *rt, *zeta = NULL;
        uint32_t rt_format, w, h;
        int colour_format = 0, zeta_format = 0;
        struct nv20_miptree *nv20mt = 0;
@@ -117,7 +117,7 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20)
        w = fb->cbufs[0]->width;
        h = fb->cbufs[0]->height;
        colour_format = fb->cbufs[0]->format;
-       rt = fb->cbufs[0];
+       rt = (struct nv04_surface *)fb->cbufs[0];
 
        if (fb->zsbuf) {
                if (colour_format) {
@@ -129,7 +129,7 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20)
                }
 
                zeta_format = fb->zsbuf->format;
-               zeta = fb->zsbuf;
+               zeta = (struct nv04_surface *)fb->zsbuf;
        }
 
        rt_format = NV20TCL_RT_FORMAT_TYPE_LINEAR | 0x20;
@@ -148,18 +148,18 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20)
 
        if (zeta) {
                BEGIN_RING(kelvin, NV20TCL_RT_PITCH, 1);
-               OUT_RING  (rt->stride | (zeta->stride << 16));
+               OUT_RING  (rt->pitch | (zeta->pitch << 16));
        } else {
                BEGIN_RING(kelvin, NV20TCL_RT_PITCH, 1);
-               OUT_RING  (rt->stride | (rt->stride << 16));
+               OUT_RING  (rt->pitch | (rt->pitch << 16));
        }
 
-       nv20mt = (struct nv20_miptree *)rt->texture;
+       nv20mt = (struct nv20_miptree *)rt->base.texture;
        nv20->rt[0] = nv20mt->buffer;
 
        if (zeta_format)
        {
-               nv20mt = (struct nv20_miptree *)zeta->texture;
+               nv20mt = (struct nv20_miptree *)zeta->base.texture;
                nv20->zeta = nv20mt->buffer;
        }
 
index 6cd607583cf73b40da957913ea7ed0ddd71a84f5..4224bdd6afae374b6f4d7398341fdbfb72240d64 100644 (file)
@@ -33,7 +33,7 @@
 #include "util/u_tile.h"
 
 static void
-nv20_surface_copy(struct pipe_context *pipe, boolean do_flip,
+nv20_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -41,15 +41,6 @@ nv20_surface_copy(struct pipe_context *pipe, boolean do_flip,
        struct nv20_context *nv20 = nv20_context(pipe);
        struct nv04_surface_2d *eng2d = nv20->screen->eng2d;
 
-       if (do_flip) {
-               desty += height;
-               while (height--) {
-                       eng2d->copy(eng2d, dest, destx, desty--, src,
-                                   srcx, srcy++, width, 1);
-               }
-               return;
-       }
-
        eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
 }
 
diff --git a/src/gallium/drivers/nv20/nv20_transfer.c b/src/gallium/drivers/nv20/nv20_transfer.c
new file mode 100644 (file)
index 0000000..e525529
--- /dev/null
@@ -0,0 +1,196 @@
+#include <pipe/p_state.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
+#include <nouveau/nouveau_winsys.h>
+#include "nv20_context.h"
+#include "nv20_screen.h"
+#include "nv20_state.h"
+
+struct nv20_transfer {
+       struct pipe_transfer base;
+       struct pipe_surface *surface;
+       bool direct;
+};
+
+static unsigned nv20_usage_tx_to_buf(unsigned tx_usage)
+{
+       switch (tx_usage) {
+               case PIPE_TRANSFER_READ:
+                       return PIPE_BUFFER_USAGE_CPU_READ;
+               case PIPE_TRANSFER_WRITE:
+                       return PIPE_BUFFER_USAGE_CPU_WRITE;
+               case PIPE_TRANSFER_READ_WRITE:
+                       return PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+               default:
+                       assert(0);
+       }
+
+       return -1;
+}
+
+static void
+nv20_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
+                             struct pipe_texture *template)
+{
+       memset(template, 0, sizeof(struct pipe_texture));
+       template->target = pt->target;
+       template->format = pt->format;
+       template->width[0] = pt->width[level];
+       template->height[0] = pt->height[level];
+       template->depth[0] = 1;
+       template->block = pt->block;
+       template->nblocksx[0] = pt->nblocksx[level];
+       template->nblocksy[0] = pt->nblocksx[level];
+       template->last_level = 0;
+       template->compressed = pt->compressed;
+       template->nr_samples = pt->nr_samples;
+
+       template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
+                             NOUVEAU_TEXTURE_USAGE_LINEAR;
+}
+
+static struct pipe_transfer *
+nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+                 unsigned face, unsigned level, unsigned zslice,
+                 enum pipe_transfer_usage usage,
+                 unsigned x, unsigned y, unsigned w, unsigned h)
+{
+       struct nv20_miptree *mt = (struct nv20_miptree *)pt;
+       struct nv20_transfer *tx;
+       struct pipe_texture tx_tex_template, *tx_tex;
+
+       tx = CALLOC_STRUCT(nv20_transfer);
+       if (!tx)
+               return NULL;
+
+       pipe_texture_reference(&tx->base.texture, pt);
+       tx->base.format = pt->format;
+       tx->base.x = x;
+       tx->base.y = y;
+       tx->base.width = w;
+       tx->base.height = h;
+       tx->base.block = pt->block;
+       tx->base.nblocksx = pt->nblocksx[level];
+       tx->base.nblocksy = pt->nblocksy[level];
+       tx->base.stride = mt->level[level].pitch;
+       tx->base.usage = usage;
+       tx->base.face = face;
+       tx->base.level = level;
+       tx->base.zslice = zslice;
+
+       /* Direct access to texture */
+       if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
+            debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+           pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
+       {
+               tx->direct = true;
+               tx->surface = pscreen->get_tex_surface(pscreen, pt,
+                                                      0, 0, 0,
+                                                      nv20_usage_tx_to_buf(usage));
+               return &tx->base;
+       }
+
+       tx->direct = false;
+
+       nv20_compatible_transfer_tex(pt, level, &tx_tex_template);
+
+       tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
+       if (!tx_tex)
+       {
+               FREE(tx);
+               return NULL;
+       }
+
+       tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
+                                              face, level, zslice,
+                                              nv20_usage_tx_to_buf(usage));
+
+       pipe_texture_reference(&tx_tex, NULL);
+
+       if (!tx->surface)
+       {
+               pipe_surface_reference(&tx->surface, NULL);
+               FREE(tx);
+               return NULL;
+       }
+
+       if (usage != PIPE_TRANSFER_WRITE) {
+               struct nv20_screen *nvscreen = nv20_screen(pscreen);
+               struct pipe_surface *src;
+
+               src = pscreen->get_tex_surface(pscreen, pt,
+                                              face, level, zslice,
+                                              PIPE_BUFFER_USAGE_GPU_READ);
+
+               /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+               /* TODO: Check if SIFM can un-swizzle */
+               nvscreen->eng2d->copy(nvscreen->eng2d,
+                                     tx->surface, 0, 0,
+                                     src, 0, 0,
+                                     src->width, src->height);
+
+               pipe_surface_reference(&src, NULL);
+       }
+
+       return &tx->base;
+}
+
+static void
+nv20_transfer_del(struct pipe_transfer *ptx)
+{
+       struct nv20_transfer *tx = (struct nv20_transfer *)ptx;
+
+       if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) {
+               struct pipe_screen *pscreen = ptx->texture->screen;
+               struct nv20_screen *nvscreen = nv20_screen(pscreen);
+               struct pipe_surface *dst;
+
+               dst = pscreen->get_tex_surface(pscreen, ptx->texture,
+                                              ptx->face, ptx->level, ptx->zslice,
+                                              PIPE_BUFFER_USAGE_GPU_WRITE);
+
+               /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+               nvscreen->eng2d->copy(nvscreen->eng2d,
+                                     dst, 0, 0,
+                                     tx->surface, 0, 0,
+                                     dst->width, dst->height);
+
+               pipe_surface_reference(&dst, NULL);
+       }
+
+       pipe_surface_reference(&tx->surface, NULL);
+       pipe_texture_reference(&ptx->texture, NULL);
+       FREE(ptx);
+}
+
+static void *
+nv20_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv20_transfer *tx = (struct nv20_transfer *)ptx;
+       struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
+       struct nv20_miptree *mt = (struct nv20_miptree *)tx->surface->texture;
+       void *map = pipe_buffer_map(pscreen, mt->buffer,
+                                   nv20_usage_tx_to_buf(ptx->usage));
+
+       return map + ns->base.offset +
+              ptx->y * ns->pitch + ptx->x * ptx->block.size;
+}
+
+static void
+nv20_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv20_transfer *tx = (struct nv20_transfer *)ptx;
+       struct nv20_miptree *mt = (struct nv20_miptree *)tx->surface->texture;
+
+       pipe_buffer_unmap(pscreen, mt->buffer);
+}
+
+void
+nv20_screen_init_transfer_functions(struct pipe_screen *pscreen)
+{
+       pscreen->get_tex_transfer = nv20_transfer_new;
+       pscreen->tex_transfer_destroy = nv20_transfer_del;
+       pscreen->transfer_map = nv20_transfer_map;
+       pscreen->transfer_unmap = nv20_transfer_unmap;
+}
index 69f2790dfe280e920ed2ce5fed9815515d701d9a..364c80d8f3ee28058b5851e4d10306840896cc26 100644 (file)
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv30
 
-DRIVER_SOURCES = \
+C_SOURCES = \
        nv30_clear.c \
        nv30_context.c \
        nv30_draw.c \
@@ -22,16 +22,8 @@ DRIVER_SOURCES = \
        nv30_state_viewport.c \
        nv30_state_zsa.c \
        nv30_surface.c \
+       nv30_transfer.c \
        nv30_vbo.c \
        nv30_vertprog.c
 
-C_SOURCES = \
-       $(COMMON_SOURCES) \
-       $(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
index 320ba3f4bf42c0ba20b1f5538fbfa6cdd6aadcf9..bdfe1425d24628042bdb048136b5a2b57598b5aa 100644 (file)
@@ -834,6 +834,7 @@ nv30_fragprog_validate(struct nv30_context *nv30)
        struct nv30_fragment_program *fp = nv30->fragprog;
        struct pipe_buffer *constbuf =
                nv30->constbuf[PIPE_SHADER_FRAGMENT];
+       struct pipe_screen *screen = nv30->pipe.screen;
        struct pipe_winsys *ws = nv30->pipe.winsys;
        struct nouveau_stateobj *so;
        boolean new_consts = FALSE;
@@ -849,7 +850,7 @@ nv30_fragprog_validate(struct nv30_context *nv30)
                return FALSE;
        }
 
-       fp->buffer = ws->buffer_create(ws, 0x100, 0, fp->insn_len * 4);
+       fp->buffer = screen->buffer_create(screen, 0x100, 0, fp->insn_len * 4);
        nv30_fragprog_upload(nv30, fp);
 
        so = so_new(8, 1);
@@ -864,6 +865,7 @@ nv30_fragprog_validate(struct nv30_context *nv30)
        so_method(so, nv30->screen->rankine, NV34TCL_TX_UNITS_ENABLE, 1);
        so_data  (so, fp->samplers);
        so_ref(so, &fp->so);
+       so_ref(NULL, &so);
 
 update_constants:
        if (fp->nr_consts) {
index b1d2663af38267caa5cf9310156fce2c86092f35..8b6ab992d16887ac2abf13f8e522ed1cd90795c5 100644 (file)
@@ -137,6 +137,7 @@ nv30_fragtex_validate(struct nv30_context *nv30)
                so_method(so, nv30->screen->rankine, NV34TCL_TX_ENABLE(unit), 1);
                so_data  (so, 0);
                so_ref(so, &nv30->state.hw[NV30_STATE_FRAGTEX0 + unit]);
+               so_ref(NULL, &so);
                state->dirty |= (1ULL << (NV30_STATE_FRAGTEX0 + unit));
        }
 
@@ -147,6 +148,7 @@ nv30_fragtex_validate(struct nv30_context *nv30)
 
                so = nv30_fragtex_build(nv30, unit);
                so_ref(so, &nv30->state.hw[NV30_STATE_FRAGTEX0 + unit]);
+               so_ref(NULL, &so);
                state->dirty |= (1ULL << (NV30_STATE_FRAGTEX0 + unit));
        }
 
index 510c94d4e644cda6d8c269147a8f8c2ba7ab1fcb..d6dc621c9eea4972bc6111039d51255065a8c99c 100644 (file)
@@ -67,17 +67,16 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt)
 static struct pipe_texture *
 nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
 {
-       struct pipe_winsys *ws = pscreen->winsys;
        struct nv30_miptree *mt;
+       unsigned buf_usage = PIPE_BUFFER_USAGE_PIXEL |
+                            NOUVEAU_BUFFER_USAGE_TEXTURE;
 
        mt = MALLOC(sizeof(struct nv30_miptree));
        if (!mt)
                return NULL;
        mt->base = *pt;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = pscreen;
-       mt->shadow_tex = NULL;
-       mt->shadow_surface = NULL;
 
        /* Swizzled textures must be POT */
        if (pt->width[0] & (pt->width[0] - 1) ||
@@ -85,8 +84,8 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
                mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
        else
        if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
-+                           PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
-+                           PIPE_TEXTURE_USAGE_DEPTH_STENCIL))
+                            PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+                            PIPE_TEXTURE_USAGE_DEPTH_STENCIL))
                mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
        else
        if (pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC)
@@ -107,11 +106,12 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
                }
        }
 
+       if (pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC)
+               buf_usage |= PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+
        nv30_miptree_layout(mt);
 
-       mt->buffer = ws->buffer_create(ws, 256,
-                                      PIPE_BUFFER_USAGE_PIXEL |
-                                      NOUVEAU_BUFFER_USAGE_TEXTURE,
+       mt->buffer = pscreen->buffer_create(pscreen, 256, buf_usage,
                                       mt->total_size);
        if (!mt->buffer) {
                FREE(mt);
@@ -137,38 +137,27 @@ nv30_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
                return NULL;
 
        mt->base = *pt;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = pscreen;
        mt->level[0].pitch = stride[0];
        mt->level[0].image_offset = CALLOC(1, sizeof(unsigned));
 
-       pipe_buffer_reference(pscreen, &mt->buffer, pb);
+       pipe_buffer_reference(&mt->buffer, pb);
        return &mt->base;
 }
 
 static void
-nv30_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt)
+nv30_miptree_destroy(struct pipe_texture *pt)
 {
-       struct pipe_texture *pt = *ppt;
        struct nv30_miptree *mt = (struct nv30_miptree *)pt;
        int l;
 
-       *ppt = NULL;
-       if (--pt->refcount)
-               return;
-
-       pipe_buffer_reference(pscreen, &mt->buffer, NULL);
+       pipe_buffer_reference(&mt->buffer, NULL);
        for (l = 0; l <= pt->last_level; l++) {
                if (mt->level[l].image_offset)
                        FREE(mt->level[l].image_offset);
        }
 
-       if (mt->shadow_tex) {
-               if (mt->shadow_surface)
-                       pscreen->tex_surface_release(pscreen, &mt->shadow_surface);
-               nv30_miptree_release(pscreen, &mt->shadow_tex);
-       }
-
        FREE(mt);
 }
 
@@ -178,48 +167,38 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
                         unsigned flags)
 {
        struct nv30_miptree *nv30mt = (struct nv30_miptree *)pt;
-       struct pipe_surface *ps;
+       struct nv04_surface *ns;
 
-       ps = CALLOC_STRUCT(pipe_surface);
-       if (!ps)
+       ns = CALLOC_STRUCT(nv04_surface);
+       if (!ns)
                return NULL;
-       pipe_texture_reference(&ps->texture, pt);
-       ps->format = pt->format;
-       ps->width = pt->width[level];
-       ps->height = pt->height[level];
-       ps->block = pt->block;
-       ps->nblocksx = pt->nblocksx[level];
-       ps->nblocksy = pt->nblocksy[level];
-       ps->stride = nv30mt->level[level].pitch;
-       ps->usage = flags;
-       ps->status = PIPE_SURFACE_STATUS_DEFINED;
-       ps->refcount = 1;
-       ps->face = face;
-       ps->level = level;
-       ps->zslice = zslice;
+       pipe_texture_reference(&ns->base.texture, pt);
+       ns->base.format = pt->format;
+       ns->base.width = pt->width[level];
+       ns->base.height = pt->height[level];
+       ns->base.usage = flags;
+       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
+       pipe_reference_init(&ns->base.reference, 1);
+       ns->base.face = face;
+       ns->base.level = level;
+       ns->base.zslice = zslice;
+       ns->pitch = nv30mt->level[level].pitch;
 
        if (pt->target == PIPE_TEXTURE_CUBE) {
-               ps->offset = nv30mt->level[level].image_offset[face];
+               ns->base.offset = nv30mt->level[level].image_offset[face];
        } else
        if (pt->target == PIPE_TEXTURE_3D) {
-               ps->offset = nv30mt->level[level].image_offset[zslice];
+               ns->base.offset = nv30mt->level[level].image_offset[zslice];
        } else {
-               ps->offset = nv30mt->level[level].image_offset[0];
+               ns->base.offset = nv30mt->level[level].image_offset[0];
        }
 
-       return ps;
+       return &ns->base;
 }
 
 static void
-nv30_miptree_surface_del(struct pipe_screen *pscreen,
-                        struct pipe_surface **psurface)
+nv30_miptree_surface_del(struct pipe_surface *ps)
 {
-       struct pipe_surface *ps = *psurface;
-
-       *psurface = NULL;
-       if (--ps->refcount > 0)
-               return;
-
        pipe_texture_reference(&ps->texture, NULL);
        FREE(ps);
 }
@@ -229,7 +208,7 @@ nv30_screen_init_miptree_functions(struct pipe_screen *pscreen)
 {
        pscreen->texture_create = nv30_miptree_create;
        pscreen->texture_blanket = nv30_miptree_blanket;
-       pscreen->texture_release = nv30_miptree_release;
+       pscreen->texture_destroy = nv30_miptree_destroy;
        pscreen->get_tex_surface = nv30_miptree_surface_new;
-       pscreen->tex_surface_release = nv30_miptree_surface_del;
+       pscreen->tex_surface_destroy = nv30_miptree_surface_del;
 }
index c97a73f0b1a5c7c1fc9ca240379957053a576ad2..d395c5e1b7f5db77a52ea582d6fc2c50a38ea6a6 100644 (file)
@@ -135,82 +135,6 @@ nv30_surface_buffer(struct pipe_surface *surf)
        return mt->buffer;
 }
 
-static void *
-nv30_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
-                unsigned flags )
-{
-       struct pipe_winsys      *ws = screen->winsys;
-       struct pipe_surface     *surface_to_map;
-       void                    *map;
-
-       if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
-               struct nv30_miptree *mt = (struct nv30_miptree *)surface->texture;
-
-               if (!mt->shadow_tex) {
-                       unsigned old_tex_usage = surface->texture->tex_usage;
-                       surface->texture->tex_usage = NOUVEAU_TEXTURE_USAGE_LINEAR |
-                                                     PIPE_TEXTURE_USAGE_DYNAMIC;
-                       mt->shadow_tex = screen->texture_create(screen, surface->texture);
-                       surface->texture->tex_usage = old_tex_usage;
-
-                       assert(mt->shadow_tex->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR);
-               }
-
-               mt->shadow_surface = screen->get_tex_surface
-               (
-                       screen, mt->shadow_tex,
-                       surface->face, surface->level, surface->zslice,
-                       surface->usage
-               );
-
-               surface_to_map = mt->shadow_surface;
-       }
-       else
-               surface_to_map = surface;
-
-       assert(surface_to_map);
-
-       map = ws->buffer_map(ws, nv30_surface_buffer(surface_to_map), flags);
-       if (!map)
-               return NULL;
-
-       return map + surface_to_map->offset;
-}
-
-static void
-nv30_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
-{
-       struct pipe_winsys      *ws = screen->winsys;
-       struct pipe_surface     *surface_to_unmap;
-
-       /* TODO: Copy from shadow just before push buffer is flushed instead.
-                There are probably some programs that map/unmap excessively
-                before rendering. */
-       if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
-               struct nv30_miptree *mt = (struct nv30_miptree *)surface->texture;
-
-               assert(mt->shadow_tex);
-
-               surface_to_unmap = mt->shadow_surface;
-       }
-       else
-               surface_to_unmap = surface;
-
-       assert(surface_to_unmap);
-
-       ws->buffer_unmap(ws, nv30_surface_buffer(surface_to_unmap));
-
-       if (surface_to_unmap != surface) {
-               struct nv30_screen *nvscreen = nv30_screen(screen);
-
-               nvscreen->eng2d->copy(nvscreen->eng2d, surface, 0, 0,
-                                     surface_to_unmap, 0, 0,
-                                     surface->width, surface->height);
-
-               screen->tex_surface_release(screen, &surface_to_unmap);
-       }
-}
-
 static void
 nv30_screen_destroy(struct pipe_screen *pscreen)
 {
@@ -391,10 +315,8 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 
        screen->pipe.is_format_supported = nv30_screen_surface_format_supported;
 
-       screen->pipe.surface_map = nv30_surface_map;
-       screen->pipe.surface_unmap = nv30_surface_unmap;
-
        nv30_screen_init_miptree_functions(&screen->pipe);
+       nv30_screen_init_transfer_functions(&screen->pipe);
        u_simple_screen_init(&screen->pipe);
 
        return &screen->pipe;
index b11e470f949e4dc484a4bd171341eddd1b29fc28..8e36883975926cd67cbc5427605d14706247d6a7 100644 (file)
@@ -34,4 +34,7 @@ nv30_screen(struct pipe_screen *screen)
        return (struct nv30_screen *)screen;
 }
 
+void
+nv30_screen_init_transfer_functions(struct pipe_screen *pscreen);
+
 #endif
index 26147565a5317dd6b266c31b1e45dc5b43abf5fa..b91e972c12336783abd0910564f87e011eaf7b31 100644 (file)
@@ -51,6 +51,7 @@ nv30_blend_state_create(struct pipe_context *pipe,
        so_data  (so, cso->dither ? 1 : 0);
 
        so_ref(so, &bso->so);
+       so_ref(NULL, &so);
        bso->pipe = *cso;
        return (void *)bso;
 }
@@ -404,6 +405,7 @@ nv30_rasterizer_state_create(struct pipe_context *pipe,
        }
 
        so_ref(so, &rsso->so);
+       so_ref(NULL, &so);
        rsso->pipe = *cso;
        return (void *)rsso;
 }
@@ -477,6 +479,7 @@ nv30_depth_stencil_alpha_state_create(struct pipe_context *pipe,
        }
 
        so_ref(so, &zsaso->so);
+       so_ref(NULL, &so);
        zsaso->pipe = *cso;
        return (void *)zsaso;
 }
index 2023278e377e00aabcfaea6ae02e6671232f1a21..e6f23bf166715c2fbcaf4e03d994212d6d74f2b9 100644 (file)
@@ -76,9 +76,6 @@ struct nv30_miptree {
        struct pipe_buffer *buffer;
        uint total_size;
 
-       struct pipe_texture *shadow_tex;
-       struct pipe_surface *shadow_surface;
-
        struct {
                uint pitch;
                uint *image_offset;
index 44d43e132a52fa6d294210f00b355050e7b83f57..64cf9ae93a0a6018262be11a7b715900acc145b6 100644 (file)
@@ -28,6 +28,7 @@ nv30_state_blend_colour_validate(struct nv30_context *nv30)
                       (float_to_ubyte(bcol->color[2]) <<  0)));
 
        so_ref(so, &nv30->state.hw[NV30_STATE_BCOL]);
+       so_ref(NULL, &so);
        return TRUE;
 }
 
index 77368cb20553341a36ef68fa268abfd8d8142352..fdc1cade905124a164245084771870338b71a771 100644 (file)
@@ -5,7 +5,7 @@ static boolean
 nv30_state_framebuffer_validate(struct nv30_context *nv30)
 {
        struct pipe_framebuffer_state *fb = &nv30->framebuffer;
-       struct pipe_surface *rt[2], *zeta = NULL;
+       struct nv04_surface *rt[2], *zeta = NULL;
        uint32_t rt_enable, rt_format;
        int i, colour_format = 0, zeta_format = 0;
        struct nouveau_stateobj *so = so_new(64, 10);
@@ -21,7 +21,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
                } else {
                        colour_format = fb->cbufs[i]->format;
                        rt_enable |= (NV34TCL_RT_ENABLE_COLOR0 << i);
-                       rt[i] = fb->cbufs[i];
+                       rt[i] = (struct nv04_surface *)fb->cbufs[i];
                }
        }
 
@@ -30,13 +30,13 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
 
        if (fb->zsbuf) {
                zeta_format = fb->zsbuf->format;
-               zeta = fb->zsbuf;
+               zeta = (struct nv04_surface *)fb->zsbuf;
        }
 
-       if (!(rt[0]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
+       if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
                assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
                for (i = 1; i < fb->nr_cbufs; i++)
-                       assert(!(rt[i]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
+                       assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
 
                /* FIXME: NV34TCL_RT_FORMAT_LOG2_[WIDTH/HEIGHT] */
                rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
@@ -71,44 +71,44 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
        }
 
        if (rt_enable & NV34TCL_RT_ENABLE_COLOR0) {
-               uint32_t pitch = rt[0]->stride;
+               uint32_t pitch = rt[0]->pitch;
                if (zeta) {
-                       pitch |= (zeta->stride << 16);
+                       pitch |= (zeta->pitch << 16);
                } else {
                        pitch |= (pitch << 16);
                }
 
-               nv30mt = (struct nv30_miptree *)rt[0]->texture;
+               nv30mt = (struct nv30_miptree *)rt[0]->base.texture;
                so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR0, 1);
                so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
                          nv30->nvws->channel->vram->handle,
                          nv30->nvws->channel->gart->handle);
                so_method(so, nv30->screen->rankine, NV34TCL_COLOR0_PITCH, 2);
                so_data  (so, pitch);
-               so_reloc (so, nv30mt->buffer, rt[0]->offset, rt_flags |
+               so_reloc (so, nv30mt->buffer, rt[0]->base.offset, rt_flags |
                          NOUVEAU_BO_LOW, 0, 0);
        }
 
        if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) {
-               nv30mt = (struct nv30_miptree *)rt[1]->texture;
+               nv30mt = (struct nv30_miptree *)rt[1]->base.texture;
                so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR1, 1);
                so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
                          nv30->nvws->channel->vram->handle,
                          nv30->nvws->channel->gart->handle);
                so_method(so, nv30->screen->rankine, NV34TCL_COLOR1_OFFSET, 2);
-               so_reloc (so, nv30mt->buffer, rt[1]->offset, rt_flags |
+               so_reloc (so, nv30mt->buffer, rt[1]->base.offset, rt_flags |
                          NOUVEAU_BO_LOW, 0, 0);
-               so_data  (so, rt[1]->stride);
+               so_data  (so, rt[1]->pitch);
        }
 
        if (zeta_format) {
-               nv30mt = (struct nv30_miptree *)zeta->texture;
+               nv30mt = (struct nv30_miptree *)zeta->base.texture;
                so_method(so, nv30->screen->rankine, NV34TCL_DMA_ZETA, 1);
                so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
                          nv30->nvws->channel->vram->handle,
                          nv30->nvws->channel->gart->handle);
                so_method(so, nv30->screen->rankine, NV34TCL_ZETA_OFFSET, 1);
-               so_reloc (so, nv30mt->buffer, zeta->offset, rt_flags |
+               so_reloc (so, nv30mt->buffer, zeta->base.offset, rt_flags |
                          NOUVEAU_BO_LOW, 0, 0);
                /* TODO: allocate LMA depth buffer */
        }
@@ -132,6 +132,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
        so_data  (so, 0);
 
        so_ref(so, &nv30->state.hw[NV30_STATE_FB]);
+       so_ref(NULL, &so);
        return TRUE;
 }
 
index 1db9bc1795547d063ea0b1e0282d1a46ec446881..3ac7a8471eae26df8cc040e144c098bbca69121f 100644 (file)
@@ -23,6 +23,7 @@ nv30_state_scissor_validate(struct nv30_context *nv30)
        }
 
        so_ref(so, &nv30->state.hw[NV30_STATE_SCISSOR]);
+       so_ref(NULL, &so);
        return TRUE;
 }
 
index 41b42813b496c505aafb1a1271976f3c6c68bbea..d0c791ac0821648337f0b367bf45b189410211f5 100644 (file)
@@ -27,6 +27,7 @@ nv30_state_stipple_validate(struct nv30_context *nv30)
        }
 
        so_ref(so, &nv30->state.hw[NV30_STATE_STIPPLE]);
+       so_ref(NULL, &so);
        return TRUE;
 }
 
index 951d40ebfdd44df1232d921d690ad4cc404af418..c3eb413dac69178a41d20a507df3ae94e3b2b29d 100644 (file)
@@ -7,7 +7,8 @@ nv30_state_viewport_validate(struct nv30_context *nv30)
        struct nouveau_stateobj *so;
        unsigned bypass;
 
-       if (/*nv30->render_mode == HW &&*/ !nv30->rasterizer->pipe.bypass_clipping)
+       if (/*nv30->render_mode == HW &&*/
+           !nv30->rasterizer->pipe.bypass_vs_clip_and_viewport)
                bypass = 0;
        else
                bypass = 1;
@@ -58,6 +59,7 @@ nv30_state_viewport_validate(struct nv30_context *nv30)
        so_data  (so, 1);
 
        so_ref(so, &nv30->state.hw[NV30_STATE_VIEWPORT]);
+       so_ref(NULL, &so);
        return TRUE;
 }
 
index 0f8dc12045a93eb8462567b263bdda63892ea630..5e237e13eb54d8423d6025bdbad79bf0dd5546f5 100644 (file)
@@ -33,7 +33,7 @@
 #include "util/u_tile.h"
 
 static void
-nv30_surface_copy(struct pipe_context *pipe, boolean do_flip,
+nv30_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -41,15 +41,6 @@ nv30_surface_copy(struct pipe_context *pipe, boolean do_flip,
        struct nv30_context *nv30 = nv30_context(pipe);
        struct nv04_surface_2d *eng2d = nv30->screen->eng2d;
 
-       if (do_flip) {
-               desty += height;
-               while (height--) {
-                       eng2d->copy(eng2d, dest, destx, desty--, src,
-                                   srcx, srcy++, width, 1);
-               }
-               return;
-       }
-
        eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
 }
 
diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c
new file mode 100644 (file)
index 0000000..8b915b3
--- /dev/null
@@ -0,0 +1,196 @@
+#include <pipe/p_state.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
+#include <nouveau/nouveau_winsys.h>
+#include "nv30_context.h"
+#include "nv30_screen.h"
+#include "nv30_state.h"
+
+struct nv30_transfer {
+       struct pipe_transfer base;
+       struct pipe_surface *surface;
+       bool direct;
+};
+
+static unsigned nv30_usage_tx_to_buf(unsigned tx_usage)
+{
+       switch (tx_usage) {
+               case PIPE_TRANSFER_READ:
+                       return PIPE_BUFFER_USAGE_CPU_READ;
+               case PIPE_TRANSFER_WRITE:
+                       return PIPE_BUFFER_USAGE_CPU_WRITE;
+               case PIPE_TRANSFER_READ_WRITE:
+                       return PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+               default:
+                       assert(0);
+       }
+
+       return -1;
+}
+
+static void
+nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
+                             struct pipe_texture *template)
+{
+       memset(template, 0, sizeof(struct pipe_texture));
+       template->target = pt->target;
+       template->format = pt->format;
+       template->width[0] = pt->width[level];
+       template->height[0] = pt->height[level];
+       template->depth[0] = 1;
+       template->block = pt->block;
+       template->nblocksx[0] = pt->nblocksx[level];
+       template->nblocksy[0] = pt->nblocksx[level];
+       template->last_level = 0;
+       template->compressed = pt->compressed;
+       template->nr_samples = pt->nr_samples;
+
+       template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
+                             NOUVEAU_TEXTURE_USAGE_LINEAR;
+}
+
+static struct pipe_transfer *
+nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+                 unsigned face, unsigned level, unsigned zslice,
+                 enum pipe_transfer_usage usage,
+                 unsigned x, unsigned y, unsigned w, unsigned h)
+{
+       struct nv30_miptree *mt = (struct nv30_miptree *)pt;
+       struct nv30_transfer *tx;
+       struct pipe_texture tx_tex_template, *tx_tex;
+
+       tx = CALLOC_STRUCT(nv30_transfer);
+       if (!tx)
+               return NULL;
+
+       pipe_texture_reference(&tx->base.texture, pt);
+       tx->base.format = pt->format;
+       tx->base.x = x;
+       tx->base.y = y;
+       tx->base.width = w;
+       tx->base.height = h;
+       tx->base.block = pt->block;
+       tx->base.nblocksx = pt->nblocksx[level];
+       tx->base.nblocksy = pt->nblocksy[level];
+       tx->base.stride = mt->level[level].pitch;
+       tx->base.usage = usage;
+       tx->base.face = face;
+       tx->base.level = level;
+       tx->base.zslice = zslice;
+
+       /* Direct access to texture */
+       if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
+            debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+           pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
+       {
+               tx->direct = true;
+               tx->surface = pscreen->get_tex_surface(pscreen, pt,
+                                                      face, level, zslice,
+                                                      nv30_usage_tx_to_buf(usage));
+               return &tx->base;
+       }
+
+       tx->direct = false;
+
+       nv30_compatible_transfer_tex(pt, level, &tx_tex_template);
+
+       tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
+       if (!tx_tex)
+       {
+               FREE(tx);
+               return NULL;
+       }
+
+       tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
+                                              0, 0, 0,
+                                              nv30_usage_tx_to_buf(usage));
+
+       pipe_texture_reference(&tx_tex, NULL);
+
+       if (!tx->surface)
+       {
+               pipe_surface_reference(&tx->surface, NULL);
+               FREE(tx);
+               return NULL;
+       }
+
+       if (usage != PIPE_TRANSFER_WRITE) {
+               struct nv30_screen *nvscreen = nv30_screen(pscreen);
+               struct pipe_surface *src;
+
+               src = pscreen->get_tex_surface(pscreen, pt,
+                                              face, level, zslice,
+                                              PIPE_BUFFER_USAGE_GPU_READ);
+
+               /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+               /* TODO: Check if SIFM can un-swizzle */
+               nvscreen->eng2d->copy(nvscreen->eng2d,
+                                     tx->surface, 0, 0,
+                                     src, 0, 0,
+                                     src->width, src->height);
+
+               pipe_surface_reference(&src, NULL);
+       }
+
+       return &tx->base;
+}
+
+static void
+nv30_transfer_del(struct pipe_transfer *ptx)
+{
+       struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
+
+       if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) {
+               struct pipe_screen *pscreen = ptx->texture->screen;
+               struct nv30_screen *nvscreen = nv30_screen(pscreen);
+               struct pipe_surface *dst;
+
+               dst = pscreen->get_tex_surface(pscreen, ptx->texture,
+                                              ptx->face, ptx->level, ptx->zslice,
+                                              PIPE_BUFFER_USAGE_GPU_WRITE);
+
+               /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+               nvscreen->eng2d->copy(nvscreen->eng2d,
+                                     dst, 0, 0,
+                                     tx->surface, 0, 0,
+                                     dst->width, dst->height);
+
+               pipe_surface_reference(&dst, NULL);
+       }
+
+       pipe_surface_reference(&tx->surface, NULL);
+       pipe_texture_reference(&ptx->texture, NULL);
+       FREE(ptx);
+}
+
+static void *
+nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
+       struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
+       struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture;
+       void *map = pipe_buffer_map(pscreen, mt->buffer,
+                                   nv30_usage_tx_to_buf(ptx->usage));
+
+       return map + ns->base.offset +
+              ptx->y * ns->pitch + ptx->x * ptx->block.size;
+}
+
+static void
+nv30_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
+       struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture;
+
+       pipe_buffer_unmap(pscreen, mt->buffer);
+}
+
+void
+nv30_screen_init_transfer_functions(struct pipe_screen *pscreen)
+{
+       pscreen->get_tex_transfer = nv30_transfer_new;
+       pscreen->tex_transfer_destroy = nv30_transfer_del;
+       pscreen->transfer_map = nv30_transfer_map;
+       pscreen->transfer_unmap = nv30_transfer_unmap;
+}
index 2d6d48ac161f3034601e7abb20210e9c33fdf876..990a8763824ad5974143ce3d7825151161a1a768 100644 (file)
@@ -539,10 +539,13 @@ nv30_vbo_validate(struct nv30_context *nv30)
        so_data  (vtxbuf, 0);
 
        so_ref(vtxbuf, &nv30->state.hw[NV30_STATE_VTXBUF]);
+       so_ref(NULL, &vtxbuf);
        nv30->state.dirty |= (1ULL << NV30_STATE_VTXBUF);
        so_ref(vtxfmt, &nv30->state.hw[NV30_STATE_VTXFMT]);
+       so_ref(NULL, &vtxfmt);
        nv30->state.dirty |= (1ULL << NV30_STATE_VTXFMT);
        so_ref(sattr, &nv30->state.hw[NV30_STATE_VTXATTR]);
+       so_ref(NULL, &sattr);
        nv30->state.dirty |= (1ULL << NV30_STATE_VTXATTR);
        return FALSE;
 }
index d26272505705b96fc45843e071ef16ee3a4e74d7..eaf543b8f791568cbf78a43c3ed796505c1d5feb 100644 (file)
@@ -685,6 +685,7 @@ nv30_vertprog_validate(struct nv30_context *nv30)
                so_method(so, rankine, NV34TCL_VP_START_FROM_ID, 1);
                so_data  (so, vp->exec->start);
                so_ref(so, &vp->so);
+               so_ref(NULL, &so);
 
                upload_code = TRUE;
        }
index 9c8eadf7e440c07694da8a90bfb762f059fbac02..0ecae2b4913faf7cfa88507998accd3a54b78ed8 100644 (file)
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv40
 
-DRIVER_SOURCES = \
+C_SOURCES = \
        nv40_clear.c \
        nv40_context.c \
        nv40_draw.c \
@@ -22,16 +22,8 @@ DRIVER_SOURCES = \
        nv40_state_viewport.c \
        nv40_state_zsa.c \
        nv40_surface.c \
+       nv40_transfer.c \
        nv40_vbo.c \
        nv40_vertprog.c
 
-C_SOURCES = \
-       $(COMMON_SOURCES) \
-       $(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
index 91dcbebda0d03723efbb6a4167b91e9a75452cf1..16e40889ec302fc1f1cbd71028b68ef859e1f7d3 100644 (file)
@@ -917,6 +917,7 @@ nv40_fragprog_validate(struct nv40_context *nv40)
        struct nv40_fragment_program *fp = nv40->fragprog;
        struct pipe_buffer *constbuf =
                nv40->constbuf[PIPE_SHADER_FRAGMENT];
+       struct pipe_screen *screen = nv40->pipe.screen;
        struct pipe_winsys *ws = nv40->pipe.winsys;
        struct nouveau_stateobj *so;
        boolean new_consts = FALSE;
@@ -932,7 +933,7 @@ nv40_fragprog_validate(struct nv40_context *nv40)
                return FALSE;
        }
 
-       fp->buffer = ws->buffer_create(ws, 0x100, 0, fp->insn_len * 4);
+       fp->buffer = screen->buffer_create(screen, 0x100, 0, fp->insn_len * 4);
        nv40_fragprog_upload(nv40, fp);
 
        so = so_new(4, 1);
@@ -943,6 +944,7 @@ nv40_fragprog_validate(struct nv40_context *nv40)
        so_method(so, nv40->screen->curie, NV40TCL_FP_CONTROL, 1);
        so_data  (so, fp->fp_control);
        so_ref(so, &fp->so);
+       so_ref(NULL, &so);
 
 update_constants:
        if (fp->nr_consts) {
index 0227d22620d405c840604b845433caec178afc50..eb3002dc05387bfbab4153a6bedcf13e353f9e84 100644 (file)
@@ -151,6 +151,7 @@ nv40_fragtex_validate(struct nv40_context *nv40)
 
                so = nv40_fragtex_build(nv40, unit);
                so_ref(so, &nv40->state.hw[NV40_STATE_FRAGTEX0 + unit]);
+               so_ref(NULL, &so);
                state->dirty |= (1ULL << (NV40_STATE_FRAGTEX0 + unit));
        }
 
index e38b1e7f5cabc54eaebc01e8d5f69b08b20a65c7..abadca8c933d53e0b464e0d84b945d33e0eeb588 100644 (file)
@@ -67,7 +67,6 @@ nv40_miptree_layout(struct nv40_miptree *mt)
 static struct pipe_texture *
 nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
 {
-       struct pipe_winsys *ws = pscreen->winsys;
        struct nv40_miptree *mt;
        unsigned buf_usage = PIPE_BUFFER_USAGE_PIXEL |
                             NOUVEAU_BUFFER_USAGE_TEXTURE;
@@ -76,10 +75,8 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
        if (!mt)
                return NULL;
        mt->base = *pt;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = pscreen;
-       mt->shadow_tex = NULL;
-       mt->shadow_surface = NULL;
 
        /* Swizzled textures must be POT */
        if (pt->width[0] & (pt->width[0] - 1) ||
@@ -114,7 +111,7 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
 
        nv40_miptree_layout(mt);
 
-       mt->buffer = ws->buffer_create(ws, 256, buf_usage, mt->total_size);
+       mt->buffer = pscreen->buffer_create(pscreen, 256, buf_usage, mt->total_size);
        if (!mt->buffer) {
                FREE(mt);
                return NULL;
@@ -139,38 +136,27 @@ nv40_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
                return NULL;
 
        mt->base = *pt;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = pscreen;
        mt->level[0].pitch = stride[0];
        mt->level[0].image_offset = CALLOC(1, sizeof(unsigned));
 
-       pipe_buffer_reference(pscreen, &mt->buffer, pb);
+       pipe_buffer_reference(&mt->buffer, pb);
        return &mt->base;
 }
 
 static void
-nv40_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt)
+nv40_miptree_destroy(struct pipe_texture *pt)
 {
-       struct pipe_texture *pt = *ppt;
        struct nv40_miptree *mt = (struct nv40_miptree *)pt;
        int l;
 
-       *ppt = NULL;
-       if (--pt->refcount)
-               return;
-
-       pipe_buffer_reference(pscreen, &mt->buffer, NULL);
+       pipe_buffer_reference(&mt->buffer, NULL);
        for (l = 0; l <= pt->last_level; l++) {
                if (mt->level[l].image_offset)
                        FREE(mt->level[l].image_offset);
        }
 
-       if (mt->shadow_tex) {
-               if (mt->shadow_surface)
-                       pscreen->tex_surface_release(pscreen, &mt->shadow_surface);
-               nv40_miptree_release(pscreen, &mt->shadow_tex);
-       }
-
        FREE(mt);
 }
 
@@ -180,48 +166,38 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
                         unsigned flags)
 {
        struct nv40_miptree *mt = (struct nv40_miptree *)pt;
-       struct pipe_surface *ps;
+       struct nv04_surface *ns;
 
-       ps = CALLOC_STRUCT(pipe_surface);
-       if (!ps)
+       ns = CALLOC_STRUCT(nv04_surface);
+       if (!ns)
                return NULL;
-       pipe_texture_reference(&ps->texture, pt);
-       ps->format = pt->format;
-       ps->width = pt->width[level];
-       ps->height = pt->height[level];
-       ps->block = pt->block;
-       ps->nblocksx = pt->nblocksx[level];
-       ps->nblocksy = pt->nblocksy[level];
-       ps->stride = mt->level[level].pitch;
-       ps->usage = flags;
-       ps->status = PIPE_SURFACE_STATUS_DEFINED;
-       ps->refcount = 1;
-       ps->face = face;
-       ps->level = level;
-       ps->zslice = zslice;
+       pipe_texture_reference(&ns->base.texture, pt);
+       ns->base.format = pt->format;
+       ns->base.width = pt->width[level];
+       ns->base.height = pt->height[level];
+       ns->base.usage = flags;
+       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
+       pipe_reference_init(&ns->base.reference, 1);
+       ns->base.face = face;
+       ns->base.level = level;
+       ns->base.zslice = zslice;
+       ns->pitch = mt->level[level].pitch;
 
        if (pt->target == PIPE_TEXTURE_CUBE) {
-               ps->offset = mt->level[level].image_offset[face];
+               ns->base.offset = mt->level[level].image_offset[face];
        } else
        if (pt->target == PIPE_TEXTURE_3D) {
-               ps->offset = mt->level[level].image_offset[zslice];
+               ns->base.offset = mt->level[level].image_offset[zslice];
        } else {
-               ps->offset = mt->level[level].image_offset[0];
+               ns->base.offset = mt->level[level].image_offset[0];
        }
 
-       return ps;
+       return &ns->base;
 }
 
 static void
-nv40_miptree_surface_del(struct pipe_screen *pscreen,
-                        struct pipe_surface **psurface)
+nv40_miptree_surface_del(struct pipe_surface *ps)
 {
-       struct pipe_surface *ps = *psurface;
-
-       *psurface = NULL;
-       if (--ps->refcount > 0)
-               return;
-
        pipe_texture_reference(&ps->texture, NULL);
        FREE(ps);
 }
@@ -231,8 +207,8 @@ nv40_screen_init_miptree_functions(struct pipe_screen *pscreen)
 {
        pscreen->texture_create = nv40_miptree_create;
        pscreen->texture_blanket = nv40_miptree_blanket;
-       pscreen->texture_release = nv40_miptree_release;
+       pscreen->texture_destroy = nv40_miptree_destroy;
        pscreen->get_tex_surface = nv40_miptree_surface_new;
-       pscreen->tex_surface_release = nv40_miptree_surface_del;
+       pscreen->tex_surface_destroy = nv40_miptree_surface_del;
 }
 
index 2372bc8441051c886725f51c95cd5222ce4644f8..0d4baefaea3dc2194c160aaa51caab00b44094df 100644 (file)
@@ -144,81 +144,6 @@ nv40_surface_buffer(struct pipe_surface *surf)
        return mt->buffer;
 }
 
-static void *
-nv40_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
-                unsigned flags )
-{
-       struct pipe_winsys      *ws = screen->winsys;
-       struct pipe_surface     *surface_to_map;
-       void                    *map;
-
-       if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
-               struct nv40_miptree *mt = (struct nv40_miptree *)surface->texture;
-
-               if (!mt->shadow_tex) {
-                       unsigned old_tex_usage = surface->texture->tex_usage;
-                       surface->texture->tex_usage = NOUVEAU_TEXTURE_USAGE_LINEAR |
-                                                     PIPE_TEXTURE_USAGE_DYNAMIC;
-                       mt->shadow_tex = screen->texture_create(screen, surface->texture);
-                       surface->texture->tex_usage = old_tex_usage;
-
-                       assert(mt->shadow_tex->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR);
-               }
-
-               mt->shadow_surface = screen->get_tex_surface
-               (
-                       screen, mt->shadow_tex,
-                       surface->face, surface->level, surface->zslice,
-                       surface->usage
-               );
-
-               surface_to_map = mt->shadow_surface;
-       }
-       else
-               surface_to_map = surface;
-
-       assert(surface_to_map);
-       map = ws->buffer_map(ws, nv40_surface_buffer(surface_to_map), flags);
-       if (!map)
-               return NULL;
-
-       return map + surface_to_map->offset;
-}
-
-static void
-nv40_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
-{
-       struct pipe_winsys      *ws = screen->winsys;
-       struct pipe_surface     *surface_to_unmap;
-
-       /* TODO: Copy from shadow just before push buffer is flushed instead.
-                There are probably some programs that map/unmap excessively
-                before rendering. */
-       if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
-               struct nv40_miptree *mt = (struct nv40_miptree *)surface->texture;
-
-               assert(mt->shadow_tex);
-
-               surface_to_unmap = mt->shadow_surface;
-       }
-       else
-               surface_to_unmap = surface;
-
-       assert(surface_to_unmap);
-
-       ws->buffer_unmap(ws, nv40_surface_buffer(surface_to_unmap));
-
-       if (surface_to_unmap != surface) {
-               struct nv40_screen *nvscreen = nv40_screen(screen);
-
-               nvscreen->eng2d->copy(nvscreen->eng2d, surface, 0, 0,
-                                     surface_to_unmap, 0, 0,
-                                     surface->width, surface->height);
-
-               screen->tex_surface_release(screen, &surface_to_unmap);
-       }
-}
-
 static void
 nv40_screen_destroy(struct pipe_screen *pscreen)
 {
@@ -240,7 +165,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 {
        struct nv40_screen *screen = CALLOC_STRUCT(nv40_screen);
        struct nouveau_stateobj *so;
-       unsigned curie_class;
+       unsigned curie_class = 0;
        unsigned chipset = nvws->channel->device->chipset;
        int ret;
 
@@ -265,8 +190,6 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
                if (NV6X_GRCLASS4497_CHIPSETS & (1 << (chipset & 0x0f)))
                        curie_class = NV44TCL;
                break;
-       default:
-               break;
        }
 
        if (!curie_class) {
@@ -372,10 +295,8 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 
        screen->pipe.is_format_supported = nv40_screen_surface_format_supported;
 
-       screen->pipe.surface_map = nv40_surface_map;
-       screen->pipe.surface_unmap = nv40_surface_unmap;
-
        nv40_screen_init_miptree_functions(&screen->pipe);
+       nv40_screen_init_transfer_functions(&screen->pipe);
        u_simple_screen_init(&screen->pipe);
 
        return &screen->pipe;
index 4500aa0e5cc2ac1084620c1172eda15d0df3f268..7b503bd207dfda69c7793bbccec3f87396c06986 100644 (file)
@@ -34,4 +34,7 @@ nv40_screen(struct pipe_screen *screen)
        return (struct nv40_screen *)screen;
 }
 
+void
+nv40_screen_init_transfer_functions(struct pipe_screen *pscreen);
+
 #endif
index 2eff25aa836afd5b6738a37698687156219c17f6..c3ee4d234537d1dc317649dff573316899c46f94 100644 (file)
@@ -52,6 +52,7 @@ nv40_blend_state_create(struct pipe_context *pipe,
        so_data  (so, cso->dither ? 1 : 0);
 
        so_ref(so, &bso->so);
+       so_ref(NULL, &so);
        bso->pipe = *cso;
        return (void *)bso;
 }
@@ -414,6 +415,7 @@ nv40_rasterizer_state_create(struct pipe_context *pipe,
        }
 
        so_ref(so, &rsso->so);
+       so_ref(NULL, &so);
        rsso->pipe = *cso;
        return (void *)rsso;
 }
@@ -487,6 +489,7 @@ nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe,
        }
 
        so_ref(so, &zsaso->so);
+       so_ref(NULL, &so);
        zsaso->pipe = *cso;
        return (void *)zsaso;
 }
index 9c55903ae309cfc16362cfbb68e55e752b8e2749..8a9d8c8fdf608bc409f3b157f53a2edc38ba9a18 100644 (file)
@@ -79,9 +79,6 @@ struct nv40_miptree {
        struct pipe_buffer *buffer;
        uint total_size;
 
-       struct pipe_texture *shadow_tex;
-       struct pipe_surface *shadow_surface;
-
        struct {
                uint pitch;
                uint *image_offset;
index 95e6d7394f466330452b988b6d73878b78528603..8cd05ce66ef858f138d0c9d064b9cbf2ed8e7af3 100644 (file)
@@ -28,6 +28,7 @@ nv40_state_blend_colour_validate(struct nv40_context *nv40)
                       (float_to_ubyte(bcol->color[2]) <<  0)));
 
        so_ref(so, &nv40->state.hw[NV40_STATE_BCOL]);
+       so_ref(NULL, &so);
        return TRUE;
 }
 
index 454abad31f4f33f6ce4cafabde0717a129cdc6c7..be618a306bf739d49e7546687c9818f04e4b5dee 100644 (file)
@@ -12,7 +12,7 @@ static boolean
 nv40_state_framebuffer_validate(struct nv40_context *nv40)
 {
        struct pipe_framebuffer_state *fb = &nv40->framebuffer;
-       struct pipe_surface *rt[4], *zeta;
+       struct nv04_surface *rt[4], *zeta;
        uint32_t rt_enable, rt_format;
        int i, colour_format = 0, zeta_format = 0;
        struct nouveau_stateobj *so = so_new(64, 10);
@@ -27,7 +27,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
                } else {
                        colour_format = fb->cbufs[i]->format;
                        rt_enable |= (NV40TCL_RT_ENABLE_COLOR0 << i);
-                       rt[i] = fb->cbufs[i];
+                       rt[i] = (struct nv04_surface *)fb->cbufs[i];
                }
        }
 
@@ -37,13 +37,13 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
 
        if (fb->zsbuf) {
                zeta_format = fb->zsbuf->format;
-               zeta = fb->zsbuf;
+               zeta = (struct nv04_surface *)fb->zsbuf;
        }
 
-       if (!(rt[0]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
+       if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
                assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
                for (i = 1; i < fb->nr_cbufs; i++)
-                       assert(!(rt[i]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
+                       assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
 
                rt_format = NV40TCL_RT_FORMAT_TYPE_SWIZZLED |
                            log2i(fb->width) << NV40TCL_RT_FORMAT_LOG2_WIDTH_SHIFT |
@@ -78,60 +78,60 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
 
        if (rt_enable & NV40TCL_RT_ENABLE_COLOR0) {
                so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR0, 1);
-               so_reloc (so, nv40_surface_buffer(rt[0]), 0, rt_flags | NOUVEAU_BO_OR,
+               so_reloc (so, nv40_surface_buffer(&rt[0]->base), 0, rt_flags | NOUVEAU_BO_OR,
                          nv40->nvws->channel->vram->handle,
                          nv40->nvws->channel->gart->handle);
                so_method(so, nv40->screen->curie, NV40TCL_COLOR0_PITCH, 2);
-               so_data  (so, rt[0]->stride);
-               so_reloc (so, nv40_surface_buffer(rt[0]), rt[0]->offset, rt_flags |
+               so_data  (so, rt[0]->pitch);
+               so_reloc (so, nv40_surface_buffer(&rt[0]->base), rt[0]->base.offset, rt_flags |
                          NOUVEAU_BO_LOW, 0, 0);
        }
 
        if (rt_enable & NV40TCL_RT_ENABLE_COLOR1) {
                so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR1, 1);
-               so_reloc (so, nv40_surface_buffer(rt[1]), 0, rt_flags | NOUVEAU_BO_OR,
+               so_reloc (so, nv40_surface_buffer(&rt[1]->base), 0, rt_flags | NOUVEAU_BO_OR,
                          nv40->nvws->channel->vram->handle,
                          nv40->nvws->channel->gart->handle);
                so_method(so, nv40->screen->curie, NV40TCL_COLOR1_OFFSET, 2);
-               so_reloc (so, nv40_surface_buffer(rt[1]), rt[1]->offset, rt_flags |
+               so_reloc (so, nv40_surface_buffer(&rt[1]->base), rt[1]->base.offset, rt_flags |
                          NOUVEAU_BO_LOW, 0, 0);
-               so_data  (so, rt[1]->stride);
+               so_data  (so, rt[1]->pitch);
        }
 
        if (rt_enable & NV40TCL_RT_ENABLE_COLOR2) {
                so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR2, 1);
-               so_reloc (so, nv40_surface_buffer(rt[2]), 0, rt_flags | NOUVEAU_BO_OR,
+               so_reloc (so, nv40_surface_buffer(&rt[2]->base), 0, rt_flags | NOUVEAU_BO_OR,
                          nv40->nvws->channel->vram->handle,
                          nv40->nvws->channel->gart->handle);
                so_method(so, nv40->screen->curie, NV40TCL_COLOR2_OFFSET, 1);
-               so_reloc (so, nv40_surface_buffer(rt[2]), rt[2]->offset, rt_flags |
+               so_reloc (so, nv40_surface_buffer(&rt[2]->base), rt[2]->base.offset, rt_flags |
                          NOUVEAU_BO_LOW, 0, 0);
                so_method(so, nv40->screen->curie, NV40TCL_COLOR2_PITCH, 1);
-               so_data  (so, rt[2]->stride);
+               so_data  (so, rt[2]->pitch);
        }
 
        if (rt_enable & NV40TCL_RT_ENABLE_COLOR3) {
                so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR3, 1);
-               so_reloc (so, nv40_surface_buffer(rt[3]), 0, rt_flags | NOUVEAU_BO_OR,
+               so_reloc (so, nv40_surface_buffer(&rt[3]->base), 0, rt_flags | NOUVEAU_BO_OR,
                          nv40->nvws->channel->vram->handle,
                          nv40->nvws->channel->gart->handle);
                so_method(so, nv40->screen->curie, NV40TCL_COLOR3_OFFSET, 1);
-               so_reloc (so, nv40_surface_buffer(rt[3]), rt[3]->offset, rt_flags |
+               so_reloc (so, nv40_surface_buffer(&rt[3]->base), rt[3]->base.offset, rt_flags |
                          NOUVEAU_BO_LOW, 0, 0);
                so_method(so, nv40->screen->curie, NV40TCL_COLOR3_PITCH, 1);
-               so_data  (so, rt[3]->stride);
+               so_data  (so, rt[3]->pitch);
        }
 
        if (zeta_format) {
                so_method(so, nv40->screen->curie, NV40TCL_DMA_ZETA, 1);
-               so_reloc (so, nv40_surface_buffer(zeta), 0, rt_flags | NOUVEAU_BO_OR,
+               so_reloc (so, nv40_surface_buffer(&zeta->base), 0, rt_flags | NOUVEAU_BO_OR,
                          nv40->nvws->channel->vram->handle,
                          nv40->nvws->channel->gart->handle);
                so_method(so, nv40->screen->curie, NV40TCL_ZETA_OFFSET, 1);
-               so_reloc (so, nv40_surface_buffer(zeta), zeta->offset, rt_flags |
+               so_reloc (so, nv40_surface_buffer(&zeta->base), zeta->base.offset, rt_flags |
                          NOUVEAU_BO_LOW, 0, 0);
                so_method(so, nv40->screen->curie, NV40TCL_ZETA_PITCH, 1);
-               so_data  (so, zeta->stride);
+               so_data  (so, zeta->pitch);
        }
 
        so_method(so, nv40->screen->curie, NV40TCL_RT_ENABLE, 1);
@@ -150,6 +150,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
        so_data  (so, (1 << 12) | h);
 
        so_ref(so, &nv40->state.hw[NV40_STATE_FB]);
+       so_ref(NULL, &so);
        return TRUE;
 }
 
index 285239ef419f715e257f91e69b5ed0703f4bc56d..cf58d33906a9629c134f673ac8aaf6f937ac821f 100644 (file)
@@ -23,6 +23,7 @@ nv40_state_scissor_validate(struct nv40_context *nv40)
        }
 
        so_ref(so, &nv40->state.hw[NV40_STATE_SCISSOR]);
+       so_ref(NULL, &so);
        return TRUE;
 }
 
index 869a55b40536d9d59718f9f970ba6a08e1e75657..665d2d5fcaca698125438fdad42eb0d68aae9763 100644 (file)
@@ -7,7 +7,8 @@ nv40_state_viewport_validate(struct nv40_context *nv40)
        struct nouveau_stateobj *so;
        unsigned bypass;
 
-       if (nv40->render_mode == HW && !nv40->rasterizer->pipe.bypass_clipping)
+       if (nv40->render_mode == HW &&
+           !nv40->rasterizer->pipe.bypass_vs_clip_and_viewport)
                bypass = 0;
        else
                bypass = 1;
@@ -55,6 +56,7 @@ nv40_state_viewport_validate(struct nv40_context *nv40)
        }
 
        so_ref(so, &nv40->state.hw[NV40_STATE_VIEWPORT]);
+       so_ref(NULL, &so);
        return TRUE;
 }
 
index c4a5fb20d97c4eb5cae4bfcac7510d82ad7f029a..1a849da32d71aadd3737c5b46edc35ca0a799bcb 100644 (file)
@@ -33,7 +33,7 @@
 #include "util/u_tile.h"
 
 static void
-nv40_surface_copy(struct pipe_context *pipe, boolean do_flip,
+nv40_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -41,15 +41,6 @@ nv40_surface_copy(struct pipe_context *pipe, boolean do_flip,
        struct nv40_context *nv40 = nv40_context(pipe);
        struct nv04_surface_2d *eng2d = nv40->screen->eng2d;
 
-       if (do_flip) {
-               desty += height;
-               while (height--) {
-                       eng2d->copy(eng2d, dest, destx, desty--, src,
-                                   srcx, srcy++, width, 1);
-               }
-               return;
-       }
-
        eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
 }
 
diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c
new file mode 100644 (file)
index 0000000..728e8b5
--- /dev/null
@@ -0,0 +1,196 @@
+#include <pipe/p_state.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
+#include <nouveau/nouveau_winsys.h>
+#include "nv40_context.h"
+#include "nv40_screen.h"
+#include "nv40_state.h"
+
+struct nv40_transfer {
+       struct pipe_transfer base;
+       struct pipe_surface *surface;
+       bool direct;
+};
+
+static unsigned nv40_usage_tx_to_buf(unsigned tx_usage)
+{
+       switch (tx_usage) {
+               case PIPE_TRANSFER_READ:
+                       return PIPE_BUFFER_USAGE_CPU_READ;
+               case PIPE_TRANSFER_WRITE:
+                       return PIPE_BUFFER_USAGE_CPU_WRITE;
+               case PIPE_TRANSFER_READ_WRITE:
+                       return PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+               default:
+                       assert(0);
+       }
+
+       return -1;
+}
+
+static void
+nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
+                             struct pipe_texture *template)
+{
+       memset(template, 0, sizeof(struct pipe_texture));
+       template->target = pt->target;
+       template->format = pt->format;
+       template->width[0] = pt->width[level];
+       template->height[0] = pt->height[level];
+       template->depth[0] = 1;
+       template->block = pt->block;
+       template->nblocksx[0] = pt->nblocksx[level];
+       template->nblocksy[0] = pt->nblocksx[level];
+       template->last_level = 0;
+       template->compressed = pt->compressed;
+       template->nr_samples = pt->nr_samples;
+
+       template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
+                             NOUVEAU_TEXTURE_USAGE_LINEAR;
+}
+
+static struct pipe_transfer *
+nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+                 unsigned face, unsigned level, unsigned zslice,
+                 enum pipe_transfer_usage usage,
+                 unsigned x, unsigned y, unsigned w, unsigned h)
+{
+       struct nv40_miptree *mt = (struct nv40_miptree *)pt;
+       struct nv40_transfer *tx;
+       struct pipe_texture tx_tex_template, *tx_tex;
+
+       tx = CALLOC_STRUCT(nv40_transfer);
+       if (!tx)
+               return NULL;
+
+       pipe_texture_reference(&tx->base.texture, pt);
+       tx->base.format = pt->format;
+       tx->base.x = x;
+       tx->base.y = y;
+       tx->base.width = w;
+       tx->base.height = h;
+       tx->base.block = pt->block;
+       tx->base.nblocksx = pt->nblocksx[level];
+       tx->base.nblocksy = pt->nblocksy[level];
+       tx->base.stride = mt->level[level].pitch;
+       tx->base.usage = usage;
+       tx->base.face = face;
+       tx->base.level = level;
+       tx->base.zslice = zslice;
+
+       /* Direct access to texture */
+       if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
+            debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+           pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
+       {
+               tx->direct = true;
+               tx->surface = pscreen->get_tex_surface(pscreen, pt,
+                                                      face, level, zslice,
+                                                      nv40_usage_tx_to_buf(usage));
+               return &tx->base;
+       }
+
+       tx->direct = false;
+
+       nv40_compatible_transfer_tex(pt, level, &tx_tex_template);
+
+       tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
+       if (!tx_tex)
+       {
+               FREE(tx);
+               return NULL;
+       }
+
+       tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
+                                              0, 0, 0,
+                                              nv40_usage_tx_to_buf(usage));
+
+       pipe_texture_reference(&tx_tex, NULL);
+
+       if (!tx->surface)
+       {
+               pipe_surface_reference(&tx->surface, NULL);
+               FREE(tx);
+               return NULL;
+       }
+
+       if (usage != PIPE_TRANSFER_WRITE) {
+               struct nv40_screen *nvscreen = nv40_screen(pscreen);
+               struct pipe_surface *src;
+
+               src = pscreen->get_tex_surface(pscreen, pt,
+                                              face, level, zslice,
+                                              PIPE_BUFFER_USAGE_GPU_READ);
+
+               /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+               /* TODO: Check if SIFM can un-swizzle */
+               nvscreen->eng2d->copy(nvscreen->eng2d,
+                                     tx->surface, 0, 0,
+                                     src, 0, 0,
+                                     src->width, src->height);
+
+               pipe_surface_reference(&src, NULL);
+       }
+
+       return &tx->base;
+}
+
+static void
+nv40_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
+
+       if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) {
+               struct pipe_screen *pscreen = ptx->texture->screen;
+               struct nv40_screen *nvscreen = nv40_screen(pscreen);
+               struct pipe_surface *dst;
+
+               dst = pscreen->get_tex_surface(pscreen, ptx->texture,
+                                              ptx->face, ptx->level, ptx->zslice,
+                                              PIPE_BUFFER_USAGE_GPU_WRITE);
+
+               /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+               nvscreen->eng2d->copy(nvscreen->eng2d,
+                                     dst, 0, 0,
+                                     tx->surface, 0, 0,
+                                     dst->width, dst->height);
+
+               pipe_surface_reference(&dst, NULL);
+       }
+
+       pipe_surface_reference(&tx->surface, NULL);
+       pipe_texture_reference(&ptx->texture, NULL);
+       FREE(ptx);
+}
+
+static void *
+nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
+       struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
+       struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture;
+       void *map = pipe_buffer_map(pscreen, mt->buffer,
+                                   nv40_usage_tx_to_buf(ptx->usage));
+
+       return map + ns->base.offset +
+              ptx->y * ns->pitch + ptx->x * ptx->block.size;
+}
+
+static void
+nv40_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
+       struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture;
+
+       pipe_buffer_unmap(pscreen, mt->buffer);
+}
+
+void
+nv40_screen_init_transfer_functions(struct pipe_screen *pscreen)
+{
+       pscreen->get_tex_transfer = nv40_transfer_new;
+       pscreen->tex_transfer_destroy = nv40_transfer_del;
+       pscreen->transfer_map = nv40_transfer_map;
+       pscreen->transfer_unmap = nv40_transfer_unmap;
+}
index 8f1834628f7a010dfc234283b1355a97ce5efef2..f3518b2e4fe31323df6008b82a5f5b0cca482485 100644 (file)
@@ -537,10 +537,13 @@ nv40_vbo_validate(struct nv40_context *nv40)
        so_data  (vtxbuf, 0);
 
        so_ref(vtxbuf, &nv40->state.hw[NV40_STATE_VTXBUF]);
+       so_ref(NULL, &vtxbuf);
        nv40->state.dirty |= (1ULL << NV40_STATE_VTXBUF);
        so_ref(vtxfmt, &nv40->state.hw[NV40_STATE_VTXFMT]);
+       so_ref(NULL, &vtxfmt);
        nv40->state.dirty |= (1ULL << NV40_STATE_VTXFMT);
        so_ref(sattr, &nv40->state.hw[NV40_STATE_VTXATTR]);
+       so_ref(NULL, &sattr);
        nv40->state.dirty |= (1ULL << NV40_STATE_VTXATTR);
        return FALSE;
 }
index 0862386638cb553cde1a755c87fcfd0b7ebcb756..7df9a4d3264a9d14e8613d13ba6fcea44faebaf7 100644 (file)
@@ -916,6 +916,7 @@ check_gpu_resources:
                so_method(so, curie,  NV40TCL_CLIP_PLANE_ENABLE, 1);
                so_data  (so, vp->clip_ctrl);
                so_ref(so, &vp->so);
+               so_ref(NULL, &so);
 
                upload_code = TRUE;
        }
index be30400c0398768d55d39375d57b79f34a157199..612aea28a34b5c001752bf398f26386cd84dabbf 100644 (file)
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv50
 
-DRIVER_SOURCES = \
+C_SOURCES = \
        nv50_clear.c \
        nv50_context.c \
        nv50_draw.c \
@@ -15,15 +15,7 @@ DRIVER_SOURCES = \
        nv50_state_validate.c \
        nv50_surface.c \
        nv50_tex.c \
+       nv50_transfer.c \
        nv50_vbo.c
 
-C_SOURCES = \
-       $(COMMON_SOURCES) \
-       $(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
index 1e9d45cb3409c30fb771594b847f76c5f906e9f6..313e435e7a5a2e0e225d7f5e39a8a5d55f718afd 100644 (file)
@@ -64,10 +64,8 @@ struct nv50_rasterizer_stateobj {
 };
 
 struct nv50_miptree_level {
-       struct pipe_buffer **image;
        int *image_offset;
-       unsigned image_dirty_cpu[512/32];
-       unsigned image_dirty_gpu[512/32];
+       unsigned pitch;
 };
 
 struct nv50_miptree {
@@ -200,8 +198,4 @@ extern boolean nv50_state_validate(struct nv50_context *nv50);
 /* nv50_tex.c */
 extern void nv50_tex_validate(struct nv50_context *);
 
-/* nv50_miptree.c */
-extern void nv50_miptree_sync(struct pipe_screen *, struct nv50_miptree *,
-                             unsigned level, unsigned image);
-
 #endif
index 91091d53f57391355819f9dad1e54058476bc363..dc4688ccdc46bdc645be0b326bfb6a7a9528fbac 100644 (file)
@@ -29,7 +29,6 @@
 static struct pipe_texture *
 nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
 {
-       struct pipe_winsys *ws = pscreen->winsys;
        struct nv50_miptree *mt = CALLOC_STRUCT(nv50_miptree);
        struct pipe_texture *pt = &mt->base;
        unsigned usage, width = tmp->width[0], height = tmp->height[0];
@@ -37,7 +36,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
        int i, l;
 
        mt->base = *tmp;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = pscreen;
 
        usage = PIPE_BUFFER_USAGE_PIXEL;
@@ -72,7 +71,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
                pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
 
                lvl->image_offset = CALLOC(mt->image_nr, sizeof(int));
-               lvl->image = CALLOC(mt->image_nr, sizeof(struct pipe_buffer *));
+               lvl->pitch = align(pt->width[l] * pt->block.size, 64);
 
                width = MAX2(1, width >> 1);
                height = MAX2(1, height >> 1);
@@ -88,14 +87,13 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
                        size  = align(size, 64);
                        size *= align(pt->height[l], 8) * pt->block.size;
 
-                       lvl->image[i] = ws->buffer_create(ws, 256, 0, size);
                        lvl->image_offset[i] = mt->total_size;
 
                        mt->total_size += size;
                }
        }
 
-       mt->buffer = ws->buffer_create(ws, 256, usage, mt->total_size);
+       mt->buffer = pscreen->buffer_create(pscreen, 256, usage, mt->total_size);
        if (!mt->buffer) {
                FREE(mt);
                return NULL;
@@ -120,119 +118,23 @@ nv50_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
                return NULL;
 
        mt->base = *pt;
-       mt->base.refcount = 1;
+       pipe_reference_init(&mt->base.reference, 1);
        mt->base.screen = pscreen;
        mt->image_nr = 1;
+       mt->level[0].pitch = *stride;
        mt->level[0].image_offset = CALLOC(1, sizeof(unsigned));
 
-       pipe_buffer_reference(pscreen, &mt->buffer, pb);
+       pipe_buffer_reference(&mt->buffer, pb);
        return &mt->base;
 }
 
-static INLINE void
-mark_dirty(uint32_t *flags, unsigned image)
-{
-       flags[image / 32] |= (1 << (image % 32));
-}
-
-static INLINE void
-mark_clean(uint32_t *flags, unsigned image)
-{
-       flags[image / 32] &= ~(1 << (image % 32));
-}
-
-static INLINE int
-is_dirty(uint32_t *flags, unsigned image)
-{
-       return !!(flags[image / 32] & (1 << (image % 32)));
-}
-
 static void
-nv50_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt)
-{
-       struct pipe_texture *pt = *ppt;
-
-       *ppt = NULL;
-
-       if (--pt->refcount <= 0) {
-               struct nv50_miptree *mt = nv50_miptree(pt);
-
-               pipe_buffer_reference(pscreen, &mt->buffer, NULL);
-               FREE(mt);
-       }
-}
-
-void
-nv50_miptree_sync(struct pipe_screen *pscreen, struct nv50_miptree *mt,
-                 unsigned level, unsigned image)
+nv50_miptree_destroy(struct pipe_texture *pt)
 {
-       struct nv50_screen *nvscreen = nv50_screen(pscreen);
-       struct nv50_miptree_level *lvl = &mt->level[level];
-       struct pipe_surface *dst, *src;
-       unsigned face = 0, zslice = 0;
-
-       if (!is_dirty(lvl->image_dirty_cpu, image))
-               return;
-
-       if (mt->base.target == PIPE_TEXTURE_CUBE)
-               face = image;
-       else
-       if (mt->base.target == PIPE_TEXTURE_3D)
-               zslice = image;
-
-       /* Mark as clean already - so we don't continually call this function
-        * trying to get a GPU_WRITE pipe_surface!
-        */
-       mark_clean(lvl->image_dirty_cpu, image);
-
-       /* Pretend we're doing CPU access so we get the backing pipe_surface
-        * and not a view into the larger miptree.
-        */
-       src = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
-                                      PIPE_BUFFER_USAGE_CPU_READ);
-
-       /* Pretend we're only reading with the GPU so surface doesn't get marked
-        * as dirtied by the GPU.
-        */
-       dst = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
-                                      PIPE_BUFFER_USAGE_GPU_READ);
-
-       nv50_surface_do_copy(nvscreen, dst, 0, 0, src, 0, 0, dst->width, dst->height);
-
-       pscreen->tex_surface_release(pscreen, &dst);
-       pscreen->tex_surface_release(pscreen, &src);
-}
-
-/* The reverse of the above */
-static void
-nv50_miptree_sync_cpu(struct pipe_screen *pscreen, struct nv50_miptree *mt,
-                     unsigned level, unsigned image)
-{
-       struct nv50_screen *nvscreen = nv50_screen(pscreen);
-       struct nv50_miptree_level *lvl = &mt->level[level];
-       struct pipe_surface *dst, *src;
-       unsigned face = 0, zslice = 0;
-
-       if (!is_dirty(lvl->image_dirty_gpu, image))
-               return;
-
-       if (mt->base.target == PIPE_TEXTURE_CUBE)
-               face = image;
-       else
-       if (mt->base.target == PIPE_TEXTURE_3D)
-               zslice = image;
-
-       mark_clean(lvl->image_dirty_gpu, image);
-
-       src = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
-                                      PIPE_BUFFER_USAGE_GPU_READ);
-       dst = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
-                                      PIPE_BUFFER_USAGE_CPU_READ);
-
-       nv50_surface_do_copy(nvscreen, dst, 0, 0, src, 0, 0, dst->width, dst->height);
+       struct nv50_miptree *mt = nv50_miptree(pt);
 
-       pscreen->tex_surface_release(pscreen, &dst);
-       pscreen->tex_surface_release(pscreen, &src);
+        pipe_buffer_reference(&mt->buffer, NULL);
+        FREE(mt);
 }
 
 static struct pipe_surface *
@@ -260,52 +162,24 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
        ps->format = pt->format;
        ps->width = pt->width[level];
        ps->height = pt->height[level];
-       ps->block = pt->block;
-       ps->nblocksx = pt->nblocksx[level];
-       ps->nblocksy = pt->nblocksy[level];
-       ps->stride = ps->width * ps->block.size;
        ps->usage = flags;
        ps->status = PIPE_SURFACE_STATUS_DEFINED;
-       ps->refcount = 1;
+       pipe_reference_init(&ps->reference, 1);
        ps->face = face;
        ps->level = level;
        ps->zslice = zslice;
-
-       if (flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
-               assert(!(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE));
-               nv50_miptree_sync_cpu(pscreen, mt, level, img);
-
-               ps->offset = 0;
-               pipe_texture_reference(&ps->texture, pt);
-
-               if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
-                       mark_dirty(lvl->image_dirty_cpu, img);
-       } else {
-               nv50_miptree_sync(pscreen, mt, level, img);
-
-               ps->offset = lvl->image_offset[img];
-               pipe_texture_reference(&ps->texture, pt);
-
-               if (flags & PIPE_BUFFER_USAGE_GPU_WRITE)
-                       mark_dirty(lvl->image_dirty_gpu, img);
-       }
+       ps->offset = lvl->image_offset[img];
 
        return ps;
 }
 
 static void
-nv50_miptree_surface_del(struct pipe_screen *pscreen,
-                        struct pipe_surface **psurface)
+nv50_miptree_surface_del(struct pipe_surface *ps)
 {
-       struct pipe_surface *ps = *psurface;
        struct nv50_surface *s = nv50_surface(ps);
 
-       *psurface = NULL;
-
-       if (--ps->refcount <= 0) {
-               pipe_texture_reference(&ps->texture, NULL);
-               FREE(s);
-       }
+        pipe_texture_reference(&ps->texture, NULL);
+        FREE(s);
 }
 
 void
@@ -313,8 +187,8 @@ nv50_screen_init_miptree_functions(struct pipe_screen *pscreen)
 {
        pscreen->texture_create = nv50_miptree_create;
        pscreen->texture_blanket = nv50_miptree_blanket;
-       pscreen->texture_release = nv50_miptree_release;
+       pscreen->texture_destroy = nv50_miptree_destroy;
        pscreen->get_tex_surface = nv50_miptree_surface_new;
-       pscreen->tex_surface_release = nv50_miptree_surface_del;
+       pscreen->tex_surface_destroy = nv50_miptree_surface_del;
 }
 
index 14c5d47e790d3a90eb62dc0b08262c0f38be1d36..2d15868ae8439f4abcf2f178acd9b3c69a9813f5 100644 (file)
@@ -1603,7 +1603,7 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p)
 {
        struct nouveau_channel *chan = nv50->screen->nvws->channel;
        struct nouveau_grobj *tesla = nv50->screen->tesla;
-       struct pipe_winsys *ws = nv50->pipe.winsys;
+       struct pipe_screen *screen = nv50->pipe.screen;
        struct nv50_program_exec *e;
        struct nouveau_stateobj *so;
        const unsigned flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_WR;
@@ -1611,7 +1611,7 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p)
        boolean upload = FALSE;
 
        if (!p->buffer) {
-               p->buffer = ws->buffer_create(ws, 0x100, 0, p->exec_size * 4);
+               p->buffer = screen->buffer_create(screen, 0x100, 0, p->exec_size * 4);
                upload = TRUE;
        }
 
@@ -1719,6 +1719,7 @@ nv50_vertprog_validate(struct nv50_context *nv50)
        so_method(so, tesla, 0x140c, 1);
        so_data  (so, 0); /* program start offset */
        so_ref(so, &nv50->state.vertprog);
+       so_ref(NULL, &so);
 }
 
 void
@@ -1758,6 +1759,7 @@ nv50_fragprog_validate(struct nv50_context *nv50)
        so_method(so, tesla, 0x1414, 1);
        so_data  (so, 0); /* program start offset */
        so_ref(so, &nv50->state.fragprog);
+       so_ref(NULL, &so);
 }
 
 void
@@ -1775,7 +1777,7 @@ nv50_program_destroy(struct nv50_context *nv50, struct nv50_program *p)
        p->exec_size = 0;
 
        if (p->buffer)
-               pipe_buffer_reference(pscreen, &p->buffer, NULL);
+               pipe_buffer_reference(&p->buffer, NULL);
 
        nv50->screen->nvws->res_free(&p->data);
 
index 20745ceab8b9d1ab8bedc3f8f1b2559df16c928e..a2c56f99a89b9da49312317fe3f8043112acfc19 100644 (file)
@@ -41,13 +41,13 @@ nv50_query(struct pipe_query *pipe)
 static struct pipe_query *
 nv50_query_create(struct pipe_context *pipe, unsigned type)
 {
-       struct pipe_winsys *ws = pipe->winsys;
+       struct pipe_screen *screen = pipe->winsys;
        struct nv50_query *q = CALLOC_STRUCT(nv50_query);
 
        assert (q->type == PIPE_QUERY_OCCLUSION_COUNTER);
        q->type = type;
 
-       q->buffer = ws->buffer_create(ws, 256, 0, 16);
+       q->buffer = screen->buffer_create(screen, 256, 0, 16);
        if (!q->buffer) {
                FREE(q);
                return NULL;
@@ -62,7 +62,7 @@ nv50_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
        struct nv50_query *q = nv50_query(pq);
 
        if (q) {
-               pipe_buffer_reference(pipe->screen, &q->buffer, NULL);
+               pipe_buffer_reference(&q->buffer, NULL);
                FREE(q);
        }
 }
@@ -90,11 +90,12 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq)
        struct nouveau_channel *chan = nv50->screen->nvws->channel;
        struct nouveau_grobj *tesla = nv50->screen->tesla;
        struct nv50_query *q = nv50_query(pq);
+       struct nouveau_bo *bo = nv50->screen->nvws->get_bo(q->buffer);
 
        WAIT_RING (chan, 5);
        BEGIN_RING(chan, tesla, 0x1b00, 4);
-       OUT_RELOCh(chan, q->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
-       OUT_RELOCl(chan, q->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCh(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCl(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
        OUT_RING  (chan, 0x00000000);
        OUT_RING  (chan, 0x0100f002);
        FIRE_RING (chan);
index 58d7a621a8045cb8c5d5e25d425126466b79a9ce..298056459489c4dbc895b5f6c3f96f6c82e1c16c 100644 (file)
 
 #include "nouveau/nouveau_stateobj.h"
 
-#define NV5X_GRCLASS5097_CHIPSETS 0x00000001
-#define NV8X_GRCLASS8297_CHIPSETS 0x00000050
-#define NV9X_GRCLASS8297_CHIPSETS 0x00000014
-
 static boolean
 nv50_screen_is_format_supported(struct pipe_screen *pscreen,
                                enum pipe_format format,
@@ -124,9 +120,9 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
                return 1;
        case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
                return 0;
-       case NOUVEAU_CAP_HW_VTXBUF:     
+       case NOUVEAU_CAP_HW_VTXBUF:
                return 1;
-       case NOUVEAU_CAP_HW_IDXBUF:     
+       case NOUVEAU_CAP_HW_IDXBUF:
                return 0;
        default:
                NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
@@ -173,36 +169,38 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
                return NULL;
        screen->nvws = nvws;
 
-       /* 2D object */
-       ret = nvws->grobj_alloc(nvws, NV50_2D, &screen->eng2d);
+       /* DMA engine object */
+       ret = nvws->grobj_alloc(nvws, 0x5039, &screen->m2mf);
        if (ret) {
-               NOUVEAU_ERR("Error creating 2D object: %d\n", ret);
+               NOUVEAU_ERR("Error creating M2MF object: %d\n", ret);
                nv50_screen_destroy(&screen->pipe);
                return NULL;
        }
 
-       /* 3D object */
-       if ((chipset & 0xf0) != 0x50 && (chipset & 0xf0) != 0x80) {
-               NOUVEAU_ERR("Not a G8x chipset\n");
+       /* 2D object */
+       ret = nvws->grobj_alloc(nvws, NV50_2D, &screen->eng2d);
+       if (ret) {
+               NOUVEAU_ERR("Error creating 2D object: %d\n", ret);
                nv50_screen_destroy(&screen->pipe);
                return NULL;
        }
 
+       /* 3D object */
        switch (chipset & 0xf0) {
        case 0x50:
-               if (NV5X_GRCLASS5097_CHIPSETS & (1 << (chipset & 0x0f)))
-                       tesla_class = 0x5097;
+               tesla_class = 0x5097;
                break;
        case 0x80:
-               if (NV8X_GRCLASS8297_CHIPSETS & (1 << (chipset & 0x0f)))
-                       tesla_class = 0x8297;
-               break;
        case 0x90:
-               if (NV9X_GRCLASS8297_CHIPSETS & (1 << (chipset & 0x0f)))
-                       tesla_class = 0x8297;
+               tesla_class = 0x8297;
                break;
-       default:
+       case 0xa0:
+               tesla_class = 0x8397;
                break;
+       default:
+               NOUVEAU_ERR("Not a known NV50 chipset: NV%02x\n", chipset);
+               nv50_screen_destroy(&screen->pipe);
+               return NULL;
        }
 
        if (tesla_class == 0) {
@@ -226,6 +224,31 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
                return NULL;
        }
 
+        /* Setup the pipe */
+       screen->pipe.winsys = ws;
+
+       screen->pipe.destroy = nv50_screen_destroy;
+
+       screen->pipe.get_name = nv50_screen_get_name;
+       screen->pipe.get_vendor = nv50_screen_get_vendor;
+       screen->pipe.get_param = nv50_screen_get_param;
+       screen->pipe.get_paramf = nv50_screen_get_paramf;
+
+       screen->pipe.is_format_supported = nv50_screen_is_format_supported;
+
+       nv50_screen_init_miptree_functions(&screen->pipe);
+       nv50_transfer_init_screen_functions(&screen->pipe);
+       u_simple_screen_init(&screen->pipe);
+
+       /* Static M2MF init */
+       so = so_new(32, 0);
+       so_method(so, screen->m2mf, 0x0180, 3);
+       so_data  (so, screen->sync->handle);
+       so_data  (so, screen->nvws->channel->vram->handle);
+       so_data  (so, screen->nvws->channel->vram->handle);
+       so_emit(nvws, so);
+       so_ref (NULL, &so);
+
        /* Static 2D init */
        so = so_new(64, 0);
        so_method(so, screen->eng2d, NV50_2D_DMA_NOTIFY, 4);
@@ -268,7 +291,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
        so_data  (so, 8);
 
        /* Shared constant buffer */
-       screen->constbuf = ws->buffer_create(ws, 0, 0, 128 * 4 * 4);
+       screen->constbuf = screen->pipe.buffer_create(&screen->pipe, 0, 0, 128 * 4 * 4);
        if (nvws->res_init(&screen->vp_data_heap, 0, 128)) {
                NOUVEAU_ERR("Error initialising constant buffer\n");
                nv50_screen_destroy(&screen->pipe);
@@ -287,7 +310,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
         * blocks.  At some point we *may* want to go the NVIDIA way of doing
         * things?
         */
-       screen->tic = ws->buffer_create(ws, 0, 0, 32 * 8 * 4);
+       screen->tic = screen->pipe.buffer_create(&screen->pipe, 0, 0, 32 * 8 * 4);
        so_method(so, screen->tesla, 0x1280, 3);
        so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
                  NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
@@ -301,7 +324,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
                  NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
        so_data  (so, 0x00000800);
 
-       screen->tsc = ws->buffer_create(ws, 0, 0, 32 * 8 * 4);
+       screen->tsc = screen->pipe.buffer_create(&screen->pipe, 0, 0, 32 * 8 * 4);
        so_method(so, screen->tesla, 0x1280, 3);
        so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
                  NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
@@ -333,24 +356,10 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
        so_data  (so, 1);
 
        so_emit(nvws, so);
-       so_ref(so, &screen->static_init);
+       so_ref (so, &screen->static_init);
+       so_ref (NULL, &so);
        nvws->push_flush(nvws, 0, NULL);
 
-       screen->pipe.winsys = ws;
-
-       screen->pipe.destroy = nv50_screen_destroy;
-
-       screen->pipe.get_name = nv50_screen_get_name;
-       screen->pipe.get_vendor = nv50_screen_get_vendor;
-       screen->pipe.get_param = nv50_screen_get_param;
-       screen->pipe.get_paramf = nv50_screen_get_paramf;
-
-       screen->pipe.is_format_supported = nv50_screen_is_format_supported;
-
-       nv50_screen_init_miptree_functions(&screen->pipe);
-       nv50_surface_init_screen_functions(&screen->pipe);
-       u_simple_screen_init(&screen->pipe);
-
        return &screen->pipe;
 }
 
index c888ca071c8d621fbccea8d5d7055092df35e064..db567aaac892060f28849dbfe416456b8409e256 100644 (file)
@@ -12,6 +12,7 @@ struct nv50_screen {
 
        struct nouveau_grobj *tesla;
        struct nouveau_grobj *eng2d;
+       struct nouveau_grobj *m2mf;
        struct nouveau_notifier *sync;
 
        struct pipe_buffer *constbuf;
@@ -29,6 +30,6 @@ nv50_screen(struct pipe_screen *screen)
        return (struct nv50_screen *)screen;
 }
 
-void nv50_surface_init_screen_functions(struct pipe_screen *);
+void nv50_transfer_init_screen_functions(struct pipe_screen *);
 
 #endif
index 787ff958ec7003c695f7923a87029e32a61f9c50..ba852194cddde7f6e5b417d566a722c27e1a2f59 100644 (file)
@@ -85,6 +85,7 @@ nv50_blend_state_create(struct pipe_context *pipe,
 
        bso->pipe = *cso;
        so_ref(so, &bso->so);
+       so_ref(NULL, &so);
        return (void *)bso;
 }
 
@@ -352,6 +353,7 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,
 
        rso->pipe = *cso;
        so_ref(so, &rso->so);
+       so_ref(NULL, &so);
        return (void *)rso;
 }
 
@@ -438,6 +440,7 @@ nv50_depth_stencil_alpha_state_create(struct pipe_context *pipe,
 
        zsa->pipe = *cso;
        so_ref(so, &zsa->so);
+       so_ref(NULL, &so);
        return (void *)zsa;
 }
 
index 948112ffa9febe16da781591cff5c916a7340a15..85098a78a25711045543d90427a34b8197e65a60 100644 (file)
@@ -124,6 +124,7 @@ nv50_state_validate_fb(struct nv50_context *nv50)
        so_data  (so, h);
 
        so_ref(so, &nv50->state.fb);
+       so_ref(NULL, &so);
 }
 
 static void
@@ -214,6 +215,7 @@ nv50_state_validate(struct nv50_context *nv50)
                so_data  (so, fui(nv50->blend_colour.color[2]));
                so_data  (so, fui(nv50->blend_colour.color[3]));
                so_ref(so, &nv50->state.blend_colour);
+               so_ref(NULL, &so);
        }
 
        if (nv50->dirty & NV50_NEW_STIPPLE) {
@@ -222,6 +224,7 @@ nv50_state_validate(struct nv50_context *nv50)
                for (i = 0; i < 32; i++)
                        so_data(so, nv50->stipple.stipple[i]);
                so_ref(so, &nv50->state.stipple);
+               so_ref(NULL, &so);
        }
 
        if (nv50->dirty & (NV50_NEW_SCISSOR | NV50_NEW_RASTERIZER)) {
@@ -243,6 +246,7 @@ nv50_state_validate(struct nv50_context *nv50)
                        so_data(so, (8192 << 16));
                }
                so_ref(so, &nv50->state.scissor);
+               so_ref(NULL, &so);
                nv50->state.dirty |= NV50_NEW_SCISSOR;
        }
 scissor_uptodate:
@@ -250,7 +254,7 @@ scissor_uptodate:
        if (nv50->dirty & NV50_NEW_VIEWPORT) {
                unsigned bypass;
 
-               if (!nv50->rasterizer->pipe.bypass_clipping)
+               if (!nv50->rasterizer->pipe.bypass_vs_clip_and_viewport)
                        bypass = 0;
                else
                        bypass = 1;
@@ -283,6 +287,7 @@ scissor_uptodate:
                }
 
                so_ref(so, &nv50->state.viewport);
+               so_ref(NULL, &so);
        }
 viewport_uptodate:
 
@@ -296,6 +301,7 @@ viewport_uptodate:
                for (i = 0; i < nv50->sampler_nr; i++)
                        so_datap (so, nv50->sampler[i], 8);
                so_ref(so, &nv50->state.tsc_upload);
+               so_ref(NULL, &so);
        }
 
        if (nv50->dirty & NV50_NEW_TEXTURE)
index f2dd2eb30bef112cbbac6fcd578e53ec53581ab9..0cc5168144d644923ed6e3da7978e5e7135206ab 100644 (file)
@@ -51,6 +51,7 @@ nv50_format(enum pipe_format format)
 static int
 nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst)
 {
+       struct nv50_miptree *mt = nv50_miptree(ps->texture);
        struct nouveau_channel *chan = screen->nvws->channel;
        struct nouveau_grobj *eng2d = screen->eng2d;
        struct nouveau_bo *bo;
@@ -70,7 +71,7 @@ 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, ps->stride);
+               OUT_RING  (chan, mt->level[0].pitch);
                OUT_RING  (chan, ps->width);
                OUT_RING  (chan, ps->height);
                OUT_RELOCh(chan, bo, ps->offset, flags);
@@ -143,7 +144,7 @@ nv50_surface_do_copy(struct nv50_screen *screen, struct pipe_surface *dst,
 }
 
 static void
-nv50_surface_copy(struct pipe_context *pipe, boolean flip,
+nv50_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -153,16 +154,8 @@ nv50_surface_copy(struct pipe_context *pipe, boolean flip,
 
        assert(src->format == dest->format);
 
-       if (flip) {
-               desty += height;
-               while (height--) {
-                       nv50_surface_do_copy(screen, dest, destx, desty--, src,
-                                            srcx, srcy++, width, 1);
-               }
-       } else {
-               nv50_surface_do_copy(screen, dest, destx, desty, src, srcx,
+       nv50_surface_do_copy(screen, dest, destx, desty, src, srcx,
                                     srcy, width, height);
-       }
 }
 
 static void
@@ -197,23 +190,6 @@ nv50_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest,
        OUT_RING  (chan, height);
 }
 
-static void *
-nv50_surface_map(struct pipe_screen *screen, struct pipe_surface *ps,
-                unsigned flags )
-{
-       struct pipe_winsys *ws = screen->winsys;
-
-       return ws->buffer_map(ws, nv50_surface_buffer(ps), flags);
-}
-
-static void
-nv50_surface_unmap(struct pipe_screen *pscreen, struct pipe_surface *ps)
-{
-       struct pipe_winsys *ws = pscreen->winsys;
-
-       ws->buffer_unmap(ws, nv50_surface_buffer(ps));
-}
-
 void
 nv50_init_surface_functions(struct nv50_context *nv50)
 {
@@ -221,10 +197,4 @@ nv50_init_surface_functions(struct nv50_context *nv50)
        nv50->pipe.surface_fill = nv50_surface_fill;
 }
 
-void
-nv50_surface_init_screen_functions(struct pipe_screen *pscreen)
-{
-       pscreen->surface_map = nv50_surface_map;
-       pscreen->surface_unmap = nv50_surface_unmap;
-}
 
index 675f9b20cbca9fb0bc7d149a028daf78a3ba7db9..223c8a3a456197bf04931e817c6ba0b1470456e2 100644 (file)
@@ -135,7 +135,7 @@ nv50_tex_validate(struct nv50_context *nv50)
 {
        struct nouveau_grobj *tesla = nv50->screen->tesla;
        struct nouveau_stateobj *so;
-       int unit, level, image;
+       int unit;
 
        so = so_new(nv50->miptree_nr * 8 + 3, nv50->miptree_nr * 2);
        so_method(so, tesla, 0x0f00, 1);
@@ -144,13 +144,6 @@ nv50_tex_validate(struct nv50_context *nv50)
        for (unit = 0; unit < nv50->miptree_nr; unit++) {
                struct nv50_miptree *mt = nv50->miptree[unit];
 
-               for (level = 0; level <= mt->base.last_level; level++) {
-                       for (image = 0; image < mt->image_nr; image++) {
-                               nv50_miptree_sync(&nv50->screen->pipe, mt,
-                                                 level, image);
-                       }
-               }
-
                if (nv50_tex_construct(so, mt)) {
                        NOUVEAU_ERR("failed tex validate\n");
                        so_ref(NULL, &so);
@@ -159,5 +152,6 @@ nv50_tex_validate(struct nv50_context *nv50)
        }
 
        so_ref(so, &nv50->state.tic_upload);
+       so_ref(NULL, &so);
 }
 
diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c
new file mode 100644 (file)
index 0000000..747195b
--- /dev/null
@@ -0,0 +1,211 @@
+
+#include "pipe/p_context.h"
+#include "pipe/p_inlines.h"
+
+#include "nv50_context.h"
+
+struct nv50_transfer {
+       struct pipe_transfer base;
+       struct pipe_buffer *buffer;
+       struct nv50_miptree_level *level;
+       int level_pitch;
+       int level_width;
+       int level_height;
+       int level_x;
+       int level_y;
+};
+
+static void
+nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src,
+                       int src_pitch, int sx, int sy, int sw, int sh,
+                       struct pipe_buffer *dst, int dst_pitch, int dx, int dy,
+                       int dw, int dh, int cpp, int width, int height,
+                       unsigned src_reloc, unsigned dst_reloc)
+{
+       struct nv50_screen *screen = nv50_screen(pscreen);
+       struct nouveau_winsys *nvws = screen->nvws;
+       struct nouveau_channel *chan = nvws->channel;
+       struct nouveau_grobj *m2mf = screen->m2mf;
+       struct nouveau_bo *src_bo = nvws->get_bo(src);
+       struct nouveau_bo *dst_bo = nvws->get_bo(dst);
+       unsigned src_offset = 0, dst_offset = 0;
+
+       src_reloc |= NOUVEAU_BO_RD;
+       dst_reloc |= NOUVEAU_BO_WR;
+
+       WAIT_RING (chan, 14);
+
+       if (!src_bo->tiled) {
+               BEGIN_RING(chan, m2mf, 0x0200, 1);
+               OUT_RING  (chan, 1);
+               BEGIN_RING(chan, m2mf, 0x0314, 1);
+               OUT_RING  (chan, src_pitch);
+               src_offset = (sy * src_pitch) + (sx * cpp);
+       } else {
+               BEGIN_RING(chan, m2mf, 0x0200, 6);
+               OUT_RING  (chan, 0);
+               OUT_RING  (chan, 0);
+               OUT_RING  (chan, sw * cpp);
+               OUT_RING  (chan, sh);
+               OUT_RING  (chan, 1);
+               OUT_RING  (chan, 0);
+       }
+
+       if (!dst_bo->tiled) {
+               BEGIN_RING(chan, m2mf, 0x021c, 1);
+               OUT_RING  (chan, 1);
+               BEGIN_RING(chan, m2mf, 0x0318, 1);
+               OUT_RING  (chan, dst_pitch);
+               dst_offset = (dy * dst_pitch) + (dx * cpp);
+       } else {
+               BEGIN_RING(chan, m2mf, 0x021c, 6);
+               OUT_RING  (chan, 0);
+               OUT_RING  (chan, 0);
+               OUT_RING  (chan, dw * cpp);
+               OUT_RING  (chan, dh);
+               OUT_RING  (chan, 1);
+               OUT_RING  (chan, 0);
+       }
+
+       while (height) {
+               int line_count = height > 2047 ? 2047 : height;
+
+               WAIT_RING (chan, 15);
+               BEGIN_RING(chan, m2mf, 0x0238, 2);
+               OUT_RELOCh(chan, src_bo, src_offset, src_reloc);
+               OUT_RELOCh(chan, dst_bo, dst_offset, dst_reloc);
+               BEGIN_RING(chan, m2mf, 0x030c, 2);
+               OUT_RELOCl(chan, src_bo, src_offset, src_reloc);
+               OUT_RELOCl(chan, dst_bo, dst_offset, dst_reloc);
+               if (src_bo->tiled) {
+                       BEGIN_RING(chan, m2mf, 0x0218, 1);
+                       OUT_RING  (chan, (dy << 16) | sx);
+               } else {
+                       src_offset += (line_count * src_pitch);
+               }
+               if (dst_bo->tiled) {
+                       BEGIN_RING(chan, m2mf, 0x0234, 1);
+                       OUT_RING  (chan, (sy << 16) | dx);
+               } else {
+                       dst_offset += (line_count * dst_pitch);
+               }
+               BEGIN_RING(chan, m2mf, 0x031c, 4);
+               OUT_RING  (chan, width * cpp);
+               OUT_RING  (chan, line_count);
+               OUT_RING  (chan, 0x00000101);
+               OUT_RING  (chan, 0);
+               FIRE_RING (chan);
+
+               height -= line_count;
+               sy += line_count;
+               dy += line_count;
+       }
+}
+
+static struct pipe_transfer *
+nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+                 unsigned face, unsigned level, unsigned zslice,
+                 enum pipe_transfer_usage usage,
+                 unsigned x, unsigned y, unsigned w, unsigned h)
+{
+       struct nv50_miptree *mt = nv50_miptree(pt);
+       struct nv50_miptree_level *lvl = &mt->level[level];
+       struct nv50_transfer *tx;
+       unsigned image = 0;
+
+       if (pt->target == PIPE_TEXTURE_CUBE)
+               image = face;
+       else
+       if (pt->target == PIPE_TEXTURE_3D)
+               image = zslice;
+
+       tx = CALLOC_STRUCT(nv50_transfer);
+       if (!tx)
+               return NULL;
+
+       pipe_texture_reference(&tx->base.texture, pt);
+       tx->base.format = pt->format;
+       tx->base.width = w;
+       tx->base.height = h;
+       tx->base.block = pt->block;
+       tx->base.nblocksx = pt->nblocksx[level];
+       tx->base.nblocksy = pt->nblocksy[level];
+       tx->base.stride = (w * pt->block.size);
+       tx->base.usage = usage;
+
+       tx->level = lvl;
+       tx->level_pitch = lvl->pitch;
+       tx->level_width = mt->base.width[level];
+       tx->level_height = mt->base.height[level];
+       tx->level_x = x;
+       tx->level_y = y;
+       tx->buffer =
+               pipe_buffer_create(pscreen, 0, NOUVEAU_BUFFER_USAGE_TRANSFER,
+                                  w * tx->base.block.size * h);
+
+       if (usage != PIPE_TRANSFER_WRITE) {
+               nv50_transfer_rect_m2mf(pscreen, mt->buffer, tx->level_pitch,
+                                       x, y, tx->level_width, tx->level_height,
+                                       tx->buffer, tx->base.stride, 0, 0,
+                                       tx->base.width, tx->base.height,
+                                       tx->base.block.size, w, h,
+                                       NOUVEAU_BO_VRAM | NOUVEAU_BO_GART,
+                                       NOUVEAU_BO_GART);
+       }
+
+       return &tx->base;
+}
+
+static void
+nv50_transfer_del(struct pipe_transfer *ptx)
+{
+       struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
+       struct nv50_miptree *mt = nv50_miptree(ptx->texture);
+
+       if (ptx->usage != PIPE_TRANSFER_READ) {
+               struct pipe_screen *pscreen = ptx->texture->screen;
+               nv50_transfer_rect_m2mf(pscreen, tx->buffer, tx->base.stride,
+                                       0, 0, tx->base.width, tx->base.height,
+                                       mt->buffer, tx->level_pitch,
+                                       tx->level_x, tx->level_y,
+                                       tx->level_width, tx->level_height,
+                                       tx->base.block.size, tx->base.width,
+                                       tx->base.height, NOUVEAU_BO_GART,
+                                       NOUVEAU_BO_VRAM | NOUVEAU_BO_GART);
+       }
+
+       pipe_buffer_reference(&tx->buffer, NULL);
+       pipe_texture_reference(&ptx->texture, NULL);
+       FREE(ptx);
+}
+
+static void *
+nv50_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
+       unsigned flags = 0;
+
+       if (ptx->usage & PIPE_TRANSFER_WRITE)
+               flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
+       if (ptx->usage & PIPE_TRANSFER_READ)
+               flags |= PIPE_BUFFER_USAGE_CPU_READ;
+
+       return pipe_buffer_map(pscreen, tx->buffer, flags);
+}
+
+static void
+nv50_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+       struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
+
+       pipe_buffer_unmap(pscreen, tx->buffer);
+}
+
+void
+nv50_transfer_init_screen_functions(struct pipe_screen *pscreen)
+{
+       pscreen->get_tex_transfer = nv50_transfer_new;
+       pscreen->tex_transfer_destroy = nv50_transfer_del;
+       pscreen->transfer_map = nv50_transfer_map;
+       pscreen->transfer_unmap = nv50_transfer_unmap;
+}
index 0c970adb03afdfdca33f4f44fc6d3e0f90136e33..0749c906914859c3c9b01f9e34d91271afc52ce8 100644 (file)
@@ -202,7 +202,7 @@ nv50_vbo_validate(struct nv50_context *nv50)
 {
        struct nouveau_grobj *tesla = nv50->screen->tesla;
        struct nouveau_stateobj *vtxbuf, *vtxfmt;
-       int i, vpi = 0;
+       int i;
 
        vtxbuf = so_new(nv50->vtxelt_nr * 4, nv50->vtxelt_nr * 2);
        vtxfmt = so_new(nv50->vtxelt_nr + 1, 0);
@@ -250,5 +250,7 @@ nv50_vbo_validate(struct nv50_context *nv50)
 
        so_ref (vtxfmt, &nv50->state.vtxfmt);
        so_ref (vtxbuf, &nv50->state.vtxbuf);
+       so_ref (NULL, &vtxbuf);
+       so_ref (NULL, &vtxfmt);
 }
 
index e83d943cd84f6f0bda36a651ccdf4c5004ad232c..0e4e11553252758d4f693c34a56cc2993afe4d27 100644 (file)
@@ -7,15 +7,17 @@ C_SOURCES = \
        r300_chipset.c \
        r300_clear.c \
        r300_context.c \
+       r300_debug.c \
        r300_emit.c \
        r300_flush.c \
+       r300_query.c \
        r300_screen.c \
        r300_state.c \
+       r300_state_derived.c \
+       r300_state_invariant.c \
        r300_state_shader.c \
        r300_surface.c \
        r300_swtcl_emit.c \
        r300_texture.c
 
 include ../../Makefile.template
-
-symlinks:
index 7def62422a011ebe57c5907abac943ff287d351e..e01a0546b22b51d67c54922519c622ef2c716c4d 100644 (file)
@@ -21,7 +21,7 @@
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
 #include "r300_chipset.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 /* r300_chipset: A file all to itself for deducing the various properties of
  * Radeons. */
@@ -30,7 +30,7 @@
 void r300_parse_chipset(struct r300_capabilities* caps)
 {
     /* Reasonable defaults */
-    caps->has_tcl = TRUE;
+    caps->has_tcl = getenv("RADEON_NO_TCL") ? TRUE : FALSE;
     caps->is_r500 = FALSE;
     caps->num_vert_fpus = 4;
 
@@ -204,6 +204,13 @@ void r300_parse_chipset(struct r300_capabilities* caps)
             caps->has_tcl = FALSE;
             break;
 
+        case 0x793F:
+        case 0x7941:
+        case 0x7942:
+            caps->family = CHIP_FAMILY_RS600;
+            caps->has_tcl = FALSE;
+            break;
+
         case 0x796C:
         case 0x796D:
         case 0x796E:
@@ -343,6 +350,6 @@ void r300_parse_chipset(struct r300_capabilities* caps)
             break;
     }
 
-    /* Force off TCL for now */
-    caps->has_tcl = FALSE;
+    /* XXX SW TCL is broken so no forcing it off right now
+    caps->has_tcl = FALSE; */
 }
index a9cd372ec5591288372340bee15d3c4a170b7e3a..21eebeae6005c8a6d4b5f2b119b3286c65a4b287 100644 (file)
@@ -64,6 +64,7 @@ enum {
     CHIP_FAMILY_RC410,
     CHIP_FAMILY_RS480,
     CHIP_FAMILY_RS482,
+    CHIP_FAMILY_RS600,
     CHIP_FAMILY_RS690,
     CHIP_FAMILY_RS740,
     CHIP_FAMILY_RV515,
index 7b605ae87ac0fc965bab74f332139b08119ae90c..b8584702aad173e2423962f9d2abc78a8f99411f 100644 (file)
 
 #include "r300_context.h"
 
+static boolean r300_draw_range_elements(struct pipe_context* pipe,
+                                        struct pipe_buffer* indexBuffer,
+                                        unsigned indexSize,
+                                        unsigned minIndex,
+                                        unsigned maxIndex,
+                                        unsigned mode,
+                                        unsigned start,
+                                        unsigned count)
+{
+    struct r300_context* r300 = r300_context(pipe);
+    int i;
+
+    if (r300->dirty_state) {
+        r300_emit_dirty_state(r300);
+    }
+
+    for (i = 0; i < r300->vertex_buffer_count; i++) {
+        void* buf = pipe_buffer_map(pipe->screen,
+                                    r300->vertex_buffers[i].buffer,
+                                    PIPE_BUFFER_USAGE_CPU_READ);
+        draw_set_mapped_vertex_buffer(r300->draw, i, buf);
+    }
+
+    if (indexBuffer) {
+        void* indices = pipe_buffer_map(pipe->screen, indexBuffer,
+                                        PIPE_BUFFER_USAGE_CPU_READ);
+        draw_set_mapped_element_buffer_range(r300->draw, indexSize,
+                                             minIndex, maxIndex, indices);
+    } else {
+        draw_set_mapped_element_buffer(r300->draw, 0, NULL);
+    }
+
+    draw_set_mapped_constant_buffer(r300->draw,
+            r300->shader_constants[PIPE_SHADER_VERTEX].constants,
+            r300->shader_constants[PIPE_SHADER_VERTEX].user_count *
+                (sizeof(float) * 4));
+
+    draw_arrays(r300->draw, mode, start, count);
+
+    for (i = 0; i < r300->vertex_buffer_count; i++) {
+        pipe_buffer_unmap(pipe->screen, r300->vertex_buffers[i].buffer);
+        draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
+    }
+
+    if (indexBuffer) {
+        pipe_buffer_unmap(pipe->screen, indexBuffer);
+        draw_set_mapped_element_buffer_range(r300->draw, 0, start,
+                                             start + count - 1, NULL);
+    }
+
+    return TRUE;
+}
+
+static boolean r300_draw_elements(struct pipe_context* pipe,
+                                  struct pipe_buffer* indexBuffer,
+                                  unsigned indexSize, unsigned mode,
+                                  unsigned start, unsigned count)
+{
+    return r300_draw_range_elements(pipe, indexBuffer, indexSize, 0, ~0,
+                                    mode, start, count);
+}
+
+static boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
+                                unsigned start, unsigned count)
+{
+    return r300_draw_elements(pipe, NULL, 0, mode, start, count);
+}
+
 static void r300_destroy_context(struct pipe_context* context) {
     struct r300_context* r300 = r300_context(context);
 
     draw_destroy(r300->draw);
 
     FREE(r300->blend_color_state);
+    FREE(r300->rs_block);
     FREE(r300->scissor_state);
+    FREE(r300->viewport_state);
     FREE(r300);
 }
 
 struct pipe_context* r300_create_context(struct pipe_screen* screen,
-                                         struct pipe_winsys* winsys,
                                          struct r300_winsys* r300_winsys)
 {
     struct r300_context* r300 = CALLOC_STRUCT(r300_context);
@@ -41,26 +110,37 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     if (!r300)
         return NULL;
 
+    /* XXX this could be refactored now? */
     r300->winsys = r300_winsys;
-    r300->context.winsys = winsys;
-    r300->context.screen = r300_create_screen(winsys, r300_winsys);
+
+    r300->context.winsys = (struct pipe_winsys*)r300_winsys;
+    r300->context.screen = r300_screen(screen);
 
     r300->context.destroy = r300_destroy_context;
 
     r300->context.clear = r300_clear;
 
+    r300->context.draw_arrays = r300_draw_arrays;
+    r300->context.draw_elements = r300_draw_elements;
+    r300->context.draw_range_elements = r300_draw_range_elements;
+
     r300->draw = draw_create();
-    /*XXX draw_set_rasterize_stage(r300->draw, r300_draw_swtcl_stage(r300));*/
+    draw_set_rasterize_stage(r300->draw, r300_draw_swtcl_stage(r300));
 
     r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state);
+    r300->rs_block = CALLOC_STRUCT(r300_rs_block);
     r300->scissor_state = CALLOC_STRUCT(r300_scissor_state);
+    r300->viewport_state = CALLOC_STRUCT(r300_viewport_state);
 
     r300_init_flush_functions(r300);
 
+    r300_init_query_functions(r300);
+
     r300_init_surface_functions(r300);
 
     r300_init_state_functions(r300);
 
+    r300_emit_invariant_state(r300);
     r300->dirty_state = R300_NEW_KITCHEN_SINK;
     r300->dirty_hw++;
 
index 376c57639d8abc5cfa8f623baf0b33232c427a00..0e5e471d11682d20269dc5150ee690e950d0130b 100644 (file)
 #define R300_CONTEXT_H
 
 #include "draw/draw_context.h"
+#include "draw/draw_vertex.h"
 #include "pipe/p_context.h"
 #include "tgsi/tgsi_scan.h"
 #include "util/u_memory.h"
 
 #include "r300_clear.h"
+#include "r300_query.h"
 #include "r300_screen.h"
 #include "r300_winsys.h"
 
@@ -58,8 +60,12 @@ struct r300_dsa_state {
 };
 
 struct r300_rs_state {
+    /* XXX icky as fucking hell */
+    struct pipe_rasterizer_state rs;
+
     uint32_t vap_control_status;    /* R300_VAP_CNTL_STATUS: 0x2140 */
     uint32_t point_size;            /* R300_GA_POINT_SIZE: 0x421c */
+    uint32_t point_minmax;          /* R300_GA_POINT_MINMAX: 0x4230 */
     uint32_t line_control;          /* R300_GA_LINE_CNTL: 0x4234 */
     uint32_t depth_scale_front;  /* R300_SU_POLY_OFFSET_FRONT_SCALE: 0x42a4 */
     uint32_t depth_offset_front;/* R300_SU_POLY_OFFSET_FRONT_OFFSET: 0x42a8 */
@@ -69,6 +75,14 @@ struct r300_rs_state {
     uint32_t cull_mode;             /* R300_SU_CULL_MODE: 0x42b8 */
     uint32_t line_stipple_config;   /* R300_GA_LINE_STIPPLE_CONFIG: 0x4328 */
     uint32_t line_stipple_value;    /* R300_GA_LINE_STIPPLE_VALUE: 0x4260 */
+    uint32_t color_control;         /* R300_GA_COLOR_CONTROL: 0x4278 */
+};
+
+struct r300_rs_block {
+    uint32_t ip[8]; /* R300_RS_IP_[0-7], R500_RS_IP_[0-7] */
+    uint32_t count; /* R300_RS_COUNT */
+    uint32_t inst_count; /* R300_RS_INST_COUNT */
+    uint32_t inst[8]; /* R300_RS_INST_[0-7] */
 };
 
 struct r300_sampler_state {
@@ -83,23 +97,52 @@ struct r300_scissor_state {
 };
 
 struct r300_texture_state {
+    uint32_t format0; /* R300_TX_FORMAT0: 0x4480 */
+    uint32_t format1; /* R300_TX_FORMAT1: 0x44c0 */
+    uint32_t format2; /* R300_TX_FORMAT2: 0x4500 */
+};
+
+struct r300_viewport_state {
+    float xscale;         /* R300_VAP_VPORT_XSCALE:  0x2098 */
+    float xoffset;        /* R300_VAP_VPORT_XOFFSET: 0x209c */
+    float yscale;         /* R300_VAP_VPORT_YSCALE:  0x20a0 */
+    float yoffset;        /* R300_VAP_VPORT_YOFFSET: 0x20a4 */
+    float zscale;         /* R300_VAP_VPORT_ZSCALE:  0x20a8 */
+    float zoffset;        /* R300_VAP_VPORT_ZOFFSET: 0x20ac */
+    uint32_t vte_control; /* R300_VAP_VTE_CNTL:      0x20b0 */
 };
 
-#define R300_NEW_BLEND           0x000001
-#define R300_NEW_BLEND_COLOR     0x000002
-#define R300_NEW_DSA             0x000004
-#define R300_NEW_FRAMEBUFFERS    0x000008
-#define R300_NEW_FRAGMENT_SHADER 0x000010
-#define R300_NEW_RASTERIZER      0x000020
-#define R300_NEW_SAMPLER         0x000040
-#define R300_NEW_SCISSOR         0x004000
-#define R300_NEW_TEXTURE         0x008000
-#define R300_NEW_VERTEX_SHADER   0x800000
-#define R300_NEW_KITCHEN_SINK    0xffffff
+#define R300_NEW_BLEND           0x0000001
+#define R300_NEW_BLEND_COLOR     0x0000002
+#define R300_NEW_CONSTANTS       0x0000004
+#define R300_NEW_DSA             0x0000008
+#define R300_NEW_FRAMEBUFFERS    0x0000010
+#define R300_NEW_FRAGMENT_SHADER 0x0000020
+#define R300_NEW_RASTERIZER      0x0000040
+#define R300_NEW_RS_BLOCK        0x0000080
+#define R300_NEW_SAMPLER         0x0000100
+#define R300_ANY_NEW_SAMPLERS    0x000ff00
+#define R300_NEW_SCISSOR         0x0010000
+#define R300_NEW_TEXTURE         0x0020000
+#define R300_ANY_NEW_TEXTURES    0x1fe0000
+#define R300_NEW_VERTEX_FORMAT   0x2000000
+#define R300_NEW_VERTEX_SHADER   0x4000000
+#define R300_NEW_VIEWPORT        0x8000000
+#define R300_NEW_KITCHEN_SINK    0xfffffff
 
 /* The next several objects are not pure Radeon state; they inherit from
  * various Gallium classes. */
 
+struct r300_constant_buffer {
+    /* Buffer of constants */
+    /* XXX first number should be raised */
+    float constants[8][4];
+    /* Number of user-defined constants */
+    int user_count;
+    /* Total number of constants */
+    int count;
+};
+
 struct r3xx_fragment_shader {
     /* Parent class */
     struct pipe_shader_state state;
@@ -107,16 +150,55 @@ struct r3xx_fragment_shader {
 
     /* Has this shader been translated yet? */
     boolean translated;
+
+    /* Pixel stack size */
+    int stack_size;
 };
 
 struct r300_fragment_shader {
     /* Parent class */
     struct r3xx_fragment_shader shader;
+
+    /* Number of ALU instructions */
+    int alu_instruction_count;
+
+    /* Number of texture instructions */
+    int tex_instruction_count;
+
+    /* Number of texture indirections */
+    int indirections;
+
+    /* Indirection node offsets */
+    int offset0;
+    int offset1;
+    int offset2;
+    int offset3;
+
+    /* Machine instructions */
+    struct {
+        uint32_t alu_rgb_inst;
+        uint32_t alu_rgb_addr;
+        uint32_t alu_alpha_inst;
+        uint32_t alu_alpha_addr;
+    } instructions[64]; /* XXX magic num */
 };
 
 struct r500_fragment_shader {
     /* Parent class */
     struct r3xx_fragment_shader shader;
+
+    /* Number of used instructions */
+    int instruction_count;
+
+    /* Machine instructions */
+    struct {
+        uint32_t inst0;
+        uint32_t inst1;
+        uint32_t inst2;
+        uint32_t inst3;
+        uint32_t inst4;
+        uint32_t inst5;
+    } instructions[256]; /*< XXX magic number */
 };
 
 struct r300_texture {
@@ -126,11 +208,30 @@ struct r300_texture {
     /* Offsets into the buffer. */
     unsigned offset[PIPE_MAX_TEXTURE_LEVELS];
 
+    /* Stride (pitch?) of this texture in bytes */
+    unsigned stride;
+    
     /* Total size of this texture, in bytes. */
     unsigned size;
 
     /* Pipe buffer backing this texture. */
     struct pipe_buffer* buffer;
+
+    /* Registers carrying texture format data. */
+    struct r300_texture_state state;
+};
+
+struct r300_vertex_format {
+    /* Parent class */
+    struct vertex_info vinfo;
+    /* R300_VAP_PROG_STREAK_CNTL_[0-7] */
+    uint32_t vap_prog_stream_cntl[8];
+    /* R300_VAP_PROG_STREAK_CNTL_EXT_[0-7] */
+    uint32_t vap_prog_stream_cntl_ext[8];
+    /* This is a map of VAP/SW TCL outputs into the GA/RS.
+     * tab[i] is the location of input i in GA/RS input memory.
+     * Named tab for historical reasons. */
+    int tab[16];
 };
 
 struct r300_context {
@@ -147,6 +248,8 @@ struct r300_context {
     struct r300_blend_state* blend_state;
     /* Blend color state. */
     struct r300_blend_color_state* blend_color_state;
+    /* Shader constants. */
+    struct r300_constant_buffer shader_constants[PIPE_SHADER_TYPES];
     /* Depth, stencil, and alpha state. */
     struct r300_dsa_state* dsa_state;
     /* Fragment shader. */
@@ -155,6 +258,8 @@ struct r300_context {
     struct pipe_framebuffer_state framebuffer_state;
     /* Rasterizer state. */
     struct r300_rs_state* rs_state;
+    /* RS block state. */
+    struct r300_rs_block* rs_block;
     /* Sampler states. */
     struct r300_sampler_state* sampler_states[8];
     int sampler_count;
@@ -162,8 +267,14 @@ struct r300_context {
     struct r300_scissor_state* scissor_state;
     /* Texture states. */
     struct r300_texture* textures[8];
-    struct r300_texture_state* texture_states[8];
     int texture_count;
+    /* Vertex buffers. */
+    struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
+    int vertex_buffer_count;
+    /* Vertex information. */
+    struct r300_vertex_format vertex_info;
+    /* Viewport state. */
+    struct r300_viewport_state* viewport_state;
     /* Bitmask of dirty state objects. */
     uint32_t dirty_state;
     /* Flag indicating whether or not the HW is dirty. */
@@ -176,6 +287,7 @@ static struct r300_context* r300_context(struct pipe_context* context) {
 }
 
 /* Context initialization. */
+struct draw_stage* r300_draw_swtcl_stage(struct r300_context* r300);
 void r300_init_state_functions(struct r300_context* r300);
 void r300_init_surface_functions(struct r300_context* r300);
 
@@ -183,7 +295,6 @@ void r300_init_surface_functions(struct r300_context* r300);
  * We'll just step out in that case... */
 #ifndef R300_WINSYS_H
 struct pipe_context* r300_create_context(struct pipe_screen* screen,
-                                         struct pipe_winsys* winsys,
                                          struct r300_winsys* r300_winsys);
 #endif
 
index 385b61a096ce0497afccea6558eb526ad1c1b9d0..d8038ff1e198a4c16568d305e61a19b4967fc0e1 100644 (file)
 #ifndef R300_CS_H
 #define R300_CS_H
 
+#include "util/u_math.h"
+
 #include "r300_reg.h"
 #include "r300_winsys.h"
 
-/* Pack a 32-bit float into a dword. */
-static uint32_t pack_float_32(float f)
-{
-    union {
-        float f;
-        uint32_t u;
-    } u;
-
-    u.f = f;
-    return u.u;
-}
-
 /* Yes, I know macros are ugly. However, they are much prettier than the code
  * that they neatly hide away, and don't have the cost of function setup,so
  * we're going to use them. */
 
 #define MAX_CS_SIZE 64 * 1024 / 4
 
+#define VERY_VERBOSE_REGISTERS 0
+
 /* XXX stolen from radeon_drm.h */
 #define RADEON_GEM_DOMAIN_CPU  0x1
 #define RADEON_GEM_DOMAIN_GTT  0x2
@@ -80,13 +72,14 @@ static uint32_t pack_float_32(float f)
 } while (0)
 
 #define OUT_CS_32F(value) do { \
-    cs_winsys->write_cs_dword(cs, pack_float_32(value)); \
+    cs_winsys->write_cs_dword(cs, fui(value)); \
     cs_count--; \
 } while (0)
 
 #define OUT_CS_REG(register, value) do { \
-    debug_printf("r300: writing 0x%08X to register 0x%04X\n", \
-        value, register); \
+    if (VERY_VERBOSE_REGISTERS) \
+        debug_printf("r300: writing 0x%08X to register 0x%04X\n", \
+            value, register); \
     assert(register); \
     OUT_CS(CP_PACKET0(register, 0)); \
     OUT_CS(value); \
@@ -95,8 +88,9 @@ static uint32_t pack_float_32(float f)
 /* Note: This expects count to be the number of registers,
  * not the actual packet0 count! */
 #define OUT_CS_REG_SEQ(register, count) do { \
-    debug_printf("r300: writing register sequence of %d to 0x%04X\n", \
-        count, register); \
+    if (VERY_VERBOSE_REGISTERS) \
+        debug_printf("r300: writing register sequence of %d to 0x%04X\n", \
+            count, register); \
     assert(register); \
     OUT_CS(CP_PACKET0(register, ((count) - 1))); \
 } while (0)
@@ -119,7 +113,7 @@ static uint32_t pack_float_32(float f)
 } while (0)
 
 #define FLUSH_CS do { \
-    debug_printf("r300: FLUSH_CS in %s (%s:%d)\n", __FUNCTION__, __FILE__, \
+    debug_printf("r300: FLUSH_CS in %s (%s:%d)\n\n", __FUNCTION__, __FILE__, \
         __LINE__); \
     cs_winsys->flush_cs(cs); \
 } while (0)
index 71e6623699125c2e8c362c94efb91e8af71978f9..03bb608eb9a106218c5f4fbf97dd42b9e1e22263 100644 (file)
 
 #ifdef R300_CS_H
 
+#define RADEON_ONE_REG_WR        (1 << 15)
+
+#define OUT_CS_ONE_REG(register, count) do { \
+    if (VERY_VERBOSE_REGISTERS) \
+        debug_printf("r300: writing data sequence of %d to 0x%04X\n", \
+            count, register); \
+    assert(register); \
+    OUT_CS(CP_PACKET0(register, ((count) - 1)) | RADEON_ONE_REG_WR); \
+} while (0)
+
 #define R300_PACIFY do { \
+    OUT_CS_REG(RADEON_WAIT_UNTIL, (1 << 14) | (1 << 15) | (1 << 16) | (1 << 17) | \
+        (1 << 18)); \
+} while (0)
+
+#define R300_SCREENDOOR do { \
     OUT_CS_REG(R300_SC_SCREENDOOR, 0x0); \
-    OUT_CS_REG(RADEON_WAIT_UNTIL, (1 << 15) | (1 << 17) | \
-        (1 << 18) | (1 << 31)); \
+    R300_PACIFY; \
     OUT_CS_REG(R300_SC_SCREENDOOR, 0xffffff); \
 } while (0)
 
-
 #endif /* R300_CS_H */
diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c
new file mode 100644 (file)
index 0000000..f657588
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "r300_debug.h"
+
+static char* r500_fs_swiz[] = {
+    " R",
+    " G",
+    " B",
+    " A",
+    " 0",
+    ".5",
+    " 1",
+    " U",
+};
+
+static char* r500_fs_op_rgb[] = {
+    "MAD",
+    "DP3",
+    "DP4",
+    "D2A",
+    "MIN",
+    "MAX",
+    "---",
+    "CND",
+    "CMP",
+    "FRC",
+    "SOP",
+    "MDH",
+    "MDV",
+};
+
+static char* r500_fs_op_alpha[] = {
+    "MAD",
+    " DP",
+    "MIN",
+    "MAX",
+    "---",
+    "CND",
+    "CMP",
+    "FRC",
+    "EX2",
+    "LN2",
+    "RCP",
+    "RSQ",
+    "SIN",
+    "COS",
+    "MDH",
+    "MDV",
+};
+
+static char* r500_fs_mask[] = {
+    "NONE",
+    "R   ",
+    " G  ",
+    "RG  ",
+    "  B ",
+    "R B ",
+    " GB ",
+    "RGB ",
+    "   A",
+    "R  A",
+    " G A",
+    "RG A",
+    "  BA",
+    "R BA",
+    " GBA",
+    "RGBA",
+};
+
+static char* r500_fs_tex[] = {
+    "    NOP",
+    "     LD",
+    "TEXKILL",
+    "   PROJ",
+    "LODBIAS",
+    "    LOD",
+    "   DXDY",
+};
+
+void r500_fs_dump(struct r500_fragment_shader* fs)
+{
+    int i;
+    uint32_t inst;
+
+    for (i = 0; i < fs->instruction_count; i++) {
+        inst = fs->instructions[i].inst0;
+        debug_printf("%d:  0: CMN_INST   0x%08x:", i, inst);
+        switch (inst & 0x3) {
+            case R500_INST_TYPE_ALU:
+                debug_printf("ALU ");
+                break;
+            case R500_INST_TYPE_OUT:
+                debug_printf("OUT ");
+                break;
+            case R500_INST_TYPE_FC:
+                debug_printf("FC  ");
+                break;
+            case R500_INST_TYPE_TEX:
+                debug_printf("TEX ");
+                break;
+        }
+        debug_printf("%s %s %s %s ",
+                inst & R500_INST_TEX_SEM_WAIT ? "TEX_WAIT" : "",
+                inst & R500_INST_LAST ? "LAST" : "",
+                inst & R500_INST_NOP ? "NOP" : "",
+                inst & R500_INST_ALU_WAIT ? "ALU_WAIT" : "");
+        debug_printf("wmask: %s omask: %s\n",
+                r500_fs_mask[(inst >> 11) & 0xf],
+                r500_fs_mask[(inst >> 15) & 0xf]);
+        switch (inst & 0x3) {
+            case R500_INST_TYPE_ALU:
+            case R500_INST_TYPE_OUT:
+                inst = fs->instructions[i].inst1;
+                debug_printf("    1: RGB_ADDR   0x%08x:", inst);
+                debug_printf("Addr0: %d%c, Addr1: %d%c, "
+                        "Addr2: %d%c, srcp:%d\n",
+                        inst & 0xff, (inst & (1 << 8)) ? 'c' : 't',
+                        (inst >> 10) & 0xff, (inst & (1 << 18)) ? 'c' : 't',
+                        (inst >> 20) & 0xff, (inst & (1 << 28)) ? 'c' : 't',
+                        (inst >> 30));
+
+                inst = fs->instructions[i].inst2;
+                debug_printf("    2: ALPHA_ADDR 0x%08x:", inst);
+                debug_printf("Addr0: %d%c, Addr1: %d%c, "
+                        "Addr2: %d%c, srcp:%d\n",
+                        inst & 0xff, (inst & (1 << 8)) ? 'c' : 't',
+                        (inst >> 10) & 0xff, (inst & (1 << 18)) ? 'c' : 't',
+                        (inst >> 20) & 0xff, (inst & (1 << 28)) ? 'c' : 't',
+                        (inst >> 30));
+
+                inst = fs->instructions[i].inst3;
+                debug_printf("    3: RGB_INST   0x%08x:", inst);
+                debug_printf("rgb_A_src:%d %s/%s/%s %d "
+                        "rgb_B_src:%d %s/%s/%s %d\n",
+                        inst & 0x3, r500_fs_swiz[(inst >> 2) & 0x7],
+                        r500_fs_swiz[(inst >> 5) & 0x7],
+                        r500_fs_swiz[(inst >> 8) & 0x7],
+                        (inst >> 11) & 0x3, (inst >> 13) & 0x3,
+                        r500_fs_swiz[(inst >> 15) & 0x7],
+                        r500_fs_swiz[(inst >> 18) & 0x7],
+                        r500_fs_swiz[(inst >> 21) & 0x7],
+                        (inst >> 24) & 0x3);
+
+                inst = fs->instructions[i].inst4;
+                debug_printf("    4: ALPHA_INST 0x%08x:", inst);
+                debug_printf("%s dest:%d%s alp_A_src:%d %s %d "
+                        "alp_B_src:%d %s %d w:%d\n",
+                        r500_fs_op_alpha[inst & 0xf], (inst >> 4) & 0x7f,
+                        inst & (1<<11) ? "(rel)":"", (inst >> 12) & 0x3,
+                        r500_fs_swiz[(inst >> 14) & 0x7], (inst >> 17) & 0x3,
+                        (inst >> 19) & 0x3, r500_fs_swiz[(inst >> 21) & 0x7],
+                        (inst >> 24) & 0x3, (inst >> 31) & 0x1);
+
+                inst = fs->instructions[i].inst5;
+                debug_printf("    5: RGBA_INST  0x%08x:", inst);
+                debug_printf("%s dest:%d%s rgb_C_src:%d %s/%s/%s %d "
+                        "alp_C_src:%d %s %d\n",
+                        r500_fs_op_rgb[inst & 0xf], (inst >> 4) & 0x7f,
+                        inst & (1 << 11) ? "(rel)":"", (inst >> 12) & 0x3,
+                        r500_fs_swiz[(inst >> 14) & 0x7],
+                        r500_fs_swiz[(inst >> 17) & 0x7],
+                        r500_fs_swiz[(inst >> 20) & 0x7],
+                        (inst >> 23) & 0x3, (inst >> 25) & 0x3,
+                        r500_fs_swiz[(inst >> 27) & 0x7], (inst >> 30) & 0x3);
+                break;
+            case R500_INST_TYPE_FC:
+                /* XXX don't even bother yet */
+                break;
+            case R500_INST_TYPE_TEX:
+                inst = fs->instructions[i].inst1;
+                debug_printf("    1: TEX_INST   0x%08x: id: %d "
+                        "op:%s, %s, %s %s\n",
+                        inst, (inst >> 16) & 0xf,
+                        r500_fs_tex[(inst >> 22) & 0x7],
+                        (inst & (1 << 25)) ? "ACQ" : "",
+                        (inst & (1 << 26)) ? "IGNUNC" : "",
+                        (inst & (1 << 27)) ? "UNSCALED" : "SCALED");
+
+                inst = fs->instructions[i].inst2;
+                debug_printf("    2: TEX_ADDR   0x%08x: "
+                        "src: %d%s %s/%s/%s/%s dst: %d%s %s/%s/%s/%s\n",
+                        inst, inst & 0x7f, inst & (1 << 7) ? "(rel)" : "",
+                        r500_fs_swiz[(inst >> 8) & 0x3],
+                        r500_fs_swiz[(inst >> 10) & 0x3],
+                        r500_fs_swiz[(inst >> 12) & 0x3],
+                        r500_fs_swiz[(inst >> 14) & 0x3],
+                        (inst >> 16) & 0x7f, inst & (1 << 23) ? "(rel)" : "",
+                        r500_fs_swiz[(inst >> 24) & 0x3],
+                        r500_fs_swiz[(inst >> 26) & 0x3],
+                        r500_fs_swiz[(inst >> 28) & 0x3],
+                        r500_fs_swiz[(inst >> 30) & 0x3]);
+                
+                inst = fs->instructions[i].inst3;
+                debug_printf("    3: TEX_DXDY   0x%08x\n", inst);
+                break;
+        }
+    }
+}
diff --git a/src/gallium/drivers/r300/r300_debug.h b/src/gallium/drivers/r300/r300_debug.h
new file mode 100644 (file)
index 0000000..de5d701
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2009 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_DEBUG_H
+#define R300_DEBUG_H
+
+#include "r300_reg.h"
+#include "r300_state_shader.h"
+
+void r500_fs_dump(struct r500_fragment_shader* fs);
+
+#endif /* R300_DEBUG_H */
index 585a9e729d79350492977a92f1d7e4ed5dbe4137..a2e771bd1b2c25a11df182df6c89ce24b58ff225 100644 (file)
@@ -40,9 +40,9 @@ void r300_emit_blend_state(struct r300_context* r300,
 void r300_emit_blend_color_state(struct r300_context* r300,
                                  struct r300_blend_color_state* bc)
 {
-    struct r300_screen* r300screen =
-        (struct r300_screen*)r300->context.screen;
+    struct r300_screen* r300screen = r300_screen(r300->context.screen);
     CS_LOCALS(r300);
+
     if (r300screen->caps->is_r500) {
         BEGIN_CS(3);
         OUT_CS_REG_SEQ(R500_RB3D_CONSTANT_COLOR_AR, 2);
@@ -59,9 +59,9 @@ void r300_emit_blend_color_state(struct r300_context* r300,
 void r300_emit_dsa_state(struct r300_context* r300,
                            struct r300_dsa_state* dsa)
 {
-    struct r300_screen* r300screen =
-        (struct r300_screen*)r300->context.screen;
+    struct r300_screen* r300screen = r300_screen(r300->context.screen);
     CS_LOCALS(r300);
+
     BEGIN_CS(r300screen->caps->is_r500 ? 8 : 8);
     OUT_CS_REG(R300_FG_ALPHA_FUNC, dsa->alpha_function);
     /* XXX figure out the r300 counterpart for this */
@@ -79,7 +79,95 @@ void r300_emit_dsa_state(struct r300_context* r300,
     END_CS;
 }
 
-/* XXX add pitch, stride, z/stencil buf */
+void r300_emit_fragment_shader(struct r300_context* r300,
+                               struct r300_fragment_shader* fs)
+{
+    CS_LOCALS(r300);
+    int i;
+
+    BEGIN_CS(22);
+
+    OUT_CS_REG(R300_US_CONFIG, MAX2(fs->indirections - 1, 0));
+    OUT_CS_REG(R300_US_PIXSIZE, fs->shader.stack_size);
+    /* XXX figure out exactly how big the sizes are on this reg */
+    OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
+    /* XXX figure these ones out a bit better kthnx */
+    OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0);
+    OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0);
+    OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0);
+    OUT_CS_REG(R300_US_CODE_ADDR_3, R300_RGBA_OUT);
+
+    for (i = 0; i < fs->alu_instruction_count; i++) {
+        OUT_CS_REG(R300_US_ALU_RGB_INST_0 + (4 * i),
+            fs->instructions[i].alu_rgb_inst);
+        OUT_CS_REG(R300_US_ALU_RGB_ADDR_0 + (4 * i),
+            fs->instructions[i].alu_rgb_addr);
+        OUT_CS_REG(R300_US_ALU_ALPHA_INST_0 + (4 * i),
+            fs->instructions[i].alu_alpha_inst);
+        OUT_CS_REG(R300_US_ALU_ALPHA_ADDR_0 + (4 * i),
+            fs->instructions[i].alu_alpha_addr);
+    }
+
+    END_CS;
+}
+
+void r500_emit_fragment_shader(struct r300_context* r300,
+                               struct r500_fragment_shader* fs)
+{
+    CS_LOCALS(r300);
+    struct r300_constant_buffer* constants =
+        &r300->shader_constants[PIPE_SHADER_FRAGMENT];
+    int i;
+
+    BEGIN_CS(9 + (fs->instruction_count * 6) + (constants->count ? 3 : 0) +
+            (constants->count * 4));
+    OUT_CS_REG(R500_US_CONFIG, R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO);
+    OUT_CS_REG(R500_US_PIXSIZE, fs->shader.stack_size);
+    OUT_CS_REG(R500_US_CODE_ADDR, R500_US_CODE_START_ADDR(0) |
+            R500_US_CODE_END_ADDR(fs->instruction_count));
+
+    OUT_CS_REG(R500_GA_US_VECTOR_INDEX, R500_GA_US_VECTOR_INDEX_TYPE_INSTR);
+    OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA, fs->instruction_count * 6);
+    for (i = 0; i < fs->instruction_count; i++) {
+        OUT_CS(fs->instructions[i].inst0);
+        OUT_CS(fs->instructions[i].inst1);
+        OUT_CS(fs->instructions[i].inst2);
+        OUT_CS(fs->instructions[i].inst3);
+        OUT_CS(fs->instructions[i].inst4);
+        OUT_CS(fs->instructions[i].inst5);
+    }
+
+    if (constants->count) {
+        OUT_CS_REG(R500_GA_US_VECTOR_INDEX,
+                R500_GA_US_VECTOR_INDEX_TYPE_CONST);
+        OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA, constants->count * 4);
+        for (i = 0; i < constants->count; i++) {
+            OUT_CS_32F(constants->constants[i][0]);
+            OUT_CS_32F(constants->constants[i][1]);
+            OUT_CS_32F(constants->constants[i][2]);
+            OUT_CS_32F(constants->constants[i][3]);
+        }
+    }
+
+    END_CS;
+}
+
+/* Translate pipe_format into US_OUT_FMT. Note that formats are stored from
+ * C3 to C0. */
+uint32_t translate_out_fmt(enum pipe_format format)
+{
+    switch (format) {
+        case PIPE_FORMAT_A8R8G8B8_UNORM:
+            return R300_US_OUT_FMT_C4_8 |
+                R300_C0_SEL_B | R300_C1_SEL_G |
+                R300_C2_SEL_R | R300_C3_SEL_A;
+        default:
+            return R300_US_OUT_FMT_UNUSED;
+    }
+    return 0;
+}
+
+/* XXX add pitch, stride, clean up */
 void r300_emit_fb_state(struct r300_context* r300,
                         struct pipe_framebuffer_state* fb)
 {
@@ -87,23 +175,47 @@ void r300_emit_fb_state(struct r300_context* r300,
     struct r300_texture* tex;
     int i;
 
-    BEGIN_CS((3 * fb->nr_cbufs) + 6);
+    BEGIN_CS((6 * fb->nr_cbufs) + (fb->zsbuf ? 6 : 0) + 4);
     for (i = 0; i < fb->nr_cbufs; i++) {
         tex = (struct r300_texture*)fb->cbufs[i]->texture;
         OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1);
         OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
+
+        OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i),
+            translate_out_fmt(fb->cbufs[i]->format));
+    }
+
+    if (fb->zsbuf) {
+        tex = (struct r300_texture*)fb->zsbuf->texture;
+        OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1);
+        OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
+        if (fb->zsbuf->format == PIPE_FORMAT_Z24S8_UNORM) {
+            OUT_CS_REG(R300_ZB_FORMAT,
+                R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL);
+        } else {
+            OUT_CS_REG(R300_ZB_FORMAT, 0x0);
+        }
     }
-    R300_PACIFY;
+
+    OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT,
+        R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS |
+        R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D);
+    OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT,
+        R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
+        R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
     END_CS;
 }
 
 void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs)
 {
-    struct r300_screen* r300screen =
-        (struct r300_screen*)r300->context.screen;
     CS_LOCALS(r300);
-    BEGIN_CS(14);
+
+    BEGIN_CS(20);
     OUT_CS_REG(R300_VAP_CNTL_STATUS, rs->vap_control_status);
+    OUT_CS_REG(R300_GA_POINT_SIZE, rs->point_size);
+    OUT_CS_REG_SEQ(R300_GA_POINT_MINMAX, 2);
+    OUT_CS(rs->point_minmax);
+    OUT_CS(rs->line_control);
     OUT_CS_REG_SEQ(R300_SU_POLY_OFFSET_FRONT_SCALE, 6);
     OUT_CS(rs->depth_scale_front);
     OUT_CS(rs->depth_offset_front);
@@ -113,43 +225,241 @@ void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs)
     OUT_CS(rs->cull_mode);
     OUT_CS_REG(R300_GA_LINE_STIPPLE_CONFIG, rs->line_stipple_config);
     OUT_CS_REG(R300_GA_LINE_STIPPLE_VALUE, rs->line_stipple_value);
+    OUT_CS_REG(R300_GA_COLOR_CONTROL, rs->color_control);
+    END_CS;
+}
+
+void r300_emit_rs_block_state(struct r300_context* r300,
+                              struct r300_rs_block* rs)
+{
+    struct r300_screen* r300screen = r300_screen(r300->context.screen);
+    CS_LOCALS(r300);
+    int i;
+
+    BEGIN_CS(21);
+    if (r300screen->caps->is_r500) {
+        OUT_CS_REG_SEQ(R500_RS_IP_0, 8);
+    } else {
+        OUT_CS_REG_SEQ(R300_RS_IP_0, 8);
+    }
+    for (i = 0; i < 8; i++) {
+        OUT_CS(rs->ip[i]);
+        debug_printf("ip %d: 0x%08x\n", i, rs->ip[i]);
+    }
+
+    OUT_CS_REG_SEQ(R300_RS_COUNT, 2);
+    OUT_CS(rs->count);
+    OUT_CS(rs->inst_count);
+
+    if (r300screen->caps->is_r500) {
+        OUT_CS_REG_SEQ(R500_RS_INST_0, 8);
+    } else {
+        OUT_CS_REG_SEQ(R300_RS_INST_0, 8);
+    }
+    for (i = 0; i < 8; i++) {
+        OUT_CS(rs->inst[i]);
+        debug_printf("inst %d: 0x%08x\n", i, rs->inst[i]);
+    }
+
+    debug_printf("count: 0x%08x inst_count: 0x%08x\n", rs->count,
+            rs->inst_count);
+
     END_CS;
 }
 
-static void r300_emit_dirty_state(struct r300_context* r300)
+void r300_emit_sampler(struct r300_context* r300,
+                       struct r300_sampler_state* sampler, unsigned offset)
 {
-    struct r300_screen* r300screen =
-        (struct r300_screen*)r300->context.screen;
     CS_LOCALS(r300);
 
+    BEGIN_CS(6);
+    OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), sampler->filter0);
+    OUT_CS_REG(R300_TX_FILTER1_0 + (offset * 4), sampler->filter1);
+    OUT_CS_REG(R300_TX_BORDER_COLOR_0 + (offset * 4), sampler->border_color);
+    END_CS;
+}
+
+void r300_emit_scissor_state(struct r300_context* r300,
+                             struct r300_scissor_state* scissor)
+{
+    CS_LOCALS(r300);
+
+    BEGIN_CS(3);
+    OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2);
+    OUT_CS(scissor->scissor_top_left);
+    OUT_CS(scissor->scissor_bottom_right);
+    END_CS;
+}
+
+void r300_emit_texture(struct r300_context* r300,
+                       struct r300_texture* tex, unsigned offset)
+{
+    CS_LOCALS(r300);
+
+    BEGIN_CS(10);
+    OUT_CS_REG(R300_TX_FORMAT0_0 + (offset * 4), tex->state.format0);
+    OUT_CS_REG(R300_TX_FORMAT1_0 + (offset * 4), tex->state.format1);
+    OUT_CS_REG(R300_TX_FORMAT2_0 + (offset * 4), tex->state.format2);
+    OUT_CS_REG_SEQ(R300_TX_OFFSET_0 + (offset * 4), 1);
+    OUT_CS_RELOC(tex->buffer, 0,
+            RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0, 0);
+    END_CS;
+}
+
+void r300_emit_vertex_format_state(struct r300_context* r300)
+{
+    CS_LOCALS(r300);
+    int i;
+
+    BEGIN_CS(26);
+    OUT_CS_REG(R300_VAP_VTX_SIZE, r300->vertex_info.vinfo.size);
+
+    OUT_CS_REG_SEQ(R300_VAP_VTX_STATE_CNTL, 2);
+    OUT_CS(r300->vertex_info.vinfo.hwfmt[0]);
+    OUT_CS(r300->vertex_info.vinfo.hwfmt[1]);
+    OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2);
+    OUT_CS(r300->vertex_info.vinfo.hwfmt[2]);
+    OUT_CS(r300->vertex_info.vinfo.hwfmt[3]);
+    for (i = 0; i < 4; i++) {
+        debug_printf("hwfmt%d: 0x%08x\n", i,
+                r300->vertex_info.vinfo.hwfmt[i]);
+    }
+
+    OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0, 8);
+    for (i = 0; i < 8; i++) {
+        OUT_CS(r300->vertex_info.vap_prog_stream_cntl[i]);
+        debug_printf("prog_stream_cntl%d: 0x%08x\n", i,
+                r300->vertex_info.vap_prog_stream_cntl[i]);
+    }
+    OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_EXT_0, 8);
+    for (i = 0; i < 8; i++) {
+        OUT_CS(r300->vertex_info.vap_prog_stream_cntl_ext[i]);
+        debug_printf("prog_stream_cntl_ext%d: 0x%08x\n", i,
+                r300->vertex_info.vap_prog_stream_cntl_ext[i]);
+    }
+    END_CS;
+}
+
+void r300_emit_viewport_state(struct r300_context* r300,
+                              struct r300_viewport_state* viewport)
+{
+    return;
+    CS_LOCALS(r300);
+
+    BEGIN_CS(7);
+    OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 7);
+    OUT_CS_32F(viewport->xscale);
+    OUT_CS_32F(viewport->xoffset);
+    OUT_CS_32F(viewport->yscale);
+    OUT_CS_32F(viewport->yoffset);
+    OUT_CS_32F(viewport->zscale);
+    OUT_CS_32F(viewport->zoffset);
+    OUT_CS(viewport->vte_control);
+    END_CS;
+}
+
+static void r300_flush_textures(struct r300_context* r300)
+{
+    CS_LOCALS(r300);
+
+    BEGIN_CS(4);
+    OUT_CS_REG(R300_TX_INVALTAGS, 0);
+    OUT_CS_REG(R300_TX_ENABLE, (1 << r300->texture_count) - 1);
+    END_CS;
+}
+
+/* Emit all dirty state. */
+void r300_emit_dirty_state(struct r300_context* r300)
+{
+    struct r300_screen* r300screen = r300_screen(r300->context.screen);
+    int i;
+    int dirty_tex = 0;
+
     if (!(r300->dirty_state) && !(r300->dirty_hw)) {
         return;
     }
 
+    r300_update_derived_state(r300);
+
     /* XXX check size */
 
     if (r300->dirty_state & R300_NEW_BLEND) {
         r300_emit_blend_state(r300, r300->blend_state);
+        r300->dirty_state &= ~R300_NEW_BLEND;
     }
 
     if (r300->dirty_state & R300_NEW_BLEND_COLOR) {
         r300_emit_blend_color_state(r300, r300->blend_color_state);
+        r300->dirty_state &= ~R300_NEW_BLEND_COLOR;
     }
 
     if (r300->dirty_state & R300_NEW_DSA) {
         r300_emit_dsa_state(r300, r300->dsa_state);
+        r300->dirty_state &= ~R300_NEW_DSA;
+    }
+
+    if (r300->dirty_state & R300_NEW_FRAGMENT_SHADER) {
+        if (r300screen->caps->is_r500) {
+            r500_emit_fragment_shader(r300,
+                (struct r500_fragment_shader*)r300->fs);
+        } else {
+            r300_emit_fragment_shader(r300,
+                (struct r300_fragment_shader*)r300->fs);
+        }
+        r300->dirty_state &= ~R300_NEW_FRAGMENT_SHADER;
+    }
+
+    if (r300->dirty_state & R300_NEW_FRAMEBUFFERS) {
+        r300_emit_fb_state(r300, &r300->framebuffer_state);
+        r300->dirty_state &= ~R300_NEW_FRAMEBUFFERS;
     }
 
     if (r300->dirty_state & R300_NEW_RASTERIZER) {
         r300_emit_rs_state(r300, r300->rs_state);
+        r300->dirty_state &= ~R300_NEW_RASTERIZER;
+    }
+
+    if (r300->dirty_state & R300_NEW_RS_BLOCK) {
+        r300_emit_rs_block_state(r300, r300->rs_block);
+        r300->dirty_state &= ~R300_NEW_RS_BLOCK;
+    }
+
+    if (r300->dirty_state & R300_ANY_NEW_SAMPLERS) {
+        for (i = 0; i < r300->sampler_count; i++) {
+            if (r300->dirty_state & (R300_NEW_SAMPLER << i)) {
+                r300_emit_sampler(r300, r300->sampler_states[i], i);
+                r300->dirty_state &= ~(R300_NEW_SAMPLER << i);
+                dirty_tex++;
+            }
+        }
     }
 
     if (r300->dirty_state & R300_NEW_SCISSOR) {
-        struct r300_scissor_state* scissor = r300->scissor_state;
-        /* XXX next two are contiguous regs */
-        OUT_CS_REG(R300_SC_SCISSORS_TL, scissor->scissor_top_left);
-        OUT_CS_REG(R300_SC_SCISSORS_BR, scissor->scissor_bottom_right);
+        r300_emit_scissor_state(r300, r300->scissor_state);
+        r300->dirty_state &= ~R300_NEW_SCISSOR;
     }
 
-    r300->dirty_state = 0;
+    if (r300->dirty_state & R300_ANY_NEW_TEXTURES) {
+        for (i = 0; i < r300->texture_count; i++) {
+            if (r300->dirty_state & (R300_NEW_TEXTURE << i)) {
+                r300_emit_texture(r300, r300->textures[i], i);
+                r300->dirty_state &= ~(R300_NEW_TEXTURE << i);
+                dirty_tex++;
+            }
+        }
+    }
+
+    if (r300->dirty_state & R300_NEW_VIEWPORT) {
+        r300_emit_viewport_state(r300, r300->viewport_state);
+        r300->dirty_state &= ~R300_NEW_VIEWPORT;
+    }
+
+    if (dirty_tex) {
+        r300_flush_textures(r300);
+    }
+
+    if (r300->dirty_state & R300_NEW_VERTEX_FORMAT) {
+        r300_emit_vertex_format_state(r300);
+        r300->dirty_state &= ~R300_NEW_VERTEX_FORMAT;
+    }
 }
index b6e69386f957003fc4ff5ca48531a93d6a583b8e..4aba1ee08ce8ad01e06110753759516385886e05 100644 (file)
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
+#ifndef R300_EMIT_H
+#define R300_EMIT_H
+
+#include "util/u_math.h"
+
 #include "r300_context.h"
 #include "r300_cs.h"
 #include "r300_screen.h"
@@ -33,4 +38,26 @@ void r300_emit_blend_color_state(struct r300_context* r300,
 void r300_emit_dsa_state(struct r300_context* r300,
                          struct r300_dsa_state* dsa);
 
+void r300_emit_fragment_shader(struct r300_context* r300,
+                               struct r300_fragment_shader* fs);
+
+void r500_emit_fragment_shader(struct r300_context* r300,
+                               struct r500_fragment_shader* fs);
+
+void r300_emit_fb_state(struct r300_context* r300,
+                        struct pipe_framebuffer_state* fb);
+
 void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs);
+
+void r300_emit_rs_block_state(struct r300_context* r300,
+                              struct r300_rs_block* rs);
+
+void r300_emit_scissor_state(struct r300_context* r300,
+                             struct r300_scissor_state* scissor);
+
+void r300_emit_vertex_format_state(struct r300_context* r300);
+
+/* Emit all dirty state. */
+void r300_emit_dirty_state(struct r300_context* r300);
+
+#endif /* R300_EMIT_H */
index 3766f0a0a7b0bd07f192ce152ccaa87cbcc35576..20ca6905ad25d05c95be7204c153aba29f5dc4ff 100644 (file)
@@ -31,6 +31,7 @@ static void r300_flush(struct pipe_context* pipe,
 
     if (r300->dirty_hw) {
         FLUSH_CS;
+        r300_emit_invariant_state(r300);
         r300->dirty_state = R300_NEW_KITCHEN_SINK;
         r300->dirty_hw = 0;
     }
diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
new file mode 100644 (file)
index 0000000..5f5f4c4
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "r300_query.h"
+
+static struct pipe_query* r300_create_query(struct pipe_context* pipe,
+                                            unsigned query_type)
+{
+    struct r300_query* q = CALLOC_STRUCT(r300_query);
+
+    q->type = query_type;
+    assert(q->type == PIPE_QUERY_OCCLUSION_COUNTER);
+
+    /* XXX this is to force winsys to give us a GTT buffer */
+    q->buf = pipe->screen->buffer_create(pipe->screen, 64,
+            PIPE_BUFFER_USAGE_VERTEX, 64);
+
+    return (struct pipe_query*)q;
+}
+
+static void r300_destroy_query(struct pipe_context* pipe,
+                               struct pipe_query* query)
+{
+    FREE(query);
+}
+
+static void r300_begin_query(struct pipe_context* pipe,
+                             struct pipe_query* query)
+{
+    struct r300_context* r300 = r300_context(pipe);
+    struct r300_query* q = (struct r300_query*)query;
+    CS_LOCALS(r300);
+
+    uint32_t* map = pipe_buffer_map(pipe->screen, q->buf,
+            PIPE_BUFFER_USAGE_CPU_WRITE);
+    *map = ~0;
+    pipe_buffer_unmap(pipe->screen, q->buf);
+
+    BEGIN_CS(2);
+    OUT_CS_REG(R300_ZB_ZPASS_DATA, 0);
+    END_CS;
+}
+
+static void r300_end_query(struct pipe_context* pipe,
+                           struct pipe_query* query)
+{
+    struct r300_context* r300 = r300_context(pipe);
+    struct r300_query* q = (struct r300_query*)query;
+    CS_LOCALS(r300);
+
+    BEGIN_CS(4);
+    OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
+    OUT_CS_RELOC(q->buf, 0, 0, RADEON_GEM_DOMAIN_GTT, 0);
+    END_CS;
+}
+
+static boolean r300_get_query_result(struct pipe_context* pipe,
+                                     struct pipe_query* query,
+                                     boolean wait,
+                                     uint64_t* result)
+{
+    struct r300_query* q = (struct r300_query*)query;
+    uint32_t temp;
+
+    if (wait) {
+        /* Well, we're expected to just sit here and spin, so let's go ahead
+         * and flush so we can be sure that the card's spinning... */
+        /* XXX double-check these params */
+        pipe->flush(pipe, 0, NULL);
+    }
+
+    uint32_t* map = pipe_buffer_map(pipe->screen, q->buf,
+            PIPE_BUFFER_USAGE_CPU_READ);
+    temp = *map;
+    pipe_buffer_unmap(pipe->screen, q->buf);
+
+    if (temp < 0) {
+        /* Our results haven't been written yet... */
+        return FALSE;
+    }
+
+    *result = temp;
+    return TRUE;
+}
+
+void r300_init_query_functions(struct r300_context* r300) {
+    r300->context.create_query = r300_create_query;
+    r300->context.destroy_query = r300_destroy_query;
+    r300->context.begin_query = r300_begin_query;
+    r300->context.end_query = r300_end_query;
+    r300->context.get_query_result = r300_get_query_result;
+}
diff --git a/src/gallium/drivers/r300/r300_query.h b/src/gallium/drivers/r300/r300_query.h
new file mode 100644 (file)
index 0000000..4f447ea
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2009 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_QUERY_H
+#define R300_QUERY_H
+
+#include "r300_context.h"
+#include "r300_cs.h"
+#include "r300_reg.h"
+
+struct r300_query {
+    /* The kind of query. Currently only OQ is supported. */
+    unsigned type;
+    /* Buffer object where we want our results to reside. */
+    struct pipe_buffer* buf;
+};
+
+static INLINE struct r300_query* r300_query(struct pipe_query* q)
+{
+    return (struct r300_query*)q;
+}
+
+void r300_init_query_functions(struct r300_context* r300);
+
+#endif /* R300_QUERY_H */
index dbd0cc28e239a87e9bfe971f61113a53dc1b9f80..6f3ad970abcd0c288584e770abf88fa7bd3a53ed 100644 (file)
@@ -64,7 +64,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define R300_SE_VPORT_ZSCALE                0x1DA8
 #define R300_SE_VPORT_ZOFFSET               0x1DAC
 
-
+#define R300_VAP_PORT_IDX0                 0x2040
 /*
  * Vertex Array Processing (VAP) Control
  */
@@ -139,17 +139,25 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define R300_VAP_OUTPUT_VTX_FMT_1__3_COMPONENTS 3
 #      define R300_VAP_OUTPUT_VTX_FMT_1__4_COMPONENTS 4
 
-#define R300_SE_VTE_CNTL                  0x20b0
-#      define     R300_VPORT_X_SCALE_ENA                (1 << 0)
-#      define     R300_VPORT_X_OFFSET_ENA               (1 << 1)
-#      define     R300_VPORT_Y_SCALE_ENA                (1 << 2)
-#      define     R300_VPORT_Y_OFFSET_ENA               (1 << 3)
-#      define     R300_VPORT_Z_SCALE_ENA                (1 << 4)
-#      define     R300_VPORT_Z_OFFSET_ENA               (1 << 5)
-#      define     R300_VTX_XY_FMT                       (1 << 8)
-#      define     R300_VTX_Z_FMT                        (1 << 9)
-#      define     R300_VTX_W0_FMT                       (1 << 10)
-#      define     R300_SERIAL_PROC_ENA                  (1 << 11)
+#define R300_VAP_VPORT_XSCALE                     0x2098
+#define R300_VAP_VPORT_XOFFSET                    0x209c
+#define R300_VAP_VPORT_YSCALE                     0x20a0
+#define R300_VAP_VPORT_YOFFSET                    0x20a4
+#define R300_VAP_VPORT_ZSCALE                     0x20a8
+#define R300_VAP_VPORT_ZOFFSET                    0x20ac
+
+#define R300_VAP_VTE_CNTL                         0x20b0
+#define R300_SE_VTE_CNTL R300_VAP_VTE_CNTL
+#   define R300_VPORT_X_SCALE_ENA                           (1 << 0)
+#   define R300_VPORT_X_OFFSET_ENA                          (1 << 1)
+#   define R300_VPORT_Y_SCALE_ENA                           (1 << 2)
+#   define R300_VPORT_Y_OFFSET_ENA                          (1 << 3)
+#   define R300_VPORT_Z_SCALE_ENA                           (1 << 4)
+#   define R300_VPORT_Z_OFFSET_ENA                          (1 << 5)
+#   define R300_VTX_XY_FMT                                  (1 << 8)
+#   define R300_VTX_Z_FMT                                   (1 << 9)
+#   define R300_VTX_W0_FMT                                  (1 << 10)
+#   define R300_SERIAL_PROC_ENA                             (1 << 11)
 
 #define R300_VAP_VTX_SIZE               0x20b4
 
@@ -326,6 +334,14 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_WRITE_ENA_Z                         4
 #       define R300_WRITE_ENA_W                         8
 #       define R300_SWIZZLE1_SHIFT                      16
+
+#       define R300_VAP_SWIZZLE_XYZW \
+        ((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | \
+         (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | \
+         (R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_SHIFT) | \
+         (R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_SHIFT) | \
+         (0xf << R300_WRITE_ENA_SHIFT))
+
 #define R300_VAP_PROG_STREAM_CNTL_EXT_1                 0x21e4
 #define R300_VAP_PROG_STREAM_CNTL_EXT_2                 0x21e8
 #define R300_VAP_PROG_STREAM_CNTL_EXT_3                 0x21ec
@@ -732,8 +748,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define R500_RS_IP_TEX_PTR_Q_SHIFT                     18
 #define R500_RS_IP_COL_PTR_SHIFT                       24
 #define R500_RS_IP_COL_FMT_SHIFT                       27
-#      define R500_RS_COL_PTR(x)                       (x << 24)
-#       define R500_RS_COL_FMT(x)                       (x << 27)
+#       define R500_RS_SEL_S(x)                         ((x) << 0)
+#       define R500_RS_SEL_T(x)                         ((x) << 6)
+#       define R500_RS_SEL_R(x)                         ((x) << 12)
+#       define R500_RS_SEL_Q(x)                         ((x) << 18)
+#      define R500_RS_COL_PTR(x)                       ((x) << 24)
+#       define R500_RS_COL_FMT(x)                       ((x) << 27)
 /* gap */
 #define R500_RS_IP_OFFSET_DIS                          (0 << 31)
 #define R500_RS_IP_OFFSET_EN                           (1 << 31)
@@ -1019,20 +1039,27 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_THIRD  (2 << 16)
 #      define R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST   (3 << 16)
 
-/** TODO: might be candidate for removal */
-#      define R300_RE_SHADE_MODEL_SMOOTH     ( \
-       R300_GA_COLOR_CONTROL_RGB0_SHADING_GOURAUD | R300_GA_COLOR_CONTROL_ALPHA0_SHADING_GOURAUD | \
-       R300_GA_COLOR_CONTROL_RGB1_SHADING_GOURAUD | R300_GA_COLOR_CONTROL_ALPHA1_SHADING_GOURAUD | \
-       R300_GA_COLOR_CONTROL_RGB2_SHADING_GOURAUD | R300_GA_COLOR_CONTROL_ALPHA2_SHADING_GOURAUD | \
-       R300_GA_COLOR_CONTROL_RGB3_SHADING_GOURAUD | R300_GA_COLOR_CONTROL_ALPHA3_SHADING_GOURAUD | \
-       R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST )
-/** TODO: might be candidate for removal, the GOURAUD stuff also looks buggy to me */
-#      define R300_RE_SHADE_MODEL_FLAT     ( \
-       R300_GA_COLOR_CONTROL_RGB0_SHADING_FLAT | R300_GA_COLOR_CONTROL_ALPHA0_SHADING_FLAT | \
-       R300_GA_COLOR_CONTROL_RGB1_SHADING_FLAT | R300_GA_COLOR_CONTROL_ALPHA1_SHADING_GOURAUD | \
-       R300_GA_COLOR_CONTROL_RGB2_SHADING_FLAT | R300_GA_COLOR_CONTROL_ALPHA2_SHADING_FLAT | \
-       R300_GA_COLOR_CONTROL_RGB3_SHADING_FLAT | R300_GA_COLOR_CONTROL_ALPHA3_SHADING_GOURAUD | \
-       R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST )
+#       define R300_SHADE_MODEL_FLAT ( \
+        R300_GA_COLOR_CONTROL_RGB0_SHADING_FLAT | \
+        R300_GA_COLOR_CONTROL_ALPHA0_SHADING_FLAT | \
+        R300_GA_COLOR_CONTROL_RGB1_SHADING_FLAT | \
+        R300_GA_COLOR_CONTROL_ALPHA1_SHADING_FLAT | \
+        R300_GA_COLOR_CONTROL_RGB2_SHADING_FLAT | \
+        R300_GA_COLOR_CONTROL_ALPHA2_SHADING_FLAT | \
+        R300_GA_COLOR_CONTROL_RGB3_SHADING_FLAT | \
+        R300_GA_COLOR_CONTROL_ALPHA3_SHADING_FLAT | \
+        R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST )
+
+#       define R300_SHADE_MODEL_SMOOTH ( \
+        R300_GA_COLOR_CONTROL_RGB0_SHADING_GOURAUD | \
+        R300_GA_COLOR_CONTROL_ALPHA0_SHADING_GOURAUD | \
+        R300_GA_COLOR_CONTROL_RGB1_SHADING_GOURAUD | \
+        R300_GA_COLOR_CONTROL_ALPHA1_SHADING_GOURAUD | \
+        R300_GA_COLOR_CONTROL_RGB2_SHADING_GOURAUD | \
+        R300_GA_COLOR_CONTROL_ALPHA2_SHADING_GOURAUD | \
+        R300_GA_COLOR_CONTROL_RGB3_SHADING_GOURAUD | \
+        R300_GA_COLOR_CONTROL_ALPHA3_SHADING_GOURAUD | \
+        R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST )
 
 /* Specifies red & green components of fill color -- S312 format -- Backwards comp. */
 #define R300_GA_SOLID_RG                         0x427c
@@ -1146,6 +1173,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_W_ADDR_MASK                  0x0003f000
 #       define R300_HIRES_DIS                    (0 << 18)
 #       define R300_HIRES_EN                     (1 << 18)
+#       define R300_IT_COUNT(x)                  ((x) << 0)
+#       define R300_IC_COUNT(x)                  ((x) << 7)
+#       define R300_W_COUNT(x)                   ((x) << 12)
 
 #define R300_RS_INST_COUNT                       0x4304
 #       define R300_RS_INST_COUNT_SHIFT          0
@@ -1175,8 +1205,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_RS_INTERP_SRC_SHIFT          2 /* TODO: check for removal */
 #       define R300_RS_INTERP_SRC_MASK           (7 << 2) /* TODO: check for removal */
 #      define R300_RS_TEX_PTR(x)                       (x << 0)
-#      define R300_RS_COL_PTR(x)                       (x << 6)
-#      define R300_RS_COL_FMT(x)                       (x << 9)
+#      define R300_RS_COL_PTR(x)                       ((x) << 6)
+#      define R300_RS_COL_FMT(x)                       ((x) << 9)
 #      define R300_RS_COL_FMT_RGBA                     0
 #      define R300_RS_COL_FMT_RGB0                     1
 #      define R300_RS_COL_FMT_RGB1                     2
@@ -1186,10 +1216,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define R300_RS_COL_FMT_111A                     8
 #      define R300_RS_COL_FMT_1110                     9
 #      define R300_RS_COL_FMT_1111                     10
-#      define R300_RS_SEL_S(x)                         (x << 13)
-#      define R300_RS_SEL_T(x)                         (x << 16)
-#      define R300_RS_SEL_R(x)                         (x << 19)
-#      define R300_RS_SEL_Q(x)                         (x << 22)
+#      define R300_RS_SEL_S(x)                         ((x) << 13)
+#      define R300_RS_SEL_T(x)                         ((x) << 16)
+#      define R300_RS_SEL_R(x)                         ((x) << 19)
+#      define R300_RS_SEL_Q(x)                         ((x) << 22)
 #      define R300_RS_SEL_C0                           0
 #      define R300_RS_SEL_C1                           1
 #      define R300_RS_SEL_C2                           2
@@ -1216,14 +1246,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define R500_RS_INST_14                                        0x4358
 #define R500_RS_INST_15                                        0x435c
 #define R500_RS_INST_TEX_ID_SHIFT                      0
+#        define R500_RS_INST_TEX_ID(x)                  ((x) << 0)
 #define R500_RS_INST_TEX_CN_WRITE                      (1 << 4)
 #define R500_RS_INST_TEX_ADDR_SHIFT                    5
+#        define R500_RS_INST_TEX_ADDR(x)                ((x) << 0)
 #define R500_RS_INST_COL_ID_SHIFT                      12
+#        define R500_RS_INST_COL_ID(x)                  ((x) << 12)
 #define R500_RS_INST_COL_CN_NO_WRITE                   (0 << 16)
 #define R500_RS_INST_COL_CN_WRITE                      (1 << 16)
 #define R500_RS_INST_COL_CN_WRITE_FBUFFER              (2 << 16)
 #define R500_RS_INST_COL_CN_WRITE_BACKFACE             (3 << 16)
 #define R500_RS_INST_COL_ADDR_SHIFT                    18
+#        define R500_RS_INST_COL_ADDR(x)                ((x) << 18)
 #define R500_RS_INST_TEX_ADJ                           (1 << 25)
 #define R500_RS_INST_W_CN                              (1 << 26)
 
@@ -1240,9 +1274,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define R300_RS_INST_7                     0x434C
 #      define R300_RS_INST_TEX_ID(x)           ((x) << 0)
 #      define R300_RS_INST_TEX_CN_WRITE        (1 << 3)
+#      define R300_RS_INST_TEX_ADDR(x)         ((x) << 6)
 #      define R300_RS_INST_TEX_ADDR_SHIFT      6
 #      define R300_RS_INST_COL_ID(x)           ((x) << 11)
 #      define R300_RS_INST_COL_CN_WRITE        (1 << 14)
+#      define R300_RS_INST_COL_ADDR(x)         ((x) << 17)
 #      define R300_RS_INST_COL_ADDR_SHIFT      17
 #      define R300_RS_INST_TEX_ADJ             (1 << 22)
 #      define R300_RS_COL_BIAS_UNUSED_SHIFT    23
@@ -1411,18 +1447,21 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define R500_MACRO_SWITCH               (1<<22)
 #      define R500_BORDER_FIX                 (1<<31)
 
-#define R300_TX_SIZE_0                      0x4480
+#define R300_TX_FORMAT0_0                   0x4480
 #       define R300_TX_WIDTHMASK_SHIFT           0
 #       define R300_TX_WIDTHMASK_MASK            (2047 << 0)
 #       define R300_TX_HEIGHTMASK_SHIFT          11
 #       define R300_TX_HEIGHTMASK_MASK           (2047 << 11)
-#      define R300_TX_DEPTHMASK_SHIFT           22
-#      define R300_TX_DEPTHMASK_MASK            (0xf << 22)
+#      define R300_TX_DEPTHMASK_SHIFT           22
+#      define R300_TX_DEPTHMASK_MASK            (0xf << 22)
 #       define R300_TX_MAX_MIP_LEVEL_SHIFT       26
 #       define R300_TX_MAX_MIP_LEVEL_MASK        (0xf << 26)
-#       define R300_TX_SIZE_PROJECTED            (1<<30)
-#       define R300_TX_SIZE_TXPITCH_EN           (1<<31)
-#define R300_TX_FORMAT_0                    0x44C0
+#       define R300_TX_SIZE_PROJECTED            (1 << 30)
+#       define R300_TX_PITCH_EN                  (1 << 31)
+#       define R300_TX_WIDTH(x)                  ((x) << 0)
+#       define R300_TX_HEIGHT(x)                 ((x) << 11)
+
+#define R300_TX_FORMAT1_0                   0x44C0
        /* The interpretation of the format word by Wladimir van der Laan */
        /* The X, Y, Z and W refer to the layout of the components.
           They are given meanings as R, G, B and Alpha by the swizzle
@@ -1708,7 +1747,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #   define R300_C3_SEL_R                               (1 << 14)
 #   define R300_C3_SEL_G                               (2 << 14)
 #   define R300_C3_SEL_B                               (3 << 14)
-#   define R300_OUT_SIGN(x)                            (x << 16)
+#   define R300_OUT_SIGN(x)                            ((x) << 16)
+#   define R500_ROUND_ADJ                              (1 << 20)
 
 /* ALU
  * The ALU instructions register blocks are enumerated according to the order
@@ -1795,6 +1835,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_ALU_DSTC_OUTPUT_X           (1 << 26)
 #       define R300_ALU_DSTC_OUTPUT_Y           (1 << 27)
 #       define R300_ALU_DSTC_OUTPUT_Z           (1 << 28)
+#       define R300_ALU_DSTC_OUTPUT_XYZ         (7 << 26)
+#       define R300_RGB_ADDR0(x)                ((x) << 0)
+#       define R300_RGB_ADDR1(x)                ((x) << 6)
+#       define R300_RGB_ADDR2(x)                ((x) << 12)
 
 #define R300_US_ALU_ALPHA_ADDR_0                 0x47C0
 #       define R300_ALU_SRC0A_SHIFT             0
@@ -1812,6 +1856,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_ALU_DSTA_REG                (1 << 23)
 #       define R300_ALU_DSTA_OUTPUT             (1 << 24)
 #              define R300_ALU_DSTA_DEPTH              (1 << 27)
+#       define R300_ALPHA_ADDR0(x)                ((x) << 0)
+#       define R300_ALPHA_ADDR1(x)                ((x) << 6)
+#       define R300_ALPHA_ADDR2(x)                ((x) << 12)
 
 #define R300_US_ALU_RGB_INST_0                   0x48C0
 #       define R300_ALU_ARGC_SRC0C_XYZ          0
@@ -1846,6 +1893,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_ALU_ARGC_SRC0CA_WZY         29
 #       define R300_ALU_ARGC_SRC1CA_WZY         30
 #       define R300_ALU_ARGC_SRC2CA_WZY         31
+#       define R300_RGB_SWIZA(x)                ((x) << 0)
+#       define R300_RGB_SWIZB(x)                ((x) << 7)
+#       define R300_RGB_SWIZC(x)                ((x) << 14)
 
 #       define R300_ALU_ARG0C_SHIFT             0
 #       define R300_ALU_ARG0C_MASK              (31 << 0)
@@ -1909,10 +1959,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_ALU_ARGA_SRCP_Y             13
 #       define R300_ALU_ARGA_SRCP_Z             14
 #       define R300_ALU_ARGA_SRCP_W             15
-
 #       define R300_ALU_ARGA_ZERO               16
 #       define R300_ALU_ARGA_ONE                17
 #       define R300_ALU_ARGA_HALF               18
+#       define R300_ALPHA_SWIZA(x)              ((x) << 0)
+#       define R300_ALPHA_SWIZB(x)              ((x) << 7)
+#       define R300_ALPHA_SWIZC(x)              ((x) << 14)
+
 #       define R300_ALU_ARG0A_SHIFT             0
 #       define R300_ALU_ARG0A_MASK              (31 << 0)
 #       define R300_ALU_ARG0A_NOP               (0 << 5)
@@ -2731,7 +2784,7 @@ enum {
 #   define R500_ALPHA_OP_COS                           13
 #   define R500_ALPHA_OP_MDH                           14
 #   define R500_ALPHA_OP_MDV                           15
-#   define R500_ALPHA_ADDRD(x)                         (x << 4)
+#   define R500_ALPHA_ADDRD(x)                         ((x) << 4)
 #   define R500_ALPHA_ADDRD_REL                                (1 << 11)
 #  define R500_ALPHA_SEL_A_SHIFT                       12
 #   define R500_ALPHA_SEL_A_SRC0                       (0 << 12)
@@ -2775,16 +2828,16 @@ enum {
 #   define R500_ALPHA_OMOD_DIV_4                       (5 << 26)
 #   define R500_ALPHA_OMOD_DIV_8                       (6 << 26)
 #   define R500_ALPHA_OMOD_DISABLE                     (7 << 26)
-#   define R500_ALPHA_TARGET(x)                                (x << 29)
+#   define R500_ALPHA_TARGET(x)                                ((x) << 29)
 #   define R500_ALPHA_W_OMASK                          (1 << 31)
 #define R500_US_ALU_ALPHA_ADDR_0                       0x9800
-#   define R500_ALPHA_ADDR0(x)                         (x << 0)
+#   define R500_ALPHA_ADDR0(x)                         ((x) << 0)
 #   define R500_ALPHA_ADDR0_CONST                      (1 << 8)
 #   define R500_ALPHA_ADDR0_REL                                (1 << 9)
-#   define R500_ALPHA_ADDR1(x)                         (x << 10)
+#   define R500_ALPHA_ADDR1(x)                         ((x) << 10)
 #   define R500_ALPHA_ADDR1_CONST                      (1 << 18)
 #   define R500_ALPHA_ADDR1_REL                                (1 << 19)
-#   define R500_ALPHA_ADDR2(x)                         (x << 20)
+#   define R500_ALPHA_ADDR2(x)                         ((x) << 20)
 #   define R500_ALPHA_ADDR2_CONST                      (1 << 28)
 #   define R500_ALPHA_ADDR2_REL                                (1 << 29)
 #   define R500_ALPHA_SRCP_OP_1_MINUS_2A0              (0 << 30)
@@ -2805,7 +2858,7 @@ enum {
 #   define R500_ALU_RGBA_OP_SOP                                (10 << 0)
 #   define R500_ALU_RGBA_OP_MDH                                (11 << 0)
 #   define R500_ALU_RGBA_OP_MDV                                (12 << 0)
-#   define R500_ALU_RGBA_ADDRD(x)                      (x << 4)
+#   define R500_ALU_RGBA_ADDRD(x)                      ((x) << 4)
 #   define R500_ALU_RGBA_ADDRD_REL                     (1 << 11)
 #  define R500_ALU_RGBA_SEL_C_SHIFT                    12
 #   define R500_ALU_RGBA_SEL_C_SRC0                    (0 << 12)
@@ -2932,16 +2985,16 @@ enum {
 #   define R500_ALU_RGB_OMOD_DIV_4                     (5 << 26)
 #   define R500_ALU_RGB_OMOD_DIV_8                     (6 << 26)
 #   define R500_ALU_RGB_OMOD_DISABLE                   (7 << 26)
-#   define R500_ALU_RGB_TARGET(x)                      (x << 29)
+#   define R500_ALU_RGB_TARGET(x)                      ((x) << 29)
 #   define R500_ALU_RGB_WMASK                          (1 << 31)
 #define R500_US_ALU_RGB_ADDR_0                         0x9000
-#   define R500_RGB_ADDR0(x)                           (x << 0)
+#   define R500_RGB_ADDR0(x)                           ((x) << 0)
 #   define R500_RGB_ADDR0_CONST                                (1 << 8)
 #   define R500_RGB_ADDR0_REL                          (1 << 9)
-#   define R500_RGB_ADDR1(x)                           (x << 10)
+#   define R500_RGB_ADDR1(x)                           ((x) << 10)
 #   define R500_RGB_ADDR1_CONST                                (1 << 18)
 #   define R500_RGB_ADDR1_REL                          (1 << 19)
-#   define R500_RGB_ADDR2(x)                           (x << 20)
+#   define R500_RGB_ADDR2(x)                           ((x) << 20)
 #   define R500_RGB_ADDR2_CONST                                (1 << 28)
 #   define R500_RGB_ADDR2_REL                          (1 << 29)
 #   define R500_RGB_SRCP_OP_1_MINUS_2RGB0              (0 << 30)
@@ -2973,6 +3026,7 @@ enum {
 #   define R500_INST_RGB_OMASK_R                       (1 << 15)
 #   define R500_INST_RGB_OMASK_G                       (1 << 16)
 #   define R500_INST_RGB_OMASK_B                       (1 << 17)
+#   define R500_INST_RGB_OMASK_RGB                     (7 << 15)
 #   define R500_INST_ALPHA_OMASK                       (1 << 18)
 #   define R500_INST_RGB_CLAMP                         (1 << 19)
 #   define R500_INST_ALPHA_CLAMP                       (1 << 20)
@@ -2996,19 +3050,19 @@ enum {
 
 /* note that these are 8 bit lengths, despite the offsets, at least for R500 */
 #define R500_US_CODE_ADDR                              0x4630
-#   define R500_US_CODE_START_ADDR(x)                  (x << 0)
-#   define R500_US_CODE_END_ADDR(x)                    (x << 16)
+#   define R500_US_CODE_START_ADDR(x)                  ((x) << 0)
+#   define R500_US_CODE_END_ADDR(x)                    ((x) << 16)
 #define R500_US_CODE_OFFSET                            0x4638
-#   define R500_US_CODE_OFFSET_ADDR(x)                 (x << 0)
+#   define R500_US_CODE_OFFSET_ADDR(x)                 ((x) << 0)
 #define R500_US_CODE_RANGE                             0x4634
-#   define R500_US_CODE_RANGE_ADDR(x)                  (x << 0)
-#   define R500_US_CODE_RANGE_SIZE(x)                  (x << 16)
+#   define R500_US_CODE_RANGE_ADDR(x)                  ((x) << 0)
+#   define R500_US_CODE_RANGE_SIZE(x)                  ((x) << 16)
 #define R500_US_CONFIG                                 0x4600
 #   define R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO                (1 << 1)
 #define R500_US_FC_ADDR_0                              0xa000
-#   define R500_FC_BOOL_ADDR(x)                                (x << 0)
-#   define R500_FC_INT_ADDR(x)                         (x << 8)
-#   define R500_FC_JUMP_ADDR(x)                                (x << 16)
+#   define R500_FC_BOOL_ADDR(x)                                ((x) << 0)
+#   define R500_FC_INT_ADDR(x)                         ((x) << 8)
+#   define R500_FC_JUMP_ADDR(x)                                ((x) << 16)
 #   define R500_FC_JUMP_GLOBAL                         (1 << 31)
 #define R500_US_FC_BOOL_CONST                          0x4620
 #   define R500_FC_KBOOL(x)                            (x)
@@ -3029,8 +3083,8 @@ enum {
 #   define R500_FC_A_OP_NONE                           (0 << 6)
 #   define R500_FC_A_OP_POP                            (1 << 6)
 #   define R500_FC_A_OP_PUSH                           (2 << 6)
-#   define R500_FC_JUMP_FUNC(x)                                (x << 8)
-#   define R500_FC_B_POP_CNT(x)                                (x << 16)
+#   define R500_FC_JUMP_FUNC(x)                                ((x) << 8)
+#   define R500_FC_B_POP_CNT(x)                                ((x) << 16)
 #   define R500_FC_B_OP0_NONE                          (0 << 24)
 #   define R500_FC_B_OP0_DECR                          (1 << 24)
 #   define R500_FC_B_OP0_INCR                          (2 << 24)
@@ -3039,60 +3093,18 @@ enum {
 #   define R500_FC_B_OP1_INCR                          (2 << 26)
 #   define R500_FC_IGNORE_UNCOVERED                    (1 << 28)
 #define R500_US_FC_INT_CONST_0                         0x4c00
-#   define R500_FC_INT_CONST_KR(x)                     (x << 0)
-#   define R500_FC_INT_CONST_KG(x)                     (x << 8)
-#   define R500_FC_INT_CONST_KB(x)                     (x << 16)
+#   define R500_FC_INT_CONST_KR(x)                     ((x) << 0)
+#   define R500_FC_INT_CONST_KG(x)                     ((x) << 8)
+#   define R500_FC_INT_CONST_KB(x)                     ((x) << 16)
 /* _0 through _15 */
 #define R500_US_FORMAT0_0                              0x4640
-#   define R500_FORMAT_TXWIDTH(x)                      (x << 0)
-#   define R500_FORMAT_TXHEIGHT(x)                     (x << 11)
-#   define R500_FORMAT_TXDEPTH(x)                      (x << 22)
-/* _0 through _3 */
-#define R500_US_OUT_FMT_0                              0x46A4
-#   define R500_OUT_FMT_C4_8                           (0 << 0)
-#   define R500_OUT_FMT_C4_10                          (1 << 0)
-#   define R500_OUT_FMT_C4_10_GAMMA                    (2 << 0)
-#   define R500_OUT_FMT_C_16                           (3 << 0)
-#   define R500_OUT_FMT_C2_16                          (4 << 0)
-#   define R500_OUT_FMT_C4_16                          (5 << 0)
-#   define R500_OUT_FMT_C_16_MPEG                      (6 << 0)
-#   define R500_OUT_FMT_C2_16_MPEG                     (7 << 0)
-#   define R500_OUT_FMT_C2_4                           (8 << 0)
-#   define R500_OUT_FMT_C_3_3_2                                (9 << 0)
-#   define R500_OUT_FMT_C_6_5_6                                (10 << 0)
-#   define R500_OUT_FMT_C_11_11_10                     (11 << 0)
-#   define R500_OUT_FMT_C_10_11_11                     (12 << 0)
-#   define R500_OUT_FMT_C_2_10_10_10                   (13 << 0)
-/* #define R500_OUT_FMT_RESERVED                       (14 << 0) */
-#   define R500_OUT_FMT_UNUSED                         (15 << 0)
-#   define R500_OUT_FMT_C_16_FP                                (16 << 0)
-#   define R500_OUT_FMT_C2_16_FP                       (17 << 0)
-#   define R500_OUT_FMT_C4_16_FP                       (18 << 0)
-#   define R500_OUT_FMT_C_32_FP                                (19 << 0)
-#   define R500_OUT_FMT_C2_32_FP                       (20 << 0)
-#   define R500_OUT_FMT_C4_32_FP                       (21 << 0)
-#   define R500_C0_SEL_A                               (0 << 8)
-#   define R500_C0_SEL_R                               (1 << 8)
-#   define R500_C0_SEL_G                               (2 << 8)
-#   define R500_C0_SEL_B                               (3 << 8)
-#   define R500_C1_SEL_A                               (0 << 10)
-#   define R500_C1_SEL_R                               (1 << 10)
-#   define R500_C1_SEL_G                               (2 << 10)
-#   define R500_C1_SEL_B                               (3 << 10)
-#   define R500_C2_SEL_A                               (0 << 12)
-#   define R500_C2_SEL_R                               (1 << 12)
-#   define R500_C2_SEL_G                               (2 << 12)
-#   define R500_C2_SEL_B                               (3 << 12)
-#   define R500_C3_SEL_A                               (0 << 14)
-#   define R500_C3_SEL_R                               (1 << 14)
-#   define R500_C3_SEL_G                               (2 << 14)
-#   define R500_C3_SEL_B                               (3 << 14)
-#   define R500_OUT_SIGN(x)                            (x << 16)
-#   define R500_ROUND_ADJ                              (1 << 20)
+#   define R500_FORMAT_TXWIDTH(x)                      ((x) << 0)
+#   define R500_FORMAT_TXHEIGHT(x)                     ((x) << 11)
+#   define R500_FORMAT_TXDEPTH(x)                      ((x) << 22)
 #define R500_US_PIXSIZE                                        0x4604
 #   define R500_PIX_SIZE(x)                            (x)
 #define R500_US_TEX_ADDR_0                             0x9800
-#   define R500_TEX_SRC_ADDR(x)                                (x << 0)
+#   define R500_TEX_SRC_ADDR(x)                                ((x) << 0)
 #   define R500_TEX_SRC_ADDR_REL                       (1 << 7)
 #   define R500_TEX_SRC_S_SWIZ_R                       (0 << 8)
 #   define R500_TEX_SRC_S_SWIZ_G                       (1 << 8)
@@ -3110,7 +3122,7 @@ enum {
 #   define R500_TEX_SRC_Q_SWIZ_G                       (1 << 14)
 #   define R500_TEX_SRC_Q_SWIZ_B                       (2 << 14)
 #   define R500_TEX_SRC_Q_SWIZ_A                       (3 << 14)
-#   define R500_TEX_DST_ADDR(x)                                (x << 16)
+#   define R500_TEX_DST_ADDR(x)                                ((x) << 16)
 #   define R500_TEX_DST_ADDR_REL                       (1 << 23)
 #   define R500_TEX_DST_R_SWIZ_R                       (0 << 24)
 #   define R500_TEX_DST_R_SWIZ_G                       (1 << 24)
@@ -3129,7 +3141,7 @@ enum {
 #   define R500_TEX_DST_A_SWIZ_B                       (2 << 30)
 #   define R500_TEX_DST_A_SWIZ_A                       (3 << 30)
 #define R500_US_TEX_ADDR_DXDY_0                                0xa000
-#   define R500_DX_ADDR(x)                             (x << 0)
+#   define R500_DX_ADDR(x)                             ((x) << 0)
 #   define R500_DX_ADDR_REL                            (1 << 7)
 #   define R500_DX_S_SWIZ_R                            (0 << 8)
 #   define R500_DX_S_SWIZ_G                            (1 << 8)
@@ -3147,7 +3159,7 @@ enum {
 #   define R500_DX_Q_SWIZ_G                            (1 << 14)
 #   define R500_DX_Q_SWIZ_B                            (2 << 14)
 #   define R500_DX_Q_SWIZ_A                            (3 << 14)
-#   define R500_DY_ADDR(x)                             (x << 16)
+#   define R500_DY_ADDR(x)                             ((x) << 16)
 #   define R500_DY_ADDR_REL                            (1 << 17)
 #   define R500_DY_S_SWIZ_R                            (0 << 24)
 #   define R500_DY_S_SWIZ_G                            (1 << 24)
@@ -3166,7 +3178,7 @@ enum {
 #   define R500_DY_Q_SWIZ_B                            (2 << 30)
 #   define R500_DY_Q_SWIZ_A                            (3 << 30)
 #define R500_US_TEX_INST_0                             0x9000
-#   define R500_TEX_ID(x)                              (x << 16)
+#   define R500_TEX_ID(x)                              ((x) << 16)
 #   define R500_TEX_INST_NOP                           (0 << 22)
 #   define R500_TEX_INST_LD                            (1 << 22)
 #   define R500_TEX_INST_TEXKILL                       (2 << 22)
@@ -3227,9 +3239,9 @@ enum {
 #define R300_PACKET3_3D_LOAD_VBPNTR         0x00002F00
 
 #define R300_PACKET3_INDX_BUFFER            0x00003300
-#    define R300_EB_UNK1_SHIFT                      24
-#    define R300_EB_UNK1                    (0x80<<24)
-#    define R300_EB_UNK2                        0x0810
+#    define R300_INDX_BUFFER_DST_SHIFT          0
+#    define R300_INDX_BUFFER_SKIP_SHIFT         16
+#    define R300_INDX_BUFFER_ONE_REG_WR                (1<<31)
 
 /* Same as R300_PACKET3_3D_DRAW_VBUF but without VAP_VTX_FMT */
 #define R300_PACKET3_3D_DRAW_VBUF_2         0x00003400
index 8ed66a1660c3a3cbfd32f9171b95850ef8272bfa..d2c5998c261783b21fa067ef556c786e7fc04ea8 100644 (file)
@@ -50,6 +50,7 @@ static const char* chip_families[] = {
     "RC410",
     "RS480",
     "RS482",
+    "RS600",
     "RS690",
     "RS740",
     "RV515",
@@ -100,11 +101,9 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
             /* IN THEORY */
             return 0;
         case PIPE_CAP_MAX_RENDER_TARGETS:
-            /* XXX 4 eventually */
-            return 1;
+            return 4;
         case PIPE_CAP_OCCLUSION_QUERY:
-            /* IN THEORY */
-            return 0;
+            return 1;
         case PIPE_CAP_TEXTURE_SHADOW_MAP:
             /* IN THEORY */
             return 0;
@@ -121,7 +120,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
              * shows why this is silly. Assuming RGBA, 4cpp, we can see that
              * 4096*4096*4096 = 64.0 GiB exactly, so it's not exactly
              * practical. However, if at some point a game really wants this,
-             * then we can remove this limit. */
+             * then we can remove or raise this limit. */
             if (r300screen->caps->is_r500) {
                 /* 9 == 256x256x256 */
                 return 9;
@@ -142,7 +141,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
         case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
             return 1;
         case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
-            /* XXX guessing */
+            /* XXX guessing (what a terrible guess) */
             return 2;
         default:
             debug_printf("r300: Implementation error: Bad param %d\n",
@@ -175,15 +174,44 @@ static float r300_get_paramf(struct pipe_screen* pscreen, int param)
     }
 }
 
-/* XXX moar formats */
-static boolean check_tex_2d_format(enum pipe_format format)
+static boolean check_tex_2d_format(enum pipe_format format, boolean is_r500)
 {
     switch (format) {
+        /* Colorbuffer */
+        case PIPE_FORMAT_A4R4G4B4_UNORM:
+        case PIPE_FORMAT_R5G6B5_UNORM:
+        case PIPE_FORMAT_A1R5G5B5_UNORM:
         case PIPE_FORMAT_A8R8G8B8_UNORM:
+        /* Colorbuffer or texture */
         case PIPE_FORMAT_I8_UNORM:
+        /* Z buffer */
+        case PIPE_FORMAT_Z16_UNORM:
+        /* Z buffer with stencil */
+        case PIPE_FORMAT_Z24S8_UNORM:
             return TRUE;
+
+        /* XXX These don't even exist
+        case PIPE_FORMAT_A32R32G32B32:
+        case PIPE_FORMAT_A16R16G16B16: */
+        /* XXX Insert YUV422 packed VYUY and YVYU here */
+        /* XXX What the deuce is UV88? (r3xx accel page 14)
+            debug_printf("r300: Warning: Got unimplemented format: %s in %s\n",
+                pf_name(format), __FUNCTION__);
+            return FALSE; */
+
+        /* XXX Supported yet unimplemented r5xx formats: */
+        /* XXX Again, what is UV1010 this time? (r5xx accel page 148) */
+        /* XXX Even more that don't exist
+        case PIPE_FORMAT_A10R10G10B10_UNORM:
+        case PIPE_FORMAT_A2R10G10B10_UNORM:
+        case PIPE_FORMAT_I10_UNORM:
+            debug_printf(
+                "r300: Warning: Got unimplemented r500 format: %s in %s\n",
+                pf_name(format), __FUNCTION__);
+            return FALSE; */
+
         default:
-            debug_printf("r300: Warning: Got unknown format: %s, in %s\n",
+            debug_printf("r300: Warning: Got unsupported format: %s in %s\n",
                 pf_name(format), __FUNCTION__);
             break;
     }
@@ -200,7 +228,8 @@ static boolean r300_is_format_supported(struct pipe_screen* pscreen,
 {
     switch (target) {
         case PIPE_TEXTURE_2D:
-            return check_tex_2d_format(format);
+            return check_tex_2d_format(format,
+                r300_screen(pscreen)->caps->is_r500);
         default:
             debug_printf("r300: Warning: Got unknown format target: %d\n",
                 format);
@@ -210,24 +239,84 @@ static boolean r300_is_format_supported(struct pipe_screen* pscreen,
     return FALSE;
 }
 
-static void* r300_surface_map(struct pipe_screen* screen,
-                              struct pipe_surface* surface,
-                              unsigned flags)
+static struct pipe_transfer*
+r300_get_tex_transfer(struct pipe_screen *screen,
+                      struct pipe_texture *texture,
+                      unsigned face, unsigned level, unsigned zslice,
+                      enum pipe_transfer_usage usage, unsigned x, unsigned y,
+                      unsigned w, unsigned h)
+{
+    struct r300_texture *tex = (struct r300_texture *)texture;
+    struct r300_transfer *trans;
+    unsigned offset;  /* in bytes */
+
+    /* XXX Add support for these things */
+    if (texture->target == PIPE_TEXTURE_CUBE) {
+        debug_printf("PIPE_TEXTURE_CUBE is not yet supported.\n");
+        /* offset = tex->image_offset[level][face]; */
+    }
+    else if (texture->target == PIPE_TEXTURE_3D) {
+        debug_printf("PIPE_TEXTURE_3D is not yet supported.\n");
+        /* offset = tex->image_offset[level][zslice]; */
+    }
+    else {
+        offset = tex->offset[level];
+        assert(face == 0);
+        assert(zslice == 0);
+    }
+
+    trans = CALLOC_STRUCT(r300_transfer);
+    if (trans) {
+        pipe_texture_reference(&trans->transfer.texture, texture);
+        trans->transfer.format = trans->transfer.format;
+        trans->transfer.width = w;
+        trans->transfer.height = h;
+        trans->transfer.block = texture->block;
+        trans->transfer.nblocksx = texture->nblocksx[level];
+        trans->transfer.nblocksy = texture->nblocksy[level];
+        trans->transfer.stride = tex->stride;
+        trans->transfer.usage = usage;
+        trans->offset = offset;
+    }
+    return &trans->transfer;
+}
+
+static void
+r300_tex_transfer_destroy(struct pipe_transfer *trans)
 {
-    struct r300_texture* tex = (struct r300_texture*)surface->texture;
-    char* map = pipe_buffer_map(screen, tex->buffer, flags);
+   pipe_texture_reference(&trans->texture, NULL);
+   FREE(trans);
+}
+
+static void* r300_transfer_map(struct pipe_screen* screen,
+                              struct pipe_transfer* transfer)
+{
+    struct r300_texture* tex = (struct r300_texture*)transfer->texture;
+    char* map;
+    unsigned flags = 0;
+
+    if (transfer->usage != PIPE_TRANSFER_WRITE) {
+        flags |= PIPE_BUFFER_USAGE_CPU_READ;
+    }
+    if (transfer->usage != PIPE_TRANSFER_READ) {
+        flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
+    }
+    
+    map = pipe_buffer_map(screen, tex->buffer, flags);
 
     if (!map) {
         return NULL;
     }
 
-    return map + surface->offset;
+    return map + r300_transfer(transfer)->offset +
+        transfer->y / transfer->block.height * transfer->stride +
+        transfer->x / transfer->block.width * transfer->block.size;
 }
 
-static void r300_surface_unmap(struct pipe_screen* screen,
-                               struct pipe_surface* surface)
+static void r300_transfer_unmap(struct pipe_screen* screen,
+                                struct pipe_transfer* transfer)
 {
-    struct r300_texture* tex = (struct r300_texture*)surface->texture;
+    struct r300_texture* tex = (struct r300_texture*)transfer->texture;
     pipe_buffer_unmap(screen, tex->buffer);
 }
 
@@ -239,8 +328,7 @@ static void r300_destroy_screen(struct pipe_screen* pscreen)
     FREE(r300screen);
 }
 
-struct pipe_screen* r300_create_screen(struct pipe_winsys* winsys,
-                                       struct r300_winsys* r300_winsys)
+struct pipe_screen* r300_create_screen(struct r300_winsys* r300_winsys)
 {
     struct r300_screen* r300screen = CALLOC_STRUCT(r300_screen);
     struct r300_capabilities* caps = CALLOC_STRUCT(r300_capabilities);
@@ -254,15 +342,17 @@ struct pipe_screen* r300_create_screen(struct pipe_winsys* winsys,
     r300_parse_chipset(caps);
 
     r300screen->caps = caps;
-    r300screen->screen.winsys = winsys;
+    r300screen->screen.winsys = (struct pipe_winsys*)r300_winsys;
     r300screen->screen.destroy = r300_destroy_screen;
     r300screen->screen.get_name = r300_get_name;
     r300screen->screen.get_vendor = r300_get_vendor;
     r300screen->screen.get_param = r300_get_param;
     r300screen->screen.get_paramf = r300_get_paramf;
     r300screen->screen.is_format_supported = r300_is_format_supported;
-    r300screen->screen.surface_map = r300_surface_map;
-    r300screen->screen.surface_unmap = r300_surface_unmap;
+    r300screen->screen.get_tex_transfer = r300_get_tex_transfer;
+    r300screen->screen.tex_transfer_destroy = r300_tex_transfer_destroy;
+    r300screen->screen.transfer_map = r300_transfer_map;
+    r300screen->screen.transfer_unmap = r300_transfer_unmap;
 
     r300_init_screen_texture_functions(&r300screen->screen);
     u_simple_screen_init(&r300screen->screen);
index 2e25f61dbf136517dd73da52739bd74d1ce5cbe3..3f52dbc3beaebf1ac381cda80205a2ab4e34b93a 100644 (file)
@@ -40,13 +40,27 @@ struct r300_screen {
     struct r300_capabilities* caps;
 };
 
+struct r300_transfer {
+    /* Parent class */
+    struct pipe_transfer transfer;
+
+    /* Offset from start of buffer. */
+    unsigned offset;
+};
+
 /* Convenience cast wrapper. */
 static struct r300_screen* r300_screen(struct pipe_screen* screen) {
     return (struct r300_screen*)screen;
 }
 
+/* Convenience cast wrapper. */
+static INLINE struct r300_transfer*
+r300_transfer(struct pipe_transfer* transfer)
+{
+    return (struct r300_transfer*)transfer;
+}
+
 /* Creates a new r300 screen. */
-struct pipe_screen* r300_create_screen(struct pipe_winsys* winsys,
-                                       struct r300_winsys* r300_winsys);
+struct pipe_screen* r300_create_screen(struct r300_winsys* r300_winsys);
 
 #endif /* R300_SCREEN_H */
index 9392d7234279ab4a2760d6fdaefd9c1ea115f18e..58bce22fc81a2090bdf580e620c104bc9df0d8f7 100644 (file)
 
 #include "util/u_math.h"
 #include "util/u_pack_color.h"
-#include "pipe/p_debug.h"
+
+#include "util/u_debug.h"
+#include "pipe/internal/p_winsys_screen.h"
 
 #include "r300_context.h"
 #include "r300_reg.h"
+#include "r300_state_inlines.h"
+#include "r300_state_shader.h"
 
 /* r300_state: Functions used to intialize state context by translating
- * Gallium state objects into semi-native r300 state objects.
- *
- * XXX break this file up into pieces if it gets too big! */
-
-/* Pack a float into a dword. */
-static uint32_t pack_float_32(float f)
-{
-    union {
-        float f;
-        uint32_t u;
-    } u;
-
-    u.f = f;
-    return u.u;
-}
-
-static uint32_t translate_blend_function(int blend_func) {
-    switch (blend_func) {
-        case PIPE_BLEND_ADD:
-            return R300_COMB_FCN_ADD_CLAMP;
-        case PIPE_BLEND_SUBTRACT:
-            return R300_COMB_FCN_SUB_CLAMP;
-        case PIPE_BLEND_REVERSE_SUBTRACT:
-            return R300_COMB_FCN_RSUB_CLAMP;
-        case PIPE_BLEND_MIN:
-            return R300_COMB_FCN_MIN;
-        case PIPE_BLEND_MAX:
-            return R300_COMB_FCN_MAX;
-        default:
-            debug_printf("r300: Unknown blend function %d\n", blend_func);
-            break;
-    }
-    return 0;
-}
-
-/* XXX we can also offer the D3D versions of some of these... */
-static uint32_t translate_blend_factor(int blend_fact) {
-    switch (blend_fact) {
-        case PIPE_BLENDFACTOR_ONE:
-            return R300_BLEND_GL_ONE;
-        case PIPE_BLENDFACTOR_SRC_COLOR:
-            return R300_BLEND_GL_SRC_COLOR;
-        case PIPE_BLENDFACTOR_SRC_ALPHA:
-            return R300_BLEND_GL_SRC_ALPHA;
-        case PIPE_BLENDFACTOR_DST_ALPHA:
-            return R300_BLEND_GL_DST_ALPHA;
-        case PIPE_BLENDFACTOR_DST_COLOR:
-            return R300_BLEND_GL_DST_COLOR;
-        case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
-            return R300_BLEND_GL_SRC_ALPHA_SATURATE;
-        case PIPE_BLENDFACTOR_CONST_COLOR:
-            return R300_BLEND_GL_CONST_COLOR;
-        case PIPE_BLENDFACTOR_CONST_ALPHA:
-            return R300_BLEND_GL_CONST_ALPHA;
-        /* XXX WTF are these?
-        case PIPE_BLENDFACTOR_SRC1_COLOR:
-        case PIPE_BLENDFACTOR_SRC1_ALPHA: */
-        case PIPE_BLENDFACTOR_ZERO:
-            return R300_BLEND_GL_ZERO;
-        case PIPE_BLENDFACTOR_INV_SRC_COLOR:
-            return R300_BLEND_GL_ONE_MINUS_SRC_COLOR;
-        case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
-            return R300_BLEND_GL_ONE_MINUS_SRC_ALPHA;
-        case PIPE_BLENDFACTOR_INV_DST_ALPHA:
-            return R300_BLEND_GL_ONE_MINUS_DST_ALPHA;
-        case PIPE_BLENDFACTOR_INV_DST_COLOR:
-            return R300_BLEND_GL_ONE_MINUS_DST_COLOR;
-        case PIPE_BLENDFACTOR_INV_CONST_COLOR:
-            return R300_BLEND_GL_ONE_MINUS_CONST_COLOR;
-        case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
-            return R300_BLEND_GL_ONE_MINUS_CONST_ALPHA;
-        /* XXX see above
-        case PIPE_BLENDFACTOR_INV_SRC1_COLOR:
-        case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: */
-        default:
-            debug_printf("r300: Unknown blend factor %d\n", blend_fact);
-            break;
-    }
-    return 0;
-}
+ * Gallium state objects into semi-native r300 state objects. */
 
 /* Create a new blend state based on the CSO blend state.
  *
@@ -123,16 +48,16 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
         blend->blend_control = R300_ALPHA_BLEND_ENABLE |
                 R300_SEPARATE_ALPHA_ENABLE |
                 R300_READ_ENABLE |
-                translate_blend_function(state->rgb_func) |
-                (translate_blend_factor(state->rgb_src_factor) <<
+                r300_translate_blend_function(state->rgb_func) |
+                (r300_translate_blend_factor(state->rgb_src_factor) <<
                     R300_SRC_BLEND_SHIFT) |
-                (translate_blend_factor(state->rgb_dst_factor) <<
+                (r300_translate_blend_factor(state->rgb_dst_factor) <<
                     R300_DST_BLEND_SHIFT);
         blend->alpha_blend_control =
-                translate_blend_function(state->alpha_func) |
-                (translate_blend_factor(state->alpha_src_factor) <<
+                r300_translate_blend_function(state->alpha_func) |
+                (r300_translate_blend_factor(state->alpha_src_factor) <<
                     R300_SRC_BLEND_SHIFT) |
-                (translate_blend_factor(state->alpha_dst_factor) <<
+                (r300_translate_blend_factor(state->alpha_dst_factor) <<
                     R300_DST_BLEND_SHIFT);
     }
 
@@ -175,21 +100,17 @@ static void r300_set_blend_color(struct pipe_context* pipe,
                                  const struct pipe_blend_color* color)
 {
     struct r300_context* r300 = r300_context(pipe);
-    uint32_t r, g, b, a;
     ubyte ur, ug, ub, ua;
 
-    r = util_iround(color->color[0] * 1023.0f);
-    g = util_iround(color->color[1] * 1023.0f);
-    b = util_iround(color->color[2] * 1023.0f);
-    a = util_iround(color->color[3] * 1023.0f);
-
     ur = float_to_ubyte(color->color[0]);
     ug = float_to_ubyte(color->color[1]);
     ub = float_to_ubyte(color->color[2]);
     ua = float_to_ubyte(color->color[3]);
 
-    r300->blend_color_state->blend_color = (a << 24) | (r << 16) | (g << 8) | b;
+    util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM,
+            &r300->blend_color_state->blend_color);
 
+    /* XXX this is wrong */
     r300->blend_color_state->blend_color_red_alpha = ur | (ua << 16);
     r300->blend_color_state->blend_color_green_blue = ub | (ug << 16);
 
@@ -210,83 +131,24 @@ static void
                              uint shader, uint index,
                              const struct pipe_constant_buffer* buffer)
 {
-    /* XXX */
-}
-
-static uint32_t translate_depth_stencil_function(int zs_func) {
-    switch (zs_func) {
-        case PIPE_FUNC_NEVER:
-            return R300_ZS_NEVER;
-        case PIPE_FUNC_LESS:
-            return R300_ZS_LESS;
-        case PIPE_FUNC_EQUAL:
-            return R300_ZS_EQUAL;
-        case PIPE_FUNC_LEQUAL:
-            return R300_ZS_LEQUAL;
-        case PIPE_FUNC_GREATER:
-            return R300_ZS_GREATER;
-        case PIPE_FUNC_NOTEQUAL:
-            return R300_ZS_NOTEQUAL;
-        case PIPE_FUNC_GEQUAL:
-            return R300_ZS_GEQUAL;
-        case PIPE_FUNC_ALWAYS:
-            return R300_ZS_ALWAYS;
-        default:
-            debug_printf("r300: Unknown depth/stencil function %d\n",
-                zs_func);
-            break;
-    }
-    return 0;
-}
+    struct r300_context* r300 = r300_context(pipe);
 
-static uint32_t translate_stencil_op(int s_op) {
-    switch (s_op) {
-        case PIPE_STENCIL_OP_KEEP:
-            return R300_ZS_KEEP;
-        case PIPE_STENCIL_OP_ZERO:
-            return R300_ZS_ZERO;
-        case PIPE_STENCIL_OP_REPLACE:
-            return R300_ZS_REPLACE;
-        case PIPE_STENCIL_OP_INCR:
-            return R300_ZS_INCR;
-        case PIPE_STENCIL_OP_DECR:
-            return R300_ZS_DECR;
-        case PIPE_STENCIL_OP_INCR_WRAP:
-            return R300_ZS_INCR_WRAP;
-        case PIPE_STENCIL_OP_DECR_WRAP:
-            return R300_ZS_DECR_WRAP;
-        case PIPE_STENCIL_OP_INVERT:
-            return R300_ZS_INVERT;
-        default:
-            debug_printf("r300: Unknown stencil op %d", s_op);
-            break;
+    /* This entire chunk of code seems ever-so-slightly baked.
+     * It's as if I've got pipe_buffer* matryoshkas... */
+    if (buffer && buffer->buffer && buffer->buffer->size) {
+        void* map = pipe->winsys->buffer_map(pipe->winsys, buffer->buffer,
+                                             PIPE_BUFFER_USAGE_CPU_READ);
+        memcpy(r300->shader_constants[shader].constants,
+            map, buffer->buffer->size);
+        pipe->winsys->buffer_unmap(pipe->winsys, buffer->buffer);
+
+        r300->shader_constants[shader].user_count =
+            buffer->buffer->size / (sizeof(float) * 4);
+    } else {
+        r300->shader_constants[shader].user_count = 0;
     }
-    return 0;
-}
 
-static uint32_t translate_alpha_function(int alpha_func) {
-    switch (alpha_func) {
-        case PIPE_FUNC_NEVER:
-            return R300_FG_ALPHA_FUNC_NEVER;
-        case PIPE_FUNC_LESS:
-            return R300_FG_ALPHA_FUNC_LESS;
-        case PIPE_FUNC_EQUAL:
-            return R300_FG_ALPHA_FUNC_EQUAL;
-        case PIPE_FUNC_LEQUAL:
-            return R300_FG_ALPHA_FUNC_LE;
-        case PIPE_FUNC_GREATER:
-            return R300_FG_ALPHA_FUNC_GREATER;
-        case PIPE_FUNC_NOTEQUAL:
-            return R300_FG_ALPHA_FUNC_NOTEQUAL;
-        case PIPE_FUNC_GEQUAL:
-            return R300_FG_ALPHA_FUNC_GE;
-        case PIPE_FUNC_ALWAYS:
-            return R300_FG_ALPHA_FUNC_ALWAYS;
-        default:
-            debug_printf("r300: Unknown alpha function %d", alpha_func);
-            break;
-    }
-    return 0;
+    r300->dirty_state |= R300_NEW_CONSTANTS;
 }
 
 /* Create a new depth, stencil, and alpha state based on the CSO dsa state.
@@ -309,7 +171,7 @@ static void*
         }
 
         dsa->z_stencil_control |=
-            (translate_depth_stencil_function(state->depth.func) <<
+            (r300_translate_depth_stencil_function(state->depth.func) <<
                 R300_Z_FUNC_SHIFT);
     }
 
@@ -317,14 +179,14 @@ static void*
     if (state->stencil[0].enabled) {
         dsa->z_buffer_control |= R300_STENCIL_ENABLE;
         dsa->z_stencil_control |=
-                (translate_depth_stencil_function(state->stencil[0].func) <<
-                    R300_S_FRONT_FUNC_SHIFT) |
-                (translate_stencil_op(state->stencil[0].fail_op) <<
-                    R300_S_FRONT_SFAIL_OP_SHIFT) |
-                (translate_stencil_op(state->stencil[0].zpass_op) <<
-                    R300_S_FRONT_ZPASS_OP_SHIFT) |
-                (translate_stencil_op(state->stencil[0].zfail_op) <<
-                    R300_S_FRONT_ZFAIL_OP_SHIFT);
+            (r300_translate_depth_stencil_function(state->stencil[0].func) <<
+                R300_S_FRONT_FUNC_SHIFT) |
+            (r300_translate_stencil_op(state->stencil[0].fail_op) <<
+                R300_S_FRONT_SFAIL_OP_SHIFT) |
+            (r300_translate_stencil_op(state->stencil[0].zpass_op) <<
+                R300_S_FRONT_ZPASS_OP_SHIFT) |
+            (r300_translate_stencil_op(state->stencil[0].zfail_op) <<
+                R300_S_FRONT_ZFAIL_OP_SHIFT);
 
         dsa->stencil_ref_mask = (state->stencil[0].ref_value) |
                 (state->stencil[0].valuemask << R300_STENCILMASK_SHIFT) |
@@ -333,14 +195,14 @@ static void*
         if (state->stencil[1].enabled) {
             dsa->z_buffer_control |= R300_STENCIL_FRONT_BACK;
             dsa->z_stencil_control |=
-                (translate_depth_stencil_function(state->stencil[1].func) <<
-                    R300_S_BACK_FUNC_SHIFT) |
-                (translate_stencil_op(state->stencil[1].fail_op) <<
-                    R300_S_BACK_SFAIL_OP_SHIFT) |
-                (translate_stencil_op(state->stencil[1].zpass_op) <<
-                    R300_S_BACK_ZPASS_OP_SHIFT) |
-                (translate_stencil_op(state->stencil[1].zfail_op) <<
-                    R300_S_BACK_ZFAIL_OP_SHIFT);
+            (r300_translate_depth_stencil_function(state->stencil[1].func) <<
+                R300_S_BACK_FUNC_SHIFT) |
+            (r300_translate_stencil_op(state->stencil[1].fail_op) <<
+                R300_S_BACK_SFAIL_OP_SHIFT) |
+            (r300_translate_stencil_op(state->stencil[1].zpass_op) <<
+                R300_S_BACK_ZPASS_OP_SHIFT) |
+            (r300_translate_stencil_op(state->stencil[1].zfail_op) <<
+                R300_S_BACK_ZFAIL_OP_SHIFT);
 
             dsa->stencil_ref_bf = (state->stencil[1].ref_value) |
                 (state->stencil[1].valuemask << R300_STENCILMASK_SHIFT) |
@@ -350,7 +212,8 @@ static void*
 
     /* Alpha test setup. */
     if (state->alpha.enabled) {
-        dsa->alpha_function = translate_alpha_function(state->alpha.func) |
+        dsa->alpha_function =
+            r300_translate_alpha_function(state->alpha.func) |
             R300_FG_ALPHA_FUNC_ENABLE;
         dsa->alpha_reference = CLAMP(state->alpha.ref_value * 1023.0f,
                                      0, 1023);
@@ -415,6 +278,8 @@ static void* r300_create_fs_state(struct pipe_context* pipe,
     /* Copy state directly into shader. */
     fs->state = *shader;
 
+    tgsi_scan_shader(shader->tokens, &fs->info);
+
     return (void*)fs;
 }
 
@@ -424,14 +289,18 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader)
     struct r300_context* r300 = r300_context(pipe);
     struct r3xx_fragment_shader* fs = (struct r3xx_fragment_shader*)shader;
 
-    if (!fs->translated) {
+    if (fs == NULL) {
+        r300->fs = NULL;
+        return;
+    } else if (!fs->translated) {
         if (r300_screen(r300->context.screen)->caps->is_r500) {
-            r500_translate_shader(r300, fs);
+            r500_translate_fragment_shader(r300, (struct r500_fragment_shader*)fs);
         } else {
-            r300_translate_shader(r300, fs);
+            r300_translate_fragment_shader(r300, (struct r300_fragment_shader*)fs);
         }
     }
 
+    fs->translated = TRUE;
     r300->fs = fs;
 
     r300->dirty_state |= R300_NEW_FRAGMENT_SHADER;
@@ -449,10 +318,6 @@ static void r300_set_polygon_stipple(struct pipe_context* pipe,
     /* XXX */
 }
 
-static INLINE int pack_float_16_6x(float f) {
-    return ((int)(f * 6.0) & 0xffff);
-}
-
 /* Create a new rasterizer state based on the CSO rasterizer state.
  *
  * This is a very large chunk of state, and covers most of the graphics
@@ -472,6 +337,12 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
     rs->point_size = pack_float_16_6x(state->point_size) |
         (pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT);
 
+    rs->point_minmax =
+        ((int)(state->point_size_min * 6.0) <<
+         R300_GA_POINT_MINMAX_MIN_SHIFT) |
+        ((int)(state->point_size_max * 6.0) <<
+         R300_GA_POINT_MINMAX_MAX_SHIFT);
+
     rs->line_control = pack_float_16_6x(state->line_width) |
         R300_GA_LINE_CNTL_END_TYPE_COMP;
 
@@ -504,20 +375,28 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
 
     if (rs->polygon_offset_enable) {
         rs->depth_offset_front = rs->depth_offset_back =
-                pack_float_32(state->offset_units);
+            fui(state->offset_units);
         rs->depth_scale_front = rs->depth_scale_back =
-                pack_float_32(state->offset_scale);
+            fui(state->offset_scale);
     }
 
     if (state->line_stipple_enable) {
         rs->line_stipple_config =
             R300_GA_LINE_STIPPLE_CONFIG_LINE_RESET_LINE |
-            (pack_float_32((float)state->line_stipple_factor) &
+            (fui((float)state->line_stipple_factor) &
                 R300_GA_LINE_STIPPLE_CONFIG_STIPPLE_SCALE_MASK);
         /* XXX this might need to be scaled up */
         rs->line_stipple_value = state->line_stipple_pattern;
     }
 
+    if (state->flatshade) {
+        rs->color_control = R300_SHADE_MODEL_FLAT;
+    } else {
+        rs->color_control = R300_SHADE_MODEL_SMOOTH;
+    }
+
+    rs->rs = *state;
+
     return (void*)rs;
 }
 
@@ -525,8 +404,11 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
 static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
 {
     struct r300_context* r300 = r300_context(pipe);
+    struct r300_rs_state* rs = (struct r300_rs_state*)state;
+
+    draw_set_rasterizer_state(r300->draw, &rs->rs);
 
-    r300->rs_state = (struct r300_rs_state*)state;
+    r300->rs_state = rs;
     r300->dirty_state |= R300_NEW_RASTERIZER;
 }
 
@@ -536,83 +418,6 @@ static void r300_delete_rs_state(struct pipe_context* pipe, void* state)
     FREE(state);
 }
 
-static uint32_t translate_wrap(int wrap) {
-    switch (wrap) {
-        case PIPE_TEX_WRAP_REPEAT:
-            return R300_TX_REPEAT;
-        case PIPE_TEX_WRAP_CLAMP:
-            return R300_TX_CLAMP;
-        case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
-            return R300_TX_CLAMP_TO_EDGE;
-        case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
-            return R300_TX_CLAMP_TO_BORDER;
-        case PIPE_TEX_WRAP_MIRROR_REPEAT:
-            return R300_TX_REPEAT | R300_TX_MIRRORED;
-        case PIPE_TEX_WRAP_MIRROR_CLAMP:
-            return R300_TX_CLAMP | R300_TX_MIRRORED;
-        case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
-            return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
-        case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
-            return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
-        default:
-            debug_printf("r300: Unknown texture wrap %d", wrap);
-            return 0;
-    }
-}
-
-static uint32_t translate_tex_filters(int min, int mag, int mip) {
-    uint32_t retval = 0;
-    switch (min) {
-        case PIPE_TEX_FILTER_NEAREST:
-            retval |= R300_TX_MIN_FILTER_NEAREST;
-        case PIPE_TEX_FILTER_LINEAR:
-            retval |= R300_TX_MIN_FILTER_LINEAR;
-        case PIPE_TEX_FILTER_ANISO:
-            retval |= R300_TX_MIN_FILTER_ANISO;
-        default:
-            debug_printf("r300: Unknown texture filter %d", min);
-            break;
-    }
-    switch (mag) {
-        case PIPE_TEX_FILTER_NEAREST:
-            retval |= R300_TX_MAG_FILTER_NEAREST;
-        case PIPE_TEX_FILTER_LINEAR:
-            retval |= R300_TX_MAG_FILTER_LINEAR;
-        case PIPE_TEX_FILTER_ANISO:
-            retval |= R300_TX_MAG_FILTER_ANISO;
-        default:
-            debug_printf("r300: Unknown texture filter %d", mag);
-            break;
-    }
-    switch (mip) {
-        case PIPE_TEX_MIPFILTER_NONE:
-            retval |= R300_TX_MIN_FILTER_MIP_NONE;
-        case PIPE_TEX_MIPFILTER_NEAREST:
-            retval |= R300_TX_MIN_FILTER_MIP_NEAREST;
-        case PIPE_TEX_MIPFILTER_LINEAR:
-            retval |= R300_TX_MIN_FILTER_MIP_LINEAR;
-        default:
-            debug_printf("r300: Unknown texture filter %d", mip);
-            break;
-    }
-
-    return retval;
-}
-
-static uint32_t anisotropy(float max_aniso) {
-    if (max_aniso >= 16.0f) {
-        return R300_TX_MAX_ANISO_16_TO_1;
-    } else if (max_aniso >= 8.0f) {
-        return R300_TX_MAX_ANISO_8_TO_1;
-    } else if (max_aniso >= 4.0f) {
-        return R300_TX_MAX_ANISO_4_TO_1;
-    } else if (max_aniso >= 2.0f) {
-        return R300_TX_MAX_ANISO_2_TO_1;
-    } else {
-        return R300_TX_MAX_ANISO_1_TO_1;
-    }
-}
-
 static void*
         r300_create_sampler_state(struct pipe_context* pipe,
                                   const struct pipe_sampler_state* state)
@@ -622,19 +427,19 @@ static void*
     int lod_bias;
 
     sampler->filter0 |=
-        (translate_wrap(state->wrap_s) << R300_TX_WRAP_S_SHIFT) |
-        (translate_wrap(state->wrap_t) << R300_TX_WRAP_T_SHIFT) |
-        (translate_wrap(state->wrap_r) << R300_TX_WRAP_R_SHIFT);
+        (r300_translate_wrap(state->wrap_s) << R300_TX_WRAP_S_SHIFT) |
+        (r300_translate_wrap(state->wrap_t) << R300_TX_WRAP_T_SHIFT) |
+        (r300_translate_wrap(state->wrap_r) << R300_TX_WRAP_R_SHIFT);
 
-    sampler->filter0 |= translate_tex_filters(state->min_img_filter,
-                                              state->mag_img_filter,
-                                              state->min_mip_filter);
+    sampler->filter0 |= r300_translate_tex_filters(state->min_img_filter,
+                                                   state->mag_img_filter,
+                                                   state->min_mip_filter);
 
     lod_bias = CLAMP((int)(state->lod_bias * 32), -(1 << 9), (1 << 9) - 1);
 
     sampler->filter1 |= lod_bias << R300_LOD_BIAS_SHIFT;
 
-    sampler->filter1 |= anisotropy(state->max_anisotropy);
+    sampler->filter1 |= r300_anisotropy(state->max_anisotropy);
 
     util_pack_color(state->border_color, PIPE_FORMAT_A8R8G8B8_UNORM,
                     &sampler->border_color);
@@ -710,20 +515,12 @@ static void r300_set_scissor_state(struct pipe_context* pipe,
     struct r300_context* r300 = r300_context(pipe);
     draw_flush(r300->draw);
 
-    uint32_t left, top, right, bottom;
-
-    /* So, a bit of info. The scissors are offset by R300_SCISSORS_OFFSET in
-     * both directions for all values, and can only be 13 bits wide. Why?
-     * We may never know. */
-    left = (state->minx + R300_SCISSORS_OFFSET) & 0x1fff;
-    top = (state->miny + R300_SCISSORS_OFFSET) & 0x1fff;
-    right = (state->maxx + R300_SCISSORS_OFFSET) & 0x1fff;
-    bottom = (state->maxy + R300_SCISSORS_OFFSET) & 0x1fff;
-
-    r300->scissor_state->scissor_top_left = (left << R300_SCISSORS_X_SHIFT) |
-            (top << R300_SCISSORS_Y_SHIFT);
+    r300->scissor_state->scissor_top_left =
+        (state->minx << R300_SCISSORS_X_SHIFT) |
+        (state->miny << R300_SCISSORS_Y_SHIFT);
     r300->scissor_state->scissor_bottom_right =
-        (right << R300_SCISSORS_X_SHIFT) | (bottom << R300_SCISSORS_Y_SHIFT);
+        (state->maxx << R300_SCISSORS_X_SHIFT) |
+        (state->maxy << R300_SCISSORS_Y_SHIFT);
 
     r300->dirty_state |= R300_NEW_SCISSOR;
 }
@@ -732,8 +529,26 @@ static void r300_set_viewport_state(struct pipe_context* pipe,
                                     const struct pipe_viewport_state* state)
 {
     struct r300_context* r300 = r300_context(pipe);
-    /* XXX handing this off to Draw for now */
-    draw_set_viewport_state(r300->draw, state);
+
+    r300->viewport_state->xscale = state->scale[0];
+    r300->viewport_state->yscale = state->scale[1];
+    r300->viewport_state->zscale = state->scale[2];
+
+    r300->viewport_state->xoffset = state->translate[0];
+    r300->viewport_state->yoffset = state->translate[1];
+    r300->viewport_state->zoffset = state->translate[2];
+
+    r300->viewport_state->vte_control = 0;
+    if (r300_screen(r300->context.screen)->caps->has_tcl) {
+        /* Do the transform in HW. */
+        r300->viewport_state->vte_control |=
+            R300_VPORT_X_SCALE_ENA | R300_VPORT_X_OFFSET_ENA |
+            R300_VPORT_Y_SCALE_ENA | R300_VPORT_Y_OFFSET_ENA |
+            R300_VPORT_Z_SCALE_ENA | R300_VPORT_Z_OFFSET_ENA;
+    } else {
+        /* Have Draw do the actual transform. */
+        draw_set_viewport_state(r300->draw, state);
+    }
 }
 
 static void r300_set_vertex_buffers(struct pipe_context* pipe,
@@ -741,7 +556,12 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
                                     const struct pipe_vertex_buffer* buffers)
 {
     struct r300_context* r300 = r300_context(pipe);
-    /* XXX Draw */
+
+    memcpy(r300->vertex_buffers, buffers,
+        sizeof(struct pipe_vertex_buffer) * count);
+
+    r300->vertex_buffer_count = count;
+
     draw_flush(r300->draw);
     draw_set_vertex_buffers(r300->draw, count, buffers);
 }
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
new file mode 100644 (file)
index 0000000..d761a03
--- /dev/null
@@ -0,0 +1,299 @@
+/*
+ * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "r300_state_derived.h"
+
+/* r300_state_derived: Various bits of state which are dependent upon
+ * currently bound CSO data. */
+
+/* Update the vertex_info struct in our r300_context.
+ *
+ * The vertex_info struct describes the post-TCL format of vertices. It is
+ * required for Draw when doing SW TCL, and also for describing the
+ * dreaded RS block on R300 chipsets. */
+/* XXX this function should be able to handle vert shaders as well as draw */
+static void r300_update_vertex_layout(struct r300_context* r300)
+{
+    struct r300_vertex_format vformat;
+    struct vertex_info vinfo;
+    boolean pos = FALSE, psize = FALSE, fog = FALSE;
+    int i, texs = 0, cols = 0;
+    int tab[16];
+
+    struct tgsi_shader_info* info = &r300->fs->info;
+
+    memset(&vinfo, 0, sizeof(vinfo));
+    for (i = 0; i < 16; i++) {
+        tab[i] = -1;
+    }
+
+    assert(info->num_inputs <= 16);
+
+    for (i = 0; i < info->num_inputs; i++) {
+        switch (info->input_semantic_name[i]) {
+            case TGSI_SEMANTIC_POSITION:
+                pos = TRUE;
+                tab[i] = 0;
+                break;
+            case TGSI_SEMANTIC_COLOR:
+                tab[i] = 2 + cols++;
+                break;
+            case TGSI_SEMANTIC_PSIZE:
+                psize = TRUE;
+                tab[i] = 1;
+                break;
+            case TGSI_SEMANTIC_FOG:
+                fog = TRUE;
+                /* Fall through... */
+            case TGSI_SEMANTIC_GENERIC:
+                tab[i] = 6 + texs++;
+                break;
+            default:
+                debug_printf("r300: Unknown vertex input %d\n",
+                    info->input_semantic_name[i]);
+                break;
+        }
+    }
+
+    /* Do the actual vertex_info setup.
+     *
+     * vertex_info has four uints of hardware-specific data in it.
+     * vinfo.hwfmt[0] is R300_VAP_VTX_STATE_CNTL
+     * vinfo.hwfmt[1] is R300_VAP_VSM_VTX_ASSM
+     * vinfo.hwfmt[2] is R300_VAP_OUTPUT_VTX_FMT_0
+     * vinfo.hwfmt[3] is R300_VAP_OUTPUT_VTX_FMT_1 */
+
+    vinfo.hwfmt[0] = 0x5555; /* XXX this is classic Mesa bonghits */
+
+    if (!pos) {
+        debug_printf("r300: Forcing vertex position attribute emit...\n");
+        /* Make room for the position attribute
+         * at the beginning of the tab. */
+        for (i = 15; i > 0; i--) {
+            tab[i] = tab[i-1];
+        }
+        tab[0] = 0;
+
+        draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_POS,
+            draw_find_vs_output(r300->draw, TGSI_SEMANTIC_POSITION, 0));
+    } else {
+        draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE,
+            draw_find_vs_output(r300->draw, TGSI_SEMANTIC_POSITION, 0));
+    }
+    vinfo.hwfmt[1] |= R300_INPUT_CNTL_POS;
+    vinfo.hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
+
+    if (psize) {
+        draw_emit_vertex_attr(&vinfo, EMIT_1F_PSIZE, INTERP_POS,
+            draw_find_vs_output(r300->draw, TGSI_SEMANTIC_PSIZE, 0));
+        vinfo.hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
+    }
+
+    for (i = 0; i < cols; i++) {
+        draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR,
+            draw_find_vs_output(r300->draw, TGSI_SEMANTIC_COLOR, i));
+        vinfo.hwfmt[1] |= R300_INPUT_CNTL_COLOR;
+        vinfo.hwfmt[2] |= (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i);
+    }
+
+    for (i = 0; i < texs; i++) {
+        draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE,
+            draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i));
+        vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i);
+        vinfo.hwfmt[3] |= (4 << (3 * i));
+    }
+
+    if (fog) {
+        i++;
+        draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE,
+            draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0));
+        vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i);
+        vinfo.hwfmt[3] |= (4 << (3 * i));
+    }
+
+    draw_compute_vertex_size(&vinfo);
+
+    if (memcmp(&r300->vertex_info, &vinfo, sizeof(struct vertex_info))) {
+        uint32_t temp;
+        debug_printf("attrib count: %d, fp input count: %d\n",
+                vinfo.num_attribs, info->num_inputs);
+        for (i = 0; i < vinfo.num_attribs; i++) {
+            debug_printf("attrib: offset %d, interp %d, size %d,"
+                   " tab %d\n", vinfo.attrib[i].src_index,
+                   vinfo.attrib[i].interp_mode, vinfo.attrib[i].emit,
+                   tab[i]);
+        }
+
+        for (i = 0; i < vinfo.num_attribs; i++) {
+            /* Make sure we have a proper destination for our attribute */
+            assert(tab[i] != -1);
+
+            temp = translate_vertex_data_type(vinfo.attrib[i].emit) |
+                (tab[i] << R300_DST_VEC_LOC_SHIFT);
+            if (i & 1) {
+                r300->vertex_info.vap_prog_stream_cntl[i >> 1] &= 0x0000ffff;
+                r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= temp << 16;
+            } else {
+                r300->vertex_info.vap_prog_stream_cntl[i >> 1] &= 0xffff0000;
+                r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= temp;
+            }
+
+            r300->vertex_info.vap_prog_stream_cntl_ext[i >> 1] |=
+                (R300_VAP_SWIZZLE_XYZW << (i & 1 ? 16 : 0));
+        }
+        /* Set the last vector. */
+        i--;
+        r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= (R300_LAST_VEC <<
+                (i & 1 ? 16 : 0));
+
+        memcpy(r300->vertex_info.tab, tab, sizeof(tab));
+        memcpy(&r300->vertex_info, &vinfo, sizeof(struct vertex_info));
+        r300->dirty_state |= R300_NEW_VERTEX_FORMAT;
+    }
+}
+
+/* Set up the RS block. This is the part of the chipset that actually does
+ * the rasterization of vertices into fragments. This is also the part of the
+ * chipset that locks up if any part of it is even slightly wrong. */
+static void r300_update_rs_block(struct r300_context* r300)
+{
+    struct r300_rs_block* rs = r300->rs_block;
+    struct vertex_info* vinfo = &r300->vertex_info.vinfo;
+    int* tab = r300->vertex_info.tab;
+    int col_count = 0, fp_offset = 0, i, memory_pos, tex_count = 0;
+
+    memset(rs, 0, sizeof(struct r300_rs_block));
+
+    if (r300_screen(r300->context.screen)->caps->is_r500) {
+        for (i = 0; i < vinfo->num_attribs; i++) {
+            assert(tab[vinfo->attrib[i].src_index] != -1);
+            memory_pos = tab[vinfo->attrib[i].src_index] * 4;
+            switch (vinfo->attrib[i].interp_mode) {
+                case INTERP_LINEAR:
+                    rs->ip[col_count] |=
+                        R500_RS_COL_PTR(memory_pos) |
+                        R500_RS_COL_FMT(R300_RS_COL_FMT_RGBA);
+                    col_count++;
+                    break;
+                case INTERP_PERSPECTIVE:
+                    rs->ip[tex_count] |=
+                        R500_RS_SEL_S(memory_pos) |
+                        R500_RS_SEL_T(memory_pos + 1) |
+                        R500_RS_SEL_R(memory_pos + 2) |
+                        R500_RS_SEL_Q(memory_pos + 3);
+                    tex_count++;
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        if (col_count == 0) {
+            rs->ip[0] |= R500_RS_COL_FMT(R300_RS_COL_FMT_0001);
+        }
+
+        /* Set up at least one texture pointer or RS will not be happy. */
+        if (tex_count == 0) {
+            rs->ip[0] |=
+                R500_RS_SEL_S(R500_RS_IP_PTR_K0) |
+                R500_RS_SEL_T(R500_RS_IP_PTR_K0) |
+                R500_RS_SEL_R(R500_RS_IP_PTR_K0) |
+                R500_RS_SEL_Q(R500_RS_IP_PTR_K1);
+        }
+
+        for (i = 0; i < tex_count; i++) {
+            rs->inst[i] |= R500_RS_INST_TEX_ID(i) | R500_RS_INST_TEX_CN_WRITE |
+                R500_RS_INST_TEX_ADDR(fp_offset);
+            fp_offset++;
+        }
+
+        for (i = 0; i < col_count; i++) {
+            rs->inst[i] |= R500_RS_INST_COL_ID(i) | R500_RS_INST_COL_CN_WRITE |
+                R500_RS_INST_COL_ADDR(fp_offset);
+            fp_offset++;
+        }
+    } else {
+        for (i = 0; i < vinfo->num_attribs; i++) {
+            memory_pos = tab[vinfo->attrib[i].src_index] * 4;
+            assert(tab[vinfo->attrib[i].src_index] != -1);
+            switch (vinfo->attrib[i].interp_mode) {
+                case INTERP_LINEAR:
+                    rs->ip[col_count] |=
+                        R300_RS_COL_PTR(memory_pos) |
+                        R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA);
+                    col_count++;
+                    break;
+                case INTERP_PERSPECTIVE:
+                    rs->ip[tex_count] |=
+                        R300_RS_TEX_PTR(memory_pos) |
+                        R300_RS_SEL_S(R300_RS_SEL_C0) |
+                        R300_RS_SEL_T(R300_RS_SEL_C1) |
+                        R300_RS_SEL_R(R300_RS_SEL_C2) |
+                        R300_RS_SEL_Q(R300_RS_SEL_C3);
+                    tex_count++;
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        if (col_count == 0) {
+            rs->ip[0] |= R300_RS_COL_FMT(R300_RS_COL_FMT_0001);
+        }
+
+        if (tex_count == 0) {
+            rs->ip[0] |=
+                R300_RS_SEL_S(R300_RS_SEL_K0) |
+                R300_RS_SEL_T(R300_RS_SEL_K0) |
+                R300_RS_SEL_R(R300_RS_SEL_K0) |
+                R300_RS_SEL_Q(R300_RS_SEL_K1);
+        }
+
+        for (i = 0; i < tex_count; i++) {
+            rs->inst[i] |= R300_RS_INST_TEX_ID(i) | R300_RS_INST_TEX_CN_WRITE |
+                R300_RS_INST_TEX_ADDR(fp_offset);
+            fp_offset++;
+        }
+
+        for (i = 0; i < col_count; i++) {
+            rs->inst[i] |= R300_RS_INST_COL_ID(i) | R300_RS_INST_COL_CN_WRITE |
+                R300_RS_INST_COL_ADDR(fp_offset);
+            fp_offset++;
+        }
+    }
+
+    rs->count = (tex_count * 4) | (col_count << R300_IC_COUNT_SHIFT) |
+        R300_HIRES_EN;
+
+    rs->inst_count = MAX2(MAX2(col_count - 1, tex_count - 1), 0);
+}
+
+void r300_update_derived_state(struct r300_context* r300)
+{
+    if (r300->dirty_state & R300_NEW_FRAGMENT_SHADER) {
+        r300_update_vertex_layout(r300);
+    }
+
+    if (r300->dirty_state & R300_NEW_VERTEX_FORMAT) {
+        r300_update_rs_block(r300);
+    }
+}
diff --git a/src/gallium/drivers/r300/r300_state_derived.h b/src/gallium/drivers/r300/r300_state_derived.h
new file mode 100644 (file)
index 0000000..63ae8eb
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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
+
+#include "draw/draw_vertex.h"
+
+#include "r300_context.h"
+#include "r300_reg.h"
+#include "r300_state_inlines.h"
+
+void r300_update_derived_state(struct r300_context* r300);
+
+#endif /* R300_STATE_DERIVED_H */
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
new file mode 100644 (file)
index 0000000..fd92c71
--- /dev/null
@@ -0,0 +1,384 @@
+/*
+ * Copyright 2009 Joakim Sindholt <opensource@zhasha.com>
+ *                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_INLINES_H
+#define R300_STATE_INLINES_H
+
+#include "pipe/p_format.h"
+
+#include "r300_reg.h"
+
+/* Some maths. These should probably find their way to u_math, if needed. */
+
+static INLINE int pack_float_16_6x(float f) {
+    return ((int)(f * 6.0) & 0xffff);
+}
+
+/* Blend state. */
+
+static INLINE uint32_t r300_translate_blend_function(int blend_func)
+{
+    switch (blend_func) {
+        case PIPE_BLEND_ADD:
+            return R300_COMB_FCN_ADD_CLAMP;
+        case PIPE_BLEND_SUBTRACT:
+            return R300_COMB_FCN_SUB_CLAMP;
+        case PIPE_BLEND_REVERSE_SUBTRACT:
+            return R300_COMB_FCN_RSUB_CLAMP;
+        case PIPE_BLEND_MIN:
+            return R300_COMB_FCN_MIN;
+        case PIPE_BLEND_MAX:
+            return R300_COMB_FCN_MAX;
+        default:
+            debug_printf("r300: Unknown blend function %d\n", blend_func);
+            break;
+    }
+    return 0;
+}
+
+/* XXX we can also offer the D3D versions of some of these... */
+static INLINE uint32_t r300_translate_blend_factor(int blend_fact)
+{
+    switch (blend_fact) {
+        case PIPE_BLENDFACTOR_ONE:
+            return R300_BLEND_GL_ONE;
+        case PIPE_BLENDFACTOR_SRC_COLOR:
+            return R300_BLEND_GL_SRC_COLOR;
+        case PIPE_BLENDFACTOR_SRC_ALPHA:
+            return R300_BLEND_GL_SRC_ALPHA;
+        case PIPE_BLENDFACTOR_DST_ALPHA:
+            return R300_BLEND_GL_DST_ALPHA;
+        case PIPE_BLENDFACTOR_DST_COLOR:
+            return R300_BLEND_GL_DST_COLOR;
+        case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
+            return R300_BLEND_GL_SRC_ALPHA_SATURATE;
+        case PIPE_BLENDFACTOR_CONST_COLOR:
+            return R300_BLEND_GL_CONST_COLOR;
+        case PIPE_BLENDFACTOR_CONST_ALPHA:
+            return R300_BLEND_GL_CONST_ALPHA;
+        /* XXX WTF are these?
+        case PIPE_BLENDFACTOR_SRC1_COLOR:
+        case PIPE_BLENDFACTOR_SRC1_ALPHA: */
+        case PIPE_BLENDFACTOR_ZERO:
+            return R300_BLEND_GL_ZERO;
+        case PIPE_BLENDFACTOR_INV_SRC_COLOR:
+            return R300_BLEND_GL_ONE_MINUS_SRC_COLOR;
+        case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
+            return R300_BLEND_GL_ONE_MINUS_SRC_ALPHA;
+        case PIPE_BLENDFACTOR_INV_DST_ALPHA:
+            return R300_BLEND_GL_ONE_MINUS_DST_ALPHA;
+        case PIPE_BLENDFACTOR_INV_DST_COLOR:
+            return R300_BLEND_GL_ONE_MINUS_DST_COLOR;
+        case PIPE_BLENDFACTOR_INV_CONST_COLOR:
+            return R300_BLEND_GL_ONE_MINUS_CONST_COLOR;
+        case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
+            return R300_BLEND_GL_ONE_MINUS_CONST_ALPHA;
+        /* XXX see above
+        case PIPE_BLENDFACTOR_INV_SRC1_COLOR:
+        case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: */
+        default:
+            debug_printf("r300: Unknown blend factor %d\n", blend_fact);
+            break;
+    }
+    return 0;
+}
+
+/* DSA state. */
+
+static INLINE uint32_t r300_translate_depth_stencil_function(int zs_func)
+{
+    switch (zs_func) {
+        case PIPE_FUNC_NEVER:
+            return R300_ZS_NEVER;
+        case PIPE_FUNC_LESS:
+            return R300_ZS_LESS;
+        case PIPE_FUNC_EQUAL:
+            return R300_ZS_EQUAL;
+        case PIPE_FUNC_LEQUAL:
+            return R300_ZS_LEQUAL;
+        case PIPE_FUNC_GREATER:
+            return R300_ZS_GREATER;
+        case PIPE_FUNC_NOTEQUAL:
+            return R300_ZS_NOTEQUAL;
+        case PIPE_FUNC_GEQUAL:
+            return R300_ZS_GEQUAL;
+        case PIPE_FUNC_ALWAYS:
+            return R300_ZS_ALWAYS;
+        default:
+            debug_printf("r300: Unknown depth/stencil function %d\n",
+                zs_func);
+            break;
+    }
+    return 0;
+}
+
+static INLINE uint32_t r300_translate_stencil_op(int s_op)
+{
+    switch (s_op) {
+        case PIPE_STENCIL_OP_KEEP:
+            return R300_ZS_KEEP;
+        case PIPE_STENCIL_OP_ZERO:
+            return R300_ZS_ZERO;
+        case PIPE_STENCIL_OP_REPLACE:
+            return R300_ZS_REPLACE;
+        case PIPE_STENCIL_OP_INCR:
+            return R300_ZS_INCR;
+        case PIPE_STENCIL_OP_DECR:
+            return R300_ZS_DECR;
+        case PIPE_STENCIL_OP_INCR_WRAP:
+            return R300_ZS_INCR_WRAP;
+        case PIPE_STENCIL_OP_DECR_WRAP:
+            return R300_ZS_DECR_WRAP;
+        case PIPE_STENCIL_OP_INVERT:
+            return R300_ZS_INVERT;
+        default:
+            debug_printf("r300: Unknown stencil op %d", s_op);
+            break;
+    }
+    return 0;
+}
+
+static INLINE uint32_t r300_translate_alpha_function(int alpha_func)
+{
+    switch (alpha_func) {
+        case PIPE_FUNC_NEVER:
+            return R300_FG_ALPHA_FUNC_NEVER;
+        case PIPE_FUNC_LESS:
+            return R300_FG_ALPHA_FUNC_LESS;
+        case PIPE_FUNC_EQUAL:
+            return R300_FG_ALPHA_FUNC_EQUAL;
+        case PIPE_FUNC_LEQUAL:
+            return R300_FG_ALPHA_FUNC_LE;
+        case PIPE_FUNC_GREATER:
+            return R300_FG_ALPHA_FUNC_GREATER;
+        case PIPE_FUNC_NOTEQUAL:
+            return R300_FG_ALPHA_FUNC_NOTEQUAL;
+        case PIPE_FUNC_GEQUAL:
+            return R300_FG_ALPHA_FUNC_GE;
+        case PIPE_FUNC_ALWAYS:
+            return R300_FG_ALPHA_FUNC_ALWAYS;
+        default:
+            debug_printf("r300: Unknown alpha function %d", alpha_func);
+            break;
+    }
+    return 0;
+}
+
+/* Texture sampler state. */
+
+static INLINE uint32_t r300_translate_wrap(int wrap)
+{
+    switch (wrap) {
+        case PIPE_TEX_WRAP_REPEAT:
+            return R300_TX_REPEAT;
+        case PIPE_TEX_WRAP_CLAMP:
+            return R300_TX_CLAMP;
+        case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+            return R300_TX_CLAMP_TO_EDGE;
+        case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
+            return R300_TX_CLAMP_TO_BORDER;
+        case PIPE_TEX_WRAP_MIRROR_REPEAT:
+            return R300_TX_REPEAT | R300_TX_MIRRORED;
+        case PIPE_TEX_WRAP_MIRROR_CLAMP:
+            return R300_TX_CLAMP | R300_TX_MIRRORED;
+        case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
+            return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
+        case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
+            return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
+        default:
+            debug_printf("r300: Unknown texture wrap %d", wrap);
+            return 0;
+    }
+}
+
+static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip)
+{
+    uint32_t retval = 0;
+    switch (min) {
+        case PIPE_TEX_FILTER_NEAREST:
+            retval |= R300_TX_MIN_FILTER_NEAREST;
+            break;
+        case PIPE_TEX_FILTER_LINEAR:
+            retval |= R300_TX_MIN_FILTER_LINEAR;
+            break;
+        case PIPE_TEX_FILTER_ANISO:
+            retval |= R300_TX_MIN_FILTER_ANISO;
+            break;
+        default:
+            debug_printf("r300: Unknown texture filter %d\n", min);
+            break;
+    }
+    switch (mag) {
+        case PIPE_TEX_FILTER_NEAREST:
+            retval |= R300_TX_MAG_FILTER_NEAREST;
+            break;
+        case PIPE_TEX_FILTER_LINEAR:
+            retval |= R300_TX_MAG_FILTER_LINEAR;
+            break;
+        case PIPE_TEX_FILTER_ANISO:
+            retval |= R300_TX_MAG_FILTER_ANISO;
+            break;
+        default:
+            debug_printf("r300: Unknown texture filter %d\n", mag);
+            break;
+    }
+    switch (mip) {
+        case PIPE_TEX_MIPFILTER_NONE:
+            retval |= R300_TX_MIN_FILTER_MIP_NONE;
+            break;
+        case PIPE_TEX_MIPFILTER_NEAREST:
+            retval |= R300_TX_MIN_FILTER_MIP_NEAREST;
+            break;
+        case PIPE_TEX_MIPFILTER_LINEAR:
+            retval |= R300_TX_MIN_FILTER_MIP_LINEAR;
+            break;
+        default:
+            debug_printf("r300: Unknown texture filter %d\n", mip);
+            break;
+    }
+
+    return retval;
+}
+
+static INLINE uint32_t r300_anisotropy(float max_aniso)
+{
+    if (max_aniso >= 16.0f) {
+        return R300_TX_MAX_ANISO_16_TO_1;
+    } else if (max_aniso >= 8.0f) {
+        return R300_TX_MAX_ANISO_8_TO_1;
+    } else if (max_aniso >= 4.0f) {
+        return R300_TX_MAX_ANISO_4_TO_1;
+    } else if (max_aniso >= 2.0f) {
+        return R300_TX_MAX_ANISO_2_TO_1;
+    } else {
+        return R300_TX_MAX_ANISO_1_TO_1;
+    }
+}
+
+/* Buffer formats. */
+
+static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
+{
+    switch (format) {
+        /* 8-bit buffers */
+        case PIPE_FORMAT_I8_UNORM:
+            return R300_COLOR_FORMAT_I8;
+        /* 16-bit buffers */
+        case PIPE_FORMAT_R5G6B5_UNORM:
+            return R300_COLOR_FORMAT_RGB565;
+        case PIPE_FORMAT_A1R5G5B5_UNORM:
+            return R300_COLOR_FORMAT_ARGB1555;
+        case PIPE_FORMAT_A4R4G4B4_UNORM:
+            return R300_COLOR_FORMAT_ARGB4444;
+        /* 32-bit buffers */
+        case PIPE_FORMAT_A8R8G8B8_UNORM:
+            return R300_COLOR_FORMAT_ARGB8888;
+        /* XXX Not in pipe_format
+        case PIPE_FORMAT_A32R32G32B32:
+            return R300_COLOR_FORMAT_ARGB32323232;
+        case PIPE_FORMAT_A16R16G16B16:
+            return R300_COLOR_FORMAT_ARGB16161616; */
+        /* XXX Not in pipe_format
+        case PIPE_FORMAT_A10R10G10B10_UNORM:
+            return R500_COLOR_FORMAT_ARGB10101010;
+        case PIPE_FORMAT_A2R10G10B10_UNORM:
+            return R500_COLOR_FORMAT_ARGB2101010;
+        case PIPE_FORMAT_I10_UNORM:
+            return R500_COLOR_FORMAT_I10; */
+        default:
+            debug_printf("r300: Implementation error: " \
+                "Got unsupported color format %s in %s\n",
+                pf_name(format), __FUNCTION__);
+            break;
+    }
+    return 0;
+}
+
+static INLINE uint32_t r300_translate_zsformat(enum pipe_format format)
+{
+    switch (format) {
+        /* 16-bit depth, no stencil */
+        case PIPE_FORMAT_Z16_UNORM:
+            return R300_DEPTHFORMAT_16BIT_INT_Z;
+        /* 24-bit depth, 8-bit stencil */
+        case PIPE_FORMAT_Z24S8_UNORM:
+            return R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL;
+        default:
+            debug_printf("r300: Implementation error: " \
+                "Got unsupported ZS format %s in %s\n",
+                pf_name(format), __FUNCTION__);
+            break;
+    }
+    return 0;
+}
+
+/* Non-CSO state. (For now.) */
+
+static INLINE uint32_t r300_translate_gb_pipes(int pipe_count)
+{
+    switch (pipe_count) {
+        case 1:
+            return R300_GB_TILE_PIPE_COUNT_RV300;
+            break;
+        case 2:
+            return R300_GB_TILE_PIPE_COUNT_R300;
+            break;
+        case 3:
+            return R300_GB_TILE_PIPE_COUNT_R420_3P;
+            break;
+        case 4:
+            return R300_GB_TILE_PIPE_COUNT_R420;
+            break;
+    }
+    return 0;
+}
+
+static INLINE uint32_t translate_vertex_data_type(int type) {
+    switch (type) {
+        case EMIT_1F:
+        case EMIT_1F_PSIZE:
+            return R300_DATA_TYPE_FLOAT_1;
+            break;
+        case EMIT_2F:
+            return R300_DATA_TYPE_FLOAT_2;
+            break;
+        case EMIT_3F:
+            return R300_DATA_TYPE_FLOAT_3;
+            break;
+        case EMIT_4F:
+            return R300_DATA_TYPE_FLOAT_4;
+            break;
+        case EMIT_4UB:
+            return R300_DATA_TYPE_BYTE;
+            break;
+        default:
+            debug_printf("r300: Implementation error: "
+                    "Bad vertex data type!\n");
+            assert(0);
+            break;
+    }
+
+    return 0;
+}
+
+#endif /* R300_STATE_INLINES_H */
diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c
new file mode 100644 (file)
index 0000000..3d51a8e
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2009 Joakim Sindholt <opensource@zhasha.com>
+ *                Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "r300_state_invariant.h"
+
+/* Calculate and emit invariant state. This is data that the 3D engine
+ * will probably want at the beginning of every CS, but it's not currently
+ * handled by any CSO setup, and in addition it doesn't really change much.
+ *
+ * Note that eventually this should be empty, but it's useful for development
+ * and general unduplication of code. */
+void r300_emit_invariant_state(struct r300_context* r300)
+{
+    struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
+    CS_LOCALS(r300);
+
+    BEGIN_CS(24 + (caps->has_tcl ? 2: 0));
+
+    /* Various GB enables */
+    OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE |
+        R300_GB_LINE_STUFF_ENABLE | R300_GB_TRIANGLE_STUFF_ENABLE);
+    /* Subpixel multisampling for AA */
+    OUT_CS_REG(R300_GB_MSPOS0, 0x66666666);
+    OUT_CS_REG(R300_GB_MSPOS1, 0x66666666);
+    /* GB tile config and pipe setup */
+    OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_DISABLE |
+        r300_translate_gb_pipes(caps->num_frag_pipes));
+    /* Source of fog depth */
+    OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W);
+    /* AA enable */
+    OUT_CS_REG(R300_GB_AA_CONFIG, 0x0);
+    /* GA errata fixes. */
+    if (caps->is_r500) {
+        OUT_CS_REG(R300_GA_ENHANCE,
+                R300_GA_ENHANCE_DEADLOCK_CNTL_PREVENT_TCL |
+                R300_GA_ENHANCE_FASTSYNC_CNTL_ENABLE |
+                R500_GA_ENHANCE_REG_READWRITE_ENABLE |
+                R500_GA_ENHANCE_REG_NOSTALL_ENABLE);
+    } else {
+        OUT_CS_REG(R300_GA_ENHANCE,
+                R300_GA_ENHANCE_DEADLOCK_CNTL_PREVENT_TCL |
+                R300_GA_ENHANCE_FASTSYNC_CNTL_ENABLE);
+    }
+
+    /* Fog block. */
+    OUT_CS_REG(R300_FG_FOG_BLEND, 0x00000000);
+    OUT_CS_REG(R300_FG_FOG_COLOR_R, 0x00000000);
+    OUT_CS_REG(R300_FG_FOG_COLOR_G, 0x00000000);
+    OUT_CS_REG(R300_FG_FOG_COLOR_B, 0x00000000);
+    OUT_CS_REG(R300_FG_DEPTH_SRC, 0x00000000);
+
+    /* TCL-only stuff */
+    if (caps->has_tcl) {
+        /* Amount of time to wait for vertex fetches in PVS */
+        OUT_CS_REG(VAP_PVS_VTX_TIMEOUT_REG, 0xffff);
+    }
+
+    END_CS;
+
+    /* XXX unsorted stuff from surface_fill */
+    BEGIN_CS(99 + (caps->has_tcl ? 26 : 0));
+    /* Flush PVS. */
+    OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
+
+    OUT_CS_REG(R300_SE_VTE_CNTL, R300_VPORT_X_SCALE_ENA |
+        R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA |
+        R300_VPORT_Y_OFFSET_ENA | R300_VPORT_Z_SCALE_ENA |
+        R300_VPORT_Z_OFFSET_ENA | R300_VTX_W0_FMT);
+    /* Max and min vertex index clamp. */
+    OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, 0xFFFFFF);
+    OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, 0x0);
+    /* XXX endian */
+    if (caps->has_tcl) {
+        OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP);
+        OUT_CS_REG(R300_VAP_CLIP_CNTL, R300_CLIP_DISABLE |
+            R300_PS_UCP_MODE_CLIP_AS_TRIFAN);
+        OUT_CS_REG_SEQ(R300_VAP_GB_VERT_CLIP_ADJ, 4);
+        OUT_CS_32F(1.0);
+        OUT_CS_32F(1.0);
+        OUT_CS_32F(1.0);
+        OUT_CS_32F(1.0);
+    } else {
+        OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP |
+                R300_VAP_TCL_BYPASS);
+    }
+    /* XXX magic number not in r300_reg */
+    OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0xAAAAAAAA);
+    /* XXX point tex stuffing */
+    OUT_CS_REG_SEQ(R300_GA_POINT_S0, 1);
+    OUT_CS_32F(0.0);
+    OUT_CS_REG_SEQ(R300_GA_POINT_S1, 1);
+    OUT_CS_32F(1.0);
+    OUT_CS_REG(R300_GA_TRIANGLE_STIPPLE, 0x5 |
+        (0x5 << R300_GA_TRIANGLE_STIPPLE_Y_SHIFT_SHIFT));
+    /* XXX this big chunk should be refactored into rs_state */
+    OUT_CS_REG(R300_GA_LINE_S0, 0x00000000);
+    OUT_CS_REG(R300_GA_LINE_S1, 0x3F800000);
+    OUT_CS_REG(R300_GA_SOLID_RG, 0x00000000);
+    OUT_CS_REG(R300_GA_SOLID_BA, 0x00000000);
+    OUT_CS_REG(R300_GA_POLY_MODE, 0x00000000);
+    OUT_CS_REG(R300_GA_ROUND_MODE, 0x00000001);
+    OUT_CS_REG(R300_GA_OFFSET, 0x00000000);
+    OUT_CS_REG(R300_GA_FOG_SCALE, 0x3DBF1412);
+    OUT_CS_REG(R300_GA_FOG_OFFSET, 0x00000000);
+    OUT_CS_REG(R300_SU_TEX_WRAP, 0x00000000);
+    OUT_CS_REG(R300_SU_DEPTH_SCALE, 0x4B7FFFFF);
+    OUT_CS_REG(R300_SU_DEPTH_OFFSET, 0x00000000);
+    OUT_CS_REG(R300_SC_HYPERZ, 0x0000001C);
+    OUT_CS_REG(R300_SC_EDGERULE, 0x2DA49525);
+    OUT_CS_REG(R300_RB3D_CCTL, 0x00000000);
+    OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0x0000000F);
+    OUT_CS_REG(R300_RB3D_AARESOLVE_CTL, 0x00000000);
+    OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 0x00000000);
+    OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD, 0xFFFFFFFF);
+    OUT_CS_REG(R300_ZB_FORMAT, 0x00000002);
+    OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT, 0x00000003);
+    OUT_CS_REG(R300_ZB_BW_CNTL, 0x00000000);
+    OUT_CS_REG(R300_ZB_DEPTHCLEARVALUE, 0x00000000);
+    OUT_CS_REG(R300_ZB_HIZ_OFFSET, 0x00000000);
+    OUT_CS_REG(R300_ZB_HIZ_PITCH, 0x00000000);
+    if (caps->has_tcl) {
+        OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
+            (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
+            ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) |
+                R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
+    } else {
+        OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
+            (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
+            ((R300_LAST_VEC | (2 << R300_DST_VEC_LOC_SHIFT) |
+                R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
+    }
+    OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0,
+            (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE0_SHIFT) |
+            (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE1_SHIFT));
+    OUT_CS_REG(R300_VAP_VTX_STATE_CNTL, 0x1);
+    OUT_CS_REG(R300_VAP_VSM_VTX_ASSM, 0x405);
+    OUT_CS_REG(R300_SE_VTE_CNTL, 0x0000043F);
+    /* Vertex size. */
+    OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
+    OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0xAAAAAAAA);
+    OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0, 0x00000003);
+    OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x00000000);
+    OUT_CS_REG(R300_TX_ENABLE, 0x0);
+
+    /* XXX */
+    OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa);
+
+    OUT_CS_REG_SEQ(R300_US_OUT_FMT_0, 4);
+    OUT_CS(R300_C0_SEL_B | R300_C1_SEL_G | R300_C2_SEL_R | R300_C3_SEL_A);
+    OUT_CS(R300_US_OUT_FMT_UNUSED);
+    OUT_CS(R300_US_OUT_FMT_UNUSED);
+    OUT_CS(R300_US_OUT_FMT_UNUSED);
+    OUT_CS_REG(R300_US_W_FMT, R300_W_FMT_W0);
+    /* XXX these magic numbers should be explained when
+     * this becomes a cached state object */
+    if (caps->has_tcl) {
+        OUT_CS_REG(R300_VAP_CNTL, 0xA |
+            (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) |
+            (0xB << R300_VF_MAX_VTX_NUM_SHIFT) |
+            (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT));
+        OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, 0x00100000);
+        OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x00000000);
+        OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, 0x00000001);
+        /* XXX translate these back into normal instructions */
+        OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x1);
+        OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0x0);
+        OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, 8);
+        OUT_CS(0x00F00203);
+        OUT_CS(0x00D10001);
+        OUT_CS(0x01248001);
+        OUT_CS(0x00000000);
+        OUT_CS(0x00F02203);
+        OUT_CS(0x00D10021);
+        OUT_CS(0x01248021);
+        OUT_CS(0x00000000);
+    } else {
+        OUT_CS_REG(R300_VAP_CNTL, 0xA |
+            (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) |
+            (0x5 << R300_VF_MAX_VTX_NUM_SHIFT) |
+            (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT));
+    }
+    END_CS;
+}
diff --git a/src/gallium/drivers/r300/r300_state_invariant.h b/src/gallium/drivers/r300/r300_state_invariant.h
new file mode 100644 (file)
index 0000000..8204bf9
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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_INVARIANT_H
+#define R300_STATE_INVARIANT_H
+
+#include "r300_context.h"
+#include "r300_cs.h"
+#include "r300_reg.h"
+#include "r300_state_inlines.h"
+
+void r300_emit_invariant_state(struct r300_context* r300);
+
+#endif /* R300_STATE_INVARIANT_H */
index e87172128faa2e36c28a5e4e0bb7f566447e2bea..20b83bd15b15f9a19a2929e1c4e4b085b0295a11 100644 (file)
 
 #include "r300_state_shader.h"
 
-void r300_translate_shader(struct r300_context* r300,
-                           struct r300_fragment_shader* fs)
+static void r300_copy_passthrough_shader(struct r300_fragment_shader* fs)
 {
+    struct r300_fragment_shader* pt = &r300_passthrough_fragment_shader;
+    fs->shader.stack_size = pt->shader.stack_size;
+    fs->alu_instruction_count = pt->alu_instruction_count;
+    fs->tex_instruction_count = pt->tex_instruction_count;
+    fs->indirections = pt->indirections;
+    fs->instructions[0] = pt->instructions[0];
 }
 
-void r500_translate_shader(struct r300_context* r300,
-                           struct r500_fragment_shader* fs)
+static void r500_copy_passthrough_shader(struct r500_fragment_shader* fs)
 {
+    struct r500_fragment_shader* pt = &r500_passthrough_fragment_shader;
+    fs->shader.stack_size = pt->shader.stack_size;
+    fs->instruction_count = pt->instruction_count;
+    fs->instructions[0] = pt->instructions[0];
+}
+
+static void r300_fs_declare(struct r300_fs_asm* assembler,
+                            struct tgsi_full_declaration* decl)
+{
+    switch (decl->Declaration.File) {
+        case TGSI_FILE_INPUT:
+            switch (decl->Semantic.SemanticName) {
+                case TGSI_SEMANTIC_COLOR:
+                    assembler->color_count++;
+                    break;
+                case TGSI_SEMANTIC_GENERIC:
+                    assembler->tex_count++;
+                    break;
+                default:
+                    debug_printf("r300: fs: Bad semantic declaration %d\n",
+                        decl->Semantic.SemanticName);
+                    break;
+            }
+            break;
+        case TGSI_FILE_OUTPUT:
+        case TGSI_FILE_CONSTANT:
+            break;
+        case TGSI_FILE_TEMPORARY:
+            assembler->temp_count++;
+            break;
+        default:
+            debug_printf("r300: fs: Bad file %d\n", decl->Declaration.File);
+            break;
+    }
+
+    assembler->temp_offset = assembler->color_count + assembler->tex_count;
+}
+
+static INLINE unsigned r300_fs_src(struct r300_fs_asm* assembler,
+                                   struct tgsi_src_register* src)
+{
+    switch (src->File) {
+        case TGSI_FILE_NULL:
+            return 0;
+        case TGSI_FILE_INPUT:
+            /* XXX may be wrong */
+            return src->Index;
+            break;
+        case TGSI_FILE_TEMPORARY:
+            return src->Index + assembler->temp_offset;
+            break;
+        case TGSI_FILE_IMMEDIATE:
+            return (src->Index + assembler->imm_offset) | (1 << 8);
+            break;
+        case TGSI_FILE_CONSTANT:
+            /* XXX magic */
+            return src->Index | (1 << 8);
+            break;
+        default:
+            debug_printf("r300: fs: Unimplemented src %d\n", src->File);
+            break;
+    }
+    return 0;
+}
+
+static INLINE unsigned r300_fs_dst(struct r300_fs_asm* assembler,
+                                   struct tgsi_dst_register* dst)
+{
+    switch (dst->File) {
+        case TGSI_FILE_NULL:
+            /* This happens during KIL instructions. */
+            return 0;
+            break;
+        case TGSI_FILE_OUTPUT:
+            return 0;
+            break;
+        case TGSI_FILE_TEMPORARY:
+            return dst->Index + assembler->temp_offset;
+            break;
+        default:
+            debug_printf("r300: fs: Unimplemented dst %d\n", dst->File);
+            break;
+    }
+    return 0;
+}
+
+static INLINE unsigned r500_fix_swiz(unsigned s)
+{
+    /* For historical reasons, the swizzle values x, y, z, w, and 0 are
+     * equivalent to the actual machine code, but 1 is not. Thus, we just
+     * adjust it a bit... */
+    if (s == TGSI_EXTSWIZZLE_ONE) {
+        return R500_SWIZZLE_ONE;
+    } else {
+        return s;
+    }
+}
+
+static uint32_t r500_rgba_swiz(struct tgsi_full_src_register* reg)
+{
+    if (reg->SrcRegister.Extended) {
+        return r500_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleX) |
+            (r500_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleY) << 3) |
+            (r500_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleZ) << 6) |
+            (r500_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleW) << 9);
+    } else {
+        return reg->SrcRegister.SwizzleX |
+            (reg->SrcRegister.SwizzleY << 3) |
+            (reg->SrcRegister.SwizzleZ << 6) |
+            (reg->SrcRegister.SwizzleW << 9);
+    }
+}
+
+static uint32_t r500_strq_swiz(struct tgsi_full_src_register* reg)
+{
+    return reg->SrcRegister.SwizzleX |
+        (reg->SrcRegister.SwizzleY << 2) |
+        (reg->SrcRegister.SwizzleZ << 4) |
+        (reg->SrcRegister.SwizzleW << 6);
+}
+
+static INLINE uint32_t r500_rgb_swiz(struct tgsi_full_src_register* reg)
+{
+    /* Only the first 9 bits... */
+    return (r500_rgba_swiz(reg) & 0x1ff) |
+        (reg->SrcRegister.Negate ? (1 << 9) : 0) |
+        (reg->SrcRegisterExtMod.Absolute ? (1 << 10) : 0);
+}
+
+static INLINE uint32_t r500_alpha_swiz(struct tgsi_full_src_register* reg)
+{
+    /* Only the last 3 bits... */
+    return (r500_rgba_swiz(reg) >> 9) |
+        (reg->SrcRegister.Negate ? (1 << 9) : 0) |
+        (reg->SrcRegisterExtMod.Absolute ? (1 << 10) : 0);
+}
+
+static INLINE uint32_t r500_rgba_op(unsigned op)
+{
+    switch (op) {
+        case TGSI_OPCODE_EX2:
+        case TGSI_OPCODE_LG2:
+        case TGSI_OPCODE_RCP:
+        case TGSI_OPCODE_RSQ:
+            return R500_ALU_RGBA_OP_SOP;
+        case TGSI_OPCODE_FRC:
+            return R500_ALU_RGBA_OP_FRC;
+        case TGSI_OPCODE_DP3:
+            return R500_ALU_RGBA_OP_DP3;
+        case TGSI_OPCODE_DP4:
+        case TGSI_OPCODE_DPH:
+            return R500_ALU_RGBA_OP_DP4;
+        case TGSI_OPCODE_ABS:
+        case TGSI_OPCODE_CMP:
+        case TGSI_OPCODE_MOV:
+        case TGSI_OPCODE_SWZ:
+            return R500_ALU_RGBA_OP_CMP;
+        case TGSI_OPCODE_ADD:
+        case TGSI_OPCODE_MAD:
+        case TGSI_OPCODE_MUL:
+        case TGSI_OPCODE_SUB:
+            return R500_ALU_RGBA_OP_MAD;
+        default:
+            return 0;
+    }
+}
+
+static INLINE uint32_t r500_alpha_op(unsigned op)
+{
+    switch (op) {
+        case TGSI_OPCODE_EX2:
+            return R500_ALPHA_OP_EX2;
+        case TGSI_OPCODE_LG2:
+            return R500_ALPHA_OP_LN2;
+        case TGSI_OPCODE_RCP:
+            return R500_ALPHA_OP_RCP;
+        case TGSI_OPCODE_RSQ:
+            return R500_ALPHA_OP_RSQ;
+        case TGSI_OPCODE_FRC:
+            return R500_ALPHA_OP_FRC;
+        case TGSI_OPCODE_DP3:
+        case TGSI_OPCODE_DP4:
+        case TGSI_OPCODE_DPH:
+            return R500_ALPHA_OP_DP;
+        case TGSI_OPCODE_ABS:
+        case TGSI_OPCODE_CMP:
+        case TGSI_OPCODE_MOV:
+        case TGSI_OPCODE_SWZ:
+            return R500_ALPHA_OP_CMP;
+        case TGSI_OPCODE_ADD:
+        case TGSI_OPCODE_MAD:
+        case TGSI_OPCODE_MUL:
+        case TGSI_OPCODE_SUB:
+            return R500_ALPHA_OP_MAD;
+        default:
+            return 0;
+    }
+}
+
+static INLINE uint32_t r500_tex_op(unsigned op)
+{
+    switch (op) {
+        case TGSI_OPCODE_KIL:
+            return R500_TEX_INST_TEXKILL;
+        case TGSI_OPCODE_TEX:
+            return R500_TEX_INST_LD;
+        case TGSI_OPCODE_TXB:
+            return R500_TEX_INST_LODBIAS;
+        case TGSI_OPCODE_TXP:
+            return R500_TEX_INST_PROJ;
+        default:
+            return 0;
+    }
+}
+
+/* Setup an ALU operation. */
+static INLINE void r500_emit_alu(struct r500_fragment_shader* fs,
+                                 struct r300_fs_asm* assembler,
+                                 struct tgsi_full_dst_register* dst)
+{
+    int i = fs->instruction_count;
+
+    if (dst->DstRegister.File == TGSI_FILE_OUTPUT) {
+        fs->instructions[i].inst0 = R500_INST_TYPE_OUT |
+        R500_ALU_OMASK(dst->DstRegister.WriteMask);
+    } else {
+        fs->instructions[i].inst0 = R500_INST_TYPE_ALU |
+        R500_ALU_WMASK(dst->DstRegister.WriteMask);
+    }
+
+    fs->instructions[i].inst0 |= R500_INST_TEX_SEM_WAIT;
+
+    fs->instructions[i].inst4 =
+        R500_ALPHA_ADDRD(r300_fs_dst(assembler, &dst->DstRegister));
+    fs->instructions[i].inst5 =
+        R500_ALU_RGBA_ADDRD(r300_fs_dst(assembler, &dst->DstRegister));
+}
+
+static INLINE void r500_emit_maths(struct r500_fragment_shader* fs,
+                                   struct r300_fs_asm* assembler,
+                                   struct tgsi_full_src_register* src,
+                                   struct tgsi_full_dst_register* dst,
+                                   unsigned op,
+                                   unsigned count)
+{
+    int i = fs->instruction_count;
+
+    r500_emit_alu(fs, assembler, dst);
+
+    switch (count) {
+        case 3:
+            fs->instructions[i].inst1 =
+                R500_RGB_ADDR2(r300_fs_src(assembler, &src[2].SrcRegister));
+            fs->instructions[i].inst2 =
+                R500_ALPHA_ADDR2(r300_fs_src(assembler, &src[2].SrcRegister));
+            fs->instructions[i].inst5 |=
+                R500_ALU_RGBA_SEL_C_SRC2 |
+                R500_SWIZ_RGBA_C(r500_rgb_swiz(&src[2])) |
+                R500_ALU_RGBA_ALPHA_SEL_C_SRC2 |
+                R500_SWIZ_ALPHA_C(r500_alpha_swiz(&src[2]));
+        case 2:
+            fs->instructions[i].inst1 |=
+                R500_RGB_ADDR1(r300_fs_src(assembler, &src[1].SrcRegister));
+            fs->instructions[i].inst2 |=
+                R500_ALPHA_ADDR1(r300_fs_src(assembler, &src[1].SrcRegister));
+            fs->instructions[i].inst3 =
+                R500_ALU_RGB_SEL_B_SRC1 |
+                R500_SWIZ_RGB_B(r500_rgb_swiz(&src[1]));
+            fs->instructions[i].inst4 |=
+                R500_SWIZ_ALPHA_B(r500_alpha_swiz(&src[1])) |
+                R500_ALPHA_SEL_B_SRC1;
+        case 1:
+        case 0:
+        default:
+            fs->instructions[i].inst1 |=
+                R500_RGB_ADDR0(r300_fs_src(assembler, &src[0].SrcRegister));
+            fs->instructions[i].inst2 |=
+                R500_ALPHA_ADDR0(r300_fs_src(assembler, &src[0].SrcRegister));
+            fs->instructions[i].inst3 |=
+                R500_ALU_RGB_SEL_A_SRC0 |
+                R500_SWIZ_RGB_A(r500_rgb_swiz(&src[0]));
+            fs->instructions[i].inst4 |=
+                R500_SWIZ_ALPHA_A(r500_alpha_swiz(&src[0])) |
+                R500_ALPHA_SEL_A_SRC0;
+            break;
+    }
+
+    fs->instructions[i].inst4 |= r500_alpha_op(op);
+    fs->instructions[i].inst5 |= r500_rgba_op(op);
+
+    fs->instruction_count++;
+}
+
+static INLINE void r500_emit_tex(struct r500_fragment_shader* fs,
+                                 struct r300_fs_asm* assembler,
+                                 struct tgsi_full_src_register* src,
+                                 struct tgsi_full_dst_register* dst,
+                                 uint32_t op)
+{
+    int i = fs->instruction_count;
+
+    fs->instructions[i].inst0 = R500_INST_TYPE_TEX |
+        R500_TEX_WMASK(dst->DstRegister.WriteMask) |
+        R500_INST_TEX_SEM_WAIT;
+    fs->instructions[i].inst1 = R500_TEX_ID(0) |
+        R500_TEX_SEM_ACQUIRE | //R500_TEX_IGNORE_UNCOVERED |
+        r500_tex_op(op);
+    fs->instructions[i].inst2 =
+        R500_TEX_SRC_ADDR(r300_fs_src(assembler, &src->SrcRegister)) |
+        R500_SWIZ_TEX_STRQ(r500_strq_swiz(src)) |
+        R500_TEX_DST_ADDR(r300_fs_dst(assembler, &dst->DstRegister)) |
+        R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G |
+        R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A;
+
+    if (dst->DstRegister.File == TGSI_FILE_OUTPUT) {
+        fs->instructions[i].inst2 |=
+            R500_TEX_DST_ADDR(assembler->temp_count +
+                    assembler->temp_offset);
+
+        fs->instruction_count++;
+
+        /* Setup and emit a MOV. */
+        src[0].SrcRegister.Index = assembler->temp_count;
+        src[0].SrcRegister.File = TGSI_FILE_TEMPORARY;
+
+        src[1] = src[0];
+        src[2] = r500_constant_zero;
+        r500_emit_maths(fs, assembler, src, dst, TGSI_OPCODE_MOV, 3);
+    } else {
+        fs->instruction_count++;
+    }
+}
+
+static void r500_fs_instruction(struct r500_fragment_shader* fs,
+                                struct r300_fs_asm* assembler,
+                                struct tgsi_full_instruction* inst)
+{
+    int i;
+    /* Switch between opcodes. When possible, prefer using the official
+     * AMD/ATI names for opcodes, please, as it facilitates using the
+     * documentation. */
+    switch (inst->Instruction.Opcode) {
+        /* The simple scalar ops. */
+        case TGSI_OPCODE_EX2:
+        case TGSI_OPCODE_LG2:
+        case TGSI_OPCODE_RCP:
+        case TGSI_OPCODE_RSQ:
+            /* Copy red swizzle to alpha for src0 */
+            inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleW =
+                inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleX;
+            inst->FullSrcRegisters[0].SrcRegister.SwizzleW =
+                inst->FullSrcRegisters[0].SrcRegister.SwizzleX;
+            /* Fall through */
+        case TGSI_OPCODE_FRC:
+            r500_emit_maths(fs, assembler, inst->FullSrcRegisters,
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode, 1);
+            break;
+
+        /* The dot products. */
+        case TGSI_OPCODE_DPH:
+            /* Set alpha swizzle to one for src0 */
+            if (!inst->FullSrcRegisters[0].SrcRegister.Extended) {
+                inst->FullSrcRegisters[0].SrcRegister.Extended = TRUE;
+                inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleX =
+                    inst->FullSrcRegisters[0].SrcRegister.SwizzleX;
+                inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleY =
+                    inst->FullSrcRegisters[0].SrcRegister.SwizzleY;
+                inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleZ =
+                    inst->FullSrcRegisters[0].SrcRegister.SwizzleZ;
+            }
+            inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleW =
+                TGSI_EXTSWIZZLE_ONE;
+            /* Fall through */
+        case TGSI_OPCODE_DP3:
+        case TGSI_OPCODE_DP4:
+            r500_emit_maths(fs, assembler, inst->FullSrcRegisters,
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode, 2);
+            break;
+
+        /* Simple three-source operations. */
+        case TGSI_OPCODE_CMP:
+            /* Swap src0 and src2 */
+            inst->FullSrcRegisters[3] = inst->FullSrcRegisters[2];
+            inst->FullSrcRegisters[2] = inst->FullSrcRegisters[0];
+            inst->FullSrcRegisters[0] = inst->FullSrcRegisters[3];
+            r500_emit_maths(fs, assembler, inst->FullSrcRegisters,
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3);
+            break;
+
+        /* The MAD variants. */
+        case TGSI_OPCODE_SUB:
+            /* Just like ADD, but flip the negation on src1 first */
+            inst->FullSrcRegisters[1].SrcRegister.Negate =
+                !inst->FullSrcRegisters[1].SrcRegister.Negate;
+            /* Fall through */
+        case TGSI_OPCODE_ADD:
+            /* Force src0 to one, move all registers over */
+            inst->FullSrcRegisters[2] = inst->FullSrcRegisters[1];
+            inst->FullSrcRegisters[1] = inst->FullSrcRegisters[0];
+            inst->FullSrcRegisters[0] = r500_constant_one;
+            r500_emit_maths(fs, assembler, inst->FullSrcRegisters,
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3);
+            break;
+        case TGSI_OPCODE_MUL:
+            /* Force our src2 to zero */
+            inst->FullSrcRegisters[2] = r500_constant_zero;
+            r500_emit_maths(fs, assembler, inst->FullSrcRegisters,
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3);
+            break;
+        case TGSI_OPCODE_MAD:
+            r500_emit_maths(fs, assembler, inst->FullSrcRegisters,
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3);
+            break;
+
+        /* The MOV variants. */
+        case TGSI_OPCODE_ABS:
+            /* Set absolute value modifiers. */
+            inst->FullSrcRegisters[0].SrcRegisterExtMod.Absolute = TRUE;
+            /* Fall through */
+        case TGSI_OPCODE_MOV:
+        case TGSI_OPCODE_SWZ:
+            /* src0 -> src1 and src2 forced to zero */
+            inst->FullSrcRegisters[1] = inst->FullSrcRegisters[0];
+            inst->FullSrcRegisters[2] = r500_constant_zero;
+            r500_emit_maths(fs, assembler, inst->FullSrcRegisters,
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3);
+            break;
+
+        /* The texture instruction set. */
+        case TGSI_OPCODE_KIL:
+        case TGSI_OPCODE_TEX:
+        case TGSI_OPCODE_TXB:
+        case TGSI_OPCODE_TXP:
+            r500_emit_tex(fs, assembler, &inst->FullSrcRegisters[0],
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode);
+            break;
+
+        /* This is the end. My only friend, the end. */
+        case TGSI_OPCODE_END:
+            break;
+        default:
+            debug_printf("r300: fs: Bad opcode %d\n",
+                    inst->Instruction.Opcode);
+            break;
+    }
+
+    /* Clamp, if saturation flags are set. */
+    if (inst->Instruction.Saturate == TGSI_SAT_ZERO_ONE) {
+        fs->instructions[fs->instruction_count - 1].inst0 |=
+            R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP;
+    }
+}
+
+static void r500_fs_finalize(struct r500_fragment_shader* fs,
+                             struct r300_fs_asm* assembler)
+{
+    fs->shader.stack_size = assembler->temp_count + assembler->temp_offset;
+
+    /* XXX should this just go with OPCODE_END? */
+    fs->instructions[fs->instruction_count - 1].inst0 |=
+        R500_INST_LAST;
+}
+
+void r300_translate_fragment_shader(struct r300_context* r300,
+                                    struct r300_fragment_shader* fs)
+{
+    struct tgsi_parse_context parser;
+
+    tgsi_parse_init(&parser, fs->shader.state.tokens);
+
+    while (!tgsi_parse_end_of_tokens(&parser)) {
+        tgsi_parse_token(&parser);
+    }
+
+    r300_copy_passthrough_shader(fs);
+}
+
+void r500_translate_fragment_shader(struct r300_context* r300,
+                                    struct r500_fragment_shader* fs)
+{
+    struct tgsi_parse_context parser;
+    int i;
+    struct r300_constant_buffer* consts =
+        &r300->shader_constants[PIPE_SHADER_FRAGMENT];
+
+    struct r300_fs_asm* assembler = CALLOC_STRUCT(r300_fs_asm);
+    if (assembler == NULL) {
+        return;
+    }
+    /* Setup starting offset for immediates. */
+    assembler->imm_offset = consts->user_count;
+
+    tgsi_parse_init(&parser, fs->shader.state.tokens);
+
+    while (!tgsi_parse_end_of_tokens(&parser)) {
+        tgsi_parse_token(&parser);
+
+        /* This is seriously the lamest way to create fragment programs ever.
+         * I blame TGSI. */
+        switch (parser.FullToken.Token.Type) {
+            case TGSI_TOKEN_TYPE_DECLARATION:
+                /* Allocated registers sitting at the beginning
+                 * of the program. */
+                r300_fs_declare(assembler, &parser.FullToken.FullDeclaration);
+                break;
+            case TGSI_TOKEN_TYPE_IMMEDIATE:
+                debug_printf("r300: Emitting immediate to constant buffer, "
+                        "position %d\n",
+                        assembler->imm_offset + assembler->imm_count);
+                /* I am not amused by the length of these. */
+                for (i = 0; i < 4; i++) {
+                    consts->constants[assembler->imm_offset +
+                        assembler->imm_count][i] =
+                        parser.FullToken.FullImmediate.u.ImmediateFloat32[i]
+                        .Float;
+                }
+                assembler->imm_count++;
+                break;
+            case TGSI_TOKEN_TYPE_INSTRUCTION:
+                r500_fs_instruction(fs, assembler,
+                        &parser.FullToken.FullInstruction);
+                break;
+        }
+
+    }
+
+    debug_printf("r300: %d texs and %d colors, first free reg is %d\n",
+            assembler->tex_count, assembler->color_count,
+            assembler->tex_count + assembler->color_count);
+
+    consts->count = consts->user_count + assembler->imm_count;
+    debug_printf("r300: %d total constants, "
+            "%d from user and %d from immediates\n", consts->count,
+            consts->user_count, assembler->imm_count);
+    r500_fs_finalize(fs, assembler);
+
+    tgsi_dump(fs->shader.state.tokens);
+    r500_fs_dump(fs);
+
+    tgsi_parse_free(&parser);
+    FREE(assembler);
 }
index a20bd4276c6f7f65bbf4906cd498ee71c199bc3f..06c0bb73789371d830ab32f4912fbaadf1359cbe 100644 (file)
 #ifndef R300_STATE_SHADER_H
 #define R300_STATE_SHADER_H
 
+#include "tgsi/tgsi_parse.h"
+
 #include "r300_context.h"
+#include "r300_debug.h"
+#include "r300_reg.h"
 #include "r300_screen.h"
 
-void r300_translate_shader(struct r300_context* r300,
+/* XXX this all should find its way back to r300_reg */
+/* Swizzle tools */
+#define R500_SWIZZLE_ZERO 4
+#define R500_SWIZZLE_HALF 5
+#define R500_SWIZZLE_ONE 6
+#define R500_SWIZ_RGB_ZERO ((4 << 0) | (4 << 3) | (4 << 6))
+#define R500_SWIZ_RGB_ONE ((6 << 0) | (6 << 3) | (6 << 6))
+#define R500_SWIZ_RGB_RGB ((0 << 0) | (1 << 3) | (2 << 6))
+#define R500_SWIZ_MOD_NEG 1
+#define R500_SWIZ_MOD_ABS 2
+#define R500_SWIZ_MOD_NEG_ABS 3
+/* Swizzles for inst2 */
+#define R500_SWIZ_TEX_STRQ(x) ((x) << 8)
+#define R500_SWIZ_TEX_RGBA(x) ((x) << 24)
+/* Swizzles for inst3 */
+#define R500_SWIZ_RGB_A(x) ((x) << 2)
+#define R500_SWIZ_RGB_B(x) ((x) << 15)
+/* Swizzles for inst4 */
+#define R500_SWIZ_ALPHA_A(x) ((x) << 14)
+#define R500_SWIZ_ALPHA_B(x) ((x) << 21)
+/* Swizzle for inst5 */
+#define R500_SWIZ_RGBA_C(x) ((x) << 14)
+#define R500_SWIZ_ALPHA_C(x) ((x) << 27)
+/* Writemasks */
+#define R500_TEX_WMASK(x) ((x) << 11)
+#define R500_ALU_WMASK(x) ((x) << 11)
+#define R500_ALU_OMASK(x) ((x) << 15)
+
+/* TGSI constants. TGSI is like XML: If it can't solve your problems, you're
+ * not using enough of it. */
+static const struct tgsi_full_src_register r500_constant_zero = {
+    .SrcRegister.Extended = TRUE,
+    .SrcRegister.File = TGSI_FILE_NULL,
+    .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ZERO,
+    .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ZERO,
+    .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ZERO,
+    .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ZERO,
+};
+
+static const struct tgsi_full_src_register r500_constant_one = {
+    .SrcRegister.Extended = TRUE,
+    .SrcRegister.File = TGSI_FILE_NULL,
+    .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ONE,
+    .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ONE,
+    .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ONE,
+    .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ONE,
+};
+
+/* Temporary struct used to hold assembly state while putting together
+ * fragment programs. */
+struct r300_fs_asm {
+    /* Pipe context. */
+    struct r300_context* r300;
+    /* Number of colors. */
+    unsigned color_count;
+    /* Number of texcoords. */
+    unsigned tex_count;
+    /* Offset for temporary registers. Inputs and temporaries have no
+     * distinguishing markings, so inputs start at 0 and the first usable
+     * temporary register is after all inputs. */
+    unsigned temp_offset;
+    /* Number of requested temporary registers. */
+    unsigned temp_count;
+    /* Offset for immediate constants. Neither R300 nor R500 can do four
+     * inline constants per source, so instead we copy immediates into the
+     * constant buffer. */
+    unsigned imm_offset;
+    /* Number of immediate constants. */
+    unsigned imm_count;
+};
+
+void r300_translate_fragment_shader(struct r300_context* r300,
                            struct r300_fragment_shader* fs);
 
-void r500_translate_shader(struct r300_context* r300,
+void r500_translate_fragment_shader(struct r300_context* r300,
                            struct r500_fragment_shader* fs);
 
+static const struct r300_fragment_shader r300_passthrough_fragment_shader = {
+    /* XXX This is the emission code. TODO: decode
+    OUT_CS_REG(R300_US_CONFIG, 0);
+    OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
+    OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0);
+    OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0);
+    OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0);
+    OUT_CS_REG(R300_US_CODE_ADDR_3, 0x400000);
+*/
+    .alu_instruction_count = 1,
+    .tex_instruction_count = 0,
+    .indirections = 1,
+    .shader.stack_size = 2,
+
+    .instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) |
+        R300_RGB_SWIZB(R300_ALU_ARGC_ONE) |
+        R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) |
+        R300_ALU_OUTC_MAD,
+    .instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) |
+        R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ,
+    .instructions[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) |
+        R300_ALPHA_SWIZB(R300_ALU_ARGA_ONE) |
+        R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) |
+        R300_ALU_OUTA_MAD,
+    .instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) |
+        R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT,
+};
+
+static const struct r500_fragment_shader r500_passthrough_fragment_shader = {
+    .shader.stack_size = 0,
+    .instruction_count = 1,
+    .instructions[0].inst0 = R500_INST_TYPE_OUT |
+        R500_INST_TEX_SEM_WAIT | R500_INST_LAST |
+        R500_INST_RGB_OMASK_RGB | R500_INST_ALPHA_OMASK |
+        R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP,
+    .instructions[0].inst1 =
+        R500_RGB_ADDR0(0) | R500_RGB_ADDR1(0) | R500_RGB_ADDR1_CONST |
+        R500_RGB_ADDR2(0) | R500_RGB_ADDR2_CONST,
+    .instructions[0].inst2 =
+        R500_ALPHA_ADDR0(0) | R500_ALPHA_ADDR1(0) | R500_ALPHA_ADDR1_CONST |
+        R500_ALPHA_ADDR2(0) | R500_ALPHA_ADDR2_CONST,
+    .instructions[0].inst3 =
+        R500_ALU_RGB_SEL_A_SRC0 | R500_ALU_RGB_R_SWIZ_A_R |
+        R500_ALU_RGB_G_SWIZ_A_G | R500_ALU_RGB_B_SWIZ_A_B |
+        R500_ALU_RGB_SEL_B_SRC0 | R500_ALU_RGB_R_SWIZ_B_R |
+        R500_ALU_RGB_B_SWIZ_B_G | R500_ALU_RGB_G_SWIZ_B_B,
+    .instructions[0].inst4 =
+        R500_ALPHA_OP_CMP | R500_ALPHA_SWIZ_A_A | R500_ALPHA_SWIZ_B_A,
+    .instructions[0].inst5 =
+        R500_ALU_RGBA_OP_CMP | R500_ALU_RGBA_R_SWIZ_0 |
+        R500_ALU_RGBA_G_SWIZ_0 | R500_ALU_RGBA_B_SWIZ_0 |
+        R500_ALU_RGBA_A_SWIZ_0,
+};
+
 #endif /* R300_STATE_SHADER_H */
index 1e1f96a7f96f131a80d6acdf9beec31846617968..2cc0677e52c83dd08c1ebce8f453d82e9429b746 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
+ *                Joakim Sindholt <opensource@zhasha.com>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -32,321 +33,161 @@ static void r300_surface_fill(struct pipe_context* pipe,
 {
     struct r300_context* r300 = r300_context(pipe);
     CS_LOCALS(r300);
-    struct r300_capabilities* caps = ((struct r300_screen*)pipe->screen)->caps;
+    struct r300_capabilities* caps = r300_screen(pipe->screen)->caps;
     struct r300_texture* tex = (struct r300_texture*)dest->texture;
     int i;
-    float r, g, b, a;
+    float r, g, b, a, depth;
+    unsigned pixpitch = tex->stride / tex->tex.block.size;
+
     r = (float)((color >> 16) & 0xff) / 255.0f;
     g = (float)((color >>  8) & 0xff) / 255.0f;
     b = (float)((color >>  0) & 0xff) / 255.0f;
     debug_printf("r300: Filling surface %p at (%d,%d),"
-        " dimensions %dx%d (stride %d), color 0x%x\n",
-        dest, x, y, w, h, dest->stride, color);
+        " dimensions %dx%d (pixel pitch %d), color 0x%x\n",
+        dest, x, y, w, h, pixpitch, color);
 
     /* Fallback? */
-    if (0) {
+    if (tex->tex.format != PIPE_FORMAT_A8R8G8B8_UNORM) {
         debug_printf("r300: Falling back on surface clear...");
-        void* map = pipe->screen->surface_map(pipe->screen, dest,
-            PIPE_BUFFER_USAGE_CPU_WRITE);
-        pipe_fill_rect(map, &dest->block, &dest->stride, x, y, w, h, color);
-        pipe->screen->surface_unmap(pipe->screen, dest);
+        util_surface_fill(pipe, dest, x, y, w, h, color);
         return;
     }
 
-BEGIN_CS((caps->is_r500) ? 309 : 280);
-R300_PACIFY;
-OUT_CS_REG(R300_TX_INVALTAGS, 0x0);
-R300_PACIFY;
-/* Flush PVS. */
-OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
-
-OUT_CS_REG(R300_SE_VTE_CNTL, R300_VPORT_X_SCALE_ENA |
-    R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA |
-    R300_VPORT_Y_OFFSET_ENA | R300_VPORT_Z_SCALE_ENA |
-    R300_VPORT_Z_OFFSET_ENA | R300_VTX_W0_FMT);
-/* Vertex size. */
-OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
-/* Max and min vertex index clamp. */
-OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, 0xFFFFFF);
-OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, 0x0);
-/* XXX endian */
-OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP);
-OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, 0x0);
-/* XXX magic number not in r300_reg */
-OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0xAAAAAAAA);
-OUT_CS_REG(R300_VAP_CLIP_CNTL, 0x0);
-OUT_CS_REG_SEQ(R300_VAP_GB_VERT_CLIP_ADJ, 4);
-OUT_CS_32F(1.0);
-OUT_CS_32F(1.0);
-OUT_CS_32F(1.0);
-OUT_CS_32F(1.0);
-/* XXX is this too long? */
-OUT_CS_REG(VAP_PVS_VTX_TIMEOUT_REG, 0xFFFF);
-OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE |
-    R300_GB_LINE_STUFF_ENABLE | R300_GB_TRIANGLE_STUFF_ENABLE);
-/* XXX more magic numbers */
-OUT_CS_REG(R300_GB_MSPOS0, 0x66666666);
-OUT_CS_REG(R300_GB_MSPOS1, 0x66666666);
-/* XXX why doesn't classic Mesa write the number of pipes, too? */
-OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_ENABLE | R300_GB_TILE_SIZE_16);
-OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W);
-OUT_CS_REG(R300_GB_AA_CONFIG, 0x0);
-/* XXX point tex stuffing */
-OUT_CS_REG_SEQ(R300_GA_POINT_S0, 1);
-OUT_CS_32F(0.0);
-OUT_CS_REG_SEQ(R300_GA_POINT_S1, 1);
-OUT_CS_32F(1.0);
-OUT_CS_REG(R300_GA_TRIANGLE_STIPPLE, 0x5 |
-    (0x5 << R300_GA_TRIANGLE_STIPPLE_Y_SHIFT_SHIFT));
-/* XXX should this be related to the actual point size? */
-OUT_CS_REG(R300_GA_POINT_MINMAX, 0x6 |
-    (0x1800 << R300_GA_POINT_MINMAX_MAX_SHIFT));
-/* XXX this big chunk should be refactored into rs_state */
-OUT_CS_REG(R300_GA_LINE_CNTL, 0x00030006);
-OUT_CS_REG(R300_GA_LINE_STIPPLE_CONFIG, 0x3BAAAAAB);
-OUT_CS_REG(R300_GA_LINE_STIPPLE_VALUE, 0x00000000);
-OUT_CS_REG(R300_GA_LINE_S0, 0x00000000);
-OUT_CS_REG(R300_GA_LINE_S1, 0x3F800000);
-OUT_CS_REG(R300_GA_ENHANCE, 0x00000002);
-OUT_CS_REG(R300_GA_COLOR_CONTROL, 0x0003AAAA);
-OUT_CS_REG(R300_GA_SOLID_RG, 0x00000000);
-OUT_CS_REG(R300_GA_SOLID_BA, 0x00000000);
-OUT_CS_REG(R300_GA_POLY_MODE, 0x00000000);
-OUT_CS_REG(R300_GA_ROUND_MODE, 0x00000001);
-OUT_CS_REG(R300_GA_OFFSET, 0x00000000);
-OUT_CS_REG(R300_GA_FOG_SCALE, 0x3DBF1412);
-OUT_CS_REG(R300_GA_FOG_OFFSET, 0x00000000);
-OUT_CS_REG(R300_SU_TEX_WRAP, 0x00000000);
-OUT_CS_REG(R300_SU_POLY_OFFSET_FRONT_SCALE, 0x00000000);
-OUT_CS_REG(R300_SU_POLY_OFFSET_FRONT_OFFSET, 0x00000000);
-OUT_CS_REG(R300_SU_POLY_OFFSET_BACK_SCALE, 0x00000000);
-OUT_CS_REG(R300_SU_POLY_OFFSET_BACK_OFFSET, 0x00000000);
-OUT_CS_REG(R300_SU_POLY_OFFSET_ENABLE, 0x00000000);
-OUT_CS_REG(R300_SU_CULL_MODE, 0x00000000);
-OUT_CS_REG(R300_SU_DEPTH_SCALE, 0x4B7FFFFF);
-OUT_CS_REG(R300_SU_DEPTH_OFFSET, 0x00000000);
-OUT_CS_REG(R300_SC_HYPERZ, 0x0000001C);
-OUT_CS_REG(R300_SC_EDGERULE, 0x2DA49525);
-OUT_CS_REG(R300_SC_SCREENDOOR, 0x00FFFFFF);
-OUT_CS_REG(R300_FG_FOG_BLEND, 0x00000002);
-OUT_CS_REG(R300_FG_FOG_COLOR_R, 0x00000000);
-OUT_CS_REG(R300_FG_FOG_COLOR_G, 0x00000000);
-OUT_CS_REG(R300_FG_FOG_COLOR_B, 0x00000000);
-OUT_CS_REG(R300_FG_DEPTH_SRC, 0x00000000);
-OUT_CS_REG(R300_FG_DEPTH_SRC, 0x00000000);
-OUT_CS_REG(R300_RB3D_CCTL, 0x00000000);
-OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0x0000000F);
-
-/* XXX: Oh the wonderful unknown */
-OUT_CS_REG_SEQ(0x4E54, 8);
-for (i = 0; i < 8; i++)
-    OUT_CS(0x00000000);
-OUT_CS_REG(R300_RB3D_AARESOLVE_CTL, 0x00000000);
-OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 0x00000000);
-OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD, 0xFFFFFFFF);
-OUT_CS_REG(R300_ZB_FORMAT, 0x00000002);
-OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT, 0x00000003);
-OUT_CS_REG(R300_ZB_BW_CNTL, 0x00000000);
-OUT_CS_REG(R300_ZB_DEPTHCLEARVALUE, 0x00000000);
-OUT_CS_REG(0x4F30, 0x00000000);
-OUT_CS_REG(0x4F34, 0x00000000);
-OUT_CS_REG(R300_ZB_HIZ_OFFSET, 0x00000000);
-OUT_CS_REG(R300_ZB_HIZ_PITCH, 0x00000000);
-R300_PACIFY;
-if (caps->has_tcl) {
-    OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
-        (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
-        ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) |
-            R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
-} else {
-    OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
-        (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
-        ((R300_LAST_VEC | (2 << R300_DST_VEC_LOC_SHIFT) |
-            R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
-}
-OUT_CS_REG(R300_FG_FOG_BLEND, 0x00000000);
-OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0, 0xF688F688);
-OUT_CS_REG(R300_VAP_VTX_STATE_CNTL, 0x1);
-OUT_CS_REG(R300_VAP_VSM_VTX_ASSM, 0x405);
-OUT_CS_REG(R300_SE_VTE_CNTL, 0x0000043F);
-OUT_CS_REG(R300_VAP_VTX_SIZE, 0x00000008);
-OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0xAAAAAAAA);
-OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0, 0x00000003);
-OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x00000000);
-OUT_CS_REG(R300_TX_ENABLE, 0x0);
-/* XXX viewport setup */
-OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
-OUT_CS_32F(1.0);
-OUT_CS_32F((float)x);
-OUT_CS_32F(1.0);
-OUT_CS_32F((float)y);
-OUT_CS_32F(1.0);
-OUT_CS_32F(0.0);
-
-if (caps->has_tcl) {
-    OUT_CS_REG(R300_VAP_CLIP_CNTL, R300_CLIP_DISABLE |
-        R300_PS_UCP_MODE_CLIP_AS_TRIFAN);
-}
-
-OUT_CS_REG(R300_GA_POINT_SIZE, ((h * 6) & R300_POINTSIZE_Y_MASK) |
-    ((w * 6) << R300_POINTSIZE_X_SHIFT));
-
-/* XXX RS block and fp setup */
-if (caps->is_r500) {
-    OUT_CS_REG_SEQ(R500_RS_IP_0, 8);
-    for (i = 0; i < 8; i++) {
-        /* I like the operator macros more than the shift macros... */
-        OUT_CS((R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_S_SHIFT) |
-            (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT) |
-            (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) |
-            (R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT));
+    r300_emit_blend_state(r300, &blend_clear_state);
+    r300_emit_blend_color_state(r300, &blend_color_clear_state);
+    r300_emit_dsa_state(r300, &dsa_clear_state);
+    r300_emit_rs_state(r300, &rs_clear_state);
+
+    /* Fragment shader setup */
+    if (caps->is_r500) {
+        r500_emit_fragment_shader(r300, &r500_passthrough_fragment_shader);
+        r300_emit_rs_block_state(r300, &r500_rs_block_clear_state);
+    } else {
+        r300_emit_fragment_shader(r300, &r300_passthrough_fragment_shader);
+        r300_emit_rs_block_state(r300, &r300_rs_block_clear_state);
     }
-    /* XXX */
-    OUT_CS_REG_SEQ(R300_RS_COUNT, 2);
-    OUT_CS((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN);
-    OUT_CS(0x0);
-    OUT_CS_REG(R500_RS_INST_0, R500_RS_INST_COL_CN_WRITE);
 
-    OUT_CS_REG(R500_US_CONFIG, R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO);
-    OUT_CS_REG(R500_US_PIXSIZE, 0x00000000);
-    OUT_CS_REG(R500_US_CODE_ADDR, R500_US_CODE_START_ADDR(0) |
-        R500_US_CODE_END_ADDR(1));
-    OUT_CS_REG(R500_US_CODE_RANGE, R500_US_CODE_RANGE_ADDR(0) |
-        R500_US_CODE_RANGE_SIZE(1));
-    OUT_CS_REG(R500_US_CODE_OFFSET, R500_US_CODE_OFFSET_ADDR(0));
-    R300_PACIFY;
-    OUT_CS_REG(R500_GA_US_VECTOR_INDEX,
-        0 | R500_GA_US_VECTOR_INDEX_TYPE_INSTR);
-    OUT_CS_REG(R500_GA_US_VECTOR_DATA,
-        R500_INST_TYPE_OUT | R500_INST_TEX_SEM_WAIT | R500_INST_LAST |
-        R500_INST_RGB_OMASK_R | R500_INST_RGB_OMASK_G | R500_INST_RGB_OMASK_B |
-        R500_INST_ALPHA_OMASK | R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP);
-    OUT_CS_REG(R500_GA_US_VECTOR_DATA,
-        R500_RGB_ADDR0(0) | R500_RGB_ADDR1(0) | R500_RGB_ADDR1_CONST |
-        R500_RGB_ADDR2(0) | R500_RGB_ADDR2_CONST);
-    OUT_CS_REG(R500_GA_US_VECTOR_DATA,
-        R500_ALPHA_ADDR0(0) | R500_ALPHA_ADDR1(0) | R500_ALPHA_ADDR1_CONST |
-        R500_ALPHA_ADDR2(0) | R500_ALPHA_ADDR2_CONST);
-    OUT_CS_REG(R500_GA_US_VECTOR_DATA,
-        R500_ALU_RGB_SEL_A_SRC0 | R500_ALU_RGB_R_SWIZ_A_R |
-        R500_ALU_RGB_G_SWIZ_A_G | R500_ALU_RGB_B_SWIZ_A_B |
-        R500_ALU_RGB_SEL_B_SRC0 | R500_ALU_RGB_R_SWIZ_B_R |
-        R500_ALU_RGB_B_SWIZ_B_G | R500_ALU_RGB_G_SWIZ_B_B);
-    OUT_CS_REG(R500_GA_US_VECTOR_DATA,
-        R500_ALPHA_OP_CMP | R500_ALPHA_SWIZ_A_A | R500_ALPHA_SWIZ_B_A);
-    OUT_CS_REG(R500_GA_US_VECTOR_DATA,
-        R500_ALU_RGBA_OP_CMP | R500_ALU_RGBA_R_SWIZ_0 |
-        R500_ALU_RGBA_G_SWIZ_0 | R500_ALU_RGBA_B_SWIZ_0 |
-        R500_ALU_RGBA_A_SWIZ_0);
-} else {
-    OUT_CS_REG_SEQ(R300_RS_IP_0, 8);
-    for (i = 0; i < 8; i++) {
-        OUT_CS(R300_RS_SEL_T(R300_RS_SEL_K0) |
-            R300_RS_SEL_R(R300_RS_SEL_K0) | R300_RS_SEL_Q(R300_RS_SEL_K1));
-    }
-    /* XXX */
-    OUT_CS_REG_SEQ(R300_RS_COUNT, 2);
-    OUT_CS((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN);
-    OUT_CS(1);
-    OUT_CS_REG(R300_RS_INST_0, R300_RS_INST_COL_CN_WRITE);
-
-    /* XXX magic numbers */
-    OUT_CS_REG(R300_US_CONFIG, 0);
-    OUT_CS_REG(R300_US_PIXSIZE, 2);
-    OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
-    OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0);
-    OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0);
-    OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0);
-    OUT_CS_REG(R300_US_CODE_ADDR_3, 0x400000);
-    OUT_CS_REG(R300_US_ALU_RGB_INST_0, 0x50A80);
-    OUT_CS_REG(R300_US_ALU_RGB_ADDR_0, 0x1C000000);
-    OUT_CS_REG(R300_US_ALU_ALPHA_INST_0, 0x40889);
-    OUT_CS_REG(R300_US_ALU_ALPHA_ADDR_0, 0x1000000);
-    OUT_CS_REG_SEQ(R300_US_OUT_FMT_0, 4);
-    OUT_CS(R300_C0_SEL_B | R300_C1_SEL_G | R300_C2_SEL_R | R300_C3_SEL_A);
-    OUT_CS(R300_US_OUT_FMT_UNUSED);
-    OUT_CS(R300_US_OUT_FMT_UNUSED);
-    OUT_CS(R300_US_OUT_FMT_UNUSED);
-    OUT_CS_REG(R300_US_W_FMT, R300_W_FMT_W0);
-}
-/* XXX these magic numbers should be explained when
- * this becomes a cached state object */
-if (caps->has_tcl) {
-    OUT_CS_REG(R300_VAP_CNTL, 0xA |
-        (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) |
-        (0xB << R300_VF_MAX_VTX_NUM_SHIFT) |
-        (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT));
-    OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, 0x00100000);
-    OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x00000000);
-    OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, 0x00000001);
-    R300_PACIFY;
-    /* XXX translate these back into normal instructions */
-    OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x1);
-    OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0x0);
-    OUT_CS_REG(R300_VAP_PVS_UPLOAD_DATA, 0xF00203);
-    OUT_CS_REG(R300_VAP_PVS_UPLOAD_DATA, 0xD10001);
-    OUT_CS_REG(R300_VAP_PVS_UPLOAD_DATA, 0x1248001);
-    OUT_CS_REG(R300_VAP_PVS_UPLOAD_DATA, 0x0);
-    OUT_CS_REG(R300_VAP_PVS_UPLOAD_DATA, 0xF02203);
-    OUT_CS_REG(R300_VAP_PVS_UPLOAD_DATA, 0xD10021);
-    OUT_CS_REG(R300_VAP_PVS_UPLOAD_DATA, 0x1248021);
-    OUT_CS_REG(R300_VAP_PVS_UPLOAD_DATA, 0x0);
-} else {
-    OUT_CS_REG(R300_VAP_CNTL, 0xA |
-        (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) |
-        (0x5 << R300_VF_MAX_VTX_NUM_SHIFT) |
-        (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT));
+    BEGIN_CS(36);
+
+    /* Viewport setup */
+    OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
+    OUT_CS_32F(1.0);
+    OUT_CS_32F((float)x);
+    OUT_CS_32F(1.0);
+    OUT_CS_32F((float)y);
+    OUT_CS_32F(1.0);
+    OUT_CS_32F(0.0);
+
+    /* Pixel scissors */
+    OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2);
+    OUT_CS((x << R300_SCISSORS_X_SHIFT) | (y << R300_SCISSORS_Y_SHIFT));
+    OUT_CS((w << R300_SCISSORS_X_SHIFT) | (h << R300_SCISSORS_Y_SHIFT));
+
+    /* The size of the point we're about to draw, in sixths of pixels */
+    OUT_CS_REG(R300_GA_POINT_SIZE,
+        ((h * 6) & R300_POINTSIZE_Y_MASK) |
+        ((w * 6) << R300_POINTSIZE_X_SHIFT));
+
+    /* Flush colorbuffer and blend caches. */
+    OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT,
+        R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D |
+        R300_RB3D_DSTCACHE_CTLSTAT_DC_FINISH_SIGNAL);
+    OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT,
+        R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
+        R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
+
+    OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0, 1);
+    OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
+    OUT_CS_REG(R300_RB3D_COLORPITCH0, pixpitch |
+        r300_translate_colorformat(tex->tex.format));
+    OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0x0000000F);
+    /* XXX Packet3 */
+    OUT_CS(CP_PACKET3(R200_3D_DRAW_IMMD_2, 8));
+    OUT_CS(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING |
+    (1 << R300_PRIM_NUM_VERTICES_SHIFT));
+    OUT_CS_32F(w / 2.0);
+    OUT_CS_32F(h / 2.0);
+    /* XXX this should be the depth value to clear to */
+    OUT_CS_32F(1.0);
+    OUT_CS_32F(1.0);
+    OUT_CS_32F(r);
+    OUT_CS_32F(g);
+    OUT_CS_32F(b);
+    OUT_CS_32F(1.0);
+
+    /* XXX figure out why this is 0xA and not 0x2 */
+    OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA);
+    /* XXX OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT,
+        R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
+        R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); */
+
+    END_CS;
+
+    r300->dirty_hw++;
 }
-R300_PACIFY;
-END_CS;
 
-r300_emit_blend_state(r300, &blend_clear_state);
-r300_emit_blend_color_state(r300, &blend_color_clear_state);
-r300_emit_dsa_state(r300, &dsa_clear_state);
-
-BEGIN_CS(36);
-R300_PACIFY;
-/* Flush colorbuffer and blend caches. */
-OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT,
-    R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D |
-    R300_RB3D_DSTCACHE_CTLSTAT_DC_FINISH_SIGNAL);
-OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT,
-    R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
-    R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
-
-OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0, 1);
-OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
-/* XXX this should not be so rigid and it still doesn't work right */
-OUT_CS_REG(R300_RB3D_COLORPITCH0, (dest->stride >> 2) | R300_COLOR_FORMAT_ARGB8888);
-OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0x0000000F);
-/* XXX Packet3 */
-OUT_CS(CP_PACKET3(R200_3D_DRAW_IMMD_2, 8));
-OUT_CS(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING |
-(1 << R300_PRIM_NUM_VERTICES_SHIFT));
-OUT_CS_32F(w / 2.0);
-OUT_CS_32F(h / 2.0);
-/* XXX this should be the depth value to clear to */
-OUT_CS_32F(1.0);
-OUT_CS_32F(1.0);
-OUT_CS_32F(r);
-OUT_CS_32F(g);
-OUT_CS_32F(b);
-OUT_CS_32F(1.0);
-
-/* XXX figure out why this is 0xA and not 0x2 */
-OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA);
-/* XXX OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT,
-    R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
-    R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); */
-R300_PACIFY;
-
-END_CS;
-FLUSH_CS;
-
-    r300->dirty_state = R300_NEW_KITCHEN_SINK;
+static void r300_surface_copy(struct pipe_context* pipe,
+                              struct pipe_surface* dest,
+                              unsigned destx, unsigned desty,
+                              struct pipe_surface* src,
+                              unsigned srcx, unsigned srcy,
+                              unsigned w, unsigned h)
+{
+    struct r300_context* r300 = r300_context(pipe);
+    CS_LOCALS(r300);
+    struct r300_texture* srctex = (struct r300_texture*)src->texture;
+    struct r300_texture* desttex = (struct r300_texture*)dest->texture;
+
+    unsigned pixpitch = srctex->stride / srctex->tex.block.size;
+    debug_printf("r300: Copying surface %p at (%d,%d) to %p at (%d, %d),"
+        " dimensions %dx%d (pixel pitch %d)\n",
+        src, srcx, srcy, dest, destx, desty, w, h, pixpitch);
+
+    if (TRUE) {
+        debug_printf("r300: Falling back on surface_copy\n");
+        return util_surface_copy(pipe, FALSE, dest, destx, desty, src,
+                srcx, srcy, w, h);
+    }
+#if 0
+    BEGIN_CS();
+    OUT_CS_REG(RADEON_DEFAULT_SC_BOTTOM_RIGHT,(RADEON_DEFAULT_SC_RIGHT_MAX |
+                RADEON_DEFAULT_SC_BOTTOM_MAX));
+    OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, (RADEON_GMC_DST_PITCH_OFFSET_CNTL |
+                                         RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
+                                         RADEON_GMC_BRUSH_NONE |
+                                         (datatype << 8) |
+                                         RADEON_GMC_SRC_DATATYPE_COLOR |
+                                         RADEON_ROP[rop].rop |
+                                         RADEON_DP_SRC_SOURCE_MEMORY |
+                                         RADEON_GMC_CLR_CMP_CNTL_DIS));
+    OUT_CS_REG(RADEON_DP_BRUSH_FRGD_CLR, 0xffffffff);
+    OUT_CS_REG(RADEON_DP_BRUSH_BKGD_CLR, 0x0);
+    OUT_CS_REG(RADEON_DP_SRC_FRGD_CLR, 0xffffffff);
+    OUT_CS_REG(RADEON_DP_SRC_BKGD_CLR, 0x0);
+    OUT_ACCEL_REG(RADEON_DP_WRITE_MASK, planemask);
+    OUT_ACCEL_REG(RADEON_DP_CNTL, ((info->accel_state->xdir >= 0 ? RADEON_DST_X_LEFT_TO_RIGHT : 0) |
+                              (info->accel_state->ydir >= 0 ? RADEON_DST_Y_TOP_TO_BOTTOM : 0));
+);
+
+    OUT_CS_REG_SEQ(RADEON_DST_PITCH_OFFSET, 1);
+    OUT_CS_RELOC(desttex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
+
+    OUT_CS_REG_SEQ(RADEON_SRC_PITCH_OFFSET, 1);
+    OUT_CS_RELOC(srctex->buffer, 0,
+            RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0, 0);
+
+    OUT_CS_REG(RADEON_SRC_Y_X, (srcy << 16) | srcx);
+    OUT_CS_REG(RADEON_DST_Y_X, (desty << 16) | destx);
+    OUT_CS_REG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w);
+    OUT_CS_REG(RADEON_DSTCACHE_CTLSTAT, RADEON_RB2D_DC_FLUSH_ALL);
+    OUT_CS_REG(RADEON_WAIT_UNTIL,
+                  RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_DMA_GUI_IDLE);
+    END_CS;
+#endif
 }
 
 void r300_init_surface_functions(struct r300_context* r300)
 {
     r300->context.surface_fill = r300_surface_fill;
+    r300->context.surface_copy = r300_surface_copy;
 }
index e1d53116a1fc5185fe8279a30d1e56cc795e1912..b75b3ab84cf6ea33ec9b0dd4248c3f5bd0f3e619 100644 (file)
@@ -31,6 +31,8 @@
 #include "r300_context.h"
 #include "r300_cs.h"
 #include "r300_emit.h"
+#include "r300_state_shader.h"
+#include "r300_state_inlines.h"
 
 const struct r300_blend_state blend_clear_state = {
     .blend_control = 0x0,
@@ -55,4 +57,38 @@ const struct r300_dsa_state dsa_clear_state = {
     .stencil_ref_bf = 0x0,
 };
 
+const struct r300_rs_state rs_clear_state = {
+    .point_minmax = 0x36000006,
+    .line_control = 0x00030006,
+    .depth_scale_front = 0x0,
+    .depth_offset_front = 0x0,
+    .depth_scale_back = 0x0,
+    .depth_offset_back = 0x0,
+    .polygon_offset_enable = 0x0,
+    .cull_mode = 0x0,
+    .line_stipple_config = 0x3BAAAAAB,
+    .line_stipple_value = 0x0,
+    .color_control = R300_SHADE_MODEL_FLAT,
+};
+
+const struct r300_rs_block r300_rs_block_clear_state = {
+    .ip[0] = R500_RS_SEL_S(R300_RS_SEL_K0) |
+        R500_RS_SEL_T(R300_RS_SEL_K0) |
+        R500_RS_SEL_R(R300_RS_SEL_K0) |
+        R500_RS_SEL_Q(R300_RS_SEL_K1),
+    .inst[0] = R300_RS_INST_COL_CN_WRITE,
+    .count = R300_IT_COUNT(0) | R300_IC_COUNT(1) | R300_HIRES_EN,
+    .inst_count = 0,
+};
+
+const struct r300_rs_block r500_rs_block_clear_state = {
+    .ip[0] = R500_RS_SEL_S(R500_RS_IP_PTR_K0) |
+        R500_RS_SEL_T(R500_RS_IP_PTR_K0) |
+        R500_RS_SEL_R(R500_RS_IP_PTR_K0) |
+        R500_RS_SEL_Q(R500_RS_IP_PTR_K1),
+    .inst[0] = R500_RS_INST_COL_CN_WRITE,
+    .count = R300_IT_COUNT(0) | R300_IC_COUNT(1) | R300_HIRES_EN,
+    .inst_count = 0,
+};
+
 #endif /* R300_SURFACE_H */
index f6e98d23e982ab3d3b14c472541a4b20c770d2e8..3db09514c693fdaf97438f56755ef8bbb5e3d539 100644 (file)
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
 #include "draw/draw_pipe.h"
+#include "draw/draw_vbuf.h"
 #include "util/u_memory.h"
 
 #include "r300_cs.h"
 #include "r300_context.h"
 #include "r300_reg.h"
+#include "r300_state_derived.h"
 
-/* r300_swtcl_emit: Primitive vertex emission using an immediate
- * vertex buffer and no HW TCL. */
+/* r300_swtcl_emit: Vertex and index buffer primitive emission. No HW TCL. */
 
-struct swtcl_stage {
+struct r300_swtcl_render {
     /* Parent class */
-    struct draw_stage draw;
-
+    struct vbuf_render base;
+    
+    /* Pipe context */
     struct r300_context* r300;
+
+    /* Vertex information */
+    size_t vertex_size;
+    unsigned prim;
+    unsigned hwprim;
+
+    /* VBO */
+    struct pipe_buffer* vbo;
+    size_t vbo_size;
+    size_t vbo_offset;
+    void* vbo_map;
+    size_t vbo_alloc_size;
+    size_t vbo_max_used;
 };
 
-static INLINE struct swtcl_stage* swtcl_stage(struct draw_stage* draw) {
-    return (struct swtcl_stage*)draw;
+static INLINE struct r300_swtcl_render*
+r300_swtcl_render(struct vbuf_render* render)
+{
+    return (struct r300_swtcl_render*)render;
 }
 
-static void r300_emit_vertex(struct r300_context* r300,
-                             const struct vertex_header* vertex)
+static const struct vertex_info*
+r300_swtcl_render_get_vertex_info(struct vbuf_render* render)
 {
-    /* XXX */
+    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_context* r300 = r300render->r300;
+
+    r300_update_derived_state(r300);
+
+    return &r300->vertex_info;
 }
 
-static INLINE void r300_emit_prim(struct draw_stage* draw,
-                                  struct prim_header* prim,
-                                  unsigned hwprim,
-                                  unsigned count)
+static boolean r300_swtcl_render_allocate_vertices(struct vbuf_render* render,
+                                                   ushort vertex_size,
+                                                   ushort count)
 {
-    struct r300_context* r300 = swtcl_stage(draw)->r300;
-    CS_LOCALS(r300);
-    int i;
+    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_context* r300 = r300render->r300;
+    struct pipe_screen* screen = r300->context.screen;
+    size_t size = (size_t)vertex_size * (size_t)count;
 
-    r300_emit_dirty_state(r300);
+    if (r300render->vbo) {
+        pipe_buffer_reference(&r300render->vbo, NULL);
+    }
+
+    r300render->vbo_size = MAX2(size, r300render->vbo_alloc_size);
+    r300render->vbo_offset = 0;
+    r300render->vbo = pipe_buffer_create(screen,
+                                         64,
+                                         PIPE_BUFFER_USAGE_VERTEX,
+                                         r300render->vbo_size);
 
-    /* XXX should be count * vtx size */
-    BEGIN_CS(2 + count + 6);
-    OUT_CS(CP_PACKET3(R200_3D_DRAW_IMMD_2, count));
-    OUT_CS(hwprim | R300_PRIM_WALK_RING |
-        (count << R300_PRIM_NUM_VERTICES_SHIFT));
+    r300render->vertex_size = vertex_size;
 
-    for (i = 0; i < count; i++) {
-        r300_emit_vertex(r300, prim->v[i]);
+    if (r300render->vbo) {
+        return TRUE;
+    } else {
+        return FALSE;
     }
-    R300_PACIFY;
-    END_CS;
 }
 
-/* Just as an aside...
- *
- * Radeons can do many more primitives:
- * - Line strip
- * - Triangle fan
- * - Triangle strip
- * - Line loop
- * - Quads
- * - Quad strip
- * - Polygons
- *
- * The following were just the only ones in Draw. */
+static void* r300_swtcl_render_map_vertices(struct vbuf_render* render)
+{
+    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct pipe_screen* screen = r300render->r300->context.screen;
 
-static void r300_emit_point(struct draw_stage* draw, struct prim_header* prim)
+    r300render->vbo_map = pipe_buffer_map(screen, r300render->vbo,
+                                          PIPE_BUFFER_USAGE_CPU_WRITE);
+
+    return (unsigned char*)r300render->vbo_map + r300render->vbo_offset;
+}
+
+static void r300_swtcl_render_unmap_vertices(struct vbuf_render* render,
+                                             ushort min,
+                                             ushort max)
 {
-    r300_emit_prim(draw, prim, R300_PRIM_TYPE_POINT, 1);
+    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct pipe_screen* screen = r300render->r300->context.screen;
+
+    r300render->vbo_max_used = MAX2(r300render->vbo_max_used,
+             r300render->vertex_size * (max + 1));
+
+    pipe_buffer_unmap(screen, r300render->vbo);
 }
 
-static void r300_emit_line(struct draw_stage* draw, struct prim_header* prim)
+static void r300_swtcl_render_release_vertices(struct vbuf_render* render)
 {
-    r300_emit_prim(draw, prim, R300_PRIM_TYPE_LINE, 2);
+    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+
+    pipe_buffer_reference(&r300render->vbo, NULL);
 }
 
-static void r300_emit_tri(struct draw_stage* draw, struct prim_header* prim)
+static boolean r300_swtcl_render_set_primitive(struct vbuf_render* render,
+                                               unsigned prim)
 {
-    r300_emit_prim(draw, prim, R300_PRIM_TYPE_TRI_LIST, 3);
+    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    r300render->prim = prim;
+
+    switch (prim) {
+        case PIPE_PRIM_POINTS:
+            r300render->hwprim = R300_VAP_VF_CNTL__PRIM_POINTS;
+            break;
+        case PIPE_PRIM_LINES:
+            r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINES;
+            break;
+        case PIPE_PRIM_LINE_LOOP:
+            r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINE_LOOP;
+            break;
+        case PIPE_PRIM_LINE_STRIP:
+            r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINE_STRIP;
+            break;
+        case PIPE_PRIM_TRIANGLES:
+            r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLES;
+            break;
+        case PIPE_PRIM_TRIANGLE_STRIP:
+            r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP;
+            break;
+        case PIPE_PRIM_TRIANGLE_FAN:
+            r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN;
+            break;
+        case PIPE_PRIM_QUADS:
+            r300render->hwprim = R300_VAP_VF_CNTL__PRIM_QUADS;
+            break;
+        case PIPE_PRIM_QUAD_STRIP:
+            r300render->hwprim = R300_VAP_VF_CNTL__PRIM_QUAD_STRIP;
+            break;
+        case PIPE_PRIM_POLYGON:
+            r300render->hwprim = R300_VAP_VF_CNTL__PRIM_POLYGON;
+            break;
+        default:
+            return FALSE;
+            break;
+    }
+
+    return TRUE;
 }
 
-static void r300_swtcl_flush(struct draw_stage* draw, unsigned flags)
+static void prepare_render(struct r300_swtcl_render* render, unsigned count)
 {
+    struct r300_context* r300 = render->r300;
+    int i;
+
+    CS_LOCALS(r300);
+
+    /* Make sure that all possible state is emitted. */
+    r300_emit_dirty_state(r300);
+
+    debug_printf("r300: Preparing vertex buffer %p for render, "
+            "vertex size %d, vertex count %d\n", render->vbo,
+            r300->vertex_info.vinfo.size, count);
+    /* Set the pointer to our vertex buffer. The emitted values are this:
+     * PACKET3 [3D_LOAD_VBPNTR]
+     * COUNT   [1]
+     * FORMAT  [size | stride << 8]
+     * OFFSET  [0]
+     * VBPNTR  [relocated BO]
+     */
+    BEGIN_CS(7);
+    OUT_CS(CP_PACKET3(R300_PACKET3_3D_LOAD_VBPNTR, 3));
+    OUT_CS(1);
+    OUT_CS(r300->vertex_info.vinfo.size |
+            (r300->vertex_info.vinfo.size << 8));
+    OUT_CS(render->vbo_offset);
+    OUT_CS_RELOC(render->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
+    END_CS;
 }
 
-static void r300_reset_stipple(struct draw_stage* draw)
+static void r300_swtcl_render_draw_arrays(struct vbuf_render* render,
+                                          unsigned start,
+                                          unsigned count)
 {
-    /* XXX */
+    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_context* r300 = r300render->r300;
+    struct pipe_screen* screen = r300->context.screen;
+
+    CS_LOCALS(r300);
+
+    r300render->vbo_offset = start;
+
+    prepare_render(r300render, count);
+
+    debug_printf("r300: Doing vbuf render, count %d\n", count);
+
+    BEGIN_CS(2);
+    OUT_CS(CP_PACKET3(R300_PACKET3_3D_DRAW_VBUF_2, 0));
+    OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) |
+           r300render->hwprim);
+    END_CS;
+}
+
+static void r300_swtcl_render_draw(struct vbuf_render* render,
+                                   const ushort* indices,
+                                   uint count)
+{
+    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_context* r300 = r300render->r300;
+    struct pipe_screen* screen = r300->context.screen;
+    struct pipe_buffer* index_buffer;
+    void* index_map;
+
+    CS_LOCALS(r300);
+
+    count /= 4;
+
+    prepare_render(r300render, count);
+
+    /* Send our indices into an index buffer. */
+    index_buffer = pipe_buffer_create(screen, 64, PIPE_BUFFER_USAGE_VERTEX,
+                                      count * 4);
+    if (!index_buffer) {
+        return;
+    }
+
+    index_map = pipe_buffer_map(screen, index_buffer,
+                                PIPE_BUFFER_USAGE_CPU_WRITE);
+    memcpy(index_map, indices, count * 4);
+    pipe_buffer_unmap(screen, index_buffer);
+
+    debug_printf("r300: Doing indexbuf render, count %d\n", count);
+#if 0
+    BEGIN_CS(5);
+    OUT_CS(CP_PACKET3(R300_PACKET3_3D_DRAW_INDX_2, 0));
+    OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) |
+           r300render->hwprim | R300_VAP_VF_CNTL__INDEX_SIZE_32bit);
+
+    OUT_CS(CP_PACKET3(R300_PACKET3_INDX_BUFFER, 2));
+    OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2));
+    OUT_CS_RELOC(index_buffer, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
+    END_CS;
+#endif
+}
+
+static void r300_swtcl_render_destroy(struct vbuf_render* render)
+{
+    FREE(render);
 }
 
-static void r300_swtcl_destroy(struct draw_stage* draw)
+static struct vbuf_render* r300_swtcl_render_create(struct r300_context* r300)
 {
-    FREE(draw);
+    struct r300_swtcl_render* r300render = CALLOC_STRUCT(r300_swtcl_render);
+    struct pipe_screen* screen = r300->context.screen;
+
+    r300render->r300 = r300;
+
+    /* XXX find real numbers plz */
+    r300render->base.max_vertex_buffer_bytes = 128 * 1024;
+    r300render->base.max_indices = 16 * 1024;
+
+    r300render->base.get_vertex_info = r300_swtcl_render_get_vertex_info;
+    r300render->base.allocate_vertices = r300_swtcl_render_allocate_vertices;
+    r300render->base.map_vertices = r300_swtcl_render_map_vertices;
+    r300render->base.unmap_vertices = r300_swtcl_render_unmap_vertices;
+    r300render->base.set_primitive = r300_swtcl_render_set_primitive;
+    r300render->base.draw = r300_swtcl_render_draw;
+    r300render->base.draw_arrays = r300_swtcl_render_draw_arrays;
+    r300render->base.release_vertices = r300_swtcl_render_release_vertices;
+    r300render->base.destroy = r300_swtcl_render_destroy;
+
+    /* XXX bonghits ahead
+    r300render->vbo_alloc_size = 128 * 4096;
+    r300render->vbo_size = r300render->vbo_alloc_size;
+    r300render->vbo_offset = 0;
+    r300render->vbo = pipe_buffer_create(screen,
+                                         64,
+                                         PIPE_BUFFER_USAGE_VERTEX,
+                                         r300render->vbo_size);
+    r300render->vbo_map = pipe_buffer_map(screen,
+                                          r300render->vbo,
+                                          PIPE_BUFFER_USAGE_CPU_WRITE);
+    pipe_buffer_unmap(screen, r300render->vbo); */
+
+    return &r300render->base;
 }
 
 struct draw_stage* r300_draw_swtcl_stage(struct r300_context* r300)
 {
-    struct swtcl_stage* swtcl = CALLOC_STRUCT(swtcl_stage);
+    struct vbuf_render* render;
+    struct draw_stage* stage;
+
+    render = r300_swtcl_render_create(r300);
+
+    if (!render) {
+        return NULL;
+    }
+
+    stage = draw_vbuf_stage(r300->draw, render);
+
+    if (!stage) {
+        render->destroy(render);
+        return NULL;
+    }
 
-    swtcl->r300 = r300;
-    swtcl->draw.point = r300_emit_point;
-    swtcl->draw.line = r300_emit_line;
-    swtcl->draw.tri = r300_emit_tri;
-    swtcl->draw.flush = r300_swtcl_flush;
-    swtcl->draw.reset_stipple_counter = r300_reset_stipple;
-    swtcl->draw.destroy = r300_swtcl_destroy;
+    draw_set_render(r300->draw, render);
 
-    return &swtcl->draw;
+    return stage;
 }
index ff812c09f8080139e94871e67fd0b66a6e628914..6cdea3d2854ff357f593021c487e346660f5f6b0 100644 (file)
@@ -27,12 +27,37 @@ static int minify(int i)
     return MAX2(1, i >> 1);
 }
 
+static void r300_setup_texture_state(struct r300_texture* tex,
+                                     unsigned width,
+                                     unsigned height,
+                                     unsigned pitch)
+{
+    struct r300_texture_state* state = &tex->state;
+
+    state->format0 = R300_TX_WIDTH((width - 1) & 0x7ff) |
+        R300_TX_HEIGHT((height - 1) & 0x7ff) | R300_TX_PITCH_EN;
+
+    /* XXX */
+    state->format1 = R300_TX_FORMAT_A8R8G8B8;
+
+    state->format2 = pitch - 1;
+
+    /* XXX
+    if (width > 2048) {
+        state->pitch |= R300_TXWIDTH_11;
+    }
+    if (height > 2048) {
+        state->pitch |= R300_TXHEIGHT_11;
+    } */
+}
+
 static void r300_setup_miptree(struct r300_texture* tex)
 {
     struct pipe_texture* base = &tex->tex;
     int stride, size, offset;
+    int i;
 
-    for (int i = 0; i <= base->last_level; i++) {
+    for (i = 0; i <= base->last_level; i++) {
         if (i > 0) {
             base->width[i] = minify(base->width[i-1]);
             base->height[i] = minify(base->height[i-1]);
@@ -43,13 +68,16 @@ static void r300_setup_miptree(struct r300_texture* tex)
         base->nblocksy[i] = pf_get_nblocksy(&base->block, base->width[i]);
 
         /* Radeons enjoy things in multiples of 32. */
-        /* XXX NPOT -> 64, not 32 */
+        /* XXX this can be 32 when POT */
         stride = (base->nblocksx[i] * base->block.size + 63) & ~63;
         size = stride * base->nblocksy[i] * base->depth[i];
 
-        /* XXX 64 for NPOT */
         tex->offset[i] = (tex->size + 63) & ~63;
         tex->size = tex->offset[i] + size;
+
+        if (i == 0) {
+            tex->stride = stride;
+        }
     }
 }
 
@@ -67,12 +95,16 @@ static struct pipe_texture*
     }
 
     tex->tex = *template;
-    tex->tex.refcount = 1;
+    pipe_reference_init(&tex->tex.reference, 1);
     tex->tex.screen = screen;
 
     r300_setup_miptree(tex);
 
-    tex->buffer = screen->buffer_create(screen, 63,
+    /* XXX */
+    r300_setup_texture_state(tex, tex->tex.width[0], tex->tex.height[0],
+            tex->tex.width[0]);
+
+    tex->buffer = screen->buffer_create(screen, 64,
                                         PIPE_BUFFER_USAGE_PIXEL,
                                         tex->size);
 
@@ -84,24 +116,13 @@ static struct pipe_texture*
     return (struct pipe_texture*)tex;
 }
 
-static void r300_texture_release(struct pipe_screen* screen,
-                                 struct pipe_texture** texture)
+static void r300_texture_destroy(struct pipe_texture* texture)
 {
-    if (!*texture) {
-        return;
-    }
-
-    (*texture)->refcount--;
-
-    if ((*texture)->refcount <= 0) {
-        struct r300_texture* tex = (struct r300_texture*)*texture;
+    struct r300_texture* tex = (struct r300_texture*)texture;
 
-        pipe_buffer_reference(screen, &tex->buffer, NULL);
+    pipe_buffer_reference(&tex->buffer, NULL);
 
-        FREE(tex);
-    }
-
-    *texture = NULL;
+    FREE(tex);
 }
 
 static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
@@ -119,17 +140,11 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
     offset = tex->offset[level];
 
     if (surface) {
-        surface->refcount = 1;
+        pipe_reference_init(&surface->reference, 1);
         pipe_texture_reference(&surface->texture, texture);
         surface->format = texture->format;
         surface->width = texture->width[level];
         surface->height = texture->height[level];
-        surface->block = texture->block;
-        surface->nblocksx = texture->nblocksx[level];
-        surface->nblocksy = texture->nblocksy[level];
-        /* XXX save the actual stride instead plz kthnxbai */
-        surface->stride =
-            (texture->nblocksx[level] * texture->block.size + 63) & ~63;
         surface->offset = offset;
         surface->usage = flags;
         surface->status = PIPE_SURFACE_STATUS_DEFINED;
@@ -138,19 +153,10 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
     return surface;
 }
 
-static void r300_tex_surface_release(struct pipe_screen* screen,
-                                     struct pipe_surface** surface)
+static void r300_tex_surface_destroy(struct pipe_surface* s)
 {
-    struct pipe_surface* s = *surface;
-
-    s->refcount--;
-
-    if (s->refcount <= 0) {
-        pipe_texture_reference(&s->texture, NULL);
-        FREE(s);
-    }
-
-    *surface = NULL;
+    pipe_texture_reference(&s->texture, NULL);
+    FREE(s);
 }
 
 static struct pipe_texture*
@@ -173,12 +179,15 @@ static struct pipe_texture*
     }
 
     tex->tex = *base;
-    tex->tex.refcount = 1;
+    pipe_reference_init(&tex->tex.reference, 1);
     tex->tex.screen = screen;
 
-    /* XXX tex->stride = *stride; */
+    tex->stride = *stride;
+
+    r300_setup_texture_state(tex, tex->tex.width[0], tex->tex.height[0],
+            tex->stride);
 
-    pipe_buffer_reference(screen, &tex->buffer, buffer);
+    pipe_buffer_reference(&tex->buffer, buffer);
 
     return (struct pipe_texture*)tex;
 }
@@ -186,8 +195,26 @@ static struct pipe_texture*
 void r300_init_screen_texture_functions(struct pipe_screen* screen)
 {
     screen->texture_create = r300_texture_create;
-    screen->texture_release = r300_texture_release;
+    screen->texture_destroy = r300_texture_destroy;
     screen->get_tex_surface = r300_get_tex_surface;
-    screen->tex_surface_release = r300_tex_surface_release;
+    screen->tex_surface_destroy = r300_tex_surface_destroy;
     screen->texture_blanket = r300_texture_blanket;
 }
+
+boolean r300_get_texture_buffer(struct pipe_texture* texture,
+                                struct pipe_buffer** buffer,
+                                unsigned* stride)
+{
+    struct r300_texture* tex = (struct r300_texture*)texture;
+    if (!tex) {
+        return FALSE;
+    }
+
+    pipe_buffer_reference(buffer, tex->buffer);
+
+    if (stride) {
+        *stride = tex->stride;
+    }
+
+    return TRUE;
+}
index 7964229a94f7f4a64b09e70811cf4e1a2fad4122..98fb5c9a08ff10fbf471f38260ca80f1369c3fc7 100644 (file)
 #include "util/u_math.h"
 
 #include "r300_context.h"
+#include "r300_reg.h"
 
 void r300_init_screen_texture_functions(struct pipe_screen* screen);
 
+#ifndef R300_WINSYS_H
+
+boolean r300_get_texture_buffer(struct pipe_texture* texture,
+                                struct pipe_buffer** buffer,
+                                unsigned* stride);
+
+#endif /* R300_WINSYS_H */
+
 #endif /* R300_TEXTURE_H */
index 5a3a2128927f681434772b5ebadd5fa324d9921c..baa95282c3365614b24fac88c5f490bb58d281f2 100644 (file)
@@ -33,10 +33,16 @@ extern "C" {
 
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
+#include "pipe/internal/p_winsys_screen.h"
 
 struct radeon_cs;
 
 struct r300_winsys {
+    /* Parent class */
+    struct pipe_winsys base;
+
+    /* Opaque Radeon-specific winsys object. */
+    void* radeon_winsys;
 
     /* PCI ID */
     uint32_t pci_id;
@@ -47,10 +53,6 @@ struct r300_winsys {
     /* CS object. This is very much like Intel's batchbuffer.
      * Fill it full of dwords and relocs and then submit.
      * Repeat as needed. */
-    /* Note: Unlike Mesa's version of this, we don't keep a copy of the CSM
-     * that was used to create this CS. Is this a good idea? */
-    /* Note: The pipe driver doesn't know how to use this. This is purely
-     * for the winsys. */
     struct radeon_cs* cs;
 
     /* Check to see if there's room for commands. */
@@ -84,9 +86,12 @@ struct r300_winsys {
 };
 
 struct pipe_context* r300_create_context(struct pipe_screen* screen,
-                                         struct pipe_winsys* winsys,
                                          struct r300_winsys* r300_winsys);
 
+boolean r300_get_texture_buffer(struct pipe_texture* texture,
+                                struct pipe_buffer** buffer,
+                                unsigned* stride);
+
 #ifdef __cplusplus
 }
 #endif
index 120bdfd9dd21081bdf0a6f27cad27f5485a2e03d..516e3992fdddf53963f6ebb523cde34a3ba4e0ed 100644 (file)
@@ -14,7 +14,7 @@ C_SOURCES = \
        sp_draw_arrays.c \
        sp_prim_setup.c \
        sp_prim_vbuf.c \
-       sp_quad.c \
+       sp_quad_pipe.c \
        sp_quad_alpha_test.c \
        sp_quad_blend.c \
        sp_quad_colormask.c \
@@ -42,6 +42,3 @@ C_SOURCES = \
        sp_surface.c 
 
 include ../../Makefile.template
-
-symlinks:
-
index c1f7daa8ab3d8ab49087475584160fadc95e10c3..f8720638a76b093efb082d8e4dbec742b065ee10 100644 (file)
@@ -17,7 +17,7 @@ softpipe = env.ConvenienceLibrary(
                'sp_setup.c',
                'sp_quad_alpha_test.c',
                'sp_quad_blend.c',
-               'sp_quad.c',
+               'sp_quad_pipe.c',
                'sp_quad_colormask.c',
                'sp_quad_coverage.c',
                'sp_quad_depth_test.c',
index c2d882a819740e2382884da1da348236958eb6da..06ace27d14b0299421b2d97a2c8ce653aa5453c9 100644 (file)
@@ -32,7 +32,6 @@
 
 #include "draw/draw_context.h"
 #include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "sp_clear.h"
  * Map any drawing surfaces which aren't already mapped
  */
 void
-softpipe_map_surfaces(struct softpipe_context *sp)
+softpipe_map_transfers(struct softpipe_context *sp)
 {
    unsigned i;
 
    for (i = 0; i < sp->framebuffer.nr_cbufs; i++) {
-      sp_tile_cache_map_surfaces(sp->cbuf_cache[i]);
+      sp_tile_cache_map_transfers(sp->cbuf_cache[i]);
    }
 
-   sp_tile_cache_map_surfaces(sp->zsbuf_cache);
+   sp_tile_cache_map_transfers(sp->zsbuf_cache);
 }
 
 
@@ -69,7 +68,7 @@ softpipe_map_surfaces(struct softpipe_context *sp)
  * Unmap any mapped drawing surfaces
  */
 void
-softpipe_unmap_surfaces(struct softpipe_context *sp)
+softpipe_unmap_transfers(struct softpipe_context *sp)
 {
    uint i;
 
@@ -78,16 +77,15 @@ softpipe_unmap_surfaces(struct softpipe_context *sp)
    sp_flush_tile_cache(sp, sp->zsbuf_cache);
 
    for (i = 0; i < sp->framebuffer.nr_cbufs; i++) {
-      sp_tile_cache_unmap_surfaces(sp->cbuf_cache[i]);
+      sp_tile_cache_unmap_transfers(sp->cbuf_cache[i]);
    }
-   sp_tile_cache_unmap_surfaces(sp->zsbuf_cache);
+   sp_tile_cache_unmap_transfers(sp->zsbuf_cache);
 }
 
 
 static void softpipe_destroy( struct pipe_context *pipe )
 {
    struct softpipe_context *softpipe = softpipe_context( pipe );
-   struct pipe_screen *screen = pipe->screen;
    uint i;
 
    if (softpipe->draw)
@@ -116,7 +114,7 @@ static void softpipe_destroy( struct pipe_context *pipe )
 
    for (i = 0; i < Elements(softpipe->constants); i++) {
       if (softpipe->constants[i].buffer) {
-         pipe_buffer_reference(screen, &softpipe->constants[i].buffer, NULL);
+         pipe_buffer_reference(&softpipe->constants[i].buffer, NULL);
       }
    }
 
index e2451c6ecb58ea1d000dee701b63428ecbabb5d6..59d6df8f2dd901e49059f25ccb999efe7473e143 100644 (file)
 #define SP_CONTEXT_H
 
 #include "pipe/p_context.h"
-#include "pipe/p_defines.h"
 
 #include "draw/draw_vertex.h"
 
-#include "sp_quad.h"
+#include "sp_quad_pipe.h"
 #include "sp_tex_sample.h"
 
 
@@ -51,7 +50,6 @@
  */
 #define SP_NUM_QUAD_THREADS 1
 
-struct softpipe_winsys;
 struct softpipe_vbuf_render;
 struct draw_context;
 struct draw_stage;
@@ -63,15 +61,15 @@ struct sp_vertex_shader;
 struct softpipe_context {
    struct pipe_context pipe;  /**< base class */
 
-   /* The most recent drawing state as set by the driver:
-    */
-   const struct pipe_blend_state   *blend;
+   /** Constant state objects */
+   const struct pipe_blend_state *blend;
    const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
-   const struct pipe_depth_stencil_alpha_state   *depth_stencil;
+   const struct pipe_depth_stencil_alpha_state *depth_stencil;
    const struct pipe_rasterizer_state *rasterizer;
    const struct sp_fragment_shader *fs;
    const struct sp_vertex_shader *vs;
 
+   /** Other rendering state */
    struct pipe_blend_color blend_color;
    struct pipe_clip_state clip;
    struct pipe_constant_buffer constants[PIPE_SHADER_TYPES];
@@ -82,23 +80,20 @@ struct softpipe_context {
    struct pipe_viewport_state viewport;
    struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
    struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
-   unsigned dirty;
 
    unsigned num_samplers;
    unsigned num_textures;
    unsigned num_vertex_elements;
    unsigned num_vertex_buffers;
 
-   boolean no_rast;
+   unsigned dirty; /**< Mask of SP_NEW_x flags */
 
    /* Counter for occlusion queries.  Note this supports overlapping
     * queries.
     */
    uint64_t occlusion_count;
 
-   /*
-    * Mapped vertex buffers
-    */
+   /** Mapped vertex buffers */
    ubyte *mapped_vbuffer[PIPE_MAX_ATTRIBS];
    
    /** Mapped constant buffers */
@@ -108,16 +103,11 @@ struct softpipe_context {
    struct vertex_info vertex_info;
    struct vertex_info vertex_info_vbuf;
 
+   /** Which vertex shader output slot contains point size */
    int psize_slot;
 
    unsigned reduced_api_prim;  /**< PIPE_PRIM_POINTS, _LINES or _TRIANGLES */
 
-#if 0
-   /* Stipple derived state:
-    */
-   ubyte stipple_masks[16][16];
-#endif
-
    /** Derived from scissor and surface bounds: */
    struct pipe_scissor_state cliprect;
 
@@ -159,8 +149,9 @@ struct softpipe_context {
 
    struct softpipe_tile_cache *tex_cache[PIPE_MAX_SAMPLERS];
 
-   int use_sse : 1;
-   int dump_fs : 1;
+   unsigned use_sse : 1;
+   unsigned dump_fs : 1;
+   unsigned no_rast : 1;
 };
 
 
index 7e3a25e34b1afa145c0e9c7f873e956f0b80f983..f117096bf733d71e7e8bbce0f7d29889d0ce36a6 100644 (file)
@@ -134,7 +134,7 @@ softpipe_draw_range_elements(struct pipe_context *pipe,
    if (sp->dirty)
       softpipe_update_derived( sp );
 
-   softpipe_map_surfaces(sp);
+   softpipe_map_transfers(sp);
    softpipe_map_constant_buffers(sp);
 
    /*
index c21faf57f3e1b0f9b99731b2ce90abc762464686..035f4b963eb37426ceab9501654616d5129f8d05 100644 (file)
@@ -70,7 +70,7 @@ softpipe_flush( struct pipe_context *pipe,
        * that's called before swapbuffers because we don't always want
        * to unmap surfaces when flushing.
        */
-      softpipe_unmap_surfaces(softpipe);
+      softpipe_unmap_transfers(softpipe);
    }
 
    /* Enable to dump BMPs of the color/depth buffers each frame */
index 453b0373f0feffdf554b2c8fdfb3b3e5e695ba1f..0c14d92864fe9d40ba4ab38b45412c87398d5a54 100644 (file)
 #include "sp_context.h"
 #include "sp_state.h"
 #include "sp_fs.h"
-#include "sp_headers.h"
+#include "sp_quad.h"
 
 
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
-#include "pipe/p_inlines.h"
 #include "tgsi/tgsi_exec.h"
 #include "tgsi/tgsi_parse.h"
 
index 34adac5226c8c477a615e7069762d8587538f290..f33b3e32854fc63b2ddfe95889c30b83d538af78 100644 (file)
@@ -37,7 +37,6 @@
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
-#include "pipe/p_inlines.h"
 #include "tgsi/tgsi_sse2.h"
 
 #if 0
index 9a273c87643a5ff3a90654ab5c28290a9169b4b2..366abe2ed49fab78ee0e9c5f5e1f403308496103 100644 (file)
 #include "sp_context.h"
 #include "sp_state.h"
 #include "sp_fs.h"
-#include "sp_headers.h"
+#include "sp_quad.h"
 
 
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
-#include "pipe/p_inlines.h"
 #include "tgsi/tgsi_exec.h"
 #include "tgsi/tgsi_sse2.h"
 
@@ -146,7 +145,7 @@ softpipe_create_fs_sse(struct softpipe_context *softpipe,
       return NULL;
    }
 
-   shader->base.shader = *templ;
+   shader->base.shader.tokens = NULL; /* don't hold reference to templ->tokens */
    shader->base.prepare = fs_sse_prepare;
    shader->base.run = fs_sse_run;
    shader->base.delete = fs_sse_delete;
diff --git a/src/gallium/drivers/softpipe/sp_headers.h b/src/gallium/drivers/softpipe/sp_headers.h
deleted file mode 100644 (file)
index 4a42cb3..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
-/* Authors:  Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef SP_HEADERS_H
-#define SP_HEADERS_H
-
-#include "pipe/p_state.h"
-#include "tgsi/tgsi_exec.h"
-
-#define PRIM_POINT 1
-#define PRIM_LINE  2
-#define PRIM_TRI   3
-
-
-/* The rasterizer generates 2x2 quads of fragment and feeds them to
- * the current fp_machine (see below).
- * Remember that Y=0=top with Y increasing down the window.
- */
-#define QUAD_TOP_LEFT     0
-#define QUAD_TOP_RIGHT    1
-#define QUAD_BOTTOM_LEFT  2
-#define QUAD_BOTTOM_RIGHT 3
-
-#define MASK_TOP_LEFT     (1 << QUAD_TOP_LEFT)
-#define MASK_TOP_RIGHT    (1 << QUAD_TOP_RIGHT)
-#define MASK_BOTTOM_LEFT  (1 << QUAD_BOTTOM_LEFT)
-#define MASK_BOTTOM_RIGHT (1 << QUAD_BOTTOM_RIGHT)
-#define MASK_ALL          0xf
-
-
-/**
- * Encodes everything we need to know about a 2x2 pixel block.  Uses
- * "Channel-Serial" or "SoA" layout.  
- */
-struct quad_header_input
-{
-   int x0;
-   int y0;
-   float coverage[QUAD_SIZE];    /** fragment coverage for antialiasing */
-   unsigned facing:1;   /**< Front (0) or back (1) facing? */
-   unsigned prim:2;     /**< PRIM_POINT, LINE, TRI */
-};
-
-struct quad_header_inout
-{
-   unsigned mask:4;
-};
-
-struct quad_header_output
-{
-   /** colors in SOA format (rrrr, gggg, bbbb, aaaa) */
-   float color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS][QUAD_SIZE];
-   float depth[QUAD_SIZE];
-};
-
-struct quad_header {
-   struct quad_header_input input;
-   struct quad_header_inout inout;
-   struct quad_header_output output;
-
-   const struct tgsi_interp_coef *coef;
-   const struct tgsi_interp_coef *posCoef;
-
-   unsigned nr_attrs;
-};
-
-#endif /* SP_HEADERS_H */
-
index 9cd5784e5bce6d48ed73cf682b88c267b78ef848..eef6e5806c95095bae584fac4d332f9baa29300c 100644 (file)
@@ -60,6 +60,8 @@ struct softpipe_vbuf_render
    struct softpipe_context *softpipe;
    uint prim;
    uint vertex_size;
+   uint nr_vertices;
+   uint vertex_buffer_size;
    void *vertex_buffer;
 };
 
@@ -80,26 +82,76 @@ sp_vbuf_get_vertex_info(struct vbuf_render *vbr)
 }
 
 
-static void *
+static boolean
 sp_vbuf_allocate_vertices(struct vbuf_render *vbr,
-                            ushort vertex_size, ushort nr_vertices)
+                          ushort vertex_size, ushort nr_vertices)
 {
    struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr);
-   assert(!cvbr->vertex_buffer);
-   cvbr->vertex_buffer = align_malloc(vertex_size * nr_vertices, 16);
+   unsigned size = vertex_size * nr_vertices;
+
+   if (cvbr->vertex_buffer_size < size) {
+      align_free(cvbr->vertex_buffer);
+      cvbr->vertex_buffer = align_malloc(size, 16);
+      cvbr->vertex_buffer_size = size;
+   }
+
    cvbr->vertex_size = vertex_size;
-   return cvbr->vertex_buffer;
+   cvbr->nr_vertices = nr_vertices;
+   
+   return cvbr->vertex_buffer != NULL;
 }
 
-
 static void
-sp_vbuf_release_vertices(struct vbuf_render *vbr, void *vertices,
-                           unsigned vertex_size, unsigned vertices_used)
+sp_vbuf_release_vertices(struct vbuf_render *vbr)
+{
+#if 0
+   {
+      struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr);
+      const struct vertex_info *info = 
+         softpipe_get_vbuf_vertex_info(cvbr->softpipe);
+      const float *vtx = (const float *) cvbr->vertex_buffer;
+      uint i, j;
+      debug_printf("%s (vtx_size = %u,  vtx_used = %u)\n",
+             __FUNCTION__, cvbr->vertex_size, cvbr->nr_vertices);
+      for (i = 0; i < cvbr->nr_vertices; i++) {
+         for (j = 0; j < info->num_attribs; j++) {
+            uint k;
+            switch (info->attrib[j].emit) {
+            case EMIT_4F:  k = 4;   break;
+            case EMIT_3F:  k = 3;   break;
+            case EMIT_2F:  k = 2;   break;
+            case EMIT_1F:  k = 1;   break;
+            default: assert(0);
+            }
+            debug_printf("Vert %u attr %u: ", i, j);
+            while (k-- > 0) {
+               debug_printf("%g ", vtx[0]);
+               vtx++;
+            }
+            debug_printf("\n");
+         }
+      }
+   }
+#endif
+
+   /* keep the old allocation for next time */
+}
+
+static void *
+sp_vbuf_map_vertices(struct vbuf_render *vbr)
 {
    struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr);
-   align_free(vertices);
-   assert(vertices == cvbr->vertex_buffer);
-   cvbr->vertex_buffer = NULL;
+   return cvbr->vertex_buffer;
+}
+
+static void 
+sp_vbuf_unmap_vertices(struct vbuf_render *vbr, 
+                       ushort min_index,
+                       ushort max_index )
+{
+   struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr);
+   assert( cvbr->vertex_buffer_size >= (max_index+1) * cvbr->vertex_size );
+   /* do nothing */
 }
 
 
@@ -115,8 +167,6 @@ sp_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim)
    
    setup_prepare( setup_ctx );
 
-
-
    cvbr->prim = prim;
    return TRUE;
 
@@ -394,6 +444,8 @@ sp_init_vbuf(struct softpipe_context *sp)
 
    sp->vbuf_render->base.get_vertex_info = sp_vbuf_get_vertex_info;
    sp->vbuf_render->base.allocate_vertices = sp_vbuf_allocate_vertices;
+   sp->vbuf_render->base.map_vertices = sp_vbuf_map_vertices;
+   sp->vbuf_render->base.unmap_vertices = sp_vbuf_unmap_vertices;
    sp->vbuf_render->base.set_primitive = sp_vbuf_set_primitive;
    sp->vbuf_render->base.draw = sp_vbuf_draw;
    sp->vbuf_render->base.draw_arrays = sp_vbuf_draw_arrays;
diff --git a/src/gallium/drivers/softpipe/sp_quad.c b/src/gallium/drivers/softpipe/sp_quad.c
deleted file mode 100644 (file)
index 892ef87..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
-
-#include "sp_context.h"
-#include "sp_state.h"
-#include "pipe/p_shader_tokens.h"
-
-static void
-sp_push_quad_first(
-   struct softpipe_context *sp,
-   struct quad_stage *quad,
-   uint i )
-{
-   quad->next = sp->quad[i].first;
-   sp->quad[i].first = quad;
-}
-
-static void
-sp_build_depth_stencil(
-   struct softpipe_context *sp,
-   uint i )
-{
-   if (sp->depth_stencil->stencil[0].enabled ||
-       sp->depth_stencil->stencil[1].enabled) {
-      sp_push_quad_first( sp, sp->quad[i].stencil_test, i );
-   }
-   else if (sp->depth_stencil->depth.enabled &&
-            sp->framebuffer.zsbuf) {
-      sp_push_quad_first( sp, sp->quad[i].depth_test, i );
-   }
-}
-
-void
-sp_build_quad_pipeline(struct softpipe_context *sp)
-{
-   uint i;
-
-   boolean early_depth_test =
-               sp->depth_stencil->depth.enabled &&
-               sp->framebuffer.zsbuf &&
-               !sp->depth_stencil->alpha.enabled &&
-               !sp->fs->info.uses_kill &&
-               !sp->fs->info.writes_z;
-
-   /* build up the pipeline in reverse order... */
-   for (i = 0; i < SP_NUM_QUAD_THREADS; i++) {
-      sp->quad[i].first = sp->quad[i].output;
-
-      if (sp->blend->colormask != 0xf) {
-         sp_push_quad_first( sp, sp->quad[i].colormask, i );
-      }
-
-      if (sp->blend->blend_enable ||
-          sp->blend->logicop_enable) {
-         sp_push_quad_first( sp, sp->quad[i].blend, i );
-      }
-
-      if (sp->depth_stencil->depth.occlusion_count) {
-         sp_push_quad_first( sp, sp->quad[i].occlusion, i );
-      }
-
-      if (sp->rasterizer->poly_smooth ||
-          sp->rasterizer->line_smooth ||
-          sp->rasterizer->point_smooth) {
-         sp_push_quad_first( sp, sp->quad[i].coverage, i );
-      }
-
-      if (!early_depth_test) {
-         sp_build_depth_stencil( sp, i );
-      }
-
-      if (sp->depth_stencil->alpha.enabled) {
-         sp_push_quad_first( sp, sp->quad[i].alpha_test, i );
-      }
-
-      /* XXX always enable shader? */
-      if (1) {
-         sp_push_quad_first( sp, sp->quad[i].shade, i );
-      }
-
-      if (early_depth_test) {
-         sp_build_depth_stencil( sp, i );
-         sp_push_quad_first( sp, sp->quad[i].earlyz, i );
-      }
-
-#if !USE_DRAW_STAGE_PSTIPPLE
-      if (sp->rasterizer->poly_stipple_enable) {
-         sp_push_quad_first( sp, sp->quad[i].polygon_stipple, i );
-      }
-#endif
-   }
-}
-
index 08513cb95f1633b86d711dcfcd2cc3a241d819a2..bd6c6cb912347b466b22dd853d8ed78d37d4f21c 100644 (file)
 #ifndef SP_QUAD_H
 #define SP_QUAD_H
 
+#include "pipe/p_state.h"
+#include "tgsi/tgsi_exec.h"
 
-struct softpipe_context;
-struct quad_header;
 
+#define QUAD_PRIM_POINT 1
+#define QUAD_PRIM_LINE  2
+#define QUAD_PRIM_TRI   3
 
-struct quad_stage {
-   struct softpipe_context *softpipe;
 
-   struct quad_stage *next;
+/* The rasterizer generates 2x2 quads of fragment and feeds them to
+ * the current fp_machine (see below).
+ * Remember that Y=0=top with Y increasing down the window.
+ */
+#define QUAD_TOP_LEFT     0
+#define QUAD_TOP_RIGHT    1
+#define QUAD_BOTTOM_LEFT  2
+#define QUAD_BOTTOM_RIGHT 3
+
+#define MASK_TOP_LEFT     (1 << QUAD_TOP_LEFT)
+#define MASK_TOP_RIGHT    (1 << QUAD_TOP_RIGHT)
+#define MASK_BOTTOM_LEFT  (1 << QUAD_BOTTOM_LEFT)
+#define MASK_BOTTOM_RIGHT (1 << QUAD_BOTTOM_RIGHT)
+#define MASK_ALL          0xf
+
+
+/**
+ * Quad stage inputs (pos, coverage, front/back face, etc)
+ */
+struct quad_header_input
+{
+   int x0, y0;                /**< quad window pos, always even */
+   float coverage[QUAD_SIZE]; /**< fragment coverage for antialiasing */
+   unsigned facing:1;         /**< Front (0) or back (1) facing? */
+   unsigned prim:2;           /**< QUAD_PRIM_POINT, LINE, TRI */
+};
 
-   void (*begin)(struct quad_stage *qs);
 
-   /** the stage action */
-   void (*run)(struct quad_stage *qs, struct quad_header *quad);
+/**
+ * Quad stage inputs/outputs.
+ */
+struct quad_header_inout
+{
+   unsigned mask:4;
+};
+
 
-   void (*destroy)(struct quad_stage *qs);
+/**
+ * Quad stage outputs (color & depth).
+ */
+struct quad_header_output
+{
+   /** colors in SOA format (rrrr, gggg, bbbb, aaaa) */
+   float color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS][QUAD_SIZE];
+   float depth[QUAD_SIZE];
 };
 
 
-struct quad_stage *sp_quad_polygon_stipple_stage( struct softpipe_context *softpipe );
-struct quad_stage *sp_quad_earlyz_stage( struct softpipe_context *softpipe );
-struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe );
-struct quad_stage *sp_quad_alpha_test_stage( struct softpipe_context *softpipe );
-struct quad_stage *sp_quad_stencil_test_stage( struct softpipe_context *softpipe );
-struct quad_stage *sp_quad_depth_test_stage( struct softpipe_context *softpipe );
-struct quad_stage *sp_quad_occlusion_stage( struct softpipe_context *softpipe );
-struct quad_stage *sp_quad_coverage_stage( struct softpipe_context *softpipe );
-struct quad_stage *sp_quad_blend_stage( struct softpipe_context *softpipe );
-struct quad_stage *sp_quad_colormask_stage( struct softpipe_context *softpipe );
-struct quad_stage *sp_quad_output_stage( struct softpipe_context *softpipe );
+/**
+ * Encodes everything we need to know about a 2x2 pixel block.  Uses
+ * "Channel-Serial" or "SoA" layout.  
+ */
+struct quad_header {
+   struct quad_header_input input;
+   struct quad_header_inout inout;
+   struct quad_header_output output;
 
-void sp_build_quad_pipeline(struct softpipe_context *sp);
+   const struct tgsi_interp_coef *coef;
+   const struct tgsi_interp_coef *posCoef;
 
-void sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad);
+   unsigned nr_attrs;
+};
 
 #endif /* SP_QUAD_H */
index 85c9f037a3ccd2d151ac265d4d4c793deea32409..0845bae0e687207f86b57d61e2928ac9e264cb95 100644 (file)
@@ -4,8 +4,8 @@
  */
 
 #include "sp_context.h"
-#include "sp_headers.h"
 #include "sp_quad.h"
+#include "sp_quad_pipe.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 
index fb1d430a4f2651dc8577a6f882c787568ec5b780..e134e443374c78f706fce112ce41ec108e33b689 100644 (file)
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "sp_context.h"
-#include "sp_headers.h"
+#include "sp_quad.h"
 #include "sp_surface.h"
 #include "sp_tile_cache.h"
-#include "sp_quad.h"
+#include "sp_quad_pipe.h"
 
 
 #define VEC4_COPY(DST, SRC) \
index d7d6a6974d3e97377e9eca621057917d08494d53..953d8516b90555f840adf44079d26249d4525f8b 100644 (file)
@@ -1,9 +1,9 @@
 
 #include "util/u_memory.h"
 #include "sp_context.h"
-#include "sp_headers.h"
-#include "sp_surface.h"
 #include "sp_quad.h"
+#include "sp_surface.h"
+#include "sp_quad_pipe.h"
 
 
 /**
index 563c2fc739dd458f2354d0724d67cd3d14c6b625..dc90e5d5e996bc91dfd04031e381b78e7c65dda1 100644 (file)
@@ -34,9 +34,9 @@
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "sp_context.h"
-#include "sp_headers.h"
-#include "sp_surface.h"
 #include "sp_quad.h"
+#include "sp_surface.h"
+#include "sp_quad_pipe.h"
 #include "sp_tile_cache.h"
 
 
index c27fd1482da8b66e80f796e7c1c57989a6fff2a5..4aeee858705184736b49011db46fd358c0d7c0e2 100644 (file)
@@ -35,8 +35,8 @@
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 #include "sp_context.h"
-#include "sp_headers.h"
 #include "sp_quad.h"
+#include "sp_quad_pipe.h"
 
 
 /**
@@ -46,10 +46,11 @@ static void
 coverage_quad(struct quad_stage *qs, struct quad_header *quad)
 {
    struct softpipe_context *softpipe = qs->softpipe;
+   const uint prim = quad->input.prim;
 
-   if ((softpipe->rasterizer->poly_smooth && quad->input.prim == PRIM_TRI) ||
-       (softpipe->rasterizer->line_smooth && quad->input.prim == PRIM_LINE) ||
-       (softpipe->rasterizer->point_smooth && quad->input.prim == PRIM_POINT)) {
+   if ((softpipe->rasterizer->poly_smooth && prim == QUAD_PRIM_TRI) ||
+       (softpipe->rasterizer->line_smooth && prim == QUAD_PRIM_LINE) ||
+       (softpipe->rasterizer->point_smooth && prim == QUAD_PRIM_POINT)) {
       uint cbuf;
 
       /* loop over colorbuffer outputs */
index 523bd3e08015665b8cc87b43de411ea19294c157..d463930bae10d6f52cc12279f874b31b05a6ca27 100644 (file)
@@ -32,9 +32,9 @@
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 #include "sp_context.h"
-#include "sp_headers.h"
-#include "sp_surface.h"
 #include "sp_quad.h"
+#include "sp_surface.h"
+#include "sp_quad_pipe.h"
 #include "sp_tile_cache.h"
 
 
index 6e2dde304ea1f59b3d6be94cc5fb9b9b48f0757a..496fd39ed1ac399b48b2dc80828ce5ba3f9e18f2 100644 (file)
@@ -31,8 +31,8 @@
 
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
-#include "sp_headers.h"
 #include "sp_quad.h"
+#include "sp_quad_pipe.h"
 
 
 /**
index 5dacbbe55f8cd29aabbebcce798f288e51e081dd..adca5df73d8eefa6c19ef7e1ce42cad1f3c9ca8f 100644 (file)
@@ -43,8 +43,8 @@
 
 #include "sp_context.h"
 #include "sp_state.h"
-#include "sp_headers.h"
 #include "sp_quad.h"
+#include "sp_quad_pipe.h"
 #include "sp_texture.h"
 #include "sp_tex_sample.h"
 
index 169bd82876daee035bb4a80d9341a84ef2785c88..dfa7ff3b1d17d6fe0f2d473c87ab600e817af336 100644 (file)
@@ -35,9 +35,9 @@
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 #include "sp_context.h"
-#include "sp_headers.h"
-#include "sp_surface.h"
 #include "sp_quad.h"
+#include "sp_surface.h"
+#include "sp_quad_pipe.h"
 
 static unsigned count_bits( unsigned val )
 {
index a37c8b4c39745a1616b5a0462b9f64787040b447..92d5f9f3c1a9c26f00b71d4b0e13004cc5da6c6d 100644 (file)
@@ -27,9 +27,9 @@
 
 #include "util/u_memory.h"
 #include "sp_context.h"
-#include "sp_headers.h"
-#include "sp_surface.h"
 #include "sp_quad.h"
+#include "sp_surface.h"
+#include "sp_quad_pipe.h"
 #include "sp_tile_cache.h"
 
 
diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.c b/src/gallium/drivers/softpipe/sp_quad_pipe.c
new file mode 100644 (file)
index 0000000..892ef87
--- /dev/null
@@ -0,0 +1,118 @@
+/**************************************************************************
+ * 
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+
+#include "sp_context.h"
+#include "sp_state.h"
+#include "pipe/p_shader_tokens.h"
+
+static void
+sp_push_quad_first(
+   struct softpipe_context *sp,
+   struct quad_stage *quad,
+   uint i )
+{
+   quad->next = sp->quad[i].first;
+   sp->quad[i].first = quad;
+}
+
+static void
+sp_build_depth_stencil(
+   struct softpipe_context *sp,
+   uint i )
+{
+   if (sp->depth_stencil->stencil[0].enabled ||
+       sp->depth_stencil->stencil[1].enabled) {
+      sp_push_quad_first( sp, sp->quad[i].stencil_test, i );
+   }
+   else if (sp->depth_stencil->depth.enabled &&
+            sp->framebuffer.zsbuf) {
+      sp_push_quad_first( sp, sp->quad[i].depth_test, i );
+   }
+}
+
+void
+sp_build_quad_pipeline(struct softpipe_context *sp)
+{
+   uint i;
+
+   boolean early_depth_test =
+               sp->depth_stencil->depth.enabled &&
+               sp->framebuffer.zsbuf &&
+               !sp->depth_stencil->alpha.enabled &&
+               !sp->fs->info.uses_kill &&
+               !sp->fs->info.writes_z;
+
+   /* build up the pipeline in reverse order... */
+   for (i = 0; i < SP_NUM_QUAD_THREADS; i++) {
+      sp->quad[i].first = sp->quad[i].output;
+
+      if (sp->blend->colormask != 0xf) {
+         sp_push_quad_first( sp, sp->quad[i].colormask, i );
+      }
+
+      if (sp->blend->blend_enable ||
+          sp->blend->logicop_enable) {
+         sp_push_quad_first( sp, sp->quad[i].blend, i );
+      }
+
+      if (sp->depth_stencil->depth.occlusion_count) {
+         sp_push_quad_first( sp, sp->quad[i].occlusion, i );
+      }
+
+      if (sp->rasterizer->poly_smooth ||
+          sp->rasterizer->line_smooth ||
+          sp->rasterizer->point_smooth) {
+         sp_push_quad_first( sp, sp->quad[i].coverage, i );
+      }
+
+      if (!early_depth_test) {
+         sp_build_depth_stencil( sp, i );
+      }
+
+      if (sp->depth_stencil->alpha.enabled) {
+         sp_push_quad_first( sp, sp->quad[i].alpha_test, i );
+      }
+
+      /* XXX always enable shader? */
+      if (1) {
+         sp_push_quad_first( sp, sp->quad[i].shade, i );
+      }
+
+      if (early_depth_test) {
+         sp_build_depth_stencil( sp, i );
+         sp_push_quad_first( sp, sp->quad[i].earlyz, i );
+      }
+
+#if !USE_DRAW_STAGE_PSTIPPLE
+      if (sp->rasterizer->poly_stipple_enable) {
+         sp_push_quad_first( sp, sp->quad[i].polygon_stipple, i );
+      }
+#endif
+   }
+}
+
diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.h b/src/gallium/drivers/softpipe/sp_quad_pipe.h
new file mode 100644 (file)
index 0000000..0e40586
--- /dev/null
@@ -0,0 +1,74 @@
+/**************************************************************************
+ * 
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+/* Authors:  Keith Whitwell <keith@tungstengraphics.com>
+ */
+
+#ifndef SP_QUAD_PIPE_H
+#define SP_QUAD_PIPE_H
+
+
+struct softpipe_context;
+struct quad_header;
+
+
+/**
+ * Fragment processing is performed on 2x2 blocks of pixels called "quads".
+ * Quad processing is performed with a pipeline of stages represented by
+ * this type.
+ */
+struct quad_stage {
+   struct softpipe_context *softpipe;
+
+   struct quad_stage *next;
+
+   void (*begin)(struct quad_stage *qs);
+
+   /** the stage action */
+   void (*run)(struct quad_stage *qs, struct quad_header *quad);
+
+   void (*destroy)(struct quad_stage *qs);
+};
+
+
+struct quad_stage *sp_quad_polygon_stipple_stage( struct softpipe_context *softpipe );
+struct quad_stage *sp_quad_earlyz_stage( struct softpipe_context *softpipe );
+struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe );
+struct quad_stage *sp_quad_alpha_test_stage( struct softpipe_context *softpipe );
+struct quad_stage *sp_quad_stencil_test_stage( struct softpipe_context *softpipe );
+struct quad_stage *sp_quad_depth_test_stage( struct softpipe_context *softpipe );
+struct quad_stage *sp_quad_occlusion_stage( struct softpipe_context *softpipe );
+struct quad_stage *sp_quad_coverage_stage( struct softpipe_context *softpipe );
+struct quad_stage *sp_quad_blend_stage( struct softpipe_context *softpipe );
+struct quad_stage *sp_quad_colormask_stage( struct softpipe_context *softpipe );
+struct quad_stage *sp_quad_output_stage( struct softpipe_context *softpipe );
+
+void sp_build_quad_pipeline(struct softpipe_context *sp);
+
+void sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad);
+
+#endif /* SP_QUAD_PIPE_H */
index 7495515764a4cf86a14b7d9715e645a21346062b..5e9d447737d0c3c17bf5f1a9fcd4bb5dd0ed2eb4 100644 (file)
@@ -5,10 +5,10 @@
 
 
 #include "sp_context.h"
-#include "sp_headers.h"
+#include "sp_quad.h"
 #include "sp_surface.h"
 #include "sp_tile_cache.h"
-#include "sp_quad.h"
+#include "sp_quad_pipe.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 
index ccf37f6be59dd56d9167ba8d9a893e151dece36e..05e862f0977bf41d4aeeda47f39a04ddad3a71cd 100644 (file)
@@ -4,8 +4,8 @@
  */
 
 #include "sp_context.h"
-#include "sp_headers.h"
 #include "sp_quad.h"
+#include "sp_quad_pipe.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 
@@ -19,11 +19,13 @@ stipple_quad(struct quad_stage *qs, struct quad_header *quad)
    static const uint bit31 = 1 << 31;
    static const uint bit30 = 1 << 30;
 
-   if (quad->input.prim == PRIM_TRI) {
+   if (quad->input.prim == QUAD_PRIM_TRI) {
       struct softpipe_context *softpipe = qs->softpipe;
       /* need to invert Y to index into OpenGL's stipple pattern */
       int y0, y1;
       uint stipple0, stipple1;
+      const int col0 = quad->input.x0 % 32;
+
       if (softpipe->rasterizer->origin_lower_left) {
          y0 = softpipe->framebuffer.height - 1 - quad->input.y0;
          y1 = y0 - 1;
@@ -32,12 +34,11 @@ stipple_quad(struct quad_stage *qs, struct quad_header *quad)
          y0 = quad->input.y0;
          y1 = y0 + 1;
       }
+
       stipple0 = softpipe->poly_stipple.stipple[y0 % 32];
       stipple1 = softpipe->poly_stipple.stipple[y1 % 32];
 
-#if 1
-      {
-      const int col0 = quad->input.x0 % 32;
+      /* turn off quad mask bits that fail the stipple test */
       if ((stipple0 & (bit31 >> col0)) == 0)
          quad->inout.mask &= ~MASK_TOP_LEFT;
 
@@ -49,19 +50,11 @@ stipple_quad(struct quad_stage *qs, struct quad_header *quad)
 
       if ((stipple1 & (bit30 >> col0)) == 0)
          quad->inout.mask &= ~MASK_BOTTOM_RIGHT;
-      }
-#else
-      /* We'd like to use this code, but we'd need to redefine
-       * MASK_TOP_LEFT to be (1 << 1) and MASK_TOP_RIGHT to be (1 << 0),
-       * and similarly for the BOTTOM bits.  But that may have undesirable
-       * side effects elsewhere.
-       */
-      const int col0 = 30 - (quad->input.x0 % 32);
-      quad->inout.mask &= (((stipple0 >> col0) & 0x3) | 
-                     (((stipple1 >> col0) & 0x3) << 2));
-#endif
-      if (!quad->inout.mask)
+
+      if (!quad->inout.mask) {
+         /* all fragments failed stipple test, end of quad pipeline */
          return;
+      }
    }
 
    qs->next->run(qs->next, quad);
index b0d8e01426d185087b2d28b61bbe9b2eb74f51d2..93dab236d6609ceec27ca35a58cfaee9bd0a3c6b 100644 (file)
@@ -31,7 +31,6 @@
 
 #include "draw/draw_context.h"
 #include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
 #include "util/u_memory.h"
 #include "sp_context.h"
 #include "sp_query.h"
index b1adb9cb7a2199fe09a59a98ab3d32801ed1e3fa..0925653b5d54234e496e2d799e80f0e7228233d2 100644 (file)
  * \author  Brian Paul
  */
 
-#include "sp_setup.h"
-
 #include "sp_context.h"
-#include "sp_headers.h"
+#include "sp_prim_setup.h"
 #include "sp_quad.h"
+#include "sp_quad_pipe.h"
+#include "sp_setup.h"
 #include "sp_state.h"
-#include "sp_prim_setup.h"
 #include "draw/draw_context.h"
 #include "draw/draw_private.h"
 #include "draw/draw_vertex.h"
@@ -265,17 +264,20 @@ is_inf_or_nan(float x)
 }
 
 
-static boolean cull_tri( struct setup_context *setup,
-                     float det )
+/**
+ * Do triangle cull test using tri determinant (sign indicates orientation)
+ * \return true if triangle is to be culled.
+ */
+static INLINE boolean
+cull_tri(const struct setup_context *setup, float det)
 {
-   if (det != 0) 
-   {   
+   if (det != 0) {   
       /* if (det < 0 then Z points toward camera and triangle is 
        * counter-clockwise winding.
        */
       unsigned winding = (det < 0) ? PIPE_WINDING_CCW : PIPE_WINDING_CW;
-      
-      if ((winding & setup->winding) == 0) 
+
+      if ((winding & setup->winding) == 0)
         return FALSE;
    }
 
@@ -968,7 +970,7 @@ void setup_tri( struct setup_context *setup,
    setup_tri_coefficients( setup );
    setup_tri_edges( setup );
 
-   setup->quad.input.prim = PRIM_TRI;
+   setup->quad.input.prim = QUAD_PRIM_TRI;
 
    setup->span.y = 0;
    setup->span.y_flags = 0;
@@ -1009,7 +1011,7 @@ void setup_tri( struct setup_context *setup,
  * for a line.
  */
 static void
-line_linear_coeff(struct setup_context *setup,
+line_linear_coeff(const struct setup_context *setup,
                   struct tgsi_interp_coef *coef,
                   uint vertSlot, uint i)
 {
@@ -1029,9 +1031,9 @@ line_linear_coeff(struct setup_context *setup,
  * for a line.
  */
 static void
-line_persp_coeff(struct setup_context *setup,
-                  struct tgsi_interp_coef *coef,
-                  uint vertSlot, uint i)
+line_persp_coeff(const struct setup_context *setup,
+                 struct tgsi_interp_coef *coef,
+                 uint vertSlot, uint i)
 {
    /* XXX double-check/verify this arithmetic */
    const float a0 = setup->vmin[vertSlot][i] * setup->vmin[0][3];
@@ -1206,7 +1208,7 @@ setup_line(struct setup_context *setup,
 
    setup->quad.input.x0 = setup->quad.input.y0 = -1;
    setup->quad.inout.mask = 0x0;
-   setup->quad.input.prim = PRIM_LINE;
+   setup->quad.input.prim = QUAD_PRIM_LINE;
    /* XXX temporary: set coverage to 1.0 so the line appears
     * if AA mode happens to be enabled.
     */
@@ -1266,7 +1268,7 @@ setup_line(struct setup_context *setup,
 
 
 static void
-point_persp_coeff(struct setup_context *setup,
+point_persp_coeff(const struct setup_context *setup,
                   const float (*vert)[4],
                   struct tgsi_interp_coef *coef,
                   uint vertSlot, uint i)
@@ -1361,7 +1363,7 @@ setup_point( struct setup_context *setup,
       }
    }
 
-   setup->quad.input.prim = PRIM_POINT;
+   setup->quad.input.prim = QUAD_PRIM_POINT;
 
    if (halfSize <= 0.5 && !round) {
       /* special case for 1-pixel points */
index 3eff41ffa5f757546bcafc490b3619453ccfbf3a..9776e978e3e8f9e40027b2cbfd08c1f81fc4d584 100644 (file)
@@ -85,7 +85,7 @@ struct sp_fragment_shader {
 
 /** Subclass of pipe_shader_state */
 struct sp_vertex_shader {
-   struct pipe_shader_state shader;  /* Note: this field not actually used */
+   struct pipe_shader_state shader;
    struct draw_vertex_shader *draw_data;
 };
 
@@ -184,10 +184,10 @@ softpipe_set_edgeflags(struct pipe_context *pipe, const unsigned *edgeflags);
 
 
 void
-softpipe_map_surfaces(struct softpipe_context *sp);
+softpipe_map_transfers(struct softpipe_context *sp);
 
 void
-softpipe_unmap_surfaces(struct softpipe_context *sp);
+softpipe_unmap_transfers(struct softpipe_context *sp);
 
 void
 softpipe_map_texture_surfaces(struct softpipe_context *sp);
index 4d01a9dbe15fa7ff66a4cb88c74ac9c8d06e1708..4330c2039356f45e3027b71321fe27642c26cf40 100644 (file)
 
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
-#include "pipe/p_inlines.h"
 #include "pipe/internal/p_winsys_screen.h"
 #include "pipe/p_shader_tokens.h"
 #include "draw/draw_context.h"
 #include "tgsi/tgsi_dump.h"
 #include "tgsi/tgsi_scan.h"
+#include "tgsi/tgsi_parse.h"
 
 
 void *
@@ -98,17 +98,28 @@ softpipe_create_vs_state(struct pipe_context *pipe,
    struct sp_vertex_shader *state;
 
    state = CALLOC_STRUCT(sp_vertex_shader);
-   if (state == NULL ) {
-      return NULL;
-   }
+   if (state == NULL ) 
+      goto fail;
+
+   /* copy shader tokens, the ones passed in will go away.
+    */
+   state->shader.tokens = tgsi_dup_tokens(templ->tokens);
+   if (state->shader.tokens == NULL)
+      goto fail;
 
    state->draw_data = draw_create_vertex_shader(softpipe->draw, templ);
-   if (state->draw_data == NULL) {
-      FREE( state );
-      return NULL;
-   }
+   if (state->draw_data == NULL) 
+      goto fail;
 
    return state;
+
+fail:
+   if (state) {
+      FREE( (void *)state->shader.tokens );
+      FREE( state->draw_data );
+      FREE( state );
+   }
+   return NULL;
 }
 
 
@@ -146,14 +157,12 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
                              const struct pipe_constant_buffer *buf)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
-   struct pipe_screen *screen = pipe->screen;
 
    assert(shader < PIPE_SHADER_TYPES);
    assert(index == 0);
 
    /* note: reference counting */
-   pipe_buffer_reference(screen,
-                        &softpipe->constants[shader].buffer,
+   pipe_buffer_reference(&softpipe->constants[shader].buffer,
                         buf ? buf->buffer : NULL);
 
    softpipe->dirty |= SP_NEW_CONSTANTS;
index 99a28c0d7e03a8ba487901ec8ad059ab4b4c634c..cb517b02e440049194b5c7551a39dba73b97fe53 100644 (file)
@@ -30,7 +30,6 @@
  */
 
 #include "util/u_memory.h"
-#include "pipe/p_inlines.h"
 
 #include "draw/draw_context.h"
 
index 1493c65884142253eb63ab9452e730d4a7962542..7c06d864a75edb12c7009396a9c9847566338b48 100644 (file)
@@ -27,7 +27,6 @@
 
 /* Authors:  Keith Whitwell <keith@tungstengraphics.com>
  */
-#include "pipe/p_inlines.h"
 
 #include "sp_context.h"
 #include "sp_state.h"
index 6ade7326982f3be59e09ea33bbdfcc819e64a86f..ef04843f1721352c21c55088689d443ab2ee7ed3 100644 (file)
 #include "sp_context.h"
 
 
+static void
+sp_surface_copy(struct pipe_context *pipe,
+                struct pipe_surface *dest, unsigned destx, unsigned desty,
+                struct pipe_surface *src, unsigned srcx, unsigned srcy,
+                unsigned width, unsigned height)
+{
+   util_surface_copy(pipe, FALSE,
+                     dest, destx, desty,
+                     src, srcx, srcy,
+                     width, height);
+}
 
 void
 sp_init_surface_functions(struct softpipe_context *sp)
 {
-   sp->pipe.surface_copy = util_surface_copy;
+   sp->pipe.surface_copy = sp_surface_copy;
    sp->pipe.surface_fill = util_surface_fill;
 }
index 32aa5025e43251757745baee4604df5d77fcce6d..adbd0cb7f0c18a9e8b9e482c0607af3f75e1ac40 100644 (file)
@@ -34,7 +34,7 @@
  */
 
 #include "sp_context.h"
-#include "sp_headers.h"
+#include "sp_quad.h"
 #include "sp_surface.h"
 #include "sp_texture.h"
 #include "sp_tex_sample.h"
index 3eed0d0d2934d024574b88dd7c922a26b7b03f32..48b2c22af45bb0c1585444d74d47f7c80fbef63f 100644 (file)
@@ -59,7 +59,6 @@ static boolean
 softpipe_texture_layout(struct pipe_screen *screen,
                         struct softpipe_texture * spt)
 {
-   struct pipe_winsys *ws = screen->winsys;
    struct pipe_texture *pt = &spt->base;
    unsigned level;
    unsigned width = pt->width[0];
@@ -87,9 +86,9 @@ softpipe_texture_layout(struct pipe_screen *screen,
       depth = minify(depth);
    }
 
-   spt->buffer = ws->buffer_create(ws, 32,
-                                   PIPE_BUFFER_USAGE_PIXEL,
-                                   buffer_size);
+   spt->buffer = screen->buffer_create(screen, 32,
+                                       PIPE_BUFFER_USAGE_PIXEL,
+                                       buffer_size);
 
    return spt->buffer != NULL;
 }
@@ -98,19 +97,18 @@ static boolean
 softpipe_displaytarget_layout(struct pipe_screen *screen,
                               struct softpipe_texture * spt)
 {
-   struct pipe_winsys *ws = screen->winsys;
    unsigned usage = (PIPE_BUFFER_USAGE_CPU_READ_WRITE |
                      PIPE_BUFFER_USAGE_GPU_READ_WRITE);
 
    spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]);  
    spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);  
 
-   spt->buffer = ws->surface_buffer_create( ws
-                                            spt->base.width[0], 
-                                            spt->base.height[0],
-                                            spt->base.format,
-                                            usage,
-                                            &spt->stride[0]);
+   spt->buffer = screen->surface_buffer_create( screen
+                                                spt->base.width[0], 
+                                                spt->base.height[0],
+                                                spt->base.format,
+                                                usage,
+                                                &spt->stride[0]);
 
    return spt->buffer != NULL;
 }
@@ -128,7 +126,7 @@ softpipe_texture_create(struct pipe_screen *screen,
       return NULL;
 
    spt->base = *templat;
-   spt->base.refcount = 1;
+   pipe_reference_init(&spt->base.reference, 1);
    spt->base.screen = screen;
 
    if (spt->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) {
@@ -140,7 +138,7 @@ softpipe_texture_create(struct pipe_screen *screen,
          goto fail;
    }
     
-   assert(spt->base.refcount == 1);
+   assert(p_atomic_read(&spt->base.reference.count) == 1);
    return &spt->base;
 
  fail:
@@ -170,32 +168,25 @@ softpipe_texture_blanket(struct pipe_screen * screen,
       return NULL;
 
    spt->base = *base;
-   spt->base.refcount = 1;
+   pipe_reference_init(&spt->base.reference, 1);
    spt->base.screen = screen;
    spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]);  
    spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);  
    spt->stride[0] = stride[0];
 
-   pipe_buffer_reference(screen, &spt->buffer, buffer);
+   pipe_buffer_reference(&spt->buffer, buffer);
 
    return &spt->base;
 }
 
 
 static void
-softpipe_texture_release(struct pipe_screen *screen,
-                         struct pipe_texture **pt)
+softpipe_texture_destroy(struct pipe_texture *pt)
 {
-   if (!*pt)
-      return;
-
-   if (--(*pt)->refcount <= 0) {
-      struct softpipe_texture *spt = softpipe_texture(*pt);
+   struct softpipe_texture *spt = softpipe_texture(pt);
 
-      pipe_buffer_reference(screen, &spt->buffer, NULL);
-      FREE(spt);
-   }
-   *pt = NULL;
+   pipe_buffer_reference(&spt->buffer, NULL);
+   FREE(spt);
 }
 
 
@@ -212,15 +203,11 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
 
    ps = CALLOC_STRUCT(pipe_surface);
    if (ps) {
-      ps->refcount = 1;
+      pipe_reference_init(&ps->reference, 1);
       pipe_texture_reference(&ps->texture, pt);
       ps->format = pt->format;
-      ps->block = pt->block;
       ps->width = pt->width[level];
       ps->height = pt->height[level];
-      ps->nblocksx = pt->nblocksx[level];
-      ps->nblocksy = pt->nblocksy[level];
-      ps->stride = spt->stride[level];
       ps->offset = spt->level_offset[level];
       ps->usage = usage;
 
@@ -247,10 +234,11 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
       ps->level = level;
       ps->zslice = zslice;
 
-      if (pt->target == PIPE_TEXTURE_CUBE || pt->target == PIPE_TEXTURE_3D) {
-         ps->offset += ((pt->target == PIPE_TEXTURE_CUBE) ? face : zslice) *
-            ps->nblocksy *
-            ps->stride;
+      if (pt->target == PIPE_TEXTURE_CUBE) {
+         ps->offset += face * pt->nblocksy[level] * spt->stride[level];
+      }
+      else if (pt->target == PIPE_TEXTURE_3D) {
+         ps->offset += zslice * pt->nblocksy[level] * spt->stride[level];
       }
       else {
          assert(face == 0);
@@ -262,38 +250,99 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
 
 
 static void 
-softpipe_tex_surface_release(struct pipe_screen *screen, 
-                             struct pipe_surface **s)
+softpipe_tex_surface_destroy(struct pipe_surface *surf)
 {
-   struct pipe_surface *surf = *s;
    /* Effectively do the texture_update work here - if texture images
     * needed post-processing to put them into hardware layout, this is
     * where it would happen.  For softpipe, nothing to do.
     */
    assert(surf->texture);
-   if (--surf->refcount == 0) {
-      pipe_texture_reference(&surf->texture, NULL);
-      FREE(surf);
+   pipe_texture_reference(&surf->texture, NULL);
+   FREE(surf);
+}
+
+
+static struct pipe_transfer *
+softpipe_get_tex_transfer(struct pipe_screen *screen,
+                          struct pipe_texture *texture,
+                          unsigned face, unsigned level, unsigned zslice,
+                          enum pipe_transfer_usage usage,
+                          unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   struct softpipe_texture *sptex = softpipe_texture(texture);
+   struct softpipe_transfer *spt;
+
+   assert(texture);
+   assert(level <= texture->last_level);
+
+   spt = CALLOC_STRUCT(softpipe_transfer);
+   if (spt) {
+      struct pipe_transfer *pt = &spt->base;
+      pipe_texture_reference(&pt->texture, texture);
+      pt->format = texture->format;
+      pt->block = texture->block;
+      pt->x = x;
+      pt->y = y;
+      pt->width = w;
+      pt->height = h;
+      pt->nblocksx = texture->nblocksx[level];
+      pt->nblocksy = texture->nblocksy[level];
+      pt->stride = sptex->stride[level];
+      pt->usage = usage;
+      pt->face = face;
+      pt->level = level;
+      pt->zslice = zslice;
+
+      spt->offset = sptex->level_offset[level];
+
+      if (texture->target == PIPE_TEXTURE_CUBE) {
+         spt->offset += face * pt->nblocksy * pt->stride;
+      }
+      else if (texture->target == PIPE_TEXTURE_3D) {
+         spt->offset += zslice * pt->nblocksy * pt->stride;
+      }
+      else {
+         assert(face == 0);
+         assert(zslice == 0);
+      }
+      return pt;
    }
-   *s = NULL;
+   return NULL;
+}
+
+
+static void 
+softpipe_tex_transfer_destroy(struct pipe_transfer *transfer)
+{
+   /* Effectively do the texture_update work here - if texture images
+    * needed post-processing to put them into hardware layout, this is
+    * where it would happen.  For softpipe, nothing to do.
+    */
+   assert (transfer->texture);
+   pipe_texture_reference(&transfer->texture, NULL);
+   FREE(transfer);
 }
 
 
 static void *
-softpipe_surface_map( struct pipe_screen *screen,
-                      struct pipe_surface *surface,
-                      unsigned flags )
+softpipe_transfer_map( struct pipe_screen *screen,
+                       struct pipe_transfer *transfer )
 {
    ubyte *map;
    struct softpipe_texture *spt;
+   unsigned flags = 0;
 
-   if (flags & ~surface->usage) {
-      assert(0);
-      return NULL;
+   assert(transfer->texture);
+   spt = softpipe_texture(transfer->texture);
+
+   if (transfer->usage != PIPE_TRANSFER_READ) {
+      flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
+   }
+
+   if (transfer->usage != PIPE_TRANSFER_WRITE) {
+      flags |= PIPE_BUFFER_USAGE_CPU_READ;
    }
 
-   assert(surface->texture);
-   spt = softpipe_texture(surface->texture);
    map = pipe_buffer_map(screen, spt->buffer, flags);
    if (map == NULL)
       return NULL;
@@ -301,8 +350,7 @@ softpipe_surface_map( struct pipe_screen *screen,
    /* May want to different things here depending on read/write nature
     * of the map:
     */
-   if (surface->texture &&
-       (flags & PIPE_BUFFER_USAGE_CPU_WRITE)) 
+   if (transfer->texture && transfer->usage != PIPE_TRANSFER_READ) 
    {
       /* Do something to notify sharing contexts of a texture change.
        * In softpipe, that would mean flushing the texture cache.
@@ -310,18 +358,20 @@ softpipe_surface_map( struct pipe_screen *screen,
       softpipe_screen(screen)->timestamp++;
    }
    
-   return map + surface->offset;
+   return map + softpipe_transfer(transfer)->offset +
+      transfer->y / transfer->block.height * transfer->stride +
+      transfer->x / transfer->block.width * transfer->block.size;
 }
 
 
 static void
-softpipe_surface_unmap(struct pipe_screen *screen,
-                       struct pipe_surface *surface)
+softpipe_transfer_unmap(struct pipe_screen *screen,
+                       struct pipe_transfer *transfer)
 {
    struct softpipe_texture *spt;
 
-   assert(surface->texture);
-   spt = softpipe_texture(surface->texture);
+   assert(transfer->texture);
+   spt = softpipe_texture(transfer->texture);
 
    pipe_buffer_unmap( screen, spt->buffer );
 }
@@ -338,11 +388,13 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
 {
    screen->texture_create = softpipe_texture_create;
    screen->texture_blanket = softpipe_texture_blanket;
-   screen->texture_release = softpipe_texture_release;
+   screen->texture_destroy = softpipe_texture_destroy;
 
    screen->get_tex_surface = softpipe_get_tex_surface;
-   screen->tex_surface_release = softpipe_tex_surface_release;
+   screen->tex_surface_destroy = softpipe_tex_surface_destroy;
 
-   screen->surface_map = softpipe_surface_map;
-   screen->surface_unmap = softpipe_surface_unmap;
+   screen->get_tex_transfer = softpipe_get_tex_transfer;
+   screen->tex_transfer_destroy = softpipe_tex_transfer_destroy;
+   screen->transfer_map = softpipe_transfer_map;
+   screen->transfer_unmap = softpipe_transfer_unmap;
 }
index c1636920cd60affef7d10f273aa9d1e56079dbb8..893aa7d11d81e3fa8d6d014a5bf8cd4b9ce8434f 100644 (file)
@@ -51,14 +51,27 @@ struct softpipe_texture
    boolean modified;
 };
 
+struct softpipe_transfer
+{
+   struct pipe_transfer base;
+
+   unsigned long offset;
+};
+
 
-/** cast wrapper */
+/** cast wrappers */
 static INLINE struct softpipe_texture *
 softpipe_texture(struct pipe_texture *pt)
 {
    return (struct softpipe_texture *) pt;
 }
 
+static INLINE struct softpipe_transfer *
+softpipe_transfer(struct pipe_transfer *pt)
+{
+   return (struct softpipe_transfer *) pt;
+}
+
 
 extern void
 softpipe_init_texture_funcs( struct softpipe_context *softpipe );
index ab76009375c9d62156b80e0c75f6acf903fb9bbd..69292753f133ec2f3a1667e56401f52fa52ed482 100644 (file)
@@ -26,7 +26,7 @@
  **************************************************************************/
 
 /**
- * Framebuffer/surface tile caching.
+ * Texture tile caching.
  *
  * Author:
  *    Brian Paul
@@ -40,7 +40,7 @@
 #include "sp_texture.h"
 #include "sp_tile_cache.h"
 
-#define NUM_ENTRIES 32
+#define NUM_ENTRIES 50
 
 
 /** XXX move these */
@@ -52,7 +52,8 @@ struct softpipe_tile_cache
 {
    struct pipe_screen *screen;
    struct pipe_surface *surface;  /**< the surface we're caching */
-   void *surface_map;
+   struct pipe_transfer *transfer;
+   void *transfer_map;
    struct pipe_texture *texture;  /**< if caching a texture */
    struct softpipe_cached_tile entries[NUM_ENTRIES];
    uint clear_flags[(MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32];
@@ -60,8 +61,8 @@ struct softpipe_tile_cache
    uint clear_val;
    boolean depth_stencil; /** Is the surface a depth/stencil format? */
 
-   struct pipe_surface *tex_surf;
-   void *tex_surf_map;
+   struct pipe_transfer *tex_trans;
+   void *tex_trans_map;
    int tex_face, tex_level, tex_z;
 
    struct softpipe_cached_tile tile;  /**< scratch tile for clears */
@@ -131,16 +132,19 @@ sp_create_tile_cache( struct pipe_screen *screen )
 void
 sp_destroy_tile_cache(struct softpipe_tile_cache *tc)
 {
+   struct pipe_screen *screen;
    uint pos;
 
    for (pos = 0; pos < NUM_ENTRIES; pos++) {
       /*assert(tc->entries[pos].x < 0);*/
    }
-   if (tc->surface) {
-      pipe_surface_reference(&tc->surface, NULL);
+   if (tc->transfer) {
+      screen = tc->transfer->texture->screen;
+      screen->tex_transfer_destroy(tc->transfer);
    }
-   if (tc->tex_surf) {
-      pipe_surface_reference(&tc->tex_surf, NULL);
+   if (tc->tex_trans) {
+      screen = tc->tex_trans->texture->screen;
+      screen->tex_transfer_destroy(tc->tex_trans);
    }
 
    FREE( tc );
@@ -156,18 +160,30 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
 {
    assert(!tc->texture);
 
-   if (tc->surface_map) {
-      tc->screen->surface_unmap(tc->screen, tc->surface);
-      tc->surface_map = NULL;
+   if (tc->transfer) {
+      struct pipe_screen *screen = tc->transfer->texture->screen;
+
+      if (ps == tc->surface)
+         return;
+
+      if (tc->transfer_map) {
+         screen->transfer_unmap(screen, tc->transfer);
+         tc->transfer_map = NULL;
+      }
+
+      screen->tex_transfer_destroy(tc->transfer);
+      tc->transfer = NULL;
    }
 
-   pipe_surface_reference(&tc->surface, ps);
+   tc->surface = ps;
 
-   if (tc->surface) {
-      if (tc->surface_map) /* XXX: this is always NULL!? */
-        tc->surface_map = tc->screen->surface_map(tc->screen, tc->surface,
-                                                   PIPE_BUFFER_USAGE_CPU_READ | 
-                                                   PIPE_BUFFER_USAGE_CPU_WRITE);
+   if (ps) {
+      struct pipe_screen *screen = ps->texture->screen;
+
+      tc->transfer = screen->get_tex_transfer(screen, ps->texture, ps->face,
+                                              ps->level, ps->zslice,
+                                              PIPE_TRANSFER_READ_WRITE,
+                                              0, 0, ps->width, ps->height);
 
       tc->depth_stencil = (ps->format == PIPE_FORMAT_S8Z24_UNORM ||
                            ps->format == PIPE_FORMAT_X8Z24_UNORM ||
@@ -181,7 +197,7 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
 
 
 /**
- * Return the surface being cached.
+ * Return the transfer being cached.
  */
 struct pipe_surface *
 sp_tile_cache_get_surface(struct softpipe_tile_cache *tc)
@@ -191,30 +207,27 @@ sp_tile_cache_get_surface(struct softpipe_tile_cache *tc)
 
 
 void
-sp_tile_cache_map_surfaces(struct softpipe_tile_cache *tc)
+sp_tile_cache_map_transfers(struct softpipe_tile_cache *tc)
 {
-   if (tc->surface && !tc->surface_map)
-      tc->surface_map = tc->screen->surface_map(tc->screen, tc->surface,
-                                                PIPE_BUFFER_USAGE_CPU_WRITE |
-                                                PIPE_BUFFER_USAGE_CPU_READ);
-
-   if (tc->tex_surf && !tc->tex_surf_map)
-      tc->tex_surf_map = tc->screen->surface_map(tc->screen, tc->tex_surf,
-                                                 PIPE_BUFFER_USAGE_CPU_READ);
+   if (tc->transfer && !tc->transfer_map)
+      tc->transfer_map = tc->screen->transfer_map(tc->screen, tc->transfer);
+
+   if (tc->tex_trans && !tc->tex_trans_map)
+      tc->tex_trans_map = tc->screen->transfer_map(tc->screen, tc->tex_trans);
 }
 
 
 void
-sp_tile_cache_unmap_surfaces(struct softpipe_tile_cache *tc)
+sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc)
 {
-   if (tc->surface_map) {
-      tc->screen->surface_unmap(tc->screen, tc->surface);
-      tc->surface_map = NULL;
+   if (tc->transfer_map) {
+      tc->screen->transfer_unmap(tc->screen, tc->transfer);
+      tc->transfer_map = NULL;
    }
 
-   if (tc->tex_surf_map) {
-      tc->screen->surface_unmap(tc->screen, tc->tex_surf);
-      tc->tex_surf_map = NULL;
+   if (tc->tex_trans_map) {
+      tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
+      tc->tex_trans_map = NULL;
    }
 }
 
@@ -229,15 +242,21 @@ sp_tile_cache_set_texture(struct pipe_context *pipe,
 {
    uint i;
 
-   assert(!tc->surface);
+   assert(!tc->transfer);
 
    pipe_texture_reference(&tc->texture, texture);
 
-   if (tc->tex_surf_map) {
-      tc->screen->surface_unmap(tc->screen, tc->tex_surf);
-      tc->tex_surf_map = NULL;
+   if (tc->tex_trans) {
+      struct pipe_screen *screen = tc->tex_trans->texture->screen;
+
+      if (tc->tex_trans_map) {
+         screen->transfer_unmap(screen, tc->tex_trans);
+         tc->tex_trans_map = NULL;
+      }
+
+      screen->tex_transfer_destroy(tc->tex_trans);
+      tc->tex_trans = NULL;
    }
-   pipe_surface_reference(&tc->tex_surf, NULL);
 
    /* mark as entries as invalid/empty */
    /* XXX we should try to avoid this when the teximage hasn't changed */
@@ -328,20 +347,20 @@ static void
 sp_tile_cache_flush_clear(struct pipe_context *pipe,
                           struct softpipe_tile_cache *tc)
 {
-   struct pipe_surface *ps = tc->surface;
-   const uint w = tc->surface->width;
-   const uint h = tc->surface->height;
+   struct pipe_transfer *pt = tc->transfer;
+   const uint w = tc->transfer->width;
+   const uint h = tc->transfer->height;
    uint x, y;
    uint numCleared = 0;
 
    /* clear the scratch tile to the clear value */
-   clear_tile(&tc->tile, ps->format, tc->clear_val);
+   clear_tile(&tc->tile, pt->format, tc->clear_val);
 
    /* push the tile to all positions marked as clear */
    for (y = 0; y < h; y += TILE_SIZE) {
       for (x = 0; x < w; x += TILE_SIZE) {
          if (is_clear_flag_set(tc->clear_flags, x, y)) {
-            pipe_put_tile_raw(ps,
+            pipe_put_tile_raw(pt,
                               x, y, TILE_SIZE, TILE_SIZE,
                               tc->tile.data.color32, 0/*STRIDE*/);
 
@@ -359,28 +378,28 @@ sp_tile_cache_flush_clear(struct pipe_context *pipe,
 
 
 /**
- * Flush the tile cache: write all dirty tiles back to the surface.
+ * Flush the tile cache: write all dirty tiles back to the transfer.
  * any tiles "flagged" as cleared will be "really" cleared.
  */
 void
 sp_flush_tile_cache(struct softpipe_context *softpipe,
                     struct softpipe_tile_cache *tc)
 {
-   struct pipe_surface *ps = tc->surface;
+   struct pipe_transfer *pt = tc->transfer;
    int inuse = 0, pos;
 
-   if (ps) {
-      /* caching a drawing surface */
+   if (pt) {
+      /* caching a drawing transfer */
       for (pos = 0; pos < NUM_ENTRIES; pos++) {
          struct softpipe_cached_tile *tile = tc->entries + pos;
          if (tile->x >= 0) {
             if (tc->depth_stencil) {
-               pipe_put_tile_raw(ps,
+               pipe_put_tile_raw(pt,
                                  tile->x, tile->y, TILE_SIZE, TILE_SIZE,
                                  tile->data.depth32, 0/*STRIDE*/);
             }
             else {
-               pipe_put_tile_rgba(ps,
+               pipe_put_tile_rgba(pt,
                                   tile->x, tile->y, TILE_SIZE, TILE_SIZE,
                                   (float *) tile->data.color);
             }
@@ -415,7 +434,7 @@ struct softpipe_cached_tile *
 sp_get_cached_tile(struct softpipe_context *softpipe,
                    struct softpipe_tile_cache *tc, int x, int y)
 {
-   struct pipe_surface *ps = tc->surface;
+   struct pipe_transfer *pt = tc->transfer;
 
    /* tile pos in framebuffer: */
    const int tile_x = x & ~(TILE_SIZE - 1);
@@ -431,12 +450,12 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
       if (tile->x != -1) {
          /* put dirty tile back in framebuffer */
          if (tc->depth_stencil) {
-            pipe_put_tile_raw(ps,
+            pipe_put_tile_raw(pt,
                               tile->x, tile->y, TILE_SIZE, TILE_SIZE,
                               tile->data.depth32, 0/*STRIDE*/);
          }
          else {
-            pipe_put_tile_rgba(ps,
+            pipe_put_tile_rgba(pt,
                                tile->x, tile->y, TILE_SIZE, TILE_SIZE,
                                (float *) tile->data.color);
          }
@@ -448,22 +467,22 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
       if (is_clear_flag_set(tc->clear_flags, x, y)) {
          /* don't get tile from framebuffer, just clear it */
          if (tc->depth_stencil) {
-            clear_tile(tile, ps->format, tc->clear_val);
+            clear_tile(tile, pt->format, tc->clear_val);
          }
          else {
-            clear_tile_rgba(tile, ps->format, tc->clear_color);
+            clear_tile_rgba(tile, pt->format, tc->clear_color);
          }
          clear_clear_flag(tc->clear_flags, x, y);
       }
       else {
-         /* get new tile data from surface */
+         /* get new tile data from transfer */
          if (tc->depth_stencil) {
-            pipe_get_tile_raw(ps,
+            pipe_get_tile_raw(pt,
                               tile->x, tile->y, TILE_SIZE, TILE_SIZE,
                               tile->data.depth32, 0/*STRIDE*/);
          }
          else {
-            pipe_get_tile_rgba(ps,
+            pipe_get_tile_rgba(pt,
                                tile->x, tile->y, TILE_SIZE, TILE_SIZE,
                                (float *) tile->data.color);
          }
@@ -484,7 +503,7 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
 static INLINE uint
 tex_cache_pos(int x, int y, int z, int face, int level)
 {
-   uint entry = x + y * 5 + z * 4 + face + level;
+   uint entry = x + y * 9 + z * 3 + face + level * 7;
    return entry % NUM_ENTRIES;
 }
 
@@ -510,8 +529,12 @@ sp_get_cached_tile_tex(struct softpipe_context *sp,
    if (tc->texture) {
       struct softpipe_texture *spt = softpipe_texture(tc->texture);
       if (spt->modified) {
-         /* texture was modified, force a cache reload */
-         tile->x = -1;
+         /* texture was modified, invalidate all cached tiles */
+         uint p;
+         for (p = 0; p < NUM_ENTRIES; p++) {
+            tile = tc->entries + p;
+            tile->x = -1;
+         }
          spt->modified = FALSE;
       }
    }
@@ -523,28 +546,40 @@ sp_get_cached_tile_tex(struct softpipe_context *sp,
        level != tile->level) {
       /* cache miss */
 
-      /* check if we need to get a new surface */
-      if (!tc->tex_surf ||
+#if 0
+      printf("miss at %u  x=%d y=%d z=%d face=%d level=%d\n", pos,
+             x/TILE_SIZE, y/TILE_SIZE, z, face, level);
+#endif
+      /* check if we need to get a new transfer */
+      if (!tc->tex_trans ||
           tc->tex_face != face ||
           tc->tex_level != level ||
           tc->tex_z != z) {
-         /* get new surface (view into texture) */
+         /* get new transfer (view into texture) */
+
+         if (tc->tex_trans) {
+            if (tc->tex_trans_map) {
+               tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
+               tc->tex_trans_map = NULL;
+            }
 
-        if (tc->tex_surf_map)
-            tc->screen->surface_unmap(tc->screen, tc->tex_surf);
+            screen->tex_transfer_destroy(tc->tex_trans);
+            tc->tex_trans = NULL;
+         }
 
-         tc->tex_surf = screen->get_tex_surface(screen, tc->texture, face, level, z, 
-                                                PIPE_BUFFER_USAGE_CPU_READ);
-         tc->tex_surf_map = screen->surface_map(screen, tc->tex_surf,
-                                                PIPE_BUFFER_USAGE_CPU_READ);
+         tc->tex_trans = screen->get_tex_transfer(screen, tc->texture, face, level, z, 
+                                                  PIPE_TRANSFER_READ, 0, 0,
+                                                  tc->texture->width[level],
+                                                  tc->texture->height[level]);
+         tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans);
 
          tc->tex_face = face;
          tc->tex_level = level;
          tc->tex_z = z;
       }
 
-      /* get tile from the surface (view into texture) */
-      pipe_get_tile_rgba(tc->tex_surf,
+      /* get tile from the transfer (view into texture) */
+      pipe_get_tile_rgba(tc->tex_trans,
                          tile_x, tile_y, TILE_SIZE, TILE_SIZE,
                          (float *) tile->data.color);
       tile->x = tile_x;
@@ -571,7 +606,7 @@ sp_tile_cache_clear(struct softpipe_tile_cache *tc, uint clearValue)
 
    tc->clear_val = clearValue;
 
-   switch (tc->surface->format) {
+   switch (tc->transfer->format) {
    case PIPE_FORMAT_R8G8B8A8_UNORM:
       r = (clearValue >> 24) & 0xff;
       g = (clearValue >> 16) & 0xff;
index a66bb50bcc14889b7ed2a261826a7ea9cc2c0bd6..9ac3fdda9489101d625aa80d59c062c07eb86510 100644 (file)
@@ -74,10 +74,10 @@ extern struct pipe_surface *
 sp_tile_cache_get_surface(struct softpipe_tile_cache *tc);
 
 extern void
-sp_tile_cache_map_surfaces(struct softpipe_tile_cache *tc);
+sp_tile_cache_map_transfers(struct softpipe_tile_cache *tc);
 
 extern void
-sp_tile_cache_unmap_surfaces(struct softpipe_tile_cache *tc);
+sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc);
 
 extern void
 sp_tile_cache_set_texture(struct pipe_context *pipe,
index 3859b8acb06579a925e245cba9aa9ff74a6e5b3c..e087db169aa80f304164c530e5671808af34c106 100644 (file)
@@ -4,15 +4,11 @@ include $(TOP)/configs/current
 LIBNAME = trace
 
 C_SOURCES = \
+       tr_buffer.c \
        tr_context.c \
        tr_dump.c \
        tr_screen.c \
        tr_state.c \
-       tr_texture.c \
-       tr_winsys.c 
-
+       tr_texture.c
 
 include ../../Makefile.template
-
-symlinks:
-
index 0a6bfb8f4c73e9a4040a53c4f44be9e0ddb4668e..4215215d1a1cf5453c71db5999a1d21409a894fa 100644 (file)
@@ -5,12 +5,12 @@ env = env.Clone()
 trace = env.ConvenienceLibrary(
     target = 'trace',
     source = [
+        'tr_buffer.c',
         'tr_context.c',
         'tr_dump.c',
         'tr_screen.c',
         'tr_state.c',
         'tr_texture.c',
-        'tr_winsys.c',
     ])
 
-Export('trace')
\ No newline at end of file
+Export('trace')
diff --git a/src/gallium/drivers/trace/tr_buffer.c b/src/gallium/drivers/trace/tr_buffer.c
new file mode 100644 (file)
index 0000000..6ffce16
--- /dev/null
@@ -0,0 +1,70 @@
+/**************************************************************************
+ *
+ * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "util/u_memory.h"
+
+#include "tr_buffer.h"
+
+
+struct pipe_buffer *
+trace_buffer_create(struct trace_screen *tr_scr,
+                    struct pipe_buffer *buffer)
+{
+   struct trace_buffer *tr_buf;
+
+   if(!buffer)
+      goto error;
+
+   assert(buffer->screen == tr_scr->screen);
+
+   tr_buf = CALLOC_STRUCT(trace_buffer);
+   if(!tr_buf)
+      goto error;
+
+   memcpy(&tr_buf->base, buffer, sizeof(struct pipe_buffer));
+
+   pipe_reference_init(&tr_buf->base.reference, 1);
+   tr_buf->base.screen = &tr_scr->base;
+   tr_buf->buffer = buffer;
+
+   return &tr_buf->base;
+
+error:
+   pipe_buffer_reference(&buffer, NULL);
+   return NULL;
+}
+
+
+void
+trace_buffer_destroy(struct trace_screen *tr_scr,
+                     struct pipe_buffer *buffer)
+{
+   struct trace_buffer *tr_buf = trace_buffer(tr_scr, buffer);
+   pipe_buffer_reference(&tr_buf->buffer, NULL);
+   FREE(tr_buf);
+}
diff --git a/src/gallium/drivers/trace/tr_buffer.h b/src/gallium/drivers/trace/tr_buffer.h
new file mode 100644 (file)
index 0000000..e9e4d35
--- /dev/null
@@ -0,0 +1,70 @@
+/**************************************************************************
+ *
+ * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef TR_BUFFER_H_
+#define TR_BUFFER_H_
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+
+#include "tr_screen.h"
+
+
+struct trace_buffer
+{
+   struct pipe_buffer base;
+
+   struct pipe_buffer *buffer;
+
+   void *map;
+   boolean range_flushed;
+};
+
+
+static INLINE struct trace_buffer *
+trace_buffer(struct trace_screen *tr_scr,
+             struct pipe_buffer *buffer)
+{
+   if(!buffer)
+      return NULL;
+   assert(tr_scr);
+   assert(buffer->screen == &tr_scr->base);
+   return (struct trace_buffer *)buffer;
+}
+
+
+struct pipe_buffer *
+trace_buffer_create(struct trace_screen *tr_scr,
+                    struct pipe_buffer *buffer);
+
+void
+trace_buffer_destroy(struct trace_screen *tr_scr,
+                     struct pipe_buffer *buffer);
+
+
+#endif
index ec8be27077fdbf101abefb0b66fa089d9fb278eb..c8949729047840a7144f34167c45dee05131fab5 100644 (file)
 
 #include "tr_dump.h"
 #include "tr_state.h"
+#include "tr_buffer.h"
 #include "tr_screen.h"
 #include "tr_texture.h"
-#include "tr_winsys.h"
 #include "tr_context.h"
 
 
-static INLINE struct pipe_texture * 
+static INLINE struct pipe_buffer *
+trace_buffer_unwrap(struct trace_context *tr_ctx,
+                     struct pipe_buffer *buffer)
+{
+   struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
+   struct trace_buffer *tr_buf;
+
+   if(!buffer)
+      return NULL;
+
+   tr_buf = trace_buffer(tr_scr, buffer);
+
+   assert(tr_buf->buffer);
+   assert(tr_buf->buffer->screen == tr_scr->screen);
+   return tr_buf->buffer;
+}
+
+
+static INLINE struct pipe_texture *
 trace_texture_unwrap(struct trace_context *tr_ctx,
                      struct pipe_texture *texture)
 {
-   struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen); 
+   struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
    struct trace_texture *tr_tex;
-   
+
    if(!texture)
       return NULL;
-   
+
    tr_tex = trace_texture(tr_scr, texture);
-   
+
    assert(tr_tex->texture);
    assert(tr_tex->texture->screen == tr_scr->screen);
    return tr_tex->texture;
 }
 
 
-static INLINE struct pipe_surface * 
+static INLINE struct pipe_surface *
 trace_surface_unwrap(struct trace_context *tr_ctx,
                      struct pipe_surface *surface)
 {
-   struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen); 
+   struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
    struct trace_texture *tr_tex;
    struct trace_surface *tr_surf;
-   
+
    if(!surface)
       return NULL;
 
    assert(surface->texture);
    if(!surface->texture)
       return surface;
-   
+
    tr_tex = trace_texture(tr_scr, surface->texture);
    tr_surf = trace_surface(tr_tex, surface);
-   
+
    assert(tr_surf->surface);
    assert(tr_surf->surface->texture->screen == tr_scr->screen);
    return tr_surf->surface;
@@ -86,7 +104,7 @@ trace_context_set_edgeflags(struct pipe_context *_pipe,
    struct pipe_context *pipe = tr_ctx->pipe;
 
    trace_dump_call_begin("pipe_context", "set_edgeflags");
-   
+
    trace_dump_arg(ptr, pipe);
    /* FIXME: we don't know how big this array is */
    trace_dump_arg(ptr, bitfield);
@@ -115,24 +133,27 @@ trace_context_draw_arrays(struct pipe_context *_pipe,
    result = pipe->draw_arrays(pipe, mode, start, count);;
 
    trace_dump_ret(bool, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
 static INLINE boolean
 trace_context_draw_elements(struct pipe_context *_pipe,
-                          struct pipe_buffer *indexBuffer,
+                          struct pipe_buffer *_indexBuffer,
                           unsigned indexSize,
                           unsigned mode, unsigned start, unsigned count)
 {
+   struct trace_screen *tr_scr = trace_screen(_pipe->screen);
    struct trace_context *tr_ctx = trace_context(_pipe);
+   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _indexBuffer);
    struct pipe_context *pipe = tr_ctx->pipe;
+   struct pipe_buffer *indexBuffer = tr_buf->buffer;
    boolean result;
 
-   trace_winsys_user_buffer_update(_pipe->winsys, indexBuffer);
+   trace_screen_user_buffer_update(_pipe->screen, indexBuffer);
 
    trace_dump_call_begin("pipe_context", "draw_elements");
 
@@ -146,28 +167,31 @@ trace_context_draw_elements(struct pipe_context *_pipe,
    result = pipe->draw_elements(pipe, indexBuffer, indexSize, mode, start, count);;
 
    trace_dump_ret(bool, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
 static INLINE boolean
 trace_context_draw_range_elements(struct pipe_context *_pipe,
-                                  struct pipe_buffer *indexBuffer,
+                                  struct pipe_buffer *_indexBuffer,
                                   unsigned indexSize,
                                   unsigned minIndex,
                                   unsigned maxIndex,
-                                  unsigned mode, 
-                                  unsigned start, 
+                                  unsigned mode,
+                                  unsigned start,
                                   unsigned count)
 {
+   struct trace_screen *tr_scr = trace_screen(_pipe->screen);
    struct trace_context *tr_ctx = trace_context(_pipe);
+   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _indexBuffer);
    struct pipe_context *pipe = tr_ctx->pipe;
+   struct pipe_buffer *indexBuffer = tr_buf->buffer;
    boolean result;
 
-   trace_winsys_user_buffer_update(_pipe->winsys, indexBuffer);
+   trace_screen_user_buffer_update(_pipe->screen, indexBuffer);
 
    trace_dump_call_begin("pipe_context", "draw_range_elements");
 
@@ -180,15 +204,15 @@ trace_context_draw_range_elements(struct pipe_context *_pipe,
    trace_dump_arg(uint, start);
    trace_dump_arg(uint, count);
 
-   result = pipe->draw_range_elements(pipe, 
-                                      indexBuffer, 
-                                      indexSize, minIndex, maxIndex, 
+   result = pipe->draw_range_elements(pipe,
+                                      indexBuffer,
+                                      indexSize, minIndex, maxIndex,
                                       mode, start, count);
-   
+
    trace_dump_ret(bool, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
@@ -209,9 +233,9 @@ trace_context_create_query(struct pipe_context *_pipe,
    result = pipe->create_query(pipe, query_type);;
 
    trace_dump_ret(ptr, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
@@ -235,7 +259,7 @@ trace_context_destroy_query(struct pipe_context *_pipe,
 
 
 static INLINE void
-trace_context_begin_query(struct pipe_context *_pipe, 
+trace_context_begin_query(struct pipe_context *_pipe,
                           struct pipe_query *query)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -253,7 +277,7 @@ trace_context_begin_query(struct pipe_context *_pipe,
 
 
 static INLINE void
-trace_context_end_query(struct pipe_context *_pipe, 
+trace_context_end_query(struct pipe_context *_pipe,
                         struct pipe_query *query)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -271,7 +295,7 @@ trace_context_end_query(struct pipe_context *_pipe,
 
 
 static INLINE boolean
-trace_context_get_query_result(struct pipe_context *_pipe, 
+trace_context_get_query_result(struct pipe_context *_pipe,
                                struct pipe_query *query,
                                boolean wait,
                                uint64_t *presult)
@@ -290,9 +314,9 @@ trace_context_get_query_result(struct pipe_context *_pipe,
 
    trace_dump_arg(uint, result);
    trace_dump_ret(bool, _result);
-   
+
    trace_dump_call_end();
-   
+
    return _result;
 }
 
@@ -315,13 +339,13 @@ trace_context_create_blend_state(struct pipe_context *_pipe,
    trace_dump_ret(ptr, result);
 
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
 static INLINE void
-trace_context_bind_blend_state(struct pipe_context *_pipe, 
+trace_context_bind_blend_state(struct pipe_context *_pipe,
                                void *state)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -339,7 +363,7 @@ trace_context_bind_blend_state(struct pipe_context *_pipe,
 
 
 static INLINE void
-trace_context_delete_blend_state(struct pipe_context *_pipe, 
+trace_context_delete_blend_state(struct pipe_context *_pipe,
                                  void *state)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -372,15 +396,15 @@ trace_context_create_sampler_state(struct pipe_context *_pipe,
    result = pipe->create_sampler_state(pipe, state);;
 
    trace_dump_ret(ptr, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
 static INLINE void
-trace_context_bind_sampler_states(struct pipe_context *_pipe, 
+trace_context_bind_sampler_states(struct pipe_context *_pipe,
                                   unsigned num_states, void **states)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -399,7 +423,7 @@ trace_context_bind_sampler_states(struct pipe_context *_pipe,
 
 
 static INLINE void
-trace_context_delete_sampler_state(struct pipe_context *_pipe, 
+trace_context_delete_sampler_state(struct pipe_context *_pipe,
                                    void *state)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -432,15 +456,15 @@ trace_context_create_rasterizer_state(struct pipe_context *_pipe,
    result = pipe->create_rasterizer_state(pipe, state);;
 
    trace_dump_ret(ptr, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
 static INLINE void
-trace_context_bind_rasterizer_state(struct pipe_context *_pipe, 
+trace_context_bind_rasterizer_state(struct pipe_context *_pipe,
                                     void *state)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -458,7 +482,7 @@ trace_context_bind_rasterizer_state(struct pipe_context *_pipe,
 
 
 static INLINE void
-trace_context_delete_rasterizer_state(struct pipe_context *_pipe, 
+trace_context_delete_rasterizer_state(struct pipe_context *_pipe,
                                       void *state)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -489,17 +513,17 @@ trace_context_create_depth_stencil_alpha_state(struct pipe_context *_pipe,
 
    trace_dump_arg(ptr, pipe);
    trace_dump_arg(depth_stencil_alpha_state, state);
-   
+
    trace_dump_ret(ptr, result);
 
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
 static INLINE void
-trace_context_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, 
+trace_context_bind_depth_stencil_alpha_state(struct pipe_context *_pipe,
                                              void *state)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -517,7 +541,7 @@ trace_context_bind_depth_stencil_alpha_state(struct pipe_context *_pipe,
 
 
 static INLINE void
-trace_context_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, 
+trace_context_delete_depth_stencil_alpha_state(struct pipe_context *_pipe,
                                                void *state)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -550,15 +574,15 @@ trace_context_create_fs_state(struct pipe_context *_pipe,
    result = pipe->create_fs_state(pipe, state);;
 
    trace_dump_ret(ptr, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
 static INLINE void
-trace_context_bind_fs_state(struct pipe_context *_pipe, 
+trace_context_bind_fs_state(struct pipe_context *_pipe,
                             void *state)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -576,7 +600,7 @@ trace_context_bind_fs_state(struct pipe_context *_pipe,
 
 
 static INLINE void
-trace_context_delete_fs_state(struct pipe_context *_pipe, 
+trace_context_delete_fs_state(struct pipe_context *_pipe,
                               void *state)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -609,15 +633,15 @@ trace_context_create_vs_state(struct pipe_context *_pipe,
    result = pipe->create_vs_state(pipe, state);;
 
    trace_dump_ret(ptr, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
 static INLINE void
-trace_context_bind_vs_state(struct pipe_context *_pipe, 
+trace_context_bind_vs_state(struct pipe_context *_pipe,
                             void *state)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -635,7 +659,7 @@ trace_context_bind_vs_state(struct pipe_context *_pipe,
 
 
 static INLINE void
-trace_context_delete_vs_state(struct pipe_context *_pipe, 
+trace_context_delete_vs_state(struct pipe_context *_pipe,
                               void *state)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
@@ -696,8 +720,9 @@ trace_context_set_constant_buffer(struct pipe_context *_pipe,
    struct trace_context *tr_ctx = trace_context(_pipe);
    struct pipe_context *pipe = tr_ctx->pipe;
 
-   trace_winsys_user_buffer_update(_pipe->winsys, (struct pipe_buffer *)buffer);
-   
+   if (buffer)
+      trace_screen_user_buffer_update(_pipe->screen, buffer->buffer);
+
    trace_dump_call_begin("pipe_context", "set_constant_buffer");
 
    trace_dump_arg(ptr, pipe);
@@ -705,7 +730,13 @@ trace_context_set_constant_buffer(struct pipe_context *_pipe,
    trace_dump_arg(uint, index);
    trace_dump_arg(constant_buffer, buffer);
 
-   pipe->set_constant_buffer(pipe, shader, index, buffer);;
+   if (buffer) {
+      struct pipe_constant_buffer _buffer;
+      _buffer.buffer = trace_buffer_unwrap(tr_ctx, buffer->buffer);
+      pipe->set_constant_buffer(pipe, shader, index, &_buffer);
+   } else {
+      pipe->set_constant_buffer(pipe, shader, index, buffer);
+   }
 
    trace_dump_call_end();
 }
@@ -719,7 +750,7 @@ trace_context_set_framebuffer_state(struct pipe_context *_pipe,
    struct pipe_context *pipe = tr_ctx->pipe;
    struct pipe_framebuffer_state unwrapped_state;
    unsigned i;
-   
+
    /* Unwrap the input state */
    memcpy(&unwrapped_state, state, sizeof(unwrapped_state));
    for(i = 0; i < state->nr_cbufs; ++i)
@@ -728,7 +759,7 @@ trace_context_set_framebuffer_state(struct pipe_context *_pipe,
       unwrapped_state.cbufs[i] = NULL;
    unwrapped_state.zsbuf = trace_surface_unwrap(tr_ctx, state->zsbuf);
    state = &unwrapped_state;
-   
+
    trace_dump_call_begin("pipe_context", "set_framebuffer_state");
 
    trace_dump_arg(ptr, pipe);
@@ -803,7 +834,7 @@ trace_context_set_sampler_textures(struct pipe_context *_pipe,
    struct pipe_context *pipe = tr_ctx->pipe;
    struct pipe_texture *unwrapped_textures[PIPE_MAX_SAMPLERS];
    unsigned i;
-   
+
    for(i = 0; i < num_textures; ++i)
       unwrapped_textures[i] = trace_texture_unwrap(tr_ctx, textures[i]);
    textures = unwrapped_textures;
@@ -830,18 +861,27 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe,
    unsigned i;
 
    for(i = 0; i < num_buffers; ++i)
-      trace_winsys_user_buffer_update(_pipe->winsys, buffers[i].buffer);
+      trace_screen_user_buffer_update(_pipe->screen, buffers[i].buffer);
 
    trace_dump_call_begin("pipe_context", "set_vertex_buffers");
 
    trace_dump_arg(ptr, pipe);
    trace_dump_arg(uint, num_buffers);
-   
+
    trace_dump_arg_begin("buffers");
    trace_dump_struct_array(vertex_buffer, buffers, num_buffers);
    trace_dump_arg_end();
 
-   pipe->set_vertex_buffers(pipe, num_buffers, buffers);;
+   if (num_buffers) {
+      struct pipe_vertex_buffer *_buffers = malloc(num_buffers * sizeof(*_buffers));
+      memcpy(_buffers, buffers, num_buffers * sizeof(*_buffers));
+      for (i = 0; i < num_buffers; i++)
+         _buffers[i].buffer = trace_buffer_unwrap(tr_ctx, buffers[i].buffer);
+      pipe->set_vertex_buffers(pipe, num_buffers, _buffers);
+      free(_buffers);
+   } else {
+      pipe->set_vertex_buffers(pipe, num_buffers, NULL);
+   }
 
    trace_dump_call_end();
 }
@@ -872,7 +912,6 @@ trace_context_set_vertex_elements(struct pipe_context *_pipe,
 
 static INLINE void
 trace_context_surface_copy(struct pipe_context *_pipe,
-                           boolean do_flip,
                            struct pipe_surface *dest,
                            unsigned destx, unsigned desty,
                            struct pipe_surface *src,
@@ -884,11 +923,10 @@ trace_context_surface_copy(struct pipe_context *_pipe,
 
    dest = trace_surface_unwrap(tr_ctx, dest);
    src = trace_surface_unwrap(tr_ctx, src);
-   
+
    trace_dump_call_begin("pipe_context", "surface_copy");
 
    trace_dump_arg(ptr, pipe);
-   trace_dump_arg(bool, do_flip);
    trace_dump_arg(ptr, dest);
    trace_dump_arg(uint, destx);
    trace_dump_arg(uint, desty);
@@ -898,10 +936,10 @@ trace_context_surface_copy(struct pipe_context *_pipe,
    trace_dump_arg(uint, width);
    trace_dump_arg(uint, height);
 
-   pipe->surface_copy(pipe, do_flip, 
-                      dest, destx, desty, 
+   pipe->surface_copy(pipe,
+                      dest, destx, desty,
                       src, srcx, srcy, width, height);
-   
+
    trace_dump_call_end();
 }
 
@@ -934,7 +972,7 @@ trace_context_surface_fill(struct pipe_context *_pipe,
 
 
 static INLINE void
-trace_context_clear(struct pipe_context *_pipe, 
+trace_context_clear(struct pipe_context *_pipe,
                     struct pipe_surface *surface,
                     unsigned clearValue)
 {
@@ -988,7 +1026,7 @@ trace_context_destroy(struct pipe_context *_pipe)
    trace_dump_arg(ptr, pipe);
 
    pipe->destroy(pipe);
-   
+
    trace_dump_call_end();
 
    FREE(tr_ctx);
@@ -996,23 +1034,25 @@ trace_context_destroy(struct pipe_context *_pipe)
 
 
 struct pipe_context *
-trace_context_create(struct pipe_screen *screen, 
+trace_context_create(struct pipe_screen *_screen,
                      struct pipe_context *pipe)
 {
+   struct trace_screen *tr_scr = trace_screen(_screen);
    struct trace_context *tr_ctx;
-   
+   struct pipe_screen *screen = tr_scr->screen;
+
    if(!pipe)
       goto error1;
-   
+
    if(!trace_dump_enabled())
       goto error1;
-   
+
    tr_ctx = CALLOC_STRUCT(trace_context);
    if(!tr_ctx)
       goto error1;
 
-   tr_ctx->base.winsys = screen->winsys;
-   tr_ctx->base.screen = screen;
+   tr_ctx->base.winsys = _screen->winsys;
+   tr_ctx->base.screen = _screen;
    tr_ctx->base.destroy = trace_context_destroy;
    tr_ctx->base.set_edgeflags = trace_context_set_edgeflags;
    tr_ctx->base.draw_arrays = trace_context_draw_arrays;
@@ -1057,16 +1097,14 @@ trace_context_create(struct pipe_screen *screen,
    tr_ctx->base.flush = trace_context_flush;
 
    tr_ctx->pipe = pipe;
-   
+
    trace_dump_call_begin("", "pipe_context_create");
-   trace_dump_arg_begin("screen");
-   trace_dump_ptr(pipe->screen);
-   trace_dump_arg_end();
+   trace_dump_arg(ptr, screen);
    trace_dump_ret(ptr, pipe);
    trace_dump_call_end();
 
    return &tr_ctx->base;
-   
+
 error1:
    return pipe;
 }
index 7831900ec29879118f99e232b289e278e3451c0a..d02b22a069b0831d7f98240a0051720fc590fecf 100644 (file)
@@ -30,7 +30,7 @@
 
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_context.h"
 
 
 extern "C" {
 #endif
 
-   
+
 struct trace_context
 {
    struct pipe_context base;
-   
+
    struct pipe_context *pipe;
 };
 
index a0ead0ded3344fc520015be88a3c4cbe212e3959..6837c94542d3f711ddfa74a28ef4f6e9ecfb3017 100644 (file)
 /**
  * @file
  * Trace dumping functions.
- * 
+ *
  * For now we just use standard XML for dumping the trace calls, as this is
- * simple to write, parse, and visually inspect, but the actual representation 
- * is abstracted out of this file, so that we can switch to a binary 
+ * simple to write, parse, and visually inspect, but the actual representation
+ * is abstracted out of this file, so that we can switch to a binary
  * representation if/when it becomes justified.
- * 
- * @author Jose Fonseca <jrfonseca@tungstengraphics.com>   
+ *
+ * @author Jose Fonseca <jrfonseca@tungstengraphics.com>
  */
 
 #include "pipe/p_config.h"
 
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
 #include <stdlib.h>
 #endif
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
 #include "util/u_stream.h"
 
 #include "tr_dump.h"
+#include "tr_screen.h"
+#include "tr_texture.h"
+#include "tr_buffer.h"
 
 
 static struct util_stream *stream = NULL;
 static unsigned refcount = 0;
 
 
-static INLINE void 
+static INLINE void
 trace_dump_write(const char *buf, size_t size)
 {
    if(stream)
@@ -65,14 +68,14 @@ trace_dump_write(const char *buf, size_t size)
 }
 
 
-static INLINE void 
+static INLINE void
 trace_dump_writes(const char *s)
 {
    trace_dump_write(s, strlen(s));
 }
 
 
-static INLINE void 
+static INLINE void
 trace_dump_writef(const char *format, ...)
 {
    static char buf[1024];
@@ -85,8 +88,8 @@ trace_dump_writef(const char *format, ...)
 }
 
 
-static INLINE void 
-trace_dump_escape(const char *str) 
+static INLINE void
+trace_dump_escape(const char *str)
 {
    const unsigned char *p = (const unsigned char *)str;
    unsigned char c;
@@ -109,7 +112,7 @@ trace_dump_escape(const char *str)
 }
 
 
-static INLINE void 
+static INLINE void
 trace_dump_indent(unsigned level)
 {
    unsigned i;
@@ -118,14 +121,14 @@ trace_dump_indent(unsigned level)
 }
 
 
-static INLINE void 
-trace_dump_newline(void) 
+static INLINE void
+trace_dump_newline(void)
 {
    trace_dump_writes("\n");
 }
 
 
-static INLINE void 
+static INLINE void
 trace_dump_tag(const char *name)
 {
    trace_dump_writes("<");
@@ -134,7 +137,7 @@ trace_dump_tag(const char *name)
 }
 
 
-static INLINE void 
+static INLINE void
 trace_dump_tag_begin(const char *name)
 {
    trace_dump_writes("<");
@@ -142,8 +145,8 @@ trace_dump_tag_begin(const char *name)
    trace_dump_writes(">");
 }
 
-static INLINE void 
-trace_dump_tag_begin1(const char *name, 
+static INLINE void
+trace_dump_tag_begin1(const char *name,
                       const char *attr1, const char *value1)
 {
    trace_dump_writes("<");
@@ -156,8 +159,8 @@ trace_dump_tag_begin1(const char *name,
 }
 
 
-static INLINE void 
-trace_dump_tag_begin2(const char *name, 
+static INLINE void
+trace_dump_tag_begin2(const char *name,
                       const char *attr1, const char *value1,
                       const char *attr2, const char *value2)
 {
@@ -175,8 +178,8 @@ trace_dump_tag_begin2(const char *name,
 }
 
 
-static INLINE void 
-trace_dump_tag_begin3(const char *name, 
+static INLINE void
+trace_dump_tag_begin3(const char *name,
                       const char *attr1, const char *value1,
                       const char *attr2, const char *value2,
                       const char *attr3, const char *value3)
@@ -207,7 +210,7 @@ trace_dump_tag_end(const char *name)
    trace_dump_writes(">");
 }
 
-static void 
+static void
 trace_dump_trace_close(void)
 {
    if(stream) {
@@ -221,30 +224,30 @@ trace_dump_trace_close(void)
 boolean trace_dump_trace_begin()
 {
    const char *filename;
-   
+
    filename = debug_get_option("GALLIUM_TRACE", NULL);
    if(!filename)
       return FALSE;
-   
+
    if(!stream) {
-   
+
       stream = util_stream_create(filename, 0);
       if(!stream)
          return FALSE;
-      
+
       trace_dump_writes("<?xml version='1.0' encoding='UTF-8'?>\n");
       trace_dump_writes("<?xml-stylesheet type='text/xsl' href='trace.xsl'?>\n");
       trace_dump_writes("<trace version='0.1'>\n");
-      
-#if defined(PIPE_OS_LINUX)
-      /* Linux applications rarely cleanup GL / Gallium resources so catch 
-       * application exit here */ 
+
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+      /* Linux applications rarely cleanup GL / Gallium resources so catch
+       * application exit here */
       atexit(trace_dump_trace_close);
 #endif
    }
-   
+
    ++refcount;
-   
+
    return TRUE;
 }
 
@@ -402,3 +405,49 @@ void trace_dump_ptr(const void *value)
    else
       trace_dump_null();
 }
+
+void trace_dump_buffer_ptr(struct pipe_buffer *_buffer)
+{
+   if (_buffer) {
+      struct trace_screen *tr_scr = trace_screen(_buffer->screen);
+      struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+      trace_dump_ptr(tr_buf->buffer);
+   } else {
+      trace_dump_null();
+   }
+}
+
+void trace_dump_texture_ptr(struct pipe_texture *_texture)
+{
+   if (_texture) {
+      struct trace_screen *tr_scr = trace_screen(_texture->screen);
+      struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+      trace_dump_ptr(tr_tex->texture);
+   } else {
+      trace_dump_null();
+   }
+}
+
+void trace_dump_surface_ptr(struct pipe_surface *_surface)
+{
+   if (_surface) {
+      struct trace_screen *tr_scr = trace_screen(_surface->texture->screen);
+      struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
+      struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+      trace_dump_ptr(tr_surf->surface);
+   } else {
+      trace_dump_null();
+   }
+}
+
+void trace_dump_transfer_ptr(struct pipe_transfer *_transfer)
+{
+   if (_transfer) {
+      struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen);
+      struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
+      struct trace_transfer *tr_tran = trace_transfer(tr_tex, _transfer);
+      trace_dump_ptr(tr_tran->transfer);
+   } else {
+      trace_dump_null();
+   }
+}
index 76a53731b311585fc406d15b34a7cd989c56a473..26409f26c66ef4c6fd0f9c6f6c98b9f1969bbb79 100644 (file)
 #include "pipe/p_compiler.h"
 
 
+struct pipe_buffer;
+struct pipe_texture;
+struct pipe_surface;
+struct pipe_transfer;
+
 boolean trace_dump_trace_begin(void);
 boolean trace_dump_enabled(void);
 void trace_dump_trace_end(void);
@@ -63,10 +68,14 @@ void trace_dump_member_begin(const char *name);
 void trace_dump_member_end(void);
 void trace_dump_null(void);
 void trace_dump_ptr(const void *value);
-
+/* will turn a wrapped object into the real one and dump ptr */
+void trace_dump_buffer_ptr(struct pipe_buffer *_buffer);
+void trace_dump_texture_ptr(struct pipe_texture *_texture);
+void trace_dump_surface_ptr(struct pipe_surface *_surface);
+void trace_dump_transfer_ptr(struct pipe_transfer *_transfer);
 
 /*
- * Code saving macros. 
+ * Code saving macros.
  */
 
 #define trace_dump_arg(_type, _arg) \
index 8789f86b1a83d2e6eecc057a8b5122bca8f49270..954576d721720a360ae68712fc58ac3fd819be23 100644 (file)
 
 #include "util/u_memory.h"
 
+#include "tr_buffer.h"
 #include "tr_dump.h"
 #include "tr_state.h"
-#include "tr_winsys.h"
 #include "tr_texture.h"
 #include "tr_screen.h"
 
+#include "pipe/p_inlines.h"
+
 
 static const char *
 trace_screen_get_name(struct pipe_screen *_screen)
@@ -40,17 +42,17 @@ trace_screen_get_name(struct pipe_screen *_screen)
    struct trace_screen *tr_scr = trace_screen(_screen);
    struct pipe_screen *screen = tr_scr->screen;
    const char *result;
-   
+
    trace_dump_call_begin("pipe_screen", "get_name");
-   
+
    trace_dump_arg(ptr, screen);
 
    result = screen->get_name(screen);
-   
+
    trace_dump_ret(string, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
@@ -61,80 +63,80 @@ trace_screen_get_vendor(struct pipe_screen *_screen)
    struct trace_screen *tr_scr = trace_screen(_screen);
    struct pipe_screen *screen = tr_scr->screen;
    const char *result;
-   
+
    trace_dump_call_begin("pipe_screen", "get_vendor");
-   
+
    trace_dump_arg(ptr, screen);
-  
+
    result = screen->get_vendor(screen);
-   
+
    trace_dump_ret(string, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
-static int 
-trace_screen_get_param(struct pipe_screen *_screen, 
+static int
+trace_screen_get_param(struct pipe_screen *_screen,
                        int param)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
    struct pipe_screen *screen = tr_scr->screen;
    int result;
-   
+
    trace_dump_call_begin("pipe_screen", "get_param");
-   
+
    trace_dump_arg(ptr, screen);
    trace_dump_arg(int, param);
 
    result = screen->get_param(screen, param);
-   
+
    trace_dump_ret(int, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
-static float 
-trace_screen_get_paramf(struct pipe_screen *_screen, 
+static float
+trace_screen_get_paramf(struct pipe_screen *_screen,
                         int param)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
    struct pipe_screen *screen = tr_scr->screen;
    float result;
-   
+
    trace_dump_call_begin("pipe_screen", "get_paramf");
-   
+
    trace_dump_arg(ptr, screen);
    trace_dump_arg(int, param);
 
    result = screen->get_paramf(screen, param);
-   
+
    trace_dump_ret(float, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
-static boolean 
+static boolean
 trace_screen_is_format_supported(struct pipe_screen *_screen,
                                  enum pipe_format format,
                                  enum pipe_texture_target target,
-                                 unsigned tex_usage, 
+                                 unsigned tex_usage,
                                  unsigned geom_flags)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
    struct pipe_screen *screen = tr_scr->screen;
    boolean result;
-   
+
    trace_dump_call_begin("pipe_screen", "is_format_supported");
-   
+
    trace_dump_arg(ptr, screen);
    trace_dump_arg(format, format);
    trace_dump_arg(int, target);
@@ -142,15 +144,45 @@ trace_screen_is_format_supported(struct pipe_screen *_screen,
    trace_dump_arg(uint, geom_flags);
 
    result = screen->is_format_supported(screen, format, target, tex_usage, geom_flags);
-   
+
    trace_dump_ret(bool, result);
-   
+
    trace_dump_call_end();
-   
+
    return result;
 }
 
 
+static void
+trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
+                               struct pipe_surface *_surface,
+                               void *context_private)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
+   struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+   struct pipe_screen *screen = tr_scr->screen;
+   struct pipe_surface *surface = tr_surf->surface;
+
+   trace_dump_call_begin("pipe_screen", "flush_frontbuffer");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg(ptr, surface);
+   /* XXX: hide, as there is nothing we can do with this
+   trace_dump_arg(ptr, context_private);
+   */
+
+   screen->flush_frontbuffer(screen, surface, context_private);
+
+   trace_dump_call_end();
+}
+
+
+/********************************************************************
+ * texture
+ */
+
+
 static struct pipe_texture *
 trace_screen_texture_create(struct pipe_screen *_screen,
                             const struct pipe_texture *templat)
@@ -158,20 +190,20 @@ trace_screen_texture_create(struct pipe_screen *_screen,
    struct trace_screen *tr_scr = trace_screen(_screen);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_texture *result;
-   
+
    trace_dump_call_begin("pipe_screen", "texture_create");
 
    trace_dump_arg(ptr, screen);
    trace_dump_arg(template, templat);
 
    result = screen->texture_create(screen, templat);
-   
+
    trace_dump_ret(ptr, result);
-   
+
    trace_dump_call_end();
-   
+
    result = trace_texture_create(tr_scr, result);
-   
+
    return result;
 }
 
@@ -195,71 +227,60 @@ trace_screen_texture_blanket(struct pipe_screen *_screen,
    trace_dump_arg(ptr, buffer);
 
    result = screen->texture_blanket(screen, templat, ppitch, buffer);
-   
+
    trace_dump_ret(ptr, result);
-   
+
    trace_dump_call_end();
-   
+
    result = trace_texture_create(tr_scr, result);
-   
+
    return result;
 }
 
 
-static void 
-trace_screen_texture_release(struct pipe_screen *_screen,
-                             struct pipe_texture **ptexture)
+static void
+trace_screen_texture_destroy(struct pipe_texture *_texture)
 {
-   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct trace_screen *tr_scr = trace_screen(_texture->screen);
+   struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
    struct pipe_screen *screen = tr_scr->screen;
-   struct trace_texture *tr_tex;
-   struct pipe_texture *texture;
-   
-   assert(ptexture);
-   if(*ptexture) {
-      tr_tex = trace_texture(tr_scr, *ptexture);
-      texture = tr_tex->texture;
-      assert(texture->screen == screen);
-   }
-   else
-      texture = NULL;
-   
-   if (*ptexture) {
-      if (!--(*ptexture)->refcount) {
-         trace_dump_call_begin("pipe_screen", "texture_destroy");
-         
-         trace_dump_arg(ptr, screen);
-         trace_dump_arg(ptr, texture);
-         
-         trace_texture_destroy(tr_scr, *ptexture);
-         
-         trace_dump_call_end();
-      }
-   
-      *ptexture = NULL;
-   }
+   struct pipe_texture *texture = tr_tex->texture;
+
+   assert(texture->screen == screen);
+
+   trace_dump_call_begin("pipe_screen", "texture_destroy");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg(ptr, texture);
+
+   trace_dump_call_end();
+
+   trace_texture_destroy(tr_scr, _texture);
 }
 
 
+/********************************************************************
+ * surface
+ */
+
+
 static struct pipe_surface *
 trace_screen_get_tex_surface(struct pipe_screen *_screen,
-                             struct pipe_texture *texture,
+                             struct pipe_texture *_texture,
                              unsigned face, unsigned level,
                              unsigned zslice,
                              unsigned usage)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
+   struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
    struct pipe_screen *screen = tr_scr->screen;
-   struct trace_texture *tr_tex;
-   struct pipe_surface *result;
-   
-   assert(texture);
-   tr_tex = trace_texture(tr_scr, texture);
-   texture = tr_tex->texture;
+   struct pipe_texture *texture = tr_tex->texture;
+   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);
@@ -270,133 +291,538 @@ trace_screen_get_tex_surface(struct pipe_screen *_screen,
    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_release(struct pipe_screen *_screen,
-                                 struct pipe_surface **psurface)
+static void
+trace_screen_tex_surface_destroy(struct pipe_surface *_surface)
+{
+   struct trace_screen *tr_scr = trace_screen(_surface->texture->screen);
+   struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
+   struct trace_surface *tr_surf = trace_surface(tr_tex, _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_tex, _surface);
+}
+
+
+/********************************************************************
+ * transfer
+ */
+
+
+static struct pipe_transfer *
+trace_screen_get_tex_transfer(struct pipe_screen *_screen,
+                              struct pipe_texture *_texture,
+                              unsigned face, unsigned level,
+                              unsigned zslice,
+                              enum pipe_transfer_usage usage,
+                              unsigned x, unsigned y, unsigned w, unsigned h)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
+   struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
    struct pipe_screen *screen = tr_scr->screen;
-   struct trace_texture *tr_tex;
-   struct trace_surface *tr_surf;
-   struct pipe_surface *surface;
-   
-   assert(psurface);
-   if(*psurface) {
-      tr_tex = trace_texture(tr_scr, (*psurface)->texture);
-      tr_surf = trace_surface(tr_tex, *psurface);
-      surface = tr_surf->surface;
-   }
-   else
-      surface = NULL;
-   
-   if (*psurface) {
-      if (!--(*psurface)->refcount) {
-         trace_dump_call_begin("pipe_screen", "tex_surface_destroy");
-         
-         trace_dump_arg(ptr, screen);
-         trace_dump_arg(ptr, surface);
+   struct pipe_texture *texture = tr_tex->texture;
+   struct pipe_transfer *result = NULL;
 
-         trace_surface_destroy(tr_tex, *psurface);
+   assert(texture->screen == screen);
 
-         trace_dump_call_end();
-      }
-   
-      *psurface = NULL;
-   }
+   trace_dump_call_begin("pipe_screen", "get_tex_transfer");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg(ptr, texture);
+   trace_dump_arg(uint, face);
+   trace_dump_arg(uint, level);
+   trace_dump_arg(uint, zslice);
+   trace_dump_arg(uint, usage);
+
+   trace_dump_arg(uint, x);
+   trace_dump_arg(uint, y);
+   trace_dump_arg(uint, w);
+   trace_dump_arg(uint, h);
+
+   result = screen->get_tex_transfer(screen, texture, face, level, zslice, usage,
+                                     x, y, w, h);
+
+   trace_dump_ret(ptr, result);
+
+   trace_dump_call_end();
+
+   result = trace_transfer_create(tr_tex, result);
+
+   return result;
+}
+
+
+static void
+trace_screen_tex_transfer_destroy(struct pipe_transfer *_transfer)
+{
+   struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen);
+   struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
+   struct trace_transfer *tr_tran = trace_transfer(tr_tex, _transfer);
+   struct pipe_screen *screen = tr_scr->screen;
+   struct pipe_transfer *transfer = tr_tran->transfer;
+
+   trace_dump_call_begin("pipe_screen", "tex_transfer_destroy");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg(ptr, transfer);
+
+   trace_dump_call_end();
+
+   trace_transfer_destroy(tr_tex, _transfer);
 }
 
 
 static void *
-trace_screen_surface_map(struct pipe_screen *_screen,
-                         struct pipe_surface *surface,
-                         unsigned flags)
+trace_screen_transfer_map(struct pipe_screen *_screen,
+                          struct pipe_transfer *_transfer)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
+   struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
+   struct trace_transfer *tr_trans = trace_transfer(tr_tex, _transfer);
    struct pipe_screen *screen = tr_scr->screen;
-   struct trace_texture *tr_tex;
-   struct trace_surface *tr_surf;
+   struct pipe_transfer *transfer = tr_trans->transfer;
    void *map;
-   
-   tr_tex = trace_texture(tr_scr, surface->texture);
-   tr_surf = trace_surface(tr_tex, surface);
-   surface = tr_surf->surface;
 
-   map = screen->surface_map(screen, surface, flags);
+   map = screen->transfer_map(screen, transfer);
    if(map) {
-      if(flags & PIPE_BUFFER_USAGE_CPU_WRITE) {
-         assert(!tr_surf->map);
-         tr_surf->map = map;
+      if(transfer->usage != PIPE_TRANSFER_READ) {
+         assert(!tr_trans->map);
+         tr_trans->map = map;
       }
    }
-   
+
    return map;
 }
 
 
-static void 
-trace_screen_surface_unmap(struct pipe_screen *_screen,
-                           struct pipe_surface *surface)
+static void
+trace_screen_transfer_unmap(struct pipe_screen *_screen,
+                           struct pipe_transfer *_transfer)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
+   struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
+   struct trace_transfer *tr_trans = trace_transfer(tr_tex, _transfer);
    struct pipe_screen *screen = tr_scr->screen;
-   struct trace_texture *tr_tex;
-   struct trace_surface *tr_surf;
-   
-   tr_tex = trace_texture(tr_scr, surface->texture);
-   tr_surf = trace_surface(tr_tex, surface);
-   surface = tr_surf->surface;
-   
-   if(tr_surf->map) {
-      size_t size = surface->nblocksy * surface->stride;
-      
-      trace_dump_call_begin("pipe_winsys", "surface_write");
-      
+   struct pipe_transfer *transfer = tr_trans->transfer;
+
+   if(tr_trans->map) {
+      size_t size = transfer->nblocksy * transfer->stride;
+
+      trace_dump_call_begin("pipe_screen", "transfer_write");
+
       trace_dump_arg(ptr, screen);
-      
-      trace_dump_arg(ptr, surface);
-      
-      trace_dump_arg_begin("data");
-      trace_dump_bytes(tr_surf->map, size);
-      trace_dump_arg_end();
+
+      trace_dump_arg(ptr, transfer);
 
       trace_dump_arg_begin("stride");
-      trace_dump_uint(surface->stride);
+      trace_dump_uint(transfer->stride);
+      trace_dump_arg_end();
+
+      trace_dump_arg_begin("data");
+      trace_dump_bytes(tr_trans->map, size);
       trace_dump_arg_end();
 
       trace_dump_arg_begin("size");
       trace_dump_uint(size);
       trace_dump_arg_end();
-   
+
       trace_dump_call_end();
 
-      tr_surf->map = NULL;
+      tr_trans->map = NULL;
+   }
+
+   screen->transfer_unmap(screen, transfer);
+}
+
+
+/********************************************************************
+ * buffer
+ */
+
+
+static struct pipe_buffer *
+trace_screen_surface_buffer_create(struct pipe_screen *_screen,
+                                   unsigned width, unsigned height,
+                                   enum pipe_format format,
+                                   unsigned usage,
+                                   unsigned *pstride)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct pipe_screen *screen = tr_scr->screen;
+   unsigned stride;
+   struct pipe_buffer *result;
+
+   trace_dump_call_begin("pipe_screen", "surface_buffer_create");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg(uint, width);
+   trace_dump_arg(uint, height);
+   trace_dump_arg(format, format);
+   trace_dump_arg(uint, usage);
+
+   result = screen->surface_buffer_create(screen,
+                                          width, height,
+                                          format,
+                                          usage,
+                                          pstride);
+
+   stride = *pstride;
+
+   trace_dump_arg(uint, stride);
+
+   trace_dump_ret(ptr, result);
+
+   trace_dump_call_end();
+
+   return trace_buffer_create(tr_scr, result);
+}
+
+
+static struct pipe_buffer *
+trace_screen_buffer_create(struct pipe_screen *_screen,
+                           unsigned alignment,
+                           unsigned usage,
+                           unsigned size)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct pipe_screen *screen = tr_scr->screen;
+   struct pipe_buffer *result;
+
+   trace_dump_call_begin("pipe_screen", "buffer_create");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg(uint, alignment);
+   trace_dump_arg(uint, usage);
+   trace_dump_arg(uint, size);
+
+   result = screen->buffer_create(screen, alignment, usage, size);
+
+   trace_dump_ret(ptr, result);
+
+   trace_dump_call_end();
+
+   /* Zero the buffer to avoid dumping uninitialized memory */
+   if(result->usage & PIPE_BUFFER_USAGE_CPU_WRITE) {
+      void *map;
+      map = pipe_buffer_map(screen, result, PIPE_BUFFER_USAGE_CPU_WRITE);
+      if(map) {
+         memset(map, 0, result->size);
+         screen->buffer_unmap(screen, result);
+      }
+   }
+
+   return trace_buffer_create(tr_scr, result);
+}
+
+
+static struct pipe_buffer *
+trace_screen_user_buffer_create(struct pipe_screen *_screen,
+                                void *data,
+                                unsigned size)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct pipe_screen *screen = tr_scr->screen;
+   struct pipe_buffer *result;
+
+   trace_dump_call_begin("pipe_screen", "user_buffer_create");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg_begin("data");
+   trace_dump_bytes(data, size);
+   trace_dump_arg_end();
+   trace_dump_arg(uint, size);
+
+   result = screen->user_buffer_create(screen, data, size);
+
+   trace_dump_ret(ptr, result);
+
+   trace_dump_call_end();
+
+   if(result) {
+      assert(!(result->usage & TRACE_BUFFER_USAGE_USER));
+      result->usage |= TRACE_BUFFER_USAGE_USER;
+   }
+
+   return trace_buffer_create(tr_scr, result);
+}
+
+
+/**
+ * This function is used to track if data has been changed on a user buffer
+ * without map/unmap being called.
+ */
+void
+trace_screen_user_buffer_update(struct pipe_screen *_screen,
+                                struct pipe_buffer *_buffer)
+{
+#if 0
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct pipe_screen *screen = tr_scr->screen;
+   const void *map;
+
+   if(buffer && buffer->usage & TRACE_BUFFER_USAGE_USER) {
+      map = screen->buffer_map(screen, buffer, PIPE_BUFFER_USAGE_CPU_READ);
+      if(map) {
+         trace_dump_call_begin("pipe_winsys", "buffer_write");
+
+         trace_dump_arg(ptr, screen);
+
+         trace_dump_arg(ptr, buffer);
+
+         trace_dump_arg_begin("data");
+         trace_dump_bytes(map, buffer->size);
+         trace_dump_arg_end();
+
+         trace_dump_arg_begin("size");
+         trace_dump_uint(buffer->size);
+         trace_dump_arg_end();
+
+         trace_dump_call_end();
+
+         screen->buffer_unmap(screen, buffer);
+      }
+   }
+#endif
+}
+
+
+static void *
+trace_screen_buffer_map(struct pipe_screen *_screen,
+                        struct pipe_buffer *_buffer,
+                        unsigned usage)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+   struct pipe_screen *screen = tr_scr->screen;
+   struct pipe_buffer *buffer = tr_buf->buffer;
+   void *map;
+
+   assert(screen->buffer_map);
+   map = screen->buffer_map(screen, buffer, usage);
+   if(map) {
+      if(usage & PIPE_BUFFER_USAGE_CPU_WRITE) {
+         tr_buf->map = map;
+      }
+   }
+
+   return map;
+}
+
+
+static void *
+trace_screen_buffer_map_range(struct pipe_screen *_screen,
+                              struct pipe_buffer *_buffer,
+                              unsigned offset,
+                              unsigned length,
+                              unsigned usage)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+   struct pipe_screen *screen = tr_scr->screen;
+   struct pipe_buffer *buffer = tr_buf->buffer;
+   void *map;
+
+   assert(screen->buffer_map_range);
+   map = screen->buffer_map_range(screen, buffer, offset, length, usage);
+   if(map) {
+      if(usage & PIPE_BUFFER_USAGE_CPU_WRITE) {
+         tr_buf->map = map;
+      }
    }
 
-   screen->surface_unmap(screen, surface);
+   return map;
+}
+
+
+static void
+buffer_write(struct pipe_screen *screen,
+             struct pipe_buffer *buffer,
+             unsigned offset,
+             const char *map,
+             unsigned size)
+{
+   assert(map);
+
+   trace_dump_call_begin("pipe_screen", "buffer_write");
+
+   trace_dump_arg(ptr, screen);
+
+   trace_dump_arg(ptr, buffer);
+
+   trace_dump_arg(uint, offset);
+
+   trace_dump_arg_begin("data");
+   trace_dump_bytes(map + offset, size);
+   trace_dump_arg_end();
+
+   trace_dump_arg(uint, size);
+
+   trace_dump_call_end();
+
+}
+
+
+static void
+trace_screen_buffer_flush_mapped_range(struct pipe_screen *_screen,
+                                       struct pipe_buffer *_buffer,
+                                       unsigned offset,
+                                       unsigned length)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+   struct pipe_screen *screen = tr_scr->screen;
+   struct pipe_buffer *buffer = tr_buf->buffer;
+
+   assert(tr_buf->map);
+   buffer_write(screen, buffer, offset, tr_buf->map, length);
+   tr_buf->range_flushed = TRUE;
+   screen->buffer_flush_mapped_range(screen, buffer, offset, length);
+}
+
+
+static void
+trace_screen_buffer_unmap(struct pipe_screen *_screen,
+                          struct pipe_buffer *_buffer)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+   struct pipe_screen *screen = tr_scr->screen;
+   struct pipe_buffer *buffer = tr_buf->buffer;
+
+   if (tr_buf->map && !tr_buf->range_flushed)
+      buffer_write(screen, buffer, tr_buf->map, 0, buffer->size);
+   tr_buf->map = NULL;
+   tr_buf->range_flushed = FALSE;
+   screen->buffer_unmap(screen, buffer);
+}
+
+
+static void
+trace_screen_buffer_destroy(struct pipe_buffer *_buffer)
+{
+   struct trace_screen *tr_scr = trace_screen(_buffer->screen);
+   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+   struct pipe_screen *screen = tr_scr->screen;
+   struct pipe_buffer *buffer = tr_buf->buffer;
+
+   trace_dump_call_begin("pipe_screen", "buffer_destroy");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg(ptr, buffer);
+
+   trace_dump_call_end();
+
+   trace_buffer_destroy(tr_scr, _buffer);
+}
+
+
+/********************************************************************
+ * fence
+ */
+
+
+static void
+trace_screen_fence_reference(struct pipe_screen *_screen,
+                             struct pipe_fence_handle **dst,
+                             struct pipe_fence_handle *src)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct pipe_screen *screen = tr_scr->screen;
+
+   trace_dump_call_begin("pipe_screen", "fence_reference");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg(ptr, dst);
+   trace_dump_arg(ptr, src);
+
+   screen->fence_reference(screen, dst, src);
+
+   trace_dump_call_end();
+}
+
+
+static int
+trace_screen_fence_signalled(struct pipe_screen *_screen,
+                             struct pipe_fence_handle *fence,
+                             unsigned flag)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct pipe_screen *screen = tr_scr->screen;
+   int result;
+
+   trace_dump_call_begin("pipe_screen", "fence_signalled");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg(ptr, fence);
+   trace_dump_arg(uint, flag);
+
+   result = screen->fence_signalled(screen, fence, flag);
+
+   trace_dump_ret(int, result);
+
+   trace_dump_call_end();
+
+   return result;
 }
 
 
+static int
+trace_screen_fence_finish(struct pipe_screen *_screen,
+                          struct pipe_fence_handle *fence,
+                          unsigned flag)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct pipe_screen *screen = tr_scr->screen;
+   int result;
+
+   trace_dump_call_begin("pipe_screen", "fence_finish");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg(ptr, fence);
+   trace_dump_arg(uint, flag);
+
+   result = screen->fence_finish(screen, fence, flag);
+
+   trace_dump_ret(int, result);
+
+   trace_dump_call_end();
+
+   return result;
+}
+
+
+/********************************************************************
+ * screen
+ */
+
 static void
 trace_screen_destroy(struct pipe_screen *_screen)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
    struct pipe_screen *screen = tr_scr->screen;
-   
+
    trace_dump_call_begin("pipe_screen", "destroy");
-   
+
    trace_dump_arg(ptr, screen);
 
    screen->destroy(screen);
-   
+
    trace_dump_call_end();
 
    trace_dump_trace_end();
@@ -410,21 +836,27 @@ trace_screen_create(struct pipe_screen *screen)
 {
    struct trace_screen *tr_scr;
    struct pipe_winsys *winsys;
-   
+
    if(!screen)
       goto error1;
 
    if(!trace_dump_trace_begin())
       goto error1;
 
+   trace_dump_call_begin("", "pipe_screen_create");
+
    tr_scr = CALLOC_STRUCT(trace_screen);
    if(!tr_scr)
       goto error2;
 
+#if 0
    winsys = trace_winsys_create(screen->winsys);
    if(!winsys)
       goto error3;
-   
+#else
+   winsys = screen->winsys;
+#endif
+
    tr_scr->base.winsys = winsys;
    tr_scr->base.destroy = trace_screen_destroy;
    tr_scr->base.get_name = trace_screen_get_name;
@@ -434,26 +866,43 @@ trace_screen_create(struct pipe_screen *screen)
    tr_scr->base.is_format_supported = trace_screen_is_format_supported;
    tr_scr->base.texture_create = trace_screen_texture_create;
    tr_scr->base.texture_blanket = trace_screen_texture_blanket;
-   tr_scr->base.texture_release = trace_screen_texture_release;
+   tr_scr->base.texture_destroy = trace_screen_texture_destroy;
    tr_scr->base.get_tex_surface = trace_screen_get_tex_surface;
-   tr_scr->base.tex_surface_release = trace_screen_tex_surface_release;
-   tr_scr->base.surface_map = trace_screen_surface_map;
-   tr_scr->base.surface_unmap = trace_screen_surface_unmap;
-   
+   tr_scr->base.tex_surface_destroy = trace_screen_tex_surface_destroy;
+   tr_scr->base.get_tex_transfer = trace_screen_get_tex_transfer;
+   tr_scr->base.tex_transfer_destroy = trace_screen_tex_transfer_destroy;
+   tr_scr->base.transfer_map = trace_screen_transfer_map;
+   tr_scr->base.transfer_unmap = trace_screen_transfer_unmap;
+   tr_scr->base.buffer_create = trace_screen_buffer_create;
+   tr_scr->base.user_buffer_create = trace_screen_user_buffer_create;
+   tr_scr->base.surface_buffer_create = trace_screen_surface_buffer_create;
+   if (screen->buffer_map)
+      tr_scr->base.buffer_map = trace_screen_buffer_map;
+   if (screen->buffer_map_range)
+      tr_scr->base.buffer_map_range = trace_screen_buffer_map_range;
+   if (screen->buffer_flush_mapped_range)
+      tr_scr->base.buffer_flush_mapped_range = trace_screen_buffer_flush_mapped_range;
+   if (screen->buffer_unmap)
+      tr_scr->base.buffer_unmap = trace_screen_buffer_unmap;
+   tr_scr->base.buffer_destroy = trace_screen_buffer_destroy;
+   tr_scr->base.fence_reference = trace_screen_fence_reference;
+   tr_scr->base.fence_signalled = trace_screen_fence_signalled;
+   tr_scr->base.fence_finish = trace_screen_fence_finish;
+   tr_scr->base.flush_frontbuffer = trace_screen_flush_frontbuffer;
    tr_scr->screen = screen;
 
-   trace_dump_call_begin("", "pipe_screen_create");
-   trace_dump_arg_begin("winsys");
-   trace_dump_ptr(screen->winsys);
-   trace_dump_arg_end();
    trace_dump_ret(ptr, screen);
    trace_dump_call_end();
 
    return &tr_scr->base;
 
+#if 0
 error3:
    FREE(tr_scr);
+#endif
 error2:
+   trace_dump_ret(ptr, screen);
+   trace_dump_call_end();
    trace_dump_trace_end();
 error1:
    return screen;
index 93fefdb9a5f69df2ce8a9656adfda05cc8b59149..8c65516b509731829b30445d981235321ca3cd08 100644 (file)
 extern "C" {
 #endif
 
-   
+
+/**
+ * It often happens that new data is written directly to the user buffers
+ * without mapping/unmapping. This flag marks user buffers, so that their
+ * contents can be dumpped before being used by the pipe context.
+ */
+#define TRACE_BUFFER_USAGE_USER  (1 << 31)
+
+
 struct trace_screen
 {
    struct pipe_screen base;
-   
+
    struct pipe_screen *screen;
 };
 
@@ -53,6 +61,11 @@ struct pipe_screen *
 trace_screen_create(struct pipe_screen *screen);
 
 
+void
+trace_screen_user_buffer_update(struct pipe_screen *screen,
+                                struct pipe_buffer *buffer);
+
+
 #ifdef __cplusplus
 }
 #endif
index 524f2d61948326f4e7158194bc4fb7660b1dc63a..b6a1ce0d6252a6830da8afdc336200ac076ef109 100644 (file)
@@ -50,6 +50,14 @@ void trace_dump_block(const struct pipe_format_block *block)
 }
 
 
+static void trace_dump_reference(const struct pipe_reference *reference)
+{
+   trace_dump_struct_begin("pipe_reference");
+   trace_dump_member(int, &reference->count, count);
+   trace_dump_struct_end();
+}
+
+
 void trace_dump_template(const struct pipe_texture *templat)
 {
    if(!templat) {
@@ -58,10 +66,10 @@ void trace_dump_template(const struct pipe_texture *templat)
    }
 
    trace_dump_struct_begin("pipe_texture");
-   
+
    trace_dump_member(int, templat, target);
    trace_dump_member(format, templat, format);
-   
+
    trace_dump_member_begin("width");
    trace_dump_array(uint, templat->width, 1);
    trace_dump_member_end();
@@ -77,10 +85,10 @@ void trace_dump_template(const struct pipe_texture *templat)
    trace_dump_member_begin("block");
    trace_dump_block(&templat->block);
    trace_dump_member_end();
-   
+
    trace_dump_member(uint, templat, last_level);
    trace_dump_member(uint, templat, tex_usage);
-   
+
    trace_dump_struct_end();
 }
 
@@ -114,8 +122,7 @@ void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state)
    trace_dump_member(uint, state, line_stipple_factor);
    trace_dump_member(uint, state, line_stipple_pattern);
    trace_dump_member(bool, state, line_last_pixel);
-   trace_dump_member(bool, state, bypass_clipping);
-   trace_dump_member(bool, state, bypass_vs);
+   trace_dump_member(bool, state, bypass_vs_clip_and_viewport);
    trace_dump_member(bool, state, origin_lower_left);
    trace_dump_member(bool, state, flatshade_first);
    trace_dump_member(bool, state, gl_rasterization_rules);
@@ -126,9 +133,9 @@ void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state)
    trace_dump_member(float, state, point_size_max);
    trace_dump_member(float, state, offset_units);
    trace_dump_member(float, state, offset_scale);
-   
+
    trace_dump_member_array(uint, state, sprite_coord_mode);
-   
+
    trace_dump_struct_end();
 }
 
@@ -144,10 +151,10 @@ void trace_dump_poly_stipple(const struct pipe_poly_stipple *state)
 
    trace_dump_member_begin("stipple");
    trace_dump_array(uint,
-                    state->stipple, 
+                    state->stipple,
                     Elements(state->stipple));
    trace_dump_member_end();
-   
+
    trace_dump_struct_end();
 }
 
@@ -163,7 +170,7 @@ void trace_dump_viewport_state(const struct pipe_viewport_state *state)
 
    trace_dump_member_array(float, state, scale);
    trace_dump_member_array(float, state, translate);
-   
+
    trace_dump_struct_end();
 }
 
@@ -189,7 +196,7 @@ void trace_dump_scissor_state(const struct pipe_scissor_state *state)
 void trace_dump_clip_state(const struct pipe_clip_state *state)
 {
    unsigned i;
-   
+
    if(!state) {
       trace_dump_null();
       return;
@@ -222,7 +229,7 @@ void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
 
    trace_dump_struct_begin("pipe_constant_buffer");
 
-   trace_dump_member(ptr, state, buffer);
+   trace_dump_member(buffer_ptr, state, buffer);
 
    trace_dump_struct_end();
 }
@@ -238,7 +245,7 @@ void trace_dump_shader_state(const struct pipe_shader_state *state)
    }
 
    tgsi_dump_str(state->tokens, 0, str, sizeof(str));
-   
+
    trace_dump_struct_begin("pipe_shader_state");
 
    trace_dump_member_begin("tokens");
@@ -252,7 +259,7 @@ void trace_dump_shader_state(const struct pipe_shader_state *state)
 void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state)
 {
    unsigned i;
-   
+
    if(!state) {
       trace_dump_null();
       return;
@@ -268,7 +275,7 @@ void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_
    trace_dump_member(bool, &state->depth, occlusion_count);
    trace_dump_struct_end();
    trace_dump_member_end();
-   
+
    trace_dump_member_begin("stencil");
    trace_dump_array_begin();
    for(i = 0; i < Elements(state->stencil); ++i) {
@@ -397,22 +404,47 @@ void trace_dump_surface(const struct pipe_surface *state)
 
    trace_dump_struct_begin("pipe_surface");
 
+   trace_dump_reference(&state->reference);
+
    trace_dump_member(format, state, format);
    trace_dump_member(uint, state, status);
    trace_dump_member(uint, state, clear_value);
    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_struct_end();
+}
+
+
+void trace_dump_transfer(const struct pipe_transfer *state)
+{
+   if(!state) {
+      trace_dump_null();
+      return;
+   }
+
+   trace_dump_struct_begin("pipe_transfer");
+
+   trace_dump_member(format, state, format);
+   trace_dump_member(uint, state, width);
+   trace_dump_member(uint, state, height);
+
    trace_dump_member_begin("block");
    trace_dump_block(&state->block);
    trace_dump_member_end();
-   
+
    trace_dump_member(uint, state, nblocksx);
    trace_dump_member(uint, state, nblocksy);
    trace_dump_member(uint, state, stride);
-   trace_dump_member(uint, state, layout);
-   trace_dump_member(uint, state, offset);
-   trace_dump_member(uint, state, refcount);
    trace_dump_member(uint, state, usage);
 
    trace_dump_member(ptr, state, texture);
@@ -436,7 +468,7 @@ void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state)
    trace_dump_member(uint, state, stride);
    trace_dump_member(uint, state, max_index);
    trace_dump_member(uint, state, buffer_offset);
-   trace_dump_member(ptr, state, buffer);
+   trace_dump_member(buffer_ptr, state, buffer);
 
    trace_dump_struct_end();
 }
@@ -455,7 +487,7 @@ void trace_dump_vertex_element(const struct pipe_vertex_element *state)
 
    trace_dump_member(uint, state, vertex_buffer_index);
    trace_dump_member(uint, state, nr_components);
+
    trace_dump_member(format, state, src_format);
 
    trace_dump_struct_end();
index 5ae533dc664807b289499fd3590488d352960e39..513ed0ac98d4453ba0fcedeba21908ab22a03ac4 100644 (file)
@@ -68,6 +68,8 @@ void trace_dump_sampler_state(const struct pipe_sampler_state *state);
 
 void trace_dump_surface(const struct pipe_surface *state);
 
+void trace_dump_transfer(const struct pipe_transfer *state);
+
 void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state);
 
 void trace_dump_vertex_element(const struct pipe_vertex_element *state);
index 1cc4f0bd43686f9ed84e0f225737915a11603ca0..7b392f0728692b445ba870205a96c40904c7e473 100644 (file)
@@ -25,7 +25,6 @@
  *
  **************************************************************************/
 
-#include "pipe/p_inlines.h"
 #include "util/u_hash_table.h"
 #include "util/u_memory.h"
 
 
 
 struct pipe_texture *
-trace_texture_create(struct trace_screen *tr_scr, 
+trace_texture_create(struct trace_screen *tr_scr,
                      struct pipe_texture *texture)
 {
    struct trace_texture *tr_tex;
-   
+
    if(!texture)
       goto error;
-   
+
    assert(texture->screen == tr_scr->screen);
-   
+
    tr_tex = CALLOC_STRUCT(trace_texture);
    if(!tr_tex)
       goto error;
-   
+
    memcpy(&tr_tex->base, texture, sizeof(struct pipe_texture));
+
+   pipe_reference_init(&tr_tex->base.reference, 1);
    tr_tex->base.screen = &tr_scr->base;
    tr_tex->texture = texture;
-   
+
    return &tr_tex->base;
-   
+
 error:
    pipe_texture_reference(&texture, NULL);
    return NULL;
@@ -61,38 +62,39 @@ error:
 
 
 void
-trace_texture_destroy(struct trace_screen *tr_scr, 
+trace_texture_destroy(struct trace_screen *tr_scr,
                       struct pipe_texture *texture)
 {
-   struct trace_texture *tr_tex = trace_texture(tr_scr, texture); 
+   struct trace_texture *tr_tex = trace_texture(tr_scr, texture);
    pipe_texture_reference(&tr_tex->texture, NULL);
    FREE(tr_tex);
 }
 
 
 struct pipe_surface *
-trace_surface_create(struct trace_texture *tr_tex, 
+trace_surface_create(struct trace_texture *tr_tex,
                      struct pipe_surface *surface)
 {
    struct trace_surface *tr_surf;
-   
+
    if(!surface)
       goto error;
-   
+
    assert(surface->texture == tr_tex->texture);
-   
+
    tr_surf = CALLOC_STRUCT(trace_surface);
    if(!tr_surf)
       goto error;
-   
+
    memcpy(&tr_surf->base, surface, sizeof(struct pipe_surface));
-   
+
+   pipe_reference_init(&tr_surf->base.reference, 1);
    tr_surf->base.texture = NULL;
    pipe_texture_reference(&tr_surf->base.texture, &tr_tex->base);
    tr_surf->surface = surface;
 
    return &tr_surf->base;
-   
+
 error:
    pipe_surface_reference(&surface, NULL);
    return NULL;
@@ -100,7 +102,7 @@ error:
 
 
 void
-trace_surface_destroy(struct trace_texture *tr_tex, 
+trace_surface_destroy(struct trace_texture *tr_tex,
                       struct pipe_surface *surface)
 {
    struct trace_surface *tr_surf = trace_surface(tr_tex, surface);
@@ -109,3 +111,45 @@ trace_surface_destroy(struct trace_texture *tr_tex,
    FREE(tr_surf);
 }
 
+
+struct pipe_transfer *
+trace_transfer_create(struct trace_texture *tr_tex,
+                     struct pipe_transfer *transfer)
+{
+   struct trace_transfer *tr_trans;
+
+   if(!transfer)
+      goto error;
+
+   assert(transfer->texture == tr_tex->texture);
+
+   tr_trans = CALLOC_STRUCT(trace_transfer);
+   if(!tr_trans)
+      goto error;
+
+   memcpy(&tr_trans->base, transfer, sizeof(struct pipe_transfer));
+
+   tr_trans->base.texture = NULL;
+   pipe_texture_reference(&tr_trans->base.texture, &tr_tex->base);
+   tr_trans->transfer = transfer;
+   assert(tr_trans->base.texture == &tr_tex->base);
+
+   return &tr_trans->base;
+
+error:
+   transfer->texture->screen->tex_transfer_destroy(transfer);
+   return NULL;
+}
+
+
+void
+trace_transfer_destroy(struct trace_texture *tr_tex,
+                      struct pipe_transfer *transfer)
+{
+   struct trace_transfer *tr_trans = trace_transfer(tr_tex, transfer);
+   struct pipe_screen *screen = tr_trans->transfer->texture->screen;
+   pipe_texture_reference(&tr_trans->base.texture, NULL);
+   screen->tex_transfer_destroy(tr_trans->transfer);
+   FREE(tr_trans);
+}
+
index 9e72edb8a3cfacd5e1a9c4661d26a685de7b5960..9c21bc7d27651098a5813465c81044f44611000c 100644 (file)
@@ -48,48 +48,78 @@ struct trace_surface
    struct pipe_surface base;
 
    struct pipe_surface *surface;
-   
+};
+
+
+struct trace_transfer
+{
+   struct pipe_transfer base;
+
+   struct pipe_transfer *transfer;
+
    void *map;
 };
 
 
 static INLINE struct trace_texture *
-trace_texture(struct trace_screen *tr_scr, 
+trace_texture(struct trace_screen *tr_scr,
               struct pipe_texture *texture)
 {
    if(!texture)
       return NULL;
+   assert(tr_scr);
    assert(texture->screen == &tr_scr->base);
    return (struct trace_texture *)texture;
 }
 
 
 static INLINE struct trace_surface *
-trace_surface(struct trace_texture *tr_tex, 
+trace_surface(struct trace_texture *tr_tex,
               struct pipe_surface *surface)
 {
    if(!surface)
       return NULL;
+   assert(tr_tex);
    assert(surface->texture == &tr_tex->base);
    return (struct trace_surface *)surface;
 }
 
 
+static INLINE struct trace_transfer *
+trace_transfer(struct trace_texture *tr_tex,
+               struct pipe_transfer *transfer)
+{
+   if(!transfer)
+      return NULL;
+   assert(tr_tex);
+   assert(transfer->texture == &tr_tex->base);
+   return (struct trace_transfer *)transfer;
+}
+
+
 struct pipe_texture *
-trace_texture_create(struct trace_screen *tr_scr, 
+trace_texture_create(struct trace_screen *tr_scr,
                      struct pipe_texture *texture);
 
 void
-trace_texture_destroy(struct trace_screen *tr_scr, 
+trace_texture_destroy(struct trace_screen *tr_scr,
                       struct pipe_texture *texture);
 
 struct pipe_surface *
-trace_surface_create(struct trace_texture *tr_tex, 
+trace_surface_create(struct trace_texture *tr_tex,
                      struct pipe_surface *surface);
 
 void
 trace_surface_destroy(struct trace_texture *tr_tex,
                       struct pipe_surface *surface);
 
+struct pipe_transfer *
+trace_transfer_create(struct trace_texture *tr_tex,
+                      struct pipe_transfer *transfer);
+
+void
+trace_transfer_destroy(struct trace_texture *tr_tex,
+                       struct pipe_transfer *transfer);
+
 
 #endif /* TR_TEXTURE_H_ */
diff --git a/src/gallium/drivers/trace/tr_winsys.c b/src/gallium/drivers/trace/tr_winsys.c
deleted file mode 100644 (file)
index c4148fe..0000000
+++ /dev/null
@@ -1,450 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "util/u_memory.h"
-#include "util/u_hash_table.h"
-
-#include "tr_dump.h"
-#include "tr_state.h"
-#include "tr_screen.h"
-#include "tr_texture.h"
-#include "tr_winsys.h"
-
-
-static unsigned trace_buffer_hash(void *buffer)
-{
-   return (unsigned)(uintptr_t)buffer;
-}
-
-
-static int trace_buffer_compare(void *buffer1, void *buffer2)
-{
-   return (char *)buffer2 - (char *)buffer1;
-}
-
-                  
-static const char *
-trace_winsys_get_name(struct pipe_winsys *_winsys)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   const char *result;
-   
-   trace_dump_call_begin("pipe_winsys", "get_name");
-   
-   trace_dump_arg(ptr, winsys);
-
-   result = winsys->get_name(winsys);
-   
-   trace_dump_ret(string, result);
-   
-   trace_dump_call_end();
-   
-   return result;
-}
-
-
-static void 
-trace_winsys_flush_frontbuffer(struct pipe_winsys *_winsys,
-                               struct pipe_surface *surface,
-                               void *context_private)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-
-   assert(surface);
-   if(surface->texture) {
-      struct trace_screen *tr_scr = trace_screen(surface->texture->screen);
-      struct trace_texture *tr_tex = trace_texture(tr_scr, surface->texture);
-      struct trace_surface *tr_surf = trace_surface(tr_tex, surface);
-      surface = tr_surf->surface;
-   }
-   
-   trace_dump_call_begin("pipe_winsys", "flush_frontbuffer");
-   
-   trace_dump_arg(ptr, winsys);
-   trace_dump_arg(ptr, surface);
-   /* XXX: hide, as there is nothing we can do with this
-   trace_dump_arg(ptr, context_private);
-   */
-
-   winsys->flush_frontbuffer(winsys, surface, context_private);
-   
-   trace_dump_call_end();
-}
-
-
-static struct pipe_buffer *
-trace_winsys_surface_buffer_create(struct pipe_winsys *_winsys,
-                                   unsigned width, unsigned height,
-                                   enum pipe_format format,
-                                   unsigned usage,
-                                   unsigned *pstride)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   unsigned stride;
-   struct pipe_buffer *result;
-   
-   trace_dump_call_begin("pipe_winsys", "surface_buffer_create");
-   
-   trace_dump_arg(ptr, winsys);
-   trace_dump_arg(uint, width);
-   trace_dump_arg(uint, height);
-   trace_dump_arg(format, format);
-   trace_dump_arg(uint, usage);
-
-   result = winsys->surface_buffer_create(winsys,
-                                          width, height,
-                                          format,
-                                          usage,
-                                          pstride);
-   
-   stride = *pstride;
-   
-   trace_dump_arg(uint, stride);
-   
-   trace_dump_ret(ptr, result);
-   
-   trace_dump_call_end();
-   
-   return result;
-}
-
-
-static struct pipe_buffer *
-trace_winsys_buffer_create(struct pipe_winsys *_winsys, 
-                           unsigned alignment, 
-                           unsigned usage,
-                           unsigned size)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   struct pipe_buffer *buffer;
-   
-   trace_dump_call_begin("pipe_winsys", "buffer_create");
-   
-   trace_dump_arg(ptr, winsys);
-   trace_dump_arg(uint, alignment);
-   trace_dump_arg(uint, usage);
-   trace_dump_arg(uint, size);
-
-   buffer = winsys->buffer_create(winsys, alignment, usage, size);
-   
-   trace_dump_ret(ptr, buffer);
-   
-   trace_dump_call_end();
-
-   /* Zero the buffer to avoid dumping uninitialized memory */
-   if(buffer->usage & PIPE_BUFFER_USAGE_CPU_WRITE) {
-      void *map;
-      map = winsys->buffer_map(winsys, buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
-      if(map) {
-         memset(map, 0, buffer->size);
-         winsys->buffer_unmap(winsys, buffer);
-      }
-   }
-   
-   return buffer;
-}
-
-
-static struct pipe_buffer *
-trace_winsys_user_buffer_create(struct pipe_winsys *_winsys, 
-                                void *data,
-                                unsigned size)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   struct pipe_buffer *result;
-   
-   trace_dump_call_begin("pipe_winsys", "user_buffer_create");
-   
-   trace_dump_arg(ptr, winsys);
-   trace_dump_arg_begin("data");
-   trace_dump_bytes(data, size);
-   trace_dump_arg_end();
-   trace_dump_arg(uint, size);
-
-   result = winsys->user_buffer_create(winsys, data, size);
-   
-   trace_dump_ret(ptr, result);
-   
-   trace_dump_call_end();
-   
-   /* XXX: Mark the user buffers. (we should wrap pipe_buffers, but is is 
-    * impossible to do so while texture-less surfaces are still around */
-   if(result) {
-      assert(!(result->usage & TRACE_BUFFER_USAGE_USER));
-      result->usage |= TRACE_BUFFER_USAGE_USER;
-   }
-   
-   return result;
-}
-
-
-void
-trace_winsys_user_buffer_update(struct pipe_winsys *_winsys, 
-                                struct pipe_buffer *buffer)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   const void *map;
-   
-   if(buffer && buffer->usage & TRACE_BUFFER_USAGE_USER) {
-      map = winsys->buffer_map(winsys, buffer, PIPE_BUFFER_USAGE_CPU_READ);
-      if(map) {
-         trace_dump_call_begin("pipe_winsys", "buffer_write");
-         
-         trace_dump_arg(ptr, winsys);
-         
-         trace_dump_arg(ptr, buffer);
-         
-         trace_dump_arg_begin("data");
-         trace_dump_bytes(map, buffer->size);
-         trace_dump_arg_end();
-      
-         trace_dump_arg_begin("size");
-         trace_dump_uint(buffer->size);
-         trace_dump_arg_end();
-      
-         trace_dump_call_end();
-         
-         winsys->buffer_unmap(winsys, buffer);
-      }
-   }
-}
-
-
-static void *
-trace_winsys_buffer_map(struct pipe_winsys *_winsys, 
-                        struct pipe_buffer *buffer,
-                        unsigned usage)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   void *map;
-   
-   map = winsys->buffer_map(winsys, buffer, usage);
-   if(map) {
-      if(usage & PIPE_BUFFER_USAGE_CPU_WRITE) {
-         assert(!hash_table_get(tr_ws->buffer_maps, buffer));
-         hash_table_set(tr_ws->buffer_maps, buffer, map);
-      }
-   }
-   
-   return map;
-}
-
-
-static void
-trace_winsys_buffer_unmap(struct pipe_winsys *_winsys, 
-                          struct pipe_buffer *buffer)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   const void *map;
-   
-   map = hash_table_get(tr_ws->buffer_maps, buffer);
-   if(map) {
-      trace_dump_call_begin("pipe_winsys", "buffer_write");
-      
-      trace_dump_arg(ptr, winsys);
-      
-      trace_dump_arg(ptr, buffer);
-      
-      trace_dump_arg_begin("data");
-      trace_dump_bytes(map, buffer->size);
-      trace_dump_arg_end();
-
-      trace_dump_arg_begin("size");
-      trace_dump_uint(buffer->size);
-      trace_dump_arg_end();
-   
-      trace_dump_call_end();
-
-      hash_table_remove(tr_ws->buffer_maps, buffer);
-   }
-   
-   winsys->buffer_unmap(winsys, buffer);
-}
-
-
-static void
-trace_winsys_buffer_destroy(struct pipe_winsys *_winsys,
-                            struct pipe_buffer *buffer)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   
-   trace_dump_call_begin("pipe_winsys", "buffer_destroy");
-   
-   trace_dump_arg(ptr, winsys);
-   trace_dump_arg(ptr, buffer);
-
-   winsys->buffer_destroy(winsys, buffer);
-   
-   trace_dump_call_end();
-}
-
-
-static void
-trace_winsys_fence_reference(struct pipe_winsys *_winsys,
-                             struct pipe_fence_handle **pdst,
-                             struct pipe_fence_handle *src)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   struct pipe_fence_handle *dst = *pdst;
-   
-   trace_dump_call_begin("pipe_winsys", "fence_reference");
-   
-   trace_dump_arg(ptr, winsys);
-   trace_dump_arg(ptr, dst);
-   trace_dump_arg(ptr, src);
-
-   winsys->fence_reference(winsys, pdst, src);
-   
-   trace_dump_call_end();
-}
-
-
-static int
-trace_winsys_fence_signalled(struct pipe_winsys *_winsys,
-                             struct pipe_fence_handle *fence,
-                             unsigned flag)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   int result;
-   
-   trace_dump_call_begin("pipe_winsys", "fence_signalled");
-   
-   trace_dump_arg(ptr, winsys);
-   trace_dump_arg(ptr, fence);
-   trace_dump_arg(uint, flag);
-
-   result = winsys->fence_signalled(winsys, fence, flag);
-   
-   trace_dump_ret(int, result);
-   
-   trace_dump_call_end();
-   
-   return result;
-}
-
-
-static int
-trace_winsys_fence_finish(struct pipe_winsys *_winsys,
-                          struct pipe_fence_handle *fence,
-                          unsigned flag)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   int result;
-   
-   trace_dump_call_begin("pipe_winsys", "fence_finish");
-   
-   trace_dump_arg(ptr, winsys);
-   trace_dump_arg(ptr, fence);
-   trace_dump_arg(uint, flag);
-
-   result = winsys->fence_finish(winsys, fence, flag);
-   
-   trace_dump_ret(int, result);
-   
-   trace_dump_call_end();
-   
-   return result;
-}
-
-
-static void
-trace_winsys_destroy(struct pipe_winsys *_winsys)
-{
-   struct trace_winsys *tr_ws = trace_winsys(_winsys);
-   struct pipe_winsys *winsys = tr_ws->winsys;
-   
-   trace_dump_call_begin("pipe_winsys", "destroy");
-   
-   trace_dump_arg(ptr, winsys);
-
-   /* 
-   winsys->destroy(winsys); 
-   */
-   
-   trace_dump_call_end();
-   
-   hash_table_destroy(tr_ws->buffer_maps);
-
-   FREE(tr_ws);
-}
-
-
-struct pipe_winsys *
-trace_winsys_create(struct pipe_winsys *winsys)
-{
-   struct trace_winsys *tr_ws;
-   
-   if(!winsys)
-      goto error1;
-   
-   tr_ws = CALLOC_STRUCT(trace_winsys);
-   if(!tr_ws)
-      goto error1;
-
-   tr_ws->base.destroy = trace_winsys_destroy;
-   tr_ws->base.get_name = trace_winsys_get_name;
-   tr_ws->base.flush_frontbuffer = trace_winsys_flush_frontbuffer;
-   tr_ws->base.surface_buffer_create = trace_winsys_surface_buffer_create;
-   tr_ws->base.buffer_create = trace_winsys_buffer_create;
-   tr_ws->base.user_buffer_create = trace_winsys_user_buffer_create;
-   tr_ws->base.buffer_map = trace_winsys_buffer_map;
-   tr_ws->base.buffer_unmap = trace_winsys_buffer_unmap;
-   tr_ws->base.buffer_destroy = trace_winsys_buffer_destroy;
-   tr_ws->base.fence_reference = trace_winsys_fence_reference;
-   tr_ws->base.fence_signalled = trace_winsys_fence_signalled;
-   tr_ws->base.fence_finish = trace_winsys_fence_finish;
-   
-   tr_ws->winsys = winsys;
-
-   tr_ws->buffer_maps = hash_table_create(trace_buffer_hash, 
-                                          trace_buffer_compare);
-   if(!tr_ws->buffer_maps)
-      goto error2;
-   
-   trace_dump_call_begin("", "pipe_winsys_create");
-   trace_dump_ret(ptr, winsys);
-   trace_dump_call_end();
-
-   return &tr_ws->base;
-   
-error2:
-   FREE(tr_ws);
-error1:
-   return winsys;
-}
diff --git a/src/gallium/drivers/trace/tr_winsys.h b/src/gallium/drivers/trace/tr_winsys.h
deleted file mode 100644 (file)
index 0fd2a40..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef TR_WINSYS_H_
-#define TR_WINSYS_H_
-
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
-#include "pipe/internal/p_winsys_screen.h"
-
-
-/**
- * It often happens that new data is written directly to the user buffers 
- * without mapping/unmapping. This flag marks user buffers, so that their 
- * contents can be dumpped before being used by the pipe context.
- */
-#define TRACE_BUFFER_USAGE_USER  (1 << 31)
-
-
-struct hash_table;
-
-
-struct trace_winsys
-{
-   struct pipe_winsys base;
-   
-   struct pipe_winsys *winsys;
-   
-   struct hash_table *buffer_maps;
-};
-
-
-static INLINE struct trace_winsys *
-trace_winsys(struct pipe_winsys *winsys)
-{
-   assert(winsys);
-   return (struct trace_winsys *)winsys;
-}
-
-
-
-struct pipe_winsys *
-trace_winsys_create(struct pipe_winsys *winsys);
-
-
-void
-trace_winsys_user_buffer_update(struct pipe_winsys *winsys, 
-                                struct pipe_buffer *buffer);
-
-
-#endif /* TR_WINSYS_H_ */
index ee835578b23dce8b9ebae3da00d054a7abed9764..f4a29e63c7e89b22b08aa287268c7aed96d7afd5 100644 (file)
@@ -67,6 +67,11 @@ struct pipe_winsys
    /** Returns name of this winsys interface */
    const char *(*get_name)( struct pipe_winsys *ws );
 
+   /**
+    * Do any special operations to ensure buffer size is correct
+    */
+   void (*update_buffer)( struct pipe_winsys *ws,
+                          void *context_private );
    /**
     * Do any special operations to ensure frontbuffer contents are
     * displayed, eg copy fake frontbuffer.
@@ -149,8 +154,7 @@ struct pipe_winsys
    void (*buffer_unmap)( struct pipe_winsys *ws, 
                         struct pipe_buffer *buf );
 
-   void (*buffer_destroy)( struct pipe_winsys *ws,
-                          struct pipe_buffer *buf );
+   void (*buffer_destroy)( struct pipe_buffer *buf );
 
 
    /** Set ptr = fence, with reference counting */
diff --git a/src/gallium/include/pipe/p_atomic.h b/src/gallium/include/pipe/p_atomic.h
new file mode 100644 (file)
index 0000000..f2fe083
--- /dev/null
@@ -0,0 +1,382 @@
+/**
+ * Many similar implementations exist. See for example libwsbm
+ * or the linux kernel include/atomic.h
+ *
+ * No copyright claimed on this file.
+ *
+ */
+
+#ifndef P_ATOMIC_H
+#define P_ATOMIC_H
+
+#include "p_compiler.h"
+#include "p_defines.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Favor OS-provided implementations.
+ */
+#define PIPE_ATOMIC_OS_UNLOCKED                 \
+   (defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) ||  \
+    defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT))
+
+#define PIPE_ATOMIC_OS_MS_INTERLOCK             \
+   (!defined(PIPE_CC_GCC) &&                    \
+    !PIPE_ATOMIC_OS_UNLOCKED &&                 \
+    defined(PIPE_SUBSYSTEM_WINDOWS_USER))
+
+#define PIPE_ATOMIC_OS_PROVIDED                 \
+   (PIPE_ATOMIC_OS_UNLOCKED ||                  \
+    PIPE_ATOMIC_OS_MS_INTERLOCK)
+
+/* Where no OS-provided implementation is available, fall back to
+ * either locally coded assembly or ultimately a mutex-based
+ * implementation:
+ */
+#define PIPE_ATOMIC_ASM_GCC_X86                 \
+   (!PIPE_ATOMIC_OS_PROVIDED &&                 \
+    defined(PIPE_CC_GCC) &&                     \
+    defined(PIPE_ARCH_X86))
+
+/* KW: this was originally used when x86 asm wasn't available.
+ * Maintain that logic here.
+ */
+#define PIPE_ATOMIC_GCC_INTRINISIC              \
+   (!PIPE_ATOMIC_OS_PROVIDED &&                 \
+    !PIPE_ATOMIC_ASM_GCC_X86 &&                 \
+    defined(PIPE_CC_GCC))
+
+#define PIPE_ATOMIC_ASM_MSVC_X86                \
+   (!PIPE_ATOMIC_OS_PROVIDED &&                 \
+    defined(PIPE_CC_MSVC) &&                    \
+    defined(PIPE_ARCH_X86))
+
+#define PIPE_ATOMIC_ASM                         \
+   (PIPE_ATOMIC_ASM_GCC_X86 ||                  \
+    PIPE_ATOMIC_ASM_GCC_INTRINSIC ||            \
+    PIPE_ATOMIC_ASM_MSVC_X86)
+
+
+/* Where no OS-provided or locally-coded assembly implemenation is
+ * available, use pipe_mutex:
+ */
+#define PIPE_ATOMIC_MUTEX                       \
+   (!PIPE_ATOMIC_OS_PROVIDED &&                         \
+    !PIPE_ATOMIC_ASM)
+
+
+
+#if (PIPE_ATOMIC_ASM_GCC_X86)
+
+#define PIPE_ATOMIC "GCC x86 assembly"
+
+struct pipe_atomic {
+   int32_t count;
+};
+
+#define p_atomic_set(_v, _i) ((_v)->count = (_i))
+#define p_atomic_read(_v) ((_v)->count)
+
+
+static INLINE boolean
+p_atomic_dec_zero(struct pipe_atomic *v)
+{
+   unsigned char c;
+
+   __asm__ __volatile__("lock; decl %0; sete %1":"+m"(v->count), "=qm"(c)
+                       ::"memory");
+
+   return c != 0;
+}
+
+static INLINE void
+p_atomic_inc(struct pipe_atomic *v)
+{
+   __asm__ __volatile__("lock; incl %0":"+m"(v->count));
+}
+
+static INLINE void
+p_atomic_dec(struct pipe_atomic *v)
+{
+   __asm__ __volatile__("lock; decl %0":"+m"(v->count));
+}
+
+static INLINE int32_t
+p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
+{
+   return __sync_val_compare_and_swap(&v->count, old, _new);
+}
+#endif
+
+
+
+/* Implementation using GCC-provided synchronization intrinsics
+ */
+#if (PIPE_ATOMIC_ASM_GCC_INTRINSIC)
+
+#define PIPE_ATOMIC "GCC Sync Intrinsics"
+
+struct pipe_atomic {
+   int32_t count;
+};
+
+#define p_atomic_set(_v, _i) ((_v)->count = (_i))
+#define p_atomic_read(_v) ((_v)->count)
+
+
+static INLINE boolean
+p_atomic_dec_zero(struct pipe_atomic *v)
+{
+   return (__sync_sub_and_fetch(&v->count, 1) == 0);
+}
+
+static INLINE void
+p_atomic_inc(struct pipe_atomic *v)
+{
+   (void) __sync_add_and_fetch(&v->count, 1);
+}
+
+static INLINE void
+p_atomic_dec(struct pipe_atomic *v)
+{
+   (void) __sync_sub_and_fetch(&v->count, 1);
+}
+
+static INLINE int32_t
+p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
+{
+   return __sync_val_compare_and_swap(&v->count, old, _new);
+}
+#endif
+
+
+
+/* Unlocked version for single threaded environments, such as some
+ * windows kernel modules.
+ */
+#if (PIPE_ATOMIC_OS_UNLOCKED) 
+
+#define PIPE_ATOMIC "Unlocked"
+
+struct pipe_atomic
+{
+   int32_t count;
+};
+
+#define p_atomic_set(_v, _i) ((_v)->count = (_i))
+#define p_atomic_read(_v) ((_v)->count)
+#define p_atomic_dec_zero(_v) ((boolean) --(_v)->count)
+#define p_atomic_inc(_v) ((void) (_v)->count++)
+#define p_atomic_dec(_v) ((void) (_v)->count--)
+#define p_atomic_cmpxchg(_v, old, _new) ((_v)->count == old ? (_v)->count = (_new) : (_v)->count)
+
+#endif
+
+
+/* Locally coded assembly for MSVC on x86:
+ */
+#if (PIPE_ATOMIC_ASM_MSVC_X86)
+
+#define PIPE_ATOMIC "MSVC x86 assembly"
+
+struct pipe_atomic
+{
+   int32_t count;
+};
+
+#define p_atomic_set(_v, _i) ((_v)->count = (_i))
+#define p_atomic_read(_v) ((_v)->count)
+
+static INLINE boolean
+p_atomic_dec_zero(struct pipe_atomic *v)
+{
+   int32_t *pcount = &v->count;
+   unsigned char c;
+
+   __asm {
+      mov       eax, [pcount]
+      lock dec  dword ptr [eax]
+      sete      byte ptr [c]
+   }
+
+   return c != 0;
+}
+
+static INLINE void
+p_atomic_inc(struct pipe_atomic *v)
+{
+   int32_t *pcount = &v->count;
+
+   __asm {
+      mov       eax, [pcount]
+      lock inc  dword ptr [eax]
+   }
+}
+
+static INLINE void
+p_atomic_dec(struct pipe_atomic *v)
+{
+   int32_t *pcount = &v->count;
+
+   __asm {
+      mov       eax, [pcount]
+      lock dec  dword ptr [eax]
+   }
+}
+
+static INLINE int32_t
+p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
+{
+   int32_t *pcount = &v->count;
+   int32_t orig;
+
+   __asm {
+      mov ecx, [pcount]
+      mov eax, [old]
+      mov edx, [_new]
+      lock cmpxchg [ecx], edx
+      mov [orig], eax
+   }
+
+   return orig;
+}
+#endif
+
+
+#if (PIPE_ATOMIC_OS_MS_INTERLOCK)
+
+#define PIPE_ATOMIC "MS userspace interlocks"
+
+#include <windows.h>
+
+struct pipe_atomic
+{
+   long count;
+};
+
+#define p_atomic_set(_v, _i) ((_v)->count = (_i))
+#define p_atomic_read(_v) ((_v)->count)
+
+static INLINE boolean
+p_atomic_dec_zero(struct pipe_atomic *v)
+{
+   return InterlockedDecrement(&v->count);
+}
+
+static INLINE void
+p_atomic_inc(struct pipe_atomic *v)
+{
+   InterlockedIncrement(&v->count);
+}
+
+static INLINE void
+p_atomic_dec(struct pipe_atomic *v)
+{
+   InterlockedDecrement(&v->count);
+}
+
+static INLINE int32_t
+p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
+{
+   return InterlockedCompareExchange(&v->count, _new, old);
+}
+
+#endif
+
+
+
+#if (PIPE_ATOMIC_MUTEX)
+
+#define PIPE_ATOMIC "mutex-based fallback"
+
+#include "pipe/p_thread.h"
+
+/**
+ * This implementation should really not be used.
+ * Add an assembly port instead. It may abort and
+ * doesn't destroy used mutexes.
+ */
+
+struct pipe_atomic {
+   pipe_mutex mutex;
+   int32_t count;
+};
+
+static INLINE void
+p_atomic_set(struct pipe_atomic *v, int32_t i)
+{
+   pipe_mutex_init(v->mutex);
+   pipe_mutex_lock(v->mutex);
+   v->count = i;
+   pipe_mutex_unlock(v->mutex);
+}
+
+static INLINE int32_t
+p_atomic_read(struct pipe_atomic *v)
+{
+   int32_t ret;
+
+   pipe_mutex_lock(v->mutex);
+   ret = v->count;
+   pipe_mutex_unlock(v->mutex);
+   return ret;
+}
+
+static INLINE void
+p_atomic_inc(struct pipe_atomic *v)
+{
+   pipe_mutex_lock(v->mutex);
+   ++v->count;
+   pipe_mutex_unlock(v->mutex);
+}
+
+static INLINE void
+p_atomic_dec(struct pipe_atomic *v)
+{
+   pipe_mutex_lock(v->mutex);
+   --v->count;
+   pipe_mutex_unlock(v->mutex);
+}
+
+static INLINE boolean
+p_atomic_dec_zero(struct pipe_atomic *v)
+{
+   boolean ret;
+
+   pipe_mutex_lock(v->mutex);
+   ret = (--v->count == 0);
+   pipe_mutex_unlock(v->mutex);
+   return ret;
+}
+
+static INLINE int32_t
+p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
+{
+   int32_t ret;
+
+   pipe_mutex_lock(v->mutex);
+   ret = v->count;
+   if (ret == old)
+      v->count = _new;
+   pipe_mutex_unlock(v->mutex);
+
+   return ret;
+}
+
+#endif 
+
+
+#ifndef PIPE_ATOMIC
+#error "No pipe_atomic implementation selected"
+#endif
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* P_ATOMIC_H */
index 05cbd2fc4df594fd0a103ef8eaa2230d25e09209..7f7657031d840ff413239f36c6e34cbf885a9159 100644 (file)
 #define PIPE_OS_LINUX
 #endif
 
+#if defined(__FreeBSD__)
+#define PIPE_OS_BSD
+#endif
+
 #if defined(_WIN32) || defined(WIN32)
 #define PIPE_OS_WINDOWS
 #endif
  * NOTE: There is no way to auto-detect most of these.
  */
 
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
 #define PIPE_SUBSYSTEM_DRI
-#endif /* PIPE_OS_LINUX */
+#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */
 
 #if defined(PIPE_OS_WINDOWS)
 #if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
index 9454cc87db3890a948f30641e430777988974002..2452bf3522b2d4e64830a6e40713ebab9fe12064 100644 (file)
@@ -193,7 +193,6 @@ struct pipe_context {
     */
    /*@{*/
    void (*surface_copy)(struct pipe_context *pipe,
-                        boolean do_flip,/**< flip surface contents vertically */
                        struct pipe_surface *dest,
                        unsigned destx, unsigned desty,
                        struct pipe_surface *src, /* don't make this const - 
diff --git a/src/gallium/include/pipe/p_debug.h b/src/gallium/include/pipe/p_debug.h
deleted file mode 100644 (file)
index e9c9598..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
-/**
- * @file
- * Cross-platform debugging helpers.
- * 
- * For now it just has assert and printf replacements, but it might be extended 
- * with stack trace reports and more advanced logging in the near future. 
- * 
- * @author Jose Fonseca <jrfonseca@tungstengraphics.com>
- */
-
-#ifndef P_DEBUG_H_
-#define P_DEBUG_H_
-
-
-#include <stdarg.h>
-
-#include "p_compiler.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#if defined(DBG) || defined(DEBUG)
-#ifndef DEBUG
-#define DEBUG 1
-#endif
-#else
-#ifndef NDEBUG
-#define NDEBUG 1
-#endif
-#endif
-
-   
-/* MSVC bebore VC7 does not have the __FUNCTION__ macro */
-#if defined(_MSC_VER) && _MSC_VER < 1300
-#define __FUNCTION__ "???"
-#endif
-
-
-void _debug_vprintf(const char *format, va_list ap);
-   
-
-static INLINE void
-_debug_printf(const char *format, ...)
-{
-   va_list ap;
-   va_start(ap, format);
-   _debug_vprintf(format, ap);
-   va_end(ap);
-}
-
-
-/**
- * Print debug messages.
- *
- * The actual channel used to output debug message is platform specific. To 
- * avoid misformating or truncation, follow these rules of thumb:   
- * - output whole lines
- * - avoid outputing large strings (512 bytes is the current maximum length 
- * that is guaranteed to be printed in all platforms)
- */
-static INLINE void
-debug_printf(const char *format, ...)
-{
-#ifdef DEBUG
-   va_list ap;
-   va_start(ap, format);
-   _debug_vprintf(format, ap);
-   va_end(ap);
-#else
-   (void) format; /* silence warning */
-#endif
-}
-
-
-#ifdef DEBUG
-#define debug_vprintf(_format, _ap) _debug_vprintf(_format, _ap)
-#else
-#define debug_vprintf(_format, _ap) ((void)0)
-#endif
-
-
-#ifdef DEBUG
-/**
- * Dump a blob in hex to the same place that debug_printf sends its
- * messages.
- */
-void debug_print_blob( const char *name, const void *blob, unsigned size );
-
-/* Print a message along with a prettified format string
- */
-void debug_print_format(const char *msg, unsigned fmt );
-#else
-#define debug_print_blob(_name, _blob, _size) ((void)0)
-#define debug_print_format(_msg, _fmt) ((void)0)
-#endif
-
-
-void _debug_break(void);
-
-
-/**
- * Hard-coded breakpoint.
- */
-#ifdef DEBUG
-#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
-#define debug_break() __asm("int3")
-#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
-#define debug_break()  do { _asm {int 3} } while(0)
-#else
-#define debug_break() _debug_break()
-#endif
-#else /* !DEBUG */
-#define debug_break() ((void)0)
-#endif /* !DEBUG */
-
-
-long
-debug_get_num_option(const char *name, long dfault);
-
-void _debug_assert_fail(const char *expr, 
-                        const char *file, 
-                        unsigned line, 
-                        const char *function);
-
-
-/** 
- * Assert macro
- * 
- * Do not expect that the assert call terminates -- errors must be handled 
- * regardless of assert behavior.
- */
-#ifdef DEBUG
-#define debug_assert(expr) ((expr) ? (void)0 : _debug_assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__))
-#else
-#define debug_assert(expr) ((void)0)
-#endif
-
-
-/** Override standard assert macro */
-#ifdef assert
-#undef assert
-#endif
-#define assert(expr) debug_assert(expr)
-
-
-/**
- * Output the current function name.
- */
-#ifdef DEBUG
-#define debug_checkpoint() \
-   _debug_printf("%s\n", __FUNCTION__)
-#else
-#define debug_checkpoint() \
-   ((void)0) 
-#endif
-
-
-/**
- * Output the full source code position.
- */
-#ifdef DEBUG
-#define debug_checkpoint_full() \
-   _debug_printf("%s:%u:%s", __FILE__, __LINE__, __FUNCTION__) 
-#else
-#define debug_checkpoint_full() \
-   ((void)0) 
-#endif
-
-
-/**
- * Output a warning message. Muted on release version.
- */
-#ifdef DEBUG
-#define debug_warning(__msg) \
-   _debug_printf("%s:%u:%s: warning: %s\n", __FILE__, __LINE__, __FUNCTION__, __msg)
-#else
-#define debug_warning(__msg) \
-   ((void)0) 
-#endif
-
-
-/**
- * Output an error message. Not muted on release version.
- */
-#ifdef DEBUG
-#define debug_error(__msg) \
-   _debug_printf("%s:%u:%s: error: %s\n", __FILE__, __LINE__, __FUNCTION__, __msg) 
-#else
-#define debug_error(__msg) \
-   _debug_printf("error: %s\n", __msg)
-#endif
-
-
-/**
- * Used by debug_dump_enum and debug_dump_flags to describe symbols.
- */
-struct debug_named_value
-{
-   const char *name;
-   unsigned long value;
-};
-
-
-/**
- * Some C pre-processor magic to simplify creating named values.
- * 
- * Example:
- * @code
- * static const debug_named_value my_names[] = {
- *    DEBUG_NAMED_VALUE(MY_ENUM_VALUE_X),
- *    DEBUG_NAMED_VALUE(MY_ENUM_VALUE_Y),
- *    DEBUG_NAMED_VALUE(MY_ENUM_VALUE_Z),
- *    DEBUG_NAMED_VALUE_END
- * };
- * 
- *    ...
- *    debug_printf("%s = %s\n", 
- *                 name,
- *                 debug_dump_enum(my_names, my_value));
- *    ...
- * @endcode
- */
-#define DEBUG_NAMED_VALUE(__symbol) {#__symbol, (unsigned long)__symbol} 
-#define DEBUG_NAMED_VALUE_END {NULL, 0} 
-
-
-/**
- * Convert a enum value to a string.
- */
-const char *
-debug_dump_enum(const struct debug_named_value *names, 
-                unsigned long value);
-
-const char *
-debug_dump_enum_noprefix(const struct debug_named_value *names, 
-                         const char *prefix,
-                         unsigned long value);
-
-
-/**
- * Convert binary flags value to a string.
- */
-const char *
-debug_dump_flags(const struct debug_named_value *names, 
-                 unsigned long value);
-
-
-/**
- * Get option.
- * 
- * It is an alias for getenv on Linux. 
- * 
- * On Windows it reads C:\gallium.cfg, which is a text file with CR+LF line 
- * endings with one option per line as
- *  
- *   NAME=value
- * 
- * This file must be terminated with an extra empty line.
- */
-const char *
-debug_get_option(const char *name, const char *dfault);
-
-boolean
-debug_get_bool_option(const char *name, boolean dfault);
-
-long
-debug_get_num_option(const char *name, long dfault);
-
-unsigned long
-debug_get_flags_option(const char *name, 
-                       const struct debug_named_value *flags,
-                       unsigned long dfault);
-
-
-void *
-debug_malloc(const char *file, unsigned line, const char *function,
-             size_t size);
-
-void
-debug_free(const char *file, unsigned line, const char *function,
-           void *ptr);
-
-void *
-debug_calloc(const char *file, unsigned line, const char *function,
-             size_t count, size_t size );
-
-void *
-debug_realloc(const char *file, unsigned line, const char *function,
-              void *old_ptr, size_t old_size, size_t new_size );
-
-unsigned long
-debug_memory_begin(void);
-
-void 
-debug_memory_end(unsigned long beginning);
-
-
-#if defined(PROFILE) && defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
-
-void
-debug_profile_start(void);
-
-void 
-debug_profile_stop(void);
-
-#endif
-
-
-#ifdef DEBUG
-struct pipe_surface;
-void debug_dump_image(const char *prefix,
-                      unsigned format, unsigned cpp,
-                      unsigned width, unsigned height,
-                      unsigned stride,
-                      const void *data);
-void debug_dump_surface(const char *prefix,
-                        struct pipe_surface *surface);   
-void debug_dump_surface_bmp(const char *filename,
-                            struct pipe_surface *surface);
-#else
-#define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0)
-#define debug_dump_surface(prefix, surface) ((void)0)
-#define debug_dump_surface_bmp(filename, surface) ((void)0)
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* P_DEBUG_H_ */
index 4f0b301f3173fa64b8d5fcb14b1264aee656d267..52d443970b034e961a05128e4d2c429f593d04ac 100644 (file)
@@ -193,6 +193,16 @@ enum pipe_texture_target {
 #define PIPE_SURFACE_STATUS_CLEAR      2
 
 
+/**
+ * Transfer object usage flags
+ */
+enum pipe_transfer_usage {
+   PIPE_TRANSFER_READ,
+   PIPE_TRANSFER_WRITE,
+   PIPE_TRANSFER_READ_WRITE //< Read/modify/write
+};
+
+
 /**
  * Buffer usage flags
  */
@@ -205,6 +215,7 @@ enum pipe_texture_target {
 #define PIPE_BUFFER_USAGE_INDEX     (1 << 6)
 #define PIPE_BUFFER_USAGE_CONSTANT  (1 << 7)
 #define PIPE_BUFFER_USAGE_DISCARD   (1 << 8)
+#define PIPE_BUFFER_USAGE_DONTBLOCK (1 << 9)
 /** Pipe driver custom usage flags should be greater or equal to this value */
 #define PIPE_BUFFER_USAGE_CUSTOM    (1 << 16)
 
@@ -247,6 +258,7 @@ enum pipe_texture_target {
 #define PIPE_PRIM_QUADS           7
 #define PIPE_PRIM_QUAD_STRIP      8
 #define PIPE_PRIM_POLYGON         9
+#define PIPE_PRIM_MAX             10
 
 
 /**
index b42f98ceba18a6b7773f5eab0479284cc87a7b1e..3f65a60436453992984c41f097801464c40e5690 100644 (file)
@@ -30,8 +30,9 @@
 #define PIPE_FORMAT_H
 
 #include "p_compiler.h"
-#include "p_debug.h"
 
+/* FIXME: remove these header dependencies */
+#include "util/u_debug.h"
 #include "util/u_string.h"
 
 #ifdef __cplusplus
index 1219c817b4c172468d061ed23f747c032a48ba77..1232c8796827509dcbd8d80dd04e18aaa74df149 100644 (file)
@@ -38,95 +38,6 @@ extern "C" {
 #endif
 
 
-/* XXX: these are a kludge.  will fix when all surfaces are views into
- * textures, and free-floating winsys surfaces go away.
- */
-static INLINE void *
-pipe_surface_map( struct pipe_surface *surf, unsigned flags )
-{
-   struct pipe_screen *screen;
-   assert(surf->texture);
-   screen = surf->texture->screen;
-   return screen->surface_map( screen, surf, flags );
-}
-
-static INLINE void
-pipe_surface_unmap( struct pipe_surface *surf )
-{
-   struct pipe_screen *screen;
-   assert(surf->texture);
-   screen = surf->texture->screen;
-   screen->surface_unmap( screen, surf );
-}
-
-
-
-/**
- * Set 'ptr' to point to 'surf' and update reference counting.
- * The old thing pointed to, if any, will be unreferenced first.
- * 'surf' may be NULL.
- */
-static INLINE void
-pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
-{
-   /* bump the refcount first */
-   if (surf) {
-      assert(surf->refcount);
-      surf->refcount++;
-   }
-
-   if (*ptr) {
-      struct pipe_screen *screen;
-      assert((*ptr)->refcount);
-      assert((*ptr)->texture);
-      screen = (*ptr)->texture->screen;
-      screen->tex_surface_release( screen, ptr );
-      assert(!*ptr);
-   }
-
-   *ptr = surf;
-}
-
-
-/**
- * \sa pipe_surface_reference
- */
-static INLINE void
-pipe_texture_reference(struct pipe_texture **ptr,
-                      struct pipe_texture *pt)
-{
-   assert(ptr);
-
-   if (pt) { 
-      assert(pt->refcount);
-      pt->refcount++;
-   }
-
-   if (*ptr) {
-      struct pipe_screen *screen = (*ptr)->screen;
-      assert(screen);
-      assert((*ptr)->refcount);
-      screen->texture_release(screen, ptr);
-
-      assert(!*ptr);
-   }
-
-   *ptr = pt;
-}
-
-
-static INLINE void
-pipe_texture_release(struct pipe_texture **ptr)
-{
-   struct pipe_screen *screen;
-   assert(ptr);
-   screen = (*ptr)->screen;
-   assert((*ptr)->refcount);
-   screen->texture_release(screen, ptr);
-   *ptr = NULL;
-}
-
-
 /**
  * Convenience wrappers for screen buffer functions.
  */
@@ -149,7 +60,13 @@ pipe_buffer_map(struct pipe_screen *screen,
                 struct pipe_buffer *buf,
                 unsigned usage)
 {
-   return screen->buffer_map(screen, buf, usage);
+   if(screen->buffer_map_range) {
+      unsigned offset = 0;
+      unsigned length = buf->size;
+      return screen->buffer_map_range(screen, buf, offset, length, usage);
+   }
+   else
+      return screen->buffer_map(screen, buf, usage);
 }
 
 static INLINE void
@@ -159,26 +76,74 @@ pipe_buffer_unmap(struct pipe_screen *screen,
    screen->buffer_unmap(screen, buf);
 }
 
-/* XXX: thread safety issues!
- */
+static INLINE void *
+pipe_buffer_map_range(struct pipe_screen *screen,
+                struct pipe_buffer *buf,
+                unsigned offset,
+                unsigned length,
+                unsigned usage)
+{
+   assert(offset < buf->size);
+   assert(offset + length <= buf->size);
+   assert(length);
+   if(screen->buffer_map_range)
+      return screen->buffer_map_range(screen, buf, offset, length, usage);
+   else
+      return screen->buffer_map(screen, buf, usage);
+}
+
 static INLINE void
-pipe_buffer_reference(struct pipe_screen *screen,
-                     struct pipe_buffer **ptr,
-                     struct pipe_buffer *buf)
+pipe_buffer_flush_mapped_range(struct pipe_screen *screen,
+                               struct pipe_buffer *buf,
+                               unsigned offset,
+                               unsigned length)
 {
-   if (buf) {
-      assert(buf->refcount);
-      buf->refcount++;
-   }
+   assert(offset < buf->size);
+   assert(offset + length <= buf->size);
+   assert(length);
+   if(screen->buffer_flush_mapped_range)
+      screen->buffer_flush_mapped_range(screen, buf, offset, length);
+}
 
-   if (*ptr) {
-      assert((*ptr)->refcount);
-      if(--(*ptr)->refcount == 0) {
-         screen->buffer_destroy( screen, *ptr );
-      }
+static INLINE void
+pipe_buffer_write(struct pipe_screen *screen,
+                  struct pipe_buffer *buf,
+                  unsigned offset, unsigned size,
+                  const void *data)
+{
+   uint8_t *map;
+   
+   assert(offset < buf->size);
+   assert(offset + size <= buf->size);
+   assert(size);
+
+   map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_WRITE);
+   assert(map);
+   if(map) {
+      memcpy(map + offset, data, size);
+      pipe_buffer_flush_mapped_range(screen, buf, offset, size);
+      pipe_buffer_unmap(screen, buf);
    }
+}
 
-   *ptr = buf;
+static INLINE void
+pipe_buffer_read(struct pipe_screen *screen,
+                 struct pipe_buffer *buf,
+                 unsigned offset, unsigned size,
+                 void *data)
+{
+   uint8_t *map;
+   
+   assert(offset < buf->size);
+   assert(offset + size <= buf->size);
+   assert(size);
+
+   map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_READ);
+   assert(map);
+   if(map) {
+      memcpy(data, map + offset, size);
+      pipe_buffer_unmap(screen, buf);
+   }
 }
 
 
diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h
new file mode 100644 (file)
index 0000000..60844e4
--- /dev/null
@@ -0,0 +1,88 @@
+/**************************************************************************
+ * 
+ * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#ifndef P_REFCNT_H
+#define P_REFCNT_H
+
+
+#include "p_defines.h"
+#include "p_atomic.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct pipe_reference
+{
+   struct pipe_atomic count;
+};
+
+
+static INLINE void
+pipe_reference_init(struct pipe_reference *reference, unsigned count)
+{
+   p_atomic_set(&reference->count, count);
+}
+
+
+/**
+ * Set 'ptr' to point to 'reference' and update reference counting.
+ * The old thing pointed to, if any, will be unreferenced first.
+ * 'reference' may be NULL.
+ *
+ * XXX: thread safety issues!
+ */
+static INLINE bool
+pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference)
+{
+   bool destroy = FALSE;
+
+   /* bump the reference.count first */
+   if (reference) {
+      assert(p_atomic_read(&reference->count) != 0);
+      p_atomic_inc(&reference->count);
+   }
+
+   if (*ptr) {
+      assert(p_atomic_read(&(*ptr)->count) != 0);
+      if (p_atomic_dec_zero(&(*ptr)->count)) {
+         destroy = TRUE;
+      }
+   }
+
+   *ptr = reference;
+
+   return destroy;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* P_REFCNT_H */
index 17d1548253b18cb3aa42e07a403bcd1d2f2210e0..ed3a026023bd98bb92e14c1c22cb6c5ce1d7214f 100644 (file)
@@ -55,6 +55,7 @@ struct pipe_winsys;
 struct pipe_buffer;
 
 
+
 /**
  * Gallium screen/adapter context.  Basically everything
  * hardware-specific that doesn't actually require a rendering
@@ -112,8 +113,7 @@ struct pipe_screen {
                                             const unsigned *stride,
                                             struct pipe_buffer *buffer);
 
-   void (*texture_release)(struct pipe_screen *,
-                           struct pipe_texture **pt);
+   void (*texture_destroy)(struct pipe_texture *pt);
 
    /** Get a surface which is a "view" into a texture */
    struct pipe_surface *(*get_tex_surface)(struct pipe_screen *,
@@ -122,18 +122,25 @@ struct pipe_screen {
                                            unsigned zslice,
                                            unsigned usage );
 
-   /* Surfaces allocated by the above must be released here:
-    */
-   void (*tex_surface_release)( struct pipe_screen *,
-                                struct pipe_surface ** );
+   void (*tex_surface_destroy)(struct pipe_surface *);
    
 
-   void *(*surface_map)( struct pipe_screen *,
-                         struct pipe_surface *surface,
-                         unsigned flags );
+   /** Get a transfer object for transferring data to/from a texture */
+   struct pipe_transfer *(*get_tex_transfer)(struct pipe_screen *,
+                                             struct pipe_texture *texture,
+                                             unsigned face, unsigned level,
+                                             unsigned zslice,
+                                             enum pipe_transfer_usage usage,
+                                             unsigned x, unsigned y,
+                                             unsigned w, unsigned h);
+
+   void (*tex_transfer_destroy)(struct pipe_transfer *);
+   
+   void *(*transfer_map)( struct pipe_screen *,
+                          struct pipe_transfer *transfer );
 
-   void (*surface_unmap)( struct pipe_screen *,
-                          struct pipe_surface *surface );
+   void (*transfer_unmap)( struct pipe_screen *,
+                           struct pipe_transfer *transfer );
 
 
    /**
@@ -195,12 +202,37 @@ struct pipe_screen {
    void *(*buffer_map)( struct pipe_screen *screen,
                        struct pipe_buffer *buf,
                        unsigned usage );
+   /**
+    * Map a subrange of the buffer data store into the client's address space.
+    *
+    * The returned pointer is always relative to buffer start, regardless of 
+    * the specified range. This is different from the ARB_map_buffer_range
+    * semantics because we don't forbid multiple mappings of the same buffer
+    * (yet).
+    */
+   void *(*buffer_map_range)( struct pipe_screen *screen,
+                              struct pipe_buffer *buf,
+                              unsigned offset,
+                              unsigned length,
+                              unsigned usage);
+
+   /**
+    * Notify a range that was actually written into.
+    * 
+    * The range is relative to the buffer start, regardless of the range 
+    * specified to buffer_map_range. This is different from the 
+    * ARB_map_buffer_range semantics because we don't forbid multiple mappings 
+    * of the same buffer (yet).
+    */
+   void (*buffer_flush_mapped_range)( struct pipe_screen *screen,
+                                      struct pipe_buffer *buf,
+                                      unsigned offset,
+                                      unsigned length);
 
    void (*buffer_unmap)( struct pipe_screen *screen,
-                        struct pipe_buffer *buf );
+                         struct pipe_buffer *buf );
 
-   void (*buffer_destroy)( struct pipe_screen *screen,
-                          struct pipe_buffer *buf );
+   void (*buffer_destroy)( struct pipe_buffer *buf );
 
 
    /**
index 35df70e7b7b1a08d30ce617167444e254a7a351f..4dafdd6f0a9f43b176e2ba321b6faf5837ba1592 100644 (file)
@@ -191,8 +191,8 @@ struct tgsi_immediate_float32
 /*
  * GL_EXT_vertex_shader
  */
-#define TGSI_OPCODE_INDEX               22
-#define TGSI_OPCODE_NEGATE              23
+#define TGSI_OPCODE_INDEX               22   /* considered for removal */
+#define TGSI_OPCODE_NEGATE              23   /* considered for removal */
 #define TGSI_OPCODE_MADD                TGSI_OPCODE_MAD
 #define TGSI_OPCODE_FRAC                24
 #define TGSI_OPCODE_SETGE               TGSI_OPCODE_SGE
@@ -206,7 +206,7 @@ struct tgsi_immediate_float32
 #define TGSI_OPCODE_RECIP               TGSI_OPCODE_RCP
 #define TGSI_OPCODE_RECIPSQRT           TGSI_OPCODE_RSQ
 #define TGSI_OPCODE_CROSSPRODUCT        31
-#define TGSI_OPCODE_MULTIPLYMATRIX      32
+#define TGSI_OPCODE_MULTIPLYMATRIX      32   /* considered for removal */
 
 /*
  * GL_NV_vertex_program1_1
index 9dc541630c4463cbb4bd9c8cc8c765da5f9d758b..aad41fab110c0c5b39c95533417cc473331733cc 100644 (file)
@@ -43,6 +43,8 @@
 #include "p_compiler.h"
 #include "p_defines.h"
 #include "p_format.h"
+#include "p_refcnt.h"
+#include "p_screen.h"
 
 
 #ifdef __cplusplus
@@ -64,23 +66,20 @@ extern "C" {
 
 
 /* fwd decls */
-struct pipe_screen;
 struct pipe_surface;
 
 
-
 /**
  * The driver will certainly subclass this to include actual memory
  * management information.
  */
 struct pipe_buffer
 {
+   struct pipe_reference reference;
+   struct pipe_screen *screen;
    unsigned alignment;
    unsigned usage;
    unsigned size;
-
-   /** Reference count */
-   unsigned refcount;
 };
 
 
@@ -109,9 +108,15 @@ struct pipe_rasterizer_state
    unsigned line_stipple_factor:8;  /**< [1..256] actually */
    unsigned line_stipple_pattern:16;
    unsigned line_last_pixel:1;
-   unsigned bypass_clipping:1;
-   unsigned bypass_vs:1; /**< Skip the vertex shader.  Note that the shader is
-                            still needed though, to indicate inputs/outputs */
+
+   /** 
+    * Vertex coordinates are pre-transformed to screen space.  Skip
+    * the vertex shader, clipping and viewport processing.  Note that
+    * a vertex shader is still needed though, to indicate the mapping
+    * from vertex elements to fragment shader input semantics.
+    */
+   unsigned bypass_vs_clip_and_viewport:1;
+
    unsigned origin_lower_left:1;  /**< Is (0,0) the lower-left corner? */
    unsigned flatshade_first:1;   /**< take color attribute from the first vertex of a primitive */
    unsigned gl_rasterization_rules:1; /**< enable tweaks for GL rasterization?  */
@@ -275,18 +280,14 @@ struct pipe_sampler_state
  */
 struct pipe_surface
 {
+   struct pipe_reference reference;
    enum pipe_format format;      /**< PIPE_FORMAT_x */
    unsigned status;              /**< PIPE_SURFACE_STATUS_x */
    unsigned clear_value;         /**< XXX may be temporary */
    unsigned width;               /**< logical width in pixels */
    unsigned height;              /**< logical height in pixels */
-   struct pipe_format_block block;
-   unsigned nblocksx;            /**< allocated width in blocks */
-   unsigned nblocksy;            /**< allocated height in blocks */
-   unsigned stride;              /**< stride in bytes between rows of blocks */
    unsigned layout;              /**< PIPE_SURFACE_LAYOUT_x */
    unsigned offset;              /**< offset from start of buffer, in bytes */
-   unsigned refcount;
    unsigned usage;               /**< PIPE_BUFFER_USAGE_*  */
 
    struct pipe_texture *texture; /**< texture into which this is a view  */
@@ -296,11 +297,36 @@ struct pipe_surface
 };
 
 
+/**
+ * Transfer object.  For data transfer to/from a texture.
+ */
+struct pipe_transfer
+{
+   enum pipe_format format;      /**< PIPE_FORMAT_x */
+   unsigned x;                   /**< x offset from start of texture image */
+   unsigned y;                   /**< y offset from start of texture image */
+   unsigned width;               /**< logical width in pixels */
+   unsigned height;              /**< logical height in pixels */
+   struct pipe_format_block block;
+   unsigned nblocksx;            /**< allocated width in blocks */
+   unsigned nblocksy;            /**< allocated height in blocks */
+   unsigned stride;              /**< stride in bytes between rows of blocks */
+   unsigned usage;               /**< PIPE_TRANSFER_*  */
+
+   struct pipe_texture *texture; /**< texture to transfer to/from  */
+   unsigned face;
+   unsigned level;
+   unsigned zslice;
+};
+
+
 /**
  * Texture object.
  */
 struct pipe_texture
 { 
+   struct pipe_reference reference;
+
    enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
    enum pipe_format format;         /**< PIPE_FORMAT_x */
 
@@ -319,10 +345,6 @@ struct pipe_texture
 
    unsigned tex_usage;       /* PIPE_TEXTURE_USAGE_* */
 
-   /* These are also refcounted:
-    */
-   unsigned refcount;
-
    struct pipe_screen *screen; /**< screen that this texture belongs to */
 };
 
@@ -359,6 +381,35 @@ struct pipe_vertex_element
 };
 
 
+/* Reference counting helper functions */
+static INLINE void
+pipe_buffer_reference(struct pipe_buffer **ptr, struct pipe_buffer *buf)
+{
+   struct pipe_buffer *old_buf = *ptr;
+
+   if (pipe_reference((struct pipe_reference **)ptr, &buf->reference))
+      old_buf->screen->buffer_destroy(old_buf);
+}
+
+static INLINE void
+pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
+{
+   struct pipe_surface *old_surf = *ptr;
+
+   if (pipe_reference((struct pipe_reference **)ptr, &surf->reference))
+      old_surf->texture->screen->tex_surface_destroy(old_surf);
+}
+
+static INLINE void
+pipe_texture_reference(struct pipe_texture **ptr, struct pipe_texture *tex)
+{
+   struct pipe_texture *old_tex = *ptr;
+
+   if (pipe_reference((struct pipe_reference **)ptr, &tex->reference))
+      old_tex->screen->texture_destroy(old_tex);
+}
+
+
 #ifdef __cplusplus
 }
 #endif
index 8af3cd958b0a318c1f571575c592fea2be6aa24f..a9cd77541d443920b5698d2eb6ebc220724f45a9 100644 (file)
@@ -38,7 +38,7 @@
 #include "pipe/p_compiler.h"
 
 
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
 
 #include <pthread.h> /* POSIX threads headers */
 #include <stdio.h> /* for perror() */
@@ -73,7 +73,7 @@ typedef pthread_cond_t pipe_condvar;
    static pipe_mutex mutex = PTHREAD_MUTEX_INITIALIZER
 
 #define pipe_mutex_init(mutex) \
-   pthread_mutex_init(&(mutex), NULL)
+   (void) pthread_mutex_init(&(mutex), NULL)
 
 #define pipe_mutex_destroy(mutex) \
    pthread_mutex_destroy(&(mutex))
@@ -134,20 +134,20 @@ static INLINE int pipe_thread_destroy( pipe_thread thread )
 
 typedef CRITICAL_SECTION pipe_mutex;
 
-#define pipe_static_mutex(name) \
-   /*static*/ pipe_mutex name = {0,0,0,0,0,0}
+#define pipe_static_mutex(mutex) \
+   /*static*/ pipe_mutex mutex = {0,0,0,0,0,0}
 
-#define pipe_mutex_init(name) \
-   InitializeCriticalSection(&name)
+#define pipe_mutex_init(mutex) \
+   InitializeCriticalSection(&mutex)
 
-#define pipe_mutex_destroy(name) \
-   DeleteCriticalSection(&name)
+#define pipe_mutex_destroy(mutex) \
+   DeleteCriticalSection(&mutex)
 
-#define pipe_mutex_lock(name) \
-   EnterCriticalSection(&name)
+#define pipe_mutex_lock(mutex) \
+   EnterCriticalSection(&mutex)
 
-#define pipe_mutex_unlock(name) \
-   LeaveCriticalSection(&name)
+#define pipe_mutex_unlock(mutex) \
+   LeaveCriticalSection(&mutex)
 
 /* XXX: dummy definitions, make it compile */
 
@@ -210,7 +210,7 @@ typedef unsigned pipe_condvar;
  */
 
 typedef struct {
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
    pthread_key_t key;
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
    DWORD key;
@@ -225,7 +225,7 @@ typedef struct {
 static INLINE void
 pipe_tsd_init(pipe_tsd *tsd)
 {
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
    if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
       perror("pthread_key_create(): failed to allocate key for thread specific data");
       exit(-1);
@@ -242,7 +242,7 @@ pipe_tsd_get(pipe_tsd *tsd)
    if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
       pipe_tsd_init(tsd);
    }
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
    return pthread_getspecific(tsd->key);
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
    assert(0);
@@ -259,7 +259,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value)
    if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
       pipe_tsd_init(tsd);
    }
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
    if (pthread_setspecific(tsd->key, value) != 0) {
       perror("pthread_set_specific() failed");
       exit(-1);
index 54480fa0477ad9cdf3ad5710c485a324e7ba445f..435435da29ccbfb0bbe710aa8e1572ce66cf82de 100644 (file)
@@ -2,14 +2,18 @@
 #ifndef _DRM_API_H_
 #define _DRM_API_H_
 
+#include "pipe/p_compiler.h"
+
 struct pipe_screen;
 struct pipe_winsys;
+struct pipe_buffer;
 struct pipe_context;
+struct pipe_texture;
 
 struct drm_api
 {
        /**
-        * Special buffer function
+        * Special buffer functions
         */
        /*@{*/
        struct pipe_screen*  (*create_screen)(int drmFB, int pciID);
@@ -17,17 +21,27 @@ struct drm_api
        /*@}*/
 
        /**
-        * Special buffer function
+        * Special buffer functions
         */
        /*@{*/
-       struct pipe_buffer* (*buffer_from_handle)(struct pipe_winsys *winsys, const char *name, unsigned handle);
-       unsigned (*handle_from_buffer)(struct pipe_winsys *winsys, struct pipe_buffer *buffer);
+       boolean (*buffer_from_texture)(struct pipe_texture *texture,
+                                       struct pipe_buffer **buffer,
+                                       unsigned *stride);
+       struct pipe_buffer* (*buffer_from_handle)(struct pipe_screen *screen,
+                                                  const char *name,
+                                                  unsigned handle);
+       boolean (*handle_from_buffer)(struct pipe_screen *screen,
+                                      struct pipe_buffer *buffer,
+                                      unsigned *handle);
+       boolean (*global_handle_from_buffer)(struct pipe_screen *screen,
+                                             struct pipe_buffer *buffer,
+                                             unsigned *handle);
        /*@}*/
 };
 
 /**
  * A driver needs to export this symbol
  */
-extern struct drm_api drm_api_hocks;
+extern struct drm_api drm_api_hooks;
 
 #endif
diff --git a/src/gallium/state_trackers/dri2/Makefile b/src/gallium/state_trackers/dri2/Makefile
new file mode 100644 (file)
index 0000000..47750e9
--- /dev/null
@@ -0,0 +1,28 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = dri2drm
+
+LIBRARY_INCLUDES = \
+       -I$(TOP)/include \
+       -I$(TOP)/src/mesa \
+       -I$(TOP)/src/mesa/drivers/dri/common \
+       -I$(TOP)/src/mesa/main \
+         $(shell pkg-config --cflags-only-I libdrm)
+
+
+C_SOURCES = \
+       dri_context.c \
+       dri_screen.c \
+       dri_drawable.c \
+       dri_extensions.c
+
+#      $(TOP)/src/mesa/drivers/dri/common/utils.c \
+       $(TOP)/src/mesa/drivers/dri/common/vblank.c \
+       $(TOP)/src/mesa/drivers/dri/common/dri_util.c \
+       $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c \
+       $(TOP)/src/mesa/drivers/common/driverfuncs.c \
+       $(TOP)/src/mesa/drivers/dri/common/texmem.c \
+       $(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c
+
+include ../../Makefile.template
diff --git a/src/gallium/state_trackers/dri2/dri_context.c b/src/gallium/state_trackers/dri2/dri_context.c
new file mode 100644 (file)
index 0000000..92c26ac
--- /dev/null
@@ -0,0 +1,170 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell <keithw@vmware.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ */
+
+#include "dri_screen.h"
+
+#include "dri_drawable.h"
+
+
+#include "state_tracker/drm_api.h"
+#include "state_tracker/st_public.h"
+#include "state_tracker/st_context.h"
+#include "pipe/p_context.h"
+
+#include "dri_context.h"
+
+#include "util/u_memory.h"
+
+
+GLboolean
+dri_create_context(const __GLcontextModes *visual,
+                   __DRIcontextPrivate *cPriv,
+                   void *sharedContextPrivate)
+{
+   __DRIscreenPrivate *sPriv = cPriv->driScreenPriv;
+   struct dri_screen *screen = dri_screen(sPriv);
+   struct dri_context *ctx = NULL;
+   struct st_context *st_share = NULL;
+
+   if (sharedContextPrivate) {
+      st_share = ((struct dri_context *) sharedContextPrivate)->st;
+   }
+
+   ctx = CALLOC_STRUCT(dri_context);
+   if (ctx == NULL)
+      goto fail;
+
+   cPriv->driverPrivate = ctx;
+   ctx->cPriv = cPriv;
+   ctx->sPriv = sPriv;
+
+   driParseConfigFiles(&ctx->optionCache,
+                       &screen->optionCache,
+                       sPriv->myNum,
+                       "dri");
+
+   ctx->pipe = drm_api_hooks.create_context(screen->pipe_screen);
+
+   if (ctx->pipe == NULL)
+      goto fail;
+
+   /* used in dri_flush_frontbuffer */
+   ctx->pipe->priv = ctx;
+
+   ctx->st = st_create_context(ctx->pipe, visual, st_share);
+   if (ctx->st == NULL)
+      goto fail;
+
+   dri_init_extensions(ctx);
+
+   return GL_TRUE;
+
+fail:
+   if (ctx && ctx->st)
+      st_destroy_context(ctx->st);
+
+   if (ctx && ctx->pipe)
+      ctx->pipe->destroy(ctx->pipe);
+
+   FREE(ctx);
+   return FALSE;
+}
+
+
+void
+dri_destroy_context(__DRIcontextPrivate *cPriv)
+{
+   struct dri_context *ctx = dri_context(cPriv);
+   struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
+
+   /* No particular reason to wait for command completion before
+    * destroying a context, but it is probably worthwhile flushing it
+    * to avoid having to add code elsewhere to cope with flushing a
+    * partially destroyed context.
+    */
+   st_flush(ctx->st, 0, NULL);
+
+   if (screen->dummyContext == ctx)
+      screen->dummyContext = NULL;
+
+   /* Also frees ctx->pipe?
+    */
+   st_destroy_context(ctx->st);
+
+   FREE(ctx);
+}
+
+
+GLboolean
+dri_unbind_context(__DRIcontextPrivate *cPriv)
+{
+   struct dri_context *ctx = dri_context(cPriv);
+   st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+   /* XXX make_current(NULL)? */
+   return GL_TRUE;
+}
+
+
+GLboolean
+dri_make_current(__DRIcontextPrivate *cPriv,
+                 __DRIdrawablePrivate *driDrawPriv,
+                 __DRIdrawablePrivate *driReadPriv)
+{
+   if (cPriv) {
+      struct dri_context *ctx = dri_context(cPriv);
+      struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
+      struct dri_drawable *draw = dri_drawable(driDrawPriv);
+      struct dri_drawable *read = dri_drawable(driReadPriv);
+
+      /* This is for situations in which we need a rendering context but
+       * there may not be any currently bound.
+       */
+      screen->dummyContext = ctx;
+
+      st_make_current(ctx->st,
+                      draw->stfb,
+                      read->stfb);
+
+      /* used in dri_flush_frontbuffer */
+      ctx->dPriv = driDrawPriv;
+
+      if (driDrawPriv)
+         dri_get_buffers(driDrawPriv);
+      if (driDrawPriv != driReadPriv && driReadPriv)
+         dri_get_buffers(driReadPriv);
+   } else {
+      st_make_current(NULL, NULL, NULL);
+   }
+
+   return GL_TRUE;
+}
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_context.h b/src/gallium/state_trackers/dri2/dri_context.h
new file mode 100644 (file)
index 0000000..e910472
--- /dev/null
@@ -0,0 +1,96 @@
+/**************************************************************************
+ *
+ * Copyright (C) 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell <keithw@vmware.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ */
+
+#ifndef DRI_CONTEXT_H
+#define DRI_CONTEXT_H
+
+#include "pipe/p_compiler.h"
+#include "drm.h"
+#include "dri_util.h"
+
+
+struct pipe_context;
+struct pipe_fence;
+struct st_context;
+struct dri_drawable;
+
+
+struct dri_context
+{
+   /* dri */
+   __DRIscreenPrivate *sPriv;
+   __DRIcontextPrivate *cPriv;
+   __DRIdrawablePrivate *dPriv;
+
+   driOptionCache optionCache;
+
+   /* gallium */
+   struct st_context *st;
+   struct pipe_context *pipe;
+};
+
+
+static INLINE struct dri_context *
+dri_context(__DRIcontextPrivate *driContextPriv)
+{
+   return (struct dri_context *) driContextPriv->driverPrivate;
+}
+
+
+/***********************************************************************
+ * dri_context.c
+ */
+void
+dri_destroy_context(__DRIcontextPrivate * driContextPriv);
+
+boolean
+dri_unbind_context(__DRIcontextPrivate * driContextPriv);
+
+boolean
+dri_make_current(__DRIcontextPrivate * driContextPriv,
+                 __DRIdrawablePrivate * driDrawPriv,
+                 __DRIdrawablePrivate * driReadPriv);
+
+boolean
+dri_create_context(const __GLcontextModes * visual,
+                   __DRIcontextPrivate * driContextPriv,
+                   void *sharedContextPrivate);
+
+
+/***********************************************************************
+ * dri_extensions.c
+ */
+void
+dri_init_extensions(struct dri_context *ctx);
+
+#endif
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_drawable.c b/src/gallium/state_trackers/dri2/dri_drawable.c
new file mode 100644 (file)
index 0000000..2e3f409
--- /dev/null
@@ -0,0 +1,325 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell <keithw@vmware.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ */
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "dri_drawable.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_inlines.h"
+#include "state_tracker/drm_api.h"
+#include "state_tracker/st_public.h"
+#include "state_tracker/st_context.h"
+#include "state_tracker/st_cb_fbo.h"
+
+#include "util/u_memory.h"
+
+
+static void
+dri_copy_to_front(__DRIdrawablePrivate *dPriv,
+                  struct pipe_surface *from,
+                  int x, int y, unsigned w, unsigned h)
+{
+   /* TODO send a message to the Xserver to copy to the real front buffer */
+}
+
+
+static struct pipe_surface *
+dri_surface_from_handle(struct pipe_screen *screen,
+                        unsigned handle,
+                        enum pipe_format format,
+                        unsigned width,
+                        unsigned height,
+                        unsigned pitch)
+{
+   struct pipe_surface *surface = NULL;
+   struct pipe_texture *texture = NULL;
+   struct pipe_texture templat;
+   struct pipe_buffer *buf = NULL;
+
+   buf = drm_api_hooks.buffer_from_handle(screen, "dri2 buffer", handle);
+   if (!buf)
+      return NULL;
+
+   memset(&templat, 0, sizeof(templat));
+   templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
+   templat.target = PIPE_TEXTURE_2D;
+   templat.last_level = 0;
+   templat.depth[0] = 1;
+   templat.format = format;
+   templat.width[0] = width;
+   templat.height[0] = height;
+   pf_get_block(templat.format, &templat.block);
+
+   texture = screen->texture_blanket(screen,
+                                     &templat,
+                                     &pitch,
+                                     buf);
+
+   /* we don't need the buffer from this point on */
+   pipe_buffer_reference(&buf, NULL);
+
+   if (!texture)
+      return NULL;
+
+   surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
+                                     PIPE_BUFFER_USAGE_GPU_READ |
+                                     PIPE_BUFFER_USAGE_GPU_WRITE);
+
+   /* we don't need the texture from this point on */
+   pipe_texture_reference(&texture, NULL);
+   return surface;
+}
+
+
+/**
+ * This will be called a drawable is known to have been resized.
+ */
+void
+dri_get_buffers(__DRIdrawablePrivate *dPriv)
+{
+   struct dri_drawable *drawable = dri_drawable(dPriv);
+   struct pipe_surface *surface = NULL;
+   struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen;
+   __DRIbuffer *buffers = NULL;
+   __DRIscreen *dri_screen = drawable->sPriv;
+   __DRIdrawable *dri_drawable = drawable->dPriv;
+   boolean have_depth = FALSE;
+   int i, count;
+
+   buffers = (*dri_screen->dri2.loader->getBuffers)(dri_drawable,
+                                                    &dri_drawable->w,
+                                                    &dri_drawable->h,
+                                                    drawable->attachments,
+                                                    drawable->num_attachments,
+                                                    &count,
+                                                    dri_drawable->loaderPrivate);
+
+   if (buffers == NULL) {
+      return;
+   }
+
+   /* set one cliprect to cover the whole dri_drawable */
+   dri_drawable->x = 0;
+   dri_drawable->y = 0;
+   dri_drawable->backX = 0;
+   dri_drawable->backY = 0;
+   dri_drawable->numClipRects = 1;
+   dri_drawable->pClipRects[0].x1 = 0;
+   dri_drawable->pClipRects[0].y1 = 0;
+   dri_drawable->pClipRects[0].x2 = dri_drawable->w;
+   dri_drawable->pClipRects[0].y2 = dri_drawable->h;
+   dri_drawable->numBackClipRects = 1;
+   dri_drawable->pBackClipRects[0].x1 = 0;
+   dri_drawable->pBackClipRects[0].y1 = 0;
+   dri_drawable->pBackClipRects[0].x2 = dri_drawable->w;
+   dri_drawable->pBackClipRects[0].y2 = dri_drawable->h;
+
+   for (i = 0; i < count; i++) {
+      enum pipe_format format = 0;
+      int index = 0;
+
+      switch (buffers[i].attachment) {
+         case __DRI_BUFFER_FRONT_LEFT:
+            index = ST_SURFACE_FRONT_LEFT;
+            format = PIPE_FORMAT_A8R8G8B8_UNORM;
+            break;
+         case __DRI_BUFFER_FAKE_FRONT_LEFT:
+            index = ST_SURFACE_FRONT_LEFT;
+            format = PIPE_FORMAT_A8R8G8B8_UNORM;
+            break;
+         case __DRI_BUFFER_BACK_LEFT:
+            index = ST_SURFACE_BACK_LEFT;
+            format = PIPE_FORMAT_A8R8G8B8_UNORM;
+            break;
+         case __DRI_BUFFER_DEPTH:
+            index = ST_SURFACE_DEPTH;
+            format = PIPE_FORMAT_Z24S8_UNORM;
+            break;
+         case __DRI_BUFFER_STENCIL:
+            index = ST_SURFACE_DEPTH;
+            format = PIPE_FORMAT_Z24S8_UNORM;
+            break;
+         case __DRI_BUFFER_ACCUM:
+         default:
+            assert(0);
+      }
+      assert(buffers[i].cpp == 4);
+
+      if (index == ST_SURFACE_DEPTH) {
+         if (have_depth)
+            continue;
+         else
+            have_depth = TRUE;
+      }
+
+      surface = dri_surface_from_handle(screen,
+                                        buffers[i].name,
+                                        format,
+                                        dri_drawable->w,
+                                        dri_drawable->h,
+                                        buffers[i].pitch);
+
+      st_set_framebuffer_surface(drawable->stfb, index, surface);
+      pipe_surface_reference(&surface, NULL);
+   }
+   /* this needed, or else the state tracker fails to pick the new buffers */
+   st_resize_framebuffer(drawable->stfb, dri_drawable->w, dri_drawable->h);
+}
+
+
+void
+dri_flush_frontbuffer(struct pipe_screen *screen,
+                      struct pipe_surface *surf,
+                      void *context_private)
+{
+   struct dri_context *ctx = (struct dri_context *)context_private;
+   dri_copy_to_front(ctx->dPriv, surf, 0, 0, surf->width, surf->height);
+}
+
+
+void
+dri_swap_buffers(__DRIdrawablePrivate * dPriv)
+{
+   /* not needed for dri2 */
+   assert(0);
+}
+
+
+void
+dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
+{
+   /* not needed for dri2 */
+   assert(0);
+}
+
+
+/**
+ * This is called when we need to set up GL rendering to a new X window.
+ */
+boolean
+dri_create_buffer(__DRIscreenPrivate *sPriv,
+                  __DRIdrawablePrivate *dPriv,
+                  const __GLcontextModes *visual,
+                  boolean isPixmap)
+{
+   enum pipe_format colorFormat, depthFormat, stencilFormat;
+   struct dri_screen *screen = sPriv->private;
+   struct dri_drawable *drawable = NULL;
+   struct pipe_screen *pscreen = screen->pipe_screen;
+   int i;
+
+   if (isPixmap)
+      goto fail; /* not implemented */
+
+   drawable = CALLOC_STRUCT(dri_drawable);
+   if (drawable == NULL)
+      goto fail;
+
+   /* XXX: todo: use the pipe_screen queries to figure out which
+    * render targets are supportable.
+    */
+   assert(visual->redBits == 8);
+   assert(visual->depthBits == 24 || visual->depthBits == 0);
+   assert(visual->stencilBits == 8 || visual->stencilBits == 0);
+
+   colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
+
+   if (visual->depthBits) {
+      if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
+                                       PIPE_TEXTURE_2D,
+                                       PIPE_TEXTURE_USAGE_RENDER_TARGET |
+                                       PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
+         depthFormat = PIPE_FORMAT_Z24S8_UNORM;
+      else
+         depthFormat = PIPE_FORMAT_S8Z24_UNORM;
+   } else
+      depthFormat = PIPE_FORMAT_NONE;
+
+   if (visual->stencilBits) {
+      if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
+                                       PIPE_TEXTURE_2D,
+                                       PIPE_TEXTURE_USAGE_RENDER_TARGET |
+                                       PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
+         stencilFormat = PIPE_FORMAT_Z24S8_UNORM;
+      else
+         stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
+   } else
+      stencilFormat = PIPE_FORMAT_NONE;
+
+   drawable->stfb = st_create_framebuffer(visual,
+                                          colorFormat,
+                                          depthFormat,
+                                          stencilFormat,
+                                          dPriv->w,
+                                          dPriv->h,
+                                          (void*) drawable);
+   if (drawable->stfb == NULL)
+      goto fail;
+
+   drawable->sPriv = sPriv;
+   drawable->dPriv = dPriv;
+   dPriv->driverPrivate = (void *) drawable;
+
+   /* setup dri2 buffers information */
+   i = 0;
+   drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
+#if 0
+   /* TODO incase of double buffer visual, delay fake creation */
+   drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
+#endif
+   if (visual->doubleBufferMode)
+      drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT;
+   if (visual->depthBits)
+      drawable->attachments[i++] = __DRI_BUFFER_DEPTH;
+   if (visual->stencilBits)
+      drawable->attachments[i++] = __DRI_BUFFER_STENCIL;
+   drawable->num_attachments = i;
+
+   return GL_TRUE;
+fail:
+   FREE(drawable);
+   return GL_FALSE;
+}
+
+
+void
+dri_destroy_buffer(__DRIdrawablePrivate *dPriv)
+{
+   struct dri_drawable *drawable = dri_drawable(dPriv);
+
+   st_unreference_framebuffer(drawable->stfb);
+
+   FREE(drawable);
+}
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_drawable.h b/src/gallium/state_trackers/dri2/dri_drawable.h
new file mode 100644 (file)
index 0000000..185c657
--- /dev/null
@@ -0,0 +1,89 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef DRI_DRAWABLE_H
+#define DRI_DRAWABLE_H
+
+#include "pipe/p_compiler.h"
+
+struct pipe_surface;
+struct pipe_fence;
+struct st_framebuffer;
+
+
+struct dri_drawable
+{
+   /* dri */
+   __DRIdrawablePrivate *dPriv;
+   __DRIscreenPrivate *sPriv;
+
+   unsigned attachments[8];
+   unsigned num_attachments;
+
+   /* gallium */
+   struct st_framebuffer *stfb;
+};
+
+
+static INLINE struct dri_drawable *
+dri_drawable(__DRIdrawablePrivate * driDrawPriv)
+{
+   return (struct dri_drawable *) driDrawPriv->driverPrivate;
+}
+
+
+/***********************************************************************
+ * dri_drawable.c
+ */
+boolean
+dri_create_buffer(__DRIscreenPrivate *sPriv,
+                  __DRIdrawablePrivate *dPriv,
+                  const __GLcontextModes *visual,
+                  boolean isPixmap);
+
+void
+dri_flush_frontbuffer(struct pipe_screen *screen,
+                      struct pipe_surface *surf,
+                      void *context_private);
+
+void
+dri_swap_buffers(__DRIdrawablePrivate * dPriv);
+
+void
+dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv,
+                    int x, int y,
+                    int w, int h);
+
+void
+dri_get_buffers(__DRIdrawablePrivate * dPriv);
+
+void
+dri_destroy_buffer(__DRIdrawablePrivate *dPriv);
+
+#endif
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_extensions.c b/src/gallium/state_trackers/dri2/dri_extensions.c
new file mode 100644 (file)
index 0000000..732d1e8
--- /dev/null
@@ -0,0 +1,119 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell <keithw@vmware.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ */
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "state_tracker/st_context.h"
+
+#define need_GL_ARB_multisample
+#define need_GL_ARB_occlusion_query
+#define need_GL_ARB_point_parameters
+#define need_GL_ARB_texture_compression
+#define need_GL_ARB_vertex_buffer_object
+#define need_GL_ARB_vertex_program
+#define need_GL_ARB_window_pos
+#define need_GL_EXT_blend_color
+#define need_GL_EXT_blend_equation_separate
+#define need_GL_EXT_blend_func_separate
+#define need_GL_EXT_blend_minmax
+#define need_GL_EXT_cull_vertex
+#define need_GL_EXT_fog_coord
+#define need_GL_EXT_framebuffer_object
+#define need_GL_EXT_multi_draw_arrays
+#define need_GL_EXT_secondary_color
+#define need_GL_NV_vertex_program
+#include "extension_helper.h"
+
+
+/**
+ * Extension strings exported by the driver.
+ */
+const struct dri_extension card_extensions[] = {
+   {"GL_ARB_multisample", GL_ARB_multisample_functions},
+   {"GL_ARB_multitexture", NULL},
+   {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
+   {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
+   {"GL_ARB_texture_border_clamp", NULL},
+   {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions},
+   {"GL_ARB_texture_cube_map", NULL},
+   {"GL_ARB_texture_env_add", NULL},
+   {"GL_ARB_texture_env_combine", NULL},
+   {"GL_ARB_texture_env_dot3", NULL},
+   {"GL_ARB_texture_mirrored_repeat", NULL},
+   {"GL_ARB_texture_rectangle", NULL},
+   {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
+   {"GL_ARB_pixel_buffer_object", NULL},
+   {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
+   {"GL_ARB_window_pos", GL_ARB_window_pos_functions},
+   {"GL_EXT_blend_color", GL_EXT_blend_color_functions},
+   {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
+   {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
+   {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
+   {"GL_EXT_blend_subtract", NULL},
+   {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions},
+   {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions},
+   {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
+   {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
+   {"GL_EXT_packed_depth_stencil", NULL},
+   {"GL_EXT_pixel_buffer_object", NULL},
+   {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
+   {"GL_EXT_stencil_wrap", NULL},
+   {"GL_EXT_texture_edge_clamp", NULL},
+   {"GL_EXT_texture_env_combine", NULL},
+   {"GL_EXT_texture_env_dot3", NULL},
+   {"GL_EXT_texture_filter_anisotropic", NULL},
+   {"GL_EXT_texture_lod_bias", NULL},
+   {"GL_3DFX_texture_compression_FXT1", NULL},
+   {"GL_APPLE_client_storage", NULL},
+   {"GL_MESA_pack_invert", NULL},
+   {"GL_MESA_ycbcr_texture", NULL},
+   {"GL_NV_blend_square", NULL},
+   {"GL_NV_vertex_program", GL_NV_vertex_program_functions},
+   {"GL_NV_vertex_program1_1", NULL},
+   {"GL_SGIS_generate_mipmap", NULL },
+   {NULL, NULL}
+};
+
+
+void
+dri_init_extensions(struct dri_context *ctx)
+{
+   /* The card_extensions list should be pruned according to the
+    * capabilities of the pipe_screen. This is actually something
+    * that can/should be done inside st_create_context().
+    */
+   if (ctx)
+      driInitExtensions(ctx->st->ctx, card_extensions, GL_TRUE);
+   else
+      driInitExtensions(NULL, card_extensions, GL_FALSE);
+}
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_screen.c b/src/gallium/state_trackers/dri2/dri_screen.c
new file mode 100644 (file)
index 0000000..ab5878a
--- /dev/null
@@ -0,0 +1,272 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell <keithw@vmware.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ */
+
+#include "utils.h"
+#include "vblank.h"
+#include "xmlpool.h"
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "dri_drawable.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_inlines.h"
+#include "state_tracker/drm_api.h"
+#include "state_tracker/st_public.h"
+#include "state_tracker/st_cb_fbo.h"
+
+
+PUBLIC const char __driConfigOptions[] =
+   DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
+    DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
+    DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+   DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
+    /*DRI_CONF_FORCE_S3TC_ENABLE(false)*/
+    DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+   DRI_CONF_SECTION_END DRI_CONF_END;
+
+
+const uint __driNConfigOptions = 3;
+
+
+static const __DRIextension *dri_screen_extensions[] = {
+    &driReadDrawableExtension,
+    &driCopySubBufferExtension.base,
+    &driSwapControlExtension.base,
+    &driFrameTrackingExtension.base,
+    &driMediaStreamCounterExtension.base,
+    NULL
+};
+
+
+static void
+dri_get_drm_minor(struct dri_screen *screen)
+{
+   /* TODO get the real minor */
+   screen->minor = 0;
+}
+
+
+static void
+dri_get_device_id(struct dri_screen *screen)
+{
+   char path[512];
+   FILE *file;
+
+   /*
+    * There must be a better way to get the deviceID.
+    * XXX this only works on Linux.
+    */
+   snprintf(path, sizeof(path), "/sys/class/drm/card%d/device/device", screen->minor);
+   file = fopen(path, "r");
+   if (!file) {
+      return;
+   }
+
+   fgets(path, sizeof(path), file);
+   sscanf(path, "%x", &screen->deviceID);
+   fclose(file);
+}
+
+
+static const __DRIconfig **
+dri_fill_in_modes(__DRIscreenPrivate *psp,
+                  unsigned pixel_bits, unsigned depth_bits,
+                  unsigned stencil_bits, GLboolean have_back_buffer)
+{
+   __DRIconfig **configs;
+   __GLcontextModes *m;
+   unsigned num_modes;
+   uint8_t depth_bits_array[3];
+   uint8_t stencil_bits_array[3];
+   uint8_t msaa_samples_array[1];
+   unsigned depth_buffer_factor;
+   unsigned back_buffer_factor;
+   unsigned msaa_samples_factor;
+   GLenum fb_format;
+   GLenum fb_type;
+   int i;
+
+   static const GLenum back_buffer_modes[] = {
+      GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
+   };
+
+   /* TODO probe the hardware of what is supports */
+   depth_bits_array[0] = 0;
+   depth_bits_array[1] = 24;
+   depth_bits_array[2] = 24;
+
+   stencil_bits_array[0] = 0;   /* no depth or stencil */
+   stencil_bits_array[1] = 0;   /* z24x8 */
+   stencil_bits_array[2] = 8;   /* z24s8 */
+
+   msaa_samples_array[0] = 0;
+
+   depth_buffer_factor = 3;
+   back_buffer_factor = 3;
+   msaa_samples_factor = 1;
+
+   num_modes = depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4;
+
+   if (pixel_bits == 16) {
+      fb_format = GL_RGB;
+      fb_type = GL_UNSIGNED_SHORT_5_6_5;
+   }
+   else {
+      fb_format = GL_BGRA;
+      fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
+   }
+
+   configs = driCreateConfigs(fb_format, fb_type,
+                             depth_bits_array,
+                              stencil_bits_array, depth_buffer_factor,
+                              back_buffer_modes, back_buffer_factor,
+                              msaa_samples_array, msaa_samples_factor);
+   if (configs == NULL) {
+      debug_printf("%s: driCreateConfigs failed\n", __FUNCTION__);
+      return NULL;
+   }
+
+   for (i = 0; configs[i]; i++) {
+      m = &configs[i]->modes;
+      if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
+         m->visualRating = GLX_SLOW_CONFIG;
+      }
+   }
+
+   return (const const __DRIconfig **) configs;
+}
+
+
+/**
+ * Get information about previous buffer swaps.
+ */
+int
+dri_get_swap_info(__DRIdrawablePrivate * dPriv,
+                  __DRIswapInfo * sInfo)
+{
+   if (dPriv == NULL ||
+       dPriv->driverPrivate == NULL ||
+       sInfo == NULL)
+      return -1;
+   else
+      return 0;
+}
+
+
+/**
+ * NULL stub for old dri loaders
+ */
+const __DRIconfig **
+dri_init_screen(__DRIscreenPrivate *sPriv)
+{
+   return NULL;
+}
+
+
+/**
+ * This is the driver specific part of the createNewScreen entry point.
+ *
+ * Returns the __GLcontextModes supported by this driver.
+ */
+const __DRIconfig **
+dri_init_screen2(__DRIscreenPrivate *sPriv)
+{
+   struct dri_screen *screen;
+
+   /* Set up dispatch table to cope with all known extensions */
+   dri_init_extensions(NULL);
+
+   screen = CALLOC_STRUCT(dri_screen);
+   if (!screen)
+      goto fail;
+
+   screen->sPriv = sPriv;
+   screen->fd = sPriv->fd;
+   dri_get_drm_minor(screen);
+   dri_get_device_id(screen);
+   sPriv->private = (void *) screen;
+   sPriv->extensions = dri_screen_extensions;
+
+
+   screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, screen->deviceID);
+   if (!screen->pipe_screen) {
+      debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__);
+      goto fail;
+   }
+
+   /* We need to hook in here */
+   screen->pipe_screen->flush_frontbuffer = dri_flush_frontbuffer;
+
+   driParseOptionInfo(&screen->optionCache,
+                      __driConfigOptions,
+                      __driNConfigOptions);
+
+   return dri_fill_in_modes(sPriv,
+                            4 * 8,
+                            24,
+                            8,
+                            1);
+fail:
+   return NULL;
+}
+
+
+void
+dri_destroy_screen(__DRIscreenPrivate * sPriv)
+{
+   struct dri_screen *screen = dri_screen(sPriv);
+
+   screen->pipe_screen->destroy(screen->pipe_screen);
+   FREE(screen);
+   sPriv->private = NULL;
+}
+
+
+PUBLIC const struct __DriverAPIRec driDriverAPI = {
+   .InitScreen          = dri_init_screen, /* not supported but exported */
+   .DestroyScreen       = dri_destroy_screen,
+   .CreateContext       = dri_create_context,
+   .DestroyContext      = dri_destroy_context,
+   .CreateBuffer        = dri_create_buffer,
+   .DestroyBuffer       = dri_destroy_buffer,
+   .SwapBuffers         = dri_swap_buffers, /* not supported but exported */
+   .MakeCurrent         = dri_make_current,
+   .UnbindContext       = dri_unbind_context,
+   .GetSwapInfo         = dri_get_swap_info,
+   .GetDrawableMSC      = driDrawableGetMSC32,
+   .WaitForMSC          = driWaitForMSC32,
+   .CopySubBuffer       = dri_copy_sub_buffer, /* not supported but exported */
+   .InitScreen2         = dri_init_screen2,
+};
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_screen.h b/src/gallium/state_trackers/dri2/dri_screen.h
new file mode 100644 (file)
index 0000000..fe2676d
--- /dev/null
@@ -0,0 +1,90 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell <keithw@vmware.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ */
+
+#ifndef DRI_SCREEN_H
+#define DRI_SCREEN_H
+
+#include "dri_util.h"
+#include "xmlconfig.h"
+
+#include "pipe/p_compiler.h"
+
+struct dri_screen
+{
+   /* dri */
+   __DRIscreenPrivate *sPriv;
+
+   /**
+    * Configuration cache with default values for all contexts
+    */
+   driOptionCache optionCache;
+
+   /**
+    * Temporary(?) context to use for SwapBuffers or other situations in
+    * which we need a rendering context, but none is currently bound.
+    */
+   struct dri_context *dummyContext;
+
+   /* drm */
+   int deviceID;
+   int fd;
+   int minor;
+
+   /* gallium */
+   struct pipe_winsys *pipe_winsys;
+   struct pipe_screen *pipe_screen;
+};
+
+
+/** cast wrapper */
+static INLINE struct dri_screen *
+dri_screen(__DRIscreenPrivate *sPriv)
+{
+   return (struct dri_screen *) sPriv->private;
+}
+
+
+/***********************************************************************
+ * dri_screen.c
+ */
+const __DRIconfig **
+dri_init_screen2(__DRIscreenPrivate *sPriv);
+
+void
+dri_destroy_screen(__DRIscreenPrivate * sPriv);
+
+int
+dri_get_swap_info(__DRIdrawablePrivate * dPriv,
+                  __DRIswapInfo * sInfo);
+
+#endif
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
index c9124b1c90eb4fa887a1d6fdf77e2dfca40e40b3..692a3c8b76f579cf5faa63ef8573edeba1bcd1ad 100644 (file)
@@ -6,15 +6,15 @@ TOP        = ../../../..
 
 include ${TOP}/configs/current
 
-CFLAGS += -g -Wall -Werror=implicit-function-declaration -fPIC \
+CFLAGS := \
           -I${GALLIUMDIR}/include \
           -I${GALLIUMDIR}/auxiliary \
           -I${TOP}/src/mesa/drivers/dri/common \
           -I${TOP}/src/mesa \
           -I$(TOP)/include \
           -I$(TOP)/src/egl/main \
-          $(shell pkg-config --cflags pixman-1 xorg-server) \
-          ${LIBDRM_CFLAGS}
+          ${LIBDRM_CFLAGS} \
+          ${CFLAGS}
 
 #############################################
 
index 8564972b91e2c0e015e4db5258ed79437bcaf6c0..36548fae26327e002e62a37f85a01e6bb39468c2 100644 (file)
@@ -115,7 +115,7 @@ drm_create_context(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext
 
        _eglInitContext(drv, dpy, &ctx->base, config, attrib_list);
 
-       ctx->pipe = drm_api_hocks.create_context(dev->screen);
+       ctx->pipe = drm_api_hooks.create_context(dev->screen);
        if (!ctx->pipe)
                goto err_pipe;
 
index 091d437d81b8ecbc09d4574282d0aa81a16a6fe5..e6e80b985aa2cf5133ea319d83431ae9ca326a56 100644 (file)
  * Util functions
  */
 
-static struct drm_mode_modeinfo *
+static drmModeModeInfoPtr
 drm_find_mode(drmModeConnectorPtr connector, _EGLMode *mode)
 {
        int i;
-       struct drm_mode_modeinfo *m = NULL;
+       drmModeModeInfoPtr m = NULL;
 
        for (i = 0; i < connector->count_modes; i++) {
                m = &connector->modes[i];
@@ -132,7 +132,7 @@ drm_create_texture(_EGLDriver *drv,
        scrn->front.width = w;
        scrn->front.height = h;
        scrn->front.pitch = pitch;
-       scrn->front.handle = drm_api_hocks.handle_from_buffer(dev->winsys, scrn->buffer);
+       drm_api_hooks.handle_from_buffer(screen, scrn->buffer, &scrn->front.handle);
        if (0)
                goto err_handle;
 
@@ -143,7 +143,7 @@ err_handle:
 err_surf:
        pipe_texture_reference(&texture, NULL);
 err_tex:
-       pipe_buffer_reference(screen, &buf, NULL);
+       pipe_buffer_reference(&buf, NULL);
 err_buf:
        return;
 }
@@ -173,7 +173,7 @@ drm_takedown_shown_screen(_EGLDriver *drv, struct drm_screen *screen)
 
        pipe_surface_reference(&screen->surface, NULL);
        pipe_texture_reference(&screen->tex, NULL);
-       pipe_buffer_reference(dev->screen, &screen->buffer, NULL);
+       pipe_buffer_reference(&screen->buffer, NULL);
 
        screen->shown = 0;
 }
@@ -271,7 +271,6 @@ drm_show_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy,
        struct drm_device *dev = (struct drm_device *)drv;
        struct drm_surface *surf = lookup_drm_surface(surface);
        struct drm_screen *scrn = lookup_drm_screen(dpy, screen);
-       struct pipe_context *pipe;
        _EGLMode *mode = _eglLookupMode(dpy, m);
        int ret;
        unsigned int i, k;
@@ -349,7 +348,7 @@ err_fb:
 err_bo:
        pipe_surface_reference(&scrn->surface, NULL);
        pipe_texture_reference(&scrn->tex, NULL);
-       pipe_buffer_reference(dev->screen, &scrn->buffer, NULL);
+       pipe_buffer_reference(&scrn->buffer, NULL);
 
        return EGL_FALSE;
 }
@@ -392,7 +391,6 @@ drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
                if (surf->screen) {
                        surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
                        surf->user->pipe->surface_copy(surf->user->pipe,
-                               0,
                                surf->screen->surface,
                                0, 0,
                                back_surf,
index dec82c3a002ad579d392f73973f29825e78b39b9..a22ef381b966a3a6ea7084d897deed7857b05b83 100644 (file)
@@ -92,7 +92,7 @@ drm_update_res(struct drm_device *dev)
 static void
 drm_add_modes_from_connector(_EGLScreen *screen, drmModeConnectorPtr connector)
 {
-       struct drm_mode_modeinfo *m;
+       drmModeModeInfoPtr m = NULL;
        int i;
 
        for (i = 0; i < connector->count_modes; i++) {
@@ -121,7 +121,7 @@ drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
        dev->drmFD = fd;
        drm_get_device_id(dev);
 
-       dev->screen = drm_api_hocks.create_screen(dev->drmFD, dev->deviceID);
+       dev->screen = drm_api_hooks.create_screen(dev->drmFD, dev->deviceID);
        if (!dev->screen)
                goto err_screen;
        dev->winsys = dev->screen->winsys;
index 0b4dd9797d53501afe94d3bd3aab56dafd23f904..908bab5f9bf6d5ecd2df1a6f9b6045438ce78948 100644 (file)
@@ -128,7 +128,7 @@ struct drm_screen
        /*drmModeCrtcPtr crtc;*/
        uint32_t crtcID;
 
-       struct drm_mode_modeinfo *mode;
+       drmModeModeInfoPtr mode;
 };
 
 
index cddfca54fe5560d154962022f4ee73a1de88a948..f9f4d6be3c321523635814dfff57e56fc138af6d 100644 (file)
@@ -3,7 +3,7 @@ OBJECTS         = vl_display.o vl_screen.o vl_context.o vl_surface.o vl_shader_build.o
                  vl_r16snorm_mc_buf.o
 GALLIUMDIR     = ../..
 
-CFLAGS         += -g -Wall -Werror=implicit-function-declaration -fPIC \
+CFLAGS         += -g -Wall -Werror-implicit-function-declaration -fPIC \
                   -I${GALLIUMDIR}/include                              \
                   -I${GALLIUMDIR}/auxiliary                            \
                   -I${GALLIUMDIR}/winsys/g3dvl                         \
index 187a13a56052cb3e2a4ff3a9dd4b66bff57f2811..b61b49a2f8a439ef685d9620942835a342d7308f 100644 (file)
@@ -237,10 +237,10 @@ static int vlDestroy
        pipe->delete_fs_state(pipe, basic_csc->fragment_shader);
 
        for (i = 0; i < 2; ++i)
-               pipe_buffer_reference(pipe->screen, &basic_csc->vertex_bufs[i].buffer, NULL);
+               pipe_buffer_reference(&basic_csc->vertex_bufs[i].buffer, NULL);
 
-       pipe_buffer_reference(pipe->screen, &basic_csc->vs_const_buf.buffer, NULL);
-       pipe_buffer_reference(pipe->screen, &basic_csc->fs_const_buf.buffer, NULL);
+       pipe_buffer_reference(&basic_csc->vs_const_buf.buffer, NULL);
+       pipe_buffer_reference(&basic_csc->fs_const_buf.buffer, NULL);
 
        FREE(basic_csc);
 
@@ -371,7 +371,7 @@ static int vlCreateVertexShader
        unsigned int                    ti;
        unsigned int                    i;
 
-       assert(context);
+       assert(csc);
 
        pipe = csc->pipe;
        tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token));
@@ -458,7 +458,7 @@ static int vlCreateFragmentShader
        unsigned int                    ti;
        unsigned int                    i;
 
-       assert(context);
+       assert(csc);
 
        pipe = csc->pipe;
        tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token));
index 65ddb9f01ef09b82b463ae8fe37050ce8ecfc5d3..1d8ad0b046905ffa2598239c465fdb28abc2239a 100644 (file)
@@ -41,9 +41,7 @@ static int vlInitCommon(struct vlContext *context)
        rast.line_stipple_factor = 0;
        rast.line_stipple_pattern = 0;
        rast.line_last_pixel = 0;
-       /* Don't need clipping, but viewport mapping done here */
-       rast.bypass_clipping = 0;
-       rast.bypass_vs = 0;
+       rast.bypass_vs_clip_and_viewport = 0;
        rast.origin_lower_left = 0;
        rast.line_width = 1;
        rast.point_smooth = 0;
index 2176bb86d8ab235b3eaf698b8e3e4c95d6c45bcb..eb8270ecad3fdf44cd006b4c285755d19658f790 100644 (file)
@@ -66,7 +66,7 @@ struct vlR16SnormBufferedMC
        struct vlVertex2f                       zero_block[3];
        unsigned int                            num_macroblocks;
        struct vlMpeg2MacroBlock                *macroblocks;
-       struct pipe_surface                     *tex_surface[3];
+       struct pipe_transfer                    *tex_transfer[3];
        short                                   *texels[3];
 
        struct pipe_context                     *pipe;
@@ -187,7 +187,7 @@ static inline int vlGrabBlocks
        assert(mc);
        assert(blocks);
 
-       tex_pitch = mc->tex_surface[0]->stride / mc->tex_surface[0]->block.size;
+       tex_pitch = mc->tex_transfer[0]->stride / mc->tex_transfer[0]->block.size;
        texels = mc->texels[0] + mbpy * tex_pitch + mbpx;
 
        for (y = 0; y < 2; ++y)
@@ -235,7 +235,7 @@ static inline int vlGrabBlocks
 
        for (tb = 0; tb < 2; ++tb)
        {
-               tex_pitch = mc->tex_surface[tb + 1]->stride / mc->tex_surface[tb + 1]->block.size;
+               tex_pitch = mc->tex_transfer[tb + 1]->stride / mc->tex_transfer[tb + 1]->block.size;
                texels = mc->texels[tb + 1] + mbpy * tex_pitch + mbpx;
 
                if ((coded_block_pattern >> (1 - tb)) & 1)
@@ -635,8 +635,8 @@ static int vlFlush
 
        for (i = 0; i < 3; ++i)
        {
-               pipe_surface_unmap(mc->tex_surface[i]);
-               pipe_surface_reference(&mc->tex_surface[i], NULL);
+               pipe->screen->transfer_unmap(pipe->screen, mc->tex_transfer[i]);
+               pipe->screen->tex_transfer_destroy(mc->tex_transfer[i]);
        }
 
        mc->render_target.cbufs[0] = pipe->screen->get_tex_surface
@@ -809,14 +809,16 @@ static int vlRenderMacroBlocksMpeg2R16SnormBuffered
 
                for (i = 0; i < 3; ++i)
                {
-                       mc->tex_surface[i] = mc->pipe->screen->get_tex_surface
+                       mc->tex_transfer[i] = mc->pipe->screen->get_tex_transfer
                        (
                                mc->pipe->screen,
                                mc->textures.all[i],
-                               0, 0, 0, PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD
+                               0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0,
+                               surface->texture->width[0],
+                               surface->texture->height[0]
                        );
 
-                       mc->texels[i] = pipe_surface_map(mc->tex_surface[i], PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD);
+                       mc->texels[i] = mc->pipe->screen->transfer_map(mc->pipe->screen, mc->tex_transfer[i]);
                }
        }
 
@@ -854,7 +856,7 @@ static int vlDestroy
                pipe->delete_sampler_state(pipe, mc->samplers.all[i]);
 
        for (i = 0; i < 3; ++i)
-               pipe_buffer_reference(pipe->screen, &mc->vertex_bufs.all[i].buffer, NULL);
+               pipe_buffer_reference(&mc->vertex_bufs.all[i].buffer, NULL);
 
        /* Textures 3 & 4 are not created directly, no need to release them here */
        for (i = 0; i < 3; ++i)
@@ -871,8 +873,8 @@ static int vlDestroy
                pipe->delete_fs_state(pipe, mc->b_fs[i]);
        }
 
-       pipe_buffer_reference(pipe->screen, &mc->vs_const_buf.buffer, NULL);
-       pipe_buffer_reference(pipe->screen, &mc->fs_const_buf.buffer, NULL);
+       pipe_buffer_reference(&mc->vs_const_buf.buffer, NULL);
+       pipe_buffer_reference(&mc->fs_const_buf.buffer, NULL);
 
        FREE(mc->macroblocks);
        FREE(mc);
diff --git a/src/gallium/state_trackers/glx/dri/dri_context.c b/src/gallium/state_trackers/glx/dri/dri_context.c
deleted file mode 100644 (file)
index 9424e18..0000000
+++ /dev/null
@@ -1,168 +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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "dri_screen.h"
-#include "dri_context.h"
-#include "dri_winsys.h"
-
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
-#include "pipe/p_context.h"
-
-#include "util/u_memory.h"
-
-
-GLboolean
-dri_create_context(const __GLcontextModes *visual,
-                   __DRIcontextPrivate *cPriv,
-                   void *sharedContextPrivate)
-{
-   __DRIscreenPrivate *sPriv = cPriv->driScreenPriv;
-   struct dri_screen *screen = dri_screen(sPriv);
-   struct dri_context *ctx = NULL;
-   struct st_context *st_share = NULL;
-
-   if (sharedContextPrivate) {
-      st_share = ((struct dri_context *) sharedContextPrivate)->st;
-   }
-
-   ctx = CALLOC_STRUCT(dri_context);
-   if (ctx == NULL)
-      goto fail;
-
-   cPriv->driverPrivate = ctx;
-   ctx->cPriv = cPriv;
-   ctx->sPriv = sPriv;
-
-   driParseConfigFiles(&ctx->optionCache, 
-                       &screen->optionCache,
-                       sPriv->myNum, 
-                       "dri");
-   
-   ctx->pipe = screen->pipe_screen->create_context(screen->pipe_screen,
-                                                   screen->pipe_winsys,
-                                                   hw_winsys );
-   if (ctx->pipe == NULL)
-      goto fail;
-
-   ctx->pipe->priv = ctx;       /* I guess */
-
-   ctx->st = st_create_context(ctx->pipe, visual, st_share);
-   if (ctx->st == NULL)
-      goto fail;
-
-   dri_init_extensions( ctx );
-
-   return GL_TRUE;
-
-fail:
-   if (ctx && ctx->st)
-      st_destroy_context( ctx->st );
-
-   if (ctx && ctx->pipe)
-      ctx->pipe->destroy( ctx->pipe );
-
-   FREE(ctx);
-   return FALSE;
-}
-
-
-void
-dri_destroy_context(__DRIcontextPrivate *cPriv)
-{
-   struct dri_context *ctx = dri_context(cPriv);
-   struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
-   struct pipe_winsys *winsys = screen->winsys;
-
-   /* No particular reason to wait for command completion before
-    * destroying a context, but it is probably worthwhile flushing it
-    * to avoid having to add code elsewhere to cope with flushing a
-    * partially destroyed context.
-    */
-   st_flush(ctx->st);
-
-   if (screen->dummyContext == ctx)
-      screen->dummyContext = NULL;
-
-   /* Also frees ctx->pipe?
-    */
-   st_destroy_context(ctx->st);
-
-   FREE(ctx);
-}
-
-
-GLboolean
-dri_unbind_context(__DRIcontextPrivate *cPriv)
-{
-   struct dri_context *ctx = dri_context(cPriv);
-   st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
-   /* XXX make_current(NULL)? */
-   return GL_TRUE;
-}
-
-
-GLboolean
-dri_make_current(__DRIcontextPrivate *cPriv,
-                 __DRIdrawablePrivate *driDrawPriv,
-                 __DRIdrawablePrivate *driReadPriv)
-{
-   if (cPriv) {
-      struct dri_context *ctx = dri_context(cPriv);
-      struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
-      struct dri_drawable *draw = dri_drawable(driDrawPriv);
-      struct dri_drawable *read = dri_drawable(driReadPriv);
-
-      /* This is for situations in which we need a rendering context but
-       * there may not be any currently bound.
-       */
-      screen->dummyContext = ctx;
-
-      st_make_current( ctx->st, 
-                       draw->stfb, 
-                       read->stfb );
-
-      ctx->dPriv = driDrawPriv;
-
-      /* Update window sizes if necessary:
-       */
-      if (draw->stamp != driDrawPriv->lastStamp) {
-         dri_update_window_size( draw );
-      }
-
-      if (read->stamp != driReadPriv->lastStamp) {
-         dri_update_window_size( read );
-      }
-
-   }
-   else {
-      st_make_current(NULL, NULL, NULL);
-   }
-
-   return GL_TRUE;
-}
diff --git a/src/gallium/state_trackers/glx/dri/dri_context.h b/src/gallium/state_trackers/glx/dri/dri_context.h
deleted file mode 100644 (file)
index 4e6a305..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/**************************************************************************
- *
- * Copyright (C) 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef DRI_CONTEXT_H
-#define DRI_CONTEXT_H
-
-#include "pipe/p_compiler.h"
-#include "drm.h"
-#include "dri_util.h"
-
-
-struct pipe_context;
-struct pipe_fence;
-struct st_context;
-
-
-struct dri_context
-{
-   __DRIcontextPrivate *cPriv;
-   __DRIdrawablePrivate *dPriv;
-
-   struct st_context *st;
-   struct pipe_context *pipe;
-
-   boolean locked;
-
-   /**
-    * Configuration cache
-    */
-   driOptionCache optionCache;
-};
-
-
-static INLINE struct dri_context *
-dri_context(__DRIcontextPrivate *driContextPriv)
-{
-   return (struct dri_context *) driContextPriv->driverPrivate;
-}
-
-/***********************************************************************
- * dri_context.c
- */
-void 
-dri_destroy_context(__DRIcontextPrivate * driContextPriv);
-
-boolean 
-dri_unbind_context(__DRIcontextPrivate * driContextPriv);
-
-boolean
-dri_make_current(__DRIcontextPrivate * driContextPriv,
-                 __DRIdrawablePrivate * driDrawPriv,
-                 __DRIdrawablePrivate * driReadPriv);
-
-boolean
-dri_create_context(const __GLcontextModes * visual,
-                   __DRIcontextPrivate * driContextPriv,
-                   void *sharedContextPrivate);
-
-
-
-/***********************************************************************
- * dri_lock.c
- */
-void dri_lock_hardware( struct dri_context *context, 
-                        struct dri_drawable *drawable );
-
-void dri_unlock_hardware( struct dri_context *dri );
-boolean dri_is_locked( struct dri_context *dri );
-
-
-
-#endif
diff --git a/src/gallium/state_trackers/glx/dri/dri_drawable.c b/src/gallium/state_trackers/glx/dri/dri_drawable.c
deleted file mode 100644 (file)
index b712acd..0000000
+++ /dev/null
@@ -1,363 +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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "dri_screen.h"
-#include "dri_context.h"
-#include "dri_swapbuffers.h"
-
-#include "pipe/p_context.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
-#include "state_tracker/st_cb_fbo.h"
-
-
-static void
-blit_swapbuffers(__DRIdrawablePrivate *dPriv,
-                 __DRIcontextPrivate *cPriv,
-                struct pipe_surface *src,
-                const drm_clip_rect_t *rect)
-{
-   struct dri_screen *screen = dri_screen(dPriv->driScreenPriv);
-   struct dri_drawable *fb = dri_drawable(dPriv);
-   struct dri_context *context = dri_context(cPriv);
-
-   const int nbox = dPriv->numClipRects;
-   const drm_clip_rect_t *pbox = dPriv->pClipRects;
-
-   struct pipe_surface *dest = fb->front_surface;
-   const int backWidth = fb->stfb->Base.Width;
-   const int backHeight = fb->stfb->Base.Height;
-   int i;
-
-   for (i = 0; i < nbox; i++, pbox++) {
-      drm_clip_rect_t box;
-      drm_clip_rect_t sbox;
-        
-      if (pbox->x1 > pbox->x2 ||
-         pbox->y1 > pbox->y2 ||
-         (pbox->x2 - pbox->x1) > dest->width || 
-         (pbox->y2 - pbox->y1) > dest->height) 
-        continue;
-
-      box = *pbox;
-
-      if (rect) {
-        drm_clip_rect_t rrect;
-
-        rrect.x1 = dPriv->x + rect->x1;
-        rrect.y1 = (dPriv->h - rect->y1 - rect->y2) + dPriv->y;
-        rrect.x2 = rect->x2 + rrect.x1;
-        rrect.y2 = rect->y2 + rrect.y1;
-        if (rrect.x1 > box.x1)
-           box.x1 = rrect.x1;
-        if (rrect.y1 > box.y1)
-           box.y1 = rrect.y1;
-        if (rrect.x2 < box.x2)
-           box.x2 = rrect.x2;
-        if (rrect.y2 < box.y2)
-           box.y2 = rrect.y2;
-
-        if (box.x1 > box.x2 || box.y1 > box.y2)
-           continue;
-      }
-
-      /* restrict blit to size of actually rendered area */
-      if (box.x2 - box.x1 > backWidth)
-        box.x2 = backWidth + box.x1;
-      if (box.y2 - box.y1 > backHeight)
-        box.y2 = backHeight + box.y1;
-
-      debug_printf("%s: box %d,%d-%d,%d\n", __FUNCTION__,
-                   box.x1, box.y1, box.x2, box.y2);
-
-      sbox.x1 = box.x1 - dPriv->x;
-      sbox.y1 = box.y1 - dPriv->y;
-
-      ctx->st->pipe->surface_copy( ctx->st->pipe,
-                                   FALSE,
-                                   dest,
-                                   box.x1, box.y1,
-                                   src,
-                                   sbox.x1, sbox.y1,
-                                   box.x2 - box.x1, 
-                                   box.y2 - box.y1 );
-   }
-}
-
-/**
- * Display a colorbuffer surface in an X window.
- * Used for SwapBuffers and flushing front buffer rendering.
- *
- * \param dPriv  the window/drawable to display into
- * \param surf  the surface to display
- * \param rect  optional subrect of surface to display (may be NULL).
- */
-static void
-dri_display_surface(__DRIdrawablePrivate *dPriv,
-                    struct pipe_surface *source,
-                    const drm_clip_rect_t *rect)
-{
-   struct dri_drawable *drawable = dri_drawable(dPriv);
-   struct dri_screen *screen = dri_screen(dPriv->driScreenPriv);
-   struct dri_context *context = screen->dummy_context;
-   struct pipe_winsys *winsys = screen->winsys;
-      
-   if (!context) 
-      return;
-
-   if (drawable->last_swap_fence) {
-      winsys->fence_finish( winsys,
-                            drawable->last_swap_fence,
-                            0 );
-
-      winsys->fence_reference( winsys,
-                               &drawable->last_swap_fence,
-                               NULL );
-   }
-
-   drawable->last_swap_fence = drawable->first_swap_fence;
-   drawable->first_swap_fence = NULL;
-
-   /* Call lock_hardware to update dPriv cliprects. 
-    */
-   dri_lock_hardware(context, drawable);
-   {
-      if (dPriv->numClipRects) {
-         blit_swapbuffers( context, dPriv, source, rect );
-      }
-   }
-   dri_unlock_hardware(context);
-
-   if (drawble->stamp != drawable->dPriv->lastStamp) {
-      dri_update_window_size( dpriv );
-   }
-}
-
-
-
-/**
- * This will be called a drawable is known to have moved/resized.
- */
-void
-dri_update_window_size(__DRIdrawablePrivate *dPriv)
-{
-   struct dri_drawable *drawable = dri_drawable(dPriv);
-   st_resize_framebuffer(drawable->stfb, dPriv->w, dPriv->h);
-   drawable->stamp = dPriv->lastStamp;
-}
-
-
-
-void
-dri_swap_buffers(__DRIdrawablePrivate * dPriv)
-{
-   struct dri_drawable *drawable = dri_drawable(dPriv);
-   struct pipe_surface *back_surf;
-
-   assert(drawable);
-   assert(drawable->stfb);
-
-   back_surf = st_get_framebuffer_surface(drawable->stfb,
-                                          ST_SURFACE_BACK_LEFT);
-   if (back_surf) {
-      st_notify_swapbuffers(drawable->stfb);
-      dri_display_surface(dPriv, back_surf, NULL);
-      st_notify_swapbuffers_complete(drawable->stfb);
-   }
-}
-
-
-/**
- * Called via glXCopySubBufferMESA() to copy a subrect of the back
- * buffer to the front buffer/screen.
- */
-void
-dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
-{
-   struct dri_drawable *drawable = dri_drawable(dPriv);
-   struct pipe_surface *back_surf;
-
-   assert(drawable);
-   assert(drawable->stfb);
-
-   back_surf = st_get_framebuffer_surface(drawable->stfb,
-                                          ST_SURFACE_BACK_LEFT);
-   if (back_surf) {
-      drm_clip_rect_t rect;
-      rect.x1 = x;
-      rect.y1 = y;
-      rect.x2 = w;
-      rect.y2 = h;
-
-      st_notify_swapbuffers(drawable->stfb);
-      dri_display_surface(dPriv, back_surf, &rect);
-   }
-}
-
-
-
-/*
- * The state tracker keeps track of whether the fake frontbuffer has
- * been touched by any rendering since the last time we copied its
- * contents to the real frontbuffer.  Our task is easy:
- */
-static void
-dri_flush_frontbuffer( struct pipe_winsys *winsys,
-                       struct pipe_surface *surf,
-                       void *context_private)
-{
-   struct dri_context *dri = (struct dri_context *) context_private;
-   __DRIdrawablePrivate *dPriv = dri->driDrawable;
-
-   dri_display_surface(dPriv, surf, NULL);
-}
-
-
-
-/* Need to create a surface which wraps the front surface to support
- * client-side swapbuffers.
- */
-static void
-dri_create_front_surface(struct dri_screen *screen, 
-                         struct pipe_winsys *winsys, 
-                         unsigned handle)
-{
-   struct pipe_screen *pipe_screen = screen->pipe_screen;
-   struct pipe_texture *texture;
-   struct pipe_texture templat;
-   struct pipe_surface *surface;
-   struct pipe_buffer *buffer;
-   unsigned pitch;
-
-   assert(screen->front.cpp == 4);
-
-//   buffer = dri_buffer_from_handle(screen->winsys,
-//                                        "front", handle);
-
-   if (!buffer)
-      return;
-
-   screen->front.buffer = dri_bo(buffer);
-
-   memset(&templat, 0, sizeof(templat));
-   templat.tex_usage |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
-   templat.target = PIPE_TEXTURE_2D;
-   templat.last_level = 0;
-   templat.depth[0] = 1;
-   templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
-   templat.width[0] = screen->front.width;
-   templat.height[0] = screen->front.height;
-   pf_get_block(templat.format, &templat.block);
-   pitch = screen->front.pitch;
-
-   texture = pipe_screen->texture_blanket(pipe_screen,
-                                          &templat,
-                                          &pitch,
-                                          buffer);
-
-   /* Unref the buffer we don't need it anyways */
-   pipe_buffer_reference(screen, &buffer, NULL);
-
-   surface = pipe_screen->get_tex_surface(pipe_screen,
-                                          texture,
-                                          0,
-                                          0,
-                                          0,
-                                          PIPE_BUFFER_USAGE_GPU_WRITE);
-
-   screen->front.texture = texture;
-   screen->front.surface = surface;
-}
-
-/**
- * This is called when we need to set up GL rendering to a new X window.
- */
-static boolean
-dri_create_buffer(__DRIscreenPrivate *sPriv,
-                  __DRIdrawablePrivate *dPriv,
-                  const __GLcontextModes *visual,
-                  boolean isPixmap)
-{
-   enum pipe_format colorFormat, depthFormat, stencilFormat;
-   struct dri_drawable *drawable;
-
-   if (isPixmap) 
-      goto fail;          /* not implemented */
-
-   drawable = CALLOC_STRUCT(dri_drawable);
-   if (drawable == NULL)
-      goto fail;
-
-   /* XXX: todo: use the pipe_screen queries to figure out which
-    * render targets are supportable.
-    */
-   if (visual->redBits == 5)
-      colorFormat = PIPE_FORMAT_R5G6B5_UNORM;
-   else
-      colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
-
-   if (visual->depthBits == 16)
-      depthFormat = PIPE_FORMAT_Z16_UNORM;
-   else if (visual->depthBits == 24) {
-      if (visual->stencilBits == 8)
-         depthFormat = PIPE_FORMAT_S8Z24_UNORM;
-      else
-         depthFormat = PIPE_FORMAT_X8Z24_UNORM;
-   }
-
-   drawable->stfb = st_create_framebuffer(visual,
-                                    colorFormat,
-                                    depthFormat,
-                                    dPriv->w,
-                                    dPriv->h,
-                                    (void*) drawable);
-   if (drawable->stfb == NULL)
-      goto fail;
-
-   dPriv->driverPrivate = (void *) drawable;
-   return GL_TRUE;
-
-fail:
-   FREE(drawable);
-   return GL_FALSE;
-}
-
-static void
-dri_destroy_buffer(__DRIdrawablePrivate *dPriv)
-{
-   struct dri_drawable *drawable = dri_drawable(dPriv);
-
-   /* No particular need to wait on fences before dereferencing them:
-    */
-   winsys->fence_reference( winsys, &ctx->last_swap_fence, NULL );
-   winsys->fence_reference( winsys, &ctx->first_swap_fence, NULL );
-
-   st_unreference_framebuffer(drawable->stfb);
-
-   FREE(drawable);
-}
-
diff --git a/src/gallium/state_trackers/glx/dri/dri_drawable.h b/src/gallium/state_trackers/glx/dri/dri_drawable.h
deleted file mode 100644 (file)
index 1001bb8..0000000
+++ /dev/null
@@ -1,73 +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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef DRI_DRAWABLE_H
-#define DRI_DRAWABLE_H
-
-#include "pipe/p_compiler.h"
-
-struct pipe_surface;
-struct pipe_fence;
-struct st_framebuffer;
-
-
-struct dri_drawable
-{
-   __DRIdrawablePrivate *dPriv;
-   unsigned stamp;
-
-   struct pipe_fence *last_swap_fence;
-   struct pipe_fence *first_swap_fence;
-
-   struct st_framebuffer *stfb;
-};
-
-
-static INLINE struct dri_drawable *
-dri_drawable(__DRIdrawablePrivate * driDrawPriv)
-{
-   return (struct dri_drawable *) driDrawPriv->driverPrivate;
-}
-
-
-/***********************************************************************
- * dri_drawable.c
- */
-
-void 
-dri_swap_buffers(__DRIdrawablePrivate * dPriv);
-
-void 
-dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv,
-                    int x, int y, 
-                    int w, int h);
-
-void 
-dri_update_window_size(__DRIdrawablePrivate *dPriv);
-
-
-#endif
diff --git a/src/gallium/state_trackers/glx/dri/dri_extensions.c b/src/gallium/state_trackers/glx/dri/dri_extensions.c
deleted file mode 100644 (file)
index 126faf7..0000000
+++ /dev/null
@@ -1,108 +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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_point_parameters
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
-#define need_GL_ARB_vertex_program
-#define need_GL_ARB_window_pos
-#define need_GL_EXT_blend_color
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_cull_vertex
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_framebuffer_object
-#define need_GL_EXT_multi_draw_arrays
-#define need_GL_EXT_secondary_color
-#define need_GL_NV_vertex_program
-#include "extension_helper.h"
-
-
-/**
- * Extension strings exported by the driver.
- */
-const struct dri_extension card_extensions[] = {
-   {"GL_ARB_multisample", GL_ARB_multisample_functions},
-   {"GL_ARB_multitexture", NULL},
-   {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
-   {"GL_ARB_texture_border_clamp", NULL},
-   {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions},
-   {"GL_ARB_texture_cube_map", NULL},
-   {"GL_ARB_texture_env_add", NULL},
-   {"GL_ARB_texture_env_combine", NULL},
-   {"GL_ARB_texture_env_dot3", NULL},
-   {"GL_ARB_texture_mirrored_repeat", NULL},
-   {"GL_ARB_texture_rectangle", NULL},
-   {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
-   {"GL_ARB_pixel_buffer_object", NULL},
-   {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
-   {"GL_ARB_window_pos", GL_ARB_window_pos_functions},
-   {"GL_EXT_blend_color", GL_EXT_blend_color_functions},
-   {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
-   {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
-   {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
-   {"GL_EXT_blend_subtract", NULL},
-   {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions},
-   {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions},
-   {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
-   {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
-   {"GL_EXT_packed_depth_stencil", NULL},
-   {"GL_EXT_pixel_buffer_object", NULL},
-   {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
-   {"GL_EXT_stencil_wrap", NULL},
-   {"GL_EXT_texture_edge_clamp", NULL},
-   {"GL_EXT_texture_env_combine", NULL},
-   {"GL_EXT_texture_env_dot3", NULL},
-   {"GL_EXT_texture_filter_anisotropic", NULL},
-   {"GL_EXT_texture_lod_bias", NULL},
-   {"GL_3DFX_texture_compression_FXT1", NULL},
-   {"GL_APPLE_client_storage", NULL},
-   {"GL_MESA_pack_invert", NULL},
-   {"GL_MESA_ycbcr_texture", NULL},
-   {"GL_NV_blend_square", NULL},
-   {"GL_NV_vertex_program", GL_NV_vertex_program_functions},
-   {"GL_NV_vertex_program1_1", NULL},
-   {"GL_SGIS_generate_mipmap", NULL },
-   {NULL, NULL}
-};
-
-
-
-void 
-dri_init_extensions( void )
-{
-   /* The card_extensions list should be pruned according to the
-    * capabilities of the pipe_screen.  This is actually something
-    * that can/should be done inside st_create_context().
-    */
-   driInitExtensions( ctx->st->ctx, card_extensions, GL_TRUE );
-}
diff --git a/src/gallium/state_trackers/glx/dri/dri_lock.c b/src/gallium/state_trackers/glx/dri/dri_lock.c
deleted file mode 100644 (file)
index b272ab5..0000000
+++ /dev/null
@@ -1,90 +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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "pipe/p_thread.h"
-#include "dri_context.h"
-#include "xf86drm.h"
-
-pipe_static_mutex( lockMutex );
-
-static void
-dri_contended_lock(struct dri_context *ctx)
-{
-   __DRIdrawablePrivate *dPriv = ctx->dPriv;
-   __DRIcontextPrivate *cPriv = ctx->cPriv;
-   __DRIscreenPrivate *sPriv = cPriv->driScreenPriv;
-
-   drmGetLock(sPriv->fd, cPriv->hHWContext, 0);
-
-   /* Perform round trip communication with server (including dropping
-    * and retaking the above lock) to update window dimensions:
-    */
-   if (dPriv)
-      DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-}
-
-
-/* Lock the hardware and validate our state.
- */
-void dri_lock_hardware( struct dri_context *ctx )
-{
-   __DRIcontextPrivate *cPriv = ctx->cPriv;
-   __DRIscreenPrivate *sPriv = cPriv->driScreenPriv;
-   char __ret = 0;
-
-   pipe_mutex_lock(lockMutex);
-   assert(!ctx->locked);
-
-   DRM_CAS((drmLock *) &sPriv->pSAREA->lock,
-           cPriv->hHWContext,
-           (DRM_LOCK_HELD | cPriv->hHWContext),
-           __ret);
-
-   if (__ret)
-      dri_contended_lock( ctx );
-
-   ctx->locked = TRUE;
-}
-
-
-/* Unlock the hardware using the global current context
- */
-void dri_unlock_hardware( struct dri_context *ctx )
-{
-   __DRIcontextPrivate *cPriv = ctx->cPriv;
-   __DRIscreenPrivate *sPriv = cPriv->driScreenPriv;
-
-   assert(ctx->locked);
-   ctx->locked = FALSE;
-
-   DRM_UNLOCK(sPriv->fd, 
-              (drmLock *) &sPriv->pSAREA->lock,
-              cPriv->hHWContext);
-
-   pipe_mutex_unlock(lockMutex);
-}
diff --git a/src/gallium/state_trackers/glx/dri/dri_screen.c b/src/gallium/state_trackers/glx/dri/dri_screen.c
deleted file mode 100644 (file)
index f7119b9..0000000
+++ /dev/null
@@ -1,255 +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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "utils.h"
-#include "vblank.h"
-#include "xmlpool.h"
-
-#include "dri_context.h"
-#include "dri_screen.h"
-
-#include "pipe/p_context.h"
-#include "pipe/p_screen.h"
-#include "pipe/p_inlines.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_cb_fbo.h"
-
-
-PUBLIC const char __driConfigOptions[] =
-   DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
-    DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
-    DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
-   DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
-//   DRI_CONF_FORCE_S3TC_ENABLE(false)
-    DRI_CONF_ALLOW_LARGE_TEXTURES(1)
-   DRI_CONF_SECTION_END DRI_CONF_END;
-
-const uint __driNConfigOptions = 3;
-
-static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
-
-extern const struct dri_extension card_extensions[];
-
-
-
-static const __DRIextension *driScreenExtensions[] = {
-    &driReadDrawableExtension,
-    &driCopySubBufferExtension.base,
-    &driSwapControlExtension.base,
-    &driFrameTrackingExtension.base,
-    &driMediaStreamCounterExtension.base,
-    NULL
-};
-
-
-
-
-static const char *
-dri_get_name( struct pipe_winsys *winsys )
-{
-   return "dri";
-}
-
-
-
-static void
-dri_destroy_screen(__DRIscreenPrivate * sPriv)
-{
-   struct dri_screen *screen = dri_screen(sPriv);
-
-   screen->pipe_screen->destroy( screen->pipe_screen );
-   screen->pipe_winsys->destroy( screen->pipe_winsys );
-   FREE(screen);
-   sPriv->private = NULL;
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-static int
-dri_get_swap_info(__DRIdrawablePrivate * dPriv, 
-                  __DRIswapInfo * sInfo)
-{
-   if (dPriv == NULL || 
-       dPriv->driverPrivate == NULL ||
-       sInfo == NULL) 
-      return -1;
-   else
-      return 0;
-}
-
-static const __DRIconfig **
-dri_fill_in_modes(__DRIscreenPrivate *psp,
-                  unsigned pixel_bits )
-{
-   __DRIconfig **configs;
-   __GLcontextModes *m;
-   unsigned num_modes;
-   uint8_t depth_bits_array[3];
-   uint8_t stencil_bits_array[3];
-   uint8_t msaa_samples_array[1];
-   unsigned depth_buffer_factor;
-   unsigned back_buffer_factor;
-   GLenum fb_format;
-   GLenum fb_type;
-   int i;
-
-   static const GLenum back_buffer_modes[] = {
-      GLX_NONE, GLX_SWAP_UNDEFINED_OML
-   };
-
-   depth_bits_array[0] = 0;
-   depth_bits_array[1] = depth_bits;
-   depth_bits_array[2] = depth_bits;
-
-   stencil_bits_array[0] = 0;   /* no depth or stencil */
-   stencil_bits_array[1] = 0;   /* z24x8 */
-   stencil_bits_array[2] = 8;   /* z24s8 */
-
-   msaa_samples_array[0] = 0;
-
-   depth_buffer_factor = 3;
-   back_buffer_factor = 1;
-
-   num_modes = depth_buffer_factor * back_buffer_factor * 4;
-
-   if (pixel_bits == 16) {
-      fb_format = GL_RGB;
-      fb_type = GL_UNSIGNED_SHORT_5_6_5;
-   }
-   else {
-      fb_format = GL_BGRA;
-      fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
-   }
-
-   configs = driCreateConfigs(fb_format, fb_type,
-                             depth_bits_array, 
-                              stencil_bits_array, depth_buffer_factor, 
-                              back_buffer_modes, back_buffer_factor,
-                              msaa_samples_array, 1);
-   if (configs == NULL) {
-      debug_printf("%s: driCreateConfigs failed\n", __FUNCTION__);
-      return NULL;
-   }
-
-   return configs;
-}
-
-
-
-/* This is the driver specific part of the createNewScreen entry point.
- * 
- * Returns the __GLcontextModes supported by this driver.
- */
-static const __DRIconfig **dri_init_screen(__DRIscreenPrivate *sPriv)
-{
-   static const __DRIversion ddx_expected = { 1, 6, 0 }; /* hw query */
-   static const __DRIversion dri_expected = { 4, 0, 0 };
-   static const __DRIversion drm_expected = { 1, 5, 0 }; /* hw query */
-   struct dri_screen *screen;
-
-   if (!driCheckDriDdxDrmVersions2("dri",
-                                   &sPriv->dri_version, &dri_expected,
-                                   &sPriv->ddx_version, &ddx_expected,
-                                   &sPriv->drm_version, &drm_expected)) {
-      return NULL;
-   }
-
-   /* Set up dispatch table to cope with all known extensions:
-    */
-   driInitExtensions( NULL, card_extensions, GL_FALSE );
-
-
-   screen = CALLOC_STRUCT(dri_screen);
-   if (!screen)
-      goto fail;
-
-   screen->sPriv = sPriv;
-   sPriv->private = (void *) screen;
-
-
-   /* Search the registered winsys' for one that likes this sPriv.
-    * This is required in situations where multiple devices speak to
-    * the same DDX and are built into the same binary.  
-    *
-    * Note that cases like Intel i915 vs i965 doesn't fall into this
-    * category because they are built into separate binaries.
-    *
-    * Nonetheless, it's healthy to keep that level of detail out of
-    * this state_tracker.
-    */
-   for (i = 0; 
-        i < dri1_winsys_count && 
-           screen->st_winsys == NULL; 
-        i++) 
-   {
-      screen->dri_winsys = 
-         dri_winsys[i]->check_dri_privates( sPriv->pDevPriv,
-                                            sPriv->pSAREA
-                                            /* versions, etc?? */));
-   }
-                                             
-
-   driParseOptionInfo(&screen->optionCache,
-                      __driConfigOptions, 
-                      __driNConfigOptions);
-
-
-   /* Plug our info back into the __DRIscreenPrivate:
-    */
-   sPriv->private = (void *) screen;
-   sPriv->extensions = driScreenExtensions;
-
-   return dri_fill_in_modes(sPriv, 
-                            dri_priv->cpp * 8,
-                            24,
-                            8,
-                            1);
-fail:
-   return NULL;
-}
-
-
-
-const struct __DriverAPIRec driDriverAPI = {
-   .InitScreen          = dri_init_screen,
-   .DestroyScreen       = dri_destroy_screen,
-   .CreateContext       = dri_create_context,
-   .DestroyContext      = dri_destroy_context,
-   .CreateBuffer        = dri_create_buffer,
-   .DestroyBuffer       = dri_destroy_buffer,
-   .SwapBuffers                 = dri_swap_buffers,
-   .MakeCurrent                 = dri_make_current,
-   .UnbindContext       = dri_unbind_context,
-   .GetSwapInfo                 = dri_get_swap_info,
-   .GetDrawableMSC      = driDrawableGetMSC32,
-   .WaitForMSC          = driWaitForMSC32,
-   .CopySubBuffer       = dri_copy_sub_buffer,
-
-   //.InitScreen2               = dri_init_screen2,
-};
diff --git a/src/gallium/state_trackers/glx/dri/dri_screen.h b/src/gallium/state_trackers/glx/dri/dri_screen.h
deleted file mode 100644 (file)
index 12ed86d..0000000
+++ /dev/null
@@ -1,83 +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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef DRI_SCREEN_H
-#define DRI_SCREEN_H
-
-#include "dri_util.h"
-#include "xmlconfig.h"
-
-#include "pipe/p_compiler.h"
-
-struct dri_screen
-{
-   __DRIScreenPrivate *sPriv;
-   struct pipe_winsys *pipe_winsys;
-   struct pipe_screen *pipe_screen;
-
-   struct {
-      /* Need a pipe_surface pointer to do client-side swapbuffers:
-       */
-      unsigned long buffer_handle;
-      struct pipe_surface *surface;
-      struct pipe_texture *texture;
-
-      int pitch;                   /* row stride, in bytes */
-      int width;
-      int height;
-      int size;
-      int cpp;                     /* for front and back buffers */
-   } front;
-
-   int deviceID;
-   int drmMinor;
-
-
-   /**
-    * Configuration cache with default values for all contexts
-    */
-   driOptionCache optionCache;
-
-   /**
-    * Temporary(?) context to use for SwapBuffers or other situations in
-    * which we need a rendering context, but none is currently bound.
-    */
-   struct dri_context *dummyContext;
-};
-
-
-
-/** cast wrapper */
-static INLINE struct dri_screen *
-dri_screen(__DRIscreenPrivate *sPriv)
-{
-   return (struct dri_screen *) sPriv->private;
-}
-
-
-
-#endif
index 1b63db1f0ea94fb482ae4a0df88f57fbe8949233..6d10b090aa0c9e37a9b9a58dbc533d7c4d268e1a 100644 (file)
@@ -3,23 +3,15 @@ include $(TOP)/configs/current
 
 LIBNAME = xlib
 
-
-DRIVER_INCLUDES = \
+LIBRARY_INCLUDES = \
        -I$(TOP)/include \
        -I$(TOP)/src/mesa \
-       -I$(TOP)/src/mesa/main \
-       -I$(TOP)/src/gallium/include \
-       -I$(TOP)/src/gallium/drivers \
-       -I$(TOP)/src/gallium/auxiliary
+       -I$(TOP)/src/mesa/main
 
 C_SOURCES = \
-       glxapi.c        \
-       fakeglx.c       \
-       fakeglx_fonts.c \
+       glxapi.c \
+       fakeglx.c \
+       fakeglx_fonts.c \
        xm_api.c
 
-
 include ../../../Makefile.template
-
-symlinks:
-
index 14cdad69cbefaa6924e6f58f580d45385a31026a..0dbe34139724d98692fb88081ca360eeae149009 100644 (file)
@@ -5,8 +5,7 @@ Import('*')
 
 if env['platform'] == 'linux' \
         and 'mesa' in env['statetrackers'] \
-        and ('softpipe' or 'i915simple' or 'trace') in env['drivers'] \
-        and not env['dri']:
+        and ('softpipe' or 'i915simple' or 'trace') in env['drivers']:
 
     env = env.Clone()
 
@@ -15,6 +14,8 @@ if env['platform'] == 'linux' \
         '#/src/mesa/main',
     ])
 
+    env.Append(CPPDEFINES = ['USE_XSHM'])
+
     st_xlib = env.ConvenienceLibrary(
        target = 'st_xlib',
        source = [ 'glxapi.c',
index 1ff04804f15a8e87c0b34bf6ad07a6a1962c1bf0..c2cb34d7cf79493c129e6e9f85231ce458e38bde 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "main/glheader.h"
 #include "glapi/glapi.h"
 #include "glxapi.h"
 #include "fakeglx.h"
 #include "pipe/p_thread.h"
 
 
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
+#  define PUBLIC __attribute__((visibility("default")))
+#  define USED __attribute__((used))
+#else
+#  define PUBLIC
+#  define USED
+#endif
+
+
 struct display_dispatch {
    Display *Dpy;
    struct _glxapi_table *Table;
index 33dc044ad55954154c3fec3a722f0d890bf29e39..a3d16516531a76e4d16849c9e5d29eba8ea030bf 100644 (file)
@@ -458,7 +458,7 @@ xmesa_free_buffer(XMesaBuffer buffer)
          XDestroyImage(buffer->tempImage);
 
          /* Unreference.  If count = zero we'll really delete the buffer */
-         _mesa_unreference_framebuffer(&fb);
+         _mesa_reference_framebuffer(&fb, NULL);
 
          XFreeGC(b->xm_visual->display, b->gc);
 
@@ -763,7 +763,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
 
    c->xm_visual = v;
    c->xm_buffer = NULL;   /* set later by XMesaMakeCurrent */
-   
+   c->xm_read_buffer = NULL;
+
    /* XXX: create once per Xlib Display.
     */
    screen = driver.create_pipe_screen();
@@ -1037,27 +1038,25 @@ PUBLIC
 GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
                              XMesaBuffer readBuffer )
 {
+   XMesaContext old_ctx = XMesaGetCurrentContext();
+
+   if (old_ctx && old_ctx != c) {
+      XMesaFlush(old_ctx);
+      old_ctx->xm_buffer = NULL;
+      old_ctx->xm_read_buffer = NULL;
+   }
+
    if (c) {
       if (!drawBuffer || !readBuffer)
          return GL_FALSE;  /* must specify buffers! */
 
-#if 0
-      /* XXX restore this optimization */
-      if (&(c->mesa) == _mesa_get_current_context()
-          && c->mesa.DrawBuffer == &drawBuffer->mesa_buffer
-          && c->mesa.ReadBuffer == &readBuffer->mesa_buffer
-          && xmesa_buffer(c->mesa.DrawBuffer)->wasCurrent) {
-         /* same context and buffer, do nothing */
-         return GL_TRUE;
-      }
-#endif
+      if (c == old_ctx &&
+         c->xm_buffer == drawBuffer &&
+         c->xm_read_buffer == readBuffer)
+        return GL_TRUE;
 
       c->xm_buffer = drawBuffer;
-
-      /* Call this periodically to detect when the user has begun using
-       * GL rendering from multiple threads.
-       */
-      _glapi_check_multithread();
+      c->xm_read_buffer = readBuffer;
 
       st_make_current(c->st, drawBuffer->stfb, readBuffer->stfb);
 
@@ -1071,6 +1070,7 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
    else {
       /* Detach */
       st_make_current( NULL, NULL, NULL );
+
    }
    return GL_TRUE;
 }
@@ -1143,7 +1143,6 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
       return;
 
    pipe->surface_copy(pipe,
-                      FALSE,
                       surf_front, x, y,  /* dest */
                       surf_back, x, y,   /* src */
                       width, height);
index 2b8302d1747c2a12061d51b621e11502bb9aaffd..bdd434cd3643d812c4679f29fbb2be4cc925651a 100644 (file)
@@ -295,6 +295,7 @@ struct xmesa_context {
    struct st_context *st;
    XMesaVisual xm_visual;      /** pixel format info */
    XMesaBuffer xm_buffer;      /** current drawbuffer */
+   XMesaBuffer xm_read_buffer;  /** current readbuffer */
 };
 
 
index f4c4b36ea7d5d18da84b78dabe8c3a2d07a8843c..79e68de1df8d15610a20deb3d164c4afbf2143d6 100644 (file)
 #include "pipe/p_screen.h"
 #include "pipe/p_context.h"
 #include "pipe/p_inlines.h"
-#include "util/u_memory.h"
-#include "pipe/p_shader_tokens.h" 
+#include "pipe/p_shader_tokens.h"
+#include "pipe/internal/p_winsys_screen.h"
 #include "cso_cache/cso_context.h"
-#include "util/u_draw_quad.h" 
-#include "util/u_tile.h" 
-#include "tgsi/tgsi_text.h" 
-#include "tgsi/tgsi_dump.h" 
+#include "util/u_draw_quad.h"
+#include "util/u_tile.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "tgsi/tgsi_text.h"
+#include "tgsi/tgsi_dump.h"
 
 #include "st_device.h"
 #include "st_sample.h"
@@ -93,7 +95,7 @@
 
 
 %include "p_compiler.i"
-%include "pipe/p_defines.h";
+%include "p_defines.h";
 %include "p_format.i"
 
 %include "p_device.i"
index 7b8b64b5923ed9a2dc675ebd8c9ec903c7b93389..1fdbdf98b26d5d0a0a1ba43dba8e3320b83d5d70 100644 (file)
@@ -121,7 +121,6 @@ struct st_context {
       struct pipe_constant_buffer state;
       memset(&state, 0, sizeof(state));
       state.buffer = buffer ? buffer->buffer : NULL;
-      state.size = buffer->buffer->size;
       $self->pipe->set_constant_buffer($self->pipe, shader, index, &state);
    }
 
@@ -161,7 +160,7 @@ struct st_context {
       struct pipe_vertex_buffer state;
       
       memset(&state, 0, sizeof(state));
-      state.pitch = pitch;
+      state.stride = pitch;
       state.max_index = max_index;
       state.buffer_offset = buffer_offset;
       state.buffer = buffer ? buffer->buffer : NULL;
@@ -248,7 +247,7 @@ struct st_context {
       util_draw_vertex_buffer(pipe, vbuf, 0, prim, num_verts, num_attribs);
       
 error2:
-      pipe_buffer_reference(screen, &vbuf, NULL);
+      pipe_buffer_reference(&vbuf, NULL);
 error1:
       ;
    }
@@ -266,13 +265,12 @@ error1:
     * Surface functions
     */
    
-   void surface_copy(int do_flip,
-                     struct pipe_surface *dest,
+   void surface_copy(struct pipe_surface *dest,
                      unsigned destx, unsigned desty,
                      struct pipe_surface *src,
                      unsigned srcx, unsigned srcy,
                      unsigned width, unsigned height) {
-      $self->pipe->surface_copy($self->pipe, do_flip, dest, destx, desty, src, srcx, srcy, width, height);
+      $self->pipe->surface_copy($self->pipe, dest, destx, desty, src, srcx, srcy, width, height);
    }
 
    void surface_fill(struct pipe_surface *dst,
index 7f5760b3b66da4a10f104fca0a3b943f094f0f7e..110b3d5da432d0480497b574bc3466758bd30626 100644 (file)
@@ -37,6 +37,7 @@
 %ignore winsys;
 %ignore pipe_vertex_buffer::buffer;
 
+%include "pipe/p_compiler.h";
 %include "pipe/p_state.h";
 
 
index 08ba0ebe4d0b566f93474eabedaf70e7dd9b88cb..1e64fc8e41fd997b43e67bb48be8de5054d0ca5d 100644 (file)
       pipe_put_tile_rgba($self, x, y, w, h, rgba);
    }
 
+   %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
+   void
+   get_tile_rgba8(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH) 
+   {
+      unsigned surface_usage;
+      float *rgba;
+      unsigned char *rgba8;
+      unsigned i, j, k;
+
+      *LENGTH = 0;
+      *STRING = NULL;
+      
+      if (!$self)
+         return;
+
+      *LENGTH = h*w*4;
+      *STRING = (char *) malloc(*LENGTH);
+      if(!*STRING)
+         return;
+      
+      rgba = malloc(w*4*sizeof(float));
+      if(!rgba)
+         return;
+      
+      rgba8 = (unsigned char *) *STRING;
+
+      /* XXX: force mappable surface */
+      surface_usage = $self->usage;
+      $self->usage |= PIPE_BUFFER_USAGE_CPU_READ;
+
+      for(j = 0; j < h; ++j) {
+         pipe_get_tile_rgba($self,
+                            x, y + j, w, 1,
+                            rgba);
+         for(i = 0; i < w; ++i)
+            for(k = 0; k <4; ++k)
+               rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[i*4 + k]);
+      }
+      
+      $self->usage = surface_usage;
+      
+      free(rgba);
+   }
+
    void
    get_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, unsigned *z) {
       pipe_get_tile_z($self, x, y, w, h, z);
@@ -181,7 +225,7 @@ struct st_buffer {
    
    unsigned __len__(void) 
    {
-      assert($self->buffer->refcount);
+      assert(p_atomic_read(&$self->buffer->reference.count) > 0);
       return $self->buffer->size;
    }
    
@@ -191,7 +235,7 @@ struct st_buffer {
       struct pipe_screen *screen = $self->st_dev->screen;
       const char *map;
       
-      assert($self->buffer->refcount);
+      assert(p_atomic_read(&$self->buffer->reference.count) > 0);
       
       *LENGTH = $self->buffer->size;
       *STRING = (char *) malloc($self->buffer->size);
@@ -211,7 +255,7 @@ struct st_buffer {
       struct pipe_screen *screen = $self->st_dev->screen;
       char *map;
       
-      assert($self->buffer->refcount);
+      assert(p_atomic_read(&$self->buffer->reference.count) > 0);
       
       if(offset > $self->buffer->size) {
          PyErr_SetString(PyExc_ValueError, "offset must be smaller than buffer size");
index f418f80d7b4092d9b84d752eb05c58e7508f7684..e6999a2211ea58459c41841429ac3c206b76979c 100755 (executable)
@@ -35,21 +35,19 @@ import model
 import parser
 
 
+try:
+    from struct import unpack_from
+except ImportError:
+    def unpack_from(fmt, buf, offset=0):
+        size = struct.calcsize(fmt)
+        return struct.unpack(fmt, buf[offset:offset + size])
+
+
 def make_image(surface):
-    pixels = gallium.FloatArray(surface.height*surface.width*4)
-    surface.get_tile_rgba(0, 0, surface.width, surface.height, pixels)
+    data = surface.get_tile_rgba8(0, 0, surface.width, surface.height)
 
     import Image
-    outimage = Image.new(
-        mode='RGB',
-        size=(surface.width, surface.height),
-        color=(0,0,0))
-    outpixels = outimage.load()
-    for y in range(0, surface.height):
-        for x in range(0, surface.width):
-            offset = (y*surface.width + x)*4
-            r, g, b, a = [int(pixels[offset + ch]*255) for ch in range(4)]
-            outpixels[x, y] = r, g, b
+    outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1)
     return outimage
 
 def save_image(filename, surface):
@@ -77,6 +75,7 @@ def show_image(surface):
     root.mainloop()
 
 
+verbose = 1
 
 
 class Struct:
@@ -297,6 +296,7 @@ class Context(Object):
         self.zsbuf = None
         self.vbufs = []
         self.velems = []
+        self.dirty = False
 
     def destroy(self):
         pass
@@ -374,18 +374,23 @@ class Context(Object):
             _state.ucp = ucp
         self.real.set_clip(_state)
 
+    def dump_constant_buffer(self, buffer):
+        if verbose < 2:
+            return
+
+        data = buffer.read()
+        format = '4f'
+        index = 0
+        for offset in range(0, len(data), struct.calcsize(format)):
+            x, y, z, w = unpack_from(format, data, offset)
+            sys.stdout.write('\tCONST[%2u] = {%10.4f, %10.4f, %10.4f, %10.4f}\n' % (index, x, y, z, w))
+            index += 1
+
     def set_constant_buffer(self, shader, index, state):
         if state is not None:
             self.real.set_constant_buffer(shader, index, state.buffer)
 
-            if 1:
-                data = state.buffer.read()
-                format = '4f'
-                index = 0
-                for offset in range(0, len(data), struct.calcsize(format)):
-                    x, y, z, w = struct.unpack_from(format, data, offset)
-                    sys.stdout.write('\tCONST[%2u] = {%10.4f, %10.4f, %10.4f, %10.4f}\n' % (index, x, y, z, w))
-                    index += 1
+            self.dump_constant_buffer(state.buffer)
 
     def set_framebuffer_state(self, state):
         _state = gallium.Framebuffer()
@@ -436,6 +441,9 @@ class Context(Object):
         pass
     
     def dump_vertices(self, start, count):
+        if verbose < 2:
+            return
+
         for index in range(start, start + count):
             if index >= start + 16:
                 sys.stdout.write('\t...\n')
@@ -454,12 +462,15 @@ class Context(Object):
                 }[velem.src_format]
 
                 data = vbuf.buffer.read()
-                values = struct.unpack_from(format, data, offset)
+                values = unpack_from(format, data, offset)
                 sys.stdout.write('\t\t{' + ', '.join(map(str, values)) + '},\n')
                 assert len(values) == velem.nr_components
             sys.stdout.write('\t},\n')
 
     def dump_indices(self, ibuf, isize, start, count):
+        if verbose < 2:
+            return
+
         format = {
             1: 'B',
             2: 'H',
@@ -477,7 +488,7 @@ class Context(Object):
                 sys.stdout.write('\t...\n')
                 break
             offset = i*isize
-            index, = struct.unpack_from(format, data, offset)
+            index, = unpack_from(format, data, offset)
             sys.stdout.write('\t\t%u,\n' % index)
             minindex = min(minindex, index)
             maxindex = max(maxindex, index)
@@ -489,25 +500,35 @@ class Context(Object):
         self.dump_vertices(start, count)
             
         self.real.draw_arrays(mode, start, count)
+
+        self.dirty = True
     
     def draw_elements(self, indexBuffer, indexSize, mode, start, count):
-        minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count)
-        self.dump_vertices(minindex, maxindex - minindex)
+        if verbose >= 2:
+            minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count)
+            self.dump_vertices(minindex, maxindex - minindex)
 
         self.real.draw_elements(indexBuffer, indexSize, mode, start, count)
+
+        self.dirty = True
         
     def draw_range_elements(self, indexBuffer, indexSize, minIndex, maxIndex, mode, start, count):
-        minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count)
-        minindex = min(minindex, minIndex)
-        maxindex = min(maxindex, maxIndex)
-        self.dump_vertices(minindex, maxindex - minindex)
+        if verbose >= 2:
+            minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count)
+            minindex = min(minindex, minIndex)
+            maxindex = min(maxindex, maxIndex)
+            self.dump_vertices(minindex, maxindex - minindex)
 
         self.real.draw_range_elements(indexBuffer, indexSize, minIndex, maxIndex, mode, start, count)
+
+        self.dirty = True
         
     def flush(self, flags):
         self.real.flush(flags)
-        if flags & gallium.PIPE_FLUSH_FRAME:
-            self._update()
+        if self.dirty:
+            if flags & gallium.PIPE_FLUSH_FRAME:
+                self._update()
+            self.dirty = False
         return None
 
     def clear(self, surface, value):
@@ -553,7 +574,8 @@ class Interpreter(parser.TraceDumper):
         if (call.klass, call.method) in self.ignore_calls:
             return
 
-        parser.TraceDumper.handle_call(self, call)
+        if verbose >= 1:
+            parser.TraceDumper.handle_call(self, call)
         
         args = [self.interpret_arg(arg) for name, arg in call.args] 
         
index 193479f7d6cc31d08416e20cbedb35452de84a9b..d3ccb6c2f466324eef1acc0b14453c7f26c842e8 100644 (file)
@@ -31,20 +31,10 @@ from gallium import *
 
 
 def make_image(surface):
-    pixels = FloatArray(surface.height*surface.width*4)
-    surface.get_tile_rgba(0, 0, surface.width, surface.height, pixels)
+    data = surface.get_tile_rgba8(0, 0, surface.width, surface.height)
 
     import Image
-    outimage = Image.new(
-        mode='RGB',
-        size=(surface.width, surface.height),
-        color=(0,0,0))
-    outpixels = outimage.load()
-    for y in range(0, surface.height):
-        for x in range(0, surface.width):
-            offset = (y*surface.width + x)*4
-            r, g, b, a = [int(pixels[offset + ch]*255) for ch in range(4)]
-            outpixels[x, y] = r, g, b
+    outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1)
     return outimage
 
 def save_image(filename, surface):
index 20dd8d269d906d731871195b8ae261d4f0156eab..366d4eb19afd1e1659795539cce402fbc93d1275 100644 (file)
@@ -51,11 +51,20 @@ st_device_really_destroy(struct st_device *st_dev)
 }
 
 
+static void
+st_device_reference(struct st_device **ptr, struct st_device *st_dev)
+{
+   struct st_device *old_dev = *ptr;
+
+   if (pipe_reference((struct pipe_reference **)ptr, &st_dev->reference))
+      st_device_really_destroy(old_dev);
+}
+
+
 void
 st_device_destroy(struct st_device *st_dev) 
 {
-   if(!--st_dev->refcount)
-      st_device_really_destroy(st_dev);
+   st_device_reference(&st_dev, NULL);
 }
 
 
@@ -72,7 +81,7 @@ st_device_create_from_st_winsys(const struct st_winsys *st_ws)
    if(!st_dev)
       return NULL;
    
-   st_dev->refcount = 1;
+   pipe_reference_init(&st_dev->reference, 1);
    st_dev->st_ws = st_ws;
    
    st_dev->real_screen = st_ws->screen_create();
@@ -124,8 +133,7 @@ st_context_destroy(struct st_context *st_ctx)
 
       FREE(st_ctx);
       
-      if(!--st_dev->refcount)
-         st_device_really_destroy(st_dev);
+      st_device_reference(&st_dev, NULL);
    }
 }
 
@@ -139,8 +147,7 @@ st_context_create(struct st_device *st_dev)
    if(!st_ctx)
       return NULL;
    
-   st_ctx->st_dev = st_dev;
-   ++st_dev->refcount;
+   st_device_reference(&st_ctx->st_dev, st_dev);
    
    st_ctx->real_pipe = st_dev->st_ws->context_create(st_dev->real_screen);
    if(!st_ctx->real_pipe) {
@@ -185,8 +192,7 @@ st_context_create(struct st_device *st_dev)
       memset(&rasterizer, 0, sizeof(rasterizer));
       rasterizer.front_winding = PIPE_WINDING_CW;
       rasterizer.cull_mode = PIPE_WINDING_NONE;
-      rasterizer.bypass_clipping = 1;
-      /*rasterizer.bypass_vs = 1;*/
+      rasterizer.bypass_vs_clip_and_viewport = 1;
       cso_set_rasterizer(st_ctx->cso, &rasterizer);
    }
 
@@ -225,7 +231,7 @@ st_context_create(struct st_device *st_dev)
    {
       struct pipe_screen *screen = st_dev->screen;
       struct pipe_texture templat;
-      struct pipe_surface *surface;
+      struct pipe_transfer *transfer;
       unsigned i;
 
       memset( &templat, 0, sizeof( templat ) );
@@ -241,17 +247,21 @@ st_context_create(struct st_device *st_dev)
    
       st_ctx->default_texture = screen->texture_create( screen, &templat );
       if(st_ctx->default_texture) {
-         surface = screen->get_tex_surface( screen, 
-                                            st_ctx->default_texture, 0, 0, 0,
-                                            PIPE_BUFFER_USAGE_CPU_WRITE );
-         if(surface) {
+         transfer = screen->get_tex_transfer(screen,
+                                             st_ctx->default_texture,
+                                             0, 0, 0,
+                                             PIPE_TRANSFER_WRITE,
+                                             0, 0,
+                                             st_ctx->default_texture->width[0],
+                                             st_ctx->default_texture->height[0]);
+         if (transfer) {
             uint32_t *map;
-            map = (uint32_t *) pipe_surface_map(surface, PIPE_BUFFER_USAGE_CPU_WRITE );
+            map = (uint32_t *) screen->transfer_map(screen, transfer);
             if(map) {
                *map = 0x00000000;
-               pipe_surface_unmap( surface );
+               screen->transfer_unmap(screen, transfer);
             }
-            pipe_surface_reference(&surface, NULL);
+            screen->tex_transfer_destroy(transfer);
          }
       }
    
@@ -263,24 +273,19 @@ st_context_create(struct st_device *st_dev)
    
    /* vertex shader */
    {
-      struct pipe_shader_state vert_shader;
-
       const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
                                       TGSI_SEMANTIC_GENERIC };
       const uint semantic_indexes[] = { 0, 0 };
       st_ctx->vs = util_make_vertex_passthrough_shader(st_ctx->pipe, 
                                                        2, 
                                                        semantic_names,
-                                                       semantic_indexes,
-                                                       &vert_shader);
+                                                       semantic_indexes);
       cso_set_vertex_shader_handle(st_ctx->cso, st_ctx->vs);
    }
 
    /* fragment shader */
    {
-      struct pipe_shader_state frag_shader;
-      st_ctx->fs = util_make_fragment_passthrough_shader(st_ctx->pipe, 
-                                                         &frag_shader);
+      st_ctx->fs = util_make_fragment_passthrough_shader(st_ctx->pipe);
       cso_set_fragment_shader_handle(st_ctx->cso, st_ctx->fs);
    }
 
@@ -292,8 +297,7 @@ void
 st_buffer_destroy(struct st_buffer *st_buf)
 {
    if(st_buf) {
-      struct pipe_screen *screen = st_buf->st_dev->screen;
-      pipe_buffer_reference(screen, &st_buf->buffer, NULL);
+      pipe_buffer_reference(&st_buf->buffer, NULL);
       FREE(st_buf);
    }
 }
index 7cfe6de9f6a733ab9bc8c065e0ef3478fc5b1cd1..0641aff149fd7b5a002f6ebcb2467486cb8ba62a 100644 (file)
@@ -68,13 +68,13 @@ struct st_context {
 
 
 struct st_device {
+   /* FIXME: we also need to refcount for textures and surfaces... */
+   struct pipe_reference reference;
+
    const struct st_winsys *st_ws; 
 
    struct pipe_screen *real_screen;
    struct pipe_screen *screen;
-   
-   /* FIXME: we also need to refcount for textures and surfaces... */
-   unsigned refcount;
 };
 
 
index 7765df3c4a4c6aa0cf2b9937eeaf4f6d67110bd4..c2ffe9fce1d513bf689f9f33d9714c5390ec3afa 100644 (file)
@@ -451,6 +451,7 @@ st_sample_dxt_pixel_block(enum pipe_format format,
       break;
    default:
       assert(0);
+      return;
    }
    
    i = st_random() % n;
@@ -524,26 +525,42 @@ st_sample_pixel_block(enum pipe_format format,
 void
 st_sample_surface(struct pipe_surface *surface, float *rgba) 
 {
-   const struct pipe_format_block *block = &surface->block;
-   unsigned rgba_stride = surface->width*4;
+   struct pipe_screen *screen = surface->texture->screen;
+   uint rgba_stride = surface->width * 4;
+   struct pipe_transfer *transfer;
    void *raw;
-   unsigned x, y;
 
-   raw = pipe_surface_map(surface, PIPE_BUFFER_USAGE_CPU_READ);
-   if(!raw)
+   transfer = screen->get_tex_transfer(screen,
+                                       surface->texture,
+                                       surface->face,
+                                       surface->level,
+                                       surface->zslice,
+                                       PIPE_TRANSFER_READ,
+                                       0, 0,
+                                       surface->width,
+                                       surface->height);
+   if (!transfer)
       return;
 
-   for (y = 0; y < surface->nblocksy; ++y) {
-      for(x = 0; x < surface->nblocksx; ++x) {
-         st_sample_pixel_block(surface->format,
-                               block,
-                               (uint8_t*)raw + y*surface->stride + x*block->size, 
-                               rgba + y*block->height*rgba_stride + x*block->width*4,
-                               rgba_stride,
-                               MIN2(block->width, surface->width - x*block->width), 
-                               MIN2(block->height, surface->height - y*block->height));
-       }
+   raw = screen->transfer_map(screen, transfer);
+   if (raw) {
+      const struct pipe_format_block *block = &transfer->block;
+      uint x, y;
+
+      for (y = 0; y < transfer->nblocksy; ++y) {
+         for (x = 0; x < transfer->nblocksx; ++x) {
+            st_sample_pixel_block(surface->format,
+                                  block,
+                                  (uint8_t *) raw + y * transfer->stride + x * block->size,
+                                  rgba + y * block->height * rgba_stride + x * block->width * 4,
+                                  rgba_stride,
+                                  MIN2(block->width, surface->width - x*block->width),
+                                  MIN2(block->height, surface->height - y*block->height));
+         }
+      }
+
+      screen->transfer_unmap(screen, transfer);
    }
    
-   pipe_surface_unmap(surface);
+   screen->tex_transfer_destroy(transfer);
 }
index 4d798df99bf2221e6bd111edb76bff9afc2c174d..426f347d18977a91fdb2c447cd8dc5c1b0181655 100644 (file)
@@ -124,7 +124,7 @@ st_softpipe_buffer_create(struct pipe_winsys *winsys,
 {
    struct st_softpipe_buffer *buffer = CALLOC_STRUCT(st_softpipe_buffer);
 
-   buffer->base.refcount = 1;
+   pipe_reference_init(&buffer->base.reference, 1);
    buffer->base.alignment = alignment;
    buffer->base.usage = usage;
    buffer->base.size = size;
@@ -149,7 +149,7 @@ st_softpipe_user_buffer_create(struct pipe_winsys *winsys,
    if(!buffer)
       return NULL;
    
-   buffer->base.refcount = 1;
+   pipe_reference_init(&buffer->base.reference, 1);
    buffer->base.size = bytes;
    buffer->userBuffer = TRUE;
    buffer->data = ptr;
index c72f495735d8d2a0dc7b600e7c85017094c05ed4..2141b02d688af237796742ff928f67cf74cbfd38 100644 (file)
@@ -14,13 +14,10 @@ if env['platform'] in ['windows']:
     env.Append(CPPDEFINES = [
         '_GDI32_', # prevent wgl* being declared __declspec(dllimport)
         'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers 
-        '__GL_EXPORTS',
-        '_GNU_H_WINDOWS32_DEFINES',
+        'WIN32_THREADS', # use Win32 thread API
     ])
      
     sources = [
-        'stw.c',
-
         'icd/stw_icd.c',
 
         'wgl/stw_wgl.c',
index 1aa4b8a6e22e71de6326e9bd77ef45a559da3402..faf7f2f41067a0667ef72c4276f98f4f6c717656 100644 (file)
 
 #include "GL/gl.h"
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "pipe/p_thread.h"
 
 #include "shared/stw_public.h"
 #include "icd/stw_icd.h"
-#include "stw.h"
 
+#define DBG 0
 
-#define DRV_CONTEXT_MAX 32
+static GLCLTPROCTABLE cpt;
+static boolean cpt_initialized = FALSE;
 
-struct stw_icd
-{
-   pipe_mutex mutex;
-
-   GLCLTPROCTABLE cpt;
-   boolean cpt_initialized;
-
-   struct {
-      struct stw_context *ctx;
-   } ctx_array[DRV_CONTEXT_MAX];
-};
-
-
-static struct stw_icd *stw_icd = NULL;
-
-
-boolean
-stw_icd_init( void )
-{
-   static struct stw_icd stw_icd_storage;
-
-   assert(!stw_icd);
-
-   stw_icd = &stw_icd_storage;
-   memset(stw_icd, 0, sizeof *stw_icd);
-
-   pipe_mutex_init( stw_icd->mutex );
-
-   return TRUE;
-}
-
-void
-stw_icd_cleanup(void)
-{
-   int i;
-
-   if (!stw_icd)
-      return;
-   
-   pipe_mutex_lock( stw_icd->mutex );
-   {
-      /* Ensure all contexts are destroyed */
-      for (i = 0; i < DRV_CONTEXT_MAX; i++)
-         if (stw_icd->ctx_array[i].ctx) 
-            stw_delete_context( stw_icd->ctx_array[i].ctx );
-   }
-   pipe_mutex_unlock( stw_icd->mutex );
-
-   pipe_mutex_init( stw_icd->mutex );
-   stw_icd = NULL;
-}
-
-
-static struct stw_context *
-lookup_context( struct stw_icd *icd, 
-                DHGLRC dhglrc )
-{
-   if (dhglrc == 0 || 
-       dhglrc >= DRV_CONTEXT_MAX)
-      return NULL;
-
-   if (icd == NULL)
-      return NULL;
-
-   return icd->ctx_array[dhglrc - 1].ctx;
-}
 
 BOOL APIENTRY
 DrvCopyContext(
@@ -113,63 +48,16 @@ DrvCopyContext(
    DHGLRC dhrcDest,
    UINT fuMask )
 {
-   BOOL ret = FALSE;
-
-   if (!stw_icd)
-      return FALSE;
-
-   pipe_mutex_lock( stw_icd->mutex );
-   {
-      struct stw_context *src = lookup_context( stw_icd, dhrcSource );
-      struct stw_context *dst = lookup_context( stw_icd, dhrcDest );
-   
-      if (src == NULL || dst == NULL) 
-         goto done;
-
-      ret = stw_copy_context( src, dst, fuMask );
-   }
-done:
-   pipe_mutex_unlock( stw_icd->mutex );
-
-   return ret;
+   return stw_copy_context(dhrcSource, dhrcDest, fuMask);
 }
 
+
 DHGLRC APIENTRY
 DrvCreateLayerContext(
    HDC hdc,
    INT iLayerPlane )
 {
-   DHGLRC handle = 0;
-
-   if (!stw_icd)
-      return handle;
-
-   pipe_mutex_lock( stw_icd->mutex );
-   {
-      int i;
-
-      for (i = 0; i < DRV_CONTEXT_MAX; i++) {
-         if (stw_icd->ctx_array[i].ctx == NULL)
-            break;
-      }
-   
-      /* No slot available, fail:
-       */
-      if (i == DRV_CONTEXT_MAX)
-         goto done;
-
-      stw_icd->ctx_array[i].ctx = stw_create_context( hdc, iLayerPlane );
-      if (stw_icd->ctx_array[i].ctx == NULL) 
-         goto done;
-      
-      /* success:
-       */
-      handle = (DHGLRC) i + 1;
-   }
-done:
-   pipe_mutex_unlock( stw_icd->mutex );
-
-   return handle;
+   return stw_create_layer_context( hdc, iLayerPlane );
 }
 
 DHGLRC APIENTRY
@@ -183,30 +71,7 @@ BOOL APIENTRY
 DrvDeleteContext(
    DHGLRC dhglrc )
 {
-   BOOL ret = FALSE;
-
-   if (!stw_icd)
-      return ret;
-
-   pipe_mutex_lock( stw_icd->mutex );
-   {
-      struct stw_context *ctx;
-
-      ctx = lookup_context( stw_icd, dhglrc );
-      if (ctx == NULL) 
-         goto done;
-      
-      if (stw_delete_context( ctx ) == FALSE)
-         goto done;
-      
-      stw_icd->ctx_array[dhglrc - 1].ctx = NULL;
-      ret = TRUE;
-
-   }
-done:
-   pipe_mutex_unlock( stw_icd->mutex );
-   
-   return ret;
+   return stw_delete_context( dhglrc );
 }
 
 BOOL APIENTRY
@@ -217,7 +82,8 @@ DrvDescribeLayerPlane(
    UINT nBytes,
    LPLAYERPLANEDESCRIPTOR plpd )
 {
-   debug_printf( "%s\n", __FUNCTION__ );
+   if (DBG) 
+      debug_printf( "%s\n", __FUNCTION__ );
 
    return FALSE;
 }
@@ -233,8 +99,9 @@ DrvDescribePixelFormat(
 
    r = stw_pixelformat_describe( hdc, iPixelFormat, cjpfd, ppfd );
 
-   debug_printf( "%s( %p, %d, %u, %p ) = %d\n",
-                 __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
+   if (DBG)
+      debug_printf( "%s( %p, %d, %u, %p ) = %d\n",
+                    __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
 
    return r;
 }
@@ -247,7 +114,8 @@ DrvGetLayerPaletteEntries(
    INT cEntries,
    COLORREF *pcr )
 {
-   debug_printf( "%s\n", __FUNCTION__ );
+   if (DBG)
+      debug_printf( "%s\n", __FUNCTION__ );
 
    return 0;
 }
@@ -260,7 +128,8 @@ DrvGetProcAddress(
 
    r = stw_get_proc_address( lpszProc );
 
-   debug_printf( "%s( \", __FUNCTION__%s\" ) = %p\n", lpszProc, r );
+   if (DBG)
+      debug_printf( "%s( \", __FUNCTION__%s\" ) = %p\n", lpszProc, r );
 
    return r;
 }
@@ -271,7 +140,8 @@ DrvRealizeLayerPalette(
    INT iLayerPlane,
    BOOL bRealize )
 {
-   debug_printf( "%s\n", __FUNCTION__ );
+   if (DBG)
+      debug_printf( "%s\n", __FUNCTION__ );
 
    return FALSE;
 }
@@ -280,32 +150,7 @@ BOOL APIENTRY
 DrvReleaseContext(
    DHGLRC dhglrc )
 {
-   BOOL ret = FALSE;
-
-   if (!stw_icd)
-      return ret;
-
-   pipe_mutex_lock( stw_icd->mutex );
-   {
-      struct stw_context *ctx;
-
-      /* XXX: The expectation is that ctx is the same context which is
-       * current for this thread.  We should check that and return False
-       * if not the case.
-       */
-      ctx = lookup_context( stw_icd, dhglrc );
-      if (ctx == NULL) 
-         goto done;
-
-      if (stw_make_current( NULL, NULL ) == FALSE)
-         goto done;
-
-      ret = TRUE;
-   }
-done:
-   pipe_mutex_unlock( stw_icd->mutex );
-
-   return ret;
+   return stw_release_context(dhglrc);
 }
 
 void APIENTRY
@@ -313,7 +158,8 @@ DrvSetCallbackProcs(
    INT nProcs,
    PROC *pProcs )
 {
-   debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs );
+   if (DBG)
+      debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs );
 
    return;
 }
@@ -671,38 +517,21 @@ DrvSetContext(
    DHGLRC dhglrc,
    PFN_SETPROCTABLE pfnSetProcTable )
 {
-   PGLCLTPROCTABLE result = NULL;
-
-   if (!stw_icd)
-      return result;
-
-   pipe_mutex_lock( stw_icd->mutex ); 
-   {
-      struct stw_context *ctx;
-
+   if (DBG)
       debug_printf( "%s( 0x%p, %u, 0x%p )\n", 
                     __FUNCTION__, hdc, dhglrc, pfnSetProcTable );
 
-      /* Although WGL allows different dispatch entrypoints per 
-       */
-      if (!stw_icd->cpt_initialized) {
-         init_proc_table( &stw_icd->cpt );
-         stw_icd->cpt_initialized = TRUE;
-      }
-
-      ctx = lookup_context( stw_icd, dhglrc );
-      if (ctx == NULL)
-         goto done;
-
-      if (!stw_make_current( hdc, ctx ))
-         goto done;
-
-      result = &stw_icd->cpt;
+   /* Although WGL allows different dispatch entrypoints per 
+    */
+   if (!cpt_initialized) {
+      init_proc_table( &cpt );
+      cpt_initialized = TRUE;
    }
-done:
-   pipe_mutex_unlock( stw_icd->mutex );
 
-   return result;
+   if (!stw_make_current( hdc, dhglrc ))
+      return NULL;
+      
+   return &cpt;
 }
 
 int APIENTRY
@@ -713,7 +542,8 @@ DrvSetLayerPaletteEntries(
    INT cEntries,
    CONST COLORREF *pcr )
 {
-   debug_printf( "%s\n", __FUNCTION__ );
+   if (DBG)
+      debug_printf( "%s\n", __FUNCTION__ );
 
    return 0;
 }
@@ -727,7 +557,8 @@ DrvSetPixelFormat(
 
    r = stw_pixelformat_set( hdc, iPixelFormat );
 
-   debug_printf( "%s( %p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" );
+   if (DBG)
+      debug_printf( "%s( %p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" );
 
    return r;
 }
@@ -737,7 +568,8 @@ DrvShareLists(
    DHGLRC dhglrc1,
    DHGLRC dhglrc2 )
 {
-   debug_printf( "%s\n", __FUNCTION__ );
+   if (DBG)
+      debug_printf( "%s\n", __FUNCTION__ );
 
    return FALSE;
 }
@@ -746,7 +578,8 @@ BOOL APIENTRY
 DrvSwapBuffers(
    HDC hdc )
 {
-   debug_printf( "%s( %p )\n", __FUNCTION__, hdc );
+   if (DBG)
+      debug_printf( "%s( %p )\n", __FUNCTION__, hdc );
 
    return stw_swap_buffers( hdc );
 }
@@ -756,7 +589,8 @@ DrvSwapLayerBuffers(
    HDC hdc,
    UINT fuPlanes )
 {
-   debug_printf( "%s\n", __FUNCTION__ );
+   if (DBG)
+      debug_printf( "%s\n", __FUNCTION__ );
 
    return FALSE;
 }
@@ -765,7 +599,8 @@ BOOL APIENTRY
 DrvValidateVersion(
    ULONG ulVersion )
 {
-   debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion );
+   if (DBG)
+      debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion );
 
    /* TODO: get the expected version from the winsys */
    
diff --git a/src/gallium/state_trackers/wgl/opengl32.mingw.def b/src/gallium/state_trackers/wgl/opengl32.mingw.def
new file mode 100644 (file)
index 0000000..1f03ea3
--- /dev/null
@@ -0,0 +1,387 @@
+EXPORTS
+;      GlmfBeginGlsBlock = GlmfBeginGlsBlock@4
+;      GlmfCloseMetaFile = GlmfCloseMetaFile@4
+;      GlmfEndGlsBlock = GlmfEndGlsBlock@4
+;      GlmfEndPlayback = GlmfEndPlayback@4
+;      GlmfInitPlayback = GlmfInitPlayback@12
+;      GlmfPlayGlsRecord = GlmfPlayGlsRecord@16
+       glAccum = glAccum@8
+       glAlphaFunc = glAlphaFunc@8
+       glAreTexturesResident = glAreTexturesResident@12
+       glArrayElement = glArrayElement@4
+       glBegin = glBegin@4
+       glBindTexture = glBindTexture@8
+       glBitmap = glBitmap@28
+       glBlendFunc = glBlendFunc@8
+       glCallList = glCallList@4
+       glCallLists = glCallLists@12
+       glClear = glClear@4
+       glClearAccum = glClearAccum@16
+       glClearColor = glClearColor@16
+       glClearDepth = glClearDepth@8
+       glClearIndex = glClearIndex@4
+       glClearStencil = glClearStencil@4
+       glClipPlane = glClipPlane@8
+       glColor3b = glColor3b@12
+       glColor3bv = glColor3bv@4
+       glColor3d = glColor3d@24
+       glColor3dv = glColor3dv@4
+       glColor3f = glColor3f@12
+       glColor3fv = glColor3fv@4
+       glColor3i = glColor3i@12
+       glColor3iv = glColor3iv@4
+       glColor3s = glColor3s@12
+       glColor3sv = glColor3sv@4
+       glColor3ub = glColor3ub@12
+       glColor3ubv = glColor3ubv@4
+       glColor3ui = glColor3ui@12
+       glColor3uiv = glColor3uiv@4
+       glColor3us = glColor3us@12
+       glColor3usv = glColor3usv@4
+       glColor4b = glColor4b@16
+       glColor4bv = glColor4bv@4
+       glColor4d = glColor4d@32
+       glColor4dv = glColor4dv@4
+       glColor4f = glColor4f@16
+       glColor4fv = glColor4fv@4
+       glColor4i = glColor4i@16
+       glColor4iv = glColor4iv@4
+       glColor4s = glColor4s@16
+       glColor4sv = glColor4sv@4
+       glColor4ub = glColor4ub@16
+       glColor4ubv = glColor4ubv@4
+       glColor4ui = glColor4ui@16
+       glColor4uiv = glColor4uiv@4
+       glColor4us = glColor4us@16
+       glColor4usv = glColor4usv@4
+       glColorMask = glColorMask@16
+       glColorMaterial = glColorMaterial@8
+       glColorPointer = glColorPointer@16
+       glCopyPixels = glCopyPixels@20
+       glCopyTexImage1D = glCopyTexImage1D@28
+       glCopyTexImage2D = glCopyTexImage2D@32
+       glCopyTexSubImage1D = glCopyTexSubImage1D@24
+       glCopyTexSubImage2D = glCopyTexSubImage2D@32
+       glCullFace = glCullFace@4
+;      glDebugEntry = glDebugEntry@8
+       glDeleteLists = glDeleteLists@8
+       glDeleteTextures = glDeleteTextures@8
+       glDepthFunc = glDepthFunc@4
+       glDepthMask = glDepthMask@4
+       glDepthRange = glDepthRange@16
+       glDisable = glDisable@4
+       glDisableClientState = glDisableClientState@4
+       glDrawArrays = glDrawArrays@12
+       glDrawBuffer = glDrawBuffer@4
+       glDrawElements = glDrawElements@16
+       glDrawPixels = glDrawPixels@20
+       glEdgeFlag = glEdgeFlag@4
+       glEdgeFlagPointer = glEdgeFlagPointer@8
+       glEdgeFlagv = glEdgeFlagv@4
+       glEnable = glEnable@4
+       glEnableClientState = glEnableClientState@4
+       glEnd = glEnd@0
+       glEndList = glEndList@0
+       glEvalCoord1d = glEvalCoord1d@8
+       glEvalCoord1dv = glEvalCoord1dv@4
+       glEvalCoord1f = glEvalCoord1f@4
+       glEvalCoord1fv = glEvalCoord1fv@4
+       glEvalCoord2d = glEvalCoord2d@16
+       glEvalCoord2dv = glEvalCoord2dv@4
+       glEvalCoord2f = glEvalCoord2f@8
+       glEvalCoord2fv = glEvalCoord2fv@4
+       glEvalMesh1 = glEvalMesh1@12
+       glEvalMesh2 = glEvalMesh2@20
+       glEvalPoint1 = glEvalPoint1@4
+       glEvalPoint2 = glEvalPoint2@8
+       glFeedbackBuffer = glFeedbackBuffer@12
+       glFinish = glFinish@0
+       glFlush = glFlush@0
+       glFogf = glFogf@8
+       glFogfv = glFogfv@8
+       glFogi = glFogi@8
+       glFogiv = glFogiv@8
+       glFrontFace = glFrontFace@4
+       glFrustum = glFrustum@48
+       glGenLists = glGenLists@4
+       glGenTextures = glGenTextures@8
+       glGetBooleanv = glGetBooleanv@8
+       glGetClipPlane = glGetClipPlane@8
+       glGetDoublev = glGetDoublev@8
+       glGetError = glGetError@0
+       glGetFloatv = glGetFloatv@8
+       glGetIntegerv = glGetIntegerv@8
+       glGetLightfv = glGetLightfv@12
+       glGetLightiv = glGetLightiv@12
+       glGetMapdv = glGetMapdv@12
+       glGetMapfv = glGetMapfv@12
+       glGetMapiv = glGetMapiv@12
+       glGetMaterialfv = glGetMaterialfv@12
+       glGetMaterialiv = glGetMaterialiv@12
+       glGetPixelMapfv = glGetPixelMapfv@8
+       glGetPixelMapuiv = glGetPixelMapuiv@8
+       glGetPixelMapusv = glGetPixelMapusv@8
+       glGetPointerv = glGetPointerv@8
+       glGetPolygonStipple = glGetPolygonStipple@4
+       glGetString = glGetString@4
+       glGetTexEnvfv = glGetTexEnvfv@12
+       glGetTexEnviv = glGetTexEnviv@12
+       glGetTexGendv = glGetTexGendv@12
+       glGetTexGenfv = glGetTexGenfv@12
+       glGetTexGeniv = glGetTexGeniv@12
+       glGetTexImage = glGetTexImage@20
+       glGetTexLevelParameterfv = glGetTexLevelParameterfv@16
+       glGetTexLevelParameteriv = glGetTexLevelParameteriv@16
+       glGetTexParameterfv = glGetTexParameterfv@12
+       glGetTexParameteriv = glGetTexParameteriv@12
+       glHint = glHint@8
+       glIndexMask = glIndexMask@4
+       glIndexPointer = glIndexPointer@12
+       glIndexd = glIndexd@8
+       glIndexdv = glIndexdv@4
+       glIndexf = glIndexf@4
+       glIndexfv = glIndexfv@4
+       glIndexi = glIndexi@4
+       glIndexiv = glIndexiv@4
+       glIndexs = glIndexs@4
+       glIndexsv = glIndexsv@4
+       glIndexub = glIndexub@4
+       glIndexubv = glIndexubv@4
+       glInitNames = glInitNames@0
+       glInterleavedArrays = glInterleavedArrays@12
+       glIsEnabled = glIsEnabled@4
+       glIsList = glIsList@4
+       glIsTexture = glIsTexture@4
+       glLightModelf = glLightModelf@8
+       glLightModelfv = glLightModelfv@8
+       glLightModeli = glLightModeli@8
+       glLightModeliv = glLightModeliv@8
+       glLightf = glLightf@12
+       glLightfv = glLightfv@12
+       glLighti = glLighti@12
+       glLightiv = glLightiv@12
+       glLineStipple = glLineStipple@8
+       glLineWidth = glLineWidth@4
+       glListBase = glListBase@4
+       glLoadIdentity = glLoadIdentity@0
+       glLoadMatrixd = glLoadMatrixd@4
+       glLoadMatrixf = glLoadMatrixf@4
+       glLoadName = glLoadName@4
+       glLogicOp = glLogicOp@4
+       glMap1d = glMap1d@32
+       glMap1f = glMap1f@24
+       glMap2d = glMap2d@56
+       glMap2f = glMap2f@40
+       glMapGrid1d = glMapGrid1d@20
+       glMapGrid1f = glMapGrid1f@12
+       glMapGrid2d = glMapGrid2d@40
+       glMapGrid2f = glMapGrid2f@24
+       glMaterialf = glMaterialf@12
+       glMaterialfv = glMaterialfv@12
+       glMateriali = glMateriali@12
+       glMaterialiv = glMaterialiv@12
+       glMatrixMode = glMatrixMode@4
+       glMultMatrixd = glMultMatrixd@4
+       glMultMatrixf = glMultMatrixf@4
+       glNewList = glNewList@8
+       glNormal3b = glNormal3b@12
+       glNormal3bv = glNormal3bv@4
+       glNormal3d = glNormal3d@24
+       glNormal3dv = glNormal3dv@4
+       glNormal3f = glNormal3f@12
+       glNormal3fv = glNormal3fv@4
+       glNormal3i = glNormal3i@12
+       glNormal3iv = glNormal3iv@4
+       glNormal3s = glNormal3s@12
+       glNormal3sv = glNormal3sv@4
+       glNormalPointer = glNormalPointer@12
+       glOrtho = glOrtho@48
+       glPassThrough = glPassThrough@4
+       glPixelMapfv = glPixelMapfv@12
+       glPixelMapuiv = glPixelMapuiv@12
+       glPixelMapusv = glPixelMapusv@12
+       glPixelStoref = glPixelStoref@8
+       glPixelStorei = glPixelStorei@8
+       glPixelTransferf = glPixelTransferf@8
+       glPixelTransferi = glPixelTransferi@8
+       glPixelZoom = glPixelZoom@8
+       glPointSize = glPointSize@4
+       glPolygonMode = glPolygonMode@8
+       glPolygonOffset = glPolygonOffset@8
+       glPolygonStipple = glPolygonStipple@4
+       glPopAttrib = glPopAttrib@0
+       glPopClientAttrib = glPopClientAttrib@0
+       glPopMatrix = glPopMatrix@0
+       glPopName = glPopName@0
+       glPrioritizeTextures = glPrioritizeTextures@12
+       glPushAttrib = glPushAttrib@4
+       glPushClientAttrib = glPushClientAttrib@4
+       glPushMatrix = glPushMatrix@0
+       glPushName = glPushName@4
+       glRasterPos2d = glRasterPos2d@16
+       glRasterPos2dv = glRasterPos2dv@4
+       glRasterPos2f = glRasterPos2f@8
+       glRasterPos2fv = glRasterPos2fv@4
+       glRasterPos2i = glRasterPos2i@8
+       glRasterPos2iv = glRasterPos2iv@4
+       glRasterPos2s = glRasterPos2s@8
+       glRasterPos2sv = glRasterPos2sv@4
+       glRasterPos3d = glRasterPos3d@24
+       glRasterPos3dv = glRasterPos3dv@4
+       glRasterPos3f = glRasterPos3f@12
+       glRasterPos3fv = glRasterPos3fv@4
+       glRasterPos3i = glRasterPos3i@12
+       glRasterPos3iv = glRasterPos3iv@4
+       glRasterPos3s = glRasterPos3s@12
+       glRasterPos3sv = glRasterPos3sv@4
+       glRasterPos4d = glRasterPos4d@32
+       glRasterPos4dv = glRasterPos4dv@4
+       glRasterPos4f = glRasterPos4f@16
+       glRasterPos4fv = glRasterPos4fv@4
+       glRasterPos4i = glRasterPos4i@16
+       glRasterPos4iv = glRasterPos4iv@4
+       glRasterPos4s = glRasterPos4s@16
+       glRasterPos4sv = glRasterPos4sv@4
+       glReadBuffer = glReadBuffer@4
+       glReadPixels = glReadPixels@28
+       glRectd = glRectd@32
+       glRectdv = glRectdv@8
+       glRectf = glRectf@16
+       glRectfv = glRectfv@8
+       glRecti = glRecti@16
+       glRectiv = glRectiv@8
+       glRects = glRects@16
+       glRectsv = glRectsv@8
+       glRenderMode = glRenderMode@4
+       glRotated = glRotated@32
+       glRotatef = glRotatef@16
+       glScaled = glScaled@24
+       glScalef = glScalef@12
+       glScissor = glScissor@16
+       glSelectBuffer = glSelectBuffer@8
+       glShadeModel = glShadeModel@4
+       glStencilFunc = glStencilFunc@12
+       glStencilMask = glStencilMask@4
+       glStencilOp = glStencilOp@12
+       glTexCoord1d = glTexCoord1d@8
+       glTexCoord1dv = glTexCoord1dv@4
+       glTexCoord1f = glTexCoord1f@4
+       glTexCoord1fv = glTexCoord1fv@4
+       glTexCoord1i = glTexCoord1i@4
+       glTexCoord1iv = glTexCoord1iv@4
+       glTexCoord1s = glTexCoord1s@4
+       glTexCoord1sv = glTexCoord1sv@4
+       glTexCoord2d = glTexCoord2d@16
+       glTexCoord2dv = glTexCoord2dv@4
+       glTexCoord2f = glTexCoord2f@8
+       glTexCoord2fv = glTexCoord2fv@4
+       glTexCoord2i = glTexCoord2i@8
+       glTexCoord2iv = glTexCoord2iv@4
+       glTexCoord2s = glTexCoord2s@8
+       glTexCoord2sv = glTexCoord2sv@4
+       glTexCoord3d = glTexCoord3d@24
+       glTexCoord3dv = glTexCoord3dv@4
+       glTexCoord3f = glTexCoord3f@12
+       glTexCoord3fv = glTexCoord3fv@4
+       glTexCoord3i = glTexCoord3i@12
+       glTexCoord3iv = glTexCoord3iv@4
+       glTexCoord3s = glTexCoord3s@12
+       glTexCoord3sv = glTexCoord3sv@4
+       glTexCoord4d = glTexCoord4d@32
+       glTexCoord4dv = glTexCoord4dv@4
+       glTexCoord4f = glTexCoord4f@16
+       glTexCoord4fv = glTexCoord4fv@4
+       glTexCoord4i = glTexCoord4i@16
+       glTexCoord4iv = glTexCoord4iv@4
+       glTexCoord4s = glTexCoord4s@16
+       glTexCoord4sv = glTexCoord4sv@4
+       glTexCoordPointer = glTexCoordPointer@16
+       glTexEnvf = glTexEnvf@12
+       glTexEnvfv = glTexEnvfv@12
+       glTexEnvi = glTexEnvi@12
+       glTexEnviv = glTexEnviv@12
+       glTexGend = glTexGend@16
+       glTexGendv = glTexGendv@12
+       glTexGenf = glTexGenf@12
+       glTexGenfv = glTexGenfv@12
+       glTexGeni = glTexGeni@12
+       glTexGeniv = glTexGeniv@12
+       glTexImage1D = glTexImage1D@32
+       glTexImage2D = glTexImage2D@36
+       glTexParameterf = glTexParameterf@12
+       glTexParameterfv = glTexParameterfv@12
+       glTexParameteri = glTexParameteri@12
+       glTexParameteriv = glTexParameteriv@12
+       glTexSubImage1D = glTexSubImage1D@28
+       glTexSubImage2D = glTexSubImage2D@36
+       glTranslated = glTranslated@24
+       glTranslatef = glTranslatef@12
+       glVertex2d = glVertex2d@16
+       glVertex2dv = glVertex2dv@4
+       glVertex2f = glVertex2f@8
+       glVertex2fv = glVertex2fv@4
+       glVertex2i = glVertex2i@8
+       glVertex2iv = glVertex2iv@4
+       glVertex2s = glVertex2s@8
+       glVertex2sv = glVertex2sv@4
+       glVertex3d = glVertex3d@24
+       glVertex3dv = glVertex3dv@4
+       glVertex3f = glVertex3f@12
+       glVertex3fv = glVertex3fv@4
+       glVertex3i = glVertex3i@12
+       glVertex3iv = glVertex3iv@4
+       glVertex3s = glVertex3s@12
+       glVertex3sv = glVertex3sv@4
+       glVertex4d = glVertex4d@32
+       glVertex4dv = glVertex4dv@4
+       glVertex4f = glVertex4f@16
+       glVertex4fv = glVertex4fv@4
+       glVertex4i = glVertex4i@16
+       glVertex4iv = glVertex4iv@4
+       glVertex4s = glVertex4s@16
+       glVertex4sv = glVertex4sv@4
+       glVertexPointer = glVertexPointer@16
+       glViewport = glViewport@16
+       wglChoosePixelFormat = wglChoosePixelFormat@8
+       wglCopyContext = wglCopyContext@12
+       wglCreateContext = wglCreateContext@4
+       wglCreateLayerContext = wglCreateLayerContext@8
+       wglDeleteContext = wglDeleteContext@4
+       wglDescribeLayerPlane = wglDescribeLayerPlane@20
+       wglDescribePixelFormat = wglDescribePixelFormat@16
+       wglGetCurrentContext = wglGetCurrentContext@0
+       wglGetCurrentDC = wglGetCurrentDC@0
+;      wglGetDefaultProcAddress = wglGetDefaultProcAddress@4
+       wglGetLayerPaletteEntries = wglGetLayerPaletteEntries@20
+       wglGetPixelFormat = wglGetPixelFormat@4
+       wglGetProcAddress = wglGetProcAddress@4
+       wglMakeCurrent = wglMakeCurrent@8
+       wglRealizeLayerPalette = wglRealizeLayerPalette@12
+       wglSetLayerPaletteEntries = wglSetLayerPaletteEntries@20
+       wglSetPixelFormat = wglSetPixelFormat@12
+       wglShareLists = wglShareLists@8
+       wglSwapBuffers = wglSwapBuffers@4
+       wglSwapLayerBuffers = wglSwapLayerBuffers@8
+;      wglSwapMultipleBuffers = wglSwapMultipleBuffers@8
+       wglUseFontBitmapsA = wglUseFontBitmapsA@16
+       wglUseFontBitmapsW = wglUseFontBitmapsW@16
+       wglUseFontOutlinesA = wglUseFontOutlinesA@32
+       wglUseFontOutlinesW = wglUseFontOutlinesW@32
+       DrvCopyContext = DrvCopyContext@12
+       DrvCreateContext = DrvCreateContext@4
+       DrvCreateLayerContext = DrvCreateLayerContext@8
+       DrvDeleteContext = DrvDeleteContext@4
+       DrvDescribeLayerPlane = DrvDescribeLayerPlane@20
+       DrvDescribePixelFormat = DrvDescribePixelFormat@16
+       DrvGetLayerPaletteEntries = DrvGetLayerPaletteEntries@20
+       DrvGetProcAddress = DrvGetProcAddress@4
+       DrvRealizeLayerPalette = DrvRealizeLayerPalette@12
+       DrvReleaseContext = DrvReleaseContext@4
+       DrvSetCallbackProcs = DrvSetCallbackProcs@8
+       DrvSetContext = DrvSetContext@12
+       DrvSetLayerPaletteEntries = DrvSetLayerPaletteEntries@20
+       DrvSetPixelFormat = DrvSetPixelFormat@8
+       DrvShareLists = DrvShareLists@8
+       DrvSwapBuffers = DrvSwapBuffers@4
+       DrvSwapLayerBuffers = DrvSwapLayerBuffers@8
+       DrvValidateVersion = DrvValidateVersion@4
index 2abf97b5adbc7bdefc42eea4ce92d4bdaba1fe9e..d77daac39cd63833eee8e10bc55633f80238caed 100644 (file)
 #include "stw_public.h"
 #include "stw_context.h"
 
-static struct stw_context *ctx_head = NULL;
-
 static HDC current_hdc = NULL;
-static struct stw_context *current_hrc = NULL;
+static UINT_PTR current_hglrc = 0;
 
 BOOL
 stw_copy_context(
-   struct stw_context *src,
-   struct stw_context *dst,
+   UINT_PTR hglrcSrc,
+   UINT_PTR hglrcDst,
    UINT mask )
 {
-   (void) src;
-   (void) dst;
-   (void) mask;
+   struct stw_context *src;
+   struct stw_context *dst;
+   BOOL ret = FALSE;
+
+   pipe_mutex_lock( stw_dev->mutex );
+   
+   src = stw_lookup_context( hglrcSrc );
+   dst = stw_lookup_context( hglrcDst );
+
+   if (src && dst) { 
+      /* FIXME */
+      (void) src;
+      (void) dst;
+      (void) mask;
+   }
 
-   return FALSE;
+   pipe_mutex_unlock( stw_dev->mutex );
+   
+   return ret;
 }
 
-struct stw_context *
-stw_create_context(
+UINT_PTR
+stw_create_layer_context(
    HDC hdc,
    int iLayerPlane )
 {
@@ -68,19 +80,23 @@ stw_create_context(
    struct stw_context *ctx = NULL;
    GLvisual *visual = NULL;
    struct pipe_context *pipe = NULL;
+   UINT_PTR hglrc = 0;
 
+   if(!stw_dev)
+      return 0;
+   
    if (iLayerPlane != 0)
-      return NULL;
+      return 0;
 
    pfi = stw_pixelformat_get( hdc );
    if (pfi == 0)
-      return NULL;
+      return 0;
 
    pf = pixelformat_get_info( pfi - 1 );
 
    ctx = CALLOC_STRUCT( stw_context );
    if (ctx == NULL)
-      return NULL;
+      return 0;
 
    ctx->hdc = hdc;
    ctx->color_bits = GetDeviceCaps( ctx->hdc, BITSPIXEL );
@@ -119,10 +135,26 @@ stw_create_context(
 
    ctx->st->ctx->DriverCtx = ctx;
 
-   ctx->next = ctx_head;
-   ctx_head = ctx;
+   pipe_mutex_lock( stw_dev->mutex );
+   {
+      UINT_PTR i;
+
+      for (i = 0; i < STW_CONTEXT_MAX; i++) {
+         if (stw_dev->ctx_array[i].ctx == NULL) {
+            /* success:
+             */
+            stw_dev->ctx_array[i].ctx = ctx;
+            hglrc = i + 1;
+            break;
+         }
+      }
+   }
+   pipe_mutex_unlock( stw_dev->mutex );
 
-   return ctx;
+   /* Success?
+    */
+   if (hglrc != 0)
+      return hglrc;
 
 fail:
    if (visual)
@@ -132,47 +164,83 @@ fail:
       pipe->destroy( pipe );
       
    FREE( ctx );
-   return NULL;
+   return 0;
 }
 
-
 BOOL
 stw_delete_context(
-   struct stw_context *hglrc )
+   UINT_PTR hglrc )
 {
-   struct stw_context **link = &ctx_head;
-   struct stw_context *ctx = ctx_head;
+   struct stw_context *ctx ;
+   BOOL ret = FALSE;
+   
+   if (!stw_dev)
+      return FALSE;
 
-   while (ctx != NULL) {
-      if (ctx == hglrc) {
-         GLcontext *glctx = ctx->st->ctx;
-         GET_CURRENT_CONTEXT( glcurctx );
-         struct stw_framebuffer *fb;
+   pipe_mutex_lock( stw_dev->mutex );
 
-         /* Unbind current if deleting current context.
-          */
-         if (glcurctx == glctx)
-            st_make_current( NULL, NULL, NULL );
+   ctx = stw_lookup_context(hglrc);
+   if (ctx) {
+      GLcontext *glctx = ctx->st->ctx;
+      GET_CURRENT_CONTEXT( glcurctx );
+      struct stw_framebuffer *fb;
 
-         fb = framebuffer_from_hdc( ctx->hdc );
-         if (fb)
-            framebuffer_destroy( fb );
+      /* Unbind current if deleting current context.
+       */
+      if (glcurctx == glctx)
+         st_make_current( NULL, NULL, NULL );
 
-         if (WindowFromDC( ctx->hdc ) != NULL)
-            ReleaseDC( WindowFromDC( ctx->hdc ), ctx->hdc );
+      fb = framebuffer_from_hdc( ctx->hdc );
+      if (fb)
+         framebuffer_destroy( fb );
 
-         st_destroy_context( ctx->st );
+      if (WindowFromDC( ctx->hdc ) != NULL)
+         ReleaseDC( WindowFromDC( ctx->hdc ), ctx->hdc );
 
-         *link = ctx->next;
-         FREE( ctx );
-         return TRUE;
-      }
+      st_destroy_context( ctx->st );
 
-      link = &ctx->next;
-      ctx = ctx->next;
+      FREE( ctx );
+      
+      stw_dev->ctx_array[hglrc - 1].ctx = NULL;
+      
+      ret = TRUE;
    }
 
-   return FALSE;
+   pipe_mutex_unlock( stw_dev->mutex );
+   
+   return ret;
+}
+
+BOOL
+stw_release_context(
+   UINT_PTR hglrc )
+{
+   BOOL ret = FALSE;
+
+   if (!stw_dev)
+      return ret;
+
+   pipe_mutex_lock( stw_dev->mutex );
+   {
+      struct stw_context *ctx;
+
+      /* XXX: The expectation is that ctx is the same context which is
+       * current for this thread.  We should check that and return False
+       * if not the case.
+       */
+      ctx = stw_lookup_context( hglrc );
+      if (ctx == NULL) 
+         goto done;
+
+      if (stw_make_current( NULL, 0 ) == FALSE)
+         goto done;
+
+      ret = TRUE;
+   }
+done:
+   pipe_mutex_unlock( stw_dev->mutex );
+
+   return ret;
 }
 
 /* Find the width and height of the window named by hdc.
@@ -193,10 +261,10 @@ get_window_size( HDC hdc, GLuint *width, GLuint *height )
    }
 }
 
-struct stw_context *
+UINT_PTR
 stw_get_current_context( void )
 {
-   return current_hrc;
+   return current_hglrc;
 }
 
 HDC
@@ -208,35 +276,43 @@ stw_get_current_dc( void )
 BOOL
 stw_make_current(
    HDC hdc,
-   struct stw_context *hglrc )
+   UINT_PTR hglrc )
 {
-   struct stw_context *ctx = ctx_head;
+   struct stw_context *ctx;
    GET_CURRENT_CONTEXT( glcurctx );
    struct stw_framebuffer *fb;
    GLuint width = 0;
    GLuint height = 0;
+   struct stw_context *curctx;
+
+   if (!stw_dev)
+      return FALSE;
+
+   pipe_mutex_lock( stw_dev->mutex ); 
+   ctx = stw_lookup_context( hglrc );
+   pipe_mutex_unlock( stw_dev->mutex );
+   
+   if (ctx == NULL)
+      return FALSE;
 
    current_hdc = hdc;
-   current_hrc = hglrc;
+   current_hglrc = hglrc;
 
-   if (hdc == NULL || hglrc == NULL) {
-      st_make_current( NULL, NULL, NULL );
-      return TRUE;
+   if (glcurctx != NULL) {
+      curctx = (struct stw_context *) glcurctx->DriverCtx;
+
+      if (curctx != ctx)
+        st_flush(glcurctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
    }
 
-   while (ctx != NULL) {
-      if (ctx == hglrc)
-         break;
-      ctx = ctx->next;
+   if (hdc == NULL || hglrc == 0) {
+      st_make_current( NULL, NULL, NULL );
+      return TRUE;
    }
-   if (ctx == NULL)
-      return FALSE;
 
    /* Return if already current.
     */
    if (glcurctx != NULL) {
-      struct stw_context *curctx = (struct stw_context *) glcurctx->DriverCtx;
-
       if (curctx != NULL && curctx == ctx && ctx->hdc == hdc)
          return TRUE;
    }
@@ -273,20 +349,3 @@ stw_make_current(
 
    return TRUE;
 }
-
-struct stw_context *
-stw_context_from_hdc(
-   HDC hdc )
-{
-   struct stw_context *ctx = ctx_head;
-
-   while (ctx != NULL) {
-      if (ctx->hdc == hdc)
-         return ctx;
-      ctx = ctx->next;
-   }
-   return NULL;
-}
-
-
-
index 89a8f900d81b73c5a4527b18eb5d97db6a2ee2ec..b28961527244de9994f17f7c7b7d3280452529bc 100644 (file)
@@ -37,17 +37,6 @@ struct stw_context
    struct st_context *st;
    HDC hdc;
    DWORD color_bits;
-   struct stw_context *next;
 };
 
-struct stw_context *
-stw_context_from_hdc(HDC hdc );
-
-
-
-
-
-
-
-
 #endif /* STW_CONTEXT_H */
index 6873e813ee3dfdc090d4f99bd0a43306f63b8d0e..0dca856d73bd65223f478c11a25a873e9d36f878 100644 (file)
 
 #include <windows.h>
 
-#include "pipe/p_debug.h"
+#include "glapi/glthread.h"
+#include "util/u_debug.h"
 #include "pipe/p_screen.h"
 
 #include "shared/stw_device.h"
 #include "shared/stw_winsys.h"
 #include "shared/stw_pixelformat.h"
 #include "shared/stw_public.h"
-#include "stw.h"
+
+#ifdef WIN32_THREADS
+extern _glthread_Mutex OneTimeLock;
+extern void FreeAllTSD(void);
+#endif
 
 
 struct stw_device *stw_dev = NULL;
@@ -57,23 +62,35 @@ st_flush_frontbuffer(struct pipe_screen *screen,
 
 
 boolean
-stw_shared_init(const struct stw_winsys *stw_winsys)
+st_init(const struct stw_winsys *stw_winsys)
 {
    static struct stw_device stw_dev_storage;
 
+   debug_printf("%s\n", __FUNCTION__);
+   
    assert(!stw_dev);
 
    stw_dev = &stw_dev_storage;
    memset(stw_dev, 0, sizeof(*stw_dev));
 
+#ifdef DEBUG
+   stw_dev->memdbg_no = debug_memory_begin();
+#endif
+   
    stw_dev->stw_winsys = stw_winsys;
 
+#ifdef WIN32_THREADS
+   _glthread_INIT_MUTEX(OneTimeLock);
+#endif
+
    stw_dev->screen = stw_winsys->create_screen();
    if(!stw_dev->screen)
       goto error1;
 
    stw_dev->screen->flush_frontbuffer = st_flush_frontbuffer;
    
+   pipe_mutex_init( stw_dev->mutex );
+
    pixelformat_init();
 
    return TRUE;
@@ -85,7 +102,51 @@ error1:
 
 
 void
-stw_shared_cleanup(void)
+st_cleanup(void)
 {
+   UINT_PTR i;
+
+   debug_printf("%s\n", __FUNCTION__);
+
+   if (!stw_dev)
+      return;
+   
+   pipe_mutex_lock( stw_dev->mutex );
+   {
+      /* Ensure all contexts are destroyed */
+      for (i = 0; i < STW_CONTEXT_MAX; i++)
+         if (stw_dev->ctx_array[i].ctx) 
+            stw_delete_context( i + 1 );
+   }
+   pipe_mutex_unlock( stw_dev->mutex );
+
+   pipe_mutex_destroy( stw_dev->mutex );
+   
+   stw_dev->screen->destroy(stw_dev->screen);
+
+#ifdef WIN32_THREADS
+   _glthread_DESTROY_MUTEX(OneTimeLock);
+   FreeAllTSD();
+#endif
+
+#ifdef DEBUG
+   debug_memory_end(stw_dev->memdbg_no);
+#endif
+
    stw_dev = NULL;
 }
+
+
+struct stw_context *
+stw_lookup_context( UINT_PTR dhglrc )
+{
+   if (dhglrc == 0 || 
+       dhglrc >= STW_CONTEXT_MAX)
+      return NULL;
+
+   if (stw_dev == NULL)
+      return NULL;
+
+   return stw_dev->ctx_array[dhglrc - 1].ctx;
+}
+
index bc0bce37c6e3a2a9022997a372dc195437021727..80da14b84f4c48c1eb244fb4380edea92eb7b20f 100644 (file)
  *
  **************************************************************************/
 
-#ifndef ST_DEVICE_H_
-#define ST_DEVICE_H_
+#ifndef STW_DEVICE_H_
+#define STW_DEVICE_H_
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_thread.h"
+
+
+#define STW_CONTEXT_MAX 32
 
 
 struct pipe_screen;
@@ -35,10 +42,22 @@ struct stw_device
 {
    const struct stw_winsys *stw_winsys;
    struct pipe_screen *screen;
+   
+   pipe_mutex mutex;
+
+   struct {
+      struct stw_context *ctx;
+   } ctx_array[STW_CONTEXT_MAX];
+   
+#ifdef DEBUG
+   unsigned long memdbg_no;
+#endif
 };
 
+struct stw_context *
+stw_lookup_context( UINT_PTR hglrc );
 
 extern struct stw_device *stw_dev;
 
 
-#endif /* ST_DEVICE_H_ */
+#endif /* STW_DEVICE_H_ */
index c70b31a48811e108c384e796f54b13607c1b7d75..17c96c411f709df4f09d6c3f6ee0ae8a233c85d5 100644 (file)
@@ -79,6 +79,14 @@ window_proc(
    return CallWindowProc( fb->WndProc, hWnd, uMsg, wParam, lParam );
 }
 
+static INLINE boolean
+stw_is_supported_depth_stencil(enum pipe_format format)
+{
+   struct pipe_screen *screen = stw_dev->screen;
+   return screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 
+                                      PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
+}
+
 /* Create a new framebuffer object which will correspond to the given HDC.
  */
 struct stw_framebuffer *
@@ -101,18 +109,43 @@ framebuffer_create(
 
    if (visual->depthBits == 0)
       depthFormat = PIPE_FORMAT_NONE;
-   else if (visual->depthBits <= 16)
+   else if (visual->depthBits <= 16 &&
+            stw_is_supported_depth_stencil(PIPE_FORMAT_Z16_UNORM))
       depthFormat = PIPE_FORMAT_Z16_UNORM;
-   else if (visual->depthBits <= 24)
+   else if (visual->depthBits <= 24 && visual->stencilBits != 8 &&
+            stw_is_supported_depth_stencil(PIPE_FORMAT_X8Z24_UNORM)) {
+      depthFormat = PIPE_FORMAT_X8Z24_UNORM;
+   }
+   else if (visual->depthBits <= 24 && visual->stencilBits != 8 && 
+            stw_is_supported_depth_stencil(PIPE_FORMAT_Z24X8_UNORM)) {
+      depthFormat = PIPE_FORMAT_Z24X8_UNORM;
+   }
+   else if (visual->depthBits <= 24 && visual->stencilBits == 8 && 
+            stw_is_supported_depth_stencil(PIPE_FORMAT_S8Z24_UNORM)) {
       depthFormat = PIPE_FORMAT_S8Z24_UNORM;
-   else
+   }
+   else if (visual->depthBits <= 24 && visual->stencilBits == 8 && 
+            stw_is_supported_depth_stencil(PIPE_FORMAT_Z24S8_UNORM)) {
+      depthFormat = PIPE_FORMAT_Z24S8_UNORM;
+   }
+   else if(stw_is_supported_depth_stencil(PIPE_FORMAT_Z32_UNORM)) {
       depthFormat = PIPE_FORMAT_Z32_UNORM;
+   }
+   else if(stw_is_supported_depth_stencil(PIPE_FORMAT_Z32_FLOAT)) {
+      depthFormat = PIPE_FORMAT_Z32_FLOAT;
+   }
+   else {
+      assert(0);
+      depthFormat = PIPE_FORMAT_NONE;
+   }
 
-   if (visual->stencilBits == 8) {
-      if (depthFormat == PIPE_FORMAT_S8Z24_UNORM)
-         stencilFormat = depthFormat;
-      else
-         stencilFormat = PIPE_FORMAT_S8_UNORM;
+   if (depthFormat == PIPE_FORMAT_S8Z24_UNORM || 
+       depthFormat == PIPE_FORMAT_Z24S8_UNORM) {
+      stencilFormat = depthFormat;
+   }
+   else if (visual->stencilBits == 8 && 
+            stw_is_supported_depth_stencil(PIPE_FORMAT_S8_UNORM)) {
+      stencilFormat = PIPE_FORMAT_S8_UNORM;
    }
    else {
       stencilFormat = PIPE_FORMAT_NONE;
index 84b7b287b91499f7f6ffbe941691f2226791e554..2992a1ac0a1e3322764380ddec6460b39f41482a 100644 (file)
@@ -25,7 +25,7 @@
  * 
  **************************************************************************/
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "stw_pixelformat.h"
 #include "stw_public.h"
 
@@ -74,6 +74,18 @@ add_standard_pixelformats(
    pf->depth = depth24s8;
    pf++;
 
+   pf->flags = flags;
+   pf->color = color24;
+   pf->alpha = alpha8;
+   pf->depth = depth16;
+   pf++;
+
+   pf->flags = flags;
+   pf->color = color24;
+   pf->alpha = alpha8;
+   pf->depth = depth24s8;
+   pf++;
+
    pf->flags = flags;
    pf->color = color24;
    pf->alpha = noalpha;
index 75b504a50f6a5e43e95b64f846f65af5f774db3e..39d377c16b552305e7534dd315a1ee01f69cc595 100644 (file)
 #define STW_PUBLIC_H
 
 #include <windows.h>
-#include "pipe/p_compiler.h"
 
-struct stw_winsys;
-struct stw_context;
-
-boolean
-st_shared_init(const struct stw_winsys *stw_winsys);
-
-void
-st_shared_cleanup(void);
-
-
-BOOL stw_copy_context( struct stw_context *src,
-                       struct stw_context *dst,
+BOOL stw_copy_context( UINT_PTR hglrcSrc,
+                       UINT_PTR hglrcDst,
                        UINT mask );
 
-struct stw_context *stw_create_context( HDC hdc, int iLayerPlane );
+UINT_PTR stw_create_layer_context( HDC hdc, 
+                                   int iLayerPlane );
+
+BOOL stw_delete_context( UINT_PTR hglrc );
 
-BOOL stw_delete_context( struct stw_context *ctx );
+BOOL
+stw_release_context( UINT_PTR dhglrc );
 
-struct stw_context *stw_get_current_context( void );
+UINT_PTR stw_get_current_context( void );
 
 HDC stw_get_current_dc( void );
 
-BOOL stw_make_current( HDC hdc, struct stw_context *ctx );
+BOOL stw_make_current( HDC hdc, UINT_PTR hglrc );
 
 BOOL stw_swap_buffers( HDC hdc );
 
index 0961ce3bb0e28881649939012f2bcc2818a1cc5c..2f7091a52c0614912b07ffb702ad5ee19c0ad05c 100644 (file)
@@ -111,3 +111,6 @@ void gl_dispatch_stub_770(void){}
 void gl_dispatch_stub_771(void){}
 void gl_dispatch_stub_772(void){}
 void gl_dispatch_stub_773(void){}
+void gl_dispatch_stub_774(void){}
+void gl_dispatch_stub_750(void){}
+void gl_dispatch_stub_742(void){}
diff --git a/src/gallium/state_trackers/wgl/stw.c b/src/gallium/state_trackers/wgl/stw.c
deleted file mode 100644 (file)
index 8bccdad..0000000
+++ /dev/null
@@ -1,57 +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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "stw.h"
-#include "shared/stw_winsys.h"
-
-boolean
-st_init(const struct stw_winsys *stw_winsys)
-{
-   if (!stw_shared_init( stw_winsys ))
-      goto fail;
-
-   if (!stw_icd_init())
-      goto fail;
-
-   if (!stw_wgl_init())
-      goto fail;
-
-   return TRUE;
-
-fail:
-   st_cleanup();
-   return FALSE;
-}
-
-
-void
-st_cleanup(void)
-{
-   stw_icd_cleanup();
-   stw_shared_cleanup();
-   stw_wgl_cleanup();
-}
diff --git a/src/gallium/state_trackers/wgl/stw.h b/src/gallium/state_trackers/wgl/stw.h
deleted file mode 100644 (file)
index 450af4c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef STW_H
-#define STW_H
-
-#include "pipe/p_compiler.h"
-
-struct stw_winsys;
-
-/* Public interface:
- */
-boolean stw_init( const struct stw_winsys *stw_winsys );
-void stw_cleanup( void );
-
-
-
-/* Internal functions
- */
-boolean stw_shared_init( const struct stw_winsys *stw_winsys );
-boolean stw_icd_init( void ); 
-boolean stw_wgl_init( void );
-
-void stw_shared_cleanup( void );
-void stw_icd_cleanup( void ); 
-void stw_wgl_cleanup( void );
-
-
-#endif /* STW_H */
index f50b79b4e119c862bae3620ad54635fabeeb7afa..e06d2640b47814d09e48776713b5ef591e6cf661 100644 (file)
 
 #include <windows.h>
 
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "shared/stw_public.h"
 #include "stw_wgl.h"
-#include "stw.h"
-
-boolean stw_wgl_init( void )
-{
-   debug_printf("%s\n", __FUNCTION__);
-   return TRUE;
-}
-
-void stw_wgl_cleanup( void )
-{
-}
-
-static INLINE struct stw_context *stw_context( HGLRC hglrc )
-{
-   return (struct stw_context *)hglrc;
-}
 
 
 WINGDIAPI BOOL APIENTRY
@@ -54,8 +38,8 @@ wglCopyContext(
    HGLRC hglrcDst,
    UINT mask )
 {
-   return stw_copy_context( stw_context(hglrcSrc)
-                            stw_context(hglrcDst)
+   return stw_copy_context( (UINT_PTR)hglrcSrc
+                            (UINT_PTR)hglrcDst
                             mask );
 }
 
@@ -63,7 +47,7 @@ WINGDIAPI HGLRC APIENTRY
 wglCreateContext(
    HDC hdc )
 {
-   return (HGLRC) stw_create_context( hdc, 0 );
+   return wglCreateLayerContext(hdc, 0);
 }
 
 WINGDIAPI HGLRC APIENTRY
@@ -71,21 +55,21 @@ wglCreateLayerContext(
    HDC hdc,
    int iLayerPlane )
 {
-   return (HGLRC) stw_create_context( hdc, iLayerPlane );
+   return (HGLRC) stw_create_layer_context( hdc, iLayerPlane );
 }
 
 WINGDIAPI BOOL APIENTRY
 wglDeleteContext(
    HGLRC hglrc )
 {
-   return stw_delete_context( stw_context(hglrc) );
+   return stw_delete_context( (UINT_PTR)hglrc );
 }
 
 
 WINGDIAPI HGLRC APIENTRY
 wglGetCurrentContext( VOID )
 {
-   return (HGLRC) stw_get_current_context();
+   return (HGLRC)stw_get_current_context();
 }
 
 WINGDIAPI HDC APIENTRY
@@ -99,7 +83,7 @@ wglMakeCurrent(
    HDC hdc,
    HGLRC hglrc )
 {
-   return stw_make_current( hdc, stw_context(hglrc) );
+   return stw_make_current( hdc, (UINT_PTR)hglrc );
 }
 
 
index b86cc240f284478c9c1de1b26a4232348a8d5306..a98179944aa297b931eb566091468efa1e3d39a0 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <windows.h>
 
-#include "GL/gl.h"
+#include <GL/gl.h>
 
 
 /*
diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile
new file mode 100644 (file)
index 0000000..a00ea3e
--- /dev/null
@@ -0,0 +1,29 @@
+TARGET     = libxorgtracker.a
+CFILES     = $(wildcard ./*.c)
+OBJECTS    = $(patsubst ./%.c,./%.o,$(CFILES))
+GALLIUMDIR = ../..
+TOP        = ../../../..
+
+include $(TOP)/configs/current
+
+CFLAGS = -DHAVE_CONFIG_H \
+         -g -Wall -Wimplicit-function-declaration -fPIC \
+         $(shell pkg-config --cflags pixman-1 xorg-server libdrm xproto) \
+         -I$(GALLIUMDIR)/include \
+         -I$(GALLIUMDIR)/auxiliary \
+         -I$(TOP)/src/mesa/drivers/dri/common \
+         -I$(TOP)/src/mesa \
+         -I$(TOP)/include \
+         -I$(TOP)/src/egl/main
+
+#############################################
+
+.PHONY = all clean
+
+all: $(TARGET)
+
+$(TARGET): $(OBJECTS)
+       ar rcs $(TARGET) $(OBJECTS)
+
+clean:
+       rm -rf $(OBJECTS) $(TARGET)
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
new file mode 100644 (file)
index 0000000..7304113
--- /dev/null
@@ -0,0 +1,314 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Author: Alan Hourihane <alanh@tungstengraphics.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ *
+ */
+
+#include <unistd.h>
+#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <math.h>
+#include <stdint.h>
+
+#include "xorg-server.h"
+#include <xf86.h>
+#include <xf86i2c.h>
+#include <xf86Crtc.h>
+#include "xorg_tracker.h"
+#include "xf86Modes.h"
+
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
+
+#include "pipe/p_inlines.h"
+
+struct crtc_private
+{
+    drmModeCrtcPtr drm_crtc;
+
+    /* hwcursor */
+    struct pipe_buffer *cursor_buf;
+    unsigned cursor_handle;
+};
+
+static void
+crtc_dpms(xf86CrtcPtr crtc, int mode)
+{
+    //ScrnInfoPtr pScrn = crtc->scrn;
+
+    switch (mode) {
+    case DPMSModeOn:
+    case DPMSModeStandby:
+    case DPMSModeSuspend:
+       break;
+    case DPMSModeOff:
+       break;
+    }
+}
+
+static Bool
+crtc_lock(xf86CrtcPtr crtc)
+{
+    return FALSE;
+}
+
+static void
+crtc_unlock(xf86CrtcPtr crtc)
+{
+}
+
+static void
+crtc_prepare(xf86CrtcPtr crtc)
+{
+}
+
+static void
+crtc_commit(xf86CrtcPtr crtc)
+{
+}
+
+static Bool
+crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode,
+               DisplayModePtr adjusted_mode)
+{
+    return TRUE;
+}
+
+static void
+crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
+             DisplayModePtr adjusted_mode, int x, int y)
+{
+    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+    modesettingPtr ms = modesettingPTR(crtc->scrn);
+    xf86OutputPtr output = config->output[config->compat_output];
+    drmModeConnectorPtr drm_connector = output->driver_private;
+    struct crtc_private *crtcp = crtc->driver_private;
+    drmModeCrtcPtr drm_crtc = crtcp->drm_crtc;
+    drmModeModeInfo drm_mode;
+
+    drm_mode.clock = mode->Clock;
+    drm_mode.hdisplay = mode->HDisplay;
+    drm_mode.hsync_start = mode->HSyncStart;
+    drm_mode.hsync_end = mode->HSyncEnd;
+    drm_mode.htotal = mode->HTotal;
+    drm_mode.vdisplay = mode->VDisplay;
+    drm_mode.vsync_start = mode->VSyncStart;
+    drm_mode.vsync_end = mode->VSyncEnd;
+    drm_mode.vtotal = mode->VTotal;
+    drm_mode.flags = mode->Flags;
+    drm_mode.hskew = mode->HSkew;
+    drm_mode.vscan = mode->VScan;
+    drm_mode.vrefresh = mode->VRefresh;
+    if (!mode->name)
+       xf86SetModeDefaultName(mode);
+    strncpy(drm_mode.name, mode->name, DRM_DISPLAY_MODE_LEN);
+
+    drmModeSetCrtc(ms->fd, drm_crtc->crtc_id, ms->fb_id, x, y,
+                  &drm_connector->connector_id, 1, &drm_mode);
+}
+
+#if 0
+static void
+crtc_load_lut(xf86CrtcPtr crtc)
+{
+    //ScrnInfoPtr pScrn = crtc->scrn;
+}
+#endif
+
+static void
+crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, CARD16 * blue,
+              int size)
+{
+}
+
+static void *
+crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
+{
+    //ScrnInfoPtr pScrn = crtc->scrn;
+
+    return NULL;
+}
+
+static PixmapPtr
+crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
+{
+    //ScrnInfoPtr pScrn = crtc->scrn;
+
+    return NULL;
+}
+
+static void
+crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
+{
+    //ScrnInfoPtr pScrn = crtc->scrn;
+}
+
+static void
+crtc_destroy(xf86CrtcPtr crtc)
+{
+    modesettingPtr ms = modesettingPTR(crtc->scrn);
+    struct crtc_private *crtcp = crtc->driver_private;
+
+    if (crtcp->cursor_buf)
+       pipe_buffer_reference(&crtcp->cursor_buf, NULL);
+
+    drmModeFreeCrtc(crtcp->drm_crtc);
+    xfree(crtcp);
+}
+
+static void
+crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
+{
+    unsigned char *ptr;
+    modesettingPtr ms = modesettingPTR(crtc->scrn);
+    struct crtc_private *crtcp = crtc->driver_private;
+
+    if (!crtcp->cursor_buf) {
+       crtcp->cursor_buf = pipe_buffer_create(ms->screen,
+                                              0,
+                                              PIPE_BUFFER_USAGE_CPU_WRITE |
+                                              PIPE_BUFFER_USAGE_GPU_READ,
+                                              64*64*4);
+       drm_api_hooks.handle_from_buffer(ms->screen,
+                                        crtcp->cursor_buf,
+                                        &crtcp->cursor_handle);
+    }
+
+    ptr = pipe_buffer_map(ms->screen, crtcp->cursor_buf, PIPE_BUFFER_USAGE_CPU_WRITE);
+
+    if (ptr)
+       memcpy(ptr, image, 64 * 64 * 4);
+
+    pipe_buffer_unmap(ms->screen, crtcp->cursor_buf);
+}
+
+static void
+crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
+{
+    modesettingPtr ms = modesettingPTR(crtc->scrn);
+    struct crtc_private *crtcp = crtc->driver_private;
+
+    drmModeMoveCursor(ms->fd, crtcp->drm_crtc->crtc_id, x, y);
+}
+
+static void
+crtc_show_cursor(xf86CrtcPtr crtc)
+{
+    modesettingPtr ms = modesettingPTR(crtc->scrn);
+    struct crtc_private *crtcp = crtc->driver_private;
+
+    if (crtcp->cursor_buf)
+       drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id,
+                        crtcp->cursor_handle, 64, 64);
+}
+
+static void
+crtc_hide_cursor(xf86CrtcPtr crtc)
+{
+    modesettingPtr ms = modesettingPTR(crtc->scrn);
+    struct crtc_private *crtcp = crtc->driver_private;
+
+    drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, 0, 0, 0);
+}
+
+static const xf86CrtcFuncsRec crtc_funcs = {
+    .dpms = crtc_dpms,
+    .save = NULL,
+    .restore = NULL,
+    .lock = crtc_lock,
+    .unlock = crtc_unlock,
+    .mode_fixup = crtc_mode_fixup,
+    .prepare = crtc_prepare,
+    .mode_set = crtc_mode_set,
+    .commit = crtc_commit,
+    .gamma_set = crtc_gamma_set,
+    .shadow_create = crtc_shadow_create,
+    .shadow_allocate = crtc_shadow_allocate,
+    .shadow_destroy = crtc_shadow_destroy,
+    .set_cursor_position = crtc_set_cursor_position,
+    .show_cursor = crtc_show_cursor,
+    .hide_cursor = crtc_hide_cursor,
+    .load_cursor_image = NULL,        /* lets convert to argb only */
+    .set_cursor_colors = NULL,        /* using argb only */
+    .load_cursor_argb = crtc_load_cursor_argb,
+    .destroy = crtc_destroy,
+};
+
+void
+cursor_destroy(xf86CrtcPtr crtc)
+{
+    modesettingPtr ms = modesettingPTR(crtc->scrn);
+    struct crtc_private *crtcp = crtc->driver_private;
+
+    if (crtcp->cursor_buf) {
+       pipe_buffer_reference(&crtcp->cursor_buf, NULL);
+    }
+}
+
+void
+crtc_init(ScrnInfoPtr pScrn)
+{
+    modesettingPtr ms = modesettingPTR(pScrn);
+    xf86CrtcPtr crtc;
+    drmModeResPtr res;
+    drmModeCrtcPtr drm_crtc = NULL;
+    struct crtc_private *crtcp;
+    int c;
+
+    res = drmModeGetResources(ms->fd);
+    if (res == 0) {
+       ErrorF("Failed drmModeGetResources %d\n", errno);
+       return;
+    }
+
+    for (c = 0; c < res->count_crtcs; c++) {
+       drm_crtc = drmModeGetCrtc(ms->fd, res->crtcs[c]);
+       if (!drm_crtc)
+           continue;
+
+       crtc = xf86CrtcCreate(pScrn, &crtc_funcs);
+       if (crtc == NULL)
+           goto out;
+
+       crtcp = xcalloc(1, sizeof(struct crtc_private));
+       if (!crtcp) {
+           xf86CrtcDestroy(crtc);
+           goto out;
+       }
+
+       crtcp->drm_crtc = drm_crtc;
+
+       crtc->driver_private = crtcp;
+
+    }
+
+  out:
+    drmModeFreeResources(res);
+}
+
+/* vim: set sw=4 ts=8 sts=4: */
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
new file mode 100644 (file)
index 0000000..d04204e
--- /dev/null
@@ -0,0 +1,212 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Author: Alan Hourihane <alanh@tungstengraphics.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ *
+ */
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "xorg_tracker.h"
+
+#include "dri2.h"
+
+#include "pipe/p_state.h"
+#include "pipe/p_inlines.h"
+
+typedef struct {
+    PixmapPtr pPixmap;
+    struct pipe_texture *tex;
+    struct pipe_buffer *buf;
+} *BufferPrivatePtr;
+
+static DRI2BufferPtr
+driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
+{
+    struct pipe_texture *depth, *tex;
+    struct pipe_buffer *buf;
+    ScreenPtr pScreen = pDraw->pScreen;
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    BufferPrivatePtr privates;
+    DRI2BufferPtr buffers;
+    PixmapPtr pPixmap;
+    unsigned stride, handle;
+    int i;
+
+    buffers = xcalloc(count, sizeof *buffers);
+    if (!buffers)
+       goto fail_buffers;
+
+    privates = xcalloc(count, sizeof *privates);
+    if (!privates)
+       goto fail_privates;
+
+    depth = NULL;
+    for (i = 0; i < count; i++) {
+       pPixmap = NULL;
+       tex = NULL;
+       buf = NULL;
+       if (attachments[i] == DRI2BufferFrontLeft) {
+           if (pDraw->type == DRAWABLE_PIXMAP)
+               pPixmap = (PixmapPtr) pDraw;
+           else
+               pPixmap = (*pScreen->GetWindowPixmap)((WindowPtr) pDraw);
+           pPixmap->refcnt++;
+           tex = xorg_exa_get_texture(pPixmap);
+       } else if (attachments[i] == DRI2BufferStencil) {
+           pipe_texture_reference(&tex, depth);
+       } else if (attachments[i] == DRI2BufferDepth) {
+           struct pipe_texture template;
+
+           memset(&template, 0, sizeof(template));
+           template.target = PIPE_TEXTURE_2D;
+           template.compressed = 0;
+           template.format = PIPE_FORMAT_S8Z24_UNORM;
+           pf_get_block(template.format, &template.block);
+           template.width[0] = pDraw->width;
+           template.height[0] = pDraw->height;
+           template.depth[0] = 1;
+           template.last_level = 0;
+           template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
+           tex = ms->screen->texture_create(ms->screen, &template);
+       } else {
+           struct pipe_texture template;
+           memset(&template, 0, sizeof(template));
+           template.target = PIPE_TEXTURE_2D;
+           template.compressed = 0;
+           template.format = PIPE_FORMAT_A8R8G8B8_UNORM;
+           pf_get_block(template.format, &template.block);
+           template.width[0] = pDraw->width;
+           template.height[0] = pDraw->height;
+           template.depth[0] = 1;
+           template.last_level = 0;
+           template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
+           tex = ms->screen->texture_create(ms->screen, &template);
+       }
+
+       drm_api_hooks.buffer_from_texture(tex, &buf, &stride);
+       drm_api_hooks.global_handle_from_buffer(ms->screen, buf, &handle);
+
+       buffers[i].name = handle;
+       buffers[i].attachment = attachments[i];
+       buffers[i].pitch = stride;
+       buffers[i].cpp = 4;
+       buffers[i].driverPrivate = &privates[i];
+       buffers[i].flags = 0; /* not tiled */
+       privates[i].pPixmap = pPixmap;
+       privates[i].buf = buf;
+       privates[i].tex = tex;
+    }
+
+    return buffers;
+
+fail_privates:
+    xfree(buffers);
+fail_buffers:
+    return NULL;
+}
+
+static void
+driDestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
+{
+    ScreenPtr pScreen = pDraw->pScreen;
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    BufferPrivatePtr private;
+    int i;
+
+    for (i = 0; i < count; i++) {
+       private = buffers[i].driverPrivate;
+
+       if (private->pPixmap)
+           (*pScreen->DestroyPixmap)(private->pPixmap);
+
+       pipe_texture_reference(&private->tex, NULL);
+       pipe_buffer_reference(&private->buf, NULL);
+    }
+
+    if (buffers) {
+       xfree(buffers[0].driverPrivate);
+       xfree(buffers);
+    }
+}
+
+static void
+driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
+              DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer)
+{
+    ScreenPtr pScreen = pDraw->pScreen;
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    BufferPrivatePtr dst_priv = pDestBuffer->driverPrivate;
+    BufferPrivatePtr src_priv = pSrcBuffer->driverPrivate;
+
+    struct pipe_surface *dst_surf =
+       ms->screen->get_tex_surface(ms->screen, dst_priv->tex, 0, 0, 0,
+                                   PIPE_BUFFER_USAGE_GPU_WRITE);
+    struct pipe_surface *src_surf =
+       ms->screen->get_tex_surface(ms->screen, src_priv->tex, 0, 0, 0,
+                                   PIPE_BUFFER_USAGE_GPU_READ);
+
+    ms->ctx->surface_copy(ms->ctx, dst_surf, 0, 0, src_surf,
+                         0, 0, pDraw->width, pDraw->height);
+
+    pipe_surface_reference(&dst_surf, NULL);
+    pipe_surface_reference(&src_surf, NULL);
+}
+
+Bool
+driScreenInit(ScreenPtr pScreen)
+{
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    DRI2InfoRec dri2info;
+
+    dri2info.version = 1;
+    dri2info.fd = ms->fd;
+#if 0
+    dri2info.driverName = pScrn->name;
+#else
+    dri2info.driverName = "i915"; /* FIXME */
+#endif
+    dri2info.deviceName = "/dev/dri/card0"; /* FIXME */
+
+    dri2info.CreateBuffers = driCreateBuffers;
+    dri2info.DestroyBuffers = driDestroyBuffers;
+    dri2info.CopyRegion = driCopyRegion;
+
+    return DRI2ScreenInit(pScreen, &dri2info);
+}
+
+void
+driCloseScreen(ScreenPtr pScreen)
+{
+    DRI2CloseScreen(pScreen);
+}
+
+/* vim: set sw=4 ts=8 sts=4: */
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
new file mode 100644 (file)
index 0000000..8a2711e
--- /dev/null
@@ -0,0 +1,695 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Author: Alan Hourihane <alanh@tungstengraphics.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ *
+ */
+
+
+#include "xorg-server.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "compiler.h"
+#include "xf86RAC.h"
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+#include "xf86Resources.h"
+#include "mipointer.h"
+#include "micmap.h"
+#include <X11/extensions/randr.h>
+#include "fb.h"
+#include "edid.h"
+#include "xf86i2c.h"
+#include "xf86Crtc.h"
+#include "miscstruct.h"
+#include "dixstruct.h"
+#include "xf86xv.h"
+#include <X11/extensions/Xv.h>
+#ifndef XSERVER_LIBPCIACCESS
+#error "libpciaccess needed"
+#endif
+
+#include <pciaccess.h>
+
+#include "xorg_tracker.h"
+#include "xorg_winsys.h"
+
+static void AdjustFrame(int scrnIndex, int x, int y, int flags);
+static Bool CloseScreen(int scrnIndex, ScreenPtr pScreen);
+static Bool EnterVT(int scrnIndex, int flags);
+static Bool SaveHWState(ScrnInfoPtr pScrn);
+static Bool RestoreHWState(ScrnInfoPtr pScrn);
+
+
+static ModeStatus ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose,
+                           int flags);
+static void FreeScreen(int scrnIndex, int flags);
+static void LeaveVT(int scrnIndex, int flags);
+static Bool SwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
+static Bool ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
+                      char **argv);
+static Bool PreInit(ScrnInfoPtr pScrn, int flags);
+
+typedef enum
+{
+    OPTION_SW_CURSOR,
+} modesettingOpts;
+
+static const OptionInfoRec Options[] = {
+    {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE},
+    {-1, NULL, OPTV_NONE, {0}, FALSE}
+};
+
+/*
+ * Functions that might be needed
+ */
+
+static const char *exaSymbols[] = {
+    "exaGetVersion",
+    "exaDriverInit",
+    "exaDriverFini",
+    "exaOffscreenAlloc",
+    "exaOffscreenFree",
+    "exaWaitSync",
+    NULL
+};
+
+static const char *fbSymbols[] = {
+    "fbPictureInit",
+    "fbScreenInit",
+    NULL
+};
+
+static const char *ddcSymbols[] = {
+    "xf86PrintEDID",
+    "xf86SetDDCproperties",
+    NULL
+};
+
+/*
+ * Exported Xorg driver functions to winsys
+ */
+
+void
+xorg_tracker_loader_ref_sym_lists()
+{
+    LoaderRefSymLists(exaSymbols, fbSymbols, ddcSymbols, NULL);
+}
+
+const OptionInfoRec *
+xorg_tracker_available_options(int chipid, int busid)
+{
+    return Options;
+}
+
+void
+xorg_tracker_set_functions(ScrnInfoPtr scrn)
+{
+    scrn->PreInit = PreInit;
+    scrn->ScreenInit = ScreenInit;
+    scrn->SwitchMode = SwitchMode;
+    scrn->AdjustFrame = AdjustFrame;
+    scrn->EnterVT = EnterVT;
+    scrn->LeaveVT = LeaveVT;
+    scrn->FreeScreen = FreeScreen;
+    scrn->ValidMode = ValidMode;
+}
+
+/*
+ * Static Xorg funtctions
+ */
+
+static Bool
+GetRec(ScrnInfoPtr pScrn)
+{
+    if (pScrn->driverPrivate)
+       return TRUE;
+
+    pScrn->driverPrivate = xnfcalloc(sizeof(modesettingRec), 1);
+
+    return TRUE;
+}
+
+static void
+FreeRec(ScrnInfoPtr pScrn)
+{
+    if (!pScrn)
+       return;
+
+    if (!pScrn->driverPrivate)
+       return;
+
+    xfree(pScrn->driverPrivate);
+
+    pScrn->driverPrivate = NULL;
+}
+
+static void
+ProbeDDC(ScrnInfoPtr pScrn, int index)
+{
+    ConfiguredMonitor = NULL;
+}
+
+static Bool
+CreateFrontBuffer(ScrnInfoPtr pScrn)
+{
+    modesettingPtr ms = modesettingPTR(pScrn);
+    ScreenPtr pScreen = pScrn->pScreen;
+    PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen);
+
+    ms->noEvict = TRUE;
+    pScreen->ModifyPixmapHeader(rootPixmap,
+                               pScrn->virtualX, pScrn->virtualY,
+                               pScrn->depth, pScrn->bitsPerPixel,
+                               pScrn->displayWidth * pScrn->bitsPerPixel / 8,
+                               NULL);
+    ms->noEvict = FALSE;
+
+    drmModeAddFB(ms->fd,
+                pScrn->virtualX,
+                pScrn->virtualY,
+                pScrn->depth,
+                pScrn->bitsPerPixel,
+                pScrn->displayWidth * pScrn->bitsPerPixel / 8,
+                xorg_exa_get_pixmap_handle(rootPixmap), &ms->fb_id);
+
+    pScrn->frameX0 = 0;
+    pScrn->frameY0 = 0;
+    AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+    return TRUE;
+}
+
+static Bool
+crtc_resize(ScrnInfoPtr pScrn, int width, int height)
+{
+    modesettingPtr ms = modesettingPTR(pScrn);
+    //ScreenPtr pScreen = pScrn->pScreen;
+    //PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen);
+    //Bool fbAccessDisabled;
+    //CARD8 *fbstart;
+
+    if (width == pScrn->virtualX && height == pScrn->virtualY)
+       return TRUE;
+
+    ErrorF("RESIZING TO %dx%d\n", width, height);
+
+    pScrn->virtualX = width;
+    pScrn->virtualY = height;
+
+    /* HW dependent - FIXME */
+    pScrn->displayWidth = pScrn->virtualX;
+
+    drmModeRmFB(ms->fd, ms->fb_id);
+
+    /* now create new frontbuffer */
+    return CreateFrontBuffer(pScrn);
+}
+
+static const xf86CrtcConfigFuncsRec crtc_config_funcs = {
+    crtc_resize
+};
+
+static Bool
+PreInit(ScrnInfoPtr pScrn, int flags)
+{
+    xf86CrtcConfigPtr xf86_config;
+    modesettingPtr ms;
+    rgb defaultWeight = { 0, 0, 0 };
+    EntityInfoPtr pEnt;
+    EntPtr msEnt = NULL;
+    char *BusID;
+    int max_width, max_height;
+
+    if (pScrn->numEntities != 1)
+       return FALSE;
+
+    pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+
+    if (flags & PROBE_DETECT) {
+       ProbeDDC(pScrn, pEnt->index);
+       return TRUE;
+    }
+
+    /* Allocate driverPrivate */
+    if (!GetRec(pScrn))
+       return FALSE;
+
+    ms = modesettingPTR(pScrn);
+    ms->SaveGeneration = -1;
+    ms->pEnt = pEnt;
+
+    pScrn->displayWidth = 640;        /* default it */
+
+    if (ms->pEnt->location.type != BUS_PCI)
+       return FALSE;
+
+    ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
+
+    /* Allocate an entity private if necessary */
+    if (xf86IsEntityShared(pScrn->entityList[0])) {
+       FatalError("Entity");
+#if 0
+       msEnt = xf86GetEntityPrivate(pScrn->entityList[0],
+                                    modesettingEntityIndex)->ptr;
+       ms->entityPrivate = msEnt;
+#else
+       (void)msEnt;
+#endif
+    } else
+       ms->entityPrivate = NULL;
+
+    if (xf86RegisterResources(ms->pEnt->index, NULL, ResNone)) {
+       return FALSE;
+    }
+
+    if (xf86IsEntityShared(pScrn->entityList[0])) {
+       if (xf86IsPrimInitDone(pScrn->entityList[0])) {
+           /* do something */
+       } else {
+           xf86SetPrimInitDone(pScrn->entityList[0]);
+       }
+    }
+
+    BusID = xalloc(64);
+    sprintf(BusID, "PCI:%d:%d:%d",
+           ((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
+           ms->PciInfo->dev, ms->PciInfo->func
+       );
+
+    ms->fd = drmOpen(NULL, BusID);
+
+    if (ms->fd < 0)
+       return FALSE;
+
+    pScrn->racMemFlags = RAC_FB | RAC_COLORMAP;
+    pScrn->monitor = pScrn->confScreen->monitor;
+    pScrn->progClock = TRUE;
+    pScrn->rgbBits = 8;
+
+    if (!xf86SetDepthBpp
+       (pScrn, 0, 0, 0,
+        PreferConvert24to32 | SupportConvert24to32 | Support32bppFb))
+       return FALSE;
+
+    switch (pScrn->depth) {
+    case 15:
+    case 16:
+    case 24:
+       break;
+    default:
+       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                  "Given depth (%d) is not supported by the driver\n",
+                  pScrn->depth);
+       return FALSE;
+    }
+    xf86PrintDepthBpp(pScrn);
+
+    if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight))
+       return FALSE;
+    if (!xf86SetDefaultVisual(pScrn, -1))
+       return FALSE;
+
+    /* Process the options */
+    xf86CollectOptions(pScrn, NULL);
+    if (!(ms->Options = xalloc(sizeof(Options))))
+       return FALSE;
+    memcpy(ms->Options, Options, sizeof(Options));
+    xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options);
+
+    /* Allocate an xf86CrtcConfig */
+    xf86CrtcConfigInit(pScrn, &crtc_config_funcs);
+    xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+
+    max_width = 8192;
+    max_height = 8192;
+    xf86CrtcSetSizeRange(pScrn, 320, 200, max_width, max_height);
+
+    if (xf86ReturnOptValBool(ms->Options, OPTION_SW_CURSOR, FALSE)) {
+       ms->SWCursor = TRUE;
+    }
+
+    SaveHWState(pScrn);
+
+    crtc_init(pScrn);
+    output_init(pScrn);
+
+    if (!xf86InitialConfiguration(pScrn, TRUE)) {
+       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n");
+       RestoreHWState(pScrn);
+       return FALSE;
+    }
+
+    RestoreHWState(pScrn);
+
+    /*
+     * If the driver can do gamma correction, it should call xf86SetGamma() here.
+     */
+    {
+       Gamma zeros = { 0.0, 0.0, 0.0 };
+
+       if (!xf86SetGamma(pScrn, zeros)) {
+           return FALSE;
+       }
+    }
+
+    if (pScrn->modes == NULL) {
+       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
+       return FALSE;
+    }
+
+    pScrn->currentMode = pScrn->modes;
+
+    /* Set display resolution */
+    xf86SetDpi(pScrn, 0, 0);
+
+    /* Load the required sub modules */
+    if (!xf86LoadSubModule(pScrn, "fb")) {
+       return FALSE;
+    }
+
+    xf86LoaderReqSymLists(fbSymbols, NULL);
+
+    xf86LoadSubModule(pScrn, "exa");
+
+#ifdef DRI2
+    xf86LoadSubModule(pScrn, "dri2");
+#endif
+
+    return TRUE;
+}
+
+static Bool
+SaveHWState(ScrnInfoPtr pScrn)
+{
+    /*xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);*/
+
+    return TRUE;
+}
+
+static Bool
+RestoreHWState(ScrnInfoPtr pScrn)
+{
+    /*xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);*/
+
+    return TRUE;
+}
+
+static Bool
+CreateScreenResources(ScreenPtr pScreen)
+{
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    PixmapPtr rootPixmap;
+    Bool ret;
+
+    ms->noEvict = TRUE;
+
+    pScreen->CreateScreenResources = ms->createScreenResources;
+    ret = pScreen->CreateScreenResources(pScreen);
+    pScreen->CreateScreenResources = CreateScreenResources;
+
+    rootPixmap = pScreen->GetScreenPixmap(pScreen);
+
+    if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, NULL))
+       FatalError("Couldn't adjust screen pixmap\n");
+
+    ms->noEvict = FALSE;
+
+    drmModeAddFB(ms->fd,
+                pScrn->virtualX,
+                pScrn->virtualY,
+                pScrn->depth,
+                pScrn->bitsPerPixel,
+                pScrn->displayWidth * pScrn->bitsPerPixel / 8,
+                xorg_exa_get_pixmap_handle(rootPixmap), &ms->fb_id);
+
+    AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+    return ret;
+}
+
+static Bool
+ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+{
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    VisualPtr visual;
+
+    /* deal with server regeneration */
+    if (ms->fd < 0) {
+       char *BusID;
+
+       BusID = xalloc(64);
+       sprintf(BusID, "PCI:%d:%d:%d",
+               ((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
+               ms->PciInfo->dev, ms->PciInfo->func
+           );
+
+       ms->fd = drmOpen(NULL, BusID);
+
+       if (ms->fd < 0)
+           return FALSE;
+    }
+
+    if (!ms->screen) {
+       ms->screen = drm_api_hooks.create_screen(ms->fd, ms->PciInfo->device_id);
+
+       if (!ms->screen) {
+           FatalError("Could not init pipe_screen\n");
+           return FALSE;
+       }
+    }
+
+    pScrn->pScreen = pScreen;
+
+    /* HW dependent - FIXME */
+    pScrn->displayWidth = pScrn->virtualX;
+
+    miClearVisualTypes();
+
+    if (!miSetVisualTypes(pScrn->depth,
+                         miGetDefaultVisualMask(pScrn->depth),
+                         pScrn->rgbBits, pScrn->defaultVisual))
+       return FALSE;
+
+    if (!miSetPixmapDepths())
+       return FALSE;
+
+    pScrn->memPhysBase = 0;
+    pScrn->fbOffset = 0;
+
+    if (!fbScreenInit(pScreen, NULL,
+                     pScrn->virtualX, pScrn->virtualY,
+                     pScrn->xDpi, pScrn->yDpi,
+                     pScrn->displayWidth, pScrn->bitsPerPixel))
+       return FALSE;
+
+    if (pScrn->bitsPerPixel > 8) {
+       /* Fixup RGB ordering */
+       visual = pScreen->visuals + pScreen->numVisuals;
+       while (--visual >= pScreen->visuals) {
+           if ((visual->class | DynamicClass) == DirectColor) {
+               visual->offsetRed = pScrn->offset.red;
+               visual->offsetGreen = pScrn->offset.green;
+               visual->offsetBlue = pScrn->offset.blue;
+               visual->redMask = pScrn->mask.red;
+               visual->greenMask = pScrn->mask.green;
+               visual->blueMask = pScrn->mask.blue;
+           }
+       }
+    }
+
+    fbPictureInit(pScreen, NULL, 0);
+
+    ms->createScreenResources = pScreen->CreateScreenResources;
+    pScreen->CreateScreenResources = CreateScreenResources;
+
+    xf86SetBlackWhitePixels(pScreen);
+
+    ms->exa = xorg_exa_init(pScrn);
+
+    miInitializeBackingStore(pScreen);
+    xf86SetBackingStore(pScreen);
+    xf86SetSilkenMouse(pScreen);
+    miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+
+    /* Need to extend HWcursor support to handle mask interleave */
+    if (!ms->SWCursor)
+       xf86_cursors_init(pScreen, 64, 64,
+                         HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
+                         HARDWARE_CURSOR_ARGB);
+
+    /* Must force it before EnterVT, so we are in control of VT and
+     * later memory should be bound when allocating, e.g rotate_mem */
+    pScrn->vtSema = TRUE;
+
+    pScreen->SaveScreen = xf86SaveScreen;
+    ms->CloseScreen = pScreen->CloseScreen;
+    pScreen->CloseScreen = CloseScreen;
+
+    if (!xf86CrtcScreenInit(pScreen))
+       return FALSE;
+
+    if (!miCreateDefColormap(pScreen))
+       return FALSE;
+
+    xf86DPMSInit(pScreen, xf86DPMSSet, 0);
+
+    if (serverGeneration == 1)
+       xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
+
+#if 1
+#ifdef DRI2
+    driScreenInit(pScreen);
+#endif
+#endif
+
+    return EnterVT(scrnIndex, 1);
+}
+
+static void
+AdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+    xf86OutputPtr output = config->output[config->compat_output];
+    xf86CrtcPtr crtc = output->crtc;
+
+    if (crtc && crtc->enabled) {
+       crtc->funcs->mode_set(crtc, pScrn->currentMode, pScrn->currentMode, x,
+                             y);
+       crtc->x = output->initial_x + x;
+       crtc->y = output->initial_y + y;
+    }
+}
+
+static void
+FreeScreen(int scrnIndex, int flags)
+{
+    FreeRec(xf86Screens[scrnIndex]);
+}
+
+/* HACK */
+void
+cursor_destroy(xf86CrtcPtr crtc);
+
+static void
+LeaveVT(int scrnIndex, int flags)
+{
+    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+    int o;
+
+    for (o = 0; o < config->num_crtc; o++) {
+       xf86CrtcPtr crtc = config->crtc[o];
+
+       cursor_destroy(crtc);
+
+       if (crtc->rotatedPixmap || crtc->rotatedData) {
+           crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap,
+                                       crtc->rotatedData);
+           crtc->rotatedPixmap = NULL;
+           crtc->rotatedData = NULL;
+       }
+    }
+
+    drmModeRmFB(ms->fd, ms->fb_id);
+
+    RestoreHWState(pScrn);
+
+    pScrn->vtSema = FALSE;
+}
+
+/*
+ * This gets called when gaining control of the VT, and from ScreenInit().
+ */
+static Bool
+EnterVT(int scrnIndex, int flags)
+{
+    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    modesettingPtr ms = modesettingPTR(pScrn);
+
+    /*
+     * Only save state once per server generation since that's what most
+     * drivers do.  Could change this to save state at each VT enter.
+     */
+    if (ms->SaveGeneration != serverGeneration) {
+       ms->SaveGeneration = serverGeneration;
+       SaveHWState(pScrn);
+    }
+
+    if (!flags)                               /* signals startup as we'll do this in CreateScreenResources */
+       CreateFrontBuffer(pScrn);
+
+    if (!xf86SetDesiredModes(pScrn))
+       return FALSE;
+
+    return TRUE;
+}
+
+static Bool
+SwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+{
+    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+
+    return xf86SetSingleMode(pScrn, mode, RR_Rotate_0);
+}
+
+static Bool
+CloseScreen(int scrnIndex, ScreenPtr pScreen)
+{
+    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    modesettingPtr ms = modesettingPTR(pScrn);
+
+    if (pScrn->vtSema) {
+       LeaveVT(scrnIndex, 0);
+    }
+#ifdef DRI2
+    driCloseScreen(pScreen);
+#endif
+
+    pScreen->CreateScreenResources = ms->createScreenResources;
+
+    if (ms->exa)
+       xorg_exa_close(pScrn);
+
+    drmClose(ms->fd);
+    ms->fd = -1;
+
+    pScrn->vtSema = FALSE;
+    pScreen->CloseScreen = ms->CloseScreen;
+    return (*pScreen->CloseScreen) (scrnIndex, pScreen);
+}
+
+static ModeStatus
+ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+{
+    return MODE_OK;
+}
+
+/* vim: set sw=4 ts=8 sts=4: */
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
new file mode 100644 (file)
index 0000000..56c8fdc
--- /dev/null
@@ -0,0 +1,528 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Author: Alan Hourihane <alanh@tungstengraphics.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ *
+ */
+
+#include "xf86.h"
+#include "xorg_tracker.h"
+
+#include "pipe/p_format.h"
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "pipe/p_inlines.h"
+
+struct exa_entity
+{
+    ExaDriverPtr pExa;
+    struct pipe_context *ctx;
+    struct pipe_screen *scrn;
+};
+
+struct PixmapPriv
+{
+    int flags;
+    struct pipe_texture *tex;
+    unsigned int color;
+    struct pipe_surface *src_surf; /* for copies */
+
+    struct pipe_transfer *map_transfer;
+    unsigned map_count;
+};
+
+/*
+ * Helper functions
+ */
+
+static void
+exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp)
+{
+    switch (depth) {
+    case 32:
+       *format = PIPE_FORMAT_A8R8G8B8_UNORM;
+       assert(*bbp == 32);
+       break;
+    case 24:
+       *format = PIPE_FORMAT_X8R8G8B8_UNORM;
+       assert(*bbp == 32);
+       break;
+    case 16:
+       *format = PIPE_FORMAT_R5G6B5_UNORM;
+       assert(*bbp == 16);
+       break;
+    case 15:
+       *format = PIPE_FORMAT_A1R5G5B5_UNORM;
+       assert(*bbp == 16);
+       break;
+    case 8:
+    case 4:
+    case 1:
+       *format = PIPE_FORMAT_A8R8G8B8_UNORM; /* bad bad bad */
+       break;
+    default:
+       assert(0);
+       break;
+    }
+}
+
+/*
+ * Static exported EXA functions
+ */
+
+static void
+ExaWaitMarker(ScreenPtr pScreen, int marker)
+{
+}
+
+static int
+ExaMarkSync(ScreenPtr pScreen)
+{
+    return 1;
+}
+
+static Bool
+ExaPrepareAccess(PixmapPtr pPix, int index)
+{
+    ScreenPtr pScreen = pPix->drawable.pScreen;
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    struct exa_entity *exa = ms->exa;
+    struct PixmapPriv *priv;
+
+    priv = exaGetPixmapDriverPrivate(pPix);
+
+    if (!priv)
+       return FALSE;
+
+    if (!priv->tex)
+       return FALSE;
+
+    if (priv->map_count++ == 0)
+    {
+       priv->map_transfer =
+           exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
+                                       PIPE_TRANSFER_READ_WRITE,
+                                       0, 0, priv->tex->width[0], priv->tex->height[0]);
+
+       pPix->devPrivate.ptr =
+           exa->scrn->transfer_map(exa->scrn, priv->map_transfer);
+       pPix->devKind = priv->map_transfer->stride;
+    }
+
+    return TRUE;
+}
+
+static void
+ExaFinishAccess(PixmapPtr pPix, int index)
+{
+    ScreenPtr pScreen = pPix->drawable.pScreen;
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    struct exa_entity *exa = ms->exa;
+    struct PixmapPriv *priv;
+    priv = exaGetPixmapDriverPrivate(pPix);
+
+    if (!priv)
+       return;
+
+    if (!priv->map_transfer)
+       return;
+
+    if (--priv->map_count == 0) {
+       assert(priv->map_transfer);
+       exa->scrn->transfer_unmap(exa->scrn, priv->map_transfer);
+       exa->scrn->tex_transfer_destroy(priv->map_transfer);
+       priv->map_transfer = NULL;
+    }
+}
+
+static void
+ExaDone(PixmapPtr pPixmap)
+{
+    ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap);
+    struct exa_entity *exa = ms->exa;
+
+    if (!priv)
+       return;
+
+    if (priv->src_surf)
+       exa->scrn->tex_surface_destroy(priv->src_surf);
+    priv->src_surf = NULL;
+}
+
+static void
+ExaDoneComposite(PixmapPtr pPixmap)
+{
+
+}
+
+static Bool
+ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
+{
+    ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap);
+    struct exa_entity *exa = ms->exa;
+
+    if (1)
+        return FALSE;
+
+    if (pPixmap->drawable.depth < 15)
+       return FALSE;
+
+    if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planeMask))
+       return FALSE;
+
+    if (!priv || !priv->tex)
+       return FALSE;
+
+    if (alu != GXcopy)
+       return FALSE;
+
+    if (!exa->ctx || !exa->ctx->surface_fill)
+       return FALSE;
+
+    priv->color = fg;
+
+    return TRUE;
+}
+
+static void
+ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1)
+{
+    ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    struct exa_entity *exa = ms->exa;
+    struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap);
+    struct pipe_surface *surf =
+       exa->scrn->get_tex_surface(exa->scrn, priv->tex, 0, 0, 0,
+                                  PIPE_BUFFER_USAGE_GPU_READ |
+                                  PIPE_BUFFER_USAGE_GPU_WRITE);
+
+    exa->ctx->surface_fill(exa->ctx, surf, x0, y0, x1 - x0, y1 - y0,
+                          priv->color);
+
+    exa->scrn->tex_surface_destroy(surf);
+}
+
+static Bool
+ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
+              int ydir, int alu, Pixel planeMask)
+{
+    ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    struct exa_entity *exa = ms->exa;
+    struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
+    struct PixmapPriv *src_priv = exaGetPixmapDriverPrivate(pSrcPixmap);
+
+    if (1)
+        return FALSE;
+
+    if (alu != GXcopy)
+       return FALSE;
+
+    if (pSrcPixmap->drawable.depth < 15 || pDstPixmap->drawable.depth < 15)
+       return FALSE;
+
+    if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planeMask))
+       return FALSE;
+
+    if (!priv || !src_priv)
+       return FALSE;
+
+    if (!priv->tex || !src_priv->tex)
+       return FALSE;
+
+    if (!exa->ctx || !exa->ctx->surface_copy)
+       return FALSE;
+
+    priv->src_surf =
+       exa->scrn->get_tex_surface(exa->scrn, src_priv->tex, 0, 0, 0,
+                                  PIPE_BUFFER_USAGE_GPU_READ |
+                                  PIPE_BUFFER_USAGE_GPU_WRITE);
+
+    return TRUE;
+}
+
+static void
+ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
+       int width, int height)
+{
+    ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    struct exa_entity *exa = ms->exa;
+    struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
+    struct pipe_surface *surf =
+       exa->scrn->get_tex_surface(exa->scrn, priv->tex, 0, 0, 0,
+                                  PIPE_BUFFER_USAGE_GPU_READ |
+                                  PIPE_BUFFER_USAGE_GPU_WRITE);
+
+    exa->ctx->surface_copy(exa->ctx, surf, dstX, dstY, priv->src_surf,
+                          srcX, srcY, width, height);
+    exa->scrn->tex_surface_destroy(surf);
+}
+
+static Bool
+ExaPrepareComposite(int op, PicturePtr pSrcPicture,
+                   PicturePtr pMaskPicture, PicturePtr pDstPicture,
+                   PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
+{
+    return FALSE;
+}
+
+static void
+ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
+            int dstX, int dstY, int width, int height)
+{
+}
+
+static Bool
+ExaCheckComposite(int op,
+                 PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+                 PicturePtr pDstPicture)
+{
+    return FALSE;
+}
+
+static void *
+ExaCreatePixmap(ScreenPtr pScreen, int size, int align)
+{
+    struct PixmapPriv *priv;
+
+    priv = xcalloc(1, sizeof(struct PixmapPriv));
+    if (!priv)
+       return NULL;
+
+    return priv;
+}
+
+static void
+ExaDestroyPixmap(ScreenPtr pScreen, void *dPriv)
+{
+    struct PixmapPriv *priv = (struct PixmapPriv *)dPriv;
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+
+    if (!priv)
+       return;
+
+    if (priv->tex)
+       ms->screen->texture_destroy(priv->tex);
+
+    xfree(priv);
+}
+
+static Bool
+ExaPixmapIsOffscreen(PixmapPtr pPixmap)
+{
+    struct PixmapPriv *priv;
+
+    priv = exaGetPixmapDriverPrivate(pPixmap);
+
+    if (!priv)
+       return FALSE;
+
+    if (priv->tex)
+       return TRUE;
+
+    return FALSE;
+}
+
+unsigned
+xorg_exa_get_pixmap_handle(PixmapPtr pPixmap)
+{
+    ScreenPtr pScreen = pPixmap->drawable.pScreen;
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    modesettingPtr ms = modesettingPTR(pScrn);
+    struct PixmapPriv *priv;
+    struct pipe_buffer *buffer = NULL;
+    unsigned handle;
+    unsigned stride;
+
+    if (!ms->exa) {
+       FatalError("NO MS->EXA\n");
+       return 0;
+    }
+
+    priv = exaGetPixmapDriverPrivate(pPixmap);
+
+    if (!priv) {
+       FatalError("NO PIXMAP PRIVATE\n");
+       return 0;
+    }
+
+    drm_api_hooks.buffer_from_texture(priv->tex, &buffer, &stride);
+    drm_api_hooks.handle_from_buffer(ms->screen, buffer, &handle);
+    pipe_buffer_reference(&buffer, NULL);
+    return handle;
+}
+
+static Bool
+ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
+                     int depth, int bitsPerPixel, int devKind,
+                     pointer pPixData)
+{
+    ScreenPtr pScreen = pPixmap->drawable.pScreen;
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap);
+    modesettingPtr ms = modesettingPTR(pScrn);
+    struct exa_entity *exa = ms->exa;
+
+    if (!priv)
+       return FALSE;
+
+    if (depth <= 0)
+       depth = pPixmap->drawable.depth;
+
+    if (bitsPerPixel <= 0)
+       bitsPerPixel = pPixmap->drawable.bitsPerPixel;
+
+    if (width <= 0)
+       width = pPixmap->drawable.width;
+
+    if (height <= 0)
+       height = pPixmap->drawable.height;
+
+    if (width <= 0 || height <= 0 || depth <= 0)
+       return FALSE;
+
+    miModifyPixmapHeader(pPixmap, width, height, depth,
+                            bitsPerPixel, devKind, NULL);
+
+    /* Deal with screen resize */
+    if (priv->tex && (priv->tex->width[0] != width || priv->tex->height[0] != height)) {
+       pipe_texture_reference(&priv->tex, NULL);
+    }
+
+    if (!priv->tex) {
+       struct pipe_texture template;
+
+       memset(&template, 0, sizeof(template));
+       template.target = PIPE_TEXTURE_2D;
+       template.compressed = 0;
+       exa_get_pipe_format(depth, &template.format, &bitsPerPixel);
+       pf_get_block(template.format, &template.block);
+       template.width[0] = width;
+       template.height[0] = height;
+       template.depth[0] = 1;
+       template.last_level = 0;
+       template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
+       priv->tex = exa->scrn->texture_create(exa->scrn, &template);
+    }
+
+    return TRUE;
+}
+
+struct pipe_texture *
+xorg_exa_get_texture(PixmapPtr pPixmap)
+{
+    struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap);
+    struct pipe_texture *tex = NULL;
+    pipe_texture_reference(&tex, priv->tex);
+    return tex;
+}
+
+void
+xorg_exa_close(ScrnInfoPtr pScrn)
+{
+    modesettingPtr ms = modesettingPTR(pScrn);
+    struct exa_entity *exa = ms->exa;
+
+    if (exa->ctx)
+       exa->ctx->destroy(exa->ctx);
+
+    exaDriverFini(pScrn->pScreen);
+    xfree(exa);
+    ms->exa = NULL;
+}
+
+void *
+xorg_exa_init(ScrnInfoPtr pScrn)
+{
+    modesettingPtr ms = modesettingPTR(pScrn);
+    struct exa_entity *exa;
+    ExaDriverPtr pExa;
+
+    exa = xcalloc(1, sizeof(struct exa_entity));
+    if (!exa)
+       return NULL;
+
+    pExa = exaDriverAlloc();
+    if (!pExa) {
+       goto out_err;
+    }
+
+    memset(pExa, 0, sizeof(*pExa));
+    pExa->exa_major = 2;
+    pExa->exa_minor = 2;
+    pExa->memoryBase = 0;
+    pExa->memorySize = 0;
+    pExa->offScreenBase = 0;
+    pExa->pixmapOffsetAlign = 0;
+    pExa->pixmapPitchAlign = 1;
+    pExa->flags = EXA_OFFSCREEN_PIXMAPS | EXA_HANDLES_PIXMAPS;
+    pExa->maxX = 8191;                /* FIXME */
+    pExa->maxY = 8191;                /* FIXME */
+    pExa->WaitMarker = ExaWaitMarker;
+    pExa->MarkSync = ExaMarkSync;
+    pExa->PrepareSolid = ExaPrepareSolid;
+    pExa->Solid = ExaSolid;
+    pExa->DoneSolid = ExaDone;
+    pExa->PrepareCopy = ExaPrepareCopy;
+    pExa->Copy = ExaCopy;
+    pExa->DoneCopy = ExaDone;
+    pExa->CheckComposite = ExaCheckComposite;
+    pExa->PrepareComposite = ExaPrepareComposite;
+    pExa->Composite = ExaComposite;
+    pExa->DoneComposite = ExaDoneComposite;
+    pExa->PixmapIsOffscreen = ExaPixmapIsOffscreen;
+    pExa->PrepareAccess = ExaPrepareAccess;
+    pExa->FinishAccess = ExaFinishAccess;
+    pExa->CreatePixmap = ExaCreatePixmap;
+    pExa->DestroyPixmap = ExaDestroyPixmap;
+    pExa->ModifyPixmapHeader = ExaModifyPixmapHeader;
+
+    if (!exaDriverInit(pScrn->pScreen, pExa)) {
+       goto out_err;
+    }
+
+    exa->scrn = ms->screen;
+    exa->ctx = drm_api_hooks.create_context(exa->scrn);
+    /* Share context with DRI */
+    ms->ctx = exa->ctx;
+
+    return (void *)exa;
+
+  out_err:
+    xorg_exa_close(pScrn);
+
+    return NULL;
+}
+
+/* vim: set sw=4 ts=8 sts=4: */
diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c
new file mode 100644 (file)
index 0000000..950af94
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Author: Alan Hourihane <alanh@tungstengraphics.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ *
+ */
+
+#include "xorg-server.h"
+#include <xf86.h>
+#include <xf86i2c.h>
+#include <xf86Crtc.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
+
+#include "X11/Xatom.h"
+
+#include "xorg_tracker.h"
+
+static char *connector_enum_list[] = {
+    "Unknown",
+    "VGA",
+    "DVI-I",
+    "DVI-D",
+    "DVI-A",
+    "Composite",
+    "SVIDEO",
+    "LVDS",
+    "Component",
+    "9-pin DIN",
+    "DisplayPort",
+    "HDMI Type A",
+    "HDMI Type B",
+};
+
+static void
+dpms(xf86OutputPtr output, int mode)
+{
+}
+
+static void
+save(xf86OutputPtr output)
+{
+}
+
+static void
+restore(xf86OutputPtr output)
+{
+}
+
+static int
+mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
+{
+    return MODE_OK;
+}
+
+static Bool
+mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
+          DisplayModePtr adjusted_mode)
+{
+    return TRUE;
+}
+
+static void
+prepare(xf86OutputPtr output)
+{
+    dpms(output, DPMSModeOff);
+}
+
+static void
+mode_set(xf86OutputPtr output, DisplayModePtr mode,
+        DisplayModePtr adjusted_mode)
+{
+}
+
+static void
+commit(xf86OutputPtr output)
+{
+    dpms(output, DPMSModeOn);
+
+    if (output->scrn->pScreen != NULL)
+       xf86_reload_cursors(output->scrn->pScreen);
+}
+
+static xf86OutputStatus
+detect(xf86OutputPtr output)
+{
+    drmModeConnectorPtr drm_connector = output->driver_private;
+
+    switch (drm_connector->connection) {
+    case DRM_MODE_CONNECTED:
+       return XF86OutputStatusConnected;
+    case DRM_MODE_DISCONNECTED:
+       return XF86OutputStatusDisconnected;
+    default:
+       return XF86OutputStatusUnknown;
+    }
+}
+
+static DisplayModePtr
+get_modes(xf86OutputPtr output)
+{
+    drmModeConnectorPtr drm_connector = output->driver_private;
+    drmModeModeInfoPtr drm_mode = NULL;
+    DisplayModePtr modes = NULL, mode = NULL;
+    int i;
+
+    for (i = 0; i < drm_connector->count_modes; i++) {
+       drm_mode = &drm_connector->modes[i];
+       if (drm_mode) {
+           mode = xcalloc(1, sizeof(DisplayModeRec));
+           if (!mode)
+               continue;
+           mode->type = 0;
+           mode->Clock = drm_mode->clock;
+           mode->HDisplay = drm_mode->hdisplay;
+           mode->HSyncStart = drm_mode->hsync_start;
+           mode->HSyncEnd = drm_mode->hsync_end;
+           mode->HTotal = drm_mode->htotal;
+           mode->VDisplay = drm_mode->vdisplay;
+           mode->VSyncStart = drm_mode->vsync_start;
+           mode->VSyncEnd = drm_mode->vsync_end;
+           mode->VTotal = drm_mode->vtotal;
+           mode->Flags = drm_mode->flags;
+           mode->HSkew = drm_mode->hskew;
+           mode->VScan = drm_mode->vscan;
+           mode->VRefresh = xf86ModeVRefresh(mode);
+           mode->Private = (void *)drm_mode;
+           xf86SetModeDefaultName(mode);
+           modes = xf86ModesAdd(modes, mode);
+           xf86PrintModeline(0, mode);
+       }
+    }
+
+    return modes;
+}
+
+static void
+destroy(xf86OutputPtr output)
+{
+    drmModeFreeConnector(output->driver_private);
+}
+
+static void
+create_resources(xf86OutputPtr output)
+{
+#ifdef RANDR_12_INTERFACE
+#endif /* RANDR_12_INTERFACE */
+}
+
+#ifdef RANDR_12_INTERFACE
+static Bool
+set_property(xf86OutputPtr output, Atom property, RRPropertyValuePtr value)
+{
+    return TRUE;
+}
+#endif /* RANDR_12_INTERFACE */
+
+#ifdef RANDR_13_INTERFACE
+static Bool
+get_property(xf86OutputPtr output, Atom property)
+{
+    return TRUE;
+}
+#endif /* RANDR_13_INTERFACE */
+
+#ifdef RANDR_GET_CRTC_INTERFACE
+static xf86CrtcPtr
+get_crtc(xf86OutputPtr output)
+{
+    return NULL;
+}
+#endif
+
+static const xf86OutputFuncsRec output_funcs = {
+    .create_resources = create_resources,
+    .dpms = dpms,
+    .save = save,
+    .restore = restore,
+    .mode_valid = mode_valid,
+    .mode_fixup = mode_fixup,
+    .prepare = prepare,
+    .mode_set = mode_set,
+    .commit = commit,
+    .detect = detect,
+    .get_modes = get_modes,
+#ifdef RANDR_12_INTERFACE
+    .set_property = set_property,
+#endif
+#ifdef RANDR_13_INTERFACE
+    .get_property = get_property,
+#endif
+    .destroy = destroy,
+#ifdef RANDR_GET_CRTC_INTERFACE
+    .get_crtc = get_crtc,
+#endif
+};
+
+void
+output_init(ScrnInfoPtr pScrn)
+{
+    modesettingPtr ms = modesettingPTR(pScrn);
+    xf86OutputPtr output;
+    drmModeResPtr res;
+    drmModeConnectorPtr drm_connector = NULL;
+    drmModeEncoderPtr drm_encoder = NULL;
+    char *name;
+    int c, v, p;
+
+    res = drmModeGetResources(ms->fd);
+    if (res == 0) {
+       DRV_ERROR("Failed drmModeGetResources\n");
+       return;
+    }
+
+    for (c = 0; c < res->count_connectors; c++) {
+       drm_connector = drmModeGetConnector(ms->fd, res->connectors[c]);
+       if (!drm_connector)
+           goto out;
+
+#if 0
+       for (p = 0; p < drm_connector->count_props; p++) {
+           drmModePropertyPtr prop;
+
+           prop = drmModeGetProperty(ms->fd, drm_connector->props[p]);
+
+           name = NULL;
+           if (prop) {
+               ErrorF("VALUES %d\n", prop->count_values);
+
+               for (v = 0; v < prop->count_values; v++)
+                   ErrorF("%s %lld\n", prop->name, prop->values[v]);
+           }
+       }
+#else
+       (void)p;
+       (void)v;
+#endif
+
+       name = connector_enum_list[drm_connector->connector_type];
+
+       output = xf86OutputCreate(pScrn, &output_funcs, name);
+       if (!output)
+           continue;
+
+       drm_encoder = drmModeGetEncoder(ms->fd, drm_connector->encoders[0]);
+       if (drm_encoder) {
+           output->possible_crtcs = drm_encoder->possible_crtcs;
+           output->possible_clones = drm_encoder->possible_clones;
+       } else {
+           output->possible_crtcs = 0;
+           output->possible_clones = 0;
+       }
+       output->driver_private = drm_connector;
+       output->subpixel_order = SubPixelHorizontalRGB;
+       output->interlaceAllowed = FALSE;
+       output->doubleScanAllowed = FALSE;
+    }
+
+  out:
+    drmModeFreeResources(res);
+}
+
+/* vim: set sw=4 ts=8 sts=4: */
diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
new file mode 100644 (file)
index 0000000..82c3890
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Author: Alan Hourihane <alanh@tungstengraphics.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ *
+ */
+
+#ifndef _XORG_TRACKER_H_
+#define _XORG_TRACKER_H_
+
+#include <errno.h>
+#include <drm.h>
+#include <xf86drm.h>
+#include <xf86drmMode.h>
+#include "exa.h"
+
+#include "pipe/p_screen.h"
+#include "state_tracker/drm_api.h"
+
+#define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg);
+
+typedef struct
+{
+    int lastInstance;
+    int refCount;
+    ScrnInfoPtr pScrn_1;
+    ScrnInfoPtr pScrn_2;
+} EntRec, *EntPtr;
+
+typedef struct _modesettingRec
+{
+    /* drm */
+    int fd;
+    unsigned fb_id;
+
+    /* X */
+    EntPtr entityPrivate;
+
+    int Chipset;
+    EntityInfoPtr pEnt;
+    struct pci_device *PciInfo;
+
+    Bool noAccel;
+    Bool SWCursor;
+    CloseScreenProcPtr CloseScreen;
+
+    /* Broken-out options. */
+    OptionInfoPtr Options;
+
+    unsigned int SaveGeneration;
+
+    CreateScreenResourcesProcPtr createScreenResources;
+
+    /* gallium */
+    struct pipe_screen *screen;
+    struct pipe_context *ctx;
+
+    /* exa */
+    void *exa;
+    Bool noEvict;
+
+} modesettingRec, *modesettingPtr;
+
+#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
+
+
+/***********************************************************************
+ * xorg_exa.c
+ */
+struct pipe_texture *
+xorg_exa_get_texture(PixmapPtr pPixmap);
+
+unsigned
+xorg_exa_get_pixmap_handle(PixmapPtr pPixmap);
+
+void *
+xorg_exa_init(ScrnInfoPtr pScrn);
+
+void
+xorg_exa_close(ScrnInfoPtr pScrn);
+
+
+/***********************************************************************
+ * xorg_dri2.c
+ */
+Bool
+driScreenInit(ScreenPtr pScreen);
+
+void
+driCloseScreen(ScreenPtr pScreen);
+
+
+/***********************************************************************
+ * xorg_crtc.c
+ */
+void
+crtc_init(ScrnInfoPtr pScrn);
+
+
+/***********************************************************************
+ * xorg_output.c
+ */
+void
+output_init(ScrnInfoPtr pScrn);
+
+
+#endif /* _XORG_TRACKER_H_ */
diff --git a/src/gallium/state_trackers/xorg/xorg_winsys.h b/src/gallium/state_trackers/xorg/xorg_winsys.h
new file mode 100644 (file)
index 0000000..d523080
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Author: Alan Hourihane <alanh@tungstengraphics.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ *
+ */
+
+/*
+ * File with all the junk needed to personalize the a xorg driver.
+ */
+
+#ifndef _XORG_WINSYS_H_
+#define _XORG_WINSYS_H_
+
+#include "xorg-server.h"
+#include "xf86.h"
+#include "xf86Resources.h"
+#include "pciaccess.h"
+
+#ifndef XSERVER_LIBPCIACCESS
+#error "libpciaccess needed"
+#endif
+
+void xorg_tracker_set_functions(ScrnInfoPtr scrn);
+const OptionInfoRec * xorg_tracker_available_options(int chipid, int busid);
+void xorg_tracker_loader_ref_sym_lists(void);
+
+#endif
index 2360a6a94a1efe5db0450e653f90a9a0cad46328..bce5b3f9e0d1a3724aeebec48c6af2f4f4825309 100644 (file)
@@ -1,24 +1,12 @@
+# src/gallium/winsys/Makefile
 TOP = ../../..
 include $(TOP)/configs/current
 
-
 SUBDIRS = $(GALLIUM_WINSYS_DIRS)
 
-
-default: subdirs
-
-
-subdirs:
+default install clean:
        @for dir in $(SUBDIRS) ; do \
                if [ -d $$dir ] ; then \
-                       (cd $$dir && $(MAKE)) || exit 1 ; \
+                       (cd $$dir && $(MAKE) $@) || exit 1; \
                fi \
        done
-
-
-clean:
-       rm -f `find . -name \*.[oa]`
-
-
-# Dummy install target
-install:
index a84fcd8418bc1289ab85db5389905b726b8c12f0..fee01916432fcdee0c618632f69ee33112d0bfd3 100644 (file)
@@ -1,38 +1,12 @@
-# src/gallium/winsys/drm/Makefile
-
+# src/gallium/winsys/Makefile
 TOP = ../../../..
-
 include $(TOP)/configs/current
 
 SUBDIRS = $(GALLIUM_WINSYS_DRM_DIRS)
 
-default: $(TOP)/$(LIB_DIR)/gallium subdirs
-
-
-$(TOP)/$(LIB_DIR)/gallium:
-       -mkdir -p $(TOP)/$(LIB_DIR)/gallium
-
-
-subdirs:
-       @for dir in $(SUBDIRS) ; do \
-               if [ -d $$dir ] ; then \
-                       (cd $$dir && $(MAKE)) || exit 1 ; \
-               fi \
-       done
-
-
-install:
-       @for dir in $(SUBDIRS) ; do \
-               if [ -d $$dir ] ; then \
-                       (cd $$dir && $(MAKE) install) || exit 1 ; \
-               fi \
-       done
-
-
-clean:
+default install clean:
        @for dir in $(SUBDIRS) ; do \
                if [ -d $$dir ] ; then \
-                       (cd $$dir && $(MAKE) clean) ; \
+                       (cd $$dir && $(MAKE) $@) || exit 1; \
                fi \
        done
-       -rm -f common/*.o
index cccf8abdfdab455706e28b6d814519442cf8b01e..9f92cb42072bb436cf71246025adf8734bac27f3 100644 (file)
@@ -79,25 +79,24 @@ SHARED_INCLUDES = \
 
 ##### TARGETS #####
 
-default: depend symlinks $(LIBNAME) $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME) $(LIBNAME_EGL) $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME_EGL)
-
+default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
 $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
-       $(TOP)/bin/mklib -noprefix -o $@ \
+       $(MKLIB) -noprefix -o $@ \
                $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES)  $(WINOBJ) $(DRI_LIB_DEPS) $(DRIVER_EXTRAS)
 
 $(LIBNAME_EGL): $(WINSYS_OBJECTS) $(LIBS)
-       $(TOP)/bin/mklib -o $(LIBNAME_EGL) \
+       $(MKLIB) -o $(LIBNAME_EGL) \
                -linker "$(CC)" \
                -noprefix \
                $(OBJECTS) $(MKLIB_OPTIONS) $(WINSYS_OBJECTS) $(PIPE_DRIVERS) $(WINOBJ) $(DRI_LIB_DEPS) \
                --whole-archive $(LIBS) $(GALLIUM_AUXILIARIES) --no-whole-archive $(DRIVER_EXTRAS)
 
-$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(LIBNAME)
-       $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)/gallium
+$(TOP)/$(LIB_DIR)/gallium:
+       mkdir -p $@
 
-$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME_EGL): $(LIBNAME_EGL)
-       $(INSTALL) $(LIBNAME_EGL) $(TOP)/$(LIB_DIR)/gallium
+$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(LIBNAME) $(TOP)/$(LIB_DIR)/gallium
+       $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)/gallium
 
 depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
        rm -f depend
@@ -118,8 +117,8 @@ clean:
 
 
 install: $(LIBNAME)
-       $(INSTALL) -d $(DRI_DRIVER_INSTALL_DIR)
-       $(INSTALL) -m 755 $(LIBNAME) $(DRI_DRIVER_INSTALL_DIR)
+       $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
+       $(INSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
 
 
 include depend
index eede9fc866c3cb777f44f2ee10d68230877355f0..d8feef6824adb967bb40499e6621bcb8e8ce4e96 100644 (file)
@@ -1,25 +1,12 @@
+# src/gallium/winsys/drm/intel/Makefile
 TOP = ../../../../..
 include $(TOP)/configs/current
 
+SUBDIRS = gem $(GALLIUM_STATE_TRACKERS_DIRS)
 
-SUBDIRS = gem egl
-
-
-default: subdirs
-
-
-subdirs:
+default install clean:
        @for dir in $(SUBDIRS) ; do \
                if [ -d $$dir ] ; then \
-                       (cd $$dir && $(MAKE)) || exit 1 ; \
+                       (cd $$dir && $(MAKE) $@) || exit 1; \
                fi \
        done
-
-
-clean:
-       rm -f `find . -name \*.[oa]`
-       rm -f `find . -name depend`
-
-
-# Dummy install target
-install:
diff --git a/src/gallium/winsys/drm/intel/common/Makefile b/src/gallium/winsys/drm/intel/common/Makefile
deleted file mode 100644 (file)
index bf1a7d6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = inteldrm
-
-C_SOURCES = \
-       intel_be_batchbuffer.c \
-       intel_be_context.c \
-       intel_be_device.c \
-       ws_dri_bufmgr.c \
-       ws_dri_drmpool.c \
-       ws_dri_fencemgr.c \
-       ws_dri_mallocpool.c \
-       ws_dri_slabpool.c
-
-
-include ./Makefile.template
-
-DRIVER_DEFINES = $(shell pkg-config libdrm --cflags \
-                && pkg-config libdrm --atleast-version=2.3.1 \
-                && echo "-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP")
-symlinks:
-
diff --git a/src/gallium/winsys/drm/intel/common/Makefile.template b/src/gallium/winsys/drm/intel/common/Makefile.template
deleted file mode 100644 (file)
index 02ed363..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*-makefile-*-
-
-
-# We still have a dependency on the "dri" buffer manager.  Most likely
-# the interface can be reused in non-dri environments, and also as a
-# frontend to simpler memory managers.
-#
-COMMON_SOURCES = 
-
-OBJECTS = $(C_SOURCES:.c=.o) \
-          $(CPP_SOURCES:.cpp=.o) \
-         $(ASM_SOURCES:.S=.o) 
-
-
-### Include directories
-INCLUDES = \
-       -I. \
-       -I$(TOP)/src/gallium/include \
-       -I$(TOP)/src/gallium/auxiliary \
-       -I$(TOP)/src/gallium/drivers \
-       -I$(TOP)/include \
-        $(DRIVER_INCLUDES)
-
-
-##### RULES #####
-
-.c.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.cpp.o:
-       $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.S.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES)  $< -o $@
-
-
-##### TARGETS #####
-
-default: depend symlinks $(LIBNAME)
-
-
-$(LIBNAME): $(OBJECTS) Makefile Makefile.template
-       $(TOP)/bin/mklib -o $@ -static $(OBJECTS) $(DRIVER_LIBS)
-
-
-depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
-       rm -f depend
-       touch depend
-       $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) \
-               $(ASM_SOURCES) 2> /dev/null
-
-
-# Emacs tags
-tags:
-       etags `find . -name \*.[ch]` `find ../include`
-
-
-# Remove .o and backup files
-clean::
-       -rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
-       -rm -f depend depend.bak
-
-
-include depend
diff --git a/src/gallium/winsys/drm/intel/common/intel_be_batchbuffer.c b/src/gallium/winsys/drm/intel/common/intel_be_batchbuffer.c
deleted file mode 100644 (file)
index bc13a57..0000000
+++ /dev/null
@@ -1,429 +0,0 @@
-
-#include "intel_be_batchbuffer.h"
-#include "intel_be_context.h"
-#include "intel_be_device.h"
-#include <errno.h>
-
-#include "xf86drm.h"
-
-static void
-intel_realloc_relocs(struct intel_be_batchbuffer *batch, int num_relocs)
-{
-    unsigned long size = num_relocs * I915_RELOC0_STRIDE + I915_RELOC_HEADER;
-
-    size *= sizeof(uint32_t);
-    batch->reloc = realloc(batch->reloc, size);
-    batch->reloc_size = num_relocs;
-}
-
-
-void
-intel_be_batchbuffer_reset(struct intel_be_batchbuffer *batch)
-{
-   /*
-    * Get a new, free batchbuffer.
-    */
-    drmBO *bo;
-    struct drm_bo_info_req *req;
-
-   driBOUnrefUserList(batch->list);
-   driBOResetList(batch->list);
-
-   /* base.size is the size available to the i915simple driver */
-   batch->base.size = batch->device->max_batch_size - BATCH_RESERVED;
-   batch->base.actual_size = batch->device->max_batch_size;
-   driBOData(batch->buffer, batch->base.actual_size, NULL, NULL, 0);
-
-   /*
-    * Add the batchbuffer to the validate list.
-    */
-
-   driBOAddListItem(batch->list, batch->buffer,
-                   DRM_BO_FLAG_EXE | DRM_BO_FLAG_MEM_TT,
-                   DRM_BO_FLAG_EXE | DRM_BO_MASK_MEM,
-                   &batch->dest_location, &batch->node);
-
-   req = &batch->node->bo_arg.d.req.bo_req;
-
-   /*
-    * Set up information needed for us to make relocations
-    * relative to the underlying drm buffer objects.
-    */
-
-   driReadLockKernelBO();
-   bo = driBOKernel(batch->buffer);
-   req->presumed_offset = (uint64_t) bo->offset;
-   req->hint = DRM_BO_HINT_PRESUMED_OFFSET;
-   batch->drmBOVirtual = (uint8_t *) bo->virtual;
-   driReadUnlockKernelBO();
-
-   /*
-    * Adjust the relocation buffer size.
-    */
-
-   if (batch->reloc_size > INTEL_MAX_RELOCS ||
-       batch->reloc == NULL)
-     intel_realloc_relocs(batch, INTEL_DEFAULT_RELOCS);
-
-   assert(batch->reloc != NULL);
-   batch->reloc[0] = 0; /* No relocs yet. */
-   batch->reloc[1] = 1; /* Reloc type 1 */
-   batch->reloc[2] = 0; /* Only a single relocation list. */
-   batch->reloc[3] = 0; /* Only a single relocation list. */
-
-   batch->base.map = driBOMap(batch->buffer, DRM_BO_FLAG_WRITE, 0);
-   batch->poolOffset = driBOPoolOffset(batch->buffer);
-   batch->base.ptr = batch->base.map;
-   batch->dirty_state = ~0;
-   batch->nr_relocs = 0;
-   batch->flags = 0;
-   batch->id = 0;//batch->intel->intelScreen->batch_id++;
-}
-
-/*======================================================================
- * Public functions
- */
-struct intel_be_batchbuffer *
-intel_be_batchbuffer_alloc(struct intel_be_context *intel)
-{
-   struct intel_be_batchbuffer *batch = calloc(sizeof(*batch), 1);
-
-   batch->intel = intel;
-   batch->device = intel->device;
-
-   driGenBuffers(intel->device->batchPool, "batchbuffer", 1,
-                 &batch->buffer, 4096,
-                 DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE, 0);
-   batch->last_fence = NULL;
-   batch->list = driBOCreateList(20);
-   batch->reloc = NULL;
-   intel_be_batchbuffer_reset(batch);
-   return batch;
-}
-
-void
-intel_be_batchbuffer_free(struct intel_be_batchbuffer *batch)
-{
-   if (batch->last_fence) {
-      driFenceFinish(batch->last_fence,
-                    DRM_FENCE_TYPE_EXE, FALSE);
-      driFenceUnReference(&batch->last_fence);
-   }
-   if (batch->base.map) {
-      driBOUnmap(batch->buffer);
-      batch->base.map = NULL;
-   }
-   driBOUnReference(batch->buffer);
-   driBOFreeList(batch->list);
-   if (batch->reloc)
-       free(batch->reloc);
-   batch->buffer = NULL;
-   free(batch);
-}
-
-void
-intel_be_offset_relocation(struct intel_be_batchbuffer *batch,
-                       unsigned pre_add,
-                       struct _DriBufferObject *driBO,
-                       uint64_t val_flags,
-                       uint64_t val_mask)
-{
-    int itemLoc;
-    struct _drmBONode *node;
-    uint32_t *reloc;
-    struct drm_bo_info_req *req;
-
-    driBOAddListItem(batch->list, driBO, val_flags, val_mask,
-                    &itemLoc, &node);
-    req = &node->bo_arg.d.req.bo_req;
-
-    if (!(req->hint &  DRM_BO_HINT_PRESUMED_OFFSET)) {
-
-       /*
-        * Stop other threads from tampering with the underlying
-        * drmBO while we're reading its offset.
-        */
-
-       driReadLockKernelBO();
-       req->presumed_offset = (uint64_t) driBOKernel(driBO)->offset;
-       driReadUnlockKernelBO();
-       req->hint = DRM_BO_HINT_PRESUMED_OFFSET;
-    }
-
-    pre_add += driBOPoolOffset(driBO);
-
-    if (batch->nr_relocs == batch->reloc_size)
-       intel_realloc_relocs(batch, batch->reloc_size * 2);
-
-    reloc = batch->reloc +
-       (I915_RELOC_HEADER + batch->nr_relocs * I915_RELOC0_STRIDE);
-
-    reloc[0] = ((uint8_t *)batch->base.ptr - batch->drmBOVirtual);
-    i915_batchbuffer_dword(&batch->base, req->presumed_offset + pre_add);
-    reloc[1] = pre_add;
-    reloc[2] = itemLoc;
-    reloc[3] = batch->dest_location;
-    batch->nr_relocs++;
-}
-
-static void
-i915_drm_copy_reply(const struct drm_bo_info_rep * rep, drmBO * buf)
-{
-    buf->handle = rep->handle;
-    buf->flags = rep->flags;
-    buf->size = rep->size;
-    buf->offset = rep->offset;
-    buf->mapHandle = rep->arg_handle;
-    buf->proposedFlags = rep->proposed_flags;
-    buf->start = rep->buffer_start;
-    buf->fenceFlags = rep->fence_flags;
-    buf->replyFlags = rep->rep_flags;
-    buf->pageAlignment = rep->page_alignment;
-}
-
-static int
-i915_execbuf(struct intel_be_batchbuffer *batch,
-            unsigned int used,
-            boolean ignore_cliprects,
-            drmBOList *list,
-            struct drm_i915_execbuffer *ea)
-{
-// struct intel_be_context *intel = batch->intel;
-   drmBONode *node;
-   drmMMListHead *l;
-   struct drm_i915_op_arg *arg, *first;
-   struct drm_bo_op_req *req;
-   struct drm_bo_info_rep *rep;
-   uint64_t *prevNext = NULL;
-   drmBO *buf;
-   int ret = 0;
-   uint32_t count = 0;
-
-   first = NULL;
-   for (l = list->list.next; l != &list->list; l = l->next) {
-      node = DRMLISTENTRY(drmBONode, l, head);
-
-      arg = &node->bo_arg;
-      req = &arg->d.req;
-
-      if (!first)
-        first = arg;
-
-      if (prevNext)
-        *prevNext = (unsigned long)arg;
-
-      prevNext = &arg->next;
-      req->bo_req.handle = node->buf->handle;
-      req->op = drm_bo_validate;
-      req->bo_req.flags = node->arg0;
-      req->bo_req.mask = node->arg1;
-      req->bo_req.hint |= 0;
-      count++;
-   }
-
-   memset(ea, 0, sizeof(*ea));
-   ea->num_buffers = count;
-   ea->batch.start = batch->poolOffset;
-   ea->batch.used = used;
-#if 0 /* ZZZ JB: no cliprects used */
-   ea->batch.cliprects = intel->pClipRects;
-   ea->batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects;
-   ea->batch.DR1 = 0;
-   ea->batch.DR4 = 0;((((GLuint) intel->drawX) & 0xffff) |
-                  (((GLuint) intel->drawY) << 16));
-#else
-   ea->batch.cliprects = NULL;
-   ea->batch.num_cliprects = 0;
-   ea->batch.DR1 = 0;
-   ea->batch.DR4 = 0;
-#endif
-   ea->fence_arg.flags = DRM_I915_FENCE_FLAG_FLUSHED;
-   ea->ops_list = (unsigned long) first;
-   first->reloc_ptr = (unsigned long) batch->reloc;
-   batch->reloc[0] = batch->nr_relocs;
-
-   //return -EFAULT;
-   do {
-      ret = drmCommandWriteRead(batch->device->fd, DRM_I915_EXECBUFFER, ea,
-                               sizeof(*ea));
-   } while (ret == -EAGAIN);
-
-   if (ret != 0)
-      return ret;
-
-   for (l = list->list.next; l != &list->list; l = l->next) {
-      node = DRMLISTENTRY(drmBONode, l, head);
-      arg = &node->bo_arg;
-      rep = &arg->d.rep.bo_info;
-
-      if (!arg->handled) {
-        return -EFAULT;
-      }
-      if (arg->d.rep.ret)
-        return arg->d.rep.ret;
-
-      buf = node->buf;
-      i915_drm_copy_reply(rep, buf);
-   }
-   return 0;
-}
-
-/* TODO: Push this whole function into bufmgr.
- */
-static struct _DriFenceObject *
-do_flush_locked(struct intel_be_batchbuffer *batch,
-                unsigned int used,
-                boolean ignore_cliprects, boolean allow_unlock)
-{
-   struct intel_be_context *intel = batch->intel;
-   struct _DriFenceObject *fo;
-   drmFence fence;
-   drmBOList *boList;
-   struct drm_i915_execbuffer ea;
-   int ret = 0;
-
-   driBOValidateUserList(batch->list);
-   boList = driGetdrmBOList(batch->list);
-
-#if 0 /* ZZZ JB Allways run */
-   if (!(intel->numClipRects == 0 && !ignore_cliprects)) {
-#else
-   if (1) {
-#endif
-      ret = i915_execbuf(batch, used, ignore_cliprects, boList, &ea);
-   } else {
-     driPutdrmBOList(batch->list);
-     fo = NULL;
-     goto out;
-   }
-   driPutdrmBOList(batch->list);
-   if (ret)
-      abort();
-
-   if (ea.fence_arg.error != 0) {
-
-     /*
-      * The hardware has been idled by the kernel.
-      * Don't fence the driBOs.
-      */
-
-       if (batch->last_fence)
-          driFenceUnReference(&batch->last_fence);
-#if 0 /* ZZZ JB: no _mesa_* funcs in gallium */
-       _mesa_printf("fence error\n");
-#endif
-       batch->last_fence = NULL;
-       fo = NULL;
-       goto out;
-   }
-
-   fence.handle = ea.fence_arg.handle;
-   fence.fence_class = ea.fence_arg.fence_class;
-   fence.type = ea.fence_arg.type;
-   fence.flags = ea.fence_arg.flags;
-   fence.signaled = ea.fence_arg.signaled;
-
-   fo = driBOFenceUserList(batch->device->fenceMgr, batch->list,
-                          "SuperFence", &fence);
-
-   if (driFenceType(fo) & DRM_I915_FENCE_TYPE_RW) {
-       if (batch->last_fence)
-          driFenceUnReference(&batch->last_fence);
-   /*
-       * FIXME: Context last fence??
-       */
-       batch->last_fence = fo;
-       driFenceReference(fo);
-   }
- out:
-#if 0 /* ZZZ JB: fix this */
-   intel->vtbl.lost_hardware(intel);
-#else
-   (void)intel;
-#endif
-   return fo;
-}
-
-
-struct _DriFenceObject *
-intel_be_batchbuffer_flush(struct intel_be_batchbuffer *batch)
-{
-   struct intel_be_context *intel = batch->intel;
-   unsigned int used = batch->base.ptr - batch->base.map;
-   boolean was_locked = batch->intel->hardware_locked(intel);
-   struct _DriFenceObject *fence;
-
-   if (used == 0) {
-      driFenceReference(batch->last_fence);
-      return batch->last_fence;
-   }
-
-   /* Add the MI_BATCH_BUFFER_END.  Always add an MI_FLUSH - this is a
-    * performance drain that we would like to avoid.
-    */
-#if 0 /* ZZZ JB: what should we do here? */
-   if (used & 4) {
-      ((int *) batch->base.ptr)[0] = intel->vtbl.flush_cmd();
-      ((int *) batch->base.ptr)[1] = 0;
-      ((int *) batch->base.ptr)[2] = MI_BATCH_BUFFER_END;
-      used += 12;
-   }
-   else {
-      ((int *) batch->base.ptr)[0] = intel->vtbl.flush_cmd();
-      ((int *) batch->base.ptr)[1] = MI_BATCH_BUFFER_END;
-      used += 8;
-   }
-#else
-   if (used & 4) {
-      ((int *) batch->base.ptr)[0] = ((0<<29)|(4<<23)); // MI_FLUSH;
-      ((int *) batch->base.ptr)[1] = 0;
-      ((int *) batch->base.ptr)[2] = (0xA<<23); // MI_BATCH_BUFFER_END;
-      used += 12;
-   }
-   else {
-      ((int *) batch->base.ptr)[0] = ((0<<29)|(4<<23)); // MI_FLUSH;
-      ((int *) batch->base.ptr)[1] = (0xA<<23); // MI_BATCH_BUFFER_END;
-      used += 8;
-   }
-#endif
-   driBOUnmap(batch->buffer);
-   batch->base.ptr = NULL;
-   batch->base.map = NULL;
-
-   /* TODO: Just pass the relocation list and dma buffer up to the
-    * kernel.
-    */
-   if (!was_locked)
-      intel->hardware_lock(intel);
-
-   fence = do_flush_locked(batch, used, !(batch->flags & INTEL_BATCH_CLIPRECTS),
-                          FALSE);
-
-   if (!was_locked)
-      intel->hardware_unlock(intel);
-
-   /* Reset the buffer:
-    */
-   intel_be_batchbuffer_reset(batch);
-   return fence;
-}
-
-void
-intel_be_batchbuffer_finish(struct intel_be_batchbuffer *batch)
-{
-   struct _DriFenceObject *fence = intel_be_batchbuffer_flush(batch);
-   driFenceFinish(fence, driFenceType(fence), FALSE);
-   driFenceUnReference(&fence);
-}
-
-#if 0
-void
-intel_be_batchbuffer_data(struct intel_be_batchbuffer *batch,
-                       const void *data, unsigned int bytes, unsigned int flags)
-{
-   assert((bytes & 3) == 0);
-   intel_batchbuffer_require_space(batch, bytes, flags);
-   memcpy(batch->base.ptr, data, bytes);
-   batch->base.ptr += bytes;
-}
-#endif
diff --git a/src/gallium/winsys/drm/intel/common/intel_be_batchbuffer.h b/src/gallium/winsys/drm/intel/common/intel_be_batchbuffer.h
deleted file mode 100644 (file)
index f150e3a..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-
-#ifndef INTEL_BE_BATCHBUFFER_H
-#define INTEL_BE_BATCHBUFFER_H
-
-#include "i915simple/i915_batch.h"
-
-#include "ws_dri_bufmgr.h"
-
-#define BATCH_RESERVED 16
-
-#define INTEL_DEFAULT_RELOCS 100
-#define INTEL_MAX_RELOCS 400
-
-#define INTEL_BATCH_NO_CLIPRECTS 0x1
-#define INTEL_BATCH_CLIPRECTS    0x2
-
-struct intel_be_context;
-struct intel_be_device;
-
-struct intel_be_batchbuffer
-{
-       struct i915_batchbuffer base;
-
-       struct intel_be_context *intel;
-       struct intel_be_device *device;
-
-       struct _DriBufferObject *buffer;
-       struct _DriFenceObject *last_fence;
-       uint32_t flags;
-
-       struct _DriBufferList *list;
-       size_t list_count;
-
-       uint32_t *reloc;
-       size_t reloc_size;
-       size_t nr_relocs;
-
-       uint32_t dirty_state;
-       uint32_t id;
-
-       uint32_t poolOffset;
-       uint8_t *drmBOVirtual;
-       struct _drmBONode *node; /* Validation list node for this buffer */
-       int dest_location;     /* Validation list sequence for this buffer */
-};
-
-struct intel_be_batchbuffer *
-intel_be_batchbuffer_alloc(struct intel_be_context *intel);
-
-void
-intel_be_batchbuffer_free(struct intel_be_batchbuffer *batch);
-
-void
-intel_be_batchbuffer_finish(struct intel_be_batchbuffer *batch);
-
-struct _DriFenceObject *
-intel_be_batchbuffer_flush(struct intel_be_batchbuffer *batch);
-
-void
-intel_be_batchbuffer_reset(struct intel_be_batchbuffer *batch);
-
-void
-intel_be_offset_relocation(struct intel_be_batchbuffer *batch,
-                       unsigned pre_add,
-                       struct _DriBufferObject *driBO,
-                       uint64_t val_flags,
-                       uint64_t val_mask);
-
-#endif
diff --git a/src/gallium/winsys/drm/intel/common/intel_be_context.c b/src/gallium/winsys/drm/intel/common/intel_be_context.c
deleted file mode 100644 (file)
index 1af3967..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-
-/*
- * Authors: Jakob Bornecrantz <jakob-at-tungstengraphics.com>
- */
-
-#include "ws_dri_fencemgr.h"
-#include "intel_be_device.h"
-#include "intel_be_context.h"
-#include "intel_be_batchbuffer.h"
-
-static INLINE struct intel_be_context *
-intel_be_context(struct i915_winsys *sws)
-{
-       return (struct intel_be_context *)sws;
-}
-
-/* Simple batchbuffer interface:
- */
-
-static struct i915_batchbuffer*
-intel_i915_batch_get(struct i915_winsys *sws)
-{
-       struct intel_be_context *intel = intel_be_context(sws);
-       return &intel->batch->base;
-}
-
-static void intel_i915_batch_reloc(struct i915_winsys *sws,
-                                  struct pipe_buffer *buf,
-                                  unsigned access_flags,
-                                  unsigned delta)
-{
-       struct intel_be_context *intel = intel_be_context(sws);
-
-       unsigned flags = DRM_BO_FLAG_MEM_TT;
-       unsigned mask = DRM_BO_MASK_MEM;
-
-       if (access_flags & I915_BUFFER_ACCESS_WRITE) {
-               flags |= DRM_BO_FLAG_WRITE;
-               mask |= DRM_BO_FLAG_WRITE;
-       }
-
-       if (access_flags & I915_BUFFER_ACCESS_READ) {
-               flags |= DRM_BO_FLAG_READ;
-               mask |= DRM_BO_FLAG_READ;
-       }
-
-       intel_be_offset_relocation(intel->batch,
-                               delta,
-                               dri_bo(buf),
-                               flags,
-                               mask);
-}
-
-static void intel_i915_batch_flush(struct i915_winsys *sws,
-                                  struct pipe_fence_handle **fence)
-{
-       struct intel_be_context *intel = intel_be_context(sws);
-
-       union {
-               struct _DriFenceObject *dri;
-               struct pipe_fence_handle *pipe;
-       } fu;
-
-       if (fence)
-               assert(!*fence);
-
-       fu.dri = intel_be_batchbuffer_flush(intel->batch);
-
-       if (!fu.dri) {
-               assert(0);
-               *fence = NULL;
-               return;
-       }
-
-       if (fu.dri) {
-               if (fence)
-                       *fence = fu.pipe;
-               else
-                       driFenceUnReference(&fu.dri);
-       }
-
-}
-
-boolean
-intel_be_init_context(struct intel_be_context *intel, struct intel_be_device *device)
-{
-       assert(intel);
-       assert(device);
-
-       intel->device = device;
-
-       /* TODO move framebuffer createion to the driver */
-
-       intel->base.batch_get = intel_i915_batch_get;
-       intel->base.batch_reloc = intel_i915_batch_reloc;
-       intel->base.batch_flush = intel_i915_batch_flush;
-
-       intel->batch = intel_be_batchbuffer_alloc(intel);
-
-       return true;
-}
-
-void
-intel_be_destroy_context(struct intel_be_context *intel)
-{
-       intel_be_batchbuffer_free(intel->batch);
-}
diff --git a/src/gallium/winsys/drm/intel/common/intel_be_context.h b/src/gallium/winsys/drm/intel/common/intel_be_context.h
deleted file mode 100644 (file)
index d5cbc93..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/* These need to be diffrent from the intel winsys */
-#ifndef INTEL_BE_CONTEXT_H
-#define INTEL_BE_CONTEXT_H
-
-#include "i915simple/i915_winsys.h"
-
-struct intel_be_context
-{
-       /** Interface to i915simple driver */
-       struct i915_winsys base;
-
-       struct intel_be_device *device;
-       struct intel_be_batchbuffer *batch;
-
-       /*
-     * Hardware lock functions.
-     *
-     * Needs to be filled in by the winsys.
-     */
-       void (*hardware_lock)(struct intel_be_context *context);
-       void (*hardware_unlock)(struct intel_be_context *context);
-       boolean (*hardware_locked)(struct intel_be_context *context);
-};
-
-/**
- * Intialize a allocated intel_be_context struct.
- *
- * Remember to set the hardware_* functions.
- */
-boolean
-intel_be_init_context(struct intel_be_context *intel,
-                     struct intel_be_device *device);
-
-/**
- * Destroy a intel_be_context.
- * Does not free the struct that is up to the winsys.
- */
-void
-intel_be_destroy_context(struct intel_be_context *intel);
-#endif
diff --git a/src/gallium/winsys/drm/intel/common/intel_be_device.c b/src/gallium/winsys/drm/intel/common/intel_be_device.c
deleted file mode 100644 (file)
index 85ab1a2..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-
-
-/*
- * Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
- *                      Jakob Bornecrantz <jakob-at-tungstengraphics-dot-com>
- */
-
-#include "intel_be_device.h"
-#include "ws_dri_bufmgr.h"
-#include "ws_dri_bufpool.h"
-#include "ws_dri_fencemgr.h"
-
-#include "pipe/internal/p_winsys_screen.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_state.h"
-#include "pipe/p_inlines.h"
-#include "util/u_memory.h"
-
-#include "i915simple/i915_screen.h"
-
-/* Turn a pipe winsys into an intel/pipe winsys:
- */
-static INLINE struct intel_be_device *
-intel_be_device( struct pipe_winsys *winsys )
-{
-       return (struct intel_be_device *)winsys;
-}
-
-
-/*
- * Buffer functions.
- *
- * Most callbacks map direcly onto dri_bufmgr operations:
- */
-
-static void *intel_be_buffer_map(struct pipe_winsys *winsys,
-                                       struct pipe_buffer *buf,
-                                       unsigned flags )
-{
-       unsigned drm_flags = 0;
-       
-       if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
-               drm_flags |= DRM_BO_FLAG_WRITE;
-
-       if (flags & PIPE_BUFFER_USAGE_CPU_READ)
-               drm_flags |= DRM_BO_FLAG_READ;
-
-       return driBOMap( dri_bo(buf), drm_flags, 0 );
-}
-
-static void intel_be_buffer_unmap(struct pipe_winsys *winsys,
-                                        struct pipe_buffer *buf)
-{
-       driBOUnmap( dri_bo(buf) );
-}
-
-static void
-intel_be_buffer_destroy(struct pipe_winsys *winsys,
-                         struct pipe_buffer *buf)
-{
-       driBOUnReference( dri_bo(buf) );
-       FREE(buf);
-}
-
-static struct pipe_buffer *
-intel_be_buffer_create(struct pipe_winsys *winsys,
-                                                 unsigned alignment,
-                                                 unsigned usage,
-                                                 unsigned size )
-{
-       struct intel_be_buffer *buffer = CALLOC_STRUCT( intel_be_buffer );
-       struct intel_be_device *iws = intel_be_device(winsys);
-       unsigned flags = 0;
-       struct _DriBufferPool *pool;
-
-       buffer->base.refcount = 1;
-       buffer->base.alignment = alignment;
-       buffer->base.usage = usage;
-       buffer->base.size = size;
-
-       if (usage & (PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_CONSTANT)) {
-               flags |= DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_CACHED;
-               pool = iws->mallocPool;
-       } else if (usage & PIPE_BUFFER_USAGE_CUSTOM) {
-               /* For vertex buffers */
-               flags |= DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_TT;
-               pool = iws->vertexPool;
-       } else {
-               flags |= DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_TT;
-               pool = iws->regionPool;
-       }
-
-       if (usage & PIPE_BUFFER_USAGE_GPU_READ)
-               flags |= DRM_BO_FLAG_READ;
-
-       if (usage & PIPE_BUFFER_USAGE_GPU_WRITE)
-               flags |= DRM_BO_FLAG_WRITE;
-
-       /* drm complains if we don't set any read/write flags.
-        */
-       if ((flags & (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE)) == 0)
-               flags |= DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE;
-
-       buffer->pool = pool;
-       driGenBuffers( buffer->pool,
-               "pipe buffer", 1, &buffer->driBO, alignment, flags, 0 );
-
-       driBOData( buffer->driBO, size, NULL, buffer->pool, 0 );
-
-       return &buffer->base;
-}
-
-
-static struct pipe_buffer *
-intel_be_user_buffer_create(struct pipe_winsys *winsys, void *ptr, unsigned bytes)
-{
-       struct intel_be_buffer *buffer = CALLOC_STRUCT( intel_be_buffer );
-       struct intel_be_device *iws = intel_be_device(winsys);
-
-       driGenUserBuffer( iws->regionPool,
-                         "pipe user buffer", &buffer->driBO, ptr, bytes );
-
-       buffer->base.refcount = 1;
-
-       return &buffer->base;
-}
-
-struct pipe_buffer *
-intel_be_buffer_from_handle(struct intel_be_device *device,
-                            const char* name, unsigned handle)
-{
-       struct intel_be_buffer *be_buf = malloc(sizeof(*be_buf));
-       struct pipe_buffer *buffer;
-
-       if (!be_buf)
-               goto err;
-
-       memset(be_buf, 0, sizeof(*be_buf));
-
-       driGenBuffers(device->staticPool, name, 1, &be_buf->driBO, 0, 0, 0);
-    driBOSetReferenced(be_buf->driBO, handle);
-
-       if (0) /** XXX TODO check error */
-               goto err_bo;
-       
-       buffer = &be_buf->base;
-       buffer->refcount = 1;
-       buffer->alignment = 0;
-       buffer->usage = 0;
-       buffer->size = driBOSize(be_buf->driBO);
-
-       return buffer;
-err_bo:
-       free(be_buf);
-err:
-       return NULL;
-}
-
-
-static struct pipe_buffer *
-intel_i915_surface_buffer_create(struct pipe_winsys *winsys,
-                                unsigned width, unsigned height,
-                                enum pipe_format format,
-                                unsigned usage,
-                                unsigned *stride)
-{
-       const unsigned alignment = 64;
-       struct pipe_format_block block;
-       unsigned nblocksx, nblocksy;
-
-       pf_get_block(format, &block);
-       nblocksx = pf_get_nblocksx(&block, width);
-       nblocksy = pf_get_nblocksy(&block, height);
-       *stride = round_up(nblocksx * block.size, alignment);
-
-       return winsys->buffer_create(winsys, alignment,
-                                    usage,
-                                    *stride * nblocksy);
-}
-
-
-/*
- * Fence functions
- */
-
-static void
-intel_be_fence_reference( struct pipe_winsys *sws,
-                      struct pipe_fence_handle **ptr,
-                      struct pipe_fence_handle *fence )
-{
-       if (*ptr)
-               driFenceUnReference((struct _DriFenceObject **)ptr);
-
-       if (fence)
-               *ptr = (struct pipe_fence_handle *)driFenceReference((struct _DriFenceObject *)fence);
-}
-
-static int
-intel_be_fence_signalled( struct pipe_winsys *sws,
-                      struct pipe_fence_handle *fence,
-                      unsigned flag )
-{
-       return driFenceSignaled((struct _DriFenceObject *)fence, flag);
-}
-
-static int
-intel_be_fence_finish( struct pipe_winsys *sws,
-                   struct pipe_fence_handle *fence,
-                   unsigned flag )
-{
-       return driFenceFinish((struct _DriFenceObject *)fence, flag, 0);
-}
-
-
-/*
- * Misc functions
- */
-
-boolean
-intel_be_init_device(struct intel_be_device *dev, int fd, unsigned id)
-{
-       dev->fd = fd;
-       dev->max_batch_size = 16 * 4096;
-       dev->max_vertex_size = 128 * 4096;
-
-       dev->base.buffer_create = intel_be_buffer_create;
-       dev->base.user_buffer_create = intel_be_user_buffer_create;
-       dev->base.buffer_map = intel_be_buffer_map;
-       dev->base.buffer_unmap = intel_be_buffer_unmap;
-       dev->base.buffer_destroy = intel_be_buffer_destroy;
-       dev->base.surface_buffer_create = intel_i915_surface_buffer_create;
-       dev->base.fence_reference = intel_be_fence_reference;
-       dev->base.fence_signalled = intel_be_fence_signalled;
-       dev->base.fence_finish = intel_be_fence_finish;
-
-#if 0 /* Set by the winsys */
-       dev->base.flush_frontbuffer = intel_flush_frontbuffer;
-       dev->base.get_name = intel_get_name;
-#endif
-
-       dev->fMan = driInitFreeSlabManager(10, 10);
-       dev->fenceMgr = driFenceMgrTTMInit(dev->fd);
-
-       dev->mallocPool = driMallocPoolInit();
-       dev->staticPool = driDRMPoolInit(dev->fd);
-       /* Sizes: 64 128 256 512 1024 2048 4096 8192 16384 32768 */
-       dev->regionPool = driSlabPoolInit(dev->fd,
-                                         DRM_BO_FLAG_READ |
-                                         DRM_BO_FLAG_WRITE |
-                                         DRM_BO_FLAG_MEM_TT,
-                                         DRM_BO_FLAG_READ |
-                                         DRM_BO_FLAG_WRITE |
-                                         DRM_BO_FLAG_MEM_TT,
-                                         64,
-                                         10, 120, 4096 * 64, 0,
-                                         dev->fMan);
-
-       dev->vertexPool = driSlabPoolInit(dev->fd,
-                                         DRM_BO_FLAG_READ |
-                                         DRM_BO_FLAG_WRITE |
-                                         DRM_BO_FLAG_MEM_TT,
-                                         DRM_BO_FLAG_READ |
-                                         DRM_BO_FLAG_WRITE |
-                                         DRM_BO_FLAG_MEM_TT,
-                                         dev->max_vertex_size,
-                                         1, 120, dev->max_vertex_size * 4, 0,
-                                         dev->fMan);
-
-       dev->batchPool = driSlabPoolInit(dev->fd,
-                                        DRM_BO_FLAG_EXE |
-                                        DRM_BO_FLAG_MEM_TT,
-                                        DRM_BO_FLAG_EXE |
-                                        DRM_BO_FLAG_MEM_TT,
-                                        dev->max_batch_size,
-                                        1, 40, dev->max_batch_size * 16, 0,
-                                        dev->fMan);
-
-       /* Fill in this struct with callbacks that i915simple will need to
-        * communicate with the window system, buffer manager, etc.
-        */
-       dev->screen = i915_create_screen(&dev->base, id);
-
-       return true;
-}
-
-void
-intel_be_destroy_device(struct intel_be_device *dev)
-{
-       driPoolTakeDown(dev->mallocPool);
-       driPoolTakeDown(dev->staticPool);
-       driPoolTakeDown(dev->regionPool);
-       driPoolTakeDown(dev->vertexPool);
-       driPoolTakeDown(dev->batchPool);
-
-       /** TODO takedown fenceMgr and fMan */
-}
diff --git a/src/gallium/winsys/drm/intel/common/intel_be_device.h b/src/gallium/winsys/drm/intel/common/intel_be_device.h
deleted file mode 100644 (file)
index 534d638..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef INTEL_DRM_DEVICE_H
-#define INTEL_DRM_DEVICE_H
-
-#include "pipe/internal/p_winsys_screen.h"
-#include "pipe/p_context.h"
-
-/*
- * Device
- */
-
-struct intel_be_device
-{
-       struct pipe_winsys base;
-
-       /**
-        * Hw level screen
-        */
-       struct pipe_screen *screen;
-
-       int fd; /**< Drm file discriptor */
-
-       size_t max_batch_size;
-       size_t max_vertex_size;
-
-       struct _DriFenceMgr *fenceMgr;
-
-       struct _DriBufferPool *batchPool;
-       struct _DriBufferPool *regionPool;
-       struct _DriBufferPool *mallocPool;
-       struct _DriBufferPool *vertexPool;
-       struct _DriBufferPool *staticPool;
-       struct _DriFreeSlabManager *fMan;
-};
-
-boolean
-intel_be_init_device(struct intel_be_device *device, int fd, unsigned id);
-
-void
-intel_be_destroy_device(struct intel_be_device *dev);
-
-/*
- * Buffer
- */
-
-struct intel_be_buffer {
-       struct pipe_buffer base;
-       struct _DriBufferPool *pool;
-       struct _DriBufferObject *driBO;
-};
-
-/**
- * Create a be buffer from a drm bo handle
- *
- * Takes a reference
- */
-struct pipe_buffer *
-intel_be_buffer_from_handle(struct intel_be_device *device,
-                            const char* name, unsigned handle);
-
-static INLINE struct intel_be_buffer *
-intel_be_buffer(struct pipe_buffer *buf)
-{
-       return (struct intel_be_buffer *)buf;
-}
-
-static INLINE struct _DriBufferObject *
-dri_bo(struct pipe_buffer *buf)
-{
-       return intel_be_buffer(buf)->driBO;
-}
-
-#endif
diff --git a/src/gallium/winsys/drm/intel/common/ws_dri_bufmgr.c b/src/gallium/winsys/drm/intel/common/ws_dri_bufmgr.c
deleted file mode 100644 (file)
index 517a97b..0000000
+++ /dev/null
@@ -1,949 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-/*
- * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
- *          Keith Whitwell <keithw-at-tungstengraphics-dot-com>
- */
-
-#include <xf86drm.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "pipe/p_thread.h"
-#include "errno.h"
-#include "ws_dri_bufmgr.h"
-#include "string.h"
-#include "pipe/p_debug.h"
-#include "ws_dri_bufpool.h"
-#include "ws_dri_fencemgr.h"
-
-
-/*
- * This lock is here to protect drmBO structs changing underneath us during a
- * validate list call, since validatelist cannot take individiual locks for
- * each drmBO. Validatelist takes this lock in write mode. Any access to an
- * individual drmBO should take this lock in read mode, since in that case, the
- * driBufferObject mutex will protect the access. Locking order is
- * driBufferObject mutex - > this rw lock.
- */
-
-pipe_static_mutex(bmMutex);
-pipe_static_condvar(bmCond);
-
-static int kernelReaders = 0;
-static int num_buffers = 0;
-static int num_user_buffers = 0;
-
-static drmBO *drmBOListBuf(void *iterator)
-{
-    drmBONode *node;
-    drmMMListHead *l = (drmMMListHead *) iterator;
-    node = DRMLISTENTRY(drmBONode, l, head);
-    return node->buf;
-}
-
-static void *drmBOListIterator(drmBOList *list)
-{
-    void *ret = list->list.next;
-
-    if (ret == &list->list)
-       return NULL;
-    return ret;
-}
-
-static void *drmBOListNext(drmBOList *list, void *iterator)
-{
-    void *ret;
-
-    drmMMListHead *l = (drmMMListHead *) iterator;
-    ret = l->next;
-    if (ret == &list->list)
-       return NULL;
-    return ret;
-}
-
-static drmBONode *drmAddListItem(drmBOList *list, drmBO *item,
-                                uint64_t arg0,
-                                uint64_t arg1)
-{
-    drmBONode *node;
-    drmMMListHead *l;
-
-    l = list->free.next;
-    if (l == &list->free) {
-       node = (drmBONode *) malloc(sizeof(*node));
-       if (!node) {
-           return NULL;
-       }
-       list->numCurrent++;
-    }
-    else {
-       DRMLISTDEL(l);
-       node = DRMLISTENTRY(drmBONode, l, head);
-    }
-    node->buf = item;
-    node->arg0 = arg0;
-    node->arg1 = arg1;
-    DRMLISTADD(&node->head, &list->list);
-    list->numOnList++;
-    return node;
-}
-
-static int drmAddValidateItem(drmBOList *list, drmBO *buf, uint64_t flags,
-                             uint64_t mask, int *newItem)
-{
-    drmBONode *node, *cur;
-    drmMMListHead *l;
-
-    *newItem = 0;
-    cur = NULL;
-
-    for (l = list->list.next; l != &list->list; l = l->next) {
-       node = DRMLISTENTRY(drmBONode, l, head);
-       if (node->buf == buf) {
-           cur = node;
-           break;
-       }
-    }
-    if (!cur) {
-       cur = drmAddListItem(list, buf, flags, mask);
-       if (!cur) {
-           return -ENOMEM;
-       }
-       *newItem = 1;
-       cur->arg0 = flags;
-       cur->arg1 = mask;
-    }
-    else {
-        uint64_t memFlags = cur->arg0 & flags & DRM_BO_MASK_MEM;
-       uint64_t accFlags = (cur->arg0 | flags) & ~DRM_BO_MASK_MEM;
-
-       if (mask & cur->arg1 & ~DRM_BO_MASK_MEM  & (cur->arg0 ^ flags)) {
-           return -EINVAL;
-       }
-
-       cur->arg1 |= mask;
-       cur->arg0 = (cur->arg0 & ~mask) | ((memFlags | accFlags) & mask);
-
-       if (((cur->arg1 & DRM_BO_MASK_MEM) != 0) &&
-           (cur->arg0 & DRM_BO_MASK_MEM) == 0) {
-           return -EINVAL;
-       }
-    }
-    return 0;
-}
-
-static void drmBOFreeList(drmBOList *list)
-{
-    drmBONode *node;
-    drmMMListHead *l;
-
-    l = list->list.next;
-    while(l != &list->list) {
-       DRMLISTDEL(l);
-       node = DRMLISTENTRY(drmBONode, l, head);
-       free(node);
-       l = list->list.next;
-       list->numCurrent--;
-       list->numOnList--;
-    }
-
-    l = list->free.next;
-    while(l != &list->free) {
-       DRMLISTDEL(l);
-       node = DRMLISTENTRY(drmBONode, l, head);
-       free(node);
-       l = list->free.next;
-       list->numCurrent--;
-    }
-}
-
-static int drmAdjustListNodes(drmBOList *list)
-{
-    drmBONode *node;
-    drmMMListHead *l;
-    int ret = 0;
-
-    while(list->numCurrent < list->numTarget) {
-       node = (drmBONode *) malloc(sizeof(*node));
-       if (!node) {
-           ret = -ENOMEM;
-           break;
-       }
-       list->numCurrent++;
-       DRMLISTADD(&node->head, &list->free);
-    }
-
-    while(list->numCurrent > list->numTarget) {
-       l = list->free.next;
-       if (l == &list->free)
-           break;
-       DRMLISTDEL(l);
-       node = DRMLISTENTRY(drmBONode, l, head);
-       free(node);
-       list->numCurrent--;
-    }
-    return ret;
-}
-
-static int drmBOCreateList(int numTarget, drmBOList *list)
-{
-    DRMINITLISTHEAD(&list->list);
-    DRMINITLISTHEAD(&list->free);
-    list->numTarget = numTarget;
-    list->numCurrent = 0;
-    list->numOnList = 0;
-    return drmAdjustListNodes(list);
-}
-
-static int drmBOResetList(drmBOList *list)
-{
-    drmMMListHead *l;
-    int ret;
-
-    ret = drmAdjustListNodes(list);
-    if (ret)
-       return ret;
-
-    l = list->list.next;
-    while (l != &list->list) {
-       DRMLISTDEL(l);
-       DRMLISTADD(l, &list->free);
-       list->numOnList--;
-       l = list->list.next;
-    }
-    return drmAdjustListNodes(list);
-}
-
-void driWriteLockKernelBO(void)
-{
-    pipe_mutex_lock(bmMutex);
-    while(kernelReaders != 0)
-       pipe_condvar_wait(bmCond, bmMutex);
-}
-
-void driWriteUnlockKernelBO(void)
-{
-    pipe_mutex_unlock(bmMutex);
-}
-
-void driReadLockKernelBO(void)
-{
-    pipe_mutex_lock(bmMutex);
-    kernelReaders++;
-    pipe_mutex_unlock(bmMutex);
-}
-
-void driReadUnlockKernelBO(void)
-{
-    pipe_mutex_lock(bmMutex);
-    if (--kernelReaders == 0)
-       pipe_condvar_broadcast(bmCond);
-    pipe_mutex_unlock(bmMutex);
-}
-
-
-
-
-/*
- * TODO: Introduce fence pools in the same way as
- * buffer object pools.
- */
-
-typedef struct _DriBufferObject
-{
-   DriBufferPool *pool;
-   pipe_mutex mutex;
-   int refCount;
-   const char *name;
-   uint64_t flags;
-   unsigned hint;
-   unsigned alignment;
-   unsigned createdByReference;
-   void *private;
-   /* user-space buffer: */
-   unsigned userBuffer;
-   void *userData;
-   unsigned userSize;
-} DriBufferObject;
-
-typedef struct _DriBufferList {
-    drmBOList drmBuffers;  /* List of kernel buffers needing validation */
-    drmBOList driBuffers;  /* List of user-space buffers needing validation */
-} DriBufferList;
-
-
-void
-bmError(int val, const char *file, const char *function, int line)
-{
-   printf("Fatal video memory manager error \"%s\".\n"
-          "Check kernel logs or set the LIBGL_DEBUG\n"
-          "environment variable to \"verbose\" for more info.\n"
-          "Detected in file %s, line %d, function %s.\n",
-          strerror(-val), file, line, function);
-#ifndef NDEBUG
-   abort();
-#else
-   abort();
-#endif
-}
-
-extern drmBO *
-driBOKernel(struct _DriBufferObject *buf)
-{
-   drmBO *ret;
-
-   driReadLockKernelBO();
-   pipe_mutex_lock(buf->mutex);
-   assert(buf->private != NULL);
-   ret = buf->pool->kernel(buf->pool, buf->private);
-   if (!ret)
-      BM_CKFATAL(-EINVAL);
-   pipe_mutex_unlock(buf->mutex);
-   driReadUnlockKernelBO();
-
-   return ret;
-}
-
-void
-driBOWaitIdle(struct _DriBufferObject *buf, int lazy)
-{
-
-  /*
-   * This function may block. Is it sane to keep the mutex held during
-   * that time??
-   */
-
-   pipe_mutex_lock(buf->mutex);
-   BM_CKFATAL(buf->pool->waitIdle(buf->pool, buf->private, &buf->mutex, lazy));
-   pipe_mutex_unlock(buf->mutex);
-}
-
-void *
-driBOMap(struct _DriBufferObject *buf, unsigned flags, unsigned hint)
-{
-   void *virtual;
-   int retval;
-
-   if (buf->userBuffer) {
-      return buf->userData;
-   }
-
-   pipe_mutex_lock(buf->mutex);
-   assert(buf->private != NULL);
-   retval = buf->pool->map(buf->pool, buf->private, flags, hint,
-                          &buf->mutex, &virtual);
-   pipe_mutex_unlock(buf->mutex);
-
-   return retval == 0 ? virtual : NULL;
-}
-
-void
-driBOUnmap(struct _DriBufferObject *buf)
-{
-   if (buf->userBuffer)
-      return;
-
-   assert(buf->private != NULL);
-   pipe_mutex_lock(buf->mutex);
-   BM_CKFATAL(buf->pool->unmap(buf->pool, buf->private));
-   pipe_mutex_unlock(buf->mutex);
-}
-
-unsigned long
-driBOOffset(struct _DriBufferObject *buf)
-{
-   unsigned long ret;
-
-   assert(buf->private != NULL);
-
-   pipe_mutex_lock(buf->mutex);
-   ret = buf->pool->offset(buf->pool, buf->private);
-   pipe_mutex_unlock(buf->mutex);
-   return ret;
-}
-
-unsigned long
-driBOPoolOffset(struct _DriBufferObject *buf)
-{
-   unsigned long ret;
-
-   assert(buf->private != NULL);
-
-   pipe_mutex_lock(buf->mutex);
-   ret = buf->pool->poolOffset(buf->pool, buf->private);
-   pipe_mutex_unlock(buf->mutex);
-   return ret;
-}
-
-uint64_t
-driBOFlags(struct _DriBufferObject *buf)
-{
-   uint64_t ret;
-
-   assert(buf->private != NULL);
-
-   driReadLockKernelBO();
-   pipe_mutex_lock(buf->mutex);
-   ret = buf->pool->flags(buf->pool, buf->private);
-   pipe_mutex_unlock(buf->mutex);
-   driReadUnlockKernelBO();
-   return ret;
-}
-
-struct _DriBufferObject *
-driBOReference(struct _DriBufferObject *buf)
-{
-   pipe_mutex_lock(buf->mutex);
-   if (++buf->refCount == 1) {
-      pipe_mutex_unlock(buf->mutex);
-      BM_CKFATAL(-EINVAL);
-   }
-   pipe_mutex_unlock(buf->mutex);
-   return buf;
-}
-
-void
-driBOUnReference(struct _DriBufferObject *buf)
-{
-   int tmp;
-
-   if (!buf)
-      return;
-
-   pipe_mutex_lock(buf->mutex);
-   tmp = --buf->refCount;
-   if (!tmp) {
-      pipe_mutex_unlock(buf->mutex);
-      if (buf->private) {
-        if (buf->createdByReference)
-           buf->pool->unreference(buf->pool, buf->private);
-        else
-           buf->pool->destroy(buf->pool, buf->private);
-      }
-      if (buf->userBuffer)
-        num_user_buffers--;
-      else
-        num_buffers--;
-      free(buf);
-   } else
-     pipe_mutex_unlock(buf->mutex);
-
-}
-
-
-int
-driBOData(struct _DriBufferObject *buf,
-          unsigned size, const void *data,
-         DriBufferPool *newPool,
-         uint64_t flags)
-{
-   void *virtual = NULL;
-   int newBuffer;
-   int retval = 0;
-   struct _DriBufferPool *pool;
-
-   assert(!buf->userBuffer); /* XXX just do a memcpy? */
-
-   pipe_mutex_lock(buf->mutex);
-   pool = buf->pool;
-
-   if (pool == NULL && newPool != NULL) {
-       buf->pool = newPool;
-       pool = newPool;
-   }
-   if (newPool == NULL)
-       newPool = pool;
-
-   if (!pool->create) {
-      assert((size_t)"driBOData called on invalid buffer\n" & 0);
-      BM_CKFATAL(-EINVAL);
-   }
-
-   newBuffer = (!buf->private || pool != newPool ||
-               pool->size(pool, buf->private) < size);
-
-   if (!flags)
-       flags = buf->flags;
-
-   if (newBuffer) {
-
-       if (buf->createdByReference) {
-         assert((size_t)"driBOData requiring resizing called on shared buffer.\n" & 0);
-         BM_CKFATAL(-EINVAL);
-       }
-
-       if (buf->private)
-          buf->pool->destroy(buf->pool, buf->private);
-
-       pool = newPool;
-       buf->pool = newPool;
-       buf->private = pool->create(pool, size, flags, DRM_BO_HINT_DONT_FENCE,
-                                 buf->alignment);
-      if (!buf->private)
-         retval = -ENOMEM;
-
-      if (retval == 0)
-         retval = pool->map(pool, buf->private,
-                            DRM_BO_FLAG_WRITE,
-                            DRM_BO_HINT_DONT_BLOCK, &buf->mutex, &virtual);
-   } else if (pool->map(pool, buf->private, DRM_BO_FLAG_WRITE,
-                       DRM_BO_HINT_DONT_BLOCK, &buf->mutex, &virtual)) {
-       /*
-       * Buffer is busy. need to create a new one.
-       */
-
-       void *newBuf;
-
-       newBuf = pool->create(pool, size, flags, DRM_BO_HINT_DONT_FENCE,
-                            buf->alignment);
-       if (newBuf) {
-          buf->pool->destroy(buf->pool, buf->private);
-          buf->private = newBuf;
-       }
-
-       retval = pool->map(pool, buf->private,
-                         DRM_BO_FLAG_WRITE, 0, &buf->mutex, &virtual);
-   } else {
-       uint64_t flag_diff = flags ^ buf->flags;
-
-       /*
-       * We might need to change buffer flags.
-       */
-
-       if (flag_diff){
-          assert(pool->setStatus != NULL);
-          BM_CKFATAL(pool->unmap(pool, buf->private));
-          BM_CKFATAL(pool->setStatus(pool, buf->private, flag_diff,
-                                     buf->flags));
-          if (!data)
-            goto out;
-
-          retval = pool->map(pool, buf->private,
-                             DRM_BO_FLAG_WRITE, 0, &buf->mutex, &virtual);
-       }
-   }
-
-   if (retval == 0) {
-      if (data)
-        memcpy(virtual, data, size);
-
-      BM_CKFATAL(pool->unmap(pool, buf->private));
-   }
-
- out:
-   pipe_mutex_unlock(buf->mutex);
-
-   return retval;
-}
-
-void
-driBOSubData(struct _DriBufferObject *buf,
-             unsigned long offset, unsigned long size, const void *data)
-{
-   void *virtual;
-
-   assert(!buf->userBuffer); /* XXX just do a memcpy? */
-
-   pipe_mutex_lock(buf->mutex);
-   if (size && data) {
-      BM_CKFATAL(buf->pool->map(buf->pool, buf->private,
-                                DRM_BO_FLAG_WRITE, 0, &buf->mutex,
-                               &virtual));
-      memcpy((unsigned char *) virtual + offset, data, size);
-      BM_CKFATAL(buf->pool->unmap(buf->pool, buf->private));
-   }
-   pipe_mutex_unlock(buf->mutex);
-}
-
-void
-driBOGetSubData(struct _DriBufferObject *buf,
-                unsigned long offset, unsigned long size, void *data)
-{
-   void *virtual;
-
-   assert(!buf->userBuffer); /* XXX just do a memcpy? */
-
-   pipe_mutex_lock(buf->mutex);
-   if (size && data) {
-      BM_CKFATAL(buf->pool->map(buf->pool, buf->private,
-                                DRM_BO_FLAG_READ, 0, &buf->mutex, &virtual));
-      memcpy(data, (unsigned char *) virtual + offset, size);
-      BM_CKFATAL(buf->pool->unmap(buf->pool, buf->private));
-   }
-   pipe_mutex_unlock(buf->mutex);
-}
-
-void
-driBOSetReferenced(struct _DriBufferObject *buf,
-                  unsigned long handle)
-{
-   pipe_mutex_lock(buf->mutex);
-   if (buf->private != NULL) {
-      assert((size_t)"Invalid buffer for setReferenced\n" & 0);
-      BM_CKFATAL(-EINVAL);
-
-   }
-   if (buf->pool->reference == NULL) {
-      assert((size_t)"Invalid buffer pool for setReferenced\n" & 0);
-      BM_CKFATAL(-EINVAL);
-   }
-   buf->private = buf->pool->reference(buf->pool, handle);
-   if (!buf->private) {
-      assert((size_t)"Invalid buffer pool for setStatic\n" & 0);
-      BM_CKFATAL(-ENOMEM);
-   }
-   buf->createdByReference = TRUE;
-   buf->flags = buf->pool->kernel(buf->pool, buf->private)->flags;
-   pipe_mutex_unlock(buf->mutex);
-}
-
-int
-driGenBuffers(struct _DriBufferPool *pool,
-              const char *name,
-              unsigned n,
-              struct _DriBufferObject *buffers[],
-              unsigned alignment, uint64_t flags, unsigned hint)
-{
-   struct _DriBufferObject *buf;
-   int i;
-
-   flags = (flags) ? flags : DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_MEM_VRAM |
-      DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE;
-
-   ++num_buffers;
-
-   assert(pool);
-
-   for (i = 0; i < n; ++i) {
-      buf = (struct _DriBufferObject *) calloc(1, sizeof(*buf));
-      if (!buf)
-        return -ENOMEM;
-
-      pipe_mutex_init(buf->mutex);
-      pipe_mutex_lock(buf->mutex);
-      buf->refCount = 1;
-      buf->flags = flags;
-      buf->hint = hint;
-      buf->name = name;
-      buf->alignment = alignment;
-      buf->pool = pool;
-      buf->createdByReference = 0;
-      pipe_mutex_unlock(buf->mutex);
-      buffers[i] = buf;
-   }
-   return 0;
-}
-
-void
-driGenUserBuffer(struct _DriBufferPool *pool,
-                 const char *name,
-                 struct _DriBufferObject **buffers,
-                 void *ptr, unsigned bytes)
-{
-   const unsigned alignment = 1, flags = 0, hint = 0;
-
-   --num_buffers; /* JB: is inced in GenBuffes */
-   driGenBuffers(pool, name, 1, buffers, alignment, flags, hint);
-   ++num_user_buffers;
-
-   (*buffers)->userBuffer = 1;
-   (*buffers)->userData = ptr;
-   (*buffers)->userSize = bytes;
-}
-
-void
-driDeleteBuffers(unsigned n, struct _DriBufferObject *buffers[])
-{
-   int i;
-
-   for (i = 0; i < n; ++i) {
-      driBOUnReference(buffers[i]);
-   }
-}
-
-
-void
-driInitBufMgr(int fd)
-{
-   ;
-}
-
-/*
- * Note that lists are per-context and don't need mutex protection.
- */
-
-struct _DriBufferList *
-driBOCreateList(int target)
-{
-    struct _DriBufferList *list = calloc(sizeof(*list), 1);
-
-    BM_CKFATAL(drmBOCreateList(target, &list->drmBuffers));
-    BM_CKFATAL(drmBOCreateList(target, &list->driBuffers));
-    return list;
-}
-
-int
-driBOResetList(struct _DriBufferList * list)
-{
-    int ret;
-    ret = drmBOResetList(&list->drmBuffers);
-    if (ret)
-       return ret;
-    ret = drmBOResetList(&list->driBuffers);
-    return ret;
-}
-
-void
-driBOFreeList(struct _DriBufferList * list)
-{
-   drmBOFreeList(&list->drmBuffers);
-   drmBOFreeList(&list->driBuffers);
-   free(list);
-}
-
-
-/*
- * Copied from libdrm, because it is needed by driAddValidateItem.
- */
-
-static drmBONode *
-driAddListItem(drmBOList * list, drmBO * item,
-              uint64_t arg0, uint64_t arg1)
-{
-    drmBONode *node;
-    drmMMListHead *l;
-
-    l = list->free.next;
-    if (l == &list->free) {
-       node = (drmBONode *) malloc(sizeof(*node));
-       if (!node) {
-           return NULL;
-       }
-       list->numCurrent++;
-    } else {
-       DRMLISTDEL(l);
-       node = DRMLISTENTRY(drmBONode, l, head);
-    }
-    memset(&node->bo_arg, 0, sizeof(node->bo_arg));
-    node->buf = item;
-    node->arg0 = arg0;
-    node->arg1 = arg1;
-    DRMLISTADDTAIL(&node->head, &list->list);
-    list->numOnList++;
-    return node;
-}
-
-/*
- * Slightly modified version compared to the libdrm version.
- * This one returns the list index of the buffer put on the list.
- */
-
-static int
-driAddValidateItem(drmBOList * list, drmBO * buf, uint64_t flags,
-                  uint64_t mask, int *itemLoc,
-                  struct _drmBONode **pnode)
-{
-    drmBONode *node, *cur;
-    drmMMListHead *l;
-    int count = 0;
-
-    cur = NULL;
-
-    for (l = list->list.next; l != &list->list; l = l->next) {
-       node = DRMLISTENTRY(drmBONode, l, head);
-       if (node->buf == buf) {
-           cur = node;
-           break;
-       }
-       count++;
-    }
-    if (!cur) {
-       cur = driAddListItem(list, buf, flags, mask);
-       if (!cur)
-           return -ENOMEM;
-
-       cur->arg0 = flags;
-       cur->arg1 = mask;
-    } else {
-        uint64_t memFlags = cur->arg0 & flags & DRM_BO_MASK_MEM;
-       uint64_t accFlags = (cur->arg0 | flags) & ~DRM_BO_MASK_MEM;
-
-       if (mask & cur->arg1 & ~DRM_BO_MASK_MEM  & (cur->arg0 ^ flags)) {
-           return -EINVAL;
-       }
-
-       cur->arg1 |= mask;
-       cur->arg0 = (cur->arg0 & ~mask) | ((memFlags | accFlags) & mask);
-
-       if (((cur->arg1 & DRM_BO_MASK_MEM) != 0) &&
-           (cur->arg0 & DRM_BO_MASK_MEM) == 0) {
-           return -EINVAL;
-       }
-    }
-    *itemLoc = count;
-    *pnode = cur;
-    return 0;
-}
-
-
-void
-driBOAddListItem(struct _DriBufferList * list, struct _DriBufferObject *buf,
-                 uint64_t flags, uint64_t mask, int *itemLoc,
-                struct _drmBONode **node)
-{
-   int newItem;
-
-   pipe_mutex_lock(buf->mutex);
-   BM_CKFATAL(driAddValidateItem(&list->drmBuffers,
-                                buf->pool->kernel(buf->pool, buf->private),
-                                 flags, mask, itemLoc, node));
-   BM_CKFATAL(drmAddValidateItem(&list->driBuffers, (drmBO *) buf,
-                                flags, mask, &newItem));
-   if (newItem)
-     buf->refCount++;
-
-   pipe_mutex_unlock(buf->mutex);
-}
-
-drmBOList *driGetdrmBOList(struct _DriBufferList *list)
-{
-       driWriteLockKernelBO();
-       return &list->drmBuffers;
-}
-
-void driPutdrmBOList(struct _DriBufferList *list)
-{
-       driWriteUnlockKernelBO();
-}
-
-
-void
-driBOFence(struct _DriBufferObject *buf, struct _DriFenceObject *fence)
-{
-   pipe_mutex_lock(buf->mutex);
-   if (buf->pool->fence)
-       BM_CKFATAL(buf->pool->fence(buf->pool, buf->private, fence));
-   pipe_mutex_unlock(buf->mutex);
-
-}
-
-void
-driBOUnrefUserList(struct _DriBufferList *list)
-{
-    struct _DriBufferObject *buf;
-    void *curBuf;
-
-    curBuf = drmBOListIterator(&list->driBuffers);
-    while (curBuf) {
-       buf = (struct _DriBufferObject *)drmBOListBuf(curBuf);
-       driBOUnReference(buf);
-       curBuf = drmBOListNext(&list->driBuffers, curBuf);
-    }
-}
-
-struct _DriFenceObject *
-driBOFenceUserList(struct _DriFenceMgr *mgr,
-                  struct _DriBufferList *list, const char *name,
-                  drmFence *kFence)
-{
-    struct _DriFenceObject *fence;
-    struct _DriBufferObject *buf;
-    void *curBuf;
-
-    fence = driFenceCreate(mgr, kFence->fence_class, kFence->type,
-                          kFence, sizeof(*kFence));
-    curBuf = drmBOListIterator(&list->driBuffers);
-
-   /*
-    * User-space fencing callbacks.
-    */
-
-   while (curBuf) {
-        buf = (struct _DriBufferObject *) drmBOListBuf(curBuf);
-       driBOFence(buf, fence);
-       driBOUnReference(buf);
-       curBuf = drmBOListNext(&list->driBuffers, curBuf);
-   }
-
-   driBOResetList(list);
-   return fence;
-}
-
-void
-driBOValidateUserList(struct _DriBufferList * list)
-{
-    void *curBuf;
-    struct _DriBufferObject *buf;
-
-    curBuf = drmBOListIterator(&list->driBuffers);
-
-    /*
-     * User-space validation callbacks.
-     */
-
-    while (curBuf) {
-       buf = (struct _DriBufferObject *) drmBOListBuf(curBuf);
-       pipe_mutex_lock(buf->mutex);
-       if (buf->pool->validate)
-           BM_CKFATAL(buf->pool->validate(buf->pool, buf->private, &buf->mutex));
-       pipe_mutex_unlock(buf->mutex);
-       curBuf = drmBOListNext(&list->driBuffers, curBuf);
-    }
-}
-
-
-void
-driPoolTakeDown(struct _DriBufferPool *pool)
-{
-   pool->takeDown(pool);
-
-}
-
-unsigned long
-driBOSize(struct _DriBufferObject *buf)
-{
-  unsigned long size;
-
-   pipe_mutex_lock(buf->mutex);
-   size = buf->pool->size(buf->pool, buf->private);
-   pipe_mutex_unlock(buf->mutex);
-
-  return size;
-
-}
-
-drmBOList *driBOGetDRMBuffers(struct _DriBufferList *list)
-{
-    return &list->drmBuffers;
-}
-
-drmBOList *driBOGetDRIBuffers(struct _DriBufferList *list)
-{
-    return &list->driBuffers;
-}
-
diff --git a/src/gallium/winsys/drm/intel/common/ws_dri_bufmgr.h b/src/gallium/winsys/drm/intel/common/ws_dri_bufmgr.h
deleted file mode 100644 (file)
index e6c0cff..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-/*
- * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
- *          Keith Whitwell <keithw-at-tungstengraphics-dot-com>
- */
-
-#ifndef _PSB_BUFMGR_H_
-#define _PSB_BUFMGR_H_
-#include <xf86mm.h>
-#include "i915_drm.h"
-#include "ws_dri_fencemgr.h"
-
-typedef struct _drmBONode
-{
-    drmMMListHead head;
-    drmBO *buf;
-    struct drm_i915_op_arg bo_arg;
-    uint64_t arg0;
-    uint64_t arg1;
-} drmBONode;
-
-typedef struct _drmBOList {
-    unsigned numTarget;
-    unsigned numCurrent;
-    unsigned numOnList;
-    drmMMListHead list;
-    drmMMListHead free;
-} drmBOList;
-
-
-struct _DriFenceObject;
-struct _DriBufferObject;
-struct _DriBufferPool;
-struct _DriBufferList;
-
-/*
- * Return a pointer to the libdrm buffer object this DriBufferObject
- * uses.
- */
-
-extern drmBO *driBOKernel(struct _DriBufferObject *buf);
-extern void *driBOMap(struct _DriBufferObject *buf, unsigned flags,
-                      unsigned hint);
-extern void driBOUnmap(struct _DriBufferObject *buf);
-extern unsigned long driBOOffset(struct _DriBufferObject *buf);
-extern unsigned long driBOPoolOffset(struct _DriBufferObject *buf);
-
-extern uint64_t driBOFlags(struct _DriBufferObject *buf);
-extern struct _DriBufferObject *driBOReference(struct _DriBufferObject *buf);
-extern void driBOUnReference(struct _DriBufferObject *buf);
-
-extern int driBOData(struct _DriBufferObject *r_buf,
-                    unsigned size, const void *data,
-                    struct _DriBufferPool *pool, uint64_t flags);
-
-extern void driBOSubData(struct _DriBufferObject *buf,
-                         unsigned long offset, unsigned long size,
-                         const void *data);
-extern void driBOGetSubData(struct _DriBufferObject *buf,
-                            unsigned long offset, unsigned long size,
-                            void *data);
-extern int driGenBuffers(struct _DriBufferPool *pool,
-                        const char *name,
-                        unsigned n,
-                        struct _DriBufferObject *buffers[],
-                        unsigned alignment, uint64_t flags, unsigned hint);
-extern void driGenUserBuffer(struct _DriBufferPool *pool,
-                             const char *name,
-                             struct _DriBufferObject *buffers[],
-                             void *ptr, unsigned bytes);
-extern void driDeleteBuffers(unsigned n, struct _DriBufferObject *buffers[]);
-extern void driInitBufMgr(int fd);
-extern struct _DriBufferList *driBOCreateList(int target);
-extern int driBOResetList(struct _DriBufferList * list);
-extern void driBOAddListItem(struct _DriBufferList * list,
-                            struct _DriBufferObject *buf,
-                             uint64_t flags, uint64_t mask, int *itemLoc,
-                            struct _drmBONode **node);
-
-extern void driBOValidateList(int fd, struct _DriBufferList * list);
-extern void driBOFreeList(struct _DriBufferList * list);
-extern struct _DriFenceObject *driBOFenceUserList(struct _DriFenceMgr *mgr,
-                                                 struct _DriBufferList *list,
-                                                 const char *name,
-                                                 drmFence *kFence);
-extern void driBOUnrefUserList(struct _DriBufferList *list);
-extern void driBOValidateUserList(struct _DriBufferList * list);
-extern drmBOList *driGetdrmBOList(struct _DriBufferList *list);
-extern void driPutdrmBOList(struct _DriBufferList *list);
-
-extern void driBOFence(struct _DriBufferObject *buf,
-                       struct _DriFenceObject *fence);
-
-extern void driPoolTakeDown(struct _DriBufferPool *pool);
-extern void driBOSetReferenced(struct _DriBufferObject *buf,
-                              unsigned long handle);
-unsigned long driBOSize(struct _DriBufferObject *buf);
-extern void driBOWaitIdle(struct _DriBufferObject *buf, int lazy);
-extern void driPoolTakeDown(struct _DriBufferPool *pool);
-
-extern void driReadLockKernelBO(void);
-extern void driReadUnlockKernelBO(void);
-extern void driWriteLockKernelBO(void);
-extern void driWriteUnlockKernelBO(void);
-
-/*
- * For debugging purposes.
- */
-
-extern drmBOList *driBOGetDRMBuffers(struct _DriBufferList *list);
-extern drmBOList *driBOGetDRIBuffers(struct _DriBufferList *list);
-#endif
diff --git a/src/gallium/winsys/drm/intel/common/ws_dri_bufpool.h b/src/gallium/winsys/drm/intel/common/ws_dri_bufpool.h
deleted file mode 100644 (file)
index ad3b6f3..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-/*
- * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
- */
-
-#ifndef _PSB_BUFPOOL_H_
-#define _PSB_BUFPOOL_H_
-
-#include <xf86drm.h>
-#include "pipe/p_thread.h"
-struct _DriFenceObject;
-
-typedef struct _DriBufferPool
-{
-   int fd;
-   int (*map) (struct _DriBufferPool * pool, void *private,
-               unsigned flags, int hint, pipe_mutex *mutex,
-              void **virtual);
-   int (*unmap) (struct _DriBufferPool * pool, void *private);
-   int (*destroy) (struct _DriBufferPool * pool, void *private);
-   unsigned long (*offset) (struct _DriBufferPool * pool, void *private);
-   unsigned long (*poolOffset) (struct _DriBufferPool * pool, void *private);
-   uint64_t (*flags) (struct _DriBufferPool * pool, void *private);
-   unsigned long (*size) (struct _DriBufferPool * pool, void *private);
-   void *(*create) (struct _DriBufferPool * pool, unsigned long size,
-                    uint64_t flags, unsigned hint, unsigned alignment);
-   void *(*reference) (struct _DriBufferPool * pool, unsigned handle);
-   int (*unreference) (struct _DriBufferPool * pool, void *private);
-   int (*fence) (struct _DriBufferPool * pool, void *private,
-                 struct _DriFenceObject * fence);
-   drmBO *(*kernel) (struct _DriBufferPool * pool, void *private);
-   int (*validate) (struct _DriBufferPool * pool, void *private, pipe_mutex *mutex);
-   int (*waitIdle) (struct _DriBufferPool *pool, void *private, pipe_mutex *mutex,
-                   int lazy);
-   int (*setStatus)  (struct _DriBufferPool *pool, void *private,
-                     uint64_t flag_diff, uint64_t old_flags);
-   void (*takeDown) (struct _DriBufferPool * pool);
-   void *data;
-} DriBufferPool;
-
-extern void bmError(int val, const char *file, const char *function,
-                    int line);
-#define BM_CKFATAL(val)                                               \
-  do{                                                         \
-    int tstVal = (val);                                               \
-    if (tstVal)                                               \
-      bmError(tstVal, __FILE__, __FUNCTION__, __LINE__);       \
-  } while(0);
-
-
-/*
- * Builtin pools.
- */
-
-/*
- * Kernel buffer objects. Size in multiples of page size. Page size aligned.
- */
-
-extern struct _DriBufferPool *driDRMPoolInit(int fd);
-extern struct _DriBufferPool *driMallocPoolInit(void);
-
-struct _DriFreeSlabManager;
-extern struct _DriBufferPool * driSlabPoolInit(int fd, uint64_t flags,
-                                              uint64_t validMask,
-                                              uint32_t smallestSize,
-                                              uint32_t numSizes,
-                                              uint32_t desiredNumBuffers,
-                                              uint32_t maxSlabSize,
-                                              uint32_t pageAlignment,
-                                              struct _DriFreeSlabManager *fMan);
-extern void driFinishFreeSlabManager(struct _DriFreeSlabManager *fMan);
-extern struct _DriFreeSlabManager *
-driInitFreeSlabManager(uint32_t checkIntervalMsec, uint32_t slabTimeoutMsec);
-
-
-#endif
diff --git a/src/gallium/winsys/drm/intel/common/ws_dri_drmpool.c b/src/gallium/winsys/drm/intel/common/ws_dri_drmpool.c
deleted file mode 100644 (file)
index 54618b1..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-/*
- * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
- */
-
-#include <xf86drm.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "ws_dri_bufpool.h"
-#include "ws_dri_bufmgr.h"
-#include "assert.h"
-
-/*
- * Buffer pool implementation using DRM buffer objects as DRI buffer objects.
- */
-
-static void *
-pool_create(struct _DriBufferPool *pool,
-            unsigned long size, uint64_t flags, unsigned hint,
-            unsigned alignment)
-{
-   drmBO *buf = (drmBO *) malloc(sizeof(*buf));
-   int ret;
-   unsigned pageSize = getpagesize();
-
-   if (!buf)
-      return NULL;
-
-   if ((alignment > pageSize) && (alignment % pageSize)) {
-      free(buf);
-      return NULL;
-   }
-
-   ret = drmBOCreate(pool->fd, size, alignment / pageSize,
-                    NULL,
-                     flags, hint, buf);
-   if (ret) {
-      free(buf);
-      return NULL;
-   }
-
-   return (void *) buf;
-}
-
-static void *
-pool_reference(struct _DriBufferPool *pool, unsigned handle)
-{
-   drmBO *buf = (drmBO *) malloc(sizeof(*buf));
-   int ret;
-
-   if (!buf)
-      return NULL;
-
-   ret = drmBOReference(pool->fd, handle, buf);
-
-   if (ret) {
-      free(buf);
-      return NULL;
-   }
-
-   return (void *) buf;
-}
-
-static int
-pool_destroy(struct _DriBufferPool *pool, void *private)
-{
-   int ret;
-   drmBO *buf = (drmBO *) private;
-   driReadLockKernelBO();
-   ret = drmBOUnreference(pool->fd, buf);
-   free(buf);
-   driReadUnlockKernelBO();
-   return ret;
-}
-
-static int
-pool_unreference(struct _DriBufferPool *pool, void *private)
-{
-   int ret;
-   drmBO *buf = (drmBO *) private;
-   driReadLockKernelBO();
-   ret = drmBOUnreference(pool->fd, buf);
-   free(buf);
-   driReadUnlockKernelBO();
-   return ret;
-}
-
-static int
-pool_map(struct _DriBufferPool *pool, void *private, unsigned flags,
-         int hint, pipe_mutex *mutex, void **virtual)
-{
-   drmBO *buf = (drmBO *) private;
-   int ret;
-
-   driReadLockKernelBO();
-   ret = drmBOMap(pool->fd, buf, flags, hint, virtual);
-   driReadUnlockKernelBO();
-   return ret;
-}
-
-static int
-pool_unmap(struct _DriBufferPool *pool, void *private)
-{
-   drmBO *buf = (drmBO *) private;
-   int ret;
-
-   driReadLockKernelBO();
-   ret = drmBOUnmap(pool->fd, buf);
-   driReadUnlockKernelBO();
-
-   return ret;
-}
-
-static unsigned long
-pool_offset(struct _DriBufferPool *pool, void *private)
-{
-   drmBO *buf = (drmBO *) private;
-   unsigned long offset;
-
-   driReadLockKernelBO();
-   assert(buf->flags & DRM_BO_FLAG_NO_MOVE);
-   offset = buf->offset;
-   driReadUnlockKernelBO();
-
-   return buf->offset;
-}
-
-static unsigned long
-pool_poolOffset(struct _DriBufferPool *pool, void *private)
-{
-   return 0;
-}
-
-static uint64_t
-pool_flags(struct _DriBufferPool *pool, void *private)
-{
-   drmBO *buf = (drmBO *) private;
-   uint64_t flags;
-
-   driReadLockKernelBO();
-   flags = buf->flags;
-   driReadUnlockKernelBO();
-
-   return flags;
-}
-
-
-static unsigned long
-pool_size(struct _DriBufferPool *pool, void *private)
-{
-   drmBO *buf = (drmBO *) private;
-   unsigned long size;
-
-   driReadLockKernelBO();
-   size = buf->size;
-   driReadUnlockKernelBO();
-
-   return buf->size;
-}
-
-static int
-pool_fence(struct _DriBufferPool *pool, void *private,
-           struct _DriFenceObject *fence)
-{
-   /*
-    * Noop. The kernel handles all fencing.
-    */
-
-   return 0;
-}
-
-static drmBO *
-pool_kernel(struct _DriBufferPool *pool, void *private)
-{
-   return (drmBO *) private;
-}
-
-static int
-pool_waitIdle(struct _DriBufferPool *pool, void *private, pipe_mutex *mutex,
-             int lazy)
-{
-   drmBO *buf = (drmBO *) private;
-   int ret;
-
-   driReadLockKernelBO();
-   ret = drmBOWaitIdle(pool->fd, buf, (lazy) ? DRM_BO_HINT_WAIT_LAZY:0);
-   driReadUnlockKernelBO();
-
-   return ret;
-}
-
-
-static void
-pool_takedown(struct _DriBufferPool *pool)
-{
-   free(pool);
-}
-
-/*static int
-pool_setStatus(struct _DriBufferPool *pool, void *private,
-              uint64_t flag_diff, uint64_t old_flags)
-{
-   drmBO *buf = (drmBO *) private;
-   uint64_t new_flags = old_flags ^ flag_diff;
-   int ret;
-
-   driReadLockKernelBO();
-   ret = drmBOSetStatus(pool->fd, buf, new_flags, flag_diff,
-                       0, 0, 0);
-   driReadUnlockKernelBO();
-   return ret;
-}*/
-
-struct _DriBufferPool *
-driDRMPoolInit(int fd)
-{
-   struct _DriBufferPool *pool;
-
-   pool = (struct _DriBufferPool *) malloc(sizeof(*pool));
-
-   if (!pool)
-      return NULL;
-
-   pool->fd = fd;
-   pool->map = &pool_map;
-   pool->unmap = &pool_unmap;
-   pool->destroy = &pool_destroy;
-   pool->offset = &pool_offset;
-   pool->poolOffset = &pool_poolOffset;
-   pool->flags = &pool_flags;
-   pool->size = &pool_size;
-   pool->create = &pool_create;
-   pool->fence = &pool_fence;
-   pool->kernel = &pool_kernel;
-   pool->validate = NULL;
-   pool->waitIdle = &pool_waitIdle;
-   pool->takeDown = &pool_takedown;
-   pool->reference = &pool_reference;
-   pool->unreference = &pool_unreference;
-   pool->data = NULL;
-   return pool;
-}
diff --git a/src/gallium/winsys/drm/intel/common/ws_dri_fencemgr.c b/src/gallium/winsys/drm/intel/common/ws_dri_fencemgr.c
deleted file mode 100644 (file)
index 831c75d..0000000
+++ /dev/null
@@ -1,377 +0,0 @@
-#include "ws_dri_fencemgr.h"
-#include "pipe/p_thread.h"
-#include <xf86mm.h>
-#include <string.h>
-#include <unistd.h>
-
-/*
- * Note: Locking order is
- * _DriFenceObject::mutex
- * _DriFenceMgr::mutex
- */
-
-struct _DriFenceMgr {
-    /*
-     * Constant members. Need no mutex protection.
-     */
-    struct _DriFenceMgrCreateInfo info;
-    void *private;
-
-    /*
-     * These members are protected by this->mutex
-     */
-    pipe_mutex mutex;
-    int refCount;
-    drmMMListHead *heads;
-    int num_fences;
-};
-
-struct _DriFenceObject {
-
-    /*
-     * These members are constant and need no mutex protection.
-     */
-    struct _DriFenceMgr *mgr;
-    uint32_t fence_class;
-    uint32_t fence_type;
-
-    /*
-     * These members are protected by mgr->mutex.
-     */
-    drmMMListHead head;
-    int refCount;
-
-    /*
-     * These members are protected by this->mutex.
-     */
-    pipe_mutex mutex;
-    uint32_t signaled_type;
-    void *private;
-};
-
-uint32_t
-driFenceType(struct _DriFenceObject *fence)
-{
-  return fence->fence_type;
-}
-
-struct _DriFenceMgr *
-driFenceMgrCreate(const struct _DriFenceMgrCreateInfo *info)
-{
-  struct _DriFenceMgr *tmp;
-  uint32_t i;
-
-  tmp = calloc(1, sizeof(*tmp));
-  if (!tmp)
-      return NULL;
-
-  pipe_mutex_init(tmp->mutex);
-  pipe_mutex_lock(tmp->mutex);
-  tmp->refCount = 1;
-  tmp->info = *info;
-  tmp->num_fences = 0;
-  tmp->heads = calloc(tmp->info.num_classes, sizeof(*tmp->heads));
-  if (!tmp->heads)
-      goto out_err;
-
-  for (i=0; i<tmp->info.num_classes; ++i) {
-      DRMINITLISTHEAD(&tmp->heads[i]);
-  }
-  pipe_mutex_unlock(tmp->mutex);
-  return tmp;
-
-  out_err:
-  if (tmp)
-      free(tmp);
-  return NULL;
-}
-
-static void
-driFenceMgrUnrefUnlock(struct _DriFenceMgr **pMgr)
-{
-    struct _DriFenceMgr *mgr = *pMgr;
-
-    *pMgr = NULL;
-    if (--mgr->refCount == 0)
-       free(mgr);
-    else
-       pipe_mutex_unlock(mgr->mutex);
-}
-
-void
-driFenceMgrUnReference(struct _DriFenceMgr **pMgr)
-{
-    pipe_mutex_lock((*pMgr)->mutex);
-    driFenceMgrUnrefUnlock(pMgr);
-}
-
-static void
-driFenceUnReferenceLocked(struct _DriFenceObject **pFence)
-{
-    struct _DriFenceObject *fence = *pFence;
-    struct _DriFenceMgr *mgr = fence->mgr;
-
-    *pFence = NULL;
-    if (--fence->refCount == 0) {
-       DRMLISTDELINIT(&fence->head);
-       if (fence->private)
-           mgr->info.unreference(mgr, &fence->private);
-    --mgr->num_fences;
-       fence->mgr = NULL;
-       --mgr->refCount;
-       free(fence);
-
-    }
-}
-
-
-static void
-driSignalPreviousFencesLocked(struct _DriFenceMgr *mgr,
-                             drmMMListHead *list,
-                             uint32_t fence_class,
-                             uint32_t fence_type)
-{
-    struct _DriFenceObject *entry;
-    drmMMListHead *prev;
-
-    while(list != &mgr->heads[fence_class]) {
-       entry = DRMLISTENTRY(struct _DriFenceObject, list, head);
-
-       /*
-        * Up refcount so that entry doesn't disappear from under us
-        * when we unlock-relock mgr to get the correct locking order.
-        */
-
-       ++entry->refCount;
-       pipe_mutex_unlock(mgr->mutex);
-       pipe_mutex_lock(entry->mutex);
-       pipe_mutex_lock(mgr->mutex);
-
-       prev = list->prev;
-
-
-
-       if (list->prev == list) {
-
-               /*
-                * Somebody else removed the entry from the list.
-                */
-
-               pipe_mutex_unlock(entry->mutex);
-               driFenceUnReferenceLocked(&entry);
-               return;
-       }
-
-       entry->signaled_type |= (fence_type & entry->fence_type);
-       if (entry->signaled_type == entry->fence_type) {
-           DRMLISTDELINIT(list);
-           mgr->info.unreference(mgr, &entry->private);
-       }
-       pipe_mutex_unlock(entry->mutex);
-       driFenceUnReferenceLocked(&entry);
-       list = prev;
-    }
-}
-
-
-int
-driFenceFinish(struct _DriFenceObject *fence, uint32_t fence_type,
-              int lazy_hint)
-{
-    struct _DriFenceMgr *mgr = fence->mgr;
-    int ret = 0;
-
-    pipe_mutex_lock(fence->mutex);
-
-    if ((fence->signaled_type & fence_type) == fence_type)
-       goto out0;
-
-    ret = mgr->info.finish(mgr, fence->private, fence_type, lazy_hint);
-    if (ret)
-       goto out0;
-
-    pipe_mutex_lock(mgr->mutex);
-    pipe_mutex_unlock(fence->mutex);
-
-    driSignalPreviousFencesLocked(mgr, &fence->head, fence->fence_class,
-                                 fence_type);
-    pipe_mutex_unlock(mgr->mutex);
-    return 0;
-
-  out0:
-    pipe_mutex_unlock(fence->mutex);
-    return ret;
-}
-
-uint32_t driFenceSignaledTypeCached(struct _DriFenceObject *fence)
-{
-    uint32_t ret;
-
-    pipe_mutex_lock(fence->mutex);
-    ret = fence->signaled_type;
-    pipe_mutex_unlock(fence->mutex);
-
-    return ret;
-}
-
-int
-driFenceSignaledType(struct _DriFenceObject *fence, uint32_t flush_type,
-                uint32_t *signaled)
-{
-    int ret = 0;
-    struct _DriFenceMgr *mgr;
-
-    pipe_mutex_lock(fence->mutex);
-    mgr = fence->mgr;
-    *signaled = fence->signaled_type;
-    if ((fence->signaled_type & flush_type) == flush_type)
-       goto out0;
-
-    ret = mgr->info.signaled(mgr, fence->private, flush_type, signaled);
-    if (ret) {
-       *signaled = fence->signaled_type;
-       goto out0;
-    }
-
-    if ((fence->signaled_type | *signaled) == fence->signaled_type)
-       goto out0;
-
-    pipe_mutex_lock(mgr->mutex);
-    pipe_mutex_unlock(fence->mutex);
-
-    driSignalPreviousFencesLocked(mgr, &fence->head, fence->fence_class,
-                                 *signaled);
-
-    pipe_mutex_unlock(mgr->mutex);
-    return 0;
-  out0:
-    pipe_mutex_unlock(fence->mutex);
-    return ret;
-}
-
-struct _DriFenceObject *
-driFenceReference(struct _DriFenceObject *fence)
-{
-    pipe_mutex_lock(fence->mgr->mutex);
-    ++fence->refCount;
-    pipe_mutex_unlock(fence->mgr->mutex);
-    return fence;
-}
-
-void
-driFenceUnReference(struct _DriFenceObject **pFence)
-{
-    struct _DriFenceMgr *mgr;
-
-    if (*pFence == NULL)
-       return;
-
-    mgr = (*pFence)->mgr;
-    pipe_mutex_lock(mgr->mutex);
-    ++mgr->refCount;
-    driFenceUnReferenceLocked(pFence);
-    driFenceMgrUnrefUnlock(&mgr);
-}
-
-struct _DriFenceObject
-*driFenceCreate(struct _DriFenceMgr *mgr, uint32_t fence_class,
-               uint32_t fence_type, void *private, size_t private_size)
-{
-    struct _DriFenceObject *fence;
-    size_t fence_size = sizeof(*fence);
-
-    if (private_size)
-       fence_size = ((fence_size + 15) & ~15);
-
-    fence = calloc(1, fence_size + private_size);
-
-    if (!fence) {
-       int ret = mgr->info.finish(mgr, private, fence_type, 0);
-
-       if (ret)
-           usleep(10000000);
-
-       return NULL;
-    }
-
-    pipe_mutex_init(fence->mutex);
-    pipe_mutex_lock(fence->mutex);
-    pipe_mutex_lock(mgr->mutex);
-    fence->refCount = 1;
-    DRMLISTADDTAIL(&fence->head, &mgr->heads[fence_class]);
-    fence->mgr = mgr;
-    ++mgr->refCount;
-    ++mgr->num_fences;
-    pipe_mutex_unlock(mgr->mutex);
-    fence->fence_class = fence_class;
-    fence->fence_type = fence_type;
-    fence->signaled_type = 0;
-    fence->private = private;
-    if (private_size) {
-        fence->private = (void *)(((uint8_t *) fence) + fence_size);
-       memcpy(fence->private, private, private_size);
-    }
-
-    pipe_mutex_unlock(fence->mutex);
-    return fence;
-}
-
-
-static int
-tSignaled(struct _DriFenceMgr *mgr, void *private, uint32_t flush_type,
-         uint32_t *signaled_type)
-{
-  long fd = (long) mgr->private;
-  int dummy;
-  drmFence *fence = (drmFence *) private;
-  int ret;
-
-  *signaled_type = 0;
-  ret = drmFenceSignaled((int) fd, fence, flush_type, &dummy);
-  if (ret)
-    return ret;
-
-  *signaled_type = fence->signaled;
-
-  return 0;
-}
-
-static int
-tFinish(struct _DriFenceMgr *mgr, void *private, uint32_t fence_type,
-       int lazy_hint)
-{
-  long fd = (long) mgr->private;
-  unsigned flags = lazy_hint ? DRM_FENCE_FLAG_WAIT_LAZY : 0;
-
-  return drmFenceWait((int)fd, flags, (drmFence *) private, fence_type);
-}
-
-static int
-tUnref(struct _DriFenceMgr *mgr, void **private)
-{
-  long fd = (long) mgr->private;
-  drmFence *fence = (drmFence *) *private;
-  *private = NULL;
-
-  return drmFenceUnreference(fd, fence);
-}
-
-struct _DriFenceMgr *driFenceMgrTTMInit(int fd)
-{
-  struct _DriFenceMgrCreateInfo info;
-  struct _DriFenceMgr *mgr;
-
-  info.flags = DRI_FENCE_CLASS_ORDERED;
-  info.num_classes = 4;
-  info.signaled = tSignaled;
-  info.finish = tFinish;
-  info.unreference = tUnref;
-
-  mgr = driFenceMgrCreate(&info);
-  if (mgr == NULL)
-    return NULL;
-
-  mgr->private = (void *) (long) fd;
-  return mgr;
-}
-
diff --git a/src/gallium/winsys/drm/intel/common/ws_dri_fencemgr.h b/src/gallium/winsys/drm/intel/common/ws_dri_fencemgr.h
deleted file mode 100644 (file)
index 4ea58df..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-#ifndef DRI_FENCEMGR_H
-#define DRI_FENCEMGR_H
-
-#include <stdint.h>
-#include <stdlib.h>
-
-struct _DriFenceObject;
-struct _DriFenceMgr;
-
-/*
- * Do a quick check to see if the fence manager has registered the fence
- * object as signaled. Note that this function may return a false negative
- * answer.
- */
-extern uint32_t driFenceSignaledTypeCached(struct _DriFenceObject *fence);
-
-/*
- * Check if the fence object is signaled. This function can be substantially
- * more expensive to call than the above function, but will not return a false
- * negative answer. The argument "flush_type" sets the types that the
- * underlying mechanism must make sure will eventually signal.
- */
-extern int driFenceSignaledType(struct _DriFenceObject *fence,
-                               uint32_t flush_type, uint32_t *signaled);
-
-/*
- * Convenience functions.
- */
-
-static inline int driFenceSignaled(struct _DriFenceObject *fence,
-                                  uint32_t flush_type)
-{
-    uint32_t signaled_types;
-    int ret = driFenceSignaledType(fence, flush_type, &signaled_types);
-    if (ret)
-       return 0;
-    return ((signaled_types & flush_type) == flush_type);
-}
-
-static inline int driFenceSignaledCached(struct _DriFenceObject *fence,
-                                        uint32_t flush_type)
-{
-    uint32_t signaled_types =
-       driFenceSignaledTypeCached(fence);
-
-    return ((signaled_types & flush_type) == flush_type);
-}
-
-/*
- * Reference a fence object.
- */
-extern struct _DriFenceObject *driFenceReference(struct _DriFenceObject *fence);
-
-/*
- * Unreference a fence object. The fence object pointer will be reset to NULL.
- */
-
-extern void driFenceUnReference(struct _DriFenceObject **pFence);
-
-
-/*
- * Wait for a fence to signal the indicated fence_type.
- * If "lazy_hint" is true, it indicates that the wait may sleep to avoid
- * busy-wait polling.
- */
-extern int driFenceFinish(struct _DriFenceObject *fence, uint32_t fence_type,
-                         int lazy_hint);
-
-/*
- * Create a DriFenceObject for manager "mgr".
- *
- * "private" is a pointer that should be used for the callbacks in
- * struct _DriFenceMgrCreateInfo.
- *
- * if private_size is nonzero, then the info stored at *private, with size
- * private size will be copied and the fence manager will instead use a
- * pointer to the copied data for the callbacks in
- * struct _DriFenceMgrCreateInfo. In that case, the object pointed to by
- * "private" may be destroyed after the call to driFenceCreate.
- */
-extern struct _DriFenceObject *driFenceCreate(struct _DriFenceMgr *mgr,
-                                             uint32_t fence_class,
-                                             uint32_t fence_type,
-                                             void *private,
-                                             size_t private_size);
-
-extern uint32_t driFenceType(struct _DriFenceObject *fence);
-
-/*
- * Fence creations are ordered. If a fence signals a fence_type,
- * it is safe to assume that all fences of the same class that was
- * created before that fence has signaled the same type.
- */
-
-#define DRI_FENCE_CLASS_ORDERED (1 << 0)
-
-struct _DriFenceMgrCreateInfo {
-    uint32_t flags;
-    uint32_t num_classes;
-    int (*signaled) (struct _DriFenceMgr *mgr, void *private, uint32_t flush_type,
-                    uint32_t *signaled_type);
-    int (*finish) (struct _DriFenceMgr *mgr, void *private, uint32_t fence_type, int lazy_hint);
-    int (*unreference) (struct _DriFenceMgr *mgr, void **private);
-};
-
-extern struct _DriFenceMgr *
-driFenceMgrCreate(const struct _DriFenceMgrCreateInfo *info);
-
-void
-driFenceMgrUnReference(struct _DriFenceMgr **pMgr);
-
-extern struct _DriFenceMgr *
-driFenceMgrTTMInit(int fd);
-
-#endif
diff --git a/src/gallium/winsys/drm/intel/common/ws_dri_mallocpool.c b/src/gallium/winsys/drm/intel/common/ws_dri_mallocpool.c
deleted file mode 100644 (file)
index 60924ea..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-/*
- * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
- */
-
-#include <xf86drm.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "pipe/p_debug.h"
-#include "pipe/p_thread.h"
-#include "ws_dri_bufpool.h"
-#include "ws_dri_bufmgr.h"
-
-static void *
-pool_create(struct _DriBufferPool *pool,
-            unsigned long size, uint64_t flags, unsigned hint,
-            unsigned alignment)
-{
-    unsigned long *private = malloc(size + 2*sizeof(unsigned long));
-    if ((flags & DRM_BO_MASK_MEM) != DRM_BO_FLAG_MEM_LOCAL)
-      abort();
-
-    *private = size;
-    return (void *)private;
-}
-
-
-static int
-pool_destroy(struct _DriBufferPool *pool, void *private)
-{
-    free(private);
-    return 0;
-}
-
-static int
-pool_waitIdle(struct _DriBufferPool *pool, void *private,
-             pipe_mutex *mutex, int lazy)
-{
-    return 0;
-}
-
-static int
-pool_map(struct _DriBufferPool *pool, void *private, unsigned flags,
-         int hint, pipe_mutex *mutex, void **virtual)
-{
-    *virtual = (void *)((unsigned long *)private + 2);
-    return 0;
-}
-
-static int
-pool_unmap(struct _DriBufferPool *pool, void *private)
-{
-    return 0;
-}
-
-static unsigned long
-pool_offset(struct _DriBufferPool *pool, void *private)
-{
-    /*
-     * BUG
-     */
-    abort();
-    return 0UL;
-}
-
-static unsigned long
-pool_poolOffset(struct _DriBufferPool *pool, void *private)
-{
-    /*
-     * BUG
-     */
-    abort();
-}
-
-static uint64_t
-pool_flags(struct _DriBufferPool *pool, void *private)
-{
-    return DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_CACHED;
-}
-
-static unsigned long
-pool_size(struct _DriBufferPool *pool, void *private)
-{
-    return *(unsigned long *) private;
-}
-
-
-static int
-pool_fence(struct _DriBufferPool *pool, void *private,
-           struct _DriFenceObject *fence)
-{
-    abort();
-    return 0UL;
-}
-
-static drmBO *
-pool_kernel(struct _DriBufferPool *pool, void *private)
-{
-    abort();
-    return NULL;
-}
-
-static void
-pool_takedown(struct _DriBufferPool *pool)
-{
-    free(pool);
-}
-
-
-struct _DriBufferPool *
-driMallocPoolInit(void)
-{
-   struct _DriBufferPool *pool;
-
-   pool = (struct _DriBufferPool *) malloc(sizeof(*pool));
-   if (!pool)
-       return NULL;
-
-   pool->data = NULL;
-   pool->fd = -1;
-   pool->map = &pool_map;
-   pool->unmap = &pool_unmap;
-   pool->destroy = &pool_destroy;
-   pool->offset = &pool_offset;
-   pool->poolOffset = &pool_poolOffset;
-   pool->flags = &pool_flags;
-   pool->size = &pool_size;
-   pool->create = &pool_create;
-   pool->fence = &pool_fence;
-   pool->kernel = &pool_kernel;
-   pool->validate = NULL;
-   pool->waitIdle = &pool_waitIdle;
-   pool->takeDown = &pool_takedown;
-   return pool;
-}
diff --git a/src/gallium/winsys/drm/intel/common/ws_dri_slabpool.c b/src/gallium/winsys/drm/intel/common/ws_dri_slabpool.c
deleted file mode 100644 (file)
index 391cea5..0000000
+++ /dev/null
@@ -1,968 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-/*
- * Authors: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
- */
-
-#include <stdint.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <unistd.h>
-#include <assert.h>
-#include "ws_dri_bufpool.h"
-#include "ws_dri_fencemgr.h"
-#include "ws_dri_bufmgr.h"
-#include "pipe/p_thread.h"
-
-#define DRI_SLABPOOL_ALLOC_RETRIES 100
-
-struct _DriSlab;
-
-struct _DriSlabBuffer {
-    int isSlabBuffer;
-    drmBO *bo;
-    struct _DriFenceObject *fence;
-    struct _DriSlab *parent;
-    drmMMListHead head;
-    uint32_t mapCount;
-    uint32_t start;
-    uint32_t fenceType;
-    int unFenced;
-    pipe_condvar event;
-};
-
-struct _DriKernelBO {
-    int fd;
-    drmBO bo;
-    drmMMListHead timeoutHead;
-    drmMMListHead head;
-    struct timeval timeFreed;
-    uint32_t pageAlignment;
-    void *virtual;
-};
-
-struct _DriSlab{
-    drmMMListHead head;
-    drmMMListHead freeBuffers;
-    uint32_t numBuffers;
-    uint32_t numFree;
-    struct _DriSlabBuffer *buffers;
-    struct _DriSlabSizeHeader *header;
-    struct _DriKernelBO *kbo;
-};
-
-
-struct _DriSlabSizeHeader {
-    drmMMListHead slabs;
-    drmMMListHead freeSlabs;
-    drmMMListHead delayedBuffers;
-    uint32_t numDelayed;
-    struct _DriSlabPool *slabPool;
-    uint32_t bufSize;
-    pipe_mutex mutex;
-};
-
-struct _DriFreeSlabManager {
-    struct timeval slabTimeout;
-    struct timeval checkInterval;
-    struct timeval nextCheck;
-    drmMMListHead timeoutList;
-    drmMMListHead unCached;
-    drmMMListHead cached;
-    pipe_mutex mutex;
-};
-
-
-struct _DriSlabPool {
-
-    /*
-     * The data of this structure remains constant after
-     * initialization and thus needs no mutex protection.
-     */
-
-    struct _DriFreeSlabManager *fMan;
-    uint64_t proposedFlags;
-    uint64_t validMask;
-    uint32_t *bucketSizes;
-    uint32_t numBuckets;
-    uint32_t pageSize;
-    int fd;
-    int pageAlignment;
-    int maxSlabSize;
-    int desiredNumBuffers;
-    struct _DriSlabSizeHeader *headers;
-};
-
-/*
- * FIXME: Perhaps arrange timeout slabs in size buckets for fast
- * retreival??
- */
-
-
-static inline int
-driTimeAfterEq(struct timeval *arg1, struct timeval *arg2)
-{
-    return ((arg1->tv_sec > arg2->tv_sec) ||
-           ((arg1->tv_sec == arg2->tv_sec) &&
-            (arg1->tv_usec > arg2->tv_usec)));
-}
-
-static inline void
-driTimeAdd(struct timeval *arg, struct timeval *add)
-{
-    unsigned int sec;
-
-    arg->tv_sec += add->tv_sec;
-    arg->tv_usec += add->tv_usec;
-    sec = arg->tv_usec / 1000000;
-    arg->tv_sec += sec;
-    arg->tv_usec -= sec*1000000;
-}
-
-static void
-driFreeKernelBO(struct _DriKernelBO *kbo)
-{
-    if (!kbo)
-       return;
-
-    (void) drmBOUnreference(kbo->fd, &kbo->bo);
-    free(kbo);
-}
-
-
-static void
-driFreeTimeoutKBOsLocked(struct _DriFreeSlabManager *fMan,
-                        struct timeval *time)
-{
-    drmMMListHead *list, *next;
-    struct _DriKernelBO *kbo;
-
-    if (!driTimeAfterEq(time, &fMan->nextCheck))
-       return;
-
-    for (list = fMan->timeoutList.next, next = list->next;
-        list != &fMan->timeoutList;
-        list = next, next = list->next) {
-
-       kbo = DRMLISTENTRY(struct _DriKernelBO, list, timeoutHead);
-
-       if (!driTimeAfterEq(time, &kbo->timeFreed))
-           break;
-
-       DRMLISTDELINIT(&kbo->timeoutHead);
-       DRMLISTDELINIT(&kbo->head);
-       driFreeKernelBO(kbo);
-    }
-
-    fMan->nextCheck = *time;
-    driTimeAdd(&fMan->nextCheck, &fMan->checkInterval);
-}
-
-
-/*
- * Add a _DriKernelBO to the free slab manager.
- * This means that it is available for reuse, but if it's not
- * reused in a while, it will be freed.
- */
-
-static void
-driSetKernelBOFree(struct _DriFreeSlabManager *fMan,
-                  struct _DriKernelBO *kbo)
-{
-    struct timeval time;
-
-    pipe_mutex_lock(fMan->mutex);
-    gettimeofday(&time, NULL);
-    driTimeAdd(&time, &fMan->slabTimeout);
-
-    kbo->timeFreed = time;
-
-    if (kbo->bo.flags & DRM_BO_FLAG_CACHED)
-       DRMLISTADD(&kbo->head, &fMan->cached);
-    else
-       DRMLISTADD(&kbo->head, &fMan->unCached);
-
-    DRMLISTADDTAIL(&kbo->timeoutHead, &fMan->timeoutList);
-    driFreeTimeoutKBOsLocked(fMan, &time);
-
-    pipe_mutex_unlock(fMan->mutex);
-}
-
-/*
- * Get a _DriKernelBO for us to use as storage for a slab.
- *
- */
-
-static struct _DriKernelBO *
-driAllocKernelBO(struct _DriSlabSizeHeader *header)
-
-{
-    struct _DriSlabPool *slabPool = header->slabPool;
-    struct _DriFreeSlabManager *fMan = slabPool->fMan;
-    drmMMListHead *list, *next, *head;
-    uint32_t size = header->bufSize * slabPool->desiredNumBuffers;
-    struct _DriKernelBO *kbo;
-    struct _DriKernelBO *kboTmp;
-    int ret;
-
-    /*
-     * FIXME: We should perhaps allow some variation in slabsize in order
-     * to efficiently reuse slabs.
-     */
-
-    size = (size <= slabPool->maxSlabSize) ? size : slabPool->maxSlabSize;
-    size = (size + slabPool->pageSize - 1) & ~(slabPool->pageSize - 1);
-    pipe_mutex_lock(fMan->mutex);
-
-    kbo = NULL;
-
-  retry:
-    head = (slabPool->proposedFlags & DRM_BO_FLAG_CACHED) ?
-       &fMan->cached : &fMan->unCached;
-
-    for (list = head->next, next = list->next;
-        list != head;
-        list = next, next = list->next) {
-
-       kboTmp = DRMLISTENTRY(struct _DriKernelBO, list, head);
-
-       if ((kboTmp->bo.size == size) &&
-           (slabPool->pageAlignment == 0 ||
-            (kboTmp->pageAlignment % slabPool->pageAlignment) == 0)) {
-
-           if (!kbo)
-               kbo = kboTmp;
-
-           if ((kbo->bo.proposedFlags ^ slabPool->proposedFlags) == 0)
-               break;
-
-       }
-    }
-
-    if (kbo) {
-       DRMLISTDELINIT(&kbo->head);
-       DRMLISTDELINIT(&kbo->timeoutHead);
-    }
-
-    pipe_mutex_unlock(fMan->mutex);
-
-    if (kbo) {
-        uint64_t new_mask = kbo->bo.proposedFlags ^ slabPool->proposedFlags;
-
-       ret = 0;
-       if (new_mask) {
-           ret = drmBOSetStatus(kbo->fd, &kbo->bo, slabPool->proposedFlags,
-                                new_mask, DRM_BO_HINT_DONT_FENCE, 0, 0);
-       }
-       if (ret == 0)
-           return kbo;
-
-       driFreeKernelBO(kbo);
-       kbo = NULL;
-       goto retry;
-    }
-
-    kbo = calloc(1, sizeof(struct _DriKernelBO));
-    if (!kbo)
-       return NULL;
-
-    kbo->fd = slabPool->fd;
-    DRMINITLISTHEAD(&kbo->head);
-    DRMINITLISTHEAD(&kbo->timeoutHead);
-    ret = drmBOCreate(kbo->fd, size, slabPool->pageAlignment, NULL,
-                     slabPool->proposedFlags,
-                     DRM_BO_HINT_DONT_FENCE, &kbo->bo);
-    if (ret)
-       goto out_err0;
-
-    ret = drmBOMap(kbo->fd, &kbo->bo,
-                  DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE,
-                  0, &kbo->virtual);
-
-    if (ret)
-       goto out_err1;
-
-    ret = drmBOUnmap(kbo->fd, &kbo->bo);
-    if (ret)
-       goto out_err1;
-
-    return kbo;
-
-  out_err1:
-    drmBOUnreference(kbo->fd, &kbo->bo);
-  out_err0:
-    free(kbo);
-    return NULL;
-}
-
-
-static int
-driAllocSlab(struct _DriSlabSizeHeader *header)
-{
-    struct _DriSlab *slab;
-    struct _DriSlabBuffer *buf;
-    uint32_t numBuffers;
-    int ret;
-    int i;
-
-    slab = calloc(1, sizeof(*slab));
-    if (!slab)
-       return -ENOMEM;
-
-    slab->kbo = driAllocKernelBO(header);
-    if (!slab->kbo) {
-       ret = -ENOMEM;
-       goto out_err0;
-    }
-
-    numBuffers = slab->kbo->bo.size / header->bufSize;
-
-    slab->buffers = calloc(numBuffers, sizeof(*slab->buffers));
-    if (!slab->buffers) {
-       ret = -ENOMEM;
-       goto out_err1;
-    }
-
-    DRMINITLISTHEAD(&slab->head);
-    DRMINITLISTHEAD(&slab->freeBuffers);
-    slab->numBuffers = numBuffers;
-    slab->numFree = 0;
-    slab->header = header;
-
-    buf = slab->buffers;
-    for (i=0; i < numBuffers; ++i) {
-       buf->parent = slab;
-       buf->start = i* header->bufSize;
-       buf->mapCount = 0;
-       buf->isSlabBuffer = 1;
-       pipe_condvar_init(buf->event);
-       DRMLISTADDTAIL(&buf->head, &slab->freeBuffers);
-       slab->numFree++;
-       buf++;
-    }
-
-    DRMLISTADDTAIL(&slab->head, &header->slabs);
-
-    return 0;
-
-  out_err1:
-    driSetKernelBOFree(header->slabPool->fMan, slab->kbo);
-    free(slab->buffers);
-  out_err0:
-    free(slab);
-    return ret;
-}
-
-/*
- * Delete a buffer from the slab header delayed list and put
- * it on the slab free list.
- */
-
-static void
-driSlabFreeBufferLocked(struct _DriSlabBuffer *buf)
-{
-    struct _DriSlab *slab = buf->parent;
-    struct _DriSlabSizeHeader *header = slab->header;
-    drmMMListHead *list = &buf->head;
-
-    DRMLISTDEL(list);
-    DRMLISTADDTAIL(list, &slab->freeBuffers);
-    slab->numFree++;
-
-    if (slab->head.next == &slab->head)
-       DRMLISTADDTAIL(&slab->head, &header->slabs);
-
-    if (slab->numFree == slab->numBuffers) {
-       list = &slab->head;
-       DRMLISTDEL(list);
-       DRMLISTADDTAIL(list, &header->freeSlabs);
-    }
-
-    if (header->slabs.next == &header->slabs ||
-       slab->numFree != slab->numBuffers) {
-
-       drmMMListHead *next;
-       struct _DriFreeSlabManager *fMan = header->slabPool->fMan;
-
-       for (list = header->freeSlabs.next, next = list->next;
-            list != &header->freeSlabs;
-            list = next, next = list->next) {
-
-           slab = DRMLISTENTRY(struct _DriSlab, list, head);
-
-           DRMLISTDELINIT(list);
-           driSetKernelBOFree(fMan, slab->kbo);
-           free(slab->buffers);
-           free(slab);
-       }
-    }
-}
-
-static void
-driSlabCheckFreeLocked(struct _DriSlabSizeHeader *header, int wait)
-{
-  drmMMListHead *list, *prev, *first;
-   struct _DriSlabBuffer *buf;
-   struct _DriSlab *slab;
-   int firstWasSignaled = 1;
-   int signaled;
-   int i;
-   int ret;
-
-   /*
-    * Rerun the freeing test if the youngest tested buffer
-    * was signaled, since there might be more idle buffers
-    * in the delay list.
-    */
-
-   while (firstWasSignaled) {
-       firstWasSignaled = 0;
-       signaled = 0;
-       first = header->delayedBuffers.next;
-
-       /* Only examine the oldest 1/3 of delayed buffers:
-       */
-       if (header->numDelayed > 3) {
-          for (i = 0; i < header->numDelayed; i += 3) {
-              first = first->next;
-          }
-       }
-
-       for (list = first, prev = list->prev;
-           list != &header->delayedBuffers;
-           list = prev, prev = list->prev) {
-          buf = DRMLISTENTRY(struct _DriSlabBuffer, list, head);
-          slab = buf->parent;
-
-          if (!signaled) {
-              if (wait) {
-                  ret = driFenceFinish(buf->fence, buf->fenceType, 0);
-                  if (ret)
-                      break;
-                  signaled = 1;
-                  wait = 0;
-              } else {
-                  signaled = driFenceSignaled(buf->fence, buf->fenceType);
-              }
-              if (signaled) {
-                  if (list == first)
-                      firstWasSignaled = 1;
-                  driFenceUnReference(&buf->fence);
-                  header->numDelayed--;
-                  driSlabFreeBufferLocked(buf);
-              }
-          } else if (driFenceSignaledCached(buf->fence, buf->fenceType)) {
-              driFenceUnReference(&buf->fence);
-              header->numDelayed--;
-              driSlabFreeBufferLocked(buf);
-          }
-       }
-   }
-}
-
-
-static struct _DriSlabBuffer *
-driSlabAllocBuffer(struct _DriSlabSizeHeader *header)
-{
-    static struct _DriSlabBuffer *buf;
-    struct _DriSlab *slab;
-    drmMMListHead *list;
-    int count = DRI_SLABPOOL_ALLOC_RETRIES;
-
-    pipe_mutex_lock(header->mutex);
-    while(header->slabs.next == &header->slabs && count > 0) {
-        driSlabCheckFreeLocked(header, 0);
-       if (header->slabs.next != &header->slabs)
-         break;
-
-       pipe_mutex_unlock(header->mutex);
-       if (count != DRI_SLABPOOL_ALLOC_RETRIES)
-           usleep(1);
-       pipe_mutex_lock(header->mutex);
-       (void) driAllocSlab(header);
-       count--;
-    }
-
-    list = header->slabs.next;
-    if (list == &header->slabs) {
-       pipe_mutex_unlock(header->mutex);
-       return NULL;
-    }
-    slab = DRMLISTENTRY(struct _DriSlab, list, head);
-    if (--slab->numFree == 0)
-       DRMLISTDELINIT(list);
-
-    list = slab->freeBuffers.next;
-    DRMLISTDELINIT(list);
-
-    pipe_mutex_unlock(header->mutex);
-    buf = DRMLISTENTRY(struct _DriSlabBuffer, list, head);
-    return buf;
-}
-
-static void *
-pool_create(struct _DriBufferPool *driPool, unsigned long size,
-           uint64_t flags, unsigned hint, unsigned alignment)
-{
-    struct _DriSlabPool *pool = (struct _DriSlabPool *) driPool->data;
-    struct _DriSlabSizeHeader *header;
-    struct _DriSlabBuffer *buf;
-    void *dummy;
-    int i;
-    int ret;
-
-    /*
-     * FIXME: Check for compatibility.
-     */
-
-    header = pool->headers;
-    for (i=0; i<pool->numBuckets; ++i) {
-      if (header->bufSize >= size)
-       break;
-      header++;
-    }
-
-    if (i < pool->numBuckets)
-       return driSlabAllocBuffer(header);
-
-
-    /*
-     * Fall back to allocate a buffer object directly from DRM.
-     * and wrap it in a driBO structure.
-     */
-
-
-    buf = calloc(1, sizeof(*buf));
-
-    if (!buf)
-       return NULL;
-
-    buf->bo = calloc(1, sizeof(*buf->bo));
-    if (!buf->bo)
-       goto out_err0;
-
-    if (alignment) {
-       if ((alignment < pool->pageSize) && (pool->pageSize % alignment))
-           goto out_err1;
-       if ((alignment > pool->pageSize) && (alignment % pool->pageSize))
-           goto out_err1;
-    }
-
-    ret = drmBOCreate(pool->fd, size, alignment / pool->pageSize, NULL,
-                       flags, hint, buf->bo);
-    if (ret)
-       goto out_err1;
-
-    ret  = drmBOMap(pool->fd, buf->bo, DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE,
-                   0, &dummy);
-    if (ret)
-       goto out_err2;
-
-    ret = drmBOUnmap(pool->fd, buf->bo);
-    if (ret)
-       goto out_err2;
-
-    return buf;
-  out_err2:
-    drmBOUnreference(pool->fd, buf->bo);
-  out_err1:
-    free(buf->bo);
-  out_err0:
-    free(buf);
-    return NULL;
-}
-
-static int
-pool_destroy(struct _DriBufferPool *driPool, void *private)
-{
-    struct _DriSlabBuffer *buf =
-       (struct _DriSlabBuffer *) private;
-    struct _DriSlab *slab;
-    struct _DriSlabSizeHeader *header;
-
-    if (!buf->isSlabBuffer) {
-       struct _DriSlabPool *pool = (struct _DriSlabPool *) driPool->data;
-       int ret;
-
-       ret = drmBOUnreference(pool->fd, buf->bo);
-       free(buf->bo);
-       free(buf);
-       return ret;
-    }
-
-    slab = buf->parent;
-    header = slab->header;
-
-    pipe_mutex_lock(header->mutex);
-    buf->unFenced = 0;
-    buf->mapCount = 0;
-
-    if (buf->fence && !driFenceSignaledCached(buf->fence, buf->fenceType)) {
-       DRMLISTADDTAIL(&buf->head, &header->delayedBuffers);
-       header->numDelayed++;
-    } else {
-       if (buf->fence)
-           driFenceUnReference(&buf->fence);
-       driSlabFreeBufferLocked(buf);
-    }
-
-    pipe_mutex_unlock(header->mutex);
-    return 0;
-}
-
-static int
-pool_waitIdle(struct _DriBufferPool *driPool, void *private,
-             pipe_mutex *mutex, int lazy)
-{
-   struct _DriSlabBuffer *buf = (struct _DriSlabBuffer *) private;
-
-   while(buf->unFenced)
-       pipe_condvar_wait(buf->event, *mutex);
-
-   if (!buf->fence)
-     return 0;
-
-   driFenceFinish(buf->fence, buf->fenceType, lazy);
-   driFenceUnReference(&buf->fence);
-
-   return 0;
-}
-
-static int
-pool_map(struct _DriBufferPool *pool, void *private, unsigned flags,
-         int hint, pipe_mutex *mutex, void **virtual)
-{
-   struct _DriSlabBuffer *buf = (struct _DriSlabBuffer *) private;
-   int busy;
-
-   if (buf->isSlabBuffer)
-       busy = buf->unFenced || (buf->fence && !driFenceSignaledCached(buf->fence, buf->fenceType));
-   else
-       busy = buf->fence && !driFenceSignaled(buf->fence, buf->fenceType);
-
-
-   if (busy) {
-       if (hint & DRM_BO_HINT_DONT_BLOCK)
-          return -EBUSY;
-       else {
-          (void) pool_waitIdle(pool, private, mutex, 0);
-       }
-   }
-
-   ++buf->mapCount;
-   *virtual = (buf->isSlabBuffer) ?
-       (void *) ((uint8_t *) buf->parent->kbo->virtual + buf->start) :
-       (void *) buf->bo->virtual;
-
-   return 0;
-}
-
-static int
-pool_unmap(struct _DriBufferPool *pool, void *private)
-{
-   struct _DriSlabBuffer *buf = (struct _DriSlabBuffer *) private;
-
-   --buf->mapCount;
-   if (buf->mapCount == 0 && buf->isSlabBuffer)
-      pipe_condvar_broadcast(buf->event);
-
-   return 0;
-}
-
-static unsigned long
-pool_offset(struct _DriBufferPool *pool, void *private)
-{
-   struct _DriSlabBuffer *buf = (struct _DriSlabBuffer *) private;
-   struct _DriSlab *slab;
-   struct _DriSlabSizeHeader *header;
-
-   if (!buf->isSlabBuffer) {
-       assert(buf->bo->proposedFlags & DRM_BO_FLAG_NO_MOVE);
-       return buf->bo->offset;
-   }
-
-   slab = buf->parent;
-   header = slab->header;
-
-   (void) header;
-   assert(header->slabPool->proposedFlags & DRM_BO_FLAG_NO_MOVE);
-   return slab->kbo->bo.offset + buf->start;
-}
-
-static unsigned long
-pool_poolOffset(struct _DriBufferPool *pool, void *private)
-{
-   struct _DriSlabBuffer *buf = (struct _DriSlabBuffer *) private;
-
-   return buf->start;
-}
-
-static uint64_t
-pool_flags(struct _DriBufferPool *pool, void *private)
-{
-   struct _DriSlabBuffer *buf = (struct _DriSlabBuffer *) private;
-
-   if (!buf->isSlabBuffer)
-       return buf->bo->flags;
-
-   return buf->parent->kbo->bo.flags;
-}
-
-static unsigned long
-pool_size(struct _DriBufferPool *pool, void *private)
-{
-   struct _DriSlabBuffer *buf = (struct _DriSlabBuffer *) private;
-   if (!buf->isSlabBuffer)
-       return buf->bo->size;
-
-   return buf->parent->header->bufSize;
-}
-
-static int
-pool_fence(struct _DriBufferPool *pool, void *private,
-           struct _DriFenceObject *fence)
-{
-   struct _DriSlabBuffer *buf = (struct _DriSlabBuffer *) private;
-   drmBO *bo;
-
-   if (buf->fence)
-      driFenceUnReference(&buf->fence);
-
-   buf->fence = driFenceReference(fence);
-   bo = (buf->isSlabBuffer) ?
-     &buf->parent->kbo->bo:
-     buf->bo;
-   buf->fenceType = bo->fenceFlags;
-
-   buf->unFenced = 0;
-   pipe_condvar_broadcast(buf->event);
-
-   return 0;
-}
-
-static drmBO *
-pool_kernel(struct _DriBufferPool *pool, void *private)
-{
-   struct _DriSlabBuffer *buf = (struct _DriSlabBuffer *) private;
-
-   return (buf->isSlabBuffer) ? &buf->parent->kbo->bo : buf->bo;
-}
-
-static int
-pool_validate(struct _DriBufferPool *pool, void *private,
-             pipe_mutex *mutex)
-{
-   struct _DriSlabBuffer *buf = (struct _DriSlabBuffer *) private;
-
-   if (!buf->isSlabBuffer)
-       return 0;
-
-   while(buf->mapCount != 0)
-      pipe_condvar_wait(buf->event, *mutex);
-
-   buf->unFenced = 1;
-   return 0;
-}
-
-
-struct _DriFreeSlabManager *
-driInitFreeSlabManager(uint32_t checkIntervalMsec, uint32_t slabTimeoutMsec)
-{
-    struct _DriFreeSlabManager *tmp;
-
-    tmp = calloc(1, sizeof(*tmp));
-    if (!tmp)
-       return NULL;
-
-    pipe_mutex_init(tmp->mutex);
-    pipe_mutex_lock(tmp->mutex);
-    tmp->slabTimeout.tv_usec = slabTimeoutMsec*1000;
-    tmp->slabTimeout.tv_sec = tmp->slabTimeout.tv_usec / 1000000;
-    tmp->slabTimeout.tv_usec -=  tmp->slabTimeout.tv_sec*1000000;
-
-    tmp->checkInterval.tv_usec = checkIntervalMsec*1000;
-    tmp->checkInterval.tv_sec = tmp->checkInterval.tv_usec / 1000000;
-    tmp->checkInterval.tv_usec -=  tmp->checkInterval.tv_sec*1000000;
-
-    gettimeofday(&tmp->nextCheck, NULL);
-    driTimeAdd(&tmp->nextCheck, &tmp->checkInterval);
-    DRMINITLISTHEAD(&tmp->timeoutList);
-    DRMINITLISTHEAD(&tmp->unCached);
-    DRMINITLISTHEAD(&tmp->cached);
-    pipe_mutex_unlock(tmp->mutex);
-
-    return tmp;
-}
-
-void
-driFinishFreeSlabManager(struct _DriFreeSlabManager *fMan)
-{
-    struct timeval time;
-
-    time = fMan->nextCheck;
-    driTimeAdd(&time, &fMan->checkInterval);
-
-    pipe_mutex_lock(fMan->mutex);
-    driFreeTimeoutKBOsLocked(fMan, &time);
-    pipe_mutex_unlock(fMan->mutex);
-
-    assert(fMan->timeoutList.next == &fMan->timeoutList);
-    assert(fMan->unCached.next == &fMan->unCached);
-    assert(fMan->cached.next == &fMan->cached);
-
-    free(fMan);
-}
-
-static void
-driInitSizeHeader(struct _DriSlabPool *pool, uint32_t size,
-                 struct _DriSlabSizeHeader *header)
-{
-    pipe_mutex_init(header->mutex);
-    pipe_mutex_lock(header->mutex);
-
-    DRMINITLISTHEAD(&header->slabs);
-    DRMINITLISTHEAD(&header->freeSlabs);
-    DRMINITLISTHEAD(&header->delayedBuffers);
-
-    header->numDelayed = 0;
-    header->slabPool = pool;
-    header->bufSize = size;
-
-    pipe_mutex_unlock(header->mutex);
-}
-
-static void
-driFinishSizeHeader(struct _DriSlabSizeHeader *header)
-{
-    drmMMListHead *list, *next;
-    struct _DriSlabBuffer *buf;
-
-    pipe_mutex_lock(header->mutex);
-    for (list = header->delayedBuffers.next, next = list->next;
-        list != &header->delayedBuffers;
-        list = next, next = list->next) {
-
-       buf = DRMLISTENTRY(struct _DriSlabBuffer, list , head);
-       if (buf->fence) {
-           (void) driFenceFinish(buf->fence, buf->fenceType, 0);
-           driFenceUnReference(&buf->fence);
-       }
-       header->numDelayed--;
-       driSlabFreeBufferLocked(buf);
-    }
-    pipe_mutex_unlock(header->mutex);
-}
-
-static void
-pool_takedown(struct _DriBufferPool *driPool)
-{
-   struct _DriSlabPool *pool = driPool->data;
-   int i;
-
-   for (i=0; i<pool->numBuckets; ++i) {
-     driFinishSizeHeader(&pool->headers[i]);
-   }
-
-   free(pool->headers);
-   free(pool->bucketSizes);
-   free(pool);
-   free(driPool);
-}
-
-struct _DriBufferPool *
-driSlabPoolInit(int fd, uint64_t flags,
-               uint64_t validMask,
-               uint32_t smallestSize,
-               uint32_t numSizes,
-               uint32_t desiredNumBuffers,
-               uint32_t maxSlabSize,
-               uint32_t pageAlignment,
-               struct _DriFreeSlabManager *fMan)
-{
-    struct _DriBufferPool *driPool;
-    struct _DriSlabPool *pool;
-    uint32_t i;
-
-    driPool = calloc(1, sizeof(*driPool));
-    if (!driPool)
-       return NULL;
-
-    pool = calloc(1, sizeof(*pool));
-    if (!pool)
-       goto out_err0;
-
-    pool->bucketSizes = calloc(numSizes, sizeof(*pool->bucketSizes));
-    if (!pool->bucketSizes)
-       goto out_err1;
-
-    pool->headers = calloc(numSizes, sizeof(*pool->headers));
-    if (!pool->headers)
-       goto out_err2;
-
-    pool->fMan = fMan;
-    pool->proposedFlags = flags;
-    pool->validMask = validMask;
-    pool->numBuckets = numSizes;
-    pool->pageSize = getpagesize();
-    pool->fd = fd;
-    pool->pageAlignment = pageAlignment;
-    pool->maxSlabSize = maxSlabSize;
-    pool->desiredNumBuffers = desiredNumBuffers;
-
-    for (i=0; i<pool->numBuckets; ++i) {
-       pool->bucketSizes[i] = (smallestSize << i);
-       driInitSizeHeader(pool, pool->bucketSizes[i],
-                         &pool->headers[i]);
-    }
-
-    driPool->data = (void *) pool;
-    driPool->map = &pool_map;
-    driPool->unmap = &pool_unmap;
-    driPool->destroy = &pool_destroy;
-    driPool->offset = &pool_offset;
-    driPool->poolOffset = &pool_poolOffset;
-    driPool->flags = &pool_flags;
-    driPool->size = &pool_size;
-    driPool->create = &pool_create;
-    driPool->fence = &pool_fence;
-    driPool->kernel = &pool_kernel;
-    driPool->validate = &pool_validate;
-    driPool->waitIdle = &pool_waitIdle;
-    driPool->takeDown = &pool_takedown;
-
-    return driPool;
-
-  out_err2:
-    free(pool->bucketSizes);
-  out_err1:
-    free(pool);
-  out_err0:
-    free(driPool);
-
-    return NULL;
-}
diff --git a/src/gallium/winsys/drm/intel/dri/Makefile b/src/gallium/winsys/drm/intel/dri/Makefile
deleted file mode 100644 (file)
index 2046441..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = i915_dri.so
-LIBNAME_EGL = egl_i915_dri.so
-
-PIPE_DRIVERS = \
-       $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
-       ../common/libinteldrm.a \
-       $(TOP)/src/gallium/drivers/i915simple/libi915simple.a
-
-
-DRIVER_SOURCES = \
-       intel_winsys_softpipe.c \
-       intel_swapbuffers.c \
-       intel_context.c \
-       intel_lock.c \
-       intel_screen.c
-
-C_SOURCES = \
-       $(COMMON_GALLIUM_SOURCES) \
-       $(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
-DRIVER_DEFINES = -I../common $(shell pkg-config libdrm --atleast-version=2.3.1 \
-                               && echo "-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP")
-
-include ../../Makefile.template
-
-#intel_tex_layout.o: $(TOP)/src/mesa/drivers/dri/intel/intel_tex_layout.c
-
-symlinks:
diff --git a/src/gallium/winsys/drm/intel/dri/SConscript b/src/gallium/winsys/drm/intel/dri/SConscript
deleted file mode 100644 (file)
index 6a4f50a..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-Import('*')
-
-if 'mesa' in env['statetrackers']:
-
-       env = drienv.Clone()
-
-       env.Append(CPPPATH = [
-               '../intel',
-               'server'
-       ])
-
-       #MINIGLX_SOURCES = server/intel_dri.c
-
-       DRIVER_SOURCES = [
-               'intel_winsys_pipe.c',
-               'intel_winsys_softpipe.c',
-               'intel_winsys_i915.c',
-               'intel_batchbuffer.c',
-               'intel_swapbuffers.c',
-               'intel_context.c',
-               'intel_lock.c',
-               'intel_screen.c',
-               'intel_batchpool.c',
-       ]
-
-       sources = \
-               COMMON_GALLIUM_SOURCES + \
-               COMMON_BM_SOURCES + \
-               DRIVER_SOURCES
-
-       drivers = [
-               softpipe,
-               i915simple
-       ]
-
-       # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
-       env.SharedLibrary(
-               target ='i915tex_dri.so',
-               source = sources,
-               LIBS = drivers + mesa + auxiliaries + env['LIBS'],
-       )
diff --git a/src/gallium/winsys/drm/intel/dri/intel_batchbuffer.h b/src/gallium/winsys/drm/intel/dri/intel_batchbuffer.h
deleted file mode 100644 (file)
index 3e95326..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef INTEL_BATCHBUFFER_H
-#define INTEL_BATCHBUFFER_H
-
-#include "intel_be_batchbuffer.h"
-
-/*
- * Need to redefine the BATCH defines
- */
-
-#undef BEGIN_BATCH
-#define BEGIN_BATCH(dwords, relocs) \
-   (i915_batchbuffer_check(&intel->base.batch->base, dwords, relocs))
-
-#undef OUT_BATCH
-#define OUT_BATCH(d) \
-   i915_batchbuffer_dword(&intel->base.batch->base, d)
-
-#undef OUT_RELOC
-#define OUT_RELOC(buf,flags,mask,delta) do {                                   \
-   assert((delta) >= 0);                                                       \
-   intel_be_offset_relocation(intel->base.batch, delta, buf, flags, mask);     \
-} while (0)
-
-#endif
diff --git a/src/gallium/winsys/drm/intel/dri/intel_context.c b/src/gallium/winsys/drm/intel/dri/intel_context.c
deleted file mode 100644 (file)
index 97ef731..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "i830_dri.h"
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_swapbuffers.h"
-#include "intel_batchbuffer.h"
-#include "intel_winsys_softpipe.h"
-
-#include "i915simple/i915_screen.h"
-
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_context.h"
-
-#include "utils.h"
-
-
-#ifdef DEBUG
-int __intel_debug = 0;
-#endif
-
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_point_parameters
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
-#define need_GL_ARB_vertex_program
-#define need_GL_ARB_window_pos
-#define need_GL_EXT_blend_color
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_cull_vertex
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_framebuffer_object
-#define need_GL_EXT_multi_draw_arrays
-#define need_GL_EXT_secondary_color
-#define need_GL_NV_vertex_program
-#include "extension_helper.h"
-
-
-/**
- * Extension strings exported by the intel driver.
- *
- * \note
- * It appears that ARB_texture_env_crossbar has "disappeared" compared to the
- * old i830-specific driver.
- */
-const struct dri_extension card_extensions[] = {
-   {"GL_ARB_multisample", GL_ARB_multisample_functions},
-   {"GL_ARB_multitexture", NULL},
-   {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
-   {"GL_ARB_texture_border_clamp", NULL},
-   {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions},
-   {"GL_ARB_texture_cube_map", NULL},
-   {"GL_ARB_texture_env_add", NULL},
-   {"GL_ARB_texture_env_combine", NULL},
-   {"GL_ARB_texture_env_dot3", NULL},
-   {"GL_ARB_texture_mirrored_repeat", NULL},
-   {"GL_ARB_texture_rectangle", NULL},
-   {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
-   {"GL_ARB_pixel_buffer_object", NULL},
-   {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
-   {"GL_ARB_window_pos", GL_ARB_window_pos_functions},
-   {"GL_EXT_blend_color", GL_EXT_blend_color_functions},
-   {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
-   {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
-   {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
-   {"GL_EXT_blend_subtract", NULL},
-   {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions},
-   {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions},
-   {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
-   {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
-   {"GL_EXT_packed_depth_stencil", NULL},
-   {"GL_EXT_pixel_buffer_object", NULL},
-   {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
-   {"GL_EXT_stencil_wrap", NULL},
-   {"GL_EXT_texture_edge_clamp", NULL},
-   {"GL_EXT_texture_env_combine", NULL},
-   {"GL_EXT_texture_env_dot3", NULL},
-   {"GL_EXT_texture_filter_anisotropic", NULL},
-   {"GL_EXT_texture_lod_bias", NULL},
-   {"GL_3DFX_texture_compression_FXT1", NULL},
-   {"GL_APPLE_client_storage", NULL},
-   {"GL_MESA_pack_invert", NULL},
-   {"GL_MESA_ycbcr_texture", NULL},
-   {"GL_NV_blend_square", NULL},
-   {"GL_NV_vertex_program", GL_NV_vertex_program_functions},
-   {"GL_NV_vertex_program1_1", NULL},
-   {"GL_SGIS_generate_mipmap", NULL },
-   {NULL, NULL}
-};
-
-
-
-#ifdef DEBUG
-static const struct dri_debug_control debug_control[] = {
-   {"ioctl", DEBUG_IOCTL},
-   {"bat", DEBUG_BATCH},
-   {"lock", DEBUG_LOCK},
-   {"swap", DEBUG_SWAP},
-   {NULL, 0}
-};
-#endif
-
-
-
-static void
-intel_lock_hardware(struct intel_be_context *context)
-{
-   struct intel_context *intel = (struct intel_context *)context;
-   LOCK_HARDWARE(intel);
-}
-
-static void
-intel_unlock_hardware(struct intel_be_context *context)
-{
-   struct intel_context *intel = (struct intel_context *)context;
-   UNLOCK_HARDWARE(intel);
-}
-
-static boolean
-intel_locked_hardware(struct intel_be_context *context)
-{
-   struct intel_context *intel = (struct intel_context *)context;
-   return intel->locked ? TRUE : FALSE;
-}
-
-GLboolean
-intelCreateContext(const __GLcontextModes * visual,
-                   __DRIcontextPrivate * driContextPriv,
-                   void *sharedContextPrivate)
-{
-   struct intel_context *intel = CALLOC_STRUCT(intel_context);
-   __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
-   struct intel_screen *intelScreen = intel_screen(sPriv);
-   drmI830Sarea *saPriv = intelScreen->sarea;
-   int fthrottle_mode;
-   GLboolean havePools;
-   struct pipe_context *pipe;
-   struct st_context *st_share = NULL;
-
-   if (sharedContextPrivate) {
-      st_share = ((struct intel_context *) sharedContextPrivate)->st;
-   }
-
-   driContextPriv->driverPrivate = intel;
-   intel->intelScreen = intelScreen;
-   intel->driScreen = sPriv;
-   intel->sarea = saPriv;
-
-   driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
-                       intel->driScreen->myNum, "i915");
-
-
-   /*
-    * memory pools
-    */
-   DRM_LIGHT_LOCK(sPriv->fd, &sPriv->pSAREA->lock, driContextPriv->hHWContext);
-   // ZZZ JB should be per screen and not be done per context
-   havePools = intelCreatePools(sPriv);
-   DRM_UNLOCK(sPriv->fd, &sPriv->pSAREA->lock, driContextPriv->hHWContext);
-   if (!havePools)
-      return GL_FALSE;
-
-
-   /* Dri stuff */
-   intel->hHWContext = driContextPriv->hHWContext;
-   intel->driFd = sPriv->fd;
-   intel->driHwLock = (drmLock *) & sPriv->pSAREA->lock;
-
-   fthrottle_mode = driQueryOptioni(&intel->optionCache, "fthrottle_mode");
-   intel->iw.irq_seq = -1;
-   intel->irqsEmitted = 0;
-
-   intel->last_swap_fence = NULL;
-   intel->first_swap_fence = NULL;
-
-#ifdef DEBUG
-   __intel_debug = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
-#endif
-   intel->base.hardware_lock = intel_lock_hardware;
-   intel->base.hardware_unlock = intel_unlock_hardware;
-   intel->base.hardware_locked = intel_locked_hardware;
-
-   intel_be_init_context(&intel->base, &intelScreen->base);
-
-   /*
-    * Pipe-related setup
-    */
-   if (getenv("INTEL_SP")) {
-      /* use softpipe driver instead of hw */
-      pipe = intel_create_softpipe( intel, &intelScreen->base.base );
-   }
-   else {
-      switch (intel->intelScreen->deviceID) {
-      case PCI_CHIP_I945_G:
-      case PCI_CHIP_I945_GM:
-      case PCI_CHIP_I945_GME:
-      case PCI_CHIP_G33_G:
-      case PCI_CHIP_Q33_G:
-      case PCI_CHIP_Q35_G:
-      case PCI_CHIP_I915_G:
-      case PCI_CHIP_I915_GM:
-        pipe = i915_create_context(intelScreen->base.screen,
-                                   &intelScreen->base.base,
-                                   &intel->base.base);
-        break;
-      default:
-        fprintf(stderr, "Unknown PCIID %x in %s, using software driver\n",
-                 intel->intelScreen->deviceID, __FUNCTION__);
-
-        pipe = intel_create_softpipe( intel, &intelScreen->base.base );
-        break;
-      }
-   }
-
-   pipe->priv = intel;
-
-   intel->st = st_create_context(pipe, visual, st_share);
-
-   driInitExtensions( intel->st->ctx, card_extensions, GL_TRUE );
-
-   return GL_TRUE;
-}
-
-
-void
-intelDestroyContext(__DRIcontextPrivate * driContextPriv)
-{
-   struct intel_context *intel = intel_context(driContextPriv);
-
-   assert(intel);               /* should never be null */
-   if (intel) {
-      st_finish(intel->st);
-
-      if (intel->last_swap_fence) {
-        driFenceFinish(intel->last_swap_fence, DRM_FENCE_TYPE_EXE, GL_TRUE);
-        driFenceUnReference(&intel->last_swap_fence);
-        intel->last_swap_fence = NULL;
-      }
-      if (intel->first_swap_fence) {
-        driFenceFinish(intel->first_swap_fence, DRM_FENCE_TYPE_EXE, GL_TRUE);
-        driFenceUnReference(&intel->first_swap_fence);
-        intel->first_swap_fence = NULL;
-      }
-
-      if (intel->intelScreen->dummyContext == intel)
-         intel->intelScreen->dummyContext = NULL;
-
-      st_destroy_context(intel->st);
-      intel_be_destroy_context(&intel->base);
-      free(intel);
-   }
-}
-
-
-GLboolean
-intelUnbindContext(__DRIcontextPrivate * driContextPriv)
-{
-   struct intel_context *intel = intel_context(driContextPriv);
-   st_flush(intel->st, PIPE_FLUSH_RENDER_CACHE, NULL);
-   /* XXX make_current(NULL)? */
-   return GL_TRUE;
-}
-
-
-GLboolean
-intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
-                 __DRIdrawablePrivate * driDrawPriv,
-                 __DRIdrawablePrivate * driReadPriv)
-{
-   if (driContextPriv) {
-      struct intel_context *intel = intel_context(driContextPriv);
-      struct intel_framebuffer *draw_fb = intel_framebuffer(driDrawPriv);
-      struct intel_framebuffer *read_fb = intel_framebuffer(driReadPriv);
-
-      assert(draw_fb->stfb);
-      assert(read_fb->stfb);
-
-      /* This is for situations in which we need a rendering context but
-       * there may not be any currently bound.
-       */
-      intel->intelScreen->dummyContext = intel;
-
-      st_make_current(intel->st, draw_fb->stfb, read_fb->stfb);
-
-      if ((intel->driDrawable != driDrawPriv) ||
-         (intel->lastStamp != driDrawPriv->lastStamp)) {
-         intel->driDrawable = driDrawPriv;
-         intelUpdateWindowSize(driDrawPriv);
-         intel->lastStamp = driDrawPriv->lastStamp;
-      }
-
-      /* The size of the draw buffer will have been updated above.
-       * If the readbuffer is a different window, check/update its size now.
-       */
-      if (driReadPriv != driDrawPriv) {
-         intelUpdateWindowSize(driReadPriv);
-      }
-
-   }
-   else {
-      st_make_current(NULL, NULL, NULL);
-   }
-
-   return GL_TRUE;
-}
diff --git a/src/gallium/winsys/drm/intel/dri/intel_context.h b/src/gallium/winsys/drm/intel/dri/intel_context.h
deleted file mode 100644 (file)
index 5d22a42..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef INTEL_CONTEXT_H
-#define INTEL_CONTEXT_H
-
-#include <stdint.h>
-#include "drm.h"
-
-#include "pipe/p_debug.h"
-
-#include "intel_screen.h"
-#include "i915_drm.h"
-
-#include "intel_be_context.h"
-
-
-struct pipe_context;
-struct intel_context;
-struct _DriBufferObject;
-struct st_context;
-
-
-#define INTEL_MAX_FIXUP 64
-
-/**
- * Intel rendering context, contains a state tracker and intel-specific info.
- */
-struct intel_context
-{
-   struct intel_be_context base;
-   struct st_context *st;
-
-   struct _DriFenceObject *last_swap_fence;
-   struct _DriFenceObject *first_swap_fence;
-
-//   struct intel_batchbuffer *batch;
-
-   boolean locked;
-   char *prevLockFile;
-   int prevLockLine;
-
-   uint irqsEmitted;
-   drm_i915_irq_wait_t iw;
-
-   drm_context_t hHWContext;
-   drmLock *driHwLock;
-   int driFd;
-
-   __DRIdrawablePrivate *driDrawable;
-   __DRIscreenPrivate *driScreen;
-   struct intel_screen *intelScreen;
-   drmI830Sarea *sarea;
-
-   uint lastStamp;
-
-   /**
-    * Configuration cache
-    */
-   driOptionCache optionCache;
-};
-
-
-
-/**
- * Intel framebuffer.
- */
-struct intel_framebuffer
-{
-   struct st_framebuffer *stfb;
-
-   /* other fields TBD */
-   int other;
-};
-
-
-
-
-/* These are functions now:
- */
-void LOCK_HARDWARE( struct intel_context *intel );
-void UNLOCK_HARDWARE( struct intel_context *intel );
-
-extern char *__progname;
-
-
-
-/* ================================================================
- * Debugging:
- */
-#ifdef DEBUG
-extern int __intel_debug;
-
-#define DEBUG_SWAP     0x1
-#define DEBUG_LOCK      0x2
-#define DEBUG_IOCTL    0x4
-#define DEBUG_BATCH     0x8
-
-#define DBG(flag, ...)  do {                   \
-   if (__intel_debug & (DEBUG_##flag))                 \
-      printf(__VA_ARGS__);             \
-} while(0)
-
-#else
-#define DBG(flag, ...)
-#endif
-
-
-
-#define PCI_CHIP_845_G                 0x2562
-#define PCI_CHIP_I830_M                        0x3577
-#define PCI_CHIP_I855_GM               0x3582
-#define PCI_CHIP_I865_G                        0x2572
-#define PCI_CHIP_I915_G                        0x2582
-#define PCI_CHIP_I915_GM               0x2592
-#define PCI_CHIP_I945_G                        0x2772
-#define PCI_CHIP_I945_GM               0x27A2
-#define PCI_CHIP_I945_GME              0x27AE
-#define PCI_CHIP_G33_G                 0x29C2
-#define PCI_CHIP_Q35_G                 0x29B2
-#define PCI_CHIP_Q33_G                 0x29D2
-
-
-/** Cast wrapper */
-static INLINE struct intel_context *
-intel_context(__DRIcontextPrivate *driContextPriv)
-{
-   return (struct intel_context *) driContextPriv->driverPrivate;
-}
-
-
-/** Cast wrapper */
-static INLINE struct intel_framebuffer *
-intel_framebuffer(__DRIdrawablePrivate * driDrawPriv)
-{
-   return (struct intel_framebuffer *) driDrawPriv->driverPrivate;
-}
-
-
-#endif
diff --git a/src/gallium/winsys/drm/intel/dri/intel_lock.c b/src/gallium/winsys/drm/intel/dri/intel_lock.c
deleted file mode 100644 (file)
index ad1c202..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "main/glheader.h"
-#include "pipe/p_thread.h"
-#include <GL/internal/glcore.h>
-#include "state_tracker/st_public.h"
-#include "intel_context.h"
-#include "i830_dri.h"
-
-
-
-pipe_static_mutex( lockMutex );
-
-
-static void
-intelContendedLock(struct intel_context *intel, uint flags)
-{
-   __DRIdrawablePrivate *dPriv = intel->driDrawable;
-   __DRIscreenPrivate *sPriv = intel->driScreen;
-   struct intel_screen *intelScreen = intel_screen(sPriv);
-   drmI830Sarea *sarea = intel->sarea;
-
-   drmGetLock(intel->driFd, intel->hHWContext, flags);
-
-   DBG(LOCK, "%s - got contended lock\n", __progname);
-
-   /* If the window moved, may need to set a new cliprect now.
-    *
-    * NOTE: This releases and regains the hw lock, so all state
-    * checking must be done *after* this call:
-    */
-   if (dPriv)
-      DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-
-   if (sarea->width != intelScreen->front.width ||
-       sarea->height != intelScreen->front.height) {
-
-      intelUpdateScreenRotation(sPriv, sarea);
-   }
-}
-
-
-/* Lock the hardware and validate our state.
- */
-void LOCK_HARDWARE( struct intel_context *intel )
-{
-    char __ret = 0;
-
-    pipe_mutex_lock(lockMutex);
-    assert(!intel->locked);
-
-    DRM_CAS(intel->driHwLock, intel->hHWContext,
-            (DRM_LOCK_HELD|intel->hHWContext), __ret);
-
-    if (__ret)
-       intelContendedLock( intel, 0 );
-
-    DBG(LOCK, "%s - locked\n", __progname);
-
-    intel->locked = 1;
-}
-
-
-/* Unlock the hardware using the global current context
- */
-void UNLOCK_HARDWARE( struct intel_context *intel )
-{
-   assert(intel->locked);
-   intel->locked = 0;
-
-   DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext);
-
-   pipe_mutex_unlock(lockMutex);
-
-   DBG(LOCK, "%s - unlocked\n", __progname);
-}
diff --git a/src/gallium/winsys/drm/intel/dri/intel_reg.h b/src/gallium/winsys/drm/intel/dri/intel_reg.h
deleted file mode 100644 (file)
index 4f33bee..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#ifndef _INTEL_REG_H_
-#define _INTEL_REG_H_
-
-
-#define BR00_BITBLT_CLIENT   0x40000000
-#define BR00_OP_COLOR_BLT    0x10000000
-#define BR00_OP_SRC_COPY_BLT 0x10C00000
-#define BR13_SOLID_PATTERN   0x80000000
-
-#define XY_COLOR_BLT_CMD               ((2<<29)|(0x50<<22)|0x4)
-#define XY_COLOR_BLT_WRITE_ALPHA       (1<<21)
-#define XY_COLOR_BLT_WRITE_RGB         (1<<20)
-
-#define XY_SRC_COPY_BLT_CMD             ((2<<29)|(0x53<<22)|6)
-#define XY_SRC_COPY_BLT_WRITE_ALPHA     (1<<21)
-#define XY_SRC_COPY_BLT_WRITE_RGB       (1<<20)
-
-#define MI_WAIT_FOR_EVENT               ((0x3<<23))
-#define MI_WAIT_FOR_PLANE_B_FLIP        (1<<6)
-#define MI_WAIT_FOR_PLANE_A_FLIP        (1<<2)
-
-#define MI_BATCH_BUFFER_END            (0xA<<23)
-
-
-#endif
diff --git a/src/gallium/winsys/drm/intel/dri/intel_screen.c b/src/gallium/winsys/drm/intel/dri/intel_screen.c
deleted file mode 100644 (file)
index ed75368..0000000
+++ /dev/null
@@ -1,703 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "utils.h"
-#include "vblank.h"
-#include "xmlpool.h"
-
-#include "intel_context.h"
-#include "intel_screen.h"
-#include "intel_batchbuffer.h"
-#include "intel_swapbuffers.h"
-
-#include "i830_dri.h"
-#include "ws_dri_bufpool.h"
-
-#include "pipe/p_context.h"
-#include "pipe/p_screen.h"
-#include "pipe/p_inlines.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_cb_fbo.h"
-
-static void
-intelCreateSurface(struct intel_screen *intelScreen, struct pipe_winsys *winsys, unsigned handle);
-
-static void
-intelCreateSurface(struct intel_screen *intelScreen, struct pipe_winsys *winsys, unsigned handle)
-{
-   struct pipe_screen *screen = intelScreen->base.screen;
-   struct pipe_texture *texture;
-   struct pipe_texture templat;
-   struct pipe_surface *surface;
-   struct pipe_buffer *buffer;
-   unsigned pitch;
-
-   assert(intelScreen->front.cpp == 4);
-
-   buffer = intel_be_buffer_from_handle(&intelScreen->base,
-                                        "front", handle);
-
-   if (!buffer)
-      return;
-
-   intelScreen->front.buffer = dri_bo(buffer);
-
-   memset(&templat, 0, sizeof(templat));
-   templat.tex_usage |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
-   templat.target = PIPE_TEXTURE_2D;
-   templat.last_level = 0;
-   templat.depth[0] = 1;
-   templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
-   templat.width[0] = intelScreen->front.width;
-   templat.height[0] = intelScreen->front.height;
-   pf_get_block(templat.format, &templat.block);
-   pitch = intelScreen->front.pitch;
-
-   texture = screen->texture_blanket(screen,
-                                     &templat,
-                                     &pitch,
-                                     buffer);
-
-   /* Unref the buffer we don't need it anyways */
-   pipe_buffer_reference(screen, &buffer, NULL);
-
-   surface = screen->get_tex_surface(screen,
-                                     texture,
-                                     0,
-                                     0,
-                                     0,
-                                     PIPE_BUFFER_USAGE_GPU_WRITE);
-
-   intelScreen->front.texture = texture;
-   intelScreen->front.surface = surface;
-}
-
-PUBLIC const char __driConfigOptions[] =
-   DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
-   DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
-   DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
-   DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
-//   DRI_CONF_FORCE_S3TC_ENABLE(false)
-   DRI_CONF_ALLOW_LARGE_TEXTURES(1)
-   DRI_CONF_SECTION_END DRI_CONF_END;
-
-const uint __driNConfigOptions = 3;
-
-#ifdef USE_NEW_INTERFACE
-static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
-#endif /*USE_NEW_INTERFACE */
-
-extern const struct dri_extension card_extensions[];
-
-static GLboolean
-intel_get_param(__DRIscreenPrivate *psp, int param, int *value)
-{
-   int ret;
-   struct drm_i915_getparam gp;
-
-   gp.param = param;
-   gp.value = value;
-
-   ret = drmCommandWriteRead(psp->fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
-   if (ret) {
-      fprintf(stderr, "drm_i915_getparam: %d\n", ret);
-      return GL_FALSE;
-   }
-
-   return GL_TRUE;
-}
-
-static void
-intelSetTexOffset(__DRIcontext *pDRICtx, int texname,
-                 unsigned long long offset, int depth, uint pitch)
-{
-   abort();
-#if 0
-   struct intel_context *intel = (struct intel_context*)
-      ((__DRIcontextPrivate*)pDRICtx->private)->driverPrivate;
-   struct gl_texture_object *tObj = _mesa_lookup_texture(&intel->ctx, texname);
-   struct st_texture_object *stObj = st_texture_object(tObj);
-
-   if (!stObj)
-      return;
-
-   if (stObj->pt)
-      st->pipe->texture_release(intel->st->pipe, &stObj->pt);
-
-   stObj->imageOverride = GL_TRUE;
-   stObj->depthOverride = depth;
-   stObj->pitchOverride = pitch;
-
-   if (offset)
-      stObj->textureOffset = offset;
-#endif
-}
-
-
-#if 0
-static void
-intelHandleDrawableConfig(__DRIdrawablePrivate *dPriv,
-                         __DRIcontextPrivate *pcp,
-                         __DRIDrawableConfigEvent *event)
-{
-   (void) dPriv;
-   (void) pcp;
-   (void) event;
-}
-#endif
-
-#if 0
-static void
-intelHandleBufferAttach(__DRIdrawablePrivate *dPriv,
-                       __DRIcontextPrivate *pcp,
-                       __DRIBufferAttachEvent *ba)
-{
-   struct intel_screen *intelScreen = intel_screen(dPriv->driScreenPriv);
-
-   switch (ba->buffer.attachment) {
-   case DRI_DRAWABLE_BUFFER_FRONT_LEFT:
-      intelScreen->front.width = dPriv->w;
-      intelScreen->front.height = dPriv->h;
-      intelScreen->front.cpp = ba->buffer.cpp;
-      intelScreen->front.pitch = ba->buffer.pitch;
-      driGenBuffers(intelScreen->base.staticPool, "front", 1, &intelScreen->front.buffer, 0, 0, 0);
-      driBOSetReferenced(intelScreen->front.buffer, ba->buffer.handle);
-      break;
-
-   case DRI_DRAWABLE_BUFFER_BACK_LEFT:
-   case DRI_DRAWABLE_BUFFER_DEPTH:
-   case DRI_DRAWABLE_BUFFER_STENCIL:
-   case DRI_DRAWABLE_BUFFER_ACCUM:
-      /* anything ?? */
-      break;
-
-   default:
-      fprintf(stderr, "unhandled buffer attach event, attachment type %d\n",
-             ba->buffer.attachment);
-      return;
-   }
-}
-#endif
-
-static const __DRItexOffsetExtension intelTexOffsetExtension = {
-   { __DRI_TEX_OFFSET },
-   intelSetTexOffset,
-};
-
-#if 0
-static const __DRItexBufferExtension intelTexBufferExtension = {
-    { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
-   intelSetTexBuffer,
-};
-#endif
-
-static const __DRIextension *intelScreenExtensions[] = {
-    &driReadDrawableExtension,
-    &driCopySubBufferExtension.base,
-    &driSwapControlExtension.base,
-    &driFrameTrackingExtension.base,
-    &driMediaStreamCounterExtension.base,
-    &intelTexOffsetExtension.base,
-//    &intelTexBufferExtension.base,
-    NULL
-};
-
-
-static void
-intelPrintDRIInfo(struct intel_screen * intelScreen,
-                  __DRIscreenPrivate * sPriv, I830DRIPtr gDRIPriv)
-{
-   fprintf(stderr, "*** Front size:   0x%x  offset: 0x%x  pitch: %d\n",
-           intelScreen->front.size, intelScreen->front.offset,
-           intelScreen->front.pitch);
-   fprintf(stderr, "*** Memory : 0x%x\n", gDRIPriv->mem);
-}
-
-
-#if 0
-static void
-intelPrintSAREA(const drmI830Sarea * sarea)
-{
-   fprintf(stderr, "SAREA: sarea width %d  height %d\n", sarea->width,
-           sarea->height);
-   fprintf(stderr, "SAREA: pitch: %d\n", sarea->pitch);
-   fprintf(stderr,
-           "SAREA: front offset: 0x%08x  size: 0x%x  handle: 0x%x\n",
-           sarea->front_offset, sarea->front_size,
-           (unsigned) sarea->front_handle);
-   fprintf(stderr,
-           "SAREA: back  offset: 0x%08x  size: 0x%x  handle: 0x%x\n",
-           sarea->back_offset, sarea->back_size,
-           (unsigned) sarea->back_handle);
-   fprintf(stderr, "SAREA: depth offset: 0x%08x  size: 0x%x  handle: 0x%x\n",
-           sarea->depth_offset, sarea->depth_size,
-           (unsigned) sarea->depth_handle);
-   fprintf(stderr, "SAREA: tex   offset: 0x%08x  size: 0x%x  handle: 0x%x\n",
-           sarea->tex_offset, sarea->tex_size, (unsigned) sarea->tex_handle);
-   fprintf(stderr, "SAREA: rotation: %d\n", sarea->rotation);
-   fprintf(stderr,
-           "SAREA: rotated offset: 0x%08x  size: 0x%x\n",
-           sarea->rotated_offset, sarea->rotated_size);
-   fprintf(stderr, "SAREA: rotated pitch: %d\n", sarea->rotated_pitch);
-}
-#endif
-
-
-/**
- * Use the information in the sarea to update the screen parameters
- * related to screen rotation. Needs to be called locked.
- */
-void
-intelUpdateScreenRotation(__DRIscreenPrivate * sPriv, drmI830Sarea * sarea)
-{
-   struct intel_screen *intelScreen = intel_screen(sPriv);
-
-   if (intelScreen->front.map) {
-      drmUnmap(intelScreen->front.map, intelScreen->front.size);
-      intelScreen->front.map = NULL;
-   }
-
-   if (intelScreen->front.buffer)
-      driDeleteBuffers(1, &intelScreen->front.buffer);
-
-   intelScreen->front.width = sarea->width;
-   intelScreen->front.height = sarea->height;
-   intelScreen->front.offset = sarea->front_offset;
-   intelScreen->front.pitch = sarea->pitch * intelScreen->front.cpp;
-   intelScreen->front.size = sarea->front_size;
-   intelScreen->front.handle = sarea->front_handle;
-
-   assert( sarea->front_size >=
-          intelScreen->front.pitch * intelScreen->front.height );
-
-#if 0 /* JB not important */
-   if (!sarea->front_handle)
-      return;
-
-   if (drmMap(sPriv->fd,
-             sarea->front_handle,
-             intelScreen->front.size,
-             (drmAddress *) & intelScreen->front.map) != 0) {
-      fprintf(stderr, "drmMap(frontbuffer) failed!\n");
-      return;
-   }
-#endif
-
-#if 0 /* JB */
-   if (intelScreen->staticPool) {
-      driGenBuffers(intelScreen->staticPool, "static region", 1,
-                   &intelScreen->front.buffer, 64,
-                   DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_NO_MOVE |
-                   DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0);
-
-      driBOSetStatic(intelScreen->front.buffer,
-                    intelScreen->front.offset,
-                    intelScreen->front.pitch * intelScreen->front.height,
-                    intelScreen->front.map, 0);
-   }
-#else
-   if (intelScreen->base.staticPool) {
-      if (intelScreen->front.buffer) {
-        driBOUnReference(intelScreen->front.buffer);
-        pipe_surface_reference(&intelScreen->front.surface, NULL);
-        pipe_texture_reference(&intelScreen->front.texture, NULL);
-      }
-      intelCreateSurface(intelScreen, &intelScreen->base.base, sarea->front_bo_handle);
-   }
-#endif
-}
-
-
-boolean
-intelCreatePools(__DRIscreenPrivate * sPriv)
-{
-   //unsigned batchPoolSize = 1024*1024;
-   struct intel_screen *intelScreen = intel_screen(sPriv);
-
-   if (intelScreen->havePools)
-      return GL_TRUE;
-
-   intelScreen->havePools = GL_TRUE;
-
-   if (intelScreen->sarea)
-       intelUpdateScreenRotation(sPriv, intelScreen->sarea);
-
-   return GL_TRUE;
-}
-
-static const char *
-intel_get_name( struct pipe_winsys *winsys )
-{
-   return "Intel/DRI/ttm";
-}
-
-/*
- * The state tracker (should!) keep track of whether the fake
- * frontbuffer has been touched by any rendering since the last time
- * we copied its contents to the real frontbuffer.  Our task is easy:
- */
-static void
-intel_flush_frontbuffer( struct pipe_winsys *winsys,
-                         struct pipe_surface *surf,
-                         void *context_private)
-{
-   struct intel_context *intel = (struct intel_context *) context_private;
-   __DRIdrawablePrivate *dPriv = intel->driDrawable;
-
-   intelDisplaySurface(dPriv, surf, NULL);
-}
-
-static boolean
-intelInitDriver(__DRIscreenPrivate * sPriv)
-{
-   struct intel_screen *intelScreen;
-   I830DRIPtr gDRIPriv = (I830DRIPtr) sPriv->pDevPriv;
-
-   if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
-      fprintf(stderr,
-              "\nERROR!  sizeof(I830DRIRec) does not match passed size from device driver\n");
-      return GL_FALSE;
-   }
-
-   /* Allocate the private area */
-   intelScreen = CALLOC_STRUCT(intel_screen);
-   if (!intelScreen)
-      return GL_FALSE;
-
-   /* parse information in __driConfigOptions */
-   driParseOptionInfo(&intelScreen->optionCache,
-                      __driConfigOptions, __driNConfigOptions);
-
-   sPriv->private = (void *) intelScreen;
-   intelScreen->sarea = (drmI830Sarea *) (((GLubyte *) sPriv->pSAREA) +
-                                            gDRIPriv->sarea_priv_offset);
-
-   intelScreen->deviceID = gDRIPriv->deviceID;
-
-   intelScreen->front.cpp = gDRIPriv->cpp;
-   intelScreen->drmMinor = sPriv->drm_version.minor;
-   intelUpdateScreenRotation(sPriv, intelScreen->sarea);
-
-   if (0)
-      intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv);
-
-   sPriv->extensions = intelScreenExtensions;
-
-   intelScreen->base.base.flush_frontbuffer = intel_flush_frontbuffer;
-   intelScreen->base.base.get_name = intel_get_name;
-   intel_be_init_device(&intelScreen->base, sPriv->fd, intelScreen->deviceID);
-
-   return GL_TRUE;
-}
-
-
-static void
-intelDestroyScreen(__DRIscreenPrivate * sPriv)
-{
-   struct intel_screen *intelScreen = intel_screen(sPriv);
-
-   intel_be_destroy_device(&intelScreen->base);
-   /*  intelUnmapScreenRegions(intelScreen); */
-
-   FREE(intelScreen);
-   sPriv->private = NULL;
-}
-
-
-/**
- * This is called when we need to set up GL rendering to a new X window.
- */
-static boolean
-intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
-                  __DRIdrawablePrivate * driDrawPriv,
-                  const __GLcontextModes * visual, boolean isPixmap)
-{
-   if (isPixmap) {
-      return GL_FALSE;          /* not implemented */
-   }
-   else {
-      enum pipe_format colorFormat, depthFormat, stencilFormat;
-      struct intel_framebuffer *intelfb = CALLOC_STRUCT(intel_framebuffer);
-
-      if (!intelfb)
-         return GL_FALSE;
-
-      if (visual->redBits == 5)
-         colorFormat = PIPE_FORMAT_R5G6B5_UNORM;
-      else
-         colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
-
-      if (visual->depthBits == 16)
-         depthFormat = PIPE_FORMAT_Z16_UNORM;
-      else if (visual->depthBits == 24)
-         depthFormat = PIPE_FORMAT_S8Z24_UNORM;
-      else
-         depthFormat = PIPE_FORMAT_NONE;
-
-      if (visual->stencilBits == 8)
-         stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
-      else
-         stencilFormat = PIPE_FORMAT_NONE;
-
-      intelfb->stfb = st_create_framebuffer(visual,
-                                            colorFormat,
-                                            depthFormat,
-                                            stencilFormat,
-                                            driDrawPriv->w,
-                                            driDrawPriv->h,
-                                            (void*) intelfb);
-      if (!intelfb->stfb) {
-         free(intelfb);
-         return GL_FALSE;
-      }
-
-      driDrawPriv->driverPrivate = (void *) intelfb;
-      return GL_TRUE;
-   }
-}
-
-static void
-intelDestroyBuffer(__DRIdrawablePrivate * driDrawPriv)
-{
-   struct intel_framebuffer *intelfb = intel_framebuffer(driDrawPriv);
-   assert(intelfb->stfb);
-   st_unreference_framebuffer(intelfb->stfb);
-   free(intelfb);
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-static int
-intelGetSwapInfo(__DRIdrawablePrivate * dPriv, __DRIswapInfo * sInfo)
-{
-   if ((dPriv == NULL) || (dPriv->driverPrivate == NULL)
-       || (sInfo == NULL)) {
-      return -1;
-   }
-
-   return 0;
-}
-
-static __DRIconfig **
-intelFillInModes(__DRIscreenPrivate *psp,
-                unsigned pixel_bits, unsigned depth_bits,
-                 unsigned stencil_bits, GLboolean have_back_buffer)
-{
-   __DRIconfig **configs;
-   __GLcontextModes *m;
-   unsigned num_modes;
-   unsigned depth_buffer_factor;
-   unsigned back_buffer_factor;
-   GLenum fb_format;
-   GLenum fb_type;
-   int i;
-
-   /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
-    * support pageflipping at all.
-    */
-   static const GLenum back_buffer_modes[] = {
-      GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
-   };
-
-   uint8_t depth_bits_array[3];
-   uint8_t stencil_bits_array[3];
-   uint8_t msaa_samples_array[1];
-
-
-   depth_bits_array[0] = 0;
-   depth_bits_array[1] = depth_bits;
-   depth_bits_array[2] = depth_bits;
-   msaa_samples_array[0] = 0;
-
-   /* Just like with the accumulation buffer, always provide some modes
-    * with a stencil buffer.  It will be a sw fallback, but some apps won't
-    * care about that.
-    */
-   stencil_bits_array[0] = 0;
-   stencil_bits_array[1] = 0;
-   if (depth_bits == 24)
-      stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
-
-   stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits;
-
-   depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
-   back_buffer_factor = (have_back_buffer) ? 3 : 1;
-
-   num_modes = depth_buffer_factor * back_buffer_factor * 4;
-
-   if (pixel_bits == 16) {
-      fb_format = GL_RGB;
-      fb_type = GL_UNSIGNED_SHORT_5_6_5;
-   }
-   else {
-      fb_format = GL_BGRA;
-      fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
-   }
-
-   configs = driCreateConfigs(fb_format, fb_type,
-                             depth_bits_array, stencil_bits_array,
-                             depth_buffer_factor, back_buffer_modes,
-                             back_buffer_factor, msaa_samples_array, 1);
-   if (configs == NULL) {
-    fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
-              __LINE__);
-      return NULL;
-   }
-
-   /* Mark the visual as slow if there are "fake" stencil bits.
-    */
-   for (i = 0; configs[i]; i++) {
-      m = &configs[i]->modes;
-      if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
-         m->visualRating = GLX_SLOW_CONFIG;
-      }
-   }
-
-   return configs;
-}
-
-/**
- * This is the driver specific part of the createNewScreen entry point.
- * 
- * \todo maybe fold this into intelInitDriver
- *
- * \return the __GLcontextModes supported by this driver
- */
-static const __DRIconfig **intelInitScreen(__DRIscreenPrivate *psp)
-{
-#ifdef I915
-   static const __DRIversion ddx_expected = { 1, 5, 0 };
-#else
-   static const __DRIversion ddx_expected = { 1, 6, 0 };
-#endif
-   static const __DRIversion dri_expected = { 4, 0, 0 };
-   static const __DRIversion drm_expected = { 1, 5, 0 };
-   I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv;
-
-   if (!driCheckDriDdxDrmVersions2("i915",
-                                   &psp->dri_version, &dri_expected,
-                                   &psp->ddx_version, &ddx_expected,
-                                   &psp->drm_version, &drm_expected)) {
-      return NULL;
-   }
-
-   /* Calling driInitExtensions here, with a NULL context pointer,
-    * does not actually enable the extensions.  It just makes sure
-    * that all the dispatch offsets for all the extensions that
-    * *might* be enables are known.  This is needed because the
-    * dispatch offsets need to be known when _mesa_context_create is
-    * called, but we can't enable the extensions until we have a
-    * context pointer.
-    *
-    * Hello chicken.  Hello egg.  How are you two today?
-    */
-   driInitExtensions( NULL, card_extensions, GL_FALSE );
-   //intelInitExtensions(NULL, GL_TRUE);
-          
-   if (!intelInitDriver(psp))
-       return NULL;
-
-   psp->extensions = intelScreenExtensions;
-
-   return (const __DRIconfig **)
-       intelFillInModes(psp, dri_priv->cpp * 8,
-                       (dri_priv->cpp == 2) ? 16 : 24,
-                       (dri_priv->cpp == 2) ? 0  : 8, 1);
-}
-
-/**
- * This is the driver specific part of the createNewScreen entry point.
- * 
- * \return the __GLcontextModes supported by this driver
- */
-static const
-__DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
-{
-   struct intel_screen *intelScreen;
-
-   /* Calling driInitExtensions here, with a NULL context pointer,
-    * does not actually enable the extensions.  It just makes sure
-    * that all the dispatch offsets for all the extensions that
-    * *might* be enables are known.  This is needed because the
-    * dispatch offsets need to be known when _mesa_context_create is
-    * called, but we can't enable the extensions until we have a
-    * context pointer.
-    *
-    * Hello chicken.  Hello egg.  How are you two today?
-    */
-   //intelInitExtensions(NULL, GL_TRUE);
-
-   /* Allocate the private area */
-   intelScreen = CALLOC_STRUCT(intel_screen);
-   if (!intelScreen) {
-      fprintf(stderr, "\nERROR!  Allocating private area failed\n");
-      return GL_FALSE;
-   }
-   /* parse information in __driConfigOptions */
-   driParseOptionInfo(&intelScreen->optionCache,
-                      __driConfigOptions, __driNConfigOptions);
-
-   psp->private = (void *) intelScreen;
-
-   intelScreen->drmMinor = psp->drm_version.minor;
-
-   /* Determine chipset ID? */
-   if (!intel_get_param(psp, I915_PARAM_CHIPSET_ID,
-                       &intelScreen->deviceID))
-      return GL_FALSE;
-
-   psp->extensions = intelScreenExtensions;
-
-   intel_be_init_device(&intelScreen->base, psp->fd, intelScreen->deviceID);
-   intelScreen->base.base.flush_frontbuffer = intel_flush_frontbuffer;
-   intelScreen->base.base.get_name = intel_get_name;
-
-   return driConcatConfigs(intelFillInModes(psp, 16, 16, 0, 1),
-                          intelFillInModes(psp, 32, 24, 8, 1));
-}
-
-const struct __DriverAPIRec driDriverAPI = {
-   .InitScreen          = intelInitScreen,
-   .DestroyScreen       = intelDestroyScreen,
-   .CreateContext       = intelCreateContext,
-   .DestroyContext      = intelDestroyContext,
-   .CreateBuffer        = intelCreateBuffer,
-   .DestroyBuffer       = intelDestroyBuffer,
-   .SwapBuffers                 = intelSwapBuffers,
-   .MakeCurrent                 = intelMakeCurrent,
-   .UnbindContext       = intelUnbindContext,
-   .GetSwapInfo                 = intelGetSwapInfo,
-   .GetDrawableMSC      = driDrawableGetMSC32,
-   .WaitForMSC          = driWaitForMSC32,
-   .CopySubBuffer       = intelCopySubBuffer,
-
-   //.InitScreen2               = intelInitScreen2,
-   //.HandleDrawableConfig = intelHandleDrawableConfig,
-   //.HandleBufferAttach        = intelHandleBufferAttach,
-};
diff --git a/src/gallium/winsys/drm/intel/dri/intel_screen.h b/src/gallium/winsys/drm/intel/dri/intel_screen.h
deleted file mode 100644 (file)
index 0bb43a9..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef _INTEL_SCREEN_H_
-#define _INTEL_SCREEN_H_
-
-#include "dri_util.h"
-#include "i830_common.h"
-#include "xmlconfig.h"
-#include "ws_dri_bufpool.h"
-
-#include "pipe/p_compiler.h"
-
-#include "intel_be_device.h"
-
-struct intel_screen
-{
-   struct intel_be_device base;
-
-   struct {
-      drm_handle_t handle;
-
-      /* We create a static dri buffer for the frontbuffer.
-       */
-      struct _DriBufferObject *buffer;
-      struct pipe_surface *surface;
-      struct pipe_texture *texture;
-
-      char *map;                   /* memory map */
-      int offset;                  /* from start of video mem, in bytes */
-      int pitch;                   /* row stride, in bytes */
-      int width;
-      int height;
-      int size;
-      int cpp;                     /* for front and back buffers */
-   } front;
-
-   int deviceID;
-   int drmMinor;
-
-   drmI830Sarea *sarea;
-
-   /**
-   * Configuration cache with default values for all contexts
-   */
-   driOptionCache optionCache;
-
-   boolean havePools;
-
-   /**
-    * Temporary(?) context to use for SwapBuffers or other situations in
-    * which we need a rendering context, but none is currently bound.
-    */
-   struct intel_context *dummyContext;
-
-   /*
-    * New stuff form the i915tex integration
-    */
-   unsigned batch_id;
-
-
-   struct pipe_winsys *winsys;
-};
-
-
-
-/** cast wrapper */
-static INLINE struct intel_screen *
-intel_screen(__DRIscreenPrivate *sPriv)
-{
-   return (struct intel_screen *) sPriv->private;
-}
-
-
-extern void
-intelUpdateScreenRotation(__DRIscreenPrivate * sPriv, drmI830Sarea * sarea);
-
-
-extern void intelDestroyContext(__DRIcontextPrivate * driContextPriv);
-
-extern boolean intelUnbindContext(__DRIcontextPrivate * driContextPriv);
-
-extern boolean
-intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
-                 __DRIdrawablePrivate * driDrawPriv,
-                 __DRIdrawablePrivate * driReadPriv);
-
-
-extern boolean
-intelCreatePools(__DRIscreenPrivate *sPriv);
-
-extern boolean
-intelCreateContext(const __GLcontextModes * visual,
-                   __DRIcontextPrivate * driContextPriv,
-                   void *sharedContextPrivate);
-
-
-#endif
diff --git a/src/gallium/winsys/drm/intel/dri/intel_swapbuffers.c b/src/gallium/winsys/drm/intel/dri/intel_swapbuffers.c
deleted file mode 100644 (file)
index 34ad7ee..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_swapbuffers.h"
-
-#include "intel_reg.h"
-
-#include "pipe/p_context.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
-#include "state_tracker/st_cb_fbo.h"
-
-#include "ws_dri_bufmgr.h"
-#include "intel_batchbuffer.h"
-
-/**
- * Display a colorbuffer surface in an X window.
- * Used for SwapBuffers and flushing front buffer rendering.
- *
- * \param dPriv  the window/drawable to display into
- * \param surf  the surface to display
- * \param rect  optional subrect of surface to display (may be NULL).
- */
-void
-intelDisplaySurface(__DRIdrawablePrivate *dPriv,
-                    struct pipe_surface *surf,
-                    const drm_clip_rect_t *rect)
-{
-   struct intel_screen *intelScreen = intel_screen(dPriv->driScreenPriv);
-   struct intel_context *intel = intelScreen->dummyContext;
-
-   DBG(SWAP, "%s\n", __FUNCTION__);
-
-   if (!intel) {
-      /* XXX this is where some kind of extra/meta context could be useful */
-      return;
-   }
-
-   if (intel->last_swap_fence) {
-      driFenceFinish(intel->last_swap_fence, DRM_FENCE_TYPE_EXE, TRUE);
-      driFenceUnReference(&intel->last_swap_fence);
-      intel->last_swap_fence = NULL;
-   }
-   intel->last_swap_fence = intel->first_swap_fence;
-   intel->first_swap_fence = NULL;
-
-   /* The LOCK_HARDWARE is required for the cliprects.  Buffer offsets
-    * should work regardless.
-    */
-   LOCK_HARDWARE(intel);
-   /* if this drawable isn't currently bound the LOCK_HARDWARE done on the
-    * current context (which is what intelScreenContext should return) might
-    * not get a contended lock and thus cliprects not updated (tests/manywin)
-    */
-   if (intel_context(dPriv->driContextPriv) != intel)
-      DRI_VALIDATE_DRAWABLE_INFO(intel->driScreen, dPriv);
-
-
-   if (dPriv && dPriv->numClipRects) {
-      const int srcWidth = surf->width;
-      const int srcHeight = surf->height;
-      const int nbox = dPriv->numClipRects;
-      const drm_clip_rect_t *pbox = dPriv->pClipRects;
-      const int pitch = intelScreen->front.pitch / intelScreen->front.cpp;
-      const int cpp = intelScreen->front.cpp;
-      const int srcpitch = surf->stride / cpp;
-      int BR13, CMD;
-      int i;
-
-      ASSERT(surf->buffer);
-
-      DBG(SWAP, "screen pitch %d  src surface pitch %d\n",
-         pitch, surf->stride);
-
-      if (cpp == 2) {
-        BR13 = (pitch * cpp) | (0xCC << 16) | (1 << 24);
-        CMD = XY_SRC_COPY_BLT_CMD;
-      }
-      else {
-        BR13 = (pitch * cpp) | (0xCC << 16) | (1 << 24) | (1 << 25);
-        CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
-               XY_SRC_COPY_BLT_WRITE_RGB);
-      }
-
-      for (i = 0; i < nbox; i++, pbox++) {
-        drm_clip_rect_t box;
-        drm_clip_rect_t sbox;
-
-        if (pbox->x1 > pbox->x2 ||
-            pbox->y1 > pbox->y2 ||
-            pbox->x2 > intelScreen->front.width ||
-            pbox->y2 > intelScreen->front.height) {
-            /* invalid cliprect, skip it */
-           continue;
-         }
-
-        box = *pbox;
-
-        if (rect) {
-            /* intersect cliprect with user-provided src rect */
-           drm_clip_rect_t rrect;
-
-           rrect.x1 = dPriv->x + rect->x1;
-           rrect.y1 = (dPriv->h - rect->y1 - rect->y2) + dPriv->y;
-           rrect.x2 = rect->x2 + rrect.x1;
-           rrect.y2 = rect->y2 + rrect.y1;
-           if (rrect.x1 > box.x1)
-              box.x1 = rrect.x1;
-           if (rrect.y1 > box.y1)
-              box.y1 = rrect.y1;
-           if (rrect.x2 < box.x2)
-              box.x2 = rrect.x2;
-           if (rrect.y2 < box.y2)
-              box.y2 = rrect.y2;
-
-           if (box.x1 > box.x2 || box.y1 > box.y2)
-              continue;
-        }
-
-        /* restrict blit to size of actually rendered area */
-        if (box.x2 - box.x1 > srcWidth)
-           box.x2 = srcWidth + box.x1;
-        if (box.y2 - box.y1 > srcHeight)
-           box.y2 = srcHeight + box.y1;
-
-        DBG(SWAP, "box x1 x2 y1 y2 %d %d %d %d\n",
-            box.x1, box.x2, box.y1, box.y2);
-
-        sbox.x1 = box.x1 - dPriv->x;
-        sbox.y1 = box.y1 - dPriv->y;
-
-         assert(box.x1 < box.x2);
-         assert(box.y1 < box.y2);
-
-         /* XXX this could be done with pipe->surface_copy() */
-        /* XXX should have its own batch buffer */
-        if (!BEGIN_BATCH(8, 2)) {
-           /*
-            * Since we share this batch buffer with a context
-            * we can't flush it since that risks a GPU lockup
-            */
-           assert(0);
-           continue;
-        }
-
-        OUT_BATCH(CMD);
-        OUT_BATCH(BR13);
-        OUT_BATCH((box.y1 << 16) | box.x1);
-        OUT_BATCH((box.y2 << 16) | box.x2);
-
-        OUT_RELOC(intelScreen->front.buffer,
-                  DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
-                  DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0);
-        OUT_BATCH((sbox.y1 << 16) | sbox.x1);
-        OUT_BATCH((srcpitch * cpp) & 0xffff);
-        OUT_RELOC(dri_bo(surf->buffer),
-                   DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
-                  DRM_BO_MASK_MEM | DRM_BO_FLAG_READ, 0);
-
-      }
-
-      if (intel->first_swap_fence)
-        driFenceUnReference(&intel->first_swap_fence);
-      intel->first_swap_fence = intel_be_batchbuffer_flush(intel->base.batch);
-   }
-
-   UNLOCK_HARDWARE(intel);
-
-   if (intel->lastStamp != dPriv->lastStamp) {
-      intelUpdateWindowSize(dPriv);
-      intel->lastStamp = dPriv->lastStamp;
-   }
-}
-
-
-
-/**
- * This will be called whenever the currently bound window is moved/resized.
- */
-void
-intelUpdateWindowSize(__DRIdrawablePrivate *dPriv)
-{
-   struct intel_framebuffer *intelfb = intel_framebuffer(dPriv);
-   assert(intelfb->stfb);
-   st_resize_framebuffer(intelfb->stfb, dPriv->w, dPriv->h);
-}
-
-
-
-void
-intelSwapBuffers(__DRIdrawablePrivate * dPriv)
-{
-   struct intel_framebuffer *intel_fb = intel_framebuffer(dPriv);
-   struct pipe_surface *back_surf;
-
-   assert(intel_fb);
-   assert(intel_fb->stfb);
-
-   back_surf = st_get_framebuffer_surface(intel_fb->stfb,
-                                          ST_SURFACE_BACK_LEFT);
-   if (back_surf) {
-      st_notify_swapbuffers(intel_fb->stfb);
-      intelDisplaySurface(dPriv, back_surf, NULL);
-      st_notify_swapbuffers_complete(intel_fb->stfb);
-   }
-}
-
-
-/**
- * Called via glXCopySubBufferMESA() to copy a subrect of the back
- * buffer to the front buffer/screen.
- */
-void
-intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
-{
-   struct intel_framebuffer *intel_fb = intel_framebuffer(dPriv);
-   struct pipe_surface *back_surf;
-
-   assert(intel_fb);
-   assert(intel_fb->stfb);
-
-   back_surf = st_get_framebuffer_surface(intel_fb->stfb,
-                                          ST_SURFACE_BACK_LEFT);
-   if (back_surf) {
-      drm_clip_rect_t rect;
-      rect.x1 = x;
-      rect.y1 = y;
-      rect.x2 = w;
-      rect.y2 = h;
-
-      st_notify_swapbuffers(intel_fb->stfb);
-      intelDisplaySurface(dPriv, back_surf, &rect);
-   }
-}
diff --git a/src/gallium/winsys/drm/intel/dri/intel_swapbuffers.h b/src/gallium/winsys/drm/intel/dri/intel_swapbuffers.h
deleted file mode 100644 (file)
index 46c9bab..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef INTEL_SWAPBUFFERS_H
-#define INTEL_SWAPBUFFERS_H
-
-
-struct pipe_surface;
-
-
-extern void intelDisplaySurface(__DRIdrawablePrivate * dPriv,
-                                struct pipe_surface *surf,
-                                const drm_clip_rect_t * rect);
-
-extern void intelSwapBuffers(__DRIdrawablePrivate * dPriv);
-
-extern void intelCopySubBuffer(__DRIdrawablePrivate * dPriv,
-                               int x, int y, int w, int h);
-
-extern void intelUpdateWindowSize(__DRIdrawablePrivate *dPriv);
-
-
-#endif /* INTEL_SWAPBUFFERS_H */
diff --git a/src/gallium/winsys/drm/intel/dri/intel_winsys_softpipe.c b/src/gallium/winsys/drm/intel/dri/intel_winsys_softpipe.c
deleted file mode 100644 (file)
index 20920a2..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-/*
- * Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
- */
-
-#include "intel_context.h"
-#include "intel_winsys_softpipe.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_format.h"
-#include "util/u_memory.h"
-#include "softpipe/sp_winsys.h"
-
-
-struct intel_softpipe_winsys {
-   struct softpipe_winsys sws;
-   struct intel_context *intel;
-};
-
-/**
- * Return list of surface formats supported by this driver.
- */
-static boolean
-intel_is_format_supported(struct softpipe_winsys *sws,
-                          enum pipe_format format)
-{
-   switch(format) {
-   case PIPE_FORMAT_A8R8G8B8_UNORM:
-   case PIPE_FORMAT_R5G6B5_UNORM:
-   case PIPE_FORMAT_S8Z24_UNORM:
-      return TRUE;
-   default:
-      return FALSE;
-   }
-}
-
-
-/**
- * Create rendering context which uses software rendering.
- */
-struct pipe_context *
-intel_create_softpipe( struct intel_context *intel,
-                       struct pipe_winsys *winsys )
-{
-   struct intel_softpipe_winsys *isws = CALLOC_STRUCT( intel_softpipe_winsys );
-   struct pipe_screen *screen = softpipe_create_screen(winsys);
-
-   /* Fill in this struct with callbacks that softpipe will need to
-    * communicate with the window system, buffer manager, etc.
-    */
-   isws->sws.is_format_supported = intel_is_format_supported;
-   isws->intel = intel;
-
-   /* Create the softpipe context:
-    */
-   return softpipe_create( screen, winsys, &isws->sws );
-}
diff --git a/src/gallium/winsys/drm/intel/dri/intel_winsys_softpipe.h b/src/gallium/winsys/drm/intel/dri/intel_winsys_softpipe.h
deleted file mode 100644 (file)
index 5fa14cb..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef INTEL_SOFTPIPE_H
-#define INTEL_SOFTPIPE_H
-
-struct pipe_winsys;
-struct pipe_context;
-struct intel_context;
-
-struct pipe_context *
-intel_create_softpipe( struct intel_context *intel,
-                       struct pipe_winsys *winsys );
-
-#endif
diff --git a/src/gallium/winsys/drm/intel/dri/server/i830_common.h b/src/gallium/winsys/drm/intel/dri/server/i830_common.h
deleted file mode 100644 (file)
index 3452ddb..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 VA Linux Systems Inc., Fremont, California.
-Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-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
-ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-
-#ifndef _I830_COMMON_H_
-#define _I830_COMMON_H_
-
-
-#define I830_NR_TEX_REGIONS 255        /* maximum due to use of chars for next/prev */
-#define I830_LOG_MIN_TEX_REGION_SIZE 14
-
-
-/* Driver specific DRM command indices
- * NOTE: these are not OS specific, but they are driver specific
- */
-#define DRM_I830_INIT                     0x00
-#define DRM_I830_FLUSH                    0x01
-#define DRM_I830_FLIP                     0x02
-#define DRM_I830_BATCHBUFFER              0x03
-#define DRM_I830_IRQ_EMIT                 0x04
-#define DRM_I830_IRQ_WAIT                 0x05
-#define DRM_I830_GETPARAM                 0x06
-#define DRM_I830_SETPARAM                 0x07
-#define DRM_I830_ALLOC                    0x08
-#define DRM_I830_FREE                     0x09
-#define DRM_I830_INIT_HEAP                0x0a
-#define DRM_I830_CMDBUFFER                0x0b
-#define DRM_I830_DESTROY_HEAP             0x0c
-#define DRM_I830_SET_VBLANK_PIPE          0x0d
-#define DRM_I830_GET_VBLANK_PIPE          0x0e
-#define DRM_I830_MMIO                    0x10
-
-typedef struct {
-   enum {
-      I830_INIT_DMA = 0x01,
-      I830_CLEANUP_DMA = 0x02,
-      I830_RESUME_DMA = 0x03
-   } func;
-   unsigned int mmio_offset;
-   int sarea_priv_offset;
-   unsigned int ring_start;
-   unsigned int ring_end;
-   unsigned int ring_size;
-   unsigned int front_offset;
-   unsigned int back_offset;
-   unsigned int depth_offset;
-   unsigned int w;
-   unsigned int h;
-   unsigned int pitch;
-   unsigned int pitch_bits;
-   unsigned int back_pitch;
-   unsigned int depth_pitch;
-   unsigned int cpp;
-   unsigned int chipset;
-} drmI830Init;
-
-typedef struct {
-       drmTextureRegion texList[I830_NR_TEX_REGIONS+1];
-        int last_upload;       /* last time texture was uploaded */
-        int last_enqueue;      /* last time a buffer was enqueued */
-       int last_dispatch;      /* age of the most recently dispatched buffer */
-       int ctxOwner;           /* last context to upload state */
-       /** Last context that used the buffer manager. */
-       int texAge;
-        int pf_enabled;                /* is pageflipping allowed? */
-        int pf_active;
-        int pf_current_page;   /* which buffer is being displayed? */
-        int perf_boxes;                /* performance boxes to be displayed */
-       int width, height;      /* screen size in pixels */
-
-       drm_handle_t front_handle;
-       int front_offset;
-       int front_size;
-
-       drm_handle_t back_handle;
-       int back_offset;
-       int back_size;
-
-       drm_handle_t depth_handle;
-       int depth_offset;
-       int depth_size;
-
-       drm_handle_t tex_handle;
-       int tex_offset;
-       int tex_size;
-       int log_tex_granularity;
-       int pitch;
-       int rotation;           /* 0, 90, 180 or 270 */
-       int rotated_offset;
-       int rotated_size;
-       int rotated_pitch;
-       int virtualX, virtualY;
-
-       unsigned int front_tiled;
-       unsigned int back_tiled;
-       unsigned int depth_tiled;
-       unsigned int rotated_tiled;
-       unsigned int rotated2_tiled;
-
-       int planeA_x;
-       int planeA_y;
-       int planeA_w;
-       int planeA_h;
-       int planeB_x;
-       int planeB_y;
-       int planeB_w;
-       int planeB_h;
-
-       /* Triple buffering */
-       drm_handle_t third_handle;
-       int third_offset;
-       int third_size;
-       unsigned int third_tiled;
-
-       /* buffer object handles for the static buffers.  May change
-        * over the lifetime of the client, though it doesn't in our current
-        * implementation.
-        */
-       unsigned int front_bo_handle;
-       unsigned int back_bo_handle;
-       unsigned int third_bo_handle;
-       unsigned int depth_bo_handle;
-} drmI830Sarea;
-
-/* Flags for perf_boxes
- */
-#define I830_BOX_RING_EMPTY    0x1 /* populated by kernel */
-#define I830_BOX_FLIP          0x2 /* populated by kernel */
-#define I830_BOX_WAIT          0x4 /* populated by kernel & client */
-#define I830_BOX_TEXTURE_LOAD  0x8 /* populated by kernel */
-#define I830_BOX_LOST_CONTEXT  0x10 /* populated by client */
-
-
-typedef struct {
-       int start;              /* agp offset */
-       int used;               /* nr bytes in use */
-       int DR1;                /* hw flags for GFX_OP_DRAWRECT_INFO */
-        int DR4;               /* window origin for GFX_OP_DRAWRECT_INFO*/
-       int num_cliprects;      /* mulitpass with multiple cliprects? */
-        drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */
-} drmI830BatchBuffer;
-
-typedef struct {
-       char *buf;              /* agp offset */
-       int sz;                 /* nr bytes in use */
-       int DR1;                /* hw flags for GFX_OP_DRAWRECT_INFO */
-        int DR4;               /* window origin for GFX_OP_DRAWRECT_INFO*/
-       int num_cliprects;      /* mulitpass with multiple cliprects? */
-        drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */
-} drmI830CmdBuffer;
-
-typedef struct {
-       int *irq_seq;
-} drmI830IrqEmit;
-
-typedef struct {
-       int irq_seq;
-} drmI830IrqWait;
-
-typedef struct {
-       int param;
-       int *value;
-} drmI830GetParam;
-
-#define I830_PARAM_IRQ_ACTIVE     1
-#define I830_PARAM_ALLOW_BATCHBUFFER   2
-
-typedef struct {
-       int param;
-       int value;
-} drmI830SetParam;
-
-#define I830_SETPARAM_USE_MI_BATCHBUFFER_START  1
-#define I830_SETPARAM_TEX_LRU_LOG_GRANULARITY   2
-#define I830_SETPARAM_ALLOW_BATCHBUFFER         3
-
-
-/* A memory manager for regions of shared memory:
- */
-#define I830_MEM_REGION_AGP 1
-
-typedef struct {
-       int region;
-       int alignment;
-       int size;
-       int *region_offset;     /* offset from start of fb or agp */
-} drmI830MemAlloc;
-
-typedef struct {
-       int region;
-       int region_offset;
-} drmI830MemFree;
-
-typedef struct {
-       int region;
-       int size;
-       int start;      
-} drmI830MemInitHeap;
-
-typedef struct {
-       int region;
-} drmI830MemDestroyHeap;
-
-#define DRM_I830_VBLANK_PIPE_A  1
-#define DRM_I830_VBLANK_PIPE_B  2
-
-typedef struct {
-        int pipe;
-} drmI830VBlankPipe;
-
-#define MMIO_READ  0
-#define MMIO_WRITE 1
-
-#define MMIO_REGS_IA_PRIMATIVES_COUNT           0
-#define MMIO_REGS_IA_VERTICES_COUNT             1
-#define MMIO_REGS_VS_INVOCATION_COUNT           2
-#define MMIO_REGS_GS_PRIMITIVES_COUNT           3
-#define MMIO_REGS_GS_INVOCATION_COUNT           4
-#define MMIO_REGS_CL_PRIMITIVES_COUNT           5
-#define MMIO_REGS_CL_INVOCATION_COUNT           6
-#define MMIO_REGS_PS_INVOCATION_COUNT           7
-#define MMIO_REGS_PS_DEPTH_COUNT                8
-
-typedef struct {
-        unsigned int read_write:1;
-        unsigned int reg:31;
-        void __user *data;
-} drmI830MMIO;
-
-#endif /* _I830_DRM_H_ */
diff --git a/src/gallium/winsys/drm/intel/dri/server/i830_dri.h b/src/gallium/winsys/drm/intel/dri/server/i830_dri.h
deleted file mode 100644 (file)
index 0d514b6..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-
-#ifndef _I830_DRI_H
-#define _I830_DRI_H
-
-#include "xf86drm.h"
-#include "i830_common.h"
-
-#define I830_MAX_DRAWABLES 256
-
-#define I830_MAJOR_VERSION 1
-#define I830_MINOR_VERSION 7
-#define I830_PATCHLEVEL 2
-
-#define I830_REG_SIZE 0x80000
-
-typedef struct _I830DRIRec {
-   drm_handle_t regs;
-   drmSize regsSize;
-
-   drmSize unused1; /* backbufferSize */
-   drm_handle_t unused2; /* backbuffer */
-
-   drmSize unused3; /* depthbufferSize */
-   drm_handle_t unused4; /* depthbuffer */
-
-   drmSize unused5; /* rotatedSize */
-   drm_handle_t unused6; /* rotatedbuffer */
-
-   drm_handle_t unused7; /* textures */
-   int unused8; /* textureSize */
-
-   drm_handle_t unused9; /* agp_buffers */
-   drmSize unused10; /* agp_buf_size */
-
-   int deviceID;
-   int width;
-   int height;
-   int mem;
-   int cpp;
-   int bitsPerPixel;
-
-   int unused11[8]; /* was front/back/depth/rotated offset/pitch */
-
-   int unused12; /* logTextureGranularity */
-   int unused13; /* textureOffset */
-
-   int irq;
-   int sarea_priv_offset;
-} I830DRIRec, *I830DRIPtr;
-
-typedef struct {
-   /* Nothing here yet */
-   int dummy;
-} I830ConfigPrivRec, *I830ConfigPrivPtr;
-
-typedef struct {
-   /* Nothing here yet */
-   int dummy;
-} I830DRIContextRec, *I830DRIContextPtr;
-
-
-#endif
diff --git a/src/gallium/winsys/drm/intel/dri2/Makefile b/src/gallium/winsys/drm/intel/dri2/Makefile
new file mode 100644 (file)
index 0000000..1a02109
--- /dev/null
@@ -0,0 +1,22 @@
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = i915_dri.so
+
+PIPE_DRIVERS = \
+       $(TOP)/src/gallium/state_trackers/dri2/libdri2drm.a \
+       $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \
+       $(TOP)/src/gallium/drivers/i915simple/libi915simple.a
+
+
+DRIVER_SOURCES =
+
+C_SOURCES = \
+       $(COMMON_GALLIUM_SOURCES) \
+       $(DRIVER_SOURCES)
+
+include ../../Makefile.template
+
+DRI_LIB_DEPS += -ldrm_intel
+
+symlinks:
index 7147d89e0d0a86f06aaacea6f14f6f1bb165c7dc..c5217ad2d634b538a6d106f1926c763a8577c159 100644 (file)
@@ -1,19 +1,16 @@
 TOP = ../../../../../..
+GALLIUMDIR = ../../../..
 include $(TOP)/configs/current
 
 LIBNAME = EGL_i915.so
 
 PIPE_DRIVERS = \
-       ../gem/libinteldrm.a \
-       $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
-       $(TOP)/src/gallium/drivers/i915simple/libi915simple.a \
        $(TOP)/src/gallium/state_trackers/egl/libegldrm.a \
+       $(GALLIUMDIR)/winsys/drm/intel/gem/libinteldrm.a \
+       $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+       $(TOP)/src/gallium/drivers/i915simple/libi915simple.a
 
-
-DRIVER_SOURCES = \
-       intel_context.c \
-       intel_device.c \
-       intel_api.c
+DRIVER_SOURCES =
 
 C_SOURCES = \
        $(COMMON_GALLIUM_SOURCES) \
diff --git a/src/gallium/winsys/drm/intel/egl/intel_api.c b/src/gallium/winsys/drm/intel/egl/intel_api.c
deleted file mode 100644 (file)
index 5dc4a7b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-
-#include "intel_api.h"
-
-struct drm_api drm_api_hocks =
-{
-       .create_screen = intel_create_screen,
-       .create_context = intel_create_context,
-       .buffer_from_handle = intel_be_buffer_from_handle,
-       .handle_from_buffer = intel_be_handle_from_buffer,
-};
diff --git a/src/gallium/winsys/drm/intel/egl/intel_api.h b/src/gallium/winsys/drm/intel/egl/intel_api.h
deleted file mode 100644 (file)
index 8ec165a..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-
-#ifndef _INTEL_API_H_
-#define _INTEL_API_H_
-
-#include "pipe/p_compiler.h"
-
-#include "state_tracker/drm_api.h"
-
-#include "intel_be_device.h"
-
-struct pipe_screen *intel_create_screen(int drmFD, int pciID);
-struct pipe_context *intel_create_context(struct pipe_screen *screen);
-
-#endif
diff --git a/src/gallium/winsys/drm/intel/egl/intel_context.c b/src/gallium/winsys/drm/intel/egl/intel_context.c
deleted file mode 100644 (file)
index 57e5ff7..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-
-#include "i915simple/i915_screen.h"
-
-#include "intel_be_device.h"
-#include "intel_be_context.h"
-
-#include "pipe/p_defines.h"
-#include "pipe/p_context.h"
-
-#include "intel_api.h"
-
-struct intel_context
-{
-       struct intel_be_context base;
-
-       /* stuff */
-};
-
-/*
- * Hardware lock functions.
- * Doesn't do anything in EGL
- */
-
-static void
-intel_lock_hardware(struct intel_be_context *context)
-{
-       (void)context;
-}
-
-static void
-intel_unlock_hardware(struct intel_be_context *context)
-{
-       (void)context;
-}
-
-static boolean
-intel_locked_hardware(struct intel_be_context *context)
-{
-       (void)context;
-       return FALSE;
-}
-
-
-/*
- * Misc functions.
- */
-static void
-intel_destroy_be_context(struct i915_winsys *winsys)
-{
-       struct intel_context *intel = (struct intel_context *)winsys;
-
-       intel_be_destroy_context(&intel->base);
-       free(intel);
-}
-
-struct pipe_context *
-intel_create_context(struct pipe_screen *screen)
-{
-       struct intel_context *intel;
-       struct pipe_context *pipe;
-       struct intel_be_device *device = (struct intel_be_device *)screen->winsys;
-
-       intel = (struct intel_context *)malloc(sizeof(*intel));
-       memset(intel, 0, sizeof(*intel));
-
-       intel->base.hardware_lock = intel_lock_hardware;
-       intel->base.hardware_unlock = intel_unlock_hardware;
-       intel->base.hardware_locked = intel_locked_hardware;
-
-       intel_be_init_context(&intel->base, device);
-
-       intel->base.base.destroy = intel_destroy_be_context;
-
-#if 0
-       pipe = intel_create_softpipe(intel, screen->winsys);
-#else
-       pipe = i915_create_context(screen, &device->base, &intel->base.base);
-#endif
-
-       pipe->priv = intel;
-
-       return pipe;
-}
diff --git a/src/gallium/winsys/drm/intel/egl/intel_device.c b/src/gallium/winsys/drm/intel/egl/intel_device.c
deleted file mode 100644 (file)
index 6b28140..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-
-#include <stdio.h>
-#include "pipe/p_defines.h"
-#include "intel_be_device.h"
-#include "i915simple/i915_screen.h"
-
-#include "intel_api.h"
-
-struct intel_device
-{
-       struct intel_be_device base;
-
-       int deviceID;
-};
-
-static void
-intel_destroy_winsys(struct pipe_winsys *winsys)
-{
-       struct intel_device *dev = (struct intel_device *)winsys;
-
-       intel_be_destroy_device(&dev->base);
-
-       free(dev);
-}
-
-struct pipe_screen *
-intel_create_screen(int drmFD, int deviceID)
-{
-       struct intel_device *dev;
-       struct pipe_screen *screen;
-
-       /* Allocate the private area */
-       dev = malloc(sizeof(*dev));
-       if (!dev)
-               return NULL;
-       memset(dev, 0, sizeof(*dev));
-
-       dev->deviceID = deviceID;
-
-       intel_be_init_device(&dev->base, drmFD, deviceID);
-
-       /* we need to hock our own destroy function in here */
-       dev->base.base.destroy = intel_destroy_winsys;
-
-       screen = i915_create_screen(&dev->base.base, deviceID);
-
-       return screen;
-}
index b25fc258f45e06b099366673480f96a6f125afa8..7ab1a2a771b1dbe1eed32b17ba7a78b3c7054f96 100644 (file)
@@ -6,13 +6,11 @@ LIBNAME = inteldrm
 C_SOURCES = \
        intel_be_batchbuffer.c \
        intel_be_context.c \
-       intel_be_device.c
+       intel_be_device.c \
+       intel_be_api.c
 
+LIBRARY_INCLUDES = $(shell pkg-config libdrm --cflags-only-I)
 
-include ./Makefile.template
-
-DRIVER_DEFINES = $(shell pkg-config libdrm --cflags \
-                && pkg-config libdrm --atleast-version=2.3.1 \
-                && echo "-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP")
-symlinks:
+LIBRARY_DEFINES = $(shell pkg-config libdrm --cflags-only-other)
 
+include ../../../../Makefile.template
diff --git a/src/gallium/winsys/drm/intel/gem/Makefile.template b/src/gallium/winsys/drm/intel/gem/Makefile.template
deleted file mode 100644 (file)
index b60e978..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*-makefile-*-
-
-
-# We still have a dependency on the "dri" buffer manager.  Most likely
-# the interface can be reused in non-dri environments, and also as a
-# frontend to simpler memory managers.
-#
-COMMON_SOURCES =
-
-OBJECTS = $(C_SOURCES:.c=.o) \
-       $(CPP_SOURCES:.cpp=.o) \
-       $(ASM_SOURCES:.S=.o)
-
-
-### Include directories
-INCLUDES = \
-       -I. \
-       -I$(TOP)/src/gallium/include \
-       -I$(TOP)/src/gallium/auxiliary \
-       -I$(TOP)/src/gallium/drivers \
-       -I$(TOP)/include \
-       $(DRIVER_INCLUDES)
-
-
-##### RULES #####
-
-.c.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.cpp.o:
-       $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.S.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES)  $< -o $@
-
-
-##### TARGETS #####
-
-default: depend symlinks lib$(LIBNAME).a
-
-
-lib$(LIBNAME).a: $(OBJECTS) Makefile Makefile.template
-       $(TOP)/bin/mklib -o $(LIBNAME) -static $(OBJECTS) $(DRIVER_LIBS)
-
-
-depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
-       rm -f depend
-       touch depend
-       $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) \
-               $(ASM_SOURCES) 2> /dev/null
-
-
-# Emacs tags
-tags:
-       etags `find . -name \*.[ch]` `find ../include`
-
-
-# Remove .o and backup files
-clean::
-       -rm -f *.o */*.o *~ *.so *.a *~ server/*.o $(SYMLINKS)
-       -rm -f depend depend.bak
-
-
-include depend
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.c b/src/gallium/winsys/drm/intel/gem/intel_be_api.c
new file mode 100644 (file)
index 0000000..f4ef7c2
--- /dev/null
@@ -0,0 +1,15 @@
+
+#include "intel_be_api.h"
+#include "i915simple/i915_winsys.h"
+
+struct drm_api drm_api_hooks =
+{
+       /* intel_be_context.c */
+       .create_context = intel_be_create_context,
+       /* intel_be_device.c */
+       .create_screen = intel_be_create_screen,
+       .buffer_from_texture = i915_get_texture_buffer,
+       .buffer_from_handle = intel_be_buffer_from_handle,
+       .handle_from_buffer = intel_be_handle_from_buffer,
+       .global_handle_from_buffer = intel_be_global_handle_from_buffer,
+};
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.h b/src/gallium/winsys/drm/intel/gem/intel_be_api.h
new file mode 100644 (file)
index 0000000..73e458d
--- /dev/null
@@ -0,0 +1,14 @@
+
+#ifndef _INTEL_BE_API_H_
+#define _INTEL_BE_API_H_
+
+#include "pipe/p_compiler.h"
+
+#include "state_tracker/drm_api.h"
+
+#include "intel_be_device.h"
+
+struct pipe_screen *intel_be_create_screen(int drmFD, int pciID);
+struct pipe_context *intel_be_create_context(struct pipe_screen *screen);
+
+#endif
index d9556e1f38427dec9201ca02f5337e2af86679a9..d5e63c3bae5cf628cd9499b6a8c008fb2cdedf2c 100644 (file)
@@ -21,7 +21,7 @@ intel_be_batchbuffer_alloc(struct intel_be_context *intel)
        batch->base.size = 0;
        batch->base.actual_size = intel->device->max_batch_size;
        batch->base.relocs = 0;
-       batch->base.max_relocs = INTEL_DEFAULT_RELOCS;
+       batch->base.max_relocs = 500;/*INTEL_DEFAULT_RELOCS;*/
 
        batch->base.map = malloc(batch->base.actual_size);
        memset(batch->base.map, 0, batch->base.actual_size);
@@ -47,7 +47,6 @@ intel_be_batchbuffer_reset(struct intel_be_batchbuffer *batch)
        batch->base.size = batch->base.actual_size - BATCH_RESERVED;
 
        batch->base.relocs = 0;
-       batch->base.max_relocs = INTEL_DEFAULT_RELOCS;
 
        batch->bo = drm_intel_bo_alloc(dev->pools.gem,
                                       "gallium3d_batch_buffer",
@@ -115,10 +114,10 @@ intel_be_batchbuffer_flush(struct intel_be_batchbuffer *batch,
 
        if (fence) {
                if (*fence)
-                       intel_be_fence_unreference(*fence);
+                       intel_be_fence_reference(fence, NULL);
 
                (*fence) = CALLOC_STRUCT(intel_be_fence);
-               (*fence)->refcount = 1;
+               pipe_reference_init(&(*fence)->reference, 1);
                (*fence)->bo = NULL;
        }
 }
index 95e761d78d0f8050010992909c43ef5d4656e007..bb6f1b916c270ded609372c804f87de07daeda17 100644 (file)
@@ -1,10 +1,14 @@
 
+#include "pipe/p_screen.h"
+
 #include "intel_be_device.h"
 #include "intel_be_context.h"
 #include "intel_be_batchbuffer.h"
 
 #include "i915_drm.h"
 
+#include "intel_be_api.h"
+
 static struct i915_batchbuffer *
 intel_be_batch_get(struct i915_winsys *sws)
 {
@@ -57,6 +61,21 @@ intel_be_batch_flush(struct i915_winsys *sws,
        intel_be_batchbuffer_flush(intel->batch, f);
 }
 
+
+/*
+ * Misc functions.
+ */
+
+static void
+intel_be_destroy_context(struct i915_winsys *winsys)
+{
+       struct intel_be_context *intel = intel_be_context(winsys);
+
+       intel_be_batchbuffer_free(intel->batch);
+
+       free(intel);
+}
+
 boolean
 intel_be_init_context(struct intel_be_context *intel, struct intel_be_device *device)
 {
@@ -68,13 +87,32 @@ intel_be_init_context(struct intel_be_context *intel, struct intel_be_device *de
        intel->base.batch_reloc = intel_be_batch_reloc;
        intel->base.batch_flush = intel_be_batch_flush;
 
+       intel->base.destroy = intel_be_destroy_context;
+
        intel->batch = intel_be_batchbuffer_alloc(intel);
 
        return true;
 }
 
-void
-intel_be_destroy_context(struct intel_be_context *intel)
+struct pipe_context *
+intel_be_create_context(struct pipe_screen *screen)
 {
-       intel_be_batchbuffer_free(intel->batch);
+       struct intel_be_context *intel;
+       struct pipe_context *pipe;
+       struct intel_be_device *device = intel_be_device(screen->winsys);
+
+       intel = (struct intel_be_context *)malloc(sizeof(*intel));
+       memset(intel, 0, sizeof(*intel));
+
+       intel_be_init_context(intel, device);
+
+#if 0
+       pipe = intel_create_softpipe(intel, screen->winsys);
+#else
+       pipe = i915_create_context(screen, &device->base, &intel->base);
+#endif
+
+       pipe->priv = intel;
+
+       return pipe;
 }
index 9cee1a4e52bef4352ca801c2a03d5eff52e3e6a4..5a369669c0d672916b6ed63127a732d070ab4575 100644 (file)
@@ -11,15 +11,6 @@ struct intel_be_context
 
        struct intel_be_device *device;
        struct intel_be_batchbuffer *batch;
-
-       /*
-        * Hardware lock functions.
-        *
-        * Needs to be filled in by the winsys.
-        */
-       void (*hardware_lock)(struct intel_be_context *context);
-       void (*hardware_unlock)(struct intel_be_context *context);
-       boolean (*hardware_locked)(struct intel_be_context *context);
 };
 
 static INLINE struct intel_be_context *
@@ -37,12 +28,4 @@ boolean
 intel_be_init_context(struct intel_be_context *intel,
                      struct intel_be_device *device);
 
-/**
- * Destroy a intel_be_context.
- *
- * Does not free the struct that is up to the winsys.
- */
-void
-intel_be_destroy_context(struct intel_be_context *intel);
-
 #endif
index 82c1cb2f32ac532f06c3f57b5cbfb80ede30303d..0f6300323b0f460e08a6f3e33cf5a5ba854a0697 100644 (file)
@@ -9,17 +9,9 @@
 
 #include "intel_be_fence.h"
 
-#include "i915simple/i915_screen.h"
+#include "i915simple/i915_winsys.h"
 
-
-/**
- *  Turn a pipe winsys into an intel/pipe winsys:
- */
-static INLINE struct intel_be_device *
-intel_be_device(struct pipe_winsys *winsys)
-{
-       return (struct intel_be_device *)winsys;
-}
+#include "intel_be_api.h"
 
 /*
  * Buffer
@@ -34,6 +26,12 @@ intel_be_buffer_map(struct pipe_winsys *winsys,
        int write = 0;
        int ret;
 
+        if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
+           /* Remove this when drm_intel_bo_map supports DONTBLOCK 
+            */
+           return NULL;
+        }
+
        if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
                write = 1;
 
@@ -53,8 +51,7 @@ intel_be_buffer_unmap(struct pipe_winsys *winsys,
 }
 
 static void
-intel_be_buffer_destroy(struct pipe_winsys *winsys,
-                       struct pipe_buffer *buf)
+intel_be_buffer_destroy(struct pipe_buffer *buf)
 {
        drm_intel_bo_unreference(intel_bo(buf));
        free(buf);
@@ -74,10 +71,12 @@ intel_be_buffer_create(struct pipe_winsys *winsys,
        if (!buffer)
                return NULL;
 
-       buffer->base.refcount = 1;
+       pipe_reference_init(&buffer->base.reference, 1);
        buffer->base.alignment = alignment;
        buffer->base.usage = usage;
        buffer->base.size = size;
+       buffer->flinked = FALSE;
+       buffer->flink = 0;
 
        if (usage & (PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_CONSTANT)) {
                /* Local buffer */
@@ -115,7 +114,7 @@ intel_be_user_buffer_create(struct pipe_winsys *winsys, void *ptr, unsigned byte
        if (!buffer)
                return NULL;
 
-       buffer->base.refcount = 1;
+       pipe_reference_init(&buffer->base.reference, 1);
        buffer->base.alignment = 0;
        buffer->base.usage = 0;
        buffer->base.size = bytes;
@@ -141,10 +140,10 @@ err:
 }
 
 struct pipe_buffer *
-intel_be_buffer_from_handle(struct pipe_winsys *winsys,
+intel_be_buffer_from_handle(struct pipe_screen *screen,
                             const char* name, unsigned handle)
 {
-       struct intel_be_device *dev = intel_be_device(winsys);
+       struct intel_be_device *dev = intel_be_device(screen->winsys);
        struct intel_be_buffer *buffer = CALLOC_STRUCT(intel_be_buffer);
 
        if (!buffer)
@@ -155,7 +154,8 @@ intel_be_buffer_from_handle(struct pipe_winsys *winsys,
        if (!buffer->bo)
                goto err;
 
-       buffer->base.refcount = 1;
+       pipe_reference_init(&buffer->base.reference, 1);
+       buffer->base.screen = screen;
        buffer->base.alignment = buffer->bo->align;
        buffer->base.usage = PIPE_BUFFER_USAGE_GPU_READ |
                             PIPE_BUFFER_USAGE_GPU_WRITE |
@@ -170,14 +170,39 @@ err:
        return NULL;
 }
 
-unsigned
-intel_be_handle_from_buffer(struct pipe_winsys *winsys,
-                            struct pipe_buffer *buf)
+boolean
+intel_be_handle_from_buffer(struct pipe_screen *screen,
+                            struct pipe_buffer *buffer,
+                            unsigned *handle)
 {
-       drm_intel_bo *bo = intel_bo(buf);
-       return bo->handle;
+       drm_intel_bo *bo;
+
+       if (!buffer)
+               return FALSE;
+
+       *handle = intel_bo(buffer)->handle;
+       return TRUE;
 }
 
+boolean
+intel_be_global_handle_from_buffer(struct pipe_screen *screen,
+                                  struct pipe_buffer *buffer,
+                                  unsigned *handle)
+{
+       struct intel_be_buffer *buf = intel_be_buffer(buffer);
+
+       if (!buffer)
+               return FALSE;
+
+       if (!buf->flinked) {
+               if (drm_intel_bo_flink(intel_bo(buffer), &buf->flink))
+                       return FALSE;
+               buf->flinked = TRUE;
+       }
+
+       *handle = buf->flink;
+       return TRUE;
+}
 /*
  * Fence
  */
@@ -190,15 +215,7 @@ intel_be_fence_refunref(struct pipe_winsys *sws,
        struct intel_be_fence **p = (struct intel_be_fence **)ptr;
        struct intel_be_fence *f = (struct intel_be_fence *)fence;
 
-       assert(p);
-
-       if (f)
-               intel_be_fence_reference(f);
-
-       if (*p)
-               intel_be_fence_unreference(*p);
-
-       *p = f;
+        intel_be_fence_reference(p, f);
 }
 
 static int
@@ -233,10 +250,21 @@ intel_be_fence_finish(struct pipe_winsys *sws,
  * Misc functions
  */
 
+static void
+intel_be_destroy_winsys(struct pipe_winsys *winsys)
+{
+       struct intel_be_device *dev = intel_be_device(winsys);
+
+       drm_intel_bufmgr_destroy(dev->pools.gem);
+
+       free(dev);
+}
+
 boolean
 intel_be_init_device(struct intel_be_device *dev, int fd, unsigned id)
 {
        dev->fd = fd;
+       dev->id = id;
        dev->max_batch_size = 16 * 4096;
        dev->max_vertex_size = 128 * 4096;
 
@@ -253,13 +281,28 @@ intel_be_init_device(struct intel_be_device *dev, int fd, unsigned id)
        dev->base.fence_signalled = intel_be_fence_signalled;
        dev->base.fence_finish = intel_be_fence_finish;
 
+       dev->base.destroy = intel_be_destroy_winsys;
+
        dev->pools.gem = drm_intel_bufmgr_gem_init(dev->fd, dev->max_batch_size);
 
        return true;
 }
 
-void
-intel_be_destroy_device(struct intel_be_device *dev)
+struct pipe_screen *
+intel_be_create_screen(int drmFD, int deviceID)
 {
-       drm_intel_bufmgr_destroy(dev->pools.gem);
+       struct intel_be_device *dev;
+       struct pipe_screen *screen;
+
+       /* Allocate the private area */
+       dev = malloc(sizeof(*dev));
+       if (!dev)
+               return NULL;
+       memset(dev, 0, sizeof(*dev));
+
+       intel_be_init_device(dev, drmFD, deviceID);
+
+       screen = i915_create_screen(&dev->base, deviceID);
+
+       return screen;
 }
index f06890163cc55f4985ca99a038daa8384520471d..47d2176cb4220ffc0474a7766202748bdb89802c 100644 (file)
@@ -18,6 +18,8 @@ struct intel_be_device
 
        int fd; /**< Drm file discriptor */
 
+       unsigned id;
+
        size_t max_batch_size;
        size_t max_vertex_size;
 
@@ -26,12 +28,15 @@ struct intel_be_device
        } pools;
 };
 
+static INLINE struct intel_be_device *
+intel_be_device(struct pipe_winsys *winsys)
+{
+       return (struct intel_be_device *)winsys;
+}
+
 boolean
 intel_be_init_device(struct intel_be_device *device, int fd, unsigned id);
 
-void
-intel_be_destroy_device(struct intel_be_device *dev);
-
 /*
  * Buffer
  */
@@ -39,6 +44,8 @@ intel_be_destroy_device(struct intel_be_device *dev);
 struct intel_be_buffer {
        struct pipe_buffer base;
        drm_intel_bo *bo;
+       boolean flinked;
+       unsigned flink;
 };
 
 /**
@@ -47,7 +54,7 @@ struct intel_be_buffer {
  * Takes a reference.
  */
 struct pipe_buffer *
-intel_be_buffer_from_handle(struct pipe_winsys *winsys,
+intel_be_buffer_from_handle(struct pipe_screen *screen,
                             const char* name, unsigned handle);
 
 /**
@@ -55,9 +62,20 @@ intel_be_buffer_from_handle(struct pipe_winsys *winsys,
  *
  * If buffer is destroyed handle may become invalid.
  */
-unsigned
-intel_be_handle_from_buffer(struct pipe_winsys *winsys,
-                            struct pipe_buffer *buffer);
+boolean
+intel_be_handle_from_buffer(struct pipe_screen *screen,
+                            struct pipe_buffer *buffer,
+                            unsigned *handle);
+
+/**
+ * Gets the global handle from a buffer.
+ *
+ * If buffer is destroyed handle may become invalid.
+ */
+boolean
+intel_be_global_handle_from_buffer(struct pipe_screen *screen,
+                                   struct pipe_buffer *buffer,
+                                   unsigned *handle);
 
 static INLINE struct intel_be_buffer *
 intel_be_buffer(struct pipe_buffer *buf)
index 0fe18f66f83da56fbbf6abcfb45d2d8d400c0d3e..a8abb01a9ed82ace71acecb8ff4663094284ca85 100644 (file)
  */
 struct intel_be_fence
 {
-       uint32_t refcount;
+       struct pipe_reference reference;
        drm_intel_bo *bo;
 };
 
 static INLINE void
-intel_be_fence_reference(struct intel_be_fence *f)
+intel_be_fence_reference(struct intel_be_fence **ptr, struct intel_be_fence *f)
 {
-       f->refcount++;
-}
+       struct intel_be_fence *old_fence = *ptr;
 
-static INLINE void
-intel_be_fence_unreference(struct intel_be_fence *f)
-{
-       if (!--f->refcount) {
-               if (f->bo)
-                       drm_intel_bo_unreference(f->bo);
-               free(f);
+        if (pipe_reference((struct pipe_reference**)ptr, &f->reference)) {
+               if (old_fence->bo)
+                       drm_intel_bo_unreference(old_fence->bo);
+               free(old_fence);
        }
 }
 
diff --git a/src/gallium/winsys/drm/intel/xorg/Makefile b/src/gallium/winsys/drm/intel/xorg/Makefile
new file mode 100644 (file)
index 0000000..a45ca57
--- /dev/null
@@ -0,0 +1,43 @@
+TARGET     = modesetting_drv.so
+CFILES     = $(wildcard ./*.c)
+OBJECTS    = $(patsubst ./%.c,./%.o,$(CFILES))
+GALLIUMDIR = ../../../..
+TOP        = ../../../../../..
+
+include ${TOP}/configs/current
+
+CFLAGS = -DHAVE_CONFIG_H \
+         -g -Wall -Wimplicit-function-declaration -fPIC \
+         $(shell pkg-config --cflags pixman-1 xorg-server libdrm xproto) \
+        -I../gem \
+         -I${GALLIUMDIR}/include \
+         -I${GALLIUMDIR}/drivers \
+         -I${GALLIUMDIR}/auxiliary \
+         -I${TOP}/src/mesa \
+         -I$(TOP)/include \
+         -I$(TOP)/src/egl/main
+
+LIBS = \
+       $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a \
+       $(GALLIUMDIR)/winsys/drm/intel/gem/libinteldrm.a \
+       $(TOP)/src/gallium/drivers/i915simple/libi915simple.a \
+       $(GALLIUM_AUXILIARIES)
+
+#############################################
+
+
+
+all default: $(TARGET)
+
+$(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a
+       $(TOP)/bin/mklib -noprefix -o $@ \
+       $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_intel
+
+clean:
+       rm -rf $(OBJECTS) $(TARGET)
+
+install:
+       $(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
+       $(INSTALL) -m 755 $(TARGET) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
+
+.PHONY = all clean install
diff --git a/src/gallium/winsys/drm/intel/xorg/intel_xorg.c b/src/gallium/winsys/drm/intel/xorg/intel_xorg.c
new file mode 100644 (file)
index 0000000..aea3924
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Author: Alan Hourihane <alanh@tungstengraphics.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ *
+ */
+
+#include "../../../../state_trackers/xorg/xorg_winsys.h"
+
+static void intel_xorg_identify(int flags);
+static Bool intel_xorg_pci_probe(DriverPtr driver,
+                                int entity_num,
+                                struct pci_device *device,
+                                intptr_t match_data);
+
+static const struct pci_id_match intel_xorg_device_match[] = {
+    {0x8086, 0x2592, 0xffff, 0xffff, 0, 0, 0},
+    {0x8086, 0x27A2, 0xffff, 0xffff, 0, 0, 0},
+    {0, 0, 0},
+};
+
+static SymTabRec intel_xorg_chipsets[] = {
+    {0x2592, "Intel Graphics Device"},
+    {0x27A2, "Intel Graphics Device"},
+    {-1, NULL}
+};
+
+static PciChipsets intel_xorg_pci_devices[] = {
+    {0x2592, 0x2592, RES_SHARED_VGA},
+    {0x27A2, 0x27A2, RES_SHARED_VGA},
+    {-1, -1, RES_UNDEFINED}
+};
+
+static XF86ModuleVersionInfo intel_xorg_version = {
+    "modesetting",
+    MODULEVENDORSTRING,
+    MODINFOSTRING1,
+    MODINFOSTRING2,
+    XORG_VERSION_CURRENT,
+    0, 1, 0, /* major, minor, patch */
+    ABI_CLASS_VIDEODRV,
+    ABI_VIDEODRV_VERSION,
+    MOD_CLASS_VIDEODRV,
+    {0, 0, 0, 0}
+};
+
+/*
+ * Xorg driver exported structures
+ */
+
+_X_EXPORT DriverRec modesetting = {
+    1,
+    "modesetting",
+    intel_xorg_identify,
+    NULL,
+    xorg_tracker_available_options,
+    NULL,
+    0,
+    NULL,
+    intel_xorg_device_match,
+    intel_xorg_pci_probe
+};
+
+static MODULESETUPPROTO(intel_xorg_setup);
+
+_X_EXPORT XF86ModuleData modesettingModuleData = {
+    &intel_xorg_version,
+    intel_xorg_setup,
+    NULL
+};
+
+/*
+ * Xorg driver functions
+ */
+
+static pointer
+intel_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+    static Bool setupDone = 0;
+
+    /* This module should be loaded only once, but check to be sure.
+     */
+    if (!setupDone) {
+       setupDone = 1;
+       xf86AddDriver(&modesetting, module, HaveDriverFuncs);
+
+       /*
+        * Tell the loader about symbols from other modules that this module
+        * might refer to.
+        */
+       xorg_tracker_loader_ref_sym_lists();
+
+       /*
+        * The return value must be non-NULL on success even though there
+        * is no TearDownProc.
+        */
+       return (pointer) 1;
+    } else {
+       if (errmaj)
+           *errmaj = LDR_ONCEONLY;
+       return NULL;
+    }
+}
+
+static void
+intel_xorg_identify(int flags)
+{
+    xf86PrintChipsets("modesetting", "Driver for Modesetting Kernel Drivers",
+                     intel_xorg_chipsets);
+}
+
+static Bool
+intel_xorg_pci_probe(DriverPtr driver,
+         int entity_num, struct pci_device *device, intptr_t match_data)
+{
+    ScrnInfoPtr scrn = NULL;
+    EntityInfoPtr entity;
+
+    scrn = xf86ConfigPciEntity(scrn, 0, entity_num, intel_xorg_pci_devices,
+                              NULL, NULL, NULL, NULL, NULL);
+    if (scrn != NULL) {
+       scrn->driverVersion = 1;
+       scrn->driverName = "modesetting";
+       scrn->name = "modesetting";
+       scrn->Probe = NULL;
+
+       entity = xf86GetEntityInfo(entity_num);
+
+       /* Use all the functions from the xorg tracker */
+       xorg_tracker_set_functions(scrn);
+    }
+    return scrn != NULL;
+}
index b5735329ec7ea8711971a60a1d6e512f86dd1f36..f8c81358544bd312bc65233814d6c45fa02087f5 100644 (file)
@@ -1,25 +1,12 @@
+# src/gallium/winsys/drm/nouveau/Makefile
 TOP = ../../../../..
 include $(TOP)/configs/current
 
+SUBDIRS = drm dri dri2
 
-SUBDIRS = common dri
-
-
-default: subdirs
-
-
-subdirs:
+default install clean:
        @for dir in $(SUBDIRS) ; do \
                if [ -d $$dir ] ; then \
-                       (cd $$dir && $(MAKE)) || exit 1 ; \
+                       (cd $$dir && $(MAKE) $@) || exit 1; \
                fi \
        done
-
-
-clean:
-       rm -f `find . -name \*.[oa]`
-       rm -f `find . -name depend`
-
-
-# Dummy install target
-install:
diff --git a/src/gallium/winsys/drm/nouveau/common/Makefile b/src/gallium/winsys/drm/nouveau/common/Makefile
deleted file mode 100644 (file)
index c6dd6dd..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = nouveaudrm
-
-C_SOURCES = \
-        nouveau_context.c \
-       nouveau_lock.c \
-       nouveau_screen.c \
-       nouveau_winsys.c \
-       nouveau_winsys_pipe.c \
-       nouveau_winsys_softpipe.c
-
-include ./Makefile.template
-
-DRIVER_DEFINES = $(shell pkg-config libdrm --cflags \
-                && pkg-config libdrm --atleast-version=2.3.1 \
-                && pkg-config libdrm_nouveau --exact-version=0.5 \
-                && pkg-config libdrm_nouveau --cflags \
-                && echo "-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP")
-symlinks:
-
diff --git a/src/gallium/winsys/drm/nouveau/common/Makefile.template b/src/gallium/winsys/drm/nouveau/common/Makefile.template
deleted file mode 100644 (file)
index f0d098b..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-# -*-makefile-*-
-
-COMMON_SOURCES = 
-
-OBJECTS = $(C_SOURCES:.c=.o) \
-          $(CPP_SOURCES:.cpp=.o) \
-         $(ASM_SOURCES:.S=.o) 
-
-
-### Include directories
-INCLUDES = \
-       -I. \
-       -I$(TOP)/src/gallium/include \
-       -I$(TOP)/src/gallium/auxiliary \
-       -I$(TOP)/src/gallium/drivers \
-       -I$(TOP)/include \
-        $(DRIVER_INCLUDES)
-
-
-##### RULES #####
-
-.c.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.cpp.o:
-       $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.S.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES)  $< -o $@
-
-
-##### TARGETS #####
-
-default: depend symlinks lib$(LIBNAME).a
-
-
-lib$(LIBNAME).a: $(OBJECTS) Makefile Makefile.template
-       $(TOP)/bin/mklib -o $(LIBNAME) -static $(OBJECTS) $(DRIVER_LIBS)
-
-
-depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
-       rm -f depend
-       touch depend
-       $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) \
-               $(ASM_SOURCES) 2> /dev/null
-
-
-# Emacs tags
-tags:
-       etags `find . -name \*.[ch]` `find ../include`
-
-
-# Remove .o and backup files
-clean::
-       -rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
-       -rm -f depend depend.bak
-
-
-include depend
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_context.c b/src/gallium/winsys/drm/nouveau/common/nouveau_context.c
deleted file mode 100644 (file)
index d6ae082..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-#include <pipe/p_defines.h>
-#include <pipe/p_context.h>
-#include <pipe/p_screen.h>
-#include <util/u_memory.h>
-#include "nouveau_context.h"
-#include "nouveau_dri.h"
-#include "nouveau_local.h"
-#include "nouveau_screen.h"
-#include "nouveau_winsys_pipe.h"
-
-static void
-nouveau_channel_context_destroy(struct nouveau_channel_context *nvc)
-{
-       nouveau_channel_free(&nvc->channel);
-
-       FREE(nvc);
-}
-
-static struct nouveau_channel_context *
-nouveau_channel_context_create(struct nouveau_device *dev)
-{
-       struct nouveau_channel_context *nvc;
-       int ret;
-
-       nvc = CALLOC_STRUCT(nouveau_channel_context);
-       if (!nvc)
-               return NULL;
-
-       if ((ret = nouveau_channel_alloc(dev, 0x8003d001, 0x8003d002,
-                                        &nvc->channel))) {
-               NOUVEAU_ERR("Error creating GPU channel: %d\n", ret);
-               nouveau_channel_context_destroy(nvc);
-               return NULL;
-       }
-
-       nvc->next_handle = 0x77000000;
-       return nvc;
-}
-
-int
-nouveau_context_init(struct nouveau_screen *nv_screen,
-                     drm_context_t hHWContext, drmLock *sarea_lock,
-                     struct nouveau_context *nv_share,
-                     struct nouveau_context *nv)
-{
-       struct pipe_context *pipe = NULL;
-       struct nouveau_channel_context *nvc = NULL;
-       struct nouveau_device *dev = nv_screen->device;
-       int i;
-
-       switch (dev->chipset & 0xf0) {
-       case 0x00:
-               /* NV04 */
-       case 0x10:
-       case 0x20:
-               /* NV10 */
-       case 0x30:
-               /* NV30 */
-       case 0x40:
-       case 0x60:
-               /* NV40 */
-       case 0x50:
-       case 0x80:
-       case 0x90:
-               /* G80 */
-               break;
-       default:
-               NOUVEAU_ERR("Unsupported chipset: NV%02x\n", dev->chipset);
-               return 1;
-       }
-
-       nv->nv_screen  = nv_screen;
-
-       {
-               struct nouveau_device_priv *nvdev = nouveau_device(dev);
-
-               nvdev->ctx  = hHWContext;
-               nvdev->lock = sarea_lock;
-       }
-
-       /* Attempt to share a single channel between multiple contexts from
-        * a single process.
-        */
-       nvc = nv_screen->nvc;
-       if (!nvc && nv_share)
-               nvc = nv_share->nvc;
-
-       /*XXX: temporary - disable multi-context/single-channel on pre-NV4x */
-       switch (dev->chipset & 0xf0) {
-       case 0x40:
-       case 0x60:
-               /* NV40 class */
-       case 0x50:
-       case 0x80:
-       case 0x90:
-               /* G80 class */
-               break;
-       default:
-               nvc = NULL;
-               break;
-       }
-
-       if (!nvc) {
-               nvc = nouveau_channel_context_create(dev);
-               if (!nvc) {
-                       NOUVEAU_ERR("Failed initialising GPU context\n");
-                       return 1;
-               }
-               nv_screen->nvc = nvc;
-       }
-
-       nvc->refcount++;
-       nv->nvc = nvc;
-
-       /* Find a free slot for a pipe context, allocate a new one if needed */
-       nv->pctx_id = -1;
-       for (i = 0; i < nvc->nr_pctx; i++) {
-               if (nvc->pctx[i] == NULL) {
-                       nv->pctx_id = i;
-                       break;
-               }
-       }
-
-       if (nv->pctx_id < 0) {
-               nv->pctx_id = nvc->nr_pctx++;
-               nvc->pctx =
-                       realloc(nvc->pctx,
-                               sizeof(struct pipe_context *) * nvc->nr_pctx);
-       }
-
-       /* Create pipe */
-       if (!getenv("NOUVEAU_FORCE_SOFTPIPE")) {
-               struct pipe_screen *pscreen;
-
-               pipe = nouveau_pipe_create(nv);
-               if (!pipe)
-                       NOUVEAU_ERR("Couldn't create hw pipe\n");
-               pscreen = nvc->pscreen;
-
-               nv->cap.hw_vertex_buffer =
-                       pscreen->get_param(pscreen, NOUVEAU_CAP_HW_VTXBUF);
-               nv->cap.hw_index_buffer =
-                       pscreen->get_param(pscreen, NOUVEAU_CAP_HW_IDXBUF);
-       }
-
-       if (!pipe) {
-               NOUVEAU_MSG("Using softpipe\n");
-               pipe = nouveau_create_softpipe(nv);
-               if (!pipe) {
-                       NOUVEAU_ERR("Error creating pipe, bailing\n");
-                       return 1;
-               }
-       }
-
-       {
-               struct pipe_texture *fb_tex;
-               struct pipe_surface *fb_surf;
-               struct nouveau_pipe_buffer *fb_buf;
-               enum pipe_format format;
-
-               fb_buf = calloc(1, sizeof(struct nouveau_pipe_buffer));
-               fb_buf->base.refcount = 1;
-               fb_buf->base.usage = PIPE_BUFFER_USAGE_PIXEL;
-
-               nouveau_bo_fake(dev, nv_screen->front_offset, NOUVEAU_BO_VRAM,
-                               nv_screen->front_pitch*nv_screen->front_height,
-                               NULL, &fb_buf->bo);
-
-               if (nv_screen->front_cpp == 4)
-                       format = PIPE_FORMAT_A8R8G8B8_UNORM;
-               else
-                       format = PIPE_FORMAT_R5G6B5_UNORM;
-
-               fb_surf = nouveau_surface_buffer_ref(nv, &fb_buf->base, format,
-                                                    nv_screen->front_pitch /
-                                                    nv_screen->front_cpp,
-                                                    nv_screen->front_height,
-                                                    nv_screen->front_pitch,
-                                                    &fb_tex);
-
-               nv->frontbuffer = fb_surf;
-               nv->frontbuffer_texture = fb_tex;
-       }
-
-       pipe->priv = nv;
-       return 0;
-}
-
-void
-nouveau_context_cleanup(struct nouveau_context *nv)
-{
-       struct nouveau_channel_context *nvc = nv->nvc;
-
-       assert(nv);
-
-       if (nv->pctx_id >= 0) {
-               nvc->pctx[nv->pctx_id] = NULL;
-               if (--nvc->refcount <= 0) {
-                       nouveau_channel_context_destroy(nvc);
-                       nv->nv_screen->nvc = NULL;
-               }
-       }
-       
-       /* XXX: Who cleans up the pipe? */
-}
-
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_context.h b/src/gallium/winsys/drm/nouveau/common/nouveau_context.h
deleted file mode 100644 (file)
index 02d2745..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef __NOUVEAU_CONTEXT_H__
-#define __NOUVEAU_CONTEXT_H__
-
-#include "nouveau/nouveau_winsys.h"
-#include "nouveau_drmif.h"
-#include "nouveau_device.h"
-#include "nouveau_channel.h"
-#include "nouveau_pushbuf.h"
-#include "nouveau_bo.h"
-#include "nouveau_grobj.h"
-#include "nouveau_notifier.h"
-#include "nouveau_class.h"
-#include "nouveau_local.h"
-
-struct nouveau_channel_context {
-       struct pipe_screen *pscreen;
-       int refcount;
-
-       unsigned cur_pctx;
-       unsigned nr_pctx;
-       struct pipe_context **pctx;
-
-       struct nouveau_channel  *channel;
-       unsigned next_handle;
-};
-
-struct nouveau_context {
-       int locked;
-       struct nouveau_screen *nv_screen;
-       struct pipe_surface *frontbuffer;
-       struct pipe_texture *frontbuffer_texture;
-
-       struct {
-               int hw_vertex_buffer;
-               int hw_index_buffer;
-       } cap;
-
-       /* Hardware context */
-       struct nouveau_channel_context *nvc;
-       int pctx_id;
-};
-
-extern int nouveau_context_init(struct nouveau_screen *nv_screen,
-                                drm_context_t hHWContext, drmLock *sarea_lock,
-                                struct nouveau_context *nv_share,
-                                struct nouveau_context *nv);
-extern void nouveau_context_cleanup(struct nouveau_context *nv);
-
-extern void LOCK_HARDWARE(struct nouveau_context *);
-extern void UNLOCK_HARDWARE(struct nouveau_context *);
-
-extern uint32_t *nouveau_pipe_dma_beginp(struct nouveau_grobj *, int, int);
-extern void nouveau_pipe_dma_kickoff(struct nouveau_channel *);
-
-/* Must be provided by clients of common code */
-extern void
-nouveau_contended_lock(struct nouveau_context *nv);
-
-#endif
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_dri.h b/src/gallium/winsys/drm/nouveau/common/nouveau_dri.h
deleted file mode 100644 (file)
index 1207c2d..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _NOUVEAU_DRI_
-#define _NOUVEAU_DRI_
-
-#include "xf86drm.h"
-#include "drm.h"
-#include "nouveau_drm.h"
-
-struct nouveau_dri {
-       uint32_t device_id;     /**< \brief PCI device ID */
-       uint32_t width;         /**< \brief width in pixels of display */
-       uint32_t height;        /**< \brief height in scanlines of display */
-       uint32_t depth;         /**< \brief depth of display (8, 15, 16, 24) */
-       uint32_t bpp;           /**< \brief bit depth of display (8, 16, 24, 32) */
-
-       uint32_t bus_type;      /**< \brief ths bus type */
-       uint32_t bus_mode;      /**< \brief bus mode (used for AGP, maybe also for PCI-E ?) */
-
-       uint32_t front_offset;  /**< \brief front buffer offset */
-       uint32_t front_pitch;   /**< \brief front buffer pitch */
-       uint32_t back_offset;   /**< \brief private back buffer offset */
-       uint32_t back_pitch;    /**< \brief private back buffer pitch */
-       uint32_t depth_offset;  /**< \brief private depth buffer offset */
-       uint32_t depth_pitch;   /**< \brief private depth buffer pitch */
-
-};
-
-#endif
-
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_local.h b/src/gallium/winsys/drm/nouveau/common/nouveau_local.h
deleted file mode 100644 (file)
index 11175bc..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __NOUVEAU_LOCAL_H__
-#define __NOUVEAU_LOCAL_H__
-
-#include "pipe/p_compiler.h"
-#include "nouveau_winsys_pipe.h"
-#include <stdio.h>
-
-/* Debug output */
-#define NOUVEAU_MSG(fmt, args...) do {                                         \
-       fprintf(stdout, "nouveau: "fmt, ##args);                               \
-       fflush(stdout);                                                        \
-} while(0)
-
-#define NOUVEAU_ERR(fmt, args...) do {                                         \
-       fprintf(stderr, "%s:%d -  "fmt, __func__, __LINE__, ##args);           \
-       fflush(stderr);                                                        \
-} while(0)
-
-#endif
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_lock.c b/src/gallium/winsys/drm/nouveau/common/nouveau_lock.c
deleted file mode 100644 (file)
index e8cf051..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
-#include <pipe/p_thread.h>
-#include "nouveau_context.h"
-#include "nouveau_screen.h"
-
-pipe_static_mutex(lockMutex);
-
-/* Lock the hardware and validate our state.
- */
-void
-LOCK_HARDWARE(struct nouveau_context *nv)
-{
-       struct nouveau_screen *nv_screen = nv->nv_screen;
-       struct nouveau_device *dev = nv_screen->device;
-       struct nouveau_device_priv *nvdev = nouveau_device(dev);
-       char __ret=0;
-
-       assert(!nv->locked);
-       pipe_mutex_lock(lockMutex);
-
-       DRM_CAS(nvdev->lock, nvdev->ctx,
-               (DRM_LOCK_HELD | nvdev->ctx), __ret);
-
-       if (__ret) {
-               drmGetLock(nvdev->fd, nvdev->ctx, 0);
-               nouveau_contended_lock(nv);
-       }
-       nv->locked = 1;
-}
-
-/* Unlock the hardware using the global current context 
- */
-void
-UNLOCK_HARDWARE(struct nouveau_context *nv)
-{
-       struct nouveau_screen *nv_screen = nv->nv_screen;
-       struct nouveau_device *dev = nv_screen->device;
-       struct nouveau_device_priv *nvdev = nouveau_device(dev);
-
-       assert(nv->locked);
-       nv->locked = 0;
-
-       DRM_UNLOCK(nvdev->fd, nvdev->lock, nvdev->ctx);
-
-       pipe_mutex_unlock(lockMutex);
-} 
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_screen.c b/src/gallium/winsys/drm/nouveau/common/nouveau_screen.c
deleted file mode 100644 (file)
index 422fbf0..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <util/u_memory.h>
-#include "nouveau_dri.h"
-#include "nouveau_local.h"
-#include "nouveau_screen.h"
-
-int
-nouveau_screen_init(struct nouveau_dri *nv_dri, int dev_fd,
-                    struct nouveau_screen *nv_screen)
-{
-       int ret;
-
-       ret = nouveau_device_open_existing(&nv_screen->device, 0,
-                                          dev_fd, 0);
-       if (ret) {
-               NOUVEAU_ERR("Failed opening nouveau device: %d\n", ret);
-               return 1;
-       }
-
-       nv_screen->front_offset = nv_dri->front_offset;
-       nv_screen->front_pitch  = nv_dri->front_pitch * (nv_dri->bpp / 8);
-       nv_screen->front_cpp = nv_dri->bpp / 8;
-       nv_screen->front_height = nv_dri->height;
-
-       return 0;
-}
-
-void
-nouveau_screen_cleanup(struct nouveau_screen *nv_screen)
-{
-       nouveau_device_close(&nv_screen->device);
-}
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_screen.h b/src/gallium/winsys/drm/nouveau/common/nouveau_screen.h
deleted file mode 100644 (file)
index 3e68e21..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __NOUVEAU_SCREEN_H__
-#define __NOUVEAU_SCREEN_H__
-
-#include <stdint.h>
-
-struct nouveau_device;
-struct nouveau_dri;
-
-struct nouveau_screen {
-       struct nouveau_device *device;
-
-       uint32_t front_offset;
-       uint32_t front_pitch;
-       uint32_t front_cpp;
-       uint32_t front_height;
-
-       void *nvc;
-};
-
-int
-nouveau_screen_init(struct nouveau_dri *nv_dri, int dev_fd,
-                    struct nouveau_screen *nv_screen);
-
-void
-nouveau_screen_cleanup(struct nouveau_screen *nv_screen);
-
-#endif
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys.c b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys.c
deleted file mode 100644 (file)
index b6199f8..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-#include "util/u_memory.h"
-
-#include "nouveau_context.h"
-#include "nouveau_screen.h"
-#include "nouveau_winsys_pipe.h"
-
-#include "nouveau/nouveau_winsys.h"
-
-static int
-nouveau_pipe_notifier_alloc(struct nouveau_winsys *nvws, int count,
-                           struct nouveau_notifier **notify)
-{
-       struct nouveau_context *nv = nvws->nv;
-
-       return nouveau_notifier_alloc(nv->nvc->channel, nv->nvc->next_handle++,
-                                     count, notify);
-}
-
-static int
-nouveau_pipe_grobj_alloc(struct nouveau_winsys *nvws, int grclass,
-                        struct nouveau_grobj **grobj)
-{
-       struct nouveau_context *nv = nvws->nv;
-       struct nouveau_channel *chan = nv->nvc->channel;
-       int ret;
-
-       ret = nouveau_grobj_alloc(chan, nv->nvc->next_handle++,
-                                 grclass, grobj);
-       if (ret)
-               return ret;
-
-       BEGIN_RING(chan, *grobj, 0x0000, 1);
-       OUT_RING  (chan, (*grobj)->handle);
-       (*grobj)->bound = NOUVEAU_GROBJ_BOUND_EXPLICIT;
-       return 0;
-}
-
-static int
-nouveau_pipe_push_reloc(struct nouveau_winsys *nvws, void *ptr,
-                       struct pipe_buffer *buf, uint32_t data,
-                       uint32_t flags, uint32_t vor, uint32_t tor)
-{
-       struct nouveau_bo *bo = nouveau_pipe_buffer(buf)->bo;
-
-       return nouveau_pushbuf_emit_reloc(nvws->channel, ptr, bo,
-                                         data, flags, vor, tor);
-}
-
-static int
-nouveau_pipe_push_flush(struct nouveau_winsys *nvws, unsigned size,
-                       struct pipe_fence_handle **fence)
-{
-       if (fence)
-               *fence = NULL;
-
-       return nouveau_pushbuf_flush(nvws->channel, size);
-}
-
-static struct nouveau_bo *
-nouveau_pipe_get_bo(struct pipe_buffer *pb)
-{
-       return nouveau_pipe_buffer(pb)->bo;
-}
-
-struct pipe_context *
-nouveau_pipe_create(struct nouveau_context *nv)
-{
-       struct nouveau_channel_context *nvc = nv->nvc;
-       struct nouveau_winsys *nvws = CALLOC_STRUCT(nouveau_winsys);
-       struct pipe_screen *(*hws_create)(struct pipe_winsys *,
-                                         struct nouveau_winsys *);
-       struct pipe_context *(*hw_create)(struct pipe_screen *, unsigned);
-       struct pipe_winsys *ws;
-       unsigned chipset = nv->nv_screen->device->chipset;
-
-       if (!nvws)
-               return NULL;
-
-       switch (chipset & 0xf0) {
-       case 0x00:
-               hws_create = nv04_screen_create;
-               hw_create = nv04_create;
-               break;
-       case 0x10:
-               hws_create = nv10_screen_create;
-               hw_create = nv10_create;
-               break;
-       case 0x20:
-               hws_create = nv20_screen_create;
-               hw_create = nv20_create;
-               break;
-       case 0x30:
-               hws_create = nv30_screen_create;
-               hw_create = nv30_create;
-               break;
-       case 0x40:
-       case 0x60:
-               hws_create = nv40_screen_create;
-               hw_create = nv40_create;
-               break;
-       case 0x50:
-       case 0x80:
-       case 0x90:
-               hws_create = nv50_screen_create;
-               hw_create = nv50_create;
-               break;
-       default:
-               NOUVEAU_ERR("Unknown chipset NV%02x\n", chipset);
-               return NULL;
-       }
-
-       nvws->nv                = nv;
-       nvws->channel           = nv->nvc->channel;
-
-       nvws->res_init          = nouveau_resource_init;
-       nvws->res_alloc         = nouveau_resource_alloc;
-       nvws->res_free          = nouveau_resource_free;
-
-       nvws->push_reloc        = nouveau_pipe_push_reloc;
-       nvws->push_flush        = nouveau_pipe_push_flush;
-
-       nvws->grobj_alloc       = nouveau_pipe_grobj_alloc;
-       nvws->grobj_free        = nouveau_grobj_free;
-
-       nvws->notifier_alloc    = nouveau_pipe_notifier_alloc;
-       nvws->notifier_free     = nouveau_notifier_free;
-       nvws->notifier_reset    = nouveau_notifier_reset;
-       nvws->notifier_status   = nouveau_notifier_status;
-       nvws->notifier_retval   = nouveau_notifier_return_val;
-       nvws->notifier_wait     = nouveau_notifier_wait_status;
-
-       nvws->get_bo            = nouveau_pipe_get_bo;
-
-       ws = nouveau_create_pipe_winsys(nv);
-
-       if (!nvc->pscreen)
-               nvc->pscreen = hws_create(ws, nvws);
-       nvc->pctx[nv->pctx_id] = hw_create(nvc->pscreen, nv->pctx_id);
-       return nvc->pctx[nv->pctx_id];
-}
-
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c
deleted file mode 100644 (file)
index 881df98..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-#include "pipe/internal/p_winsys_screen.h"
-#include <pipe/p_defines.h>
-#include <pipe/p_inlines.h>
-#include <util/u_memory.h>
-#include "nouveau_context.h"
-#include "nouveau_local.h"
-#include "nouveau_screen.h"
-#include "nouveau_winsys_pipe.h"
-
-static const char *
-nouveau_get_name(struct pipe_winsys *pws)
-{
-       return "Nouveau/DRI";
-}
-
-static uint32_t
-nouveau_flags_from_usage(struct nouveau_context *nv, unsigned usage)
-{
-       struct nouveau_device *dev = nv->nv_screen->device;
-       uint32_t flags = NOUVEAU_BO_LOCAL;
-
-       if (usage & PIPE_BUFFER_USAGE_PIXEL) {
-               if (usage & NOUVEAU_BUFFER_USAGE_TEXTURE)
-                       flags |= NOUVEAU_BO_GART;
-               if (!(usage & PIPE_BUFFER_USAGE_CPU_READ_WRITE))
-                       flags |= NOUVEAU_BO_VRAM;
-
-               switch (dev->chipset & 0xf0) {
-               case 0x50:
-               case 0x80:
-               case 0x90:
-                       flags |= NOUVEAU_BO_TILED;
-                       if (usage & NOUVEAU_BUFFER_USAGE_ZETA)
-                               flags |= NOUVEAU_BO_ZTILE;
-                       break;
-               default:
-                       break;
-               }
-       }
-
-       if (usage & PIPE_BUFFER_USAGE_VERTEX) {
-               if (nv->cap.hw_vertex_buffer)
-                       flags |= NOUVEAU_BO_GART;
-       }
-
-       if (usage & PIPE_BUFFER_USAGE_INDEX) {
-               if (nv->cap.hw_index_buffer)
-                       flags |= NOUVEAU_BO_GART;
-       }
-
-       return flags;
-}
-
-static struct pipe_buffer *
-nouveau_pipe_bo_create(struct pipe_winsys *pws, unsigned alignment,
-                      unsigned usage, unsigned size)
-{
-       struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
-       struct nouveau_context *nv = nvpws->nv;
-       struct nouveau_device *dev = nv->nv_screen->device;
-       struct nouveau_pipe_buffer *nvbuf;
-       uint32_t flags;
-
-       nvbuf = CALLOC_STRUCT(nouveau_pipe_buffer);
-       if (!nvbuf)
-               return NULL;
-       nvbuf->base.refcount = 1;
-       nvbuf->base.alignment = alignment;
-       nvbuf->base.usage = usage;
-       nvbuf->base.size = size;
-
-       flags = nouveau_flags_from_usage(nv, usage);
-
-       if (nouveau_bo_new(dev, flags, alignment, size, &nvbuf->bo)) {
-               FREE(nvbuf);
-               return NULL;
-       }
-
-       return &nvbuf->base;
-}
-
-static struct pipe_buffer *
-nouveau_pipe_bo_user_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
-{
-       struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
-       struct nouveau_device *dev = nvpws->nv->nv_screen->device;
-       struct nouveau_pipe_buffer *nvbuf;
-
-       nvbuf = CALLOC_STRUCT(nouveau_pipe_buffer);
-       if (!nvbuf)
-               return NULL;
-       nvbuf->base.refcount = 1;
-       nvbuf->base.size = bytes;
-
-       if (nouveau_bo_user(dev, ptr, bytes, &nvbuf->bo)) {
-               FREE(nvbuf);
-               return NULL;
-       }
-
-       return &nvbuf->base;
-}
-
-static void
-nouveau_pipe_bo_del(struct pipe_winsys *ws, struct pipe_buffer *buf)
-{
-       struct nouveau_pipe_buffer *nvbuf = nouveau_pipe_buffer(buf);
-
-       nouveau_bo_ref(NULL, &nvbuf->bo);
-       FREE(nvbuf);
-}
-
-static void *
-nouveau_pipe_bo_map(struct pipe_winsys *pws, struct pipe_buffer *buf,
-                   unsigned flags)
-{
-       struct nouveau_pipe_buffer *nvbuf = nouveau_pipe_buffer(buf);
-       uint32_t map_flags = 0;
-
-       if (flags & PIPE_BUFFER_USAGE_CPU_READ)
-               map_flags |= NOUVEAU_BO_RD;
-       if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
-               map_flags |= NOUVEAU_BO_WR;
-
-#if 0
-       if (flags & PIPE_BUFFER_USAGE_DISCARD &&
-           !(flags & PIPE_BUFFER_USAGE_CPU_READ) &&
-           nouveau_bo_busy(nvbuf->bo, map_flags)) {
-               struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
-               struct nouveau_context *nv = nvpws->nv;
-               struct nouveau_device *dev = nv->nv_screen->device;
-               struct nouveau_bo *rename;
-               uint32_t flags = nouveau_flags_from_usage(nv, buf->usage);
-
-               if (!nouveau_bo_new(dev, flags, buf->alignment, buf->size, &rename)) {
-                       nouveau_bo_ref(NULL, &nvbuf->bo);
-                       nvbuf->bo = rename;
-               }
-       }
-#endif
-
-       if (nouveau_bo_map(nvbuf->bo, map_flags))
-               return NULL;
-       return nvbuf->bo->map;
-}
-
-static void
-nouveau_pipe_bo_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf)
-{
-       struct nouveau_pipe_buffer *nvbuf = nouveau_pipe_buffer(buf);
-
-       nouveau_bo_unmap(nvbuf->bo);
-}
-
-static void
-nouveau_pipe_fence_reference(struct pipe_winsys *ws,
-                            struct pipe_fence_handle **ptr,
-                            struct pipe_fence_handle *pfence)
-{
-       *ptr = pfence;
-}
-
-static int
-nouveau_pipe_fence_signalled(struct pipe_winsys *ws,
-                            struct pipe_fence_handle *pfence, unsigned flag)
-{
-       return 0;
-}
-
-static int
-nouveau_pipe_fence_finish(struct pipe_winsys *ws,
-                         struct pipe_fence_handle *pfence, unsigned flag)
-{
-       return 0;
-}
-
-struct pipe_surface *
-nouveau_surface_buffer_ref(struct nouveau_context *nv, struct pipe_buffer *pb,
-                          enum pipe_format format, int w, int h,
-                          unsigned pitch, struct pipe_texture **ppt)
-{
-       struct pipe_screen *pscreen = nv->nvc->pscreen;
-       struct pipe_texture tmpl, *pt;
-       struct pipe_surface *ps;
-
-       memset(&tmpl, 0, sizeof(tmpl));
-       tmpl.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
-                        NOUVEAU_TEXTURE_USAGE_LINEAR;
-       tmpl.target = PIPE_TEXTURE_2D;
-       tmpl.width[0] = w;
-       tmpl.height[0] = h;
-       tmpl.depth[0] = 1;
-       tmpl.format = format;
-       pf_get_block(tmpl.format, &tmpl.block);
-       tmpl.nblocksx[0] = pf_get_nblocksx(&tmpl.block, w);
-       tmpl.nblocksy[0] = pf_get_nblocksy(&tmpl.block, h);
-
-       pt = pscreen->texture_blanket(pscreen, &tmpl, &pitch, pb);
-       if (!pt)
-               return NULL;
-
-       ps = pscreen->get_tex_surface(pscreen, pt, 0, 0, 0,
-                                     PIPE_BUFFER_USAGE_GPU_WRITE);
-
-       *ppt = pt;
-       return ps;
-}
-
-static void
-nouveau_destroy(struct pipe_winsys *pws)
-{
-       FREE(pws);
-}
-
-struct pipe_winsys *
-nouveau_create_pipe_winsys(struct nouveau_context *nv)
-{
-       struct nouveau_pipe_winsys *nvpws;
-       struct pipe_winsys *pws;
-
-       nvpws = CALLOC_STRUCT(nouveau_pipe_winsys);
-       if (!nvpws)
-               return NULL;
-       nvpws->nv = nv;
-       pws = &nvpws->pws;
-
-       pws->flush_frontbuffer = nouveau_flush_frontbuffer;
-
-       pws->buffer_create = nouveau_pipe_bo_create;
-       pws->buffer_destroy = nouveau_pipe_bo_del;
-       pws->user_buffer_create = nouveau_pipe_bo_user_create;
-       pws->buffer_map = nouveau_pipe_bo_map;
-       pws->buffer_unmap = nouveau_pipe_bo_unmap;
-
-       pws->fence_reference = nouveau_pipe_fence_reference;
-       pws->fence_signalled = nouveau_pipe_fence_signalled;
-       pws->fence_finish = nouveau_pipe_fence_finish;
-
-       pws->get_name = nouveau_get_name;
-       pws->destroy = nouveau_destroy;
-
-       return &nvpws->pws;
-}
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.h b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.h
deleted file mode 100644 (file)
index 1eb8043..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef NOUVEAU_PIPE_WINSYS_H
-#define NOUVEAU_PIPE_WINSYS_H
-
-#include "pipe/p_context.h"
-#include "pipe/internal/p_winsys_screen.h"
-#include "nouveau_context.h"
-
-struct nouveau_pipe_buffer {
-       struct pipe_buffer base;
-       struct nouveau_bo *bo;
-};
-
-static INLINE struct nouveau_pipe_buffer *
-nouveau_pipe_buffer(struct pipe_buffer *buf)
-{
-       return (struct nouveau_pipe_buffer *)buf;
-}
-
-struct nouveau_pipe_winsys {
-       struct pipe_winsys pws;
-
-       struct nouveau_context *nv;
-};
-
-extern struct pipe_winsys *
-nouveau_create_pipe_winsys(struct nouveau_context *nv);
-
-struct pipe_context *
-nouveau_create_softpipe(struct nouveau_context *nv);
-
-struct pipe_context *
-nouveau_pipe_create(struct nouveau_context *nv);
-
-/* Must be provided by clients of common code */
-extern void
-nouveau_flush_frontbuffer(struct pipe_winsys *pws, struct pipe_surface *surf,
-                         void *context_private);
-
-struct pipe_surface *
-nouveau_surface_buffer_ref(struct nouveau_context *nv, struct pipe_buffer *pb,
-                          enum pipe_format format, int w, int h,
-                          unsigned pitch, struct pipe_texture **ppt);
-
-#endif
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_softpipe.c b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_softpipe.c
deleted file mode 100644 (file)
index 396e4f2..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * 
- **************************************************************************/
-/*
- * Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
- */
-
-#include "pipe/internal/p_winsys_screen.h"
-#include <pipe/p_screen.h>
-#include <pipe/p_defines.h>
-#include <pipe/p_format.h>
-#include <softpipe/sp_winsys.h>
-#include <util/u_memory.h>
-#include "nouveau_context.h"
-#include "nouveau_winsys_pipe.h"
-
-struct nouveau_softpipe_winsys {
-   struct softpipe_winsys sws;
-   struct nouveau_context *nv;
-};
-
-/**
- * Return list of surface formats supported by this driver.
- */
-static boolean
-nouveau_is_format_supported(struct softpipe_winsys *sws,
-                            enum pipe_format format)
-{
-       switch (format) {
-       case PIPE_FORMAT_A8R8G8B8_UNORM:
-       case PIPE_FORMAT_R5G6B5_UNORM:
-       case PIPE_FORMAT_Z24S8_UNORM:
-               return TRUE;
-       default:
-               break;
-       };
-
-       return FALSE;
-}
-
-struct pipe_context *
-nouveau_create_softpipe(struct nouveau_context *nv)
-{
-       struct nouveau_softpipe_winsys *nvsws;
-       struct pipe_screen *pscreen;
-       struct pipe_winsys *ws;
-       struct pipe_context *pipe;
-
-       ws = nouveau_create_pipe_winsys(nv);
-       if (!ws)
-               return NULL;
-       pscreen = softpipe_create_screen(ws);
-       if (!pscreen) {
-               ws->destroy(ws);
-               return NULL;
-       }
-       nvsws = CALLOC_STRUCT(nouveau_softpipe_winsys);
-       if (!nvsws) {
-               ws->destroy(ws);
-               pscreen->destroy(pscreen);
-               return NULL;
-       }
-
-       nvsws->sws.is_format_supported = nouveau_is_format_supported;
-       nvsws->nv = nv;
-
-       pipe = softpipe_create(pscreen, ws, &nvsws->sws);
-       if (!pipe) {
-               ws->destroy(ws);
-               pscreen->destroy(pscreen);
-               FREE(nvsws);
-               return NULL;
-       }
-
-       return pipe;
-}
-
index 3f3553b61d25fac8d6af10505ccccb03e64988ed..f7db6201fea55f283d0a8235566a7180c2dcc31e 100644 (file)
@@ -6,19 +6,19 @@ LIBNAME = nouveau_dri.so
 MINIGLX_SOURCES =
 
 PIPE_DRIVERS = \
-       $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+       $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
        $(TOP)/src/gallium/drivers/nv04/libnv04.a \
        $(TOP)/src/gallium/drivers/nv10/libnv10.a \
        $(TOP)/src/gallium/drivers/nv20/libnv20.a \
        $(TOP)/src/gallium/drivers/nv30/libnv30.a \
        $(TOP)/src/gallium/drivers/nv40/libnv40.a \
        $(TOP)/src/gallium/drivers/nv50/libnv50.a
-
+       
 DRIVER_SOURCES = \
-       nouveau_context_dri.c \
-       nouveau_screen_dri.c \
+       nouveau_context.c \
+       nouveau_screen.c \
        nouveau_swapbuffers.c \
-       ../common/libnouveaudrm.a
+       nouveau_lock.c
 
 C_SOURCES = \
        $(COMMON_GALLIUM_SOURCES) \
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_context.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_context.c
new file mode 100644 (file)
index 0000000..deb6ffc
--- /dev/null
@@ -0,0 +1,118 @@
+#include <main/glheader.h>
+#include <glapi/glthread.h>
+#include <GL/internal/glcore.h>
+#include <utils.h>
+
+#include <state_tracker/st_public.h>
+#include <state_tracker/st_context.h>
+#include <state_tracker/drm_api.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_context.h>
+#include <pipe/p_screen.h>
+
+#include "nouveau_context.h"
+#include "nouveau_screen.h"
+
+#include "nouveau_drmif.h"
+
+GLboolean
+nouveau_context_create(const __GLcontextModes *glVis,
+                      __DRIcontextPrivate *driContextPriv,
+                      void *sharedContextPrivate)
+{
+       __DRIscreenPrivate *driScrnPriv = driContextPriv->driScreenPriv;
+       struct nouveau_screen  *nv_screen = driScrnPriv->private;
+       struct nouveau_context *nv;
+       struct pipe_context *pipe;
+       struct st_context *st_share = NULL;
+
+       if (sharedContextPrivate)
+               st_share = ((struct nouveau_context *)sharedContextPrivate)->st;
+
+       nv = CALLOC_STRUCT(nouveau_context);
+       if (!nv)
+               return GL_FALSE;
+
+       {
+               struct nouveau_device_priv *nvdev =
+                       nouveau_device(nv_screen->device);
+
+               nvdev->ctx  = driContextPriv->hHWContext;
+               nvdev->lock = (drmLock *)&driScrnPriv->pSAREA->lock;
+       }
+
+       pipe = drm_api_hooks.create_context(nv_screen->pscreen);
+       if (!pipe) {
+               FREE(nv);
+               return GL_FALSE;
+       }
+       pipe->priv = nv;
+
+       driContextPriv->driverPrivate = nv;
+       nv->dri_screen = driScrnPriv;
+
+       driParseConfigFiles(&nv->dri_option_cache, &nv_screen->option_cache,
+                           nv->dri_screen->myNum, "nouveau");
+
+       nv->st = st_create_context(pipe, glVis, st_share);
+       return GL_TRUE;
+}
+
+void
+nouveau_context_destroy(__DRIcontextPrivate *driContextPriv)
+{
+       struct nouveau_context *nv = driContextPriv->driverPrivate;
+
+       assert(nv);
+
+       st_finish(nv->st);
+       st_destroy_context(nv->st);
+
+       FREE(nv);
+}
+
+GLboolean
+nouveau_context_bind(__DRIcontextPrivate *driContextPriv,
+                    __DRIdrawablePrivate *driDrawPriv,
+                    __DRIdrawablePrivate *driReadPriv)
+{
+       struct nouveau_context *nv;
+       struct nouveau_framebuffer *draw, *read;
+
+       if (!driContextPriv) {
+               st_make_current(NULL, NULL, NULL);
+               return GL_TRUE;
+       }
+
+       nv = driContextPriv->driverPrivate;
+       draw = driDrawPriv->driverPrivate;
+       read = driReadPriv->driverPrivate;
+
+       st_make_current(nv->st, draw->stfb, read->stfb);
+
+       if ((nv->dri_drawable != driDrawPriv) ||
+           (nv->last_stamp != driDrawPriv->lastStamp)) {
+               nv->dri_drawable = driDrawPriv;
+               st_resize_framebuffer(draw->stfb, driDrawPriv->w,
+                                     driDrawPriv->h);
+               nv->last_stamp = driDrawPriv->lastStamp;
+       }
+
+       if (driDrawPriv != driReadPriv) {
+               st_resize_framebuffer(read->stfb, driReadPriv->w,
+                                     driReadPriv->h);
+       }
+
+       return GL_TRUE;
+}
+
+GLboolean
+nouveau_context_unbind(__DRIcontextPrivate *driContextPriv)
+{
+       struct nouveau_context *nv = driContextPriv->driverPrivate;
+       (void)nv;
+
+       st_flush(nv->st, 0, NULL);
+       return GL_TRUE;
+}
+
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_context.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_context.h
new file mode 100644 (file)
index 0000000..2779b09
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef __NOUVEAU_CONTEXT_DRI_H__
+#define __NOUVEAU_CONTEXT_DRI_H__
+
+#include <dri_util.h>
+#include <xmlconfig.h>
+
+#include "nouveau/nouveau_winsys.h"
+
+#define NOUVEAU_ERR(fmt, args...) debug_printf("%s: "fmt, __func__, ##args)
+
+struct nouveau_framebuffer {
+       struct st_framebuffer *stfb;
+};
+
+struct nouveau_context {
+       struct st_context *st;
+
+       /* DRI stuff */
+       __DRIscreenPrivate    *dri_screen;
+       __DRIdrawablePrivate  *dri_drawable;
+       unsigned int           last_stamp;
+       driOptionCache         dri_option_cache;
+       drm_context_t          drm_context;
+       drmLock                drm_lock;
+       int                    locked;
+};
+
+extern GLboolean nouveau_context_create(const __GLcontextModes *,
+                                       __DRIcontextPrivate *, void *);
+extern void nouveau_context_destroy(__DRIcontextPrivate *);
+extern GLboolean nouveau_context_bind(__DRIcontextPrivate *,
+                                     __DRIdrawablePrivate *draw,
+                                     __DRIdrawablePrivate *read);
+extern GLboolean nouveau_context_unbind(__DRIcontextPrivate *);
+
+extern void nouveau_contended_lock(struct nouveau_context *nv);
+extern void LOCK_HARDWARE(struct nouveau_context *nv);
+extern void UNLOCK_HARDWARE(struct nouveau_context *nv);
+
+#ifdef DEBUG
+extern int __nouveau_debug;
+
+#define DEBUG_BO (1 << 0)
+
+#define DBG(flag, ...) do {                   \
+       if (__nouveau_debug & (DEBUG_##flag)) \
+               NOUVEAU_ERR(__VA_ARGS__);     \
+} while(0)
+#else
+#define DBG(flag, ...)
+#endif
+
+#endif
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.c
deleted file mode 100644 (file)
index aacfe98..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-#include <main/glheader.h>
-#include <glapi/glthread.h>
-#include <GL/internal/glcore.h>
-#include <utils.h>
-
-#include <state_tracker/st_public.h>
-#include <state_tracker/st_context.h>
-#include <pipe/p_defines.h>
-#include <pipe/p_context.h>
-#include <pipe/p_screen.h>
-
-#include "../common/nouveau_winsys_pipe.h"
-#include "../common/nouveau_dri.h"
-#include "../common/nouveau_local.h"
-#include "nouveau_context_dri.h"
-#include "nouveau_screen_dri.h"
-
-#ifdef DEBUG
-static const struct dri_debug_control debug_control[] = {
-       { "bo", DEBUG_BO },
-       { NULL, 0 }
-};
-int __nouveau_debug = 0;
-#endif
-
-GLboolean
-nouveau_context_create(const __GLcontextModes *glVis,
-                      __DRIcontextPrivate *driContextPriv,
-                      void *sharedContextPrivate)
-{
-       __DRIscreenPrivate *driScrnPriv = driContextPriv->driScreenPriv;
-       struct nouveau_screen_dri  *nv_screen = driScrnPriv->private;
-       struct nouveau_context_dri *nv = CALLOC_STRUCT(nouveau_context_dri);
-       struct st_context *st_share = NULL;
-       struct nouveau_context_dri *nv_share = NULL;
-       struct pipe_context *pipe;
-
-       if (sharedContextPrivate) {
-               st_share = ((struct nouveau_context_dri *)sharedContextPrivate)->st;
-               nv_share = st_share->pipe->priv;
-       }
-
-       if (nouveau_context_init(&nv_screen->base, driContextPriv->hHWContext,
-                                (drmLock *)&driScrnPriv->pSAREA->lock,
-                                &nv_share->base, &nv->base)) {
-               return GL_FALSE;
-       }
-
-       pipe = nv->base.nvc->pctx[nv->base.pctx_id];
-       driContextPriv->driverPrivate = (void *)nv;
-       //nv->nv_screen  = nv_screen;
-       nv->dri_screen = driScrnPriv;
-
-       driParseConfigFiles(&nv->dri_option_cache, &nv_screen->option_cache,
-                           nv->dri_screen->myNum, "nouveau");
-#ifdef DEBUG
-       __nouveau_debug = driParseDebugString(getenv("NOUVEAU_DEBUG"),
-                                             debug_control);
-#endif
-
-       nv->st = st_create_context(pipe, glVis, st_share);
-       return GL_TRUE;
-}
-
-void
-nouveau_context_destroy(__DRIcontextPrivate *driContextPriv)
-{
-       struct nouveau_context_dri *nv = driContextPriv->driverPrivate;
-
-       assert(nv);
-
-       st_finish(nv->st);
-       st_destroy_context(nv->st);
-
-       nouveau_context_cleanup(&nv->base);
-
-       FREE(nv);
-}
-
-GLboolean
-nouveau_context_bind(__DRIcontextPrivate *driContextPriv,
-                    __DRIdrawablePrivate *driDrawPriv,
-                    __DRIdrawablePrivate *driReadPriv)
-{
-       struct nouveau_context_dri *nv;
-       struct nouveau_framebuffer *draw, *read;
-
-       if (!driContextPriv) {
-               st_make_current(NULL, NULL, NULL);
-               return GL_TRUE;
-       }
-
-       nv = driContextPriv->driverPrivate;
-       draw = driDrawPriv->driverPrivate;
-       read = driReadPriv->driverPrivate;
-
-       st_make_current(nv->st, draw->stfb, read->stfb);
-
-       if ((nv->dri_drawable != driDrawPriv) ||
-           (nv->last_stamp != driDrawPriv->lastStamp)) {
-               nv->dri_drawable = driDrawPriv;
-               st_resize_framebuffer(draw->stfb, driDrawPriv->w,
-                                     driDrawPriv->h);
-               nv->last_stamp = driDrawPriv->lastStamp;
-       }
-
-       if (driDrawPriv != driReadPriv) {
-               st_resize_framebuffer(read->stfb, driReadPriv->w,
-                                     driReadPriv->h);
-       }
-
-       return GL_TRUE;
-}
-
-GLboolean
-nouveau_context_unbind(__DRIcontextPrivate *driContextPriv)
-{
-       struct nouveau_context_dri *nv = driContextPriv->driverPrivate;
-       (void)nv;
-
-       st_flush(nv->st, 0, NULL);
-       return GL_TRUE;
-}
-
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.h
deleted file mode 100644 (file)
index 64cf326..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef __NOUVEAU_CONTEXT_DRI_H__
-#define __NOUVEAU_CONTEXT_DRI_H__
-
-#include <dri_util.h>
-#include <xmlconfig.h>
-#include <nouveau/nouveau_winsys.h>
-#include "../common/nouveau_context.h"
-
-struct nouveau_framebuffer {
-       struct st_framebuffer *stfb;
-};
-
-struct nouveau_context_dri {
-       struct nouveau_context base;
-       struct st_context *st;
-
-       /* DRI stuff */
-       __DRIscreenPrivate    *dri_screen;
-       __DRIdrawablePrivate  *dri_drawable;
-       unsigned int           last_stamp;
-       driOptionCache         dri_option_cache;
-       drm_context_t          drm_context;
-       drmLock                drm_lock;
-};
-
-extern GLboolean nouveau_context_create(const __GLcontextModes *,
-                                       __DRIcontextPrivate *, void *);
-extern void nouveau_context_destroy(__DRIcontextPrivate *);
-extern GLboolean nouveau_context_bind(__DRIcontextPrivate *,
-                                     __DRIdrawablePrivate *draw,
-                                     __DRIdrawablePrivate *read);
-extern GLboolean nouveau_context_unbind(__DRIcontextPrivate *);
-
-#ifdef DEBUG
-extern int __nouveau_debug;
-
-#define DEBUG_BO (1 << 0)
-
-#define DBG(flag, ...) do {                   \
-       if (__nouveau_debug & (DEBUG_##flag)) \
-               NOUVEAU_ERR(__VA_ARGS__);     \
-} while(0)
-#else
-#define DBG(flag, ...)
-#endif
-
-#endif
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h
new file mode 100644 (file)
index 0000000..1207c2d
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef _NOUVEAU_DRI_
+#define _NOUVEAU_DRI_
+
+#include "xf86drm.h"
+#include "drm.h"
+#include "nouveau_drm.h"
+
+struct nouveau_dri {
+       uint32_t device_id;     /**< \brief PCI device ID */
+       uint32_t width;         /**< \brief width in pixels of display */
+       uint32_t height;        /**< \brief height in scanlines of display */
+       uint32_t depth;         /**< \brief depth of display (8, 15, 16, 24) */
+       uint32_t bpp;           /**< \brief bit depth of display (8, 16, 24, 32) */
+
+       uint32_t bus_type;      /**< \brief ths bus type */
+       uint32_t bus_mode;      /**< \brief bus mode (used for AGP, maybe also for PCI-E ?) */
+
+       uint32_t front_offset;  /**< \brief front buffer offset */
+       uint32_t front_pitch;   /**< \brief front buffer pitch */
+       uint32_t back_offset;   /**< \brief private back buffer offset */
+       uint32_t back_pitch;    /**< \brief private back buffer pitch */
+       uint32_t depth_offset;  /**< \brief private depth buffer offset */
+       uint32_t depth_pitch;   /**< \brief private depth buffer pitch */
+
+};
+
+#endif
+
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c
new file mode 100644 (file)
index 0000000..92f5bd0
--- /dev/null
@@ -0,0 +1,73 @@
+/**************************************************************************
+ * 
+ * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#include <pipe/p_thread.h>
+#include "nouveau_context.h"
+#include "nouveau_screen.h"
+#include "nouveau_drmif.h"
+
+pipe_static_mutex(lockMutex);
+
+/* Lock the hardware and validate our state.
+ */
+void
+LOCK_HARDWARE(struct nouveau_context *nv)
+{
+       struct nouveau_screen *nv_screen = nv->dri_screen->private;
+       struct nouveau_device *dev = nv_screen->device;
+       struct nouveau_device_priv *nvdev = nouveau_device(dev);
+       char __ret=0;
+
+       assert(!nv->locked);
+       pipe_mutex_lock(lockMutex);
+
+       DRM_CAS(nvdev->lock, nvdev->ctx,
+               (DRM_LOCK_HELD | nvdev->ctx), __ret);
+
+       if (__ret) {
+               drmGetLock(nvdev->fd, nvdev->ctx, 0);
+               nouveau_contended_lock(nv);
+       }
+       nv->locked = 1;
+}
+
+/* Unlock the hardware using the global current context 
+ */
+void
+UNLOCK_HARDWARE(struct nouveau_context *nv)
+{
+       struct nouveau_screen *nv_screen = nv->dri_screen->private;
+       struct nouveau_device *dev = nv_screen->device;
+       struct nouveau_device_priv *nvdev = nouveau_device(dev);
+
+       assert(nv->locked);
+       nv->locked = 0;
+
+       DRM_UNLOCK(nvdev->fd, nvdev->lock, nvdev->ctx);
+
+       pipe_mutex_unlock(lockMutex);
+} 
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c
new file mode 100644 (file)
index 0000000..c4cbbc2
--- /dev/null
@@ -0,0 +1,329 @@
+#include <utils.h>
+#include <vblank.h>
+#include <xmlpool.h>
+
+#include <pipe/p_context.h>
+#include <state_tracker/st_public.h>
+#include <state_tracker/st_cb_fbo.h>
+#include <state_tracker/drm_api.h>
+
+#include "nouveau_context.h"
+#include "nouveau_screen.h"
+#include "nouveau_swapbuffers.h"
+#include "nouveau_dri.h"
+
+#include "nouveau_drm.h"
+#include "nouveau_drmif.h"
+
+#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 12
+#error nouveau_drm.h version does not match expected version
+#endif
+
+/* Extension stuff, enabling of extensions handled by Gallium's GL state
+ * tracker.  But, we still need to define the entry points we want.
+ */
+#define need_GL_ARB_fragment_program
+#define need_GL_ARB_multisample
+#define need_GL_ARB_occlusion_query
+#define need_GL_ARB_point_parameters
+#define need_GL_ARB_shader_objects
+#define need_GL_ARB_texture_compression
+#define need_GL_ARB_vertex_program
+#define need_GL_ARB_vertex_shader
+#define need_GL_ARB_vertex_buffer_object
+#define need_GL_EXT_compiled_vertex_array
+#define need_GL_EXT_fog_coord
+#define need_GL_EXT_secondary_color
+#define need_GL_EXT_framebuffer_object
+#define need_GL_VERSION_2_0
+#define need_GL_VERSION_2_1
+#include "extension_helper.h"
+
+const struct dri_extension card_extensions[] =
+{
+       { "GL_ARB_multisample", GL_ARB_multisample_functions },
+       { "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions },
+       { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
+       { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions },
+       { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
+       { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions },
+       { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
+       { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
+       { "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions },
+       { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions },
+       { "GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions },
+       { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
+       { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
+       { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
+       { NULL, 0 }
+};
+
+PUBLIC const char __driConfigOptions[] =
+DRI_CONF_BEGIN
+DRI_CONF_END;
+static const GLuint __driNConfigOptions = 0;
+
+extern const struct dri_extension common_extensions[];
+extern const struct dri_extension nv40_extensions[];
+
+static GLboolean
+nouveau_create_buffer(__DRIscreenPrivate * driScrnPriv,
+                     __DRIdrawablePrivate * driDrawPriv,
+                     const __GLcontextModes *glVis, GLboolean pixmapBuffer)
+{
+       struct nouveau_framebuffer *nvfb;
+       enum pipe_format colour, depth, stencil;
+
+       if (pixmapBuffer)
+               return GL_FALSE;
+
+       nvfb = CALLOC_STRUCT(nouveau_framebuffer);
+       if (!nvfb)
+               return GL_FALSE;
+
+       if (glVis->redBits == 5)
+               colour = PIPE_FORMAT_R5G6B5_UNORM;
+       else
+               colour = PIPE_FORMAT_A8R8G8B8_UNORM;
+
+       if (glVis->depthBits == 16)
+               depth = PIPE_FORMAT_Z16_UNORM;
+       else if (glVis->depthBits == 24)
+               depth = PIPE_FORMAT_Z24S8_UNORM;
+       else
+               depth = PIPE_FORMAT_NONE;
+
+       if (glVis->stencilBits == 8)
+               stencil = PIPE_FORMAT_Z24S8_UNORM;
+       else
+               stencil = PIPE_FORMAT_NONE;
+
+       nvfb->stfb = st_create_framebuffer(glVis, colour, depth, stencil,
+                                          driDrawPriv->w, driDrawPriv->h,
+                                          (void*)nvfb);
+       if (!nvfb->stfb) {
+               free(nvfb);
+               return  GL_FALSE;
+       }
+
+       driDrawPriv->driverPrivate = (void *)nvfb;
+       return GL_TRUE;
+}
+
+static void
+nouveau_destroy_buffer(__DRIdrawablePrivate * driDrawPriv)
+{
+       struct nouveau_framebuffer *nvfb;
+       
+       nvfb = (struct nouveau_framebuffer *)driDrawPriv->driverPrivate;
+       st_unreference_framebuffer(nvfb->stfb);
+       free(nvfb);
+}
+
+static __DRIconfig **
+nouveau_fill_in_modes(__DRIscreenPrivate *psp,
+                     unsigned pixel_bits, unsigned depth_bits,
+                     unsigned stencil_bits, GLboolean have_back_buffer)
+{
+       __DRIconfig **configs;
+       unsigned depth_buffer_factor;
+       unsigned back_buffer_factor;
+       GLenum fb_format;
+       GLenum fb_type;
+
+       static const GLenum back_buffer_modes[] = {
+               GLX_NONE, GLX_SWAP_UNDEFINED_OML,
+       };
+
+       uint8_t depth_bits_array[3];
+       uint8_t stencil_bits_array[3];
+       uint8_t msaa_samples_array[1];
+
+       depth_bits_array[0] = 0;
+       depth_bits_array[1] = depth_bits;
+       depth_bits_array[2] = depth_bits;
+
+       /* Just like with the accumulation buffer, always provide some modes
+        * with a stencil buffer.  It will be a sw fallback, but some apps won't
+        * care about that.
+        */
+       stencil_bits_array[0] = 0;
+       stencil_bits_array[1] = 0;
+       if (depth_bits == 24)
+               stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
+       stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits;
+
+       msaa_samples_array[0] = 0;
+
+       depth_buffer_factor =
+               ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
+       back_buffer_factor = (have_back_buffer) ? 3 : 1;
+
+       if (pixel_bits == 16) {
+               fb_format = GL_RGB;
+               fb_type = GL_UNSIGNED_SHORT_5_6_5;
+       }
+       else {
+               fb_format = GL_BGRA;
+               fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
+       }
+
+       configs = driCreateConfigs(fb_format, fb_type,
+                                  depth_bits_array, stencil_bits_array,
+                                  depth_buffer_factor, back_buffer_modes,
+                                  back_buffer_factor, msaa_samples_array, 1);
+       if (configs == NULL) {
+        fprintf(stderr, "[%s:%u] Error creating FBConfig!\n",
+                        __func__, __LINE__);
+               return NULL;
+       }
+
+       return configs;
+}
+
+static struct pipe_surface *
+dri_surface_from_handle(struct pipe_screen *screen,
+                        unsigned handle,
+                        enum pipe_format format,
+                        unsigned width,
+                        unsigned height,
+                        unsigned pitch)
+{
+   struct pipe_surface *surface = NULL;
+   struct pipe_texture *texture = NULL;
+   struct pipe_texture templat;
+   struct pipe_buffer *buf = NULL;
+
+   buf = drm_api_hooks.buffer_from_handle(screen, "front buffer", handle);
+   if (!buf)
+      return NULL;
+
+   memset(&templat, 0, sizeof(templat));
+   templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
+   templat.target = PIPE_TEXTURE_2D;
+   templat.last_level = 0;
+   templat.depth[0] = 1;
+   templat.format = format;
+   templat.width[0] = width;
+   templat.height[0] = height;
+   pf_get_block(templat.format, &templat.block);
+
+   texture = screen->texture_blanket(screen,
+                                     &templat,
+                                     &pitch,
+                                     buf);
+
+   /* we don't need the buffer from this point on */
+   pipe_buffer_reference(&buf, NULL);
+
+   if (!texture)
+      return NULL;
+
+   surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
+                                     PIPE_BUFFER_USAGE_GPU_READ |
+                                     PIPE_BUFFER_USAGE_GPU_WRITE);
+
+   /* we don't need the texture from this point on */
+   pipe_texture_reference(&texture, NULL);
+   return surface;
+}
+
+static const __DRIconfig **
+nouveau_screen_create(__DRIscreenPrivate *psp)
+{
+       struct nouveau_dri *nv_dri = psp->pDevPriv;
+       struct nouveau_screen *nv_screen;
+       static const __DRIversion ddx_expected =
+               { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL };
+       static const __DRIversion dri_expected = { 4, 0, 0 };
+       static const __DRIversion drm_expected =
+               { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL };
+
+       if (!driCheckDriDdxDrmVersions2("nouveau",
+                                       &psp->dri_version, &dri_expected,
+                                       &psp->ddx_version, &ddx_expected,
+                                       &psp->drm_version, &drm_expected)) {
+               return NULL;
+       }
+
+       if (drm_expected.patch != psp->drm_version.patch) {
+               fprintf(stderr, "Incompatible DRM patch level.\n"
+                               "Expected: %d\n" "Current : %d\n",
+                       drm_expected.patch, psp->drm_version.patch);
+               return NULL;
+       }
+
+       driInitExtensions(NULL, card_extensions, GL_FALSE);
+
+       if (psp->devPrivSize != sizeof(struct nouveau_dri)) {
+               NOUVEAU_ERR("DRI struct mismatch between DDX/DRI\n");
+               return NULL;
+       }
+
+       nv_screen = CALLOC_STRUCT(nouveau_screen);
+       if (!nv_screen)
+               return NULL;
+
+       nouveau_device_open_existing(&nv_screen->device, 0, psp->fd, 0);
+
+       nv_screen->pscreen = drm_api_hooks.create_screen(psp->fd, 0);
+       if (!nv_screen->pscreen) {
+               FREE(nv_screen);
+               return NULL;
+       }
+       nv_screen->pscreen->flush_frontbuffer = nouveau_flush_frontbuffer;
+
+       {
+               enum pipe_format format;
+
+               if (nv_dri->bpp == 16)
+                       format = PIPE_FORMAT_R5G6B5_UNORM;
+               else
+                       format = PIPE_FORMAT_A8R8G8B8_UNORM;
+
+               nv_screen->fb = dri_surface_from_handle(nv_screen->pscreen,
+                                                       nv_dri->front_offset,
+                                                       format,
+                                                       nv_dri->width,
+                                                       nv_dri->height,
+                                                       nv_dri->front_pitch *
+                                                       nv_dri->bpp / 8);
+       }
+                                               
+       driParseOptionInfo(&nv_screen->option_cache,
+                          __driConfigOptions, __driNConfigOptions);
+
+       nv_screen->driScrnPriv = psp;
+       psp->private = (void *)nv_screen;
+
+       return (const __DRIconfig **)
+               nouveau_fill_in_modes(psp, nv_dri->bpp,
+                                     (nv_dri->bpp == 16) ? 16 : 24,
+                                     (nv_dri->bpp == 16) ? 0 : 8, 1);
+}
+
+static void
+nouveau_screen_destroy(__DRIscreenPrivate *driScrnPriv)
+{
+       struct nouveau_screen *nv_screen = driScrnPriv->private;
+
+       driScrnPriv->private = NULL;
+       FREE(nv_screen);
+}
+
+const struct __DriverAPIRec
+driDriverAPI = {
+       .InitScreen     = nouveau_screen_create,
+       .DestroyScreen  = nouveau_screen_destroy,
+       .CreateContext  = nouveau_context_create,
+       .DestroyContext = nouveau_context_destroy,
+       .CreateBuffer   = nouveau_create_buffer,
+       .DestroyBuffer  = nouveau_destroy_buffer,
+       .SwapBuffers    = nouveau_swap_buffers,
+       .MakeCurrent    = nouveau_context_bind,
+       .UnbindContext  = nouveau_context_unbind,
+       .CopySubBuffer  = nouveau_copy_sub_buffer,
+
+       .InitScreen2    = NULL, /* one day, I promise! */
+};
+
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h
new file mode 100644 (file)
index 0000000..ac078f3
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef __NOUVEAU_SCREEN_DRI_H__
+#define __NOUVEAU_SCREEN_DRI_H__
+
+#include "xmlconfig.h"
+
+struct nouveau_screen {
+       __DRIscreenPrivate *driScrnPriv;
+       driOptionCache      option_cache;
+
+       struct nouveau_device *device;
+
+       struct pipe_screen *pscreen;
+       struct pipe_surface *fb;
+};
+
+#endif
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.c
deleted file mode 100644 (file)
index 964a902..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-#include <utils.h>
-#include <vblank.h>
-#include <xmlpool.h>
-
-#include <pipe/p_context.h>
-#include <state_tracker/st_public.h>
-#include <state_tracker/st_cb_fbo.h>
-#include <nouveau_drm.h>
-#include "../common/nouveau_dri.h"
-#include "../common/nouveau_local.h"
-#include "nouveau_context_dri.h"
-#include "nouveau_screen_dri.h"
-#include "nouveau_swapbuffers.h"
-
-#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 12
-#error nouveau_drm.h version does not match expected version
-#endif
-
-/* Extension stuff, enabling of extensions handled by Gallium's GL state
- * tracker.  But, we still need to define the entry points we want.
- */
-#define need_GL_ARB_fragment_program
-#define need_GL_ARB_multisample
-#define need_GL_ARB_occlusion_query
-#define need_GL_ARB_point_parameters
-#define need_GL_ARB_shader_objects
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_program
-#define need_GL_ARB_vertex_shader
-#define need_GL_ARB_vertex_buffer_object
-#define need_GL_EXT_compiled_vertex_array
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_secondary_color
-#define need_GL_EXT_framebuffer_object
-#define need_GL_VERSION_2_0
-#define need_GL_VERSION_2_1
-#include "extension_helper.h"
-
-const struct dri_extension card_extensions[] =
-{
-       { "GL_ARB_multisample", GL_ARB_multisample_functions },
-       { "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions },
-       { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
-       { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions },
-       { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
-       { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions },
-       { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
-       { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
-       { "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions },
-       { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions },
-       { "GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions },
-       { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
-       { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
-       { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
-       { NULL, 0 }
-};
-
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
-DRI_CONF_END;
-static const GLuint __driNConfigOptions = 0;
-
-extern const struct dri_extension common_extensions[];
-extern const struct dri_extension nv40_extensions[];
-
-static GLboolean
-nouveau_create_buffer(__DRIscreenPrivate * driScrnPriv,
-                     __DRIdrawablePrivate * driDrawPriv,
-                     const __GLcontextModes *glVis, GLboolean pixmapBuffer)
-{
-       struct nouveau_framebuffer *nvfb;
-       enum pipe_format colour, depth, stencil;
-
-       if (pixmapBuffer)
-               return GL_FALSE;
-
-       nvfb = CALLOC_STRUCT(nouveau_framebuffer);
-       if (!nvfb)
-               return GL_FALSE;
-
-       if (glVis->redBits == 5)
-               colour = PIPE_FORMAT_R5G6B5_UNORM;
-       else
-               colour = PIPE_FORMAT_A8R8G8B8_UNORM;
-
-       if (glVis->depthBits == 16)
-               depth = PIPE_FORMAT_Z16_UNORM;
-       else if (glVis->depthBits == 24)
-               depth = PIPE_FORMAT_Z24S8_UNORM;
-       else
-               depth = PIPE_FORMAT_NONE;
-
-       if (glVis->stencilBits == 8)
-               stencil = PIPE_FORMAT_Z24S8_UNORM;
-       else
-               stencil = PIPE_FORMAT_NONE;
-
-       nvfb->stfb = st_create_framebuffer(glVis, colour, depth, stencil,
-                                          driDrawPriv->w, driDrawPriv->h,
-                                          (void*)nvfb);
-       if (!nvfb->stfb) {
-               free(nvfb);
-               return  GL_FALSE;
-       }
-
-       driDrawPriv->driverPrivate = (void *)nvfb;
-       return GL_TRUE;
-}
-
-static void
-nouveau_destroy_buffer(__DRIdrawablePrivate * driDrawPriv)
-{
-       struct nouveau_framebuffer *nvfb;
-       
-       nvfb = (struct nouveau_framebuffer *)driDrawPriv->driverPrivate;
-       st_unreference_framebuffer(nvfb->stfb);
-       free(nvfb);
-}
-
-static __DRIconfig **
-nouveau_fill_in_modes(__DRIscreenPrivate *psp,
-                     unsigned pixel_bits, unsigned depth_bits,
-                     unsigned stencil_bits, GLboolean have_back_buffer)
-{
-       __DRIconfig **configs;
-       unsigned depth_buffer_factor;
-       unsigned back_buffer_factor;
-       GLenum fb_format;
-       GLenum fb_type;
-
-       static const GLenum back_buffer_modes[] = {
-               GLX_NONE, GLX_SWAP_UNDEFINED_OML,
-       };
-
-       uint8_t depth_bits_array[3];
-       uint8_t stencil_bits_array[3];
-       uint8_t msaa_samples_array[1];
-
-       depth_bits_array[0] = 0;
-       depth_bits_array[1] = depth_bits;
-       depth_bits_array[2] = depth_bits;
-
-       /* Just like with the accumulation buffer, always provide some modes
-        * with a stencil buffer.  It will be a sw fallback, but some apps won't
-        * care about that.
-        */
-       stencil_bits_array[0] = 0;
-       stencil_bits_array[1] = 0;
-       if (depth_bits == 24)
-               stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
-       stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits;
-
-       msaa_samples_array[0] = 0;
-
-       depth_buffer_factor =
-               ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
-       back_buffer_factor = (have_back_buffer) ? 3 : 1;
-
-       if (pixel_bits == 16) {
-               fb_format = GL_RGB;
-               fb_type = GL_UNSIGNED_SHORT_5_6_5;
-       }
-       else {
-               fb_format = GL_BGRA;
-               fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
-       }
-
-       configs = driCreateConfigs(fb_format, fb_type,
-                                  depth_bits_array, stencil_bits_array,
-                                  depth_buffer_factor, back_buffer_modes,
-                                  back_buffer_factor, msaa_samples_array, 1);
-       if (configs == NULL) {
-        fprintf(stderr, "[%s:%u] Error creating FBConfig!\n",
-                        __func__, __LINE__);
-               return NULL;
-       }
-
-       return configs;
-}
-
-static const __DRIconfig **
-nouveau_screen_create(__DRIscreenPrivate *psp)
-{
-       struct nouveau_dri *nv_dri = psp->pDevPriv;
-       struct nouveau_screen_dri *nv_screen;
-       static const __DRIversion ddx_expected =
-               { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL };
-       static const __DRIversion dri_expected = { 4, 0, 0 };
-       static const __DRIversion drm_expected =
-               { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL };
-
-       if (!driCheckDriDdxDrmVersions2("nouveau",
-                                       &psp->dri_version, &dri_expected,
-                                       &psp->ddx_version, &ddx_expected,
-                                       &psp->drm_version, &drm_expected)) {
-               return NULL;
-       }
-
-       if (drm_expected.patch != psp->drm_version.patch) {
-               fprintf(stderr, "Incompatible DRM patch level.\n"
-                               "Expected: %d\n" "Current : %d\n",
-                       drm_expected.patch, psp->drm_version.patch);
-               return NULL;
-       }
-
-       driInitExtensions(NULL, card_extensions, GL_FALSE);
-
-       if (psp->devPrivSize != sizeof(struct nouveau_dri)) {
-               NOUVEAU_ERR("DRI struct mismatch between DDX/DRI\n");
-               return NULL;
-       }
-
-       nv_screen = CALLOC_STRUCT(nouveau_screen_dri);
-       if (!nv_screen)
-               return NULL;
-
-       driParseOptionInfo(&nv_screen->option_cache,
-                          __driConfigOptions, __driNConfigOptions);
-
-       if (nouveau_screen_init(nv_dri, psp->fd, &nv_screen->base)) {
-               FREE(nv_screen);
-               return NULL;
-       }
-
-       nv_screen->driScrnPriv = psp;
-       psp->private = (void *)nv_screen;
-
-       return (const __DRIconfig **)
-               nouveau_fill_in_modes(psp, nv_dri->bpp,
-                                     (nv_dri->bpp == 16) ? 16 : 24,
-                                     (nv_dri->bpp == 16) ? 0 : 8, 1);
-}
-
-static void
-nouveau_screen_destroy(__DRIscreenPrivate *driScrnPriv)
-{
-       struct nouveau_screen_dri *nv_screen = driScrnPriv->private;
-
-       driScrnPriv->private = NULL;
-       nouveau_screen_cleanup(&nv_screen->base);
-       FREE(nv_screen);
-}
-
-const struct __DriverAPIRec
-driDriverAPI = {
-       .InitScreen     = nouveau_screen_create,
-       .DestroyScreen  = nouveau_screen_destroy,
-       .CreateContext  = nouveau_context_create,
-       .DestroyContext = nouveau_context_destroy,
-       .CreateBuffer   = nouveau_create_buffer,
-       .DestroyBuffer  = nouveau_destroy_buffer,
-       .SwapBuffers    = nouveau_swap_buffers,
-       .MakeCurrent    = nouveau_context_bind,
-       .UnbindContext  = nouveau_context_unbind,
-       .CopySubBuffer  = nouveau_copy_sub_buffer,
-
-       .InitScreen2    = NULL, /* one day, I promise! */
-};
-
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.h
deleted file mode 100644 (file)
index 1498087..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __NOUVEAU_SCREEN_DRI_H__
-#define __NOUVEAU_SCREEN_DRI_H__
-
-#include "../common/nouveau_screen.h"
-#include "xmlconfig.h"
-
-struct nouveau_screen_dri {
-       struct nouveau_screen base;
-       __DRIscreenPrivate *driScrnPriv;
-       driOptionCache      option_cache;
-};
-
-#endif
index 58cb6f7265c54cc77c6f81b87ba13fec0ae51b9c..9c841a0b2d086b467b730e6e7db3eaba3bc22cb5 100644 (file)
@@ -7,23 +7,25 @@
 #include <state_tracker/st_context.h>
 #include <state_tracker/st_cb_fbo.h>
 
-#include "../common/nouveau_local.h"
-#include "nouveau_context_dri.h"
-#include "nouveau_screen_dri.h"
+#include "nouveau_context.h"
+#include "nouveau_screen.h"
 #include "nouveau_swapbuffers.h"
 
+#include "nouveau_pushbuf.h"
+
 void
 nouveau_copy_buffer(__DRIdrawablePrivate *dPriv, struct pipe_surface *surf,
                    const drm_clip_rect_t *rect)
 {
-       struct nouveau_context_dri *nv = dPriv->driContextPriv->driverPrivate;
-       struct pipe_context *pipe = nv->base.nvc->pctx[nv->base.pctx_id];
+       struct nouveau_context *nv = dPriv->driContextPriv->driverPrivate;
+       struct nouveau_screen *nv_screen = nv->dri_screen->private;
+       struct pipe_context *pipe = nv->st->pipe;
        drm_clip_rect_t *pbox;
        int nbox, i;
 
-       LOCK_HARDWARE(&nv->base);
+       LOCK_HARDWARE(nv);
        if (!dPriv->numClipRects) {
-               UNLOCK_HARDWARE(&nv->base);
+               UNLOCK_HARDWARE(nv);
                return;
        }
        pbox = dPriv->pClipRects;
@@ -39,12 +41,12 @@ nouveau_copy_buffer(__DRIdrawablePrivate *dPriv, struct pipe_surface *surf,
                w  = pbox->x2 - pbox->x1;
                h  = pbox->y2 - pbox->y1;
 
-               pipe->surface_copy(pipe, FALSE, nv->base.frontbuffer,
-                                  dx, dy, surf, sx, sy, w, h);
+               pipe->surface_copy(pipe, nv_screen->fb, dx, dy, surf,
+                                  sx, sy, w, h);
        }
 
-       FIRE_RING(nv->base.nvc->channel);
-       UNLOCK_HARDWARE(&nv->base);
+       pipe->flush(pipe, 0, NULL);
+       UNLOCK_HARDWARE(nv);
 
        if (nv->last_stamp != dPriv->lastStamp) {
                struct nouveau_framebuffer *nvfb = dPriv->driverPrivate;
@@ -86,19 +88,19 @@ nouveau_swap_buffers(__DRIdrawablePrivate *dPriv)
 }
 
 void
-nouveau_flush_frontbuffer(struct pipe_winsys *pws, struct pipe_surface *surf,
+nouveau_flush_frontbuffer(struct pipe_screen *pscreen, struct pipe_surface *ps,
                          void *context_private)
 {
-       struct nouveau_context_dri *nv = context_private;
+       struct nouveau_context *nv = context_private;
        __DRIdrawablePrivate *dPriv = nv->dri_drawable;
 
-       nouveau_copy_buffer(dPriv, surf, NULL);
+       nouveau_copy_buffer(dPriv, ps, NULL);
 }
 
 void
 nouveau_contended_lock(struct nouveau_context *nv)
 {
-       struct nouveau_context_dri *nv_sub = (struct nouveau_context_dri*)nv;
+       struct nouveau_context *nv_sub = (struct nouveau_context*)nv;
        __DRIdrawablePrivate *dPriv = nv_sub->dri_drawable;
        __DRIscreenPrivate *sPriv = nv_sub->dri_screen;
 
index 825d3da6da539b979d2577f5b823e75ba95d938e..4ca9cc228313af78be2a5913ab42b82350b5c1ac 100644 (file)
@@ -1,10 +1,11 @@
 #ifndef __NOUVEAU_SWAPBUFFERS_H__
 #define __NOUVEAU_SWAPBUFFERS_H__
 
-extern void nouveau_copy_buffer(__DRIdrawablePrivate *, struct pipe_surface *,
-                               const drm_clip_rect_t *);
-extern void nouveau_copy_sub_buffer(__DRIdrawablePrivate *,
-                                   int x, int y, int w, int h);
-extern void nouveau_swap_buffers(__DRIdrawablePrivate *);
+void nouveau_copy_buffer(__DRIdrawablePrivate *, struct pipe_surface *,
+                        const drm_clip_rect_t *);
+void nouveau_copy_sub_buffer(__DRIdrawablePrivate *, int x, int y, int w, int h);
+void nouveau_swap_buffers(__DRIdrawablePrivate *);
+void nouveau_flush_frontbuffer(struct pipe_screen *, struct pipe_surface *,
+                              void *context_private);
 
 #endif
diff --git a/src/gallium/winsys/drm/nouveau/dri2/Makefile b/src/gallium/winsys/drm/nouveau/dri2/Makefile
new file mode 100644 (file)
index 0000000..728870d
--- /dev/null
@@ -0,0 +1,26 @@
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = nouveau_dri2.so
+
+PIPE_DRIVERS = \
+       $(TOP)/src/gallium/state_trackers/dri2/libdri2drm.a \
+       $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
+       $(TOP)/src/gallium/drivers/nv04/libnv04.a \
+       $(TOP)/src/gallium/drivers/nv10/libnv10.a \
+       $(TOP)/src/gallium/drivers/nv20/libnv20.a \
+       $(TOP)/src/gallium/drivers/nv30/libnv30.a \
+       $(TOP)/src/gallium/drivers/nv40/libnv40.a \
+       $(TOP)/src/gallium/drivers/nv50/libnv50.a
+
+DRIVER_SOURCES =
+
+C_SOURCES = \
+       $(COMMON_GALLIUM_SOURCES) \
+       $(DRIVER_SOURCES)
+
+include ../../Makefile.template
+
+DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs)
+
+symlinks:
diff --git a/src/gallium/winsys/drm/nouveau/drm/Makefile b/src/gallium/winsys/drm/nouveau/drm/Makefile
new file mode 100644 (file)
index 0000000..2da78d8
--- /dev/null
@@ -0,0 +1,13 @@
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = nouveaudrm
+
+C_SOURCES = nouveau_drm_api.c \
+           nouveau_winsys_pipe.c \
+           nouveau_winsys.c
+
+LIBRARY_INCLUDES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-I)
+LIBRARY_DEFINES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-other)
+
+include ../../../../Makefile.template
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
new file mode 100644 (file)
index 0000000..c0127e8
--- /dev/null
@@ -0,0 +1,194 @@
+#include "util/u_memory.h"
+
+#include "nouveau_drm_api.h"
+#include "nouveau_winsys_pipe.h"
+
+#include "nouveau_drmif.h"
+#include "nouveau_channel.h"
+#include "nouveau_bo.h"
+
+static struct pipe_screen *
+nouveau_drm_create_screen(int fd, int pciid)
+{
+       struct pipe_winsys *ws;
+       struct nouveau_winsys *nvws;
+       struct nouveau_device *dev = NULL;
+       struct pipe_screen *(*init)(struct pipe_winsys *,
+                                   struct nouveau_winsys *);
+       int ret;
+
+       ret = nouveau_device_open_existing(&dev, 0, fd, 0);
+       if (ret)
+               return NULL;
+
+       switch (dev->chipset & 0xf0) {
+       case 0x00:
+               init = nv04_screen_create;
+               break;
+       case 0x10:
+               init = nv10_screen_create;
+               break;
+       case 0x20:
+               init = nv20_screen_create;
+               break;
+       case 0x30:
+               init = nv30_screen_create;
+               break;
+       case 0x40:
+       case 0x60:
+               init = nv40_screen_create;
+               break;
+       case 0x80:
+       case 0x90:
+       case 0xa0:
+               init = nv50_screen_create;
+               break;
+       default:
+               debug_printf("%s: unknown chipset nv%02x\n", __func__,
+                            dev->chipset);
+               return NULL;
+       }
+
+       ws = nouveau_pipe_winsys_new(dev);
+       if (!ws) {
+               nouveau_device_close(&dev);
+               return NULL;
+       }
+
+       nvws = nouveau_winsys_new(ws);
+       if (!nvws) {
+               ws->destroy(ws);
+               return NULL;
+       }
+
+       nouveau_pipe_winsys(ws)->pscreen = init(ws, nvws);
+       if (!nouveau_pipe_winsys(ws)->pscreen) {
+               ws->destroy(ws);
+               return NULL;
+       }
+
+       return nouveau_pipe_winsys(ws)->pscreen;
+}
+
+static struct pipe_context *
+nouveau_drm_create_context(struct pipe_screen *pscreen)
+{
+       struct nouveau_pipe_winsys *nvpws = nouveau_screen(pscreen);
+       struct pipe_context *(*init)(struct pipe_screen *, unsigned);
+       unsigned chipset = nvpws->channel->device->chipset;
+       int i;
+
+       switch (chipset & 0xf0) {
+       case 0x00:
+               init = nv04_create;
+               break;
+       case 0x10:
+               init = nv10_create;
+               break;
+       case 0x20:
+               init = nv20_create;
+               break;
+       case 0x30:
+               init = nv30_create;
+               break;
+       case 0x40:
+       case 0x60:
+               init = nv40_create;
+               break;
+       case 0x80:
+       case 0x90:
+       case 0xa0:
+               init = nv50_create;
+               break;
+       default:
+               debug_printf("%s: unknown chipset nv%02x\n", __func__, chipset);
+               return NULL;
+       }
+
+       /* Find a free slot for a pipe context, allocate a new one if needed */
+       for (i = 0; i < nvpws->nr_pctx; i++) {
+               if (nvpws->pctx[i] == NULL)
+                       break;
+       }
+
+       if (i == nvpws->nr_pctx) {
+               nvpws->nr_pctx++;
+               nvpws->pctx = realloc(nvpws->pctx,
+                                     sizeof(*nvpws->pctx) * nvpws->nr_pctx);
+       }
+
+       nvpws->pctx[i] = init(pscreen, i);
+       return nvpws->pctx[i];
+}
+
+static boolean
+nouveau_drm_pb_from_pt(struct pipe_texture *pt, struct pipe_buffer **ppb,
+                      unsigned *stride)
+{
+       return false;
+}
+
+static struct pipe_buffer *
+nouveau_drm_pb_from_handle(struct pipe_screen *pscreen, const char *name,
+                          unsigned handle)
+{
+       struct nouveau_pipe_winsys *nvpws = nouveau_screen(pscreen);
+       struct nouveau_device *dev = nvpws->channel->device;
+       struct nouveau_pipe_buffer *nvpb;
+       int ret;
+
+       nvpb = CALLOC_STRUCT(nouveau_pipe_buffer);
+       if (!nvpb)
+               return NULL;
+
+       ret = nouveau_bo_handle_ref(dev, handle, &nvpb->bo);
+       if (ret) {
+               debug_printf("%s: ref name 0x%08x failed with %d\n",
+                            __func__, handle, ret);
+               FREE(nvpb);
+               return NULL;
+       }
+
+       pipe_reference_init(&nvpb->base.reference, 1);
+       nvpb->base.screen = pscreen;
+       nvpb->base.alignment = 0;
+       nvpb->base.usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE |
+                          PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+       nvpb->base.size = nvpb->bo->size;
+       return &nvpb->base;
+}
+
+static boolean
+nouveau_drm_handle_from_pb(struct pipe_screen *pscreen, struct pipe_buffer *pb,
+                          unsigned *handle)
+{
+       struct nouveau_pipe_buffer *nvpb = nouveau_pipe_buffer(pb);
+
+       if (!nvpb)
+               return FALSE;
+
+       *handle = nvpb->bo->handle;
+       return TRUE;
+}
+
+static boolean
+nouveau_drm_name_from_pb(struct pipe_screen *pscreen, struct pipe_buffer *pb,
+                        unsigned *handle)
+{
+       struct nouveau_pipe_buffer *nvpb = nouveau_pipe_buffer(pb);
+
+       if (!nvpb)
+               return FALSE;
+
+       return nouveau_bo_handle_get(nvpb->bo, handle) == 0;
+}
+
+struct drm_api drm_api_hooks = {
+       .create_screen = nouveau_drm_create_screen,
+       .create_context = nouveau_drm_create_context,
+       .buffer_from_texture = nouveau_drm_pb_from_pt,
+       .buffer_from_handle = nouveau_drm_pb_from_handle,
+       .handle_from_buffer = nouveau_drm_handle_from_pb,
+       .global_handle_from_buffer = nouveau_drm_name_from_pb,
+};
+
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h
new file mode 100644 (file)
index 0000000..2782c83
--- /dev/null
@@ -0,0 +1,5 @@
+#ifndef __NOUVEAU_DRM_API_H__
+#define __NOUVEAU_DRM_API_H__
+#include "state_tracker/drm_api.h"
+
+#endif
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c
new file mode 100644 (file)
index 0000000..e3175fd
--- /dev/null
@@ -0,0 +1,94 @@
+#include "util/u_memory.h"
+
+#include "nouveau_winsys_pipe.h"
+
+static int
+nouveau_pipe_notifier_alloc(struct nouveau_winsys *nvws, int count,
+                           struct nouveau_notifier **notify)
+{
+       struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(nvws->ws);
+
+       return nouveau_notifier_alloc(nvpws->channel, nvpws->next_handle++,
+                                     count, notify);
+}
+
+static int
+nouveau_pipe_grobj_alloc(struct nouveau_winsys *nvws, int grclass,
+                        struct nouveau_grobj **grobj)
+{
+       struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(nvws->ws);
+       struct nouveau_channel *chan = nvpws->channel;
+       int ret;
+
+       ret = nouveau_grobj_alloc(chan, nvpws->next_handle++, grclass, grobj);
+       if (ret)
+               return ret;
+
+       BEGIN_RING(chan, *grobj, 0x0000, 1);
+       OUT_RING  (chan, (*grobj)->handle);
+       (*grobj)->bound = NOUVEAU_GROBJ_BOUND_EXPLICIT;
+       return 0;
+}
+
+static int
+nouveau_pipe_push_reloc(struct nouveau_winsys *nvws, void *ptr,
+                       struct pipe_buffer *buf, uint32_t data,
+                       uint32_t flags, uint32_t vor, uint32_t tor)
+{
+       struct nouveau_bo *bo = nouveau_pipe_buffer(buf)->bo;
+
+       return nouveau_pushbuf_emit_reloc(nvws->channel, ptr, bo,
+                                         data, flags, vor, tor);
+}
+
+static int
+nouveau_pipe_push_flush(struct nouveau_winsys *nvws, unsigned size,
+                       struct pipe_fence_handle **fence)
+{
+       if (fence)
+               *fence = NULL;
+
+       return nouveau_pushbuf_flush(nvws->channel, size);
+}
+
+static struct nouveau_bo *
+nouveau_pipe_get_bo(struct pipe_buffer *pb)
+{
+       return nouveau_pipe_buffer(pb)->bo;
+}
+
+struct nouveau_winsys *
+nouveau_winsys_new(struct pipe_winsys *ws)
+{
+       struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws);
+       struct nouveau_winsys *nvws;
+
+       nvws = CALLOC_STRUCT(nouveau_winsys);
+       if (!nvws)
+               return NULL;
+
+       nvws->ws                = ws;
+       nvws->channel           = nvpws->channel;
+
+       nvws->res_init          = nouveau_resource_init;
+       nvws->res_alloc         = nouveau_resource_alloc;
+       nvws->res_free          = nouveau_resource_free;
+
+       nvws->push_reloc        = nouveau_pipe_push_reloc;
+       nvws->push_flush        = nouveau_pipe_push_flush;
+
+       nvws->grobj_alloc       = nouveau_pipe_grobj_alloc;
+       nvws->grobj_free        = nouveau_grobj_free;
+
+       nvws->notifier_alloc    = nouveau_pipe_notifier_alloc;
+       nvws->notifier_free     = nouveau_notifier_free;
+       nvws->notifier_reset    = nouveau_notifier_reset;
+       nvws->notifier_status   = nouveau_notifier_status;
+       nvws->notifier_retval   = nouveau_notifier_return_val;
+       nvws->notifier_wait     = nouveau_notifier_wait_status;
+
+       nvws->get_bo            = nouveau_pipe_get_bo;
+
+       return nvws;
+}
+
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c
new file mode 100644 (file)
index 0000000..9e03a9f
--- /dev/null
@@ -0,0 +1,204 @@
+#include "pipe/internal/p_winsys_screen.h"
+#include <pipe/p_defines.h>
+#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
+
+#include "nouveau_winsys_pipe.h"
+
+#include "nouveau_drmif.h"
+#include "nouveau_bo.h"
+
+static const char *
+nouveau_get_name(struct pipe_winsys *pws)
+{
+       return "Nouveau/DRI";
+}
+
+static uint32_t
+nouveau_flags_from_usage(struct pipe_winsys *ws, unsigned usage)
+{
+       struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws);
+       struct pipe_screen *pscreen = nvpws->pscreen;
+       uint32_t flags = NOUVEAU_BO_LOCAL;
+
+       if (usage & NOUVEAU_BUFFER_USAGE_TRANSFER)
+               flags |= NOUVEAU_BO_GART;
+
+       if (usage & PIPE_BUFFER_USAGE_PIXEL) {
+               if (usage & NOUVEAU_BUFFER_USAGE_TEXTURE)
+                       flags |= NOUVEAU_BO_GART;
+               if (!(usage & PIPE_BUFFER_USAGE_CPU_READ_WRITE))
+                       flags |= NOUVEAU_BO_VRAM;
+
+               switch (nvpws->channel->device->chipset & 0xf0) {
+               case 0x50:
+               case 0x80:
+               case 0x90:
+                       flags |= NOUVEAU_BO_TILED;
+                       if (usage & NOUVEAU_BUFFER_USAGE_ZETA)
+                               flags |= NOUVEAU_BO_ZTILE;
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       if (usage & PIPE_BUFFER_USAGE_VERTEX) {
+               if (pscreen->get_param(pscreen, NOUVEAU_CAP_HW_VTXBUF))
+                       flags |= NOUVEAU_BO_GART;
+       }
+
+       if (usage & PIPE_BUFFER_USAGE_INDEX) {
+               if (pscreen->get_param(pscreen, NOUVEAU_CAP_HW_IDXBUF))
+                       flags |= NOUVEAU_BO_GART;
+       }
+
+       return flags;
+}
+
+static struct pipe_buffer *
+nouveau_pipe_bo_create(struct pipe_winsys *ws, unsigned alignment,
+                      unsigned usage, unsigned size)
+{
+       struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws);
+       struct nouveau_device *dev = nvpws->channel->device;
+       struct nouveau_pipe_buffer *nvbuf;
+       uint32_t flags;
+
+       nvbuf = CALLOC_STRUCT(nouveau_pipe_buffer);
+       if (!nvbuf)
+               return NULL;
+       pipe_reference_init(&nvbuf->base.reference, 1);
+       nvbuf->base.alignment = alignment;
+       nvbuf->base.usage = usage;
+       nvbuf->base.size = size;
+
+       flags = nouveau_flags_from_usage(ws, usage);
+       if (nouveau_bo_new(dev, flags, alignment, size, &nvbuf->bo)) {
+               FREE(nvbuf);
+               return NULL;
+       }
+
+       return &nvbuf->base;
+}
+
+static struct pipe_buffer *
+nouveau_pipe_bo_user_create(struct pipe_winsys *ws, void *ptr, unsigned bytes)
+{
+       struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws);
+       struct nouveau_device *dev = nvpws->channel->device;
+       struct nouveau_pipe_buffer *nvbuf;
+
+       nvbuf = CALLOC_STRUCT(nouveau_pipe_buffer);
+       if (!nvbuf)
+               return NULL;
+       pipe_reference_init(&nvbuf->base.reference, 1);
+       nvbuf->base.size = bytes;
+
+       if (nouveau_bo_user(dev, ptr, bytes, &nvbuf->bo)) {
+               FREE(nvbuf);
+               return NULL;
+       }
+
+       return &nvbuf->base;
+}
+
+static void
+nouveau_pipe_bo_del(struct pipe_buffer *buf)
+{
+       struct nouveau_pipe_buffer *nvbuf = nouveau_pipe_buffer(buf);
+
+       nouveau_bo_ref(NULL, &nvbuf->bo);
+       FREE(nvbuf);
+}
+
+static void *
+nouveau_pipe_bo_map(struct pipe_winsys *pws, struct pipe_buffer *buf,
+                   unsigned flags)
+{
+       struct nouveau_pipe_buffer *nvbuf = nouveau_pipe_buffer(buf);
+       uint32_t map_flags = 0;
+
+       if (flags & PIPE_BUFFER_USAGE_CPU_READ)
+               map_flags |= NOUVEAU_BO_RD;
+       if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
+               map_flags |= NOUVEAU_BO_WR;
+
+       if (nouveau_bo_map(nvbuf->bo, map_flags))
+               return NULL;
+       return nvbuf->bo->map;
+}
+
+static void
+nouveau_pipe_bo_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf)
+{
+       struct nouveau_pipe_buffer *nvbuf = nouveau_pipe_buffer(buf);
+
+       nouveau_bo_unmap(nvbuf->bo);
+}
+
+static void
+nouveau_pipe_fence_reference(struct pipe_winsys *ws,
+                            struct pipe_fence_handle **ptr,
+                            struct pipe_fence_handle *pfence)
+{
+       *ptr = pfence;
+}
+
+static int
+nouveau_pipe_fence_signalled(struct pipe_winsys *ws,
+                            struct pipe_fence_handle *pfence, unsigned flag)
+{
+       return 0;
+}
+
+static int
+nouveau_pipe_fence_finish(struct pipe_winsys *ws,
+                         struct pipe_fence_handle *pfence, unsigned flag)
+{
+       return 0;
+}
+
+static void
+nouveau_destroy(struct pipe_winsys *ws)
+{
+       struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws);
+
+       nouveau_device_close(&nvpws->channel->device);
+       FREE(nvpws);
+}
+
+struct pipe_winsys *
+nouveau_pipe_winsys_new(struct nouveau_device *dev)
+{
+       struct nouveau_pipe_winsys *nvpws;
+       int ret;
+
+       nvpws = CALLOC_STRUCT(nouveau_pipe_winsys);
+       if (!nvpws)
+               return NULL;
+
+       ret = nouveau_channel_alloc(dev, 0xbeef0201, 0xbeef0202,
+                                   &nvpws->channel);
+       if (ret) {
+               debug_printf("%s: error opening GPU channel: %d\n",
+                            __func__, ret);
+               FREE(nvpws);
+               return NULL;
+       }
+       nvpws->next_handle = 0x77000000;
+
+       nvpws->base.buffer_create = nouveau_pipe_bo_create;
+       nvpws->base.buffer_destroy = nouveau_pipe_bo_del;
+       nvpws->base.user_buffer_create = nouveau_pipe_bo_user_create;
+       nvpws->base.buffer_map = nouveau_pipe_bo_map;
+       nvpws->base.buffer_unmap = nouveau_pipe_bo_unmap;
+
+       nvpws->base.fence_reference = nouveau_pipe_fence_reference;
+       nvpws->base.fence_signalled = nouveau_pipe_fence_signalled;
+       nvpws->base.fence_finish = nouveau_pipe_fence_finish;
+
+       nvpws->base.get_name = nouveau_get_name;
+       nvpws->base.destroy = nouveau_destroy;
+       return &nvpws->base;
+}
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.h b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.h
new file mode 100644 (file)
index 0000000..10e1e26
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef NOUVEAU_PIPE_WINSYS_H
+#define NOUVEAU_PIPE_WINSYS_H
+
+#include "pipe/internal/p_winsys_screen.h"
+#include "pipe/p_context.h"
+
+#include "nouveau/nouveau_winsys.h"
+
+#include "nouveau_device.h"
+
+struct nouveau_pipe_buffer {
+       struct pipe_buffer base;
+       struct nouveau_bo *bo;
+};
+
+static INLINE struct nouveau_pipe_buffer *
+nouveau_pipe_buffer(struct pipe_buffer *buf)
+{
+       return (struct nouveau_pipe_buffer *)buf;
+}
+
+struct nouveau_pipe_winsys {
+       struct pipe_winsys base;
+
+       struct pipe_screen *pscreen;
+
+       struct nouveau_channel *channel;
+       uint32_t next_handle;
+
+       unsigned nr_pctx;
+       struct pipe_context **pctx;
+};
+
+static INLINE struct nouveau_pipe_winsys *
+nouveau_pipe_winsys(struct pipe_winsys *ws)
+{
+       return (struct nouveau_pipe_winsys *)ws;
+}
+
+static INLINE struct nouveau_pipe_winsys *
+nouveau_screen(struct pipe_screen *pscreen)
+{
+       return nouveau_pipe_winsys(pscreen->winsys);
+}
+
+struct pipe_winsys *
+nouveau_pipe_winsys_new(struct nouveau_device *);
+
+struct nouveau_winsys *
+nouveau_winsys_new(struct pipe_winsys *ws);
+
+#endif
index dca1e3233a0e954e086cc7f0ff8d4264c943472d..bacdf3de28abda1ea8d38e4e47c6cfefd819ecdf 100644 (file)
@@ -1,32 +1,12 @@
-
+# src/gallium/winsys/drm/radeon/Makefile
 TOP = ../../../../..
 include $(TOP)/configs/current
 
-LIBNAME = radeon_dri.so
-
-MINIGLX_SOURCES =
-
-PIPE_DRIVERS = \
-       $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
-       $(TOP)/src/gallium/drivers/r300/libr300.a
-
-DRIVER_SOURCES = \
-       radeon_buffer.c \
-       radeon_context.c \
-       radeon_r300.c \
-       radeon_screen.c \
-       radeon_winsys_softpipe.c
-
-C_SOURCES = \
-       $(COMMON_GALLIUM_SOURCES) \
-       $(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
-DRIVER_DEFINES = -I../../../drivers/r300
-
-include ../Makefile.template
-
-DRI_LIB_DEPS += -ldrm_radeon
+SUBDIRS = core $(GALLIUM_STATE_TRACKERS_DIRS)
 
-symlinks:
+default install clean:
+       @for dir in $(SUBDIRS) ; do \
+               if [ -d $$dir ] ; then \
+                       (cd $$dir && $(MAKE) $@) || exit 1; \
+               fi \
+       done
diff --git a/src/gallium/winsys/drm/radeon/core/Makefile b/src/gallium/winsys/drm/radeon/core/Makefile
new file mode 100644 (file)
index 0000000..42a6f4a
--- /dev/null
@@ -0,0 +1,18 @@
+
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = radeonwinsys
+
+C_SOURCES = \
+       radeon_buffer.c \
+       radeon_drm.c \
+       radeon_r300.c \
+       radeon_winsys_softpipe.c
+
+LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/r300 \
+                  $(shell pkg-config libdrm --cflags-only-I)
+
+include ../../../../Makefile.template
+
+symlinks:
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
new file mode 100644 (file)
index 0000000..9dca510
--- /dev/null
@@ -0,0 +1,243 @@
+/* 
+ * Copyright Â© 2008 Jérôme Glisse
+ *             2009 Corbin Simpson
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
+ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+/*
+ * Authors:
+ *      Jérôme Glisse <glisse@freedesktop.org>
+ *      Corbin Simpson <MostAwesomeDude@gmail.com>
+ */
+
+#include "radeon_buffer.h"
+
+static const char *radeon_get_name(struct pipe_winsys *ws)
+{
+    return "Radeon/GEM+KMS";
+}
+
+static struct pipe_buffer *radeon_buffer_create(struct pipe_winsys *ws,
+                                                unsigned alignment,
+                                                unsigned usage,
+                                                unsigned size)
+{
+    struct radeon_winsys *radeon_ws = (struct radeon_winsys *)ws;
+    struct radeon_pipe_buffer *radeon_buffer;
+    uint32_t domain;
+
+    radeon_buffer = CALLOC_STRUCT(radeon_pipe_buffer);
+    if (radeon_buffer == NULL) {
+        return NULL;
+    }
+
+    pipe_reference_init(&radeon_buffer->base.reference, 1);
+    radeon_buffer->base.alignment = alignment;
+    radeon_buffer->base.usage = usage;
+    radeon_buffer->base.size = size;
+
+    domain = 0;
+
+    if (usage & PIPE_BUFFER_USAGE_PIXEL) {
+        domain |= RADEON_GEM_DOMAIN_VRAM;
+    }
+    if (usage & PIPE_BUFFER_USAGE_VERTEX) {
+        domain |= RADEON_GEM_DOMAIN_GTT;
+    }
+    if (usage & PIPE_BUFFER_USAGE_INDEX) {
+        domain |= RADEON_GEM_DOMAIN_GTT;
+    }
+
+    radeon_buffer->bo = radeon_bo_open(radeon_ws->bom, 0, size, alignment,
+                                       domain, 0);
+    if (radeon_buffer->bo == NULL) {
+        FREE(radeon_buffer);
+    }
+    return &radeon_buffer->base;
+}
+
+static struct pipe_buffer *radeon_buffer_user_create(struct pipe_winsys *ws,
+                                                     void *ptr,
+                                                     unsigned bytes)
+{
+    struct radeon_pipe_buffer *radeon_buffer;
+
+    radeon_buffer = (struct radeon_pipe_buffer*)radeon_buffer_create(ws, 0, 0, bytes);
+    if (radeon_buffer == NULL) {
+        return NULL;
+    }
+    radeon_bo_map(radeon_buffer->bo, 1);
+    memcpy(radeon_buffer->bo->ptr, ptr, bytes);
+    radeon_bo_unmap(radeon_buffer->bo);
+    return &radeon_buffer->base;
+}
+
+static void radeon_buffer_del(struct pipe_buffer *buffer)
+{
+    struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer;
+
+    radeon_bo_unref(radeon_buffer->bo);
+    free(radeon_buffer);
+}
+
+static void *radeon_buffer_map(struct pipe_winsys *ws,
+                               struct pipe_buffer *buffer,
+                               unsigned flags)
+{
+    struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer;
+    int write = 0;
+
+    if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
+       /* XXX Remove this when radeon_bo_map supports DONTBLOCK */
+       return NULL;
+    }
+    if (flags & PIPE_BUFFER_USAGE_CPU_WRITE) {
+        write = 1;
+    }
+
+    if (radeon_bo_map(radeon_buffer->bo, write))
+        return NULL;
+    return radeon_buffer->bo->ptr;
+}
+
+static void radeon_buffer_unmap(struct pipe_winsys *ws, struct pipe_buffer *buffer)
+{
+    struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer;
+
+    radeon_bo_unmap(radeon_buffer->bo);
+}
+
+static void radeon_fence_reference(struct pipe_winsys *ws,
+                                   struct pipe_fence_handle **ptr,
+                                   struct pipe_fence_handle *pfence)
+{
+}
+
+static int radeon_fence_signalled(struct pipe_winsys *ws,
+                                  struct pipe_fence_handle *pfence,
+                                  unsigned flag)
+{
+    return 1;
+}
+
+static int radeon_fence_finish(struct pipe_winsys *ws,
+                               struct pipe_fence_handle *pfence,
+                               unsigned flag)
+{
+    return 0;
+}
+
+static void radeon_flush_frontbuffer(struct pipe_winsys *pipe_winsys,
+                                     struct pipe_surface *pipe_surface,
+                                     void *context_private)
+{
+    /* TODO: call dri2CopyRegion */
+}
+
+struct radeon_winsys* radeon_pipe_winsys(int fd)
+{
+    struct radeon_winsys* radeon_ws;
+    struct radeon_bo_manager* bom;
+
+    radeon_ws = CALLOC_STRUCT(radeon_winsys);
+    if (radeon_ws == NULL) {
+        return NULL;
+    }
+
+    bom = radeon_bo_manager_gem_ctor(fd);
+    radeon_ws->bom = bom;
+
+    radeon_ws->base.flush_frontbuffer = radeon_flush_frontbuffer;
+
+    radeon_ws->base.buffer_create = radeon_buffer_create;
+    radeon_ws->base.buffer_destroy = radeon_buffer_del;
+    radeon_ws->base.user_buffer_create = radeon_buffer_user_create;
+    radeon_ws->base.buffer_map = radeon_buffer_map;
+    radeon_ws->base.buffer_unmap = radeon_buffer_unmap;
+
+    radeon_ws->base.fence_reference = radeon_fence_reference;
+    radeon_ws->base.fence_signalled = radeon_fence_signalled;
+    radeon_ws->base.fence_finish = radeon_fence_finish;
+
+    radeon_ws->base.get_name = radeon_get_name;
+
+    return radeon_ws;
+}
+#if 0
+static struct pipe_buffer *radeon_buffer_from_handle(struct radeon_screen *radeon_screen,
+                                                  uint32_t handle)
+{
+    struct radeon_pipe_buffer *radeon_buffer;
+    struct radeon_bo *bo = NULL;
+
+    bo = radeon_bo_open(radeon_screen->bom, handle, 0, 0, 0, 0);
+    if (bo == NULL) {
+        return NULL;
+    }
+    radeon_buffer = calloc(1, sizeof(struct radeon_pipe_buffer));
+    if (radeon_buffer == NULL) {
+        radeon_bo_unref(bo);
+        return NULL;
+    }
+    pipe_reference_init(&radeon_buffer->base.reference, 1);
+    radeon_buffer->base.usage = PIPE_BUFFER_USAGE_PIXEL;
+    radeon_buffer->bo = bo;
+    return &radeon_buffer->base;
+}
+
+struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_context,
+                                             uint32_t handle,
+                                             enum pipe_format format,
+                                             int w, int h, int pitch)
+{
+    struct pipe_screen *pipe_screen = radeon_context->pipe_screen;
+    struct pipe_winsys *pipe_winsys = radeon_context->pipe_winsys;
+    struct pipe_texture tmpl;
+    struct pipe_surface *ps;
+    struct pipe_texture *pt;
+    struct pipe_buffer *pb;
+
+    pb = radeon_buffer_from_handle(radeon_context->radeon_screen, handle);
+    if (pb == NULL) {
+        return NULL;
+    }
+    memset(&tmpl, 0, sizeof(tmpl));
+    tmpl.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+    tmpl.target = PIPE_TEXTURE_2D;
+    tmpl.width[0] = w;
+    tmpl.height[0] = h;
+    tmpl.depth[0] = 1;
+    tmpl.format = format;
+    pf_get_block(tmpl.format, &tmpl.block);
+    tmpl.nblocksx[0] = pf_get_nblocksx(&tmpl.block, w);
+    tmpl.nblocksy[0] = pf_get_nblocksy(&tmpl.block, h);
+
+    pt = pipe_screen->texture_blanket(pipe_screen, &tmpl, &pitch, pb);
+    if (pt == NULL) {
+        pipe_buffer_reference(&pb, NULL);
+    }
+    ps = pipe_screen->get_tex_surface(pipe_screen, pt, 0, 0, 0,
+                                      PIPE_BUFFER_USAGE_GPU_WRITE);
+    return ps;
+}
+#endif
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
new file mode 100644 (file)
index 0000000..40ad0fc
--- /dev/null
@@ -0,0 +1,67 @@
+/* 
+ * 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/internal/p_winsys_screen.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_inlines.h"
+
+//#include "state_tracker/st_public.h"
+
+#include "util/u_memory.h"
+
+#include "radeon_bo.h"
+
+#include "radeon_drm.h"
+
+struct radeon_pipe_buffer {
+    struct pipe_buffer  base;
+    struct radeon_bo    *bo;
+};
+
+struct radeon_winsys {
+    /* Parent class. */
+    struct pipe_winsys base;
+
+    /* Radeon BO manager.
+     * This corresponds to void* radeon_winsys in r300_winsys. */
+    struct radeon_bo_manager* bom;
+};
+
+struct radeon_winsys* radeon_pipe_winsys(int fb);
+struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_context,
+                                             uint32_t handle,
+                                             enum pipe_format format,
+                                             int w, int h, int pitch);
+
+#endif
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
new file mode 100644 (file)
index 0000000..3446654
--- /dev/null
@@ -0,0 +1,122 @@
+/* 
+ * 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>
+ */
+
+#include "radeon_drm.h"
+
+/* Create a pipe_screen. */
+struct pipe_screen* radeon_create_screen(int drmFB, int pciID)
+{
+    struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB);
+
+    if (getenv("RADEON_SOFTPIPE")) {
+        return softpipe_create_screen((struct pipe_winsys*)winsys);
+    } else {
+        struct r300_winsys* r300 = radeon_create_r300_winsys(drmFB, winsys);
+        FREE(winsys);
+        return r300_create_screen(r300);
+    }
+}
+
+/* Create a pipe_context. */
+struct pipe_context* radeon_create_context(struct pipe_screen* screen)
+{
+    if (getenv("RADEON_SOFTPIPE")) {
+        return radeon_create_softpipe(screen->winsys);
+    } else {
+        return r300_create_context(screen, screen->winsys);
+    }
+}
+
+boolean radeon_buffer_from_texture(struct pipe_texture* texture,
+                                   struct pipe_buffer** buffer,
+                                   unsigned* stride)
+{
+    return FALSE;
+}
+
+/* Create a buffer from a handle. */
+/* XXX what's up with name? */
+struct pipe_buffer* radeon_buffer_from_handle(struct pipe_screen* screen,
+                                              const char* name,
+                                              unsigned handle)
+{
+    struct radeon_bo_manager* bom =
+        ((struct radeon_winsys*)screen->winsys)->bom;
+    struct radeon_pipe_buffer* radeon_buffer;
+    struct radeon_bo* bo = NULL;
+
+    bo = radeon_bo_open(bom, handle, 0, 0, 0, 0);
+    if (bo == NULL) {
+        return NULL;
+    }
+
+    radeon_buffer = CALLOC_STRUCT(radeon_pipe_buffer);
+    if (radeon_buffer == NULL) {
+        radeon_bo_unref(bo);
+        return NULL;
+    }
+
+    pipe_reference_init(&radeon_buffer->base.reference, 1);
+    radeon_buffer->base.screen = screen;
+    radeon_buffer->base.usage = PIPE_BUFFER_USAGE_PIXEL;
+    radeon_buffer->bo = bo;
+    return &radeon_buffer->base;
+}
+
+boolean radeon_handle_from_buffer(struct pipe_screen* screen,
+                                  struct pipe_buffer* buffer,
+                                  unsigned* handle)
+{
+    struct radeon_pipe_buffer* radeon_buffer =
+        (struct radeon_pipe_buffer*)buffer;
+    *handle = radeon_buffer->bo->handle;
+    return TRUE;
+}
+
+boolean radeon_global_handle_from_buffer(struct pipe_screen* screen,
+                                         struct pipe_buffer* buffer,
+                                         unsigned* handle)
+{
+    /* XXX WTF is the difference here? global? */
+    struct radeon_pipe_buffer* radeon_buffer =
+        (struct radeon_pipe_buffer*)buffer;
+    *handle = radeon_buffer->bo->handle;
+    return TRUE;
+}
+
+struct drm_api drm_api_hooks = {
+    .create_screen = radeon_create_screen,
+    .create_context = radeon_create_context,
+    /* XXX fix this */
+    .buffer_from_texture = r300_get_texture_buffer,
+    .buffer_from_handle = radeon_buffer_from_handle,
+    .handle_from_buffer = radeon_handle_from_buffer,
+    .global_handle_from_buffer = radeon_global_handle_from_buffer,
+};
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.h b/src/gallium/winsys/drm/radeon/core/radeon_drm.h
new file mode 100644 (file)
index 0000000..ca2d98e
--- /dev/null
@@ -0,0 +1,63 @@
+/* 
+ * 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 "pipe/p_screen.h"
+
+#include "util/u_memory.h"
+
+#include "state_tracker/drm_api.h"
+
+#include "radeon_buffer.h"
+#include "radeon_r300.h"
+#include "radeon_winsys_softpipe.h"
+
+struct pipe_screen* radeon_create_screen(int drmFB, int pciID);
+
+struct pipe_context* radeon_create_context(struct pipe_screen* screen);
+
+boolean radeon_buffer_from_texture(struct pipe_texture* texture,
+                                   struct pipe_buffer** buffer,
+                                   unsigned* stride);
+
+struct pipe_buffer* radeon_buffer_from_handle(struct pipe_screen* screen,
+                                              const char* name,
+                                              unsigned handle);
+
+boolean radeon_handle_from_buffer(struct pipe_screen* screen,
+                                  struct pipe_buffer* buffer,
+                                  unsigned* handle);
+
+boolean radeon_global_handle_from_buffer(struct pipe_screen* screen,
+                                         struct pipe_buffer* buffer,
+                                         unsigned* handle);
+
+#endif
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
new file mode 100644 (file)
index 0000000..c7b6813
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "radeon_r300.h"
+
+static boolean radeon_r300_check_cs(struct radeon_cs* cs, int size)
+{
+    /* XXX check size here, lazy ass! */
+    return TRUE;
+}
+
+static void radeon_r300_write_cs_reloc(struct radeon_cs* cs,
+                                    struct pipe_buffer* pbuffer,
+                                    uint32_t rd,
+                                    uint32_t wd,
+                                    uint32_t flags)
+{
+    radeon_cs_write_reloc(cs, ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags);
+}
+
+static void radeon_r300_flush_cs(struct radeon_cs* cs)
+{
+    radeon_cs_emit(cs);
+    radeon_cs_erase(cs);
+}
+
+/* Helper function to do the ioctls needed for setup and init. */
+static void do_ioctls(struct r300_winsys* winsys, int fd)
+{
+    drm_radeon_getparam_t gp;
+    uint32_t target;
+    int retval;
+
+    /* XXX is this cast safe? */
+    gp.value = (int*)&target;
+
+    /* First, get PCI ID */
+    gp.param = RADEON_PARAM_DEVICE_ID;
+    retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp));
+    if (retval) {
+        fprintf(stderr, "%s: Failed to get PCI ID, error number %d",
+                __FUNCTION__, retval);
+        exit(1);
+    }
+    winsys->pci_id = target;
+
+    /* Then, get the number of pixel pipes */
+    gp.param = RADEON_PARAM_NUM_GB_PIPES;
+    retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp));
+    if (retval) {
+        fprintf(stderr, "%s: Failed to get GB pipe count, error number %d",
+                __FUNCTION__, retval);
+        exit(1);
+    }
+    winsys->gb_pipes = target;
+
+}
+
+struct r300_winsys*
+radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys)
+{
+    struct r300_winsys* winsys = CALLOC_STRUCT(r300_winsys);
+
+    do_ioctls(winsys, fd);
+
+    struct radeon_cs_manager* csm = radeon_cs_manager_gem_ctor(fd);
+
+    winsys->cs = radeon_cs_create(csm, 1024 * 64 / 4);
+
+    winsys->check_cs = radeon_r300_check_cs;
+    winsys->begin_cs = radeon_cs_begin;
+    winsys->write_cs_dword = radeon_cs_write_dword;
+    winsys->write_cs_reloc = radeon_r300_write_cs_reloc;
+    winsys->end_cs = radeon_cs_end;
+    winsys->flush_cs = radeon_r300_flush_cs;
+
+    memcpy(winsys, old_winsys, sizeof(struct radeon_winsys));
+
+    return winsys;
+}
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.h b/src/gallium/winsys/drm/radeon/core/radeon_r300.h
new file mode 100644 (file)
index 0000000..5c373cd
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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. */
+
+/* XXX WTF is this! I shouldn't have to include those first three! FUCK! */
+#include <stdint.h>
+#include <stdlib.h>
+#include "drm.h"
+#include "radeon_drm.h"
+#include "radeon_cs.h"
+
+#include "r300_winsys.h"
+
+#include "radeon_buffer.h"
+
+struct r300_winsys*
+radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys);
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c
new file mode 100644 (file)
index 0000000..226e166
--- /dev/null
@@ -0,0 +1,71 @@
+/**************************************************************************
+ * 
+ * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * 
+ **************************************************************************/
+/*
+ * Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
+ */
+
+#include "radeon_winsys_softpipe.h"
+
+struct radeon_softpipe_winsys {
+    struct softpipe_winsys  sp_winsys;
+    struct radeon_context      *radeon_context;
+};
+
+/**
+ * Return list of surface formats supported by this driver.
+ */
+static boolean radeon_is_format_supported(struct softpipe_winsys *sws, uint format)
+{
+    switch (format) {
+    case PIPE_FORMAT_A8R8G8B8_UNORM:
+    case PIPE_FORMAT_R5G6B5_UNORM:
+    case PIPE_FORMAT_Z24S8_UNORM:
+        return TRUE;
+    default:
+        break;
+    };
+    return FALSE;
+}
+
+struct pipe_context *radeon_create_softpipe(struct pipe_winsys* winsys)
+{
+    struct softpipe_winsys *sp_winsys;
+    struct pipe_screen *pipe_screen;
+
+    pipe_screen = softpipe_create_screen(winsys);
+
+    sp_winsys = CALLOC_STRUCT(softpipe_winsys);
+    if (sp_winsys == NULL) {
+        return NULL;
+    }
+
+    sp_winsys->is_format_supported = radeon_is_format_supported;
+    return softpipe_create(pipe_screen,
+                           winsys,
+                           sp_winsys);
+}
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.h b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.h
new file mode 100644 (file)
index 0000000..04740e4
--- /dev/null
@@ -0,0 +1,44 @@
+/* 
+ * 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_WINSYS_SOFTPIPE_H
+#define RADEON_WINSYS_SOFTPIPE_H
+
+#include <stdio.h>
+
+#include "pipe/p_defines.h"
+#include "pipe/p_format.h"
+
+#include "softpipe/sp_winsys.h"
+
+#include "util/u_memory.h"
+
+struct pipe_context *radeon_create_softpipe(struct pipe_winsys* winsys);
+
+#endif
diff --git a/src/gallium/winsys/drm/radeon/dri2/Makefile b/src/gallium/winsys/drm/radeon/dri2/Makefile
new file mode 100644 (file)
index 0000000..f471c44
--- /dev/null
@@ -0,0 +1,25 @@
+
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = radeon_dri.so
+
+MINIGLX_SOURCES =
+
+PIPE_DRIVERS = \
+       $(TOP)/src/gallium/state_trackers/dri2/libdri2drm.a \
+       $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \
+       $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+       $(TOP)/src/gallium/drivers/r300/libr300.a
+
+C_SOURCES = \
+       $(COMMON_GALLIUM_SOURCES) \
+       $(DRIVER_SOURCES)
+
+ASM_SOURCES = 
+
+include ../../Makefile.template
+
+DRI_LIB_DEPS += -ldrm_radeon
+
+symlinks:
diff --git a/src/gallium/winsys/drm/radeon/egl/Makefile b/src/gallium/winsys/drm/radeon/egl/Makefile
new file mode 100644 (file)
index 0000000..d989b3a
--- /dev/null
@@ -0,0 +1,25 @@
+TOP = ../../../../../..
+GALLIUMDIR = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = EGL_r300.so
+
+PIPE_DRIVERS = \
+       $(TOP)/src/gallium/state_trackers/egl/libegldrm.a \
+       $(GALLIUMDIR)/winsys/drm/radeon/core/libradeonwinsys.a \
+       $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+       $(TOP)/src/gallium/drivers/r300/libr300.a
+
+DRIVER_SOURCES =
+
+C_SOURCES = \
+       $(COMMON_GALLIUM_SOURCES) \
+       $(DRIVER_SOURCES)
+
+DRIVER_EXTRAS = -ldrm_radeon
+
+ASM_SOURCES = 
+
+include ../../Makefile.template
+
+symlinks:
diff --git a/src/gallium/winsys/drm/radeon/radeon_buffer.c b/src/gallium/winsys/drm/radeon/radeon_buffer.c
deleted file mode 100644 (file)
index 259a505..0000000
+++ /dev/null
@@ -1,239 +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>
- */
-#include <stdio.h>
-#include "dri_util.h"
-#include "state_tracker/st_public.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
-#include "radeon_buffer.h"
-#include "radeon_screen.h"
-#include "radeon_context.h"
-#include "radeon_bo.h"
-#include "radeon_drm.h"
-
-static const char *radeon_get_name(struct pipe_winsys *ws)
-{
-    return "RADEON/DRI2";
-}
-
-static struct pipe_buffer *radeon_buffer_create(struct pipe_winsys *ws,
-                                             unsigned alignment,
-                                             unsigned usage,
-                                             unsigned size)
-{
-    struct radeon_pipe_winsys *radeon_ws = (struct radeon_pipe_winsys *)ws;
-    struct radeon_pipe_buffer *radeon_buffer;
-    uint32_t domain;
-
-    radeon_buffer = calloc(1, sizeof(*radeon_buffer));
-    if (radeon_buffer == NULL) {
-        return NULL;
-    }
-    radeon_buffer->base.refcount = 1;
-    radeon_buffer->base.alignment = alignment;
-    radeon_buffer->base.usage = usage;
-    radeon_buffer->base.size = size;
-
-    domain = 0;
-
-    if (usage & PIPE_BUFFER_USAGE_PIXEL) {
-        domain |= RADEON_GEM_DOMAIN_VRAM;
-    }
-    if (usage & PIPE_BUFFER_USAGE_VERTEX) {
-        domain |= RADEON_GEM_DOMAIN_GTT;
-    }
-
-    if (usage & PIPE_BUFFER_USAGE_INDEX) {
-        domain |= RADEON_GEM_DOMAIN_GTT;
-    }
-    radeon_buffer->bo = radeon_bo_open(radeon_ws->radeon_screen->bom, 0,
-                                    size, alignment, domain, 0);
-    if (radeon_buffer->bo == NULL) {
-        free(radeon_buffer);
-    }
-    return &radeon_buffer->base;
-}
-
-static struct pipe_buffer *radeon_buffer_user_create(struct pipe_winsys *ws,
-                                                  void *ptr,
-                                                  unsigned bytes)
-{
-    struct radeon_pipe_buffer *radeon_buffer;
-
-    radeon_buffer = (struct radeon_pipe_buffer*)radeon_buffer_create(ws, 0, 0, bytes);
-    if (radeon_buffer == NULL) {
-        return NULL;
-    }
-    radeon_bo_map(radeon_buffer->bo, 1);
-    memcpy(radeon_buffer->bo->ptr, ptr, bytes);
-    radeon_bo_unmap(radeon_buffer->bo);
-    return &radeon_buffer->base;
-}
-
-static void radeon_buffer_del(struct pipe_winsys *ws, struct pipe_buffer *buffer)
-{
-    struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer;
-
-    radeon_bo_unref(radeon_buffer->bo);
-    free(radeon_buffer);
-}
-
-static void *radeon_buffer_map(struct pipe_winsys *ws,
-                            struct pipe_buffer *buffer,
-                            unsigned flags)
-{
-    struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer;
-    int write = 0;
-
-    if (flags & PIPE_BUFFER_USAGE_CPU_WRITE) {
-        write = 1;
-    }
-    if (radeon_bo_map(radeon_buffer->bo, write))
-        return NULL;
-    return radeon_buffer->bo->ptr;
-}
-
-static void radeon_buffer_unmap(struct pipe_winsys *ws, struct pipe_buffer *buffer)
-{
-    struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer;
-
-    radeon_bo_unmap(radeon_buffer->bo);
-}
-
-static void radeon_fence_reference(struct pipe_winsys *ws,
-                                struct pipe_fence_handle **ptr,
-                                struct pipe_fence_handle *pfence)
-{
-}
-
-static int radeon_fence_signalled(struct pipe_winsys *ws,
-                               struct pipe_fence_handle *pfence,
-                               unsigned flag)
-{
-    return 1;
-}
-
-static int radeon_fence_finish(struct pipe_winsys *ws,
-                            struct pipe_fence_handle *pfence,
-                            unsigned flag)
-{
-    return 0;
-}
-
-static void radeon_flush_frontbuffer(struct pipe_winsys *pipe_winsys,
-                                  struct pipe_surface *pipe_surface,
-                                  void *context_private)
-{
-    /* TODO: call dri2CopyRegion */
-}
-
-struct pipe_winsys *radeon_pipe_winsys(struct radeon_screen *radeon_screen)
-{
-    struct radeon_pipe_winsys *radeon_ws;
-
-    radeon_ws = calloc(1, sizeof(struct radeon_pipe_winsys));
-    if (radeon_ws == NULL) {
-        return NULL;
-    }
-    radeon_ws->radeon_screen = radeon_screen;
-
-    radeon_ws->winsys.flush_frontbuffer = radeon_flush_frontbuffer;
-
-    radeon_ws->winsys.buffer_create = radeon_buffer_create;
-    radeon_ws->winsys.buffer_destroy = radeon_buffer_del;
-    radeon_ws->winsys.user_buffer_create = radeon_buffer_user_create;
-    radeon_ws->winsys.buffer_map = radeon_buffer_map;
-    radeon_ws->winsys.buffer_unmap = radeon_buffer_unmap;
-
-    radeon_ws->winsys.fence_reference = radeon_fence_reference;
-    radeon_ws->winsys.fence_signalled = radeon_fence_signalled;
-    radeon_ws->winsys.fence_finish = radeon_fence_finish;
-
-    radeon_ws->winsys.get_name = radeon_get_name;
-
-    return &radeon_ws->winsys;
-}
-
-static struct pipe_buffer *radeon_buffer_from_handle(struct radeon_screen *radeon_screen,
-                                                  uint32_t handle)
-{
-    struct radeon_pipe_buffer *radeon_buffer;
-    struct radeon_bo *bo = NULL;
-
-    bo = radeon_bo_open(radeon_screen->bom, handle, 0, 0, 0, 0);
-    if (bo == NULL) {
-        return NULL;
-    }
-    radeon_buffer = calloc(1, sizeof(struct radeon_pipe_buffer));
-    if (radeon_buffer == NULL) {
-        radeon_bo_unref(bo);
-        return NULL;
-    }
-    radeon_buffer->base.refcount = 1;
-    radeon_buffer->base.usage = PIPE_BUFFER_USAGE_PIXEL;
-    radeon_buffer->bo = bo;
-    return &radeon_buffer->base;
-}
-
-struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_context,
-                                             uint32_t handle,
-                                             enum pipe_format format,
-                                             int w, int h, int pitch)
-{
-    struct pipe_screen *pipe_screen = radeon_context->pipe_screen;
-    struct pipe_winsys *pipe_winsys = radeon_context->pipe_winsys;
-    struct pipe_texture tmpl;
-    struct pipe_surface *ps;
-    struct pipe_texture *pt;
-    struct pipe_buffer *pb;
-
-    pb = radeon_buffer_from_handle(radeon_context->radeon_screen, handle);
-    if (pb == NULL) {
-        return NULL;
-    }
-    memset(&tmpl, 0, sizeof(tmpl));
-    tmpl.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
-    tmpl.target = PIPE_TEXTURE_2D;
-    tmpl.width[0] = w;
-    tmpl.height[0] = h;
-    tmpl.depth[0] = 1;
-    tmpl.format = format;
-    pf_get_block(tmpl.format, &tmpl.block);
-    tmpl.nblocksx[0] = pf_get_nblocksx(&tmpl.block, w);
-    tmpl.nblocksy[0] = pf_get_nblocksy(&tmpl.block, h);
-
-    pt = pipe_screen->texture_blanket(pipe_screen, &tmpl, &pitch, pb);
-    if (pt == NULL) {
-        pipe_buffer_reference(pipe_screen, &pb, NULL);
-    }
-    ps = pipe_screen->get_tex_surface(pipe_screen, pt, 0, 0, 0,
-                                      PIPE_BUFFER_USAGE_GPU_WRITE);
-    return ps;
-}
diff --git a/src/gallium/winsys/drm/radeon/radeon_buffer.h b/src/gallium/winsys/drm/radeon/radeon_buffer.h
deleted file mode 100644 (file)
index c626c20..0000000
+++ /dev/null
@@ -1,54 +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 "pipe/internal/p_winsys_screen.h"
-#include "radeon_screen.h"
-#include "radeon_context.h"
-#include "radeon_bo.h"
-
-struct radeon_pipe_buffer {
-    struct pipe_buffer  base;
-    struct radeon_bo    *bo;
-};
-
-struct radeon_pipe_winsys {
-    struct pipe_winsys      winsys;
-    struct radeon_screen       *radeon_screen;
-};
-
-struct pipe_winsys *radeon_pipe_winsys(struct radeon_screen *radeon_screen);
-struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_context,
-                                             uint32_t handle,
-                                             enum pipe_format format,
-                                             int w, int h, int pitch);
-
-#endif
diff --git a/src/gallium/winsys/drm/radeon/radeon_context.c b/src/gallium/winsys/drm/radeon/radeon_context.c
deleted file mode 100644 (file)
index a9d1577..0000000
+++ /dev/null
@@ -1,306 +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>
- */
-#include <stdio.h>
-#include "dri_util.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
-#include "radeon_screen.h"
-#include "radeon_context.h"
-#include "radeon_buffer.h"
-#include "radeon_winsys_softpipe.h"
-
-#define need_GL_ARB_fragment_program
-#define need_GL_ARB_multisample
-#define need_GL_ARB_point_parameters
-#define need_GL_ARB_shader_objects
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
-#define need_GL_ARB_vertex_program
-#define need_GL_ARB_vertex_shader
-#define need_GL_EXT_blend_color
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_cull_vertex
-#define need_GL_EXT_compiled_vertex_array
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_framebuffer_object
-#define need_GL_EXT_multi_draw_arrays
-#define need_GL_EXT_secondary_color
-#define need_GL_VERSION_2_0
-#define need_GL_VERSION_2_1
-#include "extension_helper.h"
-
-/**
- * Extension strings exported by the radeon driver.
- */
-const struct dri_extension radeon_card_extensions[] = {
-   {"GL_ARB_multitexture", NULL},
-   {"GL_ARB_texture_border_clamp", NULL},
-   {"GL_ARB_texture_rectangle", NULL},
-   {"GL_ARB_pixel_buffer_object", NULL},
-   {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
-   {"GL_ARB_shader_objects", GL_ARB_shader_objects_functions},
-   {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions},
-   {"GL_ARB_shading_language_120", GL_VERSION_2_1_functions},
-   {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
-   {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
-   {"GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions},
-   {"GL_EXT_blend_color", GL_EXT_blend_color_functions},
-   {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
-   {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
-   {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
-   {"GL_EXT_blend_subtract", NULL},
-   {"GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions},
-   {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions},
-   {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions},
-   {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
-   {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
-   {"GL_EXT_packed_depth_stencil", NULL},
-   {"GL_EXT_pixel_buffer_object", NULL},
-   {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
-   {"GL_EXT_stencil_wrap", NULL},
-   {NULL, NULL}
-};
-
-static void radeon_update_renderbuffers(__DRIcontext *dri_context,
-                                     __DRIdrawable *dri_drawable)
-{
-    struct radeon_framebuffer *radeon_fb;
-    struct radeon_context *radeon_context;
-    unsigned attachments[10];
-    __DRIbuffer *buffers;
-    __DRIscreen *screen;
-    int i, count;
-
-    radeon_context = dri_context->driverPrivate;
-    screen = dri_drawable->driScreenPriv;
-    radeon_fb = dri_drawable->driverPrivate;
-    for (count = 0, i = 0; count < 6; count++) {
-        if (radeon_fb->attachments & (1 << count)) {
-            attachments[i++] = count;
-        }
-    }
-
-    buffers = (*screen->dri2.loader->getBuffers)(dri_drawable,
-                                                 &dri_drawable->w,
-                                                 &dri_drawable->h,
-                                                 attachments,
-                                                 i,
-                                                 &count,
-                                                 dri_drawable->loaderPrivate);
-    if (buffers == NULL) {
-        return;
-    }
-
-    /* set one cliprect to cover the whole dri_drawable */
-    dri_drawable->x = 0;
-    dri_drawable->y = 0;
-    dri_drawable->backX = 0;
-    dri_drawable->backY = 0;
-    dri_drawable->numClipRects = 1;
-    dri_drawable->pClipRects[0].x1 = 0;
-    dri_drawable->pClipRects[0].y1 = 0;
-    dri_drawable->pClipRects[0].x2 = dri_drawable->w;
-    dri_drawable->pClipRects[0].y2 = dri_drawable->h;
-    dri_drawable->numBackClipRects = 1;
-    dri_drawable->pBackClipRects[0].x1 = 0;
-    dri_drawable->pBackClipRects[0].y1 = 0;
-    dri_drawable->pBackClipRects[0].x2 = dri_drawable->w;
-    dri_drawable->pBackClipRects[0].y2 = dri_drawable->h;
-
-    for (i = 0; i < count; i++) {
-        struct pipe_surface *ps;
-        enum pipe_format format = 0;
-        int index = 0;
-
-        switch (buffers[i].attachment) {
-        case __DRI_BUFFER_FRONT_LEFT:
-            index = ST_SURFACE_FRONT_LEFT;
-            switch (buffers[i].cpp) {
-            case 4:
-                format = PIPE_FORMAT_A8R8G8B8_UNORM;
-                break;
-            case 2:
-                format = PIPE_FORMAT_R5G6B5_UNORM;
-                break;
-            default:
-                /* FIXME: error */
-                return;
-            }
-            break;
-        case __DRI_BUFFER_BACK_LEFT:
-            index = ST_SURFACE_BACK_LEFT;
-            switch (buffers[i].cpp) {
-            case 4:
-                format = PIPE_FORMAT_A8R8G8B8_UNORM;
-                break;
-            case 2:
-                format = PIPE_FORMAT_R5G6B5_UNORM;
-                break;
-            default:
-                /* FIXME: error */
-                return;
-            }
-            break;
-        case __DRI_BUFFER_STENCIL:
-        case __DRI_BUFFER_DEPTH:
-            index = ST_SURFACE_DEPTH;
-            switch (buffers[i].cpp) {
-            case 4:
-                format = PIPE_FORMAT_Z24S8_UNORM;
-                break;
-            case 2:
-                format = PIPE_FORMAT_Z16_UNORM;
-                break;
-            default:
-                /* FIXME: error */
-                return;
-            }
-            break;
-        case __DRI_BUFFER_ACCUM:
-        default:
-            fprintf(stderr,
-                    "unhandled buffer attach event, attacment type %d\n",
-                    buffers[i].attachment);
-            return;
-        }
-
-        ps = radeon_surface_from_handle(radeon_context,
-                                     buffers[i].name,
-                                     format,
-                                     dri_drawable->w,
-                                     dri_drawable->h,
-                                     buffers[i].pitch);
-        assert(ps);
-        st_set_framebuffer_surface(radeon_fb->st_framebuffer, index, ps);
-    }
-    st_resize_framebuffer(radeon_fb->st_framebuffer,
-                          dri_drawable->w,
-                          dri_drawable->h);
-}
-
-GLboolean radeon_context_create(const __GLcontextModes *visual,
-                             __DRIcontextPrivate *dri_context,
-                             void *shared_context)
-{
-    __DRIscreenPrivate *dri_screen;
-    struct radeon_context *radeon_context;
-    struct radeon_screen *radeon_screen;
-    struct pipe_context *pipe;
-    struct st_context *shared_st_context = NULL;
-
-    dri_context->driverPrivate = NULL;
-    radeon_context = calloc(1, sizeof(struct radeon_context));
-    if (radeon_context == NULL) {
-        return GL_FALSE;
-    }
-
-    if (shared_context) {
-        shared_st_context = ((struct radeon_context*)shared_context)->st_context;
-    }
-
-    dri_screen = dri_context->driScreenPriv;
-    radeon_screen = dri_screen->private;
-    radeon_context->dri_screen = dri_screen;
-    radeon_context->radeon_screen = radeon_screen;
-    radeon_context->drm_fd = dri_screen->fd;
-
-    radeon_context->pipe_winsys = radeon_pipe_winsys(radeon_screen);
-    if (radeon_context->pipe_winsys == NULL) {
-        free(radeon_context);
-        return GL_FALSE;
-    }
-
-    if (!getenv("RADEON_SOFTPIPE")) {
-        fprintf(stderr, "Creating r300 context...\n");
-        pipe =
-            r300_create_context(NULL,
-                                radeon_context->pipe_winsys,
-                                radeon_create_r300_winsys(radeon_context->drm_fd));
-        radeon_context->pipe_screen = pipe->screen;
-    } else {
-        pipe = radeon_create_softpipe(radeon_context);
-    }
-    radeon_context->st_context = st_create_context(pipe, visual,
-                                                shared_st_context);
-    driInitExtensions(radeon_context->st_context->ctx,
-                      radeon_card_extensions, GL_TRUE);
-    dri_context->driverPrivate = radeon_context;
-    return GL_TRUE;
-}
-
-void radeon_context_destroy(__DRIcontextPrivate *dri_context)
-{
-    struct radeon_context *radeon_context;
-
-    radeon_context = dri_context->driverPrivate;
-    st_finish(radeon_context->st_context);
-    st_destroy_context(radeon_context->st_context);
-    free(radeon_context);
-}
-
-GLboolean radeon_context_bind(__DRIcontextPrivate *dri_context,
-                           __DRIdrawablePrivate *dri_drawable,
-                           __DRIdrawablePrivate *dri_readable)
-{
-    struct radeon_framebuffer *drawable;
-    struct radeon_framebuffer *readable;
-    struct radeon_context *radeon_context;
-
-    if (dri_context == NULL) {
-        st_make_current(NULL, NULL, NULL);
-        return GL_TRUE;
-    }
-
-    radeon_context = dri_context->driverPrivate;
-    drawable = dri_drawable->driverPrivate;
-    readable = dri_readable->driverPrivate;
-    st_make_current(radeon_context->st_context,
-                    drawable->st_framebuffer,
-                    readable->st_framebuffer);
-
-    radeon_update_renderbuffers(dri_context, dri_drawable);
-    if (dri_drawable != dri_readable) {
-        radeon_update_renderbuffers(dri_context, dri_readable);
-    }
-    return GL_TRUE;
-}
-
-GLboolean radeon_context_unbind(__DRIcontextPrivate *dri_context)
-{
-    struct radeon_context *radeon_context;
-
-    radeon_context = dri_context->driverPrivate;
-    st_flush(radeon_context->st_context, PIPE_FLUSH_RENDER_CACHE, NULL);
-    return GL_TRUE;
-}
diff --git a/src/gallium/winsys/drm/radeon/radeon_context.h b/src/gallium/winsys/drm/radeon/radeon_context.h
deleted file mode 100644 (file)
index d7222b4..0000000
+++ /dev/null
@@ -1,70 +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_CONTEXT_H
-#define RADEON_CONTEXT_H
-
-#include "dri_util.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
-#include "radeon_screen.h"
-
-#include "radeon_r300.h"
-
-struct radeon_framebuffer {
-    struct st_framebuffer   *st_framebuffer;
-    unsigned                attachments;
-};
-
-struct radeon_context {
-    /* st */
-    struct st_context       *st_context;
-    /* pipe */
-    struct pipe_screen      *pipe_screen;
-    struct pipe_winsys      *pipe_winsys;
-    /* DRI */
-    __DRIscreenPrivate      *dri_screen;
-    __DRIdrawablePrivate    *dri_drawable;
-    __DRIdrawablePrivate    *dri_readable;
-    /* DRM */
-    int                     drm_fd;
-   /* RADEON */
-    struct radeon_screen       *radeon_screen;
-};
-
-GLboolean radeon_context_create(const __GLcontextModes*,
-                             __DRIcontextPrivate*,
-                             void*);
-void radeon_context_destroy(__DRIcontextPrivate*);
-GLboolean radeon_context_bind(__DRIcontextPrivate*,
-                           __DRIdrawablePrivate*,
-                           __DRIdrawablePrivate*);
-GLboolean radeon_context_unbind(__DRIcontextPrivate*);
-
-#endif
diff --git a/src/gallium/winsys/drm/radeon/radeon_r300.c b/src/gallium/winsys/drm/radeon/radeon_r300.c
deleted file mode 100644 (file)
index 8fe2375..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#include "radeon_r300.h"
-
-static boolean radeon_r300_check_cs(struct radeon_cs* cs, int size)
-{
-    /* XXX check size here, lazy ass! */
-    return TRUE;
-}
-
-static void radeon_r300_write_cs_reloc(struct radeon_cs* cs,
-                                    struct pipe_buffer* pbuffer,
-                                    uint32_t rd,
-                                    uint32_t wd,
-                                    uint32_t flags)
-{
-    radeon_cs_write_reloc(cs, ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags);
-}
-
-static void radeon_r300_flush_cs(struct radeon_cs* cs)
-{
-    radeon_cs_emit(cs);
-    radeon_cs_erase(cs);
-}
-
-/* Helper function to do the ioctls needed for setup and init. */
-static void do_ioctls(struct r300_winsys* winsys, int fd)
-{
-    drm_radeon_getparam_t gp;
-    uint32_t target;
-    int retval;
-
-    /* XXX is this cast safe? */
-    gp.value = (int*)&target;
-
-    /* First, get PCI ID */
-    gp.param = RADEON_PARAM_DEVICE_ID;
-    retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp));
-    if (retval) {
-        fprintf(stderr, "%s: Failed to get PCI ID, error number %d",
-                __FUNCTION__, retval);
-        exit(1);
-    }
-    winsys->pci_id = target;
-
-    /* Then, get the number of pixel pipes */
-    gp.param = RADEON_PARAM_NUM_GB_PIPES;
-    retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp));
-    if (retval) {
-        fprintf(stderr, "%s: Failed to get GB pipe count, error number %d",
-                __FUNCTION__, retval);
-        exit(1);
-    }
-    winsys->gb_pipes = target;
-
-}
-
-struct r300_winsys* radeon_create_r300_winsys(int fd)
-{
-    struct r300_winsys* winsys = calloc(1, sizeof(struct r300_winsys));
-
-    do_ioctls(winsys, fd);
-
-    struct radeon_cs_manager* csm = radeon_cs_manager_gem_ctor(fd);
-
-    winsys->cs = radeon_cs_create(csm, 1024 * 64 / 4);
-
-    winsys->check_cs = radeon_r300_check_cs;
-    winsys->begin_cs = radeon_cs_begin;
-    winsys->write_cs_dword = radeon_cs_write_dword;
-    winsys->write_cs_reloc = radeon_r300_write_cs_reloc;
-    winsys->end_cs = radeon_cs_end;
-    winsys->flush_cs = radeon_r300_flush_cs;
-
-    return winsys;
-}
diff --git a/src/gallium/winsys/drm/radeon/radeon_r300.h b/src/gallium/winsys/drm/radeon/radeon_r300.h
deleted file mode 100644 (file)
index 8ed95a3..0000000
+++ /dev/null
@@ -1,34 +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. */
-
-/* XXX WTF is this! I shouldn't have to include those first three! FUCK! */
-#include <stdint.h>
-#include <stdlib.h>
-#include "drm.h"
-#include "radeon_drm.h"
-#include "radeon_cs.h"
-
-#include "r300_winsys.h"
-
-#include "radeon_buffer.h"
-
-struct r300_winsys* radeon_create_r300_winsys(int fd);
diff --git a/src/gallium/winsys/drm/radeon/radeon_screen.c b/src/gallium/winsys/drm/radeon/radeon_screen.c
deleted file mode 100644 (file)
index e31caff..0000000
+++ /dev/null
@@ -1,288 +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>
- */
-#include <stdio.h>
-#include "pipe/p_screen.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
-#include "pipe/p_context.h"
-#include "pipe/p_state.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
-#include "utils.h"
-#include "xf86drm.h"
-#include "drm.h"
-#include "dri_util.h"
-#include "radeon_screen.h"
-#include "radeon_context.h"
-#include "radeon_buffer.h"
-#include "radeon_bo.h"
-#include "radeon_bo_gem.h"
-#include "radeon_drm.h"
-
-extern const struct dri_extension radeon_card_extensions[];
-
-static const __DRIextension *radeon_screen_extensions[] = {
-    &driReadDrawableExtension,
-    &driCopySubBufferExtension.base,
-    &driSwapControlExtension.base,
-    &driFrameTrackingExtension.base,
-    &driMediaStreamCounterExtension.base,
-    NULL
-};
-
-static __DRIconfig **radeon_fill_in_modes(unsigned pixel_bits,
-                                       unsigned depth_bits,
-                                       GLboolean have_back_buffer)
-{
-    __DRIconfig **configs;
-    unsigned depth_buffer_factor;
-    unsigned back_buffer_factor;
-    unsigned num_modes;
-    GLenum fb_format;
-    GLenum fb_type;
-    uint8_t depth_bits_array[3];
-    uint8_t stencil_bits_array[3];
-    uint8_t msaa_samples_array[1];
-    /* TODO: pageflipping ? */
-    static const GLenum back_buffer_modes[] = {
-        GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
-    };
-
-    stencil_bits_array[0] = 0;
-    stencil_bits_array[1] = 0;
-    if (depth_bits == 24) {
-        stencil_bits_array[2] = 8;
-        num_modes = 3;
-    }
-
-    depth_bits_array[0] = 0;
-    depth_bits_array[1] = depth_bits;
-    depth_bits_array[2] = depth_bits;
-    depth_buffer_factor = (depth_bits == 24) ? 3 : 2;
-
-    back_buffer_factor = (have_back_buffer) ? 3 : 1;
-
-    msaa_samples_array[0] = 0;
-
-    if (pixel_bits == 16) {
-        fb_format = GL_RGB;
-        fb_type = GL_UNSIGNED_SHORT_5_6_5;
-    } else {
-        fb_format = GL_BGRA;
-        fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
-    }
-
-    configs = (__DRIconfig **)driCreateConfigs(fb_format,
-                                               fb_type,
-                                               depth_bits_array,
-                                               stencil_bits_array,
-                                               depth_buffer_factor,
-                                               back_buffer_modes,
-                                               back_buffer_factor,
-                                               msaa_samples_array,
-                                               1);
-    if (configs == NULL) {
-        fprintf(stderr, "[%s:%u] Error creating FBConfig!\n",
-                __FILE__, __LINE__);
-        return NULL;
-    }
-    return configs;
-}
-
-static void radeon_screen_destroy(__DRIscreenPrivate *dri_screen)
-{
-     struct radeon_screen *radeon_screen = (struct radeon_screen*)dri_screen->private;
-
-     radeon_bo_manager_gem_dtor(radeon_screen->bom); 
-     dri_screen = NULL;
-     free(radeon_screen);
-}
-
-static const __DRIconfig **radeon_screen_init(__DRIscreenPrivate *dri_screen)
-{
-    struct radeon_screen *radeon_screen;
-
-    /* Calling driInitExtensions here, with a NULL context pointer,
-     * does not actually enable the extensions.  It just makes sure
-     * that all the dispatch offsets for all the extensions that
-     * *might* be enables are known.  This is needed because the
-     * dispatch offsets need to be known when _mesa_context_create is
-     * called, but we can't enable the extensions until we have a
-     * context pointer.
-     *
-     * Hello chicken.  Hello egg.  How are you two today?
-     */
-    driInitExtensions(NULL, radeon_card_extensions, GL_FALSE);
-
-    radeon_screen = calloc(1, sizeof(struct radeon_screen));
-    if (radeon_screen == NULL) {
-        fprintf(stderr, "\nERROR!  Allocating private area failed\n");
-        return NULL;
-    }
-    dri_screen->private = (void*)radeon_screen;
-    dri_screen->extensions = radeon_screen_extensions;
-    radeon_screen->dri_screen = dri_screen;
-
-    radeon_screen->bom = radeon_bo_manager_gem_ctor(dri_screen->fd);
-    if (radeon_screen->bom == NULL) {
-        radeon_screen_destroy(dri_screen);
-        return NULL;
-    }
-
-    return driConcatConfigs(radeon_fill_in_modes(16, 16, 1),
-                            radeon_fill_in_modes(32, 24, 1));
-}
-
-static boolean radeon_buffer_create(__DRIscreenPrivate *dri_screen,
-                                 __DRIdrawablePrivate *dri_drawable,
-                                 const __GLcontextModes *visual,
-                                 boolean is_pixmap)
-{
-    if (is_pixmap) {
-        /* TODO: implement ? */
-        return GL_FALSE;
-    } else {
-        enum pipe_format color_format, depth_format, stencil_format;
-        struct radeon_framebuffer *radeon_fb;
-
-        radeon_fb = calloc(1, sizeof(struct radeon_framebuffer));
-        if (radeon_fb == NULL) {
-            return GL_FALSE;
-        }
-
-        switch (visual->redBits) {
-        case 5:
-            color_format = PIPE_FORMAT_R5G6B5_UNORM;
-            break;
-        default:
-            color_format = PIPE_FORMAT_A8R8G8B8_UNORM;
-            break;
-        }
-
-        switch (visual->depthBits) {
-        case 24:
-            depth_format = PIPE_FORMAT_S8Z24_UNORM;
-            break;
-        case 16:
-            depth_format = PIPE_FORMAT_Z16_UNORM;
-            break;
-        default:
-            depth_format = PIPE_FORMAT_NONE;
-            break;
-        }
-
-        switch (visual->stencilBits) {
-        case 8:
-            /* force depth format */
-            depth_format = PIPE_FORMAT_S8Z24_UNORM;
-            stencil_format = PIPE_FORMAT_S8Z24_UNORM;
-            break;
-        default:
-            stencil_format = PIPE_FORMAT_NONE;
-            break;
-        }
-
-        radeon_fb->st_framebuffer = st_create_framebuffer(visual,
-                                                       color_format,
-                                                       depth_format,
-                                                       stencil_format,
-                                                       dri_drawable->w,
-                                                       dri_drawable->h,
-                                                       (void*)radeon_fb);
-        if (radeon_fb->st_framebuffer == NULL) {
-            free(radeon_fb);
-            return GL_FALSE;
-        }
-        dri_drawable->driverPrivate = (void *) radeon_fb;
-
-        radeon_fb->attachments = (1 << __DRI_BUFFER_FRONT_LEFT);
-        if (visual->doubleBufferMode) {
-            radeon_fb->attachments |= (1 << __DRI_BUFFER_BACK_LEFT);
-        }
-        if (visual->depthBits || visual->stencilBits) {
-            radeon_fb->attachments |= (1 << __DRI_BUFFER_DEPTH);
-        }
-
-        return GL_TRUE;
-    }
-}
-
-static void radeon_buffer_destroy(__DRIdrawablePrivate * dri_drawable)
-{
-   struct radeon_framebuffer *radeon_fb;
-   
-   radeon_fb = dri_drawable->driverPrivate;
-   assert(radeon_fb->st_framebuffer);
-   st_unreference_framebuffer(radeon_fb->st_framebuffer);
-   free(radeon_fb);
-}
-
-static void radeon_swap_buffers(__DRIdrawablePrivate *dri_drawable)
-{
-    struct radeon_framebuffer *radeon_fb;
-    struct pipe_surface *back_surf = NULL;
-
-    radeon_fb = dri_drawable->driverPrivate;
-    assert(radeon_fb);
-    assert(radeon_fb->st_framebuffer);
-
-    st_get_framebuffer_surface(radeon_fb->st_framebuffer,
-                               ST_SURFACE_BACK_LEFT,
-                               &back_surf);
-    if (back_surf) {
-        st_notify_swapbuffers(radeon_fb->st_framebuffer);
-        /* TODO: do we want to do anythings ? */
-        st_notify_swapbuffers_complete(radeon_fb->st_framebuffer);
-    }
-}
-
-/**
- * Called via glXCopySubBufferMESA() to copy a subrect of the back
- * buffer to the front buffer/screen.
- */
-static void radeon_copy_sub_buffer(__DRIdrawablePrivate *dri_drawable,
-                         int x, int y, int w, int h)
-{
-    /* TODO: ... */
-}
-
-const struct __DriverAPIRec driDriverAPI = {
-    .InitScreen           = NULL,
-    .DestroyScreen        = radeon_screen_destroy,
-    .CreateContext        = radeon_context_create,
-    .DestroyContext       = radeon_context_destroy,
-    .CreateBuffer         = radeon_buffer_create,
-    .DestroyBuffer        = radeon_buffer_destroy,
-    .SwapBuffers          = radeon_swap_buffers,
-    .MakeCurrent          = radeon_context_bind,
-    .UnbindContext        = radeon_context_unbind,
-    .CopySubBuffer        = radeon_copy_sub_buffer,
-    .InitScreen2          = radeon_screen_init,
-};
diff --git a/src/gallium/winsys/drm/radeon/radeon_screen.h b/src/gallium/winsys/drm/radeon/radeon_screen.h
deleted file mode 100644 (file)
index 01b7fa6..0000000
+++ /dev/null
@@ -1,41 +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_SCREEN_H
-#define RADEON_SCREEN_H
-
-#include "dri_util.h"
-#include "radeon_bo.h"
-
-struct radeon_screen {
-    __DRIscreenPrivate          *dri_screen;
-    struct radeon_bo_manager    *bom;
-};
-
-#endif
diff --git a/src/gallium/winsys/drm/radeon/radeon_winsys_softpipe.c b/src/gallium/winsys/drm/radeon/radeon_winsys_softpipe.c
deleted file mode 100644 (file)
index 8402e1f..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * 
- **************************************************************************/
-/*
- * Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
- */
-#include <stdio.h>
-#include "imports.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_format.h"
-#include "softpipe/sp_winsys.h"
-#include "radeon_context.h"
-#include "radeon_winsys_softpipe.h"
-
-struct radeon_softpipe_winsys {
-    struct softpipe_winsys  sp_winsys;
-    struct radeon_context      *radeon_context;
-};
-
-/**
- * Return list of surface formats supported by this driver.
- */
-static boolean radeon_is_format_supported(struct softpipe_winsys *sws, uint format)
-{
-    switch (format) {
-    case PIPE_FORMAT_A8R8G8B8_UNORM:
-    case PIPE_FORMAT_R5G6B5_UNORM:
-    case PIPE_FORMAT_Z24S8_UNORM:
-        return TRUE;
-    default:
-        break;
-    };
-    return FALSE;
-}
-
-struct pipe_context *radeon_create_softpipe(struct radeon_context *radeon_context)
-{
-    struct radeon_softpipe_winsys *radeon_sp_ws;
-    struct pipe_screen *pipe_screen;
-
-    pipe_screen = softpipe_create_screen(radeon_context->pipe_winsys);
-
-    radeon_sp_ws = CALLOC_STRUCT(radeon_softpipe_winsys);
-    if (radeon_sp_ws == NULL) {
-        return NULL;
-    }
-    radeon_context->pipe_screen = pipe_screen;
-    radeon_sp_ws->radeon_context = radeon_context;
-    radeon_sp_ws->sp_winsys.is_format_supported = radeon_is_format_supported;
-    return softpipe_create(pipe_screen,
-                           radeon_context->pipe_winsys,
-                           &radeon_sp_ws->sp_winsys);
-}
diff --git a/src/gallium/winsys/drm/radeon/radeon_winsys_softpipe.h b/src/gallium/winsys/drm/radeon/radeon_winsys_softpipe.h
deleted file mode 100644 (file)
index 519eab7..0000000
+++ /dev/null
@@ -1,37 +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_WINSYS_SOFTPIPE_H
-#define RADEON_WINSYS_SOFTPIPE_H
-
-#include "radeon_context.h"
-
-struct pipe_context *radeon_create_softpipe(struct radeon_context *radeon_context);
-
-#endif
diff --git a/src/gallium/winsys/drm/radeon/xorg/Makefile b/src/gallium/winsys/drm/radeon/xorg/Makefile
new file mode 100644 (file)
index 0000000..6ffd4a3
--- /dev/null
@@ -0,0 +1,42 @@
+TARGET     = modesetting_drv.so
+CFILES     = $(wildcard ./*.c)
+OBJECTS    = $(patsubst ./%.c,./%.o,$(CFILES))
+GALLIUMDIR = ../../../..
+TOP        = ../../../../../..
+
+include ${TOP}/configs/current
+
+CFLAGS = -DHAVE_CONFIG_H \
+         -g -Wall -Wimplicit-function-declaration -fPIC \
+         $(shell pkg-config --cflags pixman-1 xorg-server libdrm xproto) \
+         -I${GALLIUMDIR}/include \
+         -I${GALLIUMDIR}/drivers \
+         -I${GALLIUMDIR}/auxiliary \
+         -I${TOP}/src/mesa \
+         -I$(TOP)/include \
+         -I$(TOP)/src/egl/main
+
+LIBS = \
+       $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a \
+       $(GALLIUMDIR)/winsys/drm/radeon/core/libradeonwinsys.a \
+       $(TOP)/src/gallium/drivers/r300/libr300.a \
+       $(GALLIUM_AUXILIARIES)
+
+#############################################
+
+
+
+all default: $(TARGET)
+
+$(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a
+       $(TOP)/bin/mklib -noprefix -o $@ \
+       $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_radeon
+
+clean:
+       rm -rf $(OBJECTS) $(TARGET)
+
+install:
+       $(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
+       $(INSTALL) -m 755 $(TARGET) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
+
+.PHONY = all clean install
diff --git a/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c b/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c
new file mode 100644 (file)
index 0000000..6f77fbe
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ * Author: Alan Hourihane <alanh@tungstengraphics.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ * Author: Corbin Simpson <MostAwesomedude@gmail.com>
+ *
+ */
+
+#include "../../../../state_trackers/xorg/xorg_winsys.h"
+
+static void radeon_xorg_identify(int flags);
+static Bool radeon_xorg_pci_probe(DriverPtr driver,
+                                int entity_num,
+                                struct pci_device *device,
+                                intptr_t match_data);
+
+static const struct pci_id_match radeon_xorg_device_match[] = {
+    {0x1002, 0x5E4D, 0xffff, 0xffff, 0, 0, 0},
+    {0x1002, 0x7249, 0xffff, 0xffff, 0, 0, 0},
+    {0, 0, 0},
+};
+
+static SymTabRec radeon_xorg_chipsets[] = {
+    {0x5E4D, "Radeon RV410 PCIE (X700)"},
+    {0x7249, "Radeon R580 PCIE (X1900 XT)"},
+    {-1, NULL}
+};
+
+static PciChipsets radeon_xorg_pci_devices[] = {
+    {0x5E4D, 0x5E4D, RES_SHARED_VGA},
+    {0x7249, 0x7249, RES_SHARED_VGA},
+    {-1, -1, RES_UNDEFINED}
+};
+
+static XF86ModuleVersionInfo radeon_xorg_version = {
+    "modesetting",
+    MODULEVENDORSTRING,
+    MODINFOSTRING1,
+    MODINFOSTRING2,
+    XORG_VERSION_CURRENT,
+    0, 1, 0, /* major, minor, patch */
+    ABI_CLASS_VIDEODRV,
+    ABI_VIDEODRV_VERSION,
+    MOD_CLASS_VIDEODRV,
+    {0, 0, 0, 0}
+};
+
+/*
+ * Xorg driver exported structures
+ */
+
+_X_EXPORT DriverRec modesetting = {
+    1,
+    "modesetting",
+    radeon_xorg_identify,
+    NULL,
+    xorg_tracker_available_options,
+    NULL,
+    0,
+    NULL,
+    radeon_xorg_device_match,
+    radeon_xorg_pci_probe
+};
+
+static MODULESETUPPROTO(radeon_xorg_setup);
+
+_X_EXPORT XF86ModuleData modesettingModuleData = {
+    &radeon_xorg_version,
+    radeon_xorg_setup,
+    NULL
+};
+
+/*
+ * Xorg driver functions
+ */
+
+static pointer
+radeon_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+    static Bool setupDone = 0;
+
+    /* This module should be loaded only once, but check to be sure.
+     */
+    if (!setupDone) {
+       setupDone = 1;
+       xf86AddDriver(&modesetting, module, HaveDriverFuncs);
+
+       /*
+        * Tell the loader about symbols from other modules that this module
+        * might refer to.
+        */
+       xorg_tracker_loader_ref_sym_lists();
+
+       /*
+        * The return value must be non-NULL on success even though there
+        * is no TearDownProc.
+        */
+       return (pointer) 1;
+    } else {
+       if (errmaj)
+           *errmaj = LDR_ONCEONLY;
+       return NULL;
+    }
+}
+
+static void
+radeon_xorg_identify(int flags)
+{
+    xf86PrintChipsets("modesetting", "Driver for Modesetting Kernel Drivers",
+                     radeon_xorg_chipsets);
+}
+
+static Bool
+radeon_xorg_pci_probe(DriverPtr driver,
+         int entity_num, struct pci_device *device, intptr_t match_data)
+{
+    ScrnInfoPtr scrn = NULL;
+    EntityInfoPtr entity;
+
+    scrn = xf86ConfigPciEntity(scrn, 0, entity_num, radeon_xorg_pci_devices,
+                              NULL, NULL, NULL, NULL, NULL);
+    if (scrn != NULL) {
+       scrn->driverVersion = 1;
+       scrn->driverName = "modesetting";
+       scrn->name = "modesetting";
+       scrn->Probe = NULL;
+
+       entity = xf86GetEntityInfo(entity_num);
+
+       /* Use all the functions from the xorg tracker */
+       xorg_tracker_set_functions(scrn);
+    }
+    return scrn != NULL;
+}
index c6b0e3d8c5fa691c137680806a539e28f8f53ee7..9ceb67d2ac7d5b5fdc61646df1b8715aa99f18df 100644 (file)
@@ -277,6 +277,7 @@ display_surface(struct pipe_winsys *pws,
                 struct pipe_surface *psurf,
                 struct xlib_egl_surface *xsurf)
 {
+   struct softpipe_texture *spt = softpipe_texture(psurf->texture);
    XImage *ximage;
    void *data;
 
@@ -293,13 +294,13 @@ display_surface(struct pipe_winsys *pws,
    assert(ximage->format);
    assert(ximage->bitmap_unit);
 
-   data = pws->buffer_map(pws, softpipe_texture(psurf->texture)->buffer, 0);
+   data = pws->buffer_map(pws, spt->buffer, 0);
 
    /* update XImage's fields */
    ximage->data = data;
    ximage->width = psurf->width;
    ximage->height = psurf->height;
-   ximage->bytes_per_line = psurf->stride;
+   ximage->bytes_per_line = spt->stride[psurf->level];
    
    XPutImage(xsurf->Dpy, xsurf->Win, xsurf->Gc,
              ximage, 0, 0, 0, 0, psurf->width, psurf->height);
@@ -309,7 +310,7 @@ display_surface(struct pipe_winsys *pws,
    ximage->data = NULL;
    XDestroyImage(ximage);
 
-   pws->buffer_unmap(pws, softpipe_texture(psurf->texture)->buffer);
+   pws->buffer_unmap(pws, spt->buffer);
 }
 
 
index 739bfa1c1a67b05a8c4c313aadb7252e728eb3f4..aa1bfa8e883a3f1bfd27ba0490f27c32ed98bef2 100644 (file)
@@ -99,7 +99,7 @@ buffer_create(struct pipe_winsys *pws,
    if (!buffer)
       return NULL;
 
-   buffer->Base.refcount = 1;
+   pipe_reference_init(&buffer->Base.reference, 1);
    buffer->Base.alignment = alignment;
    buffer->Base.usage = usage;
    buffer->Base.size = size;
@@ -121,7 +121,7 @@ user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
    if (!buffer)
       return NULL;
 
-   buffer->Base.refcount = 1;
+   pipe_reference_init(&buffer->Base.reference, 1);
    buffer->Base.size = bytes;
    buffer->UserBuffer = TRUE;
    buffer->Data = ptr;
@@ -148,7 +148,7 @@ buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf)
 
 
 static void
-buffer_destroy(struct pipe_winsys *pws, struct pipe_buffer *buf)
+buffer_destroy(struct pipe_buffer *buf)
 {
    struct sw_pipe_buffer *buffer = sw_pipe_buffer(buf);
 
index 864be37871fbd67221fd79fc2edcbac699f159d0..77e46a2054bedf369a5016954e9f2fb9361b0ed3 100644 (file)
@@ -31,7 +31,7 @@ nouveau_copy_buffer(dri_drawable_t *dri_drawable, struct pipe_surface *surf,
                w  = pbox->x2 - pbox->x1;
                h  = pbox->y2 - pbox->y1;
 
-               pipe->surface_copy(pipe, FALSE, nv->base.frontbuffer,
+               pipe->surface_copy(pipe, nv->base.frontbuffer,
                                   dx, dy, surf, sx, sy, w, h);
        }
 
index 40d683234fc6e8c2fd8980d3bf369079b1855b45..5b9fdb5c1f8a784ee43d01afcf1dc90e9dac6d0d 100644 (file)
@@ -1,10 +1,12 @@
 #include "vl_winsys.h"
 #include <X11/Xutil.h>
-#include <pipe/p_winsys.h>
+#include <pipe/internal/p_winsys_screen.h>
 #include <pipe/p_state.h>
 #include <pipe/p_inlines.h>
 #include <util/u_memory.h>
+#include <util/u_math.h>
 #include <softpipe/sp_winsys.h>
+#include <softpipe/sp_texture.h>
 
 /* pipe_winsys implementation */
 
@@ -37,7 +39,7 @@ static struct pipe_buffer* xsp_buffer_create(struct pipe_winsys *pws, unsigned a
        assert(pws);
 
        buffer = calloc(1, sizeof(struct xsp_buffer));
-       buffer->base.refcount = 1;
+       pipe_reference_init(&buffer->base.reference, 1);
        buffer->base.alignment = alignment;
        buffer->base.usage = usage;
        buffer->base.size = size;
@@ -53,7 +55,7 @@ static struct pipe_buffer* xsp_user_buffer_create(struct pipe_winsys *pws, void
        assert(pws);
 
        buffer = calloc(1, sizeof(struct xsp_buffer));
-       buffer->base.refcount = 1;
+       pipe_reference_init(&buffer->base.reference, 1);
        buffer->base.size = size;
        buffer->is_user_buffer = TRUE;
        buffer->data = data;
@@ -96,12 +98,6 @@ static void xsp_buffer_destroy(struct pipe_winsys *pws, struct pipe_buffer *buff
        free(xsp_buf);
 }
 
-/* Borrowed from Mesa's xm_winsys */
-static unsigned int round_up(unsigned n, unsigned multiple)
-{
-   return (n + multiple - 1) & ~(multiple - 1);
-}
-
 static struct pipe_buffer* xsp_surface_buffer_create
 (
        struct pipe_winsys *pws,
@@ -119,11 +115,11 @@ static struct pipe_buffer* xsp_surface_buffer_create
        pf_get_block(format, &block);
        nblocksx = pf_get_nblocksx(&block, width);
        nblocksy = pf_get_nblocksy(&block, height);
-       *stride = round_up(nblocksx * block.size, ALIGNMENT);
+       *stride = align(nblocksx * block.size, ALIGNMENT);
 
-       return winsys->buffer_create(winsys, ALIGNMENT,
-                                    usage,
-                                    *stride * nblocksy);
+       return pws->buffer_create(pws, ALIGNMENT,
+                                 usage,
+                                 *stride * nblocksy);
 }
 
 static void xsp_fence_reference(struct pipe_winsys *pws, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence)
@@ -167,7 +163,7 @@ static void xsp_flush_frontbuffer(struct pipe_winsys *pws, struct pipe_surface *
        xsp_winsys->fbimage.width = surface->width;
        xsp_winsys->fbimage.height = surface->height;
        xsp_winsys->fbimage.bytes_per_line = surface->width * (xsp_winsys->fbimage.bits_per_pixel >> 3);
-       xsp_winsys->fbimage.data = pipe_surface_map(surface, 0);
+       xsp_winsys->fbimage.data = ((struct xsp_buffer *)softpipe_texture(surface->texture)->buffer)->data + surface->offset;
 
        XPutImage
        (
@@ -183,7 +179,6 @@ static void xsp_flush_frontbuffer(struct pipe_winsys *pws, struct pipe_surface *
                surface->height
        );
        XFlush(xsp_context->display);
-       pipe_surface_unmap(surface);
 }
 
 static const char* xsp_get_name(struct pipe_winsys *pws)
index f9c1a346689828e1ad4a45f07eaf69cee2fefb64..72b5df8ca2470cafd2c5ccf1749f3e78b65d09a3 100644 (file)
@@ -11,12 +11,6 @@ if env['platform'] == 'windows':
                '#src/gallium/state_trackers/wgl',
        ])
 
-       env.Append(CPPDEFINES = [
-               '__GL_EXPORTS',
-               'BUILD_GL32',
-               '_GNU_H_WINDOWS32_DEFINES',
-       ])
-
        env.Append(LIBS = [
                'gdi32',
                'user32',
@@ -24,9 +18,13 @@ if env['platform'] == 'windows':
        ])
 
        sources = [
-               '#src/gallium/state_trackers/wgl/opengl32.def',
                'gdi_softpipe_winsys.c',
        ]
+       
+       if env['toolchain'] == 'crossmingw':
+               sources += ['#src/gallium/state_trackers/wgl/opengl32.mingw.def']
+       else:
+               sources += ['#src/gallium/state_trackers/wgl/opengl32.def']
                
        drivers = [
                softpipe,
index 4924dbf26ac37e92e84426c185961a26cf8753bf..440666d835e736e6fdc96e1fcac734ff50a6aa4d 100644 (file)
@@ -87,8 +87,7 @@ gdi_softpipe_buffer_unmap(struct pipe_winsys *winsys,
 
 
 static void
-gdi_softpipe_buffer_destroy(struct pipe_winsys *winsys,
-                            struct pipe_buffer *buf)
+gdi_softpipe_buffer_destroy(struct pipe_buffer *buf)
 {
    struct gdi_softpipe_buffer *oldBuf = gdi_softpipe_buffer(buf);
 
@@ -118,7 +117,7 @@ gdi_softpipe_buffer_create(struct pipe_winsys *winsys,
 {
    struct gdi_softpipe_buffer *buffer = CALLOC_STRUCT(gdi_softpipe_buffer);
 
-   buffer->base.refcount = 1;
+   pipe_reference_init(&buffer->base.reference, 1);
    buffer->base.alignment = alignment;
    buffer->base.usage = usage;
    buffer->base.size = size;
@@ -143,7 +142,7 @@ gdi_softpipe_user_buffer_create(struct pipe_winsys *winsys,
    if(!buffer)
       return NULL;
 
-   buffer->base.refcount = 1;
+   pipe_reference_init(&buffer->base.reference, 1);
    buffer->base.size = bytes;
    buffer->userBuffer = TRUE;
    buffer->data = ptr;
@@ -273,14 +272,17 @@ gdi_softpipe_flush_frontbuffer(struct pipe_screen *screen,
                                struct pipe_surface *surface,
                                HDC hDC)
 {
+    struct softpipe_texture *texture;
     struct gdi_softpipe_buffer *buffer;
     BITMAPINFO bmi;
 
-    buffer = gdi_softpipe_buffer(softpipe_texture(surface->texture)->buffer);
+    texture = softpipe_texture(surface->texture);
+                                               
+    buffer = gdi_softpipe_buffer(texture->buffer);
 
     memset(&bmi, 0, sizeof(BITMAPINFO));
     bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-    bmi.bmiHeader.biWidth = surface->stride / pf_get_size(surface->format);
+    bmi.bmiHeader.biWidth = texture->stride[surface->level] / pf_get_size(surface->format);
     bmi.bmiHeader.biHeight= -(long)surface->height;
     bmi.bmiHeader.biPlanes = 1;
     bmi.bmiHeader.biBitCount = pf_get_bits(surface->format);
index 2956e1b960a13ba918bc5a60cc77bb79a336deef..b6bd849ef2125f244757033ab4cc125a15327ca4 100644 (file)
@@ -34,8 +34,9 @@
 #include "xlib_brw_aub.h"
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 #include "util/u_memory.h"
+#include "softpipe/sp_texture.h"
 
 
 struct brw_aubfile {
@@ -322,10 +323,10 @@ void brw_aub_dump_bmp( struct brw_aubfile *aubfile,
    struct aub_dump_bmp db;
    unsigned format;
 
-   assert(surface->block.width == 1);
-   assert(surface->block.height == 1);
+   assert(surface->texture->block.width == 1);
+   assert(surface->texture->block.height == 1);
    
-   if (surface->block.size == 4)
+   if (surface->texture->block.size == 4)
       format = 0x7;
    else
       format = 0x3;
@@ -334,8 +335,9 @@ void brw_aub_dump_bmp( struct brw_aubfile *aubfile,
    db.xmin = 0;
    db.ymin = 0;
    db.format = format;
-   db.bpp = surface->block.size * 8;
-   db.pitch = surface->stride/surface->block.size;
+   db.bpp = surface->texture->block.size * 8;
+   db.pitch = softpipe_texture(surface->texture)->stride[surface->level] /
+      surface->texture->block.size;
    db.xsize = surface->width;
    db.ysize = surface->height;
    db.addr = gtt_offset;
index 8e1bfab2f5607e6c2828a26af8fff622a9021b6d..fe8dfff767209d610ed4d478924337c86abd105a 100644 (file)
@@ -37,7 +37,6 @@
 //#include "state_trackers/xlib/xmesaP.h"
 
 #include "pipe/internal/p_winsys_screen.h"
-#include "pipe/p_inlines.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "i965simple/brw_winsys.h"
@@ -57,10 +56,10 @@ buffer_from_surface(struct pipe_surface *surface)
 }
 
 struct aub_buffer {
+   struct pipe_reference reference;
    char *data;
    unsigned offset;
    unsigned size;
-   unsigned refcount;
    unsigned map_count;
    boolean dump_on_unmap;
 };
@@ -144,8 +143,7 @@ static void aub_buffer_unmap(struct pipe_winsys *winsys,
 
 
 static void
-aub_buffer_destroy(struct pipe_winsys *winsys,
-                  struct pipe_buffer *buf)
+aub_buffer_destroy(struct pipe_buffer *buf)
 {
    free(buf);
 }
@@ -189,7 +187,7 @@ aub_buffer_create(struct pipe_winsys *winsys,
    struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys);
    struct aub_buffer *sbo = CALLOC_STRUCT(aub_buffer);
 
-   sbo->refcount = 1;
+   pipe_reference_init(&sbo->reference, 1);
 
    /* Could reuse buffers that are not referenced in current
     * batchbuffer.  Can't do that atm, so always reallocate:
index c87564f4dc1ed168a0ced5b8acaf910453e505eb..13e609f58fe059242782e1c3c36cf77c380da3b8 100644 (file)
@@ -107,22 +107,21 @@ xm_buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf)
 }
 
 static void
-xm_buffer_destroy(struct pipe_winsys *pws,
+xm_buffer_destroy(/*struct pipe_winsys *pws,*/
                   struct pipe_buffer *buf)
 {
    struct xm_buffer *oldBuf = xm_buffer(buf);
 
-   if (oldBuf->data) {
-      {
+   if (oldBuf) {
+      if (oldBuf->data) {
          if (!oldBuf->userBuffer) {
             align_free(oldBuf->data);
          }
-      }
 
-      oldBuf->data = NULL;
+         oldBuf->data = NULL;
+      }
+      free(oldBuf);
    }
-
-   free(oldBuf);
 }
 
 
@@ -222,7 +221,8 @@ xm_flush_frontbuffer(struct pipe_winsys *pws,
     * This function copies that XImage to the actual X Window.
     */
    XMesaContext xmctx = (XMesaContext) context_private;
-   xlib_cell_display_surface(xmctx->xm_buffer, surf);
+   if (xmctx)
+      xlib_cell_display_surface(xmctx->xm_buffer, surf);
 }
 
 
@@ -242,7 +242,7 @@ xm_buffer_create(struct pipe_winsys *pws,
 {
    struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer);
 
-   buffer->base.refcount = 1;
+   pipe_reference_init(&buffer->base.reference, 1);
    buffer->base.alignment = alignment;
    buffer->base.usage = usage;
    buffer->base.size = size;
@@ -266,7 +266,7 @@ static struct pipe_buffer *
 xm_user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
 {
    struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer);
-   buffer->base.refcount = 1;
+   pipe_reference_init(&buffer->base.reference, 1);
    buffer->base.size = bytes;
    buffer->userBuffer = TRUE;
    buffer->data = ptr;
@@ -370,7 +370,7 @@ xlib_create_cell_winsys( void )
 
 
 static struct pipe_screen *
-xlib_create_cell_screen( struct pipe_winsys *pws )
+xlib_create_cell_screen( void )
 {
    struct pipe_winsys *winsys;
    struct pipe_screen *screen;
index 586e1dfca5de363c6987f02ae914df559ba63661..762ebd98477b97619c4683b5b496a297ba5605b4 100644 (file)
@@ -61,8 +61,10 @@ struct xm_buffer
    void *mapped;
 
    XImage *tempImage;
+#ifdef USE_XSHM
    int shm;
    XShmSegmentInfo shminfo;
+#endif
 };
 
 
@@ -73,7 +75,9 @@ struct xmesa_pipe_winsys
 {
    struct pipe_winsys base;
 /*   struct xmesa_visual *xm_visual; */
+#ifdef USE_XSHM
    int shm;
+#endif
 };
 
 
@@ -89,7 +93,13 @@ xm_buffer( struct pipe_buffer *buf )
 /**
  * X Shared Memory Image extension code
  */
+#ifdef USE_XSHM
 #define XSHM_ENABLED(b) ((b)->shm)
+#else
+#define XSHM_ENABLED(b) 0
+#endif
+
+#ifdef USE_XSHM
 
 static volatile int mesaXErrorFlag = 0;
 
@@ -170,8 +180,12 @@ alloc_shm_ximage(struct xm_buffer *b, struct xmesa_buffer *xmb,
       (void) XSetErrorHandler(old_handler);
       return;
    }
+
+   b->shm = 1;
 }
 
+#endif /* USE_XSHM */
+
 
 
 /* Most callbacks map direcly onto dri_bufmgr operations:
@@ -193,12 +207,12 @@ xm_buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf)
 }
 
 static void
-xm_buffer_destroy(struct pipe_winsys *pws,
-                  struct pipe_buffer *buf)
+xm_buffer_destroy(struct pipe_buffer *buf)
 {
    struct xm_buffer *oldBuf = xm_buffer(buf);
 
    if (oldBuf->data) {
+#ifdef USE_XSHM
       if (oldBuf->shminfo.shmid >= 0) {
          shmdt(oldBuf->shminfo.shmaddr);
          shmctl(oldBuf->shminfo.shmid, IPC_RMID, 0);
@@ -207,6 +221,7 @@ xm_buffer_destroy(struct pipe_winsys *pws,
          oldBuf->shminfo.shmaddr = (char *) -1;
       }
       else
+#endif
       {
          if (!oldBuf->userBuffer) {
             align_free(oldBuf->data);
@@ -220,7 +235,6 @@ xm_buffer_destroy(struct pipe_winsys *pws,
 }
 
 
-
 /**
  * Display/copy the image in the surface into the X window specified
  * by the XMesaBuffer.
@@ -230,8 +244,8 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b,
                               struct pipe_surface *surf)
 {
    XImage *ximage;
-   struct xm_buffer *xm_buf = xm_buffer(
-      softpipe_texture(surf->texture)->buffer);
+   struct softpipe_texture *spt = softpipe_texture(surf->texture);
+   struct xm_buffer *xm_buf = xm_buffer(spt->buffer);
    static boolean no_swap = 0;
    static boolean firsttime = 1;
 
@@ -243,20 +257,26 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b,
    if (no_swap)
       return;
 
+#ifdef USE_XSHM
    if (XSHM_ENABLED(xm_buf) && (xm_buf->tempImage == NULL)) {
-      assert(surf->block.width == 1);
-      assert(surf->block.height == 1);
-      alloc_shm_ximage(xm_buf, b, surf->stride/surf->block.size, surf->height);
+      assert(surf->texture->block.width == 1);
+      assert(surf->texture->block.height == 1);
+      alloc_shm_ximage(xm_buf, b, spt->stride[surf->level] /
+                       surf->texture->block.size, surf->height);
    }
+#endif
 
    ximage = (XSHM_ENABLED(xm_buf)) ? xm_buf->tempImage : b->tempImage;
    ximage->data = xm_buf->data;
 
    /* display image in Window */
+#ifdef USE_XSHM
    if (XSHM_ENABLED(xm_buf)) {
       XShmPutImage(b->xm_visual->display, b->drawable, b->gc,
                    ximage, 0, 0, 0, 0, surf->width, surf->height, False);
-   } else {
+   } else
+#endif
+   {
       /* check that the XImage has been previously initialized */
       assert(ximage->format);
       assert(ximage->bitmap_unit);
@@ -264,7 +284,7 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b,
       /* update XImage's fields */
       ximage->width = surf->width;
       ximage->height = surf->height;
-      ximage->bytes_per_line = surf->stride;
+      ximage->bytes_per_line = spt->stride[surf->level];
 
       XPutImage(b->xm_visual->display, b->drawable, b->gc,
                 ximage, 0, 0, 0, 0, surf->width, surf->height);
@@ -301,12 +321,9 @@ xm_buffer_create(struct pipe_winsys *pws,
                  unsigned size)
 {
    struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer);
+#ifdef USE_XSHM
    struct xmesa_pipe_winsys *xpws = (struct xmesa_pipe_winsys *) pws;
 
-   buffer->base.refcount = 1;
-   buffer->base.alignment = alignment;
-   buffer->base.usage = usage;
-   buffer->base.size = size;
    buffer->shminfo.shmid = -1;
    buffer->shminfo.shmaddr = (char *) -1;
 
@@ -315,12 +332,17 @@ xm_buffer_create(struct pipe_winsys *pws,
 
       if (alloc_shm(buffer, size)) {
          buffer->data = buffer->shminfo.shmaddr;
+         buffer->shm = 1;
       }
    }
+#endif
 
-   if (buffer->data == NULL) {
-      buffer->shm = 0;
+   pipe_reference_init(&buffer->base.reference, 1);
+   buffer->base.alignment = alignment;
+   buffer->base.usage = usage;
+   buffer->base.size = size;
 
+   if (buffer->data == NULL) {
       /* align to 16-byte multiple for Cell */
       buffer->data = align_malloc(size, max(alignment, 16));
    }
@@ -336,11 +358,13 @@ static struct pipe_buffer *
 xm_user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
 {
    struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer);
-   buffer->base.refcount = 1;
+   pipe_reference_init(&buffer->base.reference, 1);
    buffer->base.size = bytes;
    buffer->userBuffer = TRUE;
    buffer->data = ptr;
+#ifdef USE_XSHM
    buffer->shm = 0;
+#endif
 
    return &buffer->base;
 }
index 49ee8b65943c5a916f0fb8596dadc7ace18c971c..8e6ccb4f7c3c01f2c9fb002b2fec43816a047765 100644 (file)
@@ -37,6 +37,9 @@ $(TOP)/$(LIB_DIR)/$(GLEW_LIB_NAME): depend $(OBJECTS)
        $(MKLIB) -o $(GLEW_LIB) -static -install $(TOP)/$(LIB_DIR) $(OBJECTS)
 
 
+install:
+
+
 clean:
        -rm -f *.o *~
        -rm -f depend depend.bak
index b878f05ddac3480c016315571e3daf3f78e8c799..0ef5d3ab56f19f46f32e19733be8dc8a99e5d189 100644 (file)
@@ -77,6 +77,9 @@ struct __GLXDRIdrawablePrivateRec {
     int bufferCount;
     int width, height;
     unsigned long configureSeqno;
+    int have_back;
+    int have_front;
+    int have_fake_front;
 };
 
 static void dri2DestroyContext(__GLXDRIcontext *context,
@@ -196,12 +199,22 @@ static void dri2CopySubBuffer(__GLXDRIdrawable *pdraw,
     XRectangle xrect;
     XserverRegion region;
 
+    /* Check we have the right attachments */
+    if (!(priv->have_front && priv->have_back))
+       return;
+
     xrect.x = x;
     xrect.y = priv->height - y - height;
     xrect.width = width;
     xrect.height = height;
 
+#ifdef __DRI2_FLUSH
+    if (pdraw->psc->f)
+       (*pdraw->psc->f->flush)(pdraw->driDrawable);
+#endif
+
     region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+    /* should get a fence ID back from here at some point */
     DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
                   DRI2BufferFrontLeft, DRI2BufferBackLeft);
     XFixesDestroyRegion(pdraw->psc->dpy, region);
@@ -214,6 +227,57 @@ static void dri2SwapBuffers(__GLXDRIdrawable *pdraw)
     dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
 }
 
+static void dri2WaitX(__GLXDRIdrawable *pdraw)
+{
+    __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
+    XRectangle xrect;
+    XserverRegion region;
+
+    /* Check we have the right attachments */
+    if (!(priv->have_fake_front && priv->have_front))
+       return;
+
+    xrect.x = 0;
+    xrect.y = 0;
+    xrect.width = priv->width;
+    xrect.height = priv->height;
+
+#ifdef __DRI2_FLUSH
+    if (pdraw->psc->f)
+       (*pdraw->psc->f->flush)(pdraw->driDrawable);
+#endif
+
+    region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+    DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
+                  DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+    XFixesDestroyRegion(pdraw->psc->dpy, region);
+}
+
+static void dri2WaitGL(__GLXDRIdrawable *pdraw)
+{
+    __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
+    XRectangle xrect;
+    XserverRegion region;
+
+    if (!(priv->have_fake_front && priv->have_front))
+       return;
+
+    xrect.x = 0;
+    xrect.y = 0;
+    xrect.width = priv->width;
+    xrect.height = priv->height;
+
+#ifdef __DRI2_FLUSH
+    if (pdraw->psc->f)
+       (*pdraw->psc->f->flush)(pdraw->driDrawable);
+#endif
+
+    region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+    DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
+                  DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
+    XFixesDestroyRegion(pdraw->psc->dpy, region);
+}
+
 static void dri2DestroyScreen(__GLXscreenConfigs *psc)
 {
     /* Free the direct rendering per screen data */
@@ -261,6 +325,9 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
     pdraw->width = *width;
     pdraw->height = *height;
     pdraw->bufferCount = *out_count;
+    pdraw->have_front = 0;
+    pdraw->have_fake_front = 0;
+    pdraw->have_back = 0;
 
     /* This assumes the DRI2 buffer attachment tokens matches the
      * __DRIbuffer tokens. */
@@ -270,6 +337,12 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
        pdraw->buffers[i].pitch = buffers[i].pitch;
        pdraw->buffers[i].cpp = buffers[i].cpp;
        pdraw->buffers[i].flags = buffers[i].flags;
+       if (pdraw->buffers[i].attachment == __DRI_BUFFER_FRONT_LEFT)
+           pdraw->have_front = 1;
+       if (pdraw->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)
+           pdraw->have_fake_front = 1;
+       if (pdraw->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT)
+           pdraw->have_back = 1;
     }
 
     Xfree(buffers);
@@ -366,6 +439,8 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
     psp->createContext = dri2CreateContext;
     psp->createDrawable = dri2CreateDrawable;
     psp->swapBuffers = dri2SwapBuffers;
+    psp->waitGL = dri2WaitGL;
+    psp->waitX = dri2WaitX;
 
     /* DRI2 suports SubBuffer through DRI2CopyRegion, so it's always
      * available.*/
index 4fda649e59ab7160b3d737401097bd68cf55975b..90c3d8c7d9d3fa2310c53da28577a2985613137a 100644 (file)
@@ -392,6 +392,13 @@ driBindExtensions(__GLXscreenConfigs *psc, int dri2)
        }
 #endif
 
+#ifdef __DRI2_FLUSH
+       if ((strcmp(extensions[i]->name, __DRI2_FLUSH) == 0) && dri2) {
+           psc->f = (__DRI2flushExtension *) extensions[i];
+           /* internal driver extension, no GL extension exposed */
+       }
+#endif
+
        /* Ignore unknown extensions */
     }
 }
index 44724d2c7d0ffce3ed21a356afca549eb4c3cc36..3089aa172856dce6bf00bf47a839f31391230405 100644 (file)
@@ -655,6 +655,8 @@ static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen,
     psp->createContext = driCreateContext;
     psp->createDrawable = driCreateDrawable;
     psp->swapBuffers = driSwapBuffers;
+    psp->waitX = NULL;
+    psp->waitGL = NULL;
 
     return psp;
 }
index 9332eb64d3b738cc9bec9ce99896359b30b5c3b6..caf58bbd44a005b2858ec9198bf789e829f30ff9 100644 (file)
@@ -139,6 +139,8 @@ struct __GLXDRIscreenRec {
     void (*swapBuffers)(__GLXDRIdrawable *pdraw);
     void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
                          int x, int y, int width, int height);
+    void (*waitX)(__GLXDRIdrawable *pdraw);
+    void (*waitGL)(__GLXDRIdrawable *pdraw);
 };
 
 struct __GLXDRIcontextRec {
@@ -517,6 +519,10 @@ struct __GLXscreenConfigsRec {
     const __DRItexBufferExtension *texBuffer;
 #endif
 
+#ifdef __DRI2_FLUSH
+    const __DRI2flushExtension *f;
+#endif
+
 #endif
 
     /**
index c68b6ac4efef75bec5d2197e9737d3f64722a1d6..fc0e593cb35bfbd3e0433a0c74085764e66261d7 100644 (file)
@@ -611,11 +611,15 @@ PUBLIC void glXWaitGL(void)
 
 #ifdef GLX_DIRECT_RENDERING
     if (gc->driContext) {
-/* This bit of ugliness unwraps the glFinish function */
-#ifdef glFinish
-#undef glFinish
-#endif
-       glFinish();
+       int screen;
+       __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, gc->currentDrawable, &screen);
+
+       if ( pdraw != NULL ) {
+           __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+           glFlush();
+           if (psc->driScreen->waitGL != NULL)
+               (*psc->driScreen->waitGL)(pdraw);
+       }
        return;
     }
 #endif
@@ -647,7 +651,15 @@ PUBLIC void glXWaitX(void)
 
 #ifdef GLX_DIRECT_RENDERING
     if (gc->driContext) {
-       XSync(dpy, False);
+       int screen;
+       __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, gc->currentDrawable, &screen);
+
+       if ( pdraw != NULL ) {
+           __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+           if (psc->driScreen->waitX != NULL)
+               (*psc->driScreen->waitX)(pdraw);
+       } else
+           XSync(dpy, False);
        return;
     }
 #endif
index be6edf9b19317ebf70bc9d07780ce1c080c13136..b296b7c651c67337f3ffee14d7c7677fc56a37a9 100644 (file)
 void __glXDumpDrawBuffer(__GLXcontext * ctx);
 #endif
 
-#ifdef USE_SPARC_ASM
-static void _glx_mesa_init_sparc_glapi_relocs(void);
-static int _mesa_sparc_needs_init = 1;
-#define INIT_MESA_SPARC do {               \
-   if (_mesa_sparc_needs_init) {           \
-      _glx_mesa_init_sparc_glapi_relocs(); \
-      _mesa_sparc_needs_init = 0;          \
-   }                                       \
-  } while(0)
-#else
-#define INIT_MESA_SPARC do { } while(0)
-#endif
-
 /*
 ** You can set this cell to 1 to force the gl drawing stuff to be
 ** one command per packet
@@ -670,7 +657,6 @@ __glXInitialize(Display * dpy)
    }
 #endif
 
-   INIT_MESA_SPARC;
    /* The one and only long long lock */
    __glXLock();
 
@@ -785,7 +771,6 @@ __glXSetupForCommand(Display * dpy)
 
       if (gc->currentDpy == dpy) {
          /* Use opcode from gc because its right */
-         INIT_MESA_SPARC;
          return gc->majorOpcode;
       }
       else {
@@ -979,74 +964,3 @@ __glXDumpDrawBuffer(__GLXcontext * ctx)
    }
 }
 #endif
-
-#ifdef  USE_SPARC_ASM
-/*
- * This is where our dispatch table's bounds are.
- * And the static mesa_init is taken directly from
- * Mesa's 'sparc.c' initializer.
- *
- * We need something like this here, because this version
- * of openGL/glx never initializes a Mesa context, and so
- * the address of the dispatch table pointer never gets stuffed
- * into the dispatch jump table otherwise.
- *
- * It matters only on SPARC, and only if you are using assembler
- * code instead of C-code indirect dispatch.
- *
- * -- FEM, 04.xii.03
- */
-extern unsigned int _mesa_sparc_glapi_begin;
-extern unsigned int _mesa_sparc_glapi_end;
-extern void __glapi_sparc_icache_flush(unsigned int *);
-
-static void
-_glx_mesa_init_sparc_glapi_relocs(void)
-{
-   unsigned int *insn_ptr, *end_ptr;
-   unsigned long disp_addr;
-
-   insn_ptr = &_mesa_sparc_glapi_begin;
-   end_ptr = &_mesa_sparc_glapi_end;
-   disp_addr = (unsigned long) &_glapi_Dispatch;
-
-   /*
-    * Verbatim from Mesa sparc.c.  It's needed because there doesn't
-    * seem to be a better way to do this:
-    *
-    * UNCONDITIONAL_JUMP ( (*_glapi_Dispatch) + entry_offset )
-    *
-    * This code is patching in the ADDRESS of the pointer to the
-    * dispatch table.  Hence, it must be called exactly once, because
-    * that address is not going to change.
-    *
-    * What it points to can change, but Mesa (and hence, we) assume
-    * that there is only one pointer.
-    *
-    */
-   while (insn_ptr < end_ptr) {
-#if ( defined(__sparc_v9__) && ( !defined(__linux__) || defined(__linux_64__) ) )
-/*
-       This code patches for 64-bit addresses.  This had better
-       not happen for Sparc/Linux, no matter what architecture we
-       are building for.  So, don't do this.
-
-        The 'defined(__linux_64__)' is used here as a placeholder for
-        when we do do 64-bit usermode on sparc linux.
-       */
-      insn_ptr[0] |= (disp_addr >> (32 + 10));
-      insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10);
-      __glapi_sparc_icache_flush(&insn_ptr[0]);
-      insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1));
-      insn_ptr[3] |= (disp_addr & ((1 << 10) - 1));
-      __glapi_sparc_icache_flush(&insn_ptr[2]);
-      insn_ptr += 11;
-#else
-      insn_ptr[0] |= (disp_addr >> 10);
-      insn_ptr[1] |= (disp_addr & ((1 << 10) - 1));
-      __glapi_sparc_icache_flush(&insn_ptr[0]);
-      insn_ptr += 5;
-#endif
-   }
-}
-#endif /* sparc ASM in use */
index fb87abc0a5aec42bf5686bedae273f497cfc6a63..08d52aeea30f75bffdf08bf74f030a0c6f6c0cb6 100644 (file)
@@ -7521,6 +7521,26 @@ __indirect_glGetProgramivARB(GLenum target, GLenum pname, GLint * params)
     return;
 }
 
+#define X_GLrop_ProgramEnvParameter4dvARB 4185
+void
+__indirect_glProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x,
+                                      GLdouble y, GLdouble z, GLdouble w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 44;
+    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&z), 8);
+    (void) memcpy((void *) (gc->pc + 36), (void *) (&w), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
 #define X_GLrop_ProgramEnvParameter4dvARB 4185
 void
 __indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index,
@@ -7538,6 +7558,26 @@ __indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index,
     }
 }
 
+#define X_GLrop_ProgramEnvParameter4fvARB 4184
+void
+__indirect_glProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x,
+                                      GLfloat y, GLfloat z, GLfloat w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&w), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
 #define X_GLrop_ProgramEnvParameter4fvARB 4184
 void
 __indirect_glProgramEnvParameter4fvARB(GLenum target, GLuint index,
index f8c88b36bb82f990f327697bd2ec0ac671f91b4e..0719a1b30243dbac7a80e30b77aa995bc60c954c 100644 (file)
@@ -517,7 +517,9 @@ extern HIDDEN void __indirect_glGetProgramivARB(GLenum target, GLenum pname, GLi
 extern HIDDEN void __indirect_glGetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble * params);
 extern HIDDEN void __indirect_glGetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat * params);
 extern HIDDEN void __indirect_glGetVertexAttribivARB(GLuint index, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
 extern HIDDEN void __indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
+extern HIDDEN void __indirect_glProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
 extern HIDDEN void __indirect_glProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat * params);
 extern HIDDEN void __indirect_glProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
 extern HIDDEN void __indirect_glProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
index 479184337c11cf8b2276163e2fae44c0e1e7c3e9..852fe712c668018adcc31aea2aa8e754a079152c 100644 (file)
@@ -526,7 +526,9 @@ __GLapi * __glXNewIndirectAPI( void )
     glAPI->GetVertexAttribdvARB = __indirect_glGetVertexAttribdvARB;
     glAPI->GetVertexAttribfvARB = __indirect_glGetVertexAttribfvARB;
     glAPI->GetVertexAttribivARB = __indirect_glGetVertexAttribivARB;
+    glAPI->ProgramEnvParameter4dARB = __indirect_glProgramEnvParameter4dARB;
     glAPI->ProgramEnvParameter4dvARB = __indirect_glProgramEnvParameter4dvARB;
+    glAPI->ProgramEnvParameter4fARB = __indirect_glProgramEnvParameter4fARB;
     glAPI->ProgramEnvParameter4fvARB = __indirect_glProgramEnvParameter4fvARB;
     glAPI->ProgramLocalParameter4dARB = __indirect_glProgramLocalParameter4dARB;
     glAPI->ProgramLocalParameter4dvARB = __indirect_glProgramLocalParameter4dvARB;
index 12214d7fe40c05781df9f7427aa4f55b91610d2f..54c039dd6c1d32559c058dd158e9a25ddc5b577e 100644 (file)
@@ -240,6 +240,7 @@ __glTexEnvfv_size(GLenum e)
     case GL_OPERAND1_ALPHA:
     case GL_OPERAND2_ALPHA:
     case GL_OPERAND3_ALPHA_NV:
+    case GL_BUMP_TARGET_ATI:
     case GL_COORD_REPLACE_ARB:
 /*      case GL_COORD_REPLACE_NV:*/
         return 1;
index 78b71d4676fadc19882c933a6b79529f9eab2cff..4ff28dae9bbd2fcd8eeccc006b6e7ba2234d3249 100644 (file)
@@ -48,7 +48,7 @@ libglapi.a: $(GLAPI_OBJECTS)
 ######################################################################
 # Device drivers
 driver_subdirs: libmesa.a libglapi.a
-       (cd drivers && $(MAKE))
+       (cd drivers && $(MAKE))
 
 
 ######################################################################
index a878d31dbb5129c3532f88ca43e799c487915f33..d1b9e93c0c7782e46dc521e00045072bb1cdea41 100644 (file)
@@ -16,6 +16,7 @@ if env['platform'] != 'winddk':
                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
                ])       
 
        #
@@ -39,6 +40,7 @@ if env['platform'] != 'winddk':
                'main/colortab.c',
                'main/context.c',
                'main/convolve.c',
+               'main/cpuinfo.c',
                'main/debug.c',
                'main/depth.c',
                'main/depthstencil.c',
@@ -79,6 +81,7 @@ if env['platform'] != 'winddk':
                'main/renderbuffer.c',
                'main/scissor.c',
                'main/shaders.c',
+               'main/shared.c',
                'main/state.c',
                'main/stencil.c',
                'main/texcompress.c',
@@ -95,6 +98,7 @@ if env['platform'] != 'winddk':
                'main/texstate.c',
                'main/texstore.c',
                'main/varray.c',
+               'main/viewport.c',
                'main/vtxfmt.c',
        ]
        
@@ -163,6 +167,7 @@ if env['platform'] != 'winddk':
                'state_tracker/st_cb_readpixels.c',
                'state_tracker/st_cb_strings.c',
                'state_tracker/st_cb_texture.c',
+               'state_tracker/st_cb_viewport.c',
                'state_tracker/st_context.c',
                'state_tracker/st_debug.c',
                'state_tracker/st_draw.c',
@@ -186,10 +191,10 @@ if env['platform'] != 'winddk':
                'shader/nvvertparse.c',
                'shader/program.c',
                'shader/prog_cache.c',
-               'shader/prog_debug.c',
                'shader/prog_execute.c',
                'shader/prog_instruction.c',
                'shader/prog_noise.c',
+               'shader/prog_optimize.c',
                'shader/prog_parameter.c',
                'shader/prog_print.c',
                'shader/prog_statevars.c',
@@ -250,7 +255,7 @@ if env['platform'] != 'winddk':
                ])
                mesa_sources += [
                        'x86/common_x86.c',
-                       'x86/x86.c',
+                       'x86/x86_xform.c',
                        'x86/3dnow.c',
                        'x86/sse.c',
                        'x86/common_x86_asm.S',
index 986f751bdc1a7bf0f9c42d40bdd0370d8f616829..44adaf868284bf6574e8501f9d5861a4ec51eb77 100644 (file)
@@ -134,9 +134,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
    driver->BindProgram = NULL;
    driver->NewProgram = _mesa_new_program;
    driver->DeleteProgram = _mesa_delete_program;
-#if FEATURE_MESA_program_debug
-   driver->GetProgramRegister = _mesa_get_program_register;
-#endif /* FEATURE_MESA_program_debug */
 
    /* simple state commands */
    driver->AlphaFunc = NULL;
@@ -308,7 +305,7 @@ _mesa_init_driver_state(GLcontext *ctx)
    ctx->Driver.Enable(ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag);
    ctx->Driver.Enable(ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag);
    ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled);
-   ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled);
+   ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled);
    ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE);
    ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE);
    ctx->Driver.Enable(ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE);
index 0d641f25f7c0dc5812b60cf23a9b8b6340f87263..8dcaaee3079f408b2d15df5faf1944eb2665c8a6 100644 (file)
@@ -2640,6 +2640,13 @@ static const char GetProgramStringARB_names[] =
     "";
 #endif
 
+#if defined(need_GL_ATI_envmap_bumpmap)
+static const char TexBumpParameterfvATI_names[] = 
+    "ip\0" /* Parameter signature */
+    "glTexBumpParameterfvATI\0"
+    "";
+#endif
+
 #if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
 static const char CompileShaderARB_names[] = 
     "i\0" /* Parameter signature */
@@ -2980,6 +2987,13 @@ static const char GetVertexAttribdvARB_names[] =
     "";
 #endif
 
+#if defined(need_GL_ATI_envmap_bumpmap)
+static const char TexBumpParameterivATI_names[] = 
+    "ip\0" /* Parameter signature */
+    "glTexBumpParameterivATI\0"
+    "";
+#endif
+
 #if defined(need_GL_EXT_convolution)
 static const char GetSeparableFilter_names[] = 
     "iiippp\0" /* Parameter signature */
@@ -3891,6 +3905,13 @@ static const char VertexAttrib4dARB_names[] =
     "";
 #endif
 
+#if defined(need_GL_ATI_envmap_bumpmap)
+static const char GetTexBumpParameterfvATI_names[] = 
+    "ip\0" /* Parameter signature */
+    "glGetTexBumpParameterfvATI\0"
+    "";
+#endif
+
 #if defined(need_GL_NV_fragment_program)
 static const char ProgramNamedParameter4dNV_names[] = 
     "iipdddd\0" /* Parameter signature */
@@ -4834,6 +4855,13 @@ static const char VertexAttribs1svNV_names[] =
     "";
 #endif
 
+#if defined(need_GL_ATI_envmap_bumpmap)
+static const char GetTexBumpParameterivATI_names[] = 
+    "ip\0" /* Parameter signature */
+    "glGetTexBumpParameterivATI\0"
+    "";
+#endif
+
 #if defined(need_GL_EXT_coordinate_frame)
 static const char Binormal3bEXT_names[] = 
     "iii\0" /* Parameter signature */
@@ -5198,6 +5226,16 @@ static const struct dri_extension_function GL_ATI_draw_buffers_functions[] = {
 };
 #endif
 
+#if defined(need_GL_ATI_envmap_bumpmap)
+static const struct dri_extension_function GL_ATI_envmap_bumpmap_functions[] = {
+    { TexBumpParameterfvATI_names, TexBumpParameterfvATI_remap_index, -1 },
+    { TexBumpParameterivATI_names, TexBumpParameterivATI_remap_index, -1 },
+    { GetTexBumpParameterfvATI_names, GetTexBumpParameterfvATI_remap_index, -1 },
+    { GetTexBumpParameterivATI_names, GetTexBumpParameterivATI_remap_index, -1 },
+    { NULL, 0, 0 }
+};
+#endif
+
 #if defined(need_GL_ATI_fragment_shader)
 static const struct dri_extension_function GL_ATI_fragment_shader_functions[] = {
     { ColorFragmentOp2ATI_names, ColorFragmentOp2ATI_remap_index, -1 },
index ff174a251d28301a39a5664dd045f31e612a9a0c..b64618a03c8dbebb7479e2caf6de154b8b5a4542 100644 (file)
@@ -1063,31 +1063,31 @@ void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped,
       ctx->Texture.CurrentUnit = i;
 
       if ( (targets & DRI_TEXMGR_DO_TEXTURE_1D) != 0 ) {
-        texObj = ctx->Texture.Unit[i].Current1D;
+        texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_1D_INDEX];
         ctx->Driver.BindTexture( ctx, GL_TEXTURE_1D, texObj );
         move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
       }
 
       if ( (targets & DRI_TEXMGR_DO_TEXTURE_2D) != 0 ) {
-        texObj = ctx->Texture.Unit[i].Current2D;
+        texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_2D_INDEX];
         ctx->Driver.BindTexture( ctx, GL_TEXTURE_2D, texObj );
         move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
       }
 
       if ( (targets & DRI_TEXMGR_DO_TEXTURE_3D) != 0 ) {
-        texObj = ctx->Texture.Unit[i].Current3D;
+        texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_3D_INDEX];
         ctx->Driver.BindTexture( ctx, GL_TEXTURE_3D, texObj );
         move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
       }
 
       if ( (targets & DRI_TEXMGR_DO_TEXTURE_CUBE) != 0 ) {
-        texObj = ctx->Texture.Unit[i].CurrentCubeMap;
+        texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_CUBE_INDEX];
         ctx->Driver.BindTexture( ctx, GL_TEXTURE_CUBE_MAP_ARB, texObj );
         move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
       }
 
       if ( (targets & DRI_TEXMGR_DO_TEXTURE_RECT) != 0 ) {
-        texObj = ctx->Texture.Unit[i].CurrentRect;
+        texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_RECT_INDEX];
         ctx->Driver.BindTexture( ctx, GL_TEXTURE_RECTANGLE_NV, texObj );
         move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
       }
index 6b44ed9a673cbdd48fb49559066a489187f22be1..c9acd81be747a2800ca178ef1127b9c94c908114 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 #include "main/mtypes.h"
+#include "main/cpuinfo.h"
 #include "main/extensions.h"
 #include "glapi/dispatch.h"
 #include "utils.h"
 
-int driDispatchRemapTable[ driDispatchRemapTable_size ];
 
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
+int driDispatchRemapTable[ driDispatchRemapTable_size ];
 
-#if defined(USE_PPC_ASM)
-#include "ppc/common_ppc_features.h"
-#endif
 
 unsigned
 driParseDebugString( const char * debug, 
@@ -93,12 +88,8 @@ unsigned
 driGetRendererString( char * buffer, const char * hardware_name,
                      const char * driver_date, GLuint agp_mode )
 {
-#define MAX_INFO   4
-   const char * cpu[MAX_INFO];
-   unsigned   next = 0;
-   unsigned   i;
-   unsigned   offset;
-
+   unsigned offset;
+   char *cpu;
 
    offset = sprintf( buffer, "Mesa DRI %s %s", hardware_name, driver_date );
 
@@ -118,59 +109,10 @@ driGetRendererString( char * buffer, const char * hardware_name,
 
    /* Append any CPU-specific information.
     */
-#ifdef USE_X86_ASM
-   if ( _mesa_x86_cpu_features ) {
-      cpu[next] = " x86";
-      next++;
-   }
-# ifdef USE_MMX_ASM
-   if ( cpu_has_mmx ) {
-      cpu[next] = (cpu_has_mmxext) ? "/MMX+" : "/MMX";
-      next++;
-   }
-# endif
-# ifdef USE_3DNOW_ASM
-   if ( cpu_has_3dnow ) {
-      cpu[next] = (cpu_has_3dnowext) ? "/3DNow!+" : "/3DNow!";
-      next++;
-   }
-# endif
-# ifdef USE_SSE_ASM
-   if ( cpu_has_xmm ) {
-      cpu[next] = (cpu_has_xmm2) ? "/SSE2" : "/SSE";
-      next++;
-   }
-# endif
-
-#elif defined(USE_SPARC_ASM)
-
-   cpu[0] = " SPARC";
-   next = 1;
-
-#elif defined(USE_PPC_ASM)
-   if ( _mesa_ppc_cpu_features ) {
-      cpu[next] = (cpu_has_64) ? " PowerPC 64" : " PowerPC";
-      next++;
-   }
-
-# ifdef USE_VMX_ASM
-   if ( cpu_has_vmx ) {
-      cpu[next] = "/Altivec";
-      next++;
-   }
-# endif
-
-   if ( ! cpu_has_fpu ) {
-      cpu[next] = "/No FPU";
-      next++;
-   }
-#endif
-
-   for ( i = 0 ; i < next ; i++ ) {
-      const size_t len = strlen( cpu[i] );
-
-      strncpy( & buffer[ offset ], cpu[i], len );
-      offset += len;
+   cpu = _mesa_get_cpu_string();
+   if (cpu) {
+      offset += sprintf(buffer + offset, " %s", cpu);
+      _mesa_free(cpu);
    }
 
    return offset;
index d5f4fc349177d4befb02d4fac2f82225b7c2b683..d76595578c778e69c3e0ddc2a1cd29ea25118bf9 100644 (file)
@@ -546,3 +546,23 @@ DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
         DRI_CONF_DESC(fr,"Activer l'extension GL_NV_vertex_program") \
         DRI_CONF_DESC(sv,"Aktivera tillägget GL_NV_vertex_program") \
 DRI_CONF_OPT_END
+
+#define DRI_CONF_ALWAYS_FLUSH_BATCH(def) \
+DRI_CONF_OPT_BEGIN(always_flush_batch,bool,def) \
+        DRI_CONF_DESC(en,"Enable flushing batchbuffer after each draw call") \
+        DRI_CONF_DESC(de,"Enable flushing batchbuffer after each draw call") \
+        DRI_CONF_DESC(es,"Enable flushing batchbuffer after each draw call") \
+        DRI_CONF_DESC(nl,"Enable flushing batchbuffer after each draw call") \
+        DRI_CONF_DESC(fr,"Enable flushing batchbuffer after each draw call") \
+        DRI_CONF_DESC(sv,"Enable flushing batchbuffer after each draw call") \
+DRI_CONF_OPT_END
+
+#define DRI_CONF_ALWAYS_FLUSH_CACHE(def) \
+DRI_CONF_OPT_BEGIN(always_flush_cache,bool,def) \
+        DRI_CONF_DESC(en,"Enable flushing GPU caches with each draw call") \
+        DRI_CONF_DESC(de,"Enable flushing GPU caches with each draw call") \
+        DRI_CONF_DESC(es,"Enable flushing GPU caches with each draw call") \
+        DRI_CONF_DESC(nl,"Enable flushing GPU caches with each draw call") \
+        DRI_CONF_DESC(fr,"Enable flushing GPU caches with each draw call") \
+        DRI_CONF_DESC(sv,"Enable flushing GPU caches with each draw call") \
+DRI_CONF_OPT_END
index 4df1916aad07c830a610a4ce9b7cc29d6dd2cb30..5fd6ec65bf8aa3fac1da8e630edb89fc49f7a13c 100644 (file)
@@ -237,3 +237,13 @@ DRI_CONF_OPT_END
 DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
         DRI_CONF_DESC(en,gettext("Enable extension GL_NV_vertex_program")) \
 DRI_CONF_OPT_END
+
+#define DRI_CONF_ALWAYS_FLUSH_BATCH(def) \
+DRI_CONF_OPT_BEGIN(always_flush_batch,bool,def) \
+        DRI_CONF_DESC(en,gettext("Enable flushing batchbuffer after each draw call")) \
+DRI_CONF_OPT_END
+
+#define DRI_CONF_ALWAYS_FLUSH_CACHE(def) \
+DRI_CONF_OPT_BEGIN(always_flush_cache,bool,def) \
+        DRI_CONF_DESC(en,gettext("Enable flushing GPU caches with each draw call")) \
+DRI_CONF_OPT_END
index f1194d7ce82b38449070381686d9543b02c2cec4..571b8922d5d6cc7e819cb264fed0c1818b402b59 100644 (file)
@@ -480,7 +480,7 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv,
 static void
 fbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 
index ee0fe4e0dbe73ed1362c0b6e71a030d676cb0994..5eb8f417ffb76015bcb38c497bd48d54e50a3d21 100644 (file)
@@ -275,7 +275,7 @@ ffbDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func,
        /* We will properly update sw/hw state when stenciling is
         * enabled.
         */
-       if (! ctx->Stencil.Enabled)
+       if (! ctx->Stencil._Enabled)
                return;
 
        stencilctl = fmesa->stencilctl;
@@ -333,7 +333,7 @@ ffbDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail,
        /* We will properly update sw/hw state when stenciling is
         * enabled.
         */
-       if (! ctx->Stencil.Enabled)
+       if (! ctx->Stencil._Enabled)
                return;
 
        stencilctl = fmesa->stencilctl;
index 00bdcec7a6963c205982510d913e2705d88e16a8..3b9f5c675919c8858c80df1efb38404b4e1d5923 100644 (file)
@@ -394,7 +394,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,
 static void
 ffbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 
index 2ffb790f28abccc38dcc4723ae56ec2d415555c4..ca33c1740ff5c173ce81997268cd72947cac272b 100644 (file)
@@ -400,19 +400,19 @@ void gammaInitTextureObjects( GLcontext *ctx )
 
    ctx->Texture.CurrentUnit = 0;
 
-   texObj = ctx->Texture.Unit[0].Current1D;
+   texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_1D_INDEX];
    gammaBindTexture( ctx, GL_TEXTURE_1D, texObj );
 
-   texObj = ctx->Texture.Unit[0].Current2D;
+   texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];
    gammaBindTexture( ctx, GL_TEXTURE_2D, texObj );
 
 #if 0
    ctx->Texture.CurrentUnit = 1;
 
-   texObj = ctx->Texture.Unit[1].Current1D;
+   texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_1D_INDEX];
    gammaBindTexture( ctx, GL_TEXTURE_1D, texObj );
 
-   texObj = ctx->Texture.Unit[1].Current2D;
+   texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_2D_INDEX];
    gammaBindTexture( ctx, GL_TEXTURE_2D, texObj );
 #endif
 
index 2a28902e1e95753efc00257ab660afff1564d07e..7b5b53589c64031a5beae4a97a4547e7eb576959 100644 (file)
@@ -96,7 +96,7 @@ gammaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
 static void
 gammaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 static void
index 9a5a39c1dbc1b5f02e6cba8366051cdbf25d130b..6e49f3466c3ccea78b6aa50c9f81621fdcef6a48 100644 (file)
@@ -341,7 +341,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
 static void
 i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-    _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 const struct __DriverAPIRec driDriverAPI = {
index fdce8af31f4843f882c234a6ff4aafaaefaa3a79..9c540cb2bb72440d55446947053b90618f2fe320 100644 (file)
@@ -73,6 +73,8 @@ i830CreateContext(const __GLcontextModes * mesaVis,
       return GL_FALSE;
    }
 
+   _math_matrix_ctr(&intel->ViewportMatrix);
+
    /* Initialize swrast, tnl driver tables: */
    intelInitSpanFuncs(ctx);
    intelInitTriFuncs(ctx);
index 8fc8aa5f9003646324ac44706de8ea9e860645e2..1a94921078980028f4c1f96b1ebd2fcc458cd9b4 100644 (file)
@@ -422,10 +422,10 @@ i830_emit_state(struct intel_context *intel)
    struct i830_hw_state *state = i830->current;
    int i, count;
    GLuint dirty;
-   GET_CURRENT_CONTEXT(ctx);
-   BATCH_LOCALS;
    dri_bo *aper_array[3 + I830_TEX_UNITS];
    int aper_count;
+   GET_CURRENT_CONTEXT(ctx);
+   BATCH_LOCALS;
 
    /* We don't hold the lock at this point, so want to make sure that
     * there won't be a buffer wrap between the state emits and the primitive
index 6e2d41e19ab3ce41deb49c90a6fe7310439a61bf..7549029a1be909b9fd68aa1d7368451c63348258 100644 (file)
@@ -119,6 +119,8 @@ i915CreateContext(const __GLcontextModes * mesaVis,
       return GL_FALSE;
    }
 
+   _math_matrix_ctr(&intel->ViewportMatrix);
+
    /* Initialize swrast, tnl driver tables: */
    intelInitSpanFuncs(ctx);
    intelInitTriFuncs(ctx);
index f091d600c35fdf09dbfec51a0130f5d12ca3ab83..52f09a4b1b2f160f20673faa5761cc8901c670d8 100644 (file)
@@ -180,9 +180,9 @@ get_result_vector(struct i915_fragment_program *p,
    switch (inst->DstReg.File) {
    case PROGRAM_OUTPUT:
       switch (inst->DstReg.Index) {
-      case FRAG_RESULT_COLR:
+      case FRAG_RESULT_COLOR:
          return UREG(REG_TYPE_OC, 0);
-      case FRAG_RESULT_DEPR:
+      case FRAG_RESULT_DEPTH:
          p->depth_written = 1;
          return UREG(REG_TYPE_OD, 0);
       default:
index e80996580c7ca7b4aec3a5248692afdc9d88399e..1d39278cbf085050b1cce02da7c3723956231a04 100644 (file)
@@ -89,8 +89,8 @@ intel_flush_inline_primitive(struct intel_context *intel)
 
 static void intel_start_inline(struct intel_context *intel, uint32_t prim)
 {
-   BATCH_LOCALS;
    uint32_t batch_flags = LOOP_CLIPRECTS;
+   BATCH_LOCALS;
 
    intel->vtbl.emit_state(intel);
 
@@ -201,10 +201,10 @@ uint32_t *intel_get_prim_space(struct intel_context *intel, unsigned int count)
 /** Dispatches the accumulated primitive to the batchbuffer. */
 void intel_flush_prim(struct intel_context *intel)
 {
-   BATCH_LOCALS;
    dri_bo *aper_array[2];
    dri_bo *vb_bo;
    unsigned int offset, count;
+   BATCH_LOCALS;
 
    /* Must be called after an intel_start_prim. */
    assert(intel->prim.primitive != ~0);
@@ -989,7 +989,7 @@ intelChooseRenderState(GLcontext * ctx)
             intel->draw_tri = intel_fallback_tri;
 
          if (flags & DD_TRI_SMOOTH) {
-           if (intel->strict_conformance)
+           if (intel->conformance_mode > 0)
               intel->draw_tri = intel_fallback_tri;
         }
 
@@ -1001,7 +1001,7 @@ intelChooseRenderState(GLcontext * ctx)
         }
 
         if (flags & DD_POINT_SMOOTH) {
-           if (intel->strict_conformance)
+           if (intel->conformance_mode > 0)
               intel->draw_point = intel_fallback_point;
         }
 
index 82370162f595756b63ecbae50f735b67b8e93654..c724218cf567dc2d0b6c605de83e798045927f9a 100644 (file)
@@ -88,7 +88,7 @@ cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key)
 
    memset(key, 0, sizeof(*key));
 
-   key->stencil = ctx->Stencil.Enabled;
+   key->stencil = ctx->Stencil._Enabled;
    key->stencil_two_side = ctx->Stencil._TestTwoSide;
 
    if (key->stencil) {
index c45d48dff8e161a5d898eb522066606b7b847e0b..d830e49e50ae7dddfec75394550d616e4c0e3443 100644 (file)
@@ -181,34 +181,54 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
         brw_DP4(p, vec4(c->reg.dp1), deref_4f(vtx1, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation);
         is_negative = brw_IF(p, BRW_EXECUTE_1);
         {
-           brw_ADD(p, c->reg.t, c->reg.dp1, negate(c->reg.dp0));
-           brw_math_invert(p, c->reg.t, c->reg.t);
-           brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp1);
-
-           brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t1 );
-           brw_MOV(p, c->reg.t1, c->reg.t);
-           brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+             /*
+              * Both can be negative on GM965/G965 due to RHW workaround
+              * if so, this object should be rejected.
+              */
+             if (!BRW_IS_G4X(p->brw)) {
+                 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);
+                 {
+                     brw_clip_kill_thread(c);
+                 }
+                 brw_ENDIF(p, is_neg2);
+             }
+
+             brw_ADD(p, c->reg.t, c->reg.dp1, negate(c->reg.dp0));
+             brw_math_invert(p, c->reg.t, c->reg.t);
+             brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp1);
+
+             brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t1 );
+             brw_MOV(p, c->reg.t1, c->reg.t);
+             brw_set_predicate_control(p, BRW_PREDICATE_NONE);
         } 
         is_negative = brw_ELSE(p, is_negative);
         {
-           /* Coming back in.  We know that both cannot be negative
-            * because the line would have been culled in that case.
-            */
+             /* Coming back in.  We know that both cannot be negative
+              * because the line would have been culled in that case.
+              */
+
+             /* If both are positive, do nothing */
+             /* Only on GM965/G965 */
+             if (!BRW_IS_G4X(p->brw)) {
+                 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);
+             }
 
-           /* If both are positive, do nothing */
-             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);
              {
-               brw_ADD(p, c->reg.t, c->reg.dp0, negate(c->reg.dp1));
-               brw_math_invert(p, c->reg.t, c->reg.t);
-               brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp0);
-
-               brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t0 );
-               brw_MOV(p, c->reg.t0, c->reg.t);
-               brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-            }
-            brw_ENDIF(p, is_neg2);
-        }
+                 brw_ADD(p, c->reg.t, c->reg.dp0, negate(c->reg.dp1));
+                 brw_math_invert(p, c->reg.t, c->reg.t);
+                 brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp0);
+
+                 brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t0 );
+                 brw_MOV(p, c->reg.t0, c->reg.t);
+                 brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+             }
+
+             if (!BRW_IS_G4X(p->brw)) {
+                 brw_ENDIF(p, is_neg2);
+             }
+         }
         brw_ENDIF(p, is_negative);      
       }
       brw_ENDIF(p, plane_active);
index 1dbba37fe7e3afb7a23eebbe6b1c0ab4bb8d3724..7fd37bd05ff6f91164cce33388bbf502fa62cc44 100644 (file)
@@ -455,6 +455,8 @@ static void brw_clip_test( struct brw_clip_compile *c )
     struct brw_indirect vt2 = brw_indirect(2, 0);
 
     struct brw_compile *p = &c->func;
+    struct brw_instruction *is_outside;
+    struct brw_reg tmp0 = c->reg.loopcount; /* handy temporary */
 
     brw_MOV(p, get_addr_reg(vt0), brw_address(c->reg.vertex[0]));
     brw_MOV(p, get_addr_reg(vt1), brw_address(c->reg.vertex[1]));
@@ -462,53 +464,87 @@ static void brw_clip_test( struct brw_clip_compile *c )
     brw_MOV(p, v0, deref_4f(vt0, c->offset[VERT_RESULT_HPOS]));
     brw_MOV(p, v1, deref_4f(vt1, c->offset[VERT_RESULT_HPOS]));
     brw_MOV(p, v2, deref_4f(vt2, c->offset[VERT_RESULT_HPOS]));
+    brw_AND(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(~0x3f));
 
     /* test nearz, xmin, ymin plane */
-    brw_CMP(p, t1, BRW_CONDITIONAL_LE, negate(v0), get_element(v0, 3)); 
+    /* clip.xyz < -clip.w */
+    brw_CMP(p, t1, BRW_CONDITIONAL_L, v0, negate(get_element(v0, 3))); 
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-    brw_CMP(p, t2, BRW_CONDITIONAL_LE, negate(v1), get_element(v1, 3)); 
+    brw_CMP(p, t2, BRW_CONDITIONAL_L, v1, negate(get_element(v1, 3))); 
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-    brw_CMP(p, t3, BRW_CONDITIONAL_LE, negate(v2), get_element(v2, 3)); 
+    brw_CMP(p, t3, BRW_CONDITIONAL_L, v2, negate(get_element(v2, 3))); 
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+
+    /* All vertices are outside of a plane, rejected */
+    brw_AND(p, t, t1, t2);
+    brw_AND(p, t, t, t3);
+    brw_OR(p, tmp0, get_element(t, 0), get_element(t, 1));
+    brw_OR(p, tmp0, tmp0, get_element(t, 2));
+    brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
+    brw_AND(p, brw_null_reg(), tmp0, brw_imm_ud(0x1));
+    is_outside = brw_IF(p, BRW_EXECUTE_1);
+    {
+        brw_clip_kill_thread(c);
+    }
+    brw_ENDIF(p, is_outside);
+    brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+
+    /* some vertices are inside a plane, some are outside,need to clip */
     brw_XOR(p, t, t1, t2);
     brw_XOR(p, t1, t2, t3);
     brw_OR(p, t, t, t1);
-
-    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, 
-           get_element(t, 0), brw_imm_ud(0));
+    brw_AND(p, t, t, brw_imm_ud(0x1));
+    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+            get_element(t, 0), brw_imm_ud(0));
     brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<5)));
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, 
-           get_element(t, 1), brw_imm_ud(0));
+    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+            get_element(t, 1), brw_imm_ud(0));
     brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<3)));
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, 
-           get_element(t, 2), brw_imm_ud(0));
+    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+            get_element(t, 2), brw_imm_ud(0));
     brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<1)));
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
 
     /* test farz, xmax, ymax plane */
-    brw_CMP(p, t1, BRW_CONDITIONAL_L, v0, get_element(v0, 3)); 
+    /* clip.xyz > clip.w */
+    brw_CMP(p, t1, BRW_CONDITIONAL_G, v0, get_element(v0, 3)); 
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-    brw_CMP(p, t2, BRW_CONDITIONAL_L, v1, get_element(v1, 3)); 
+    brw_CMP(p, t2, BRW_CONDITIONAL_G, v1, get_element(v1, 3)); 
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-    brw_CMP(p, t3, BRW_CONDITIONAL_L, v2, get_element(v2, 3)); 
+    brw_CMP(p, t3, BRW_CONDITIONAL_G, v2, get_element(v2, 3)); 
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
 
+    /* All vertices are outside of a plane, rejected */
+    brw_AND(p, t, t1, t2);
+    brw_AND(p, t, t, t3);
+    brw_OR(p, tmp0, get_element(t, 0), get_element(t, 1));
+    brw_OR(p, tmp0, tmp0, get_element(t, 2));
+    brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
+    brw_AND(p, brw_null_reg(), tmp0, brw_imm_ud(0x1));
+    is_outside = brw_IF(p, BRW_EXECUTE_1);
+    {
+        brw_clip_kill_thread(c);
+    }
+    brw_ENDIF(p, is_outside);
+    brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+
+    /* some vertices are inside a plane, some are outside,need to clip */
     brw_XOR(p, t, t1, t2);
     brw_XOR(p, t1, t2, t3);
     brw_OR(p, t, t, t1);
-
-    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, 
-           get_element(t, 0), brw_imm_ud(0));
+    brw_AND(p, t, t, brw_imm_ud(0x1));
+    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+            get_element(t, 0), brw_imm_ud(0));
     brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<4)));
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, 
-           get_element(t, 1), brw_imm_ud(0));
+    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+            get_element(t, 1), brw_imm_ud(0));
     brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<2)));
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, 
-           get_element(t, 2), brw_imm_ud(0));
+    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+            get_element(t, 2), brw_imm_ud(0));
     brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<0)));
     brw_set_predicate_control(p, BRW_PREDICATE_NONE);
 
index eaac6224f6ed6ee1d529b4ca58168dec76bc706d..d96ff2931027dd0a7b66fcc600d895d336601403 100644 (file)
@@ -121,6 +121,9 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
    /* if conformance mode is set, swrast can handle any size AA point */
    ctx->Const.MaxPointSizeAA = 255.0;
 
+   /* We want the GLSL compiler to emit code that uses condition codes */
+   ctx->Shader.EmitCondCodes = GL_TRUE;
+
 /*    ctx->Const.MaxNativeVertexProgramTemps = 32; */
 
    brw_init_state( brw );
index df90c2027f34a281601beaf214227e65f2ece7a7..48ed4325bef69e4089a30d7b6b7220ffdf167408 100644 (file)
@@ -46,7 +46,7 @@
  *
  * CURBE - constant URB entry.  An urb region (entry) used to hold
  * constant values which the fixed function units can be instructed to
- * preload into the GRF when spawining a thread.
+ * preload into the GRF when spawning a thread.
  *
  * VUE - vertex URB entry.  An urb entry holding a vertex and usually
  * a vertex header.  The header contains control information and
@@ -63,7 +63,7 @@
  * special and may be overwritten.
  *
  * MRF - message register file.  Threads communicate (and terminate)
- * by sending messages.  Message parameters are placed in contigous
+ * by sending messages.  Message parameters are placed in contiguous
  * MRF registers.  All program output is via these messages.  URB
  * entries are populated by sending a message to the shared URB
  * function containing the new data, together with a control word,
@@ -154,21 +154,22 @@ struct brw_state_flags {
    GLuint cache;
 };
 
+
+/** Subclass of Mesa vertex program */
 struct brw_vertex_program {
    struct gl_vertex_program program;
    GLuint id;
 };
 
 
-
+/** Subclass of Mesa fragment program */
 struct brw_fragment_program {
    struct gl_fragment_program program;
-   GLuint id;
+   GLuint id;  /**< serial no. to identify frag progs, never re-used */
+   GLboolean isGLSL;  /**< really, any IF/LOOP/CONT/BREAK instructions */
 };
 
 
-
-
 /* Data about a particular attempt to compile a program.  Note that
  * there can be many of these, each in a different GL state
  * corresponding to a different brw_wm_prog_key struct, with different
@@ -418,8 +419,8 @@ struct brw_context
       struct brw_tracked_state **atoms;
       GLuint nr_atoms;
 
-      GLuint nr_draw_regions;
-      struct intel_region *draw_regions[MAX_DRAW_BUFFERS];
+      GLuint nr_color_regions;
+      struct intel_region *color_regions[MAX_DRAW_BUFFERS];
       struct intel_region *depth_region;
 
       /**
@@ -627,8 +628,6 @@ struct brw_context
  * brw_vtbl.c
  */
 void brwInitVtbl( struct brw_context *brw );
-void brw_do_flush( struct brw_context *brw, 
-                  GLuint flags );
 
 /*======================================================================
  * brw_context.c
@@ -670,7 +669,9 @@ void brwInitFragProgFuncs( struct dd_function_table *functions );
  */
 void brw_upload_urb_fence(struct brw_context *brw);
 
-void brw_upload_constant_buffer_state(struct brw_context *brw);
+/* brw_curbe.c
+ */
+void brw_upload_cs_urb_state(struct brw_context *brw);
 
 
 /*======================================================================
@@ -683,6 +684,32 @@ brw_context( GLcontext *ctx )
    return (struct brw_context *)ctx;
 }
 
+static INLINE struct brw_vertex_program *
+brw_vertex_program(struct gl_vertex_program *p)
+{
+   return (struct brw_vertex_program *) p;
+}
+
+static INLINE const struct brw_vertex_program *
+brw_vertex_program_const(const struct gl_vertex_program *p)
+{
+   return (const struct brw_vertex_program *) p;
+}
+
+static INLINE struct brw_fragment_program *
+brw_fragment_program(struct gl_fragment_program *p)
+{
+   return (struct brw_fragment_program *) p;
+}
+
+static INLINE const struct brw_fragment_program *
+brw_fragment_program_const(const struct gl_fragment_program *p)
+{
+   return (const struct brw_fragment_program *) p;
+}
+
+
+
 #define DO_SETUP_BITS ((1<<(FRAG_ATTRIB_MAX)) - 1)
 
 #endif
index 4eaaa5f871b35858c165766b2b9be08b762ba93c..545dedd34ba6a120f6a59e937bb0fd89ccdb2f82 100644 (file)
@@ -53,7 +53,7 @@ static void calculate_curbe_offsets( struct brw_context *brw )
    GLuint nr_fp_regs = (brw->wm.prog_data->nr_params + 15) / 16;
    
    /* BRW_NEW_VERTEX_PROGRAM */
-   struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program;
+   const struct brw_vertex_program *vp = brw_vertex_program_const(brw->vertex_program);
    GLuint nr_vp_regs = (vp->program.Base.Parameters->NumParameters * 4 + 15) / 16;
    GLuint nr_clip_regs = 0;
    GLuint total_regs;
@@ -138,24 +138,24 @@ const struct brw_tracked_state brw_curbe_offsets = {
  * fixed-function hardware in a double-buffering scheme to avoid a
  * pipeline stall each time the contents of the curbe is changed.
  */
-void brw_upload_constant_buffer_state(struct brw_context *brw)
+void brw_upload_cs_urb_state(struct brw_context *brw)
 {
-   struct brw_constant_buffer_state cbs; 
-   memset(&cbs, 0, sizeof(cbs));
+   struct brw_cs_urb_state cs_urb;
+   memset(&cs_urb, 0, sizeof(cs_urb));
 
    /* It appears that this is the state packet for the CS unit, ie. the
     * urb entries detailed here are housed in the CS range from the
     * URB_FENCE command.
     */
-   cbs.header.opcode = CMD_CONST_BUFFER_STATE;
-   cbs.header.length = sizeof(cbs)/4 - 2;
+   cs_urb.header.opcode = CMD_CS_URB_STATE;
+   cs_urb.header.length = sizeof(cs_urb)/4 - 2;
 
    /* BRW_NEW_URB_FENCE */
-   cbs.bits0.nr_urb_entries = brw->urb.nr_cs_entries;
-   cbs.bits0.urb_entry_size = brw->urb.csize - 1;
+   cs_urb.bits0.nr_urb_entries = brw->urb.nr_cs_entries;
+   cs_urb.bits0.urb_entry_size = brw->urb.csize - 1;
 
    assert(brw->urb.nr_cs_entries);
-   BRW_CACHED_BATCH_STRUCT(brw, &cbs);
+   BRW_CACHED_BATCH_STRUCT(brw, &cs_urb);
 }
 
 static GLfloat fixed_plane[6][4] = {
@@ -174,10 +174,12 @@ static GLfloat fixed_plane[6][4] = {
 static void prepare_constant_buffer(struct brw_context *brw)
 {
    GLcontext *ctx = &brw->intel.ctx;
-   struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program;
-   struct brw_fragment_program *fp = (struct brw_fragment_program *)brw->fragment_program;
-   GLuint sz = brw->curbe.total_size;
-   GLuint bufsz = sz * 16 * sizeof(GLfloat);
+   const struct brw_vertex_program *vp =
+      brw_vertex_program_const(brw->vertex_program);
+   const struct brw_fragment_program *fp =
+      brw_fragment_program_const(brw->fragment_program);
+   const GLuint sz = brw->curbe.total_size;
+   const GLuint bufsz = sz * 16 * sizeof(GLfloat);
    GLfloat *buf;
    GLuint i;
 
@@ -189,27 +191,25 @@ static void prepare_constant_buffer(struct brw_context *brw)
    brw->curbe.tracked_state.dirty.mesa |= fp->program.Base.Parameters->StateFlags;
 
    if (sz == 0) {
-
       if (brw->curbe.last_buf) {
         free(brw->curbe.last_buf);
         brw->curbe.last_buf = NULL;
         brw->curbe.last_bufsz  = 0;
       }
-
       return;
    }
 
-   buf = (GLfloat *)malloc(bufsz);
-
-   memset(buf, 0, bufsz);
+   buf = (GLfloat *) _mesa_calloc(bufsz);
 
+   /* fragment shader constants */
    if (brw->curbe.wm_size) {
       GLuint offset = brw->curbe.wm_start * 16;
 
       _mesa_load_state_parameters(ctx, fp->program.Base.Parameters); 
 
+      /* copy float constants */
       for (i = 0; i < brw->wm.prog_data->nr_params; i++) 
-        buf[offset + i] = brw->wm.prog_data->param[i][0];
+        buf[offset + i] = *brw->wm.prog_data->param[i];
    }
 
 
@@ -244,7 +244,7 @@ static void prepare_constant_buffer(struct brw_context *brw)
       }
    }
 
-
+   /* vertex shader constants */
    if (brw->curbe.vs_size) {
       GLuint offset = brw->curbe.vs_start * 16;
       GLuint nr = vp->program.Base.Parameters->NumParameters;
@@ -252,10 +252,11 @@ static void prepare_constant_buffer(struct brw_context *brw)
       _mesa_load_state_parameters(ctx, vp->program.Base.Parameters); 
 
       for (i = 0; i < nr; i++) {
-        buf[offset + i * 4 + 0] = vp->program.Base.Parameters->ParameterValues[i][0];
-        buf[offset + i * 4 + 1] = vp->program.Base.Parameters->ParameterValues[i][1];
-        buf[offset + i * 4 + 2] = vp->program.Base.Parameters->ParameterValues[i][2];
-        buf[offset + i * 4 + 3] = vp->program.Base.Parameters->ParameterValues[i][3];
+         const GLfloat *value = vp->program.Base.Parameters->ParameterValues[i];
+        buf[offset + i * 4 + 0] = value[0];
+        buf[offset + i * 4 + 1] = value[1];
+        buf[offset + i * 4 + 2] = value[2];
+        buf[offset + i * 4 + 3] = value[3];
       }
    }
 
@@ -274,11 +275,14 @@ static void prepare_constant_buffer(struct brw_context *brw)
        brw->curbe.last_buf &&
        bufsz == brw->curbe.last_bufsz &&
        memcmp(buf, brw->curbe.last_buf, bufsz) == 0) {
-      free(buf);
+      /* constants have not changed */
+      _mesa_free(buf);
    } 
    else {
+      /* constants have changed */
       if (brw->curbe.last_buf)
-        free(brw->curbe.last_buf);
+        _mesa_free(brw->curbe.last_buf);
+
       brw->curbe.last_buf = buf;
       brw->curbe.last_bufsz = bufsz;
 
index 39c32255f8bb3f9f2942ad999639ad232755baa7..590b064c7ef119c47960d56c548e98e4e9170c7c 100644 (file)
 
 
 #define CMD_URB_FENCE                 0x6000
-#define CMD_CONST_BUFFER_STATE        0x6001
+#define CMD_CS_URB_STATE              0x6001
 #define CMD_CONST_BUFFER              0x6002
 
 #define CMD_STATE_BASE_ADDRESS        0x6101
index 99fd587e9fc04a5a7f6752f4279d6daf87ef89d9..5342622a737b9414c5f3e6f9aedb07764212bf1d 100644 (file)
@@ -127,6 +127,7 @@ static void brw_emit_prim(struct brw_context *brw,
                          uint32_t hw_prim)
 {
    struct brw_3d_primitive prim_packet;
+   struct intel_context *intel = &brw->intel;
 
    if (INTEL_DEBUG & DEBUG_PRIMS)
       _mesa_printf("PRIM: %s %d %d\n", _mesa_lookup_enum_by_nr(prim->mode), 
@@ -146,10 +147,27 @@ static void brw_emit_prim(struct brw_context *brw,
 
    /* Can't wrap here, since we rely on the validated state. */
    brw->no_batch_wrap = GL_TRUE;
+
+   /* If we're set to always flush, do it before and after the primitive emit.
+    * We want to catch both missed flushes that hurt instruction/state cache
+    * and missed flushes of the render cache as it heads to other parts of
+    * the besides the draw code.
+    */
+   if (intel->always_flush_cache) {
+      BEGIN_BATCH(1, IGNORE_CLIPRECTS);
+      OUT_BATCH(intel->vtbl.flush_cmd());
+      ADVANCE_BATCH();
+   }
    if (prim_packet.verts_per_instance) {
       intel_batchbuffer_data( brw->intel.batch, &prim_packet,
                              sizeof(prim_packet), LOOP_CLIPRECTS);
    }
+   if (intel->always_flush_cache) {
+      BEGIN_BATCH(1, IGNORE_CLIPRECTS);
+      OUT_BATCH(intel->vtbl.flush_cmd());
+      ADVANCE_BATCH();
+   }
+
    brw->no_batch_wrap = GL_FALSE;
 }
 
@@ -194,9 +212,16 @@ static GLboolean check_fallbacks( struct brw_context *brw,
    GLcontext *ctx = &brw->intel.ctx;
    GLuint i;
 
-   if (!brw->intel.strict_conformance)
+   /* If we don't require strict OpenGL conformance, never 
+    * use fallbacks.  If we're forcing fallbacks, always
+    * use fallfacks.
+    */
+   if (brw->intel.conformance_mode == 0)
       return GL_FALSE;
 
+   if (brw->intel.conformance_mode == 2)
+      return GL_TRUE;
+
    if (ctx->Polygon.SmoothFlag) {
       for (i = 0; i < nr_prims; i++)
         if (reduced_prim[prim[i].mode] == GL_TRIANGLES) 
@@ -220,7 +245,7 @@ static GLboolean check_fallbacks( struct brw_context *brw,
         /* GS doesn't get enough information to know when to reset
          * the stipple counter?!?
          */
-        if (prim[i].mode == GL_LINE_LOOP) 
+        if (prim[i].mode == GL_LINE_LOOP || prim[i].mode == GL_LINE_STRIP
            return GL_TRUE;
            
         if (prim[i].mode == GL_POLYGON &&
@@ -230,13 +255,46 @@ static GLboolean check_fallbacks( struct brw_context *brw,
       }
    }
 
-
    if (ctx->Point.SmoothFlag) {
       for (i = 0; i < nr_prims; i++)
         if (prim[i].mode == GL_POINTS) 
            return GL_TRUE;
    }
+
+   /* BRW hardware doesn't handle GL_CLAMP texturing correctly;
+    * brw_wm_sampler_state:translate_wrap_mode() treats GL_CLAMP
+    * as GL_CLAMP_TO_EDGE instead.  If we're using GL_CLAMP, and
+    * we want strict conformance, force the fallback.
+    * Right now, we only do this for 2D textures.
+    */
+   {
+      int u;
+      for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
+         struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u];
+         if (texUnit->Enabled) {
+            if (texUnit->Enabled & TEXTURE_1D_BIT) {
+               if (texUnit->CurrentTex[TEXTURE_1D_INDEX]->WrapS == GL_CLAMP) {
+                   return GL_TRUE;
+               }
+            }
+            if (texUnit->Enabled & TEXTURE_2D_BIT) {
+               if (texUnit->CurrentTex[TEXTURE_2D_INDEX]->WrapS == GL_CLAMP ||
+                   texUnit->CurrentTex[TEXTURE_2D_INDEX]->WrapT == GL_CLAMP) {
+                   return GL_TRUE;
+               }
+            }
+            if (texUnit->Enabled & TEXTURE_3D_BIT) {
+               if (texUnit->CurrentTex[TEXTURE_3D_INDEX]->WrapS == GL_CLAMP ||
+                   texUnit->CurrentTex[TEXTURE_3D_INDEX]->WrapT == GL_CLAMP ||
+                   texUnit->CurrentTex[TEXTURE_3D_INDEX]->WrapR == GL_CLAMP) {
+                   return GL_TRUE;
+               }
+            }
+         }
+      }
+   }
       
+   /* Nothing stopping us from the fast path now */
    return GL_FALSE;
 }
 
@@ -261,11 +319,18 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
    if (ctx->NewState)
       _mesa_update_state( ctx );
 
+   /* We have to validate the textures *before* checking for fallbacks;
+    * otherwise, the software fallback won't be able to rely on the
+    * texture state, the firstLevel and lastLevel fields won't be
+    * set in the intel texture object (they'll both be 0), and the 
+    * software fallback will segfault if it attempts to access any
+    * texture level other than level 0.
+    */
+   brw_validate_textures( brw );
+
    if (check_fallbacks(brw, prim, nr_prims))
       return GL_FALSE;
 
-   brw_validate_textures( brw );
-
    /* Bind all inputs, derive varying and size information:
     */
    brw_merge_inputs( brw, arrays );
@@ -346,6 +411,8 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
       retval = GL_TRUE;
    }
 
+   if (intel->always_flush_batch)
+      intel_batchbuffer_flush(intel->batch);
  out:
    UNLOCK_HARDWARE(intel);
 
index b3ae4eef334959ce7bc26fa6324b84b61a5a1d44..c53efba599105ed1e3bdadc1c08af287551d896e 100644 (file)
@@ -129,3 +129,126 @@ const GLuint *brw_get_program( struct brw_compile *p,
    return (const GLuint *)p->store;
 }
 
+
+
+/**
+ * Subroutine calls require special attention.
+ * Mesa instructions may be expanded into multiple hardware instructions
+ * so the prog_instruction::BranchTarget field can't be used as an index
+ * into the hardware instructions.
+ *
+ * The BranchTarget field isn't needed, however.  Mesa's GLSL compiler
+ * emits CAL and BGNSUB instructions with labels that can be used to map
+ * subroutine calls to actual subroutine code blocks.
+ *
+ * The structures and function here implement patching of CAL instructions
+ * so they jump to the right subroutine code...
+ */
+
+
+/**
+ * For each OPCODE_BGNSUB we create one of these.
+ */
+struct brw_glsl_label
+{
+   const char *name; /**< the label string */
+   GLuint position;  /**< the position of the brw instruction for this label */
+   struct brw_glsl_label *next;  /**< next in linked list */
+};
+
+
+/**
+ * For each OPCODE_CAL we create one of these.
+ */
+struct brw_glsl_call
+{
+   GLuint call_inst_pos;  /**< location of the CAL instruction */
+   const char *sub_name;  /**< name of subroutine to call */
+   struct brw_glsl_call *next;  /**< next in linked list */
+};
+
+
+/**
+ * Called for each OPCODE_BGNSUB.
+ */
+void
+brw_save_label(struct brw_compile *c, const char *name, GLuint position)
+{
+   struct brw_glsl_label *label = CALLOC_STRUCT(brw_glsl_label);
+   label->name = name;
+   label->position = position;
+   label->next = c->first_label;
+   c->first_label = label;
+}
+
+
+/**
+ * Called for each OPCODE_CAL.
+ */
+void
+brw_save_call(struct brw_compile *c, const char *name, GLuint call_pos)
+{
+   struct brw_glsl_call *call = CALLOC_STRUCT(brw_glsl_call);
+   call->call_inst_pos = call_pos;
+   call->sub_name = name;
+   call->next = c->first_call;
+   c->first_call = call;
+}
+
+
+/**
+ * Lookup a label, return label's position/offset.
+ */
+static GLuint
+brw_lookup_label(struct brw_compile *c, const char *name)
+{
+   const struct brw_glsl_label *label;
+   for (label = c->first_label; label; label = label->next) {
+      if (strcmp(name, label->name) == 0) {
+         return label->position;
+      }
+   }
+   abort();  /* should never happen */
+   return ~0;
+}
+
+
+/**
+ * When we're done generating code, this function is called to resolve
+ * subroutine calls.
+ */
+void
+brw_resolve_cals(struct brw_compile *c)
+{
+    const struct brw_glsl_call *call;
+
+    for (call = c->first_call; call; call = call->next) {
+        const GLuint sub_loc = brw_lookup_label(c, call->sub_name);
+       struct brw_instruction *brw_call_inst = &c->store[call->call_inst_pos];
+       struct brw_instruction *brw_sub_inst = &c->store[sub_loc];
+       GLint offset = brw_sub_inst - brw_call_inst;
+
+       /* patch brw_inst1 to point to brw_inst2 */
+       brw_set_src1(brw_call_inst, brw_imm_d(offset * 16));
+    }
+
+    /* free linked list of calls */
+    {
+        struct brw_glsl_call *call, *next;
+        for (call = c->first_call; call; call = next) {
+           next = call->next;
+           _mesa_free(call);
+       }
+       c->first_call = NULL;
+    }
+
+    /* free linked list of labels */
+    {
+        struct brw_glsl_label *label, *next;
+       for (label = c->first_label; label; label = next) {
+           next = label->next;
+           _mesa_free(label);
+       }
+       c->first_label = NULL;
+    }
+}
index 9e2b39af9bba7dd9e71dca08cbb91c6ee0e1cb9e..eb99c21711ed44b82d4ddddf53ec9fffb9fa6147 100644 (file)
@@ -91,8 +91,13 @@ struct brw_indirect {
 };
 
 
+struct brw_glsl_label;
+struct brw_glsl_call;
+
+
+
 #define BRW_EU_MAX_INSN_STACK 5
-#define BRW_EU_MAX_INSN 1200
+#define BRW_EU_MAX_INSN 4000
 
 struct brw_compile {
    struct brw_instruction store[BRW_EU_MAX_INSN];
@@ -106,9 +111,22 @@ struct brw_compile {
    GLuint flag_value;
    GLboolean single_program_flow;
    struct brw_context *brw;
+
+   struct brw_glsl_label *first_label;  /**< linked list of labels */
+   struct brw_glsl_call *first_call;    /**< linked list of CALs */
 };
 
 
+void
+brw_save_label(struct brw_compile *c, const char *name, GLuint position);
+
+void
+brw_save_call(struct brw_compile *c, const char *name, GLuint call_pos);
+
+void
+brw_resolve_cals(struct brw_compile *c);
+
+
 
 static INLINE int type_sz( GLuint type )
 {
@@ -152,6 +170,13 @@ static INLINE struct brw_reg brw_reg( GLuint file,
                                       GLuint writemask )
 {
    struct brw_reg reg;
+   if (type == BRW_GENERAL_REGISTER_FILE)
+      assert(nr < 128);
+   else if (type == BRW_MESSAGE_REGISTER_FILE)
+      assert(nr < 9);
+   else if (type == BRW_ARCHITECTURE_REGISTER_FILE)
+      assert(nr <= BRW_ARF_IP);
+
    reg.type = type;
    reg.file = file;
    reg.nr = nr;
index 4e099b5945cc82b33d7394b3dcdd16e48e778b0d..6dce1ca48e8e524f8cc30fc00a8ba444843c9cd5 100644 (file)
@@ -55,6 +55,9 @@ static void guess_execution_size( struct brw_instruction *insn,
 static void brw_set_dest( struct brw_instruction *insn,
                          struct brw_reg dest )
 {
+   if (dest.type != BRW_ARCHITECTURE_REGISTER_FILE)
+      assert(dest.nr < 128);
+
    insn->bits1.da1.dest_reg_file = dest.file;
    insn->bits1.da1.dest_reg_type = dest.type;
    insn->bits1.da1.dest_address_mode = dest.address_mode;
@@ -96,10 +99,13 @@ static void brw_set_dest( struct brw_instruction *insn,
 }
 
 static void brw_set_src0( struct brw_instruction *insn,
-                     struct brw_reg reg )
+                          struct brw_reg reg )
 {
    assert(reg.file != BRW_MESSAGE_REGISTER_FILE);
 
+   if (reg.type != BRW_ARCHITECTURE_REGISTER_FILE)
+      assert(reg.nr < 128);
+
    insn->bits1.da1.src0_reg_file = reg.file;
    insn->bits1.da1.src0_reg_type = reg.type;
    insn->bits2.da1.src0_abs = reg.abs;
@@ -169,10 +175,12 @@ static void brw_set_src0( struct brw_instruction *insn,
 
 
 void brw_set_src1( struct brw_instruction *insn,
-                         struct brw_reg reg )
+                   struct brw_reg reg )
 {
    assert(reg.file != BRW_MESSAGE_REGISTER_FILE);
 
+   assert(reg.nr < 128);
+
    insn->bits1.da1.src1_reg_file = reg.file;
    insn->bits1.da1.src1_reg_type = reg.type;
    insn->bits3.da1.src1_abs = reg.abs;
@@ -323,13 +331,13 @@ static void brw_set_dp_read_message( struct brw_instruction *insn,
 }
 
 static void brw_set_sampler_message(struct brw_context *brw,
-                 struct brw_instruction *insn,
-                                    GLuint binding_table_index,
-                                    GLuint sampler,
-                                    GLuint msg_type,
-                                    GLuint response_length,
-                                    GLuint msg_length,
-                                    GLboolean eot)
+                                    struct brw_instruction *insn,
+                                    GLuint binding_table_index,
+                                    GLuint sampler,
+                                    GLuint msg_type,
+                                    GLuint response_length,
+                                    GLuint msg_length,
+                                    GLboolean eot)
 {
    brw_set_src1(insn, brw_imm_d(0));
 
@@ -407,7 +415,7 @@ static struct brw_instruction *brw_alu2(struct brw_compile *p,
  * Convenience routines.
  */
 #define ALU1(OP)                                       \
-struct brw_instruction *brw_##OP(struct brw_compile *p,                        \
+struct brw_instruction *brw_##OP(struct brw_compile *p,        \
              struct brw_reg dest,                      \
              struct brw_reg src0)                      \
 {                                                      \
@@ -415,7 +423,7 @@ struct brw_instruction *brw_##OP(struct brw_compile *p,                     \
 }
 
 #define ALU2(OP)                                       \
-struct brw_instruction *brw_##OP(struct brw_compile *p,                        \
+struct brw_instruction *brw_##OP(struct brw_compile *p,        \
              struct brw_reg dest,                      \
              struct brw_reg src0,                      \
              struct brw_reg src1)                      \
@@ -469,9 +477,9 @@ void brw_NOP(struct brw_compile *p)
  */
 
 struct brw_instruction *brw_JMPI(struct brw_compile *p, 
-             struct brw_reg dest,
-             struct brw_reg src0,
-             struct brw_reg src1)
+                                 struct brw_reg dest,
+                                 struct brw_reg src0,
+                                 struct brw_reg src1)
 {
    struct brw_instruction *insn = brw_alu2(p, BRW_OPCODE_JMPI, dest, src0, src1);
 
@@ -674,7 +682,7 @@ struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size)
 
 
 struct brw_instruction *brw_WHILE(struct brw_compile *p, 
-              struct brw_instruction *do_insn)
+                                  struct brw_instruction *do_insn)
 {
    struct brw_instruction *insn;
 
@@ -931,13 +939,13 @@ void brw_dp_READ_16( struct brw_compile *p,
 
 
 void brw_fb_WRITE(struct brw_compile *p,
-                  struct brw_reg dest,
-                  GLuint msg_reg_nr,
-                  struct brw_reg src0,
-                  GLuint binding_table_index,
-                  GLuint msg_length,
-                  GLuint response_length,
-                  GLboolean eot)
+                  struct brw_reg dest,
+                  GLuint msg_reg_nr,
+                  struct brw_reg src0,
+                  GLuint binding_table_index,
+                  GLuint msg_length,
+                  GLuint response_length,
+                  GLboolean eot)
 {
    struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND);
    
@@ -973,8 +981,8 @@ void brw_SAMPLE(struct brw_compile *p,
 {
    GLboolean need_stall = 0;
    
-   if(writemask == 0) {
-/*       _mesa_printf("%s: zero writemask??\n", __FUNCTION__); */
+   if (writemask == 0) {
+      /*_mesa_printf("%s: zero writemask??\n", __FUNCTION__); */
       return;
    }
    
@@ -1006,7 +1014,7 @@ void brw_SAMPLE(struct brw_compile *p,
 
       if (newmask != writemask) {
         need_stall = 1;
-/*      _mesa_printf("need stall %x %x\n", newmask , writemask); */
+         /* _mesa_printf("need stall %x %x\n", newmask , writemask); */
       }
       else {
         struct brw_reg m1 = brw_message_reg(msg_reg_nr);
@@ -1047,8 +1055,7 @@ void brw_SAMPLE(struct brw_compile *p,
                              eot);
    }
 
-   if (need_stall)
-   {
+   if (need_stall) {
       struct brw_reg reg = vec8(offset(dest, response_length-1));
 
       /*  mov (8) r9.0<1>:f    r9.0<8;8,1>:f    { Align1 }
index e63098fdd4a9c7fc4bc79d09064c241834af1524..299357409ce9c29ef53f8161a348d321433568b5 100644 (file)
@@ -75,8 +75,8 @@ static GLboolean do_check_fallback(struct brw_context *brw)
    
    /* _NEW_STENCIL 
     */
-   if (ctx->Stencil.Enabled && 
-       !brw->intel.hw_stencil) {
+   if (ctx->Stencil._Enabled &&
+       (ctx->DrawBuffer->Name == 0 && !brw->intel.hw_stencil)) {
       DBG("FALLBACK: stencil\n");
       return GL_TRUE;
    }
index 9dcdad7b4ef590cb10d949b57d9bb94c4d241591..5c94a49f60afeeda411c783702cd6ccf74de8bcc 100644 (file)
@@ -178,7 +178,7 @@ static void upload_psp_urb_cbs(struct brw_context *brw )
 {
    upload_pipelined_state_pointers(brw);
    brw_upload_urb_fence(brw);
-   brw_upload_constant_buffer_state(brw);
+   brw_upload_cs_urb_state(brw);
 }
 
 const struct brw_tracked_state brw_psp_urb_cbs = {
@@ -290,8 +290,21 @@ static void upload_polygon_stipple(struct brw_context *brw)
    bps.header.opcode = CMD_POLY_STIPPLE_PATTERN;
    bps.header.length = sizeof(bps)/4-2;
 
-   for (i = 0; i < 32; i++)
-      bps.stipple[i] = ctx->PolygonStipple[31 - i]; /* invert */
+   /* Polygon stipple is provided in OpenGL order, i.e. bottom
+    * row first.  If we're rendering to a window (i.e. the
+    * default frame buffer object, 0), then we need to invert
+    * it to match our pixel layout.  But if we're rendering
+    * to a FBO (i.e. any named frame buffer object), we *don't*
+    * need to invert - we already match the layout.
+    */
+   if (ctx->DrawBuffer->Name == 0) {
+      for (i = 0; i < 32; i++)
+         bps.stipple[i] = ctx->PolygonStipple[31 - i]; /* invert */
+   }
+   else {
+      for (i = 0; i < 32; i++)
+         bps.stipple[i] = ctx->PolygonStipple[i]; /* don't invert */
+   }
 
    BRW_CACHED_BATCH_STRUCT(brw, &bps);
 }
@@ -319,8 +332,22 @@ static void upload_polygon_stipple_offset(struct brw_context *brw)
    bpso.header.opcode = CMD_POLY_STIPPLE_OFFSET;
    bpso.header.length = sizeof(bpso)/4-2;
 
-   bpso.bits0.x_offset = (32 - (dPriv->x & 31)) & 31;
-   bpso.bits0.y_offset = (32 - ((dPriv->y + dPriv->h) & 31)) & 31;
+   /* If we're drawing to a system window (ctx->DrawBuffer->Name == 0),
+    * we have to invert the Y axis in order to match the OpenGL
+    * pixel coordinate system, and our offset must be matched
+    * to the window position.  If we're drawing to a FBO
+    * (ctx->DrawBuffer->Name != 0), then our native pixel coordinate
+    * system works just fine, and there's no window system to
+    * worry about.
+    */
+   if (brw->intel.ctx.DrawBuffer->Name == 0) {
+      bpso.bits0.x_offset = (32 - (dPriv->x & 31)) & 31;
+      bpso.bits0.y_offset = (32 - ((dPriv->y + dPriv->h) & 31)) & 31;
+   }
+   else {
+      bpso.bits0.y_offset = 0;
+      bpso.bits0.x_offset = 0;
+   }
 
    BRW_CACHED_BATCH_STRUCT(brw, &bpso);
 }
index 0c86911044b80512cac879aee73493e79e63d12a..d90bd820386a659cd3b565228f62fa3ac541579f 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "brw_context.h"
 #include "brw_util.h"
+#include "brw_wm.h"
 
 static void brwBindProgram( GLcontext *ctx,
                            GLenum target, 
@@ -94,7 +95,6 @@ static struct gl_program *brwNewProgram( GLcontext *ctx,
 static void brwDeleteProgram( GLcontext *ctx,
                              struct gl_program *prog )
 {
-   
    _mesa_delete_program( ctx, prog );
 }
 
@@ -110,30 +110,35 @@ static void brwProgramStringNotify( GLcontext *ctx,
                                    GLenum target,
                                    struct gl_program *prog )
 {
+   struct brw_context *brw = brw_context(ctx);
    if (target == GL_FRAGMENT_PROGRAM_ARB) {
       struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
-      struct brw_context *brw = brw_context(ctx);
-      struct brw_fragment_program *p = (struct brw_fragment_program *)prog;
-      struct brw_fragment_program *fp = (struct brw_fragment_program *)brw->fragment_program;
+      struct brw_fragment_program *newFP = brw_fragment_program(fprog);
+      const struct brw_fragment_program *curFP =
+         brw_fragment_program_const(brw->fragment_program);
+
       if (fprog->FogOption) {
          _mesa_append_fog_code(ctx, fprog);
          fprog->FogOption = GL_NONE;
       }
 
-      if (p == fp)
+      if (newFP == curFP)
         brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
-      p->id = brw->program_id++;      
+      newFP->id = brw->program_id++;      
+      newFP->isGLSL = brw_wm_is_glsl(fprog);
    }
    else if (target == GL_VERTEX_PROGRAM_ARB) {
-      struct brw_context *brw = brw_context(ctx);
-      struct brw_vertex_program *p = (struct brw_vertex_program *)prog;
-      struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program;
-      if (p == vp)
+      struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog;
+      struct brw_vertex_program *newVP = brw_vertex_program(vprog);
+      const struct brw_vertex_program *curVP =
+         brw_vertex_program_const(brw->vertex_program);
+
+      if (newVP == curVP)
         brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM;
-      if (p->program.IsPositionInvariant) {
-        _mesa_insert_mvp_code(ctx, &p->program);
+      if (newVP->program.IsPositionInvariant) {
+        _mesa_insert_mvp_code(ctx, &newVP->program);
       }
-      p->id = brw->program_id++;      
+      newVP->id = brw->program_id++;      
 
       /* Also tell tnl about it:
        */
index 8c1711538af5de59e8c2729e119565945a43c5f8..c3c85978f4d012d7f1ed8807bf177badfafb0e2c 100644 (file)
@@ -167,8 +167,14 @@ static void upload_sf_prog(struct brw_context *brw)
    key.do_twoside_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide);
 
    /* _NEW_POLYGON */
-   if (key.do_twoside_color)
-      key.frontface_ccw = (ctx->Polygon.FrontFace == GL_CCW);
+   if (key.do_twoside_color) {
+      /* If we're rendering to a FBO, we have to invert the polygon
+       * face orientation, just as we invert the viewport in
+       * sf_unit_create_from_key().  ctx->DrawBuffer->Name will be
+       * nonzero if we're rendering to such an FBO.
+       */
+      key.frontface_ccw = (ctx->Polygon.FrontFace == GL_CCW) ^ (ctx->DrawBuffer->Name != 0);
+   }
 
    dri_bo_unreference(brw->sf.prog_bo);
    brw->sf.prog_bo = brw_search_cache(&brw->cache, BRW_SF_PROG,
index e96d5354b300244fe20265ab515ae05c8d5dfc85..93a9686f718f49fd9e6f66d66dc5a921eb355c89 100644 (file)
@@ -44,6 +44,7 @@ static void upload_sf_vp(struct brw_context *brw)
    struct brw_sf_viewport sfv;
    GLfloat y_scale, y_bias;
    const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0);
+   const GLfloat *v = ctx->Viewport._WindowMap.m;
 
    memset(&sfv, 0, sizeof(sfv));
 
@@ -58,8 +59,6 @@ static void upload_sf_vp(struct brw_context *brw)
 
    /* _NEW_VIEWPORT */
 
-   const GLfloat *v = ctx->Viewport._WindowMap.m;
-
    sfv.viewport.m00 = v[MAT_SX];
    sfv.viewport.m11 = v[MAT_SY] * y_scale;
    sfv.viewport.m22 = v[MAT_SZ] * depth_scale;
index df839c5b30059eb679ddbd40550df8ae1a28a054..81b0a45998f05c41b950728bea2c2078c67df79a 100644 (file)
@@ -52,7 +52,6 @@ const struct brw_tracked_state brw_cc_vp;
 const struct brw_tracked_state brw_check_fallback;
 const struct brw_tracked_state brw_clip_prog;
 const struct brw_tracked_state brw_clip_unit;
-const struct brw_tracked_state brw_constant_buffer_state;
 const struct brw_tracked_state brw_constant_buffer;
 const struct brw_tracked_state brw_curbe_offsets;
 const struct brw_tracked_state brw_invarient_state;
index dc87859f3f50150284dea31e869c57e08c25b2e4..811940edc0524b0fde8f57e41de36a0fa9706210 100644 (file)
@@ -97,8 +97,6 @@ void brw_clear_batch_cache_flush( struct brw_context *brw )
 {
    clear_batch_cache(brw);
 
-/*    brw_do_flush(brw, BRW_FLUSH_STATE_CACHE|BRW_FLUSH_READ_CACHE); */
-   
    brw->state.dirty.mesa |= ~0;
    brw->state.dirty.brw |= ~0;
    brw->state.dirty.cache |= ~0;
index b28c57c2bcf759babf844024f5b3124f92d8e691..5d332d010c2fb3f3df752f32b9cbcef7674f3797 100644 (file)
@@ -162,6 +162,14 @@ static void brw_debug_prog(const char *name, dri_bo *prog)
       fprintf(stderr, "%8s: 0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
              name, (unsigned int)prog->offset + i * 4 * 4,
              data[i * 4], data[i * 4 + 1], data[i * 4 + 2], data[i * 4 + 3]);
+      /* Stop at the end of the program.  It'd be nice to keep track of the actual
+       * intended program size instead of guessing like this.
+       */
+      if (data[i * 4 + 0] == 0 &&
+         data[i * 4 + 1] == 0 &&
+         data[i * 4 + 2] == 0 &&
+         data[i * 4 + 3] == 0)
+        break;
    }
 
    dri_bo_unmap(prog);
index d97ff27f0a13fadbe76b3860f42c8ed92c7f6c63..89e298120342b6b7a97369d16f3d069e6008199f 100644 (file)
@@ -439,7 +439,7 @@ struct brw_urb_fence
    } bits1;
 };
 
-struct brw_constant_buffer_state /* previously brw_command_streamer */
+struct brw_cs_urb_state
 {
    struct header header;
 
index 9977677fd74adbc9301de20f02a37a116831c8c8..d29eb17f8cf875e155597d6003d83fb7fbc77d53 100644 (file)
@@ -170,8 +170,8 @@ static void calc_wm_input_sizes( struct brw_context *brw )
 {
    GLcontext *ctx = &brw->intel.ctx;
    /* BRW_NEW_VERTEX_PROGRAM */
-   struct brw_vertex_program *vp = 
-      (struct brw_vertex_program *)brw->vertex_program;
+   const struct brw_vertex_program *vp =
+      brw_vertex_program_const(brw->vertex_program);
    /* BRW_NEW_INPUT_DIMENSIONS */
    struct tracker t;
    GLuint insn;
index 24b7dc30fe1d8cdb6e60cd51fbbd7b24b6c68e80..3807dff991924ec4062f1c292ea2e16335cff37a 100644 (file)
@@ -156,6 +156,12 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
 
    c->prog_data.urb_entry_size = (c->nr_outputs+2+3)/4;
    c->prog_data.total_grf = reg;
+
+   if (INTEL_DEBUG & DEBUG_VS) {
+      _mesa_printf("%s NumAddrRegs %d\n", __FUNCTION__, c->vp->program.Base.NumAddressRegs);
+      _mesa_printf("%s NumTemps %d\n", __FUNCTION__, c->vp->program.Base.NumTemporaries);
+      _mesa_printf("%s reg = %d\n", __FUNCTION__, reg);
+   }
 }
 
 
@@ -658,7 +664,7 @@ static void emit_nrm( struct brw_vs_compile *c,
 /* TODO: relative addressing!
  */
 static struct brw_reg get_reg( struct brw_vs_compile *c,
-                              GLuint file,
+                              gl_register_file file,
                               GLuint index )
 {
 
@@ -954,36 +960,27 @@ static void emit_vertex_write( struct brw_vs_compile *c)
 }
 
 
+/**
+ * Called after code generation to resolve subroutine calls and the
+ * END instruction.
+ * \param end_inst  points to brw code for END instruction
+ * \param last_inst  points to last instruction emitted before vertex write
+ */
 static void 
-post_vs_emit( struct brw_vs_compile *c, struct brw_instruction *end_inst )
+post_vs_emit( struct brw_vs_compile *c,
+              struct brw_instruction *end_inst,
+              struct brw_instruction *last_inst )
 {
-   GLuint nr_insns = c->vp->program.Base.NumInstructions;
-   GLuint insn, target_insn;
-   struct prog_instruction *inst1, *inst2;
-   struct brw_instruction *brw_inst1, *brw_inst2;
-   int offset;
-   for (insn = 0; insn < nr_insns; insn++) {
-       inst1 = &c->vp->program.Base.Instructions[insn];
-       brw_inst1 = inst1->Data;
-       switch (inst1->Opcode) {
-          case OPCODE_CAL:
-          case OPCODE_BRA:
-              target_insn = inst1->BranchTarget;
-              inst2 = &c->vp->program.Base.Instructions[target_insn];
-              brw_inst2 = inst2->Data;
-              offset = brw_inst2 - brw_inst1;
-              brw_set_src1(brw_inst1, brw_imm_d(offset*16));
-              break;
-          case OPCODE_END:
-              offset = end_inst - brw_inst1;
-              brw_set_src1(brw_inst1, brw_imm_d(offset*16));
-              break;
-          default:
-              break;
-       }
-   }
+   GLint offset;
+
+   brw_resolve_cals(&c->func);
+
+   /* patch up the END code to jump past subroutines, etc */
+   offset = last_inst - end_inst;
+   brw_set_src1(end_inst, brw_imm_d(offset * 16));
 }
 
+
 /* Emit the fragment program instructions here.
  */
 void brw_vs_emit(struct brw_vs_compile *c )
@@ -992,7 +989,8 @@ void brw_vs_emit(struct brw_vs_compile *c )
    struct brw_compile *p = &c->func;
    GLuint nr_insns = c->vp->program.Base.NumInstructions;
    GLuint insn, if_insn = 0;
-   struct brw_instruction *end_inst;
+   GLuint end_offset = 0;
+   struct brw_instruction *end_inst, *last_inst;
    struct brw_instruction *if_inst[MAX_IFSN];
    struct brw_indirect stack_index = brw_indirect(0, 0);   
 
@@ -1035,7 +1033,6 @@ void brw_vs_emit(struct brw_vs_compile *c )
       
       /* Get argument regs.  SWZ is special and does this itself.
        */
-      inst->Data = &p->store[p->nr_insn];
       if (inst->Opcode != OPCODE_SWZ)
          for (i = 0; i < 3; i++) {
              struct prog_src_register *src = &inst->SrcReg[i];
@@ -1203,7 +1200,7 @@ void brw_vs_emit(struct brw_vs_compile *c )
         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));
-        inst->Data = &p->store[p->nr_insn];
+         brw_save_call(p, inst->Comment, p->nr_insn);
         brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16));
          break;
       case OPCODE_RET:
@@ -1212,14 +1209,23 @@ void brw_vs_emit(struct brw_vs_compile *c )
         brw_set_access_mode(p, BRW_ALIGN_1);
          brw_MOV(p, brw_ip_reg(), deref_1d(stack_index, 0));
         brw_set_access_mode(p, BRW_ALIGN_16);
+        break;
       case OPCODE_END: 
+         end_offset = p->nr_insn;
+         /* this instruction will get patched later to jump past subroutine
+          * code, etc.
+          */
          brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16));
          break;
       case OPCODE_PRINT:
+         /* no-op */
+         break;
       case OPCODE_BGNSUB:
+         brw_save_label(p, inst->Comment, p->nr_insn);
+         break;
       case OPCODE_ENDSUB:
-         /* no-op instructions */
-        break;
+         /* no-op */
+         break;
       default:
         _mesa_problem(NULL, "Unsupported opcode %i (%s) in vertex shader",
                        inst->Opcode, inst->Opcode < MAX_OPCODE ?
@@ -1257,9 +1263,11 @@ void brw_vs_emit(struct brw_vs_compile *c )
       release_tmps(c);
    }
 
-   end_inst = &p->store[p->nr_insn];
+   end_inst = &p->store[end_offset];
+   last_inst = &p->store[p->nr_insn];
+
+   /* The END instruction will be patched to jump to this code */
    emit_vertex_write(c);
-   post_vs_emit(c, end_inst);
-   for (insn = 0; insn < nr_insns; insn++)
-       c->vp->program.Base.Instructions[insn].Data = NULL;
+
+   post_vs_emit(c, end_inst, last_inst);
 }
index b501a59ccd5128a3e220a8d06c7741d0c84a1bc5..960bbb311e32f459ab654018c89e3e6516801073 100644 (file)
@@ -67,11 +67,13 @@ static void brw_destroy_context( struct intel_context *intel )
    brw_destroy_state(brw);
    brw_draw_destroy( brw );
 
+   _mesa_free(brw->wm.compile_data);
+
    brw_FrameBufferTexDestroy( brw );
 
-   for (i = 0; i < brw->state.nr_draw_regions; i++)
-      intel_region_release(&brw->state.draw_regions[i]);
-   brw->state.nr_draw_regions = 0;
+   for (i = 0; i < brw->state.nr_color_regions; i++)
+      intel_region_release(&brw->state.color_regions[i]);
+   brw->state.nr_color_regions = 0;
    intel_region_release(&brw->state.depth_region);
 
    dri_bo_release(&brw->curbe.curbe_bo);
@@ -90,6 +92,7 @@ static void brw_destroy_context( struct intel_context *intel )
    dri_bo_release(&brw->wm.bind_bo);
    for (i = 0; i < BRW_WM_MAX_SURF; i++)
       dri_bo_release(&brw->wm.surf_bo[i]);
+   dri_bo_release(&brw->wm.sampler_bo);
    dri_bo_release(&brw->wm.prog_bo);
    dri_bo_release(&brw->wm.state_bo);
    dri_bo_release(&brw->cc.prog_bo);
@@ -102,25 +105,25 @@ static void brw_destroy_context( struct intel_context *intel )
  * called from intelDrawBuffer()
  */
 static void brw_set_draw_region( struct intel_context *intel, 
-                                 struct intel_region *draw_regions[],
+                                 struct intel_region *color_regions[],
                                  struct intel_region *depth_region,
-                                 GLuint num_regions)
+                                 GLuint num_color_regions)
 {
    struct brw_context *brw = brw_context(&intel->ctx);
-   int i;
+   GLuint i;
 
    /* release old color/depth regions */
    if (brw->state.depth_region != depth_region)
       brw->state.dirty.brw |= BRW_NEW_DEPTH_BUFFER;
-   for (i = 0; i < brw->state.nr_draw_regions; i++)
-       intel_region_release(&brw->state.draw_regions[i]);
+   for (i = 0; i < brw->state.nr_color_regions; i++)
+       intel_region_release(&brw->state.color_regions[i]);
    intel_region_release(&brw->state.depth_region);
 
    /* reference new color/depth regions */
-   for (i = 0; i < num_regions; i++)
-       intel_region_reference(&brw->state.draw_regions[i], draw_regions[i]);
+   for (i = 0; i < num_color_regions; i++)
+       intel_region_reference(&brw->state.color_regions[i], color_regions[i]);
    intel_region_reference(&brw->state.depth_region, depth_region);
-   brw->state.nr_draw_regions = num_regions;
+   brw->state.nr_color_regions = num_color_regions;
 }
 
 
@@ -181,23 +184,6 @@ static void brw_note_unlock( struct intel_context *intel )
 }
 
 
-void brw_do_flush( struct brw_context *brw, GLuint flags )
-{
-   struct brw_mi_flush flush;
-   memset(&flush, 0, sizeof(flush));      
-   flush.opcode = CMD_MI_FLUSH;
-   flush.flags = flags;
-   BRW_BATCH_STRUCT(brw, &flush);
-}
-
-
-static void brw_emit_flush( struct intel_context *intel, GLuint unused )
-{
-   brw_do_flush(brw_context(&intel->ctx),
-               BRW_FLUSH_STATE_CACHE|BRW_FLUSH_READ_CACHE);
-}
-
-
 /* called from intelWaitForIdle() and intelFlush()
  *
  * For now, just flush everything.  Could be smarter later.
@@ -234,6 +220,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.flush_cmd = brw_flush_cmd;
-   brw->intel.vtbl.emit_flush = brw_emit_flush;
    brw->intel.vtbl.debug_batch = brw_debug_batch;
 }
index ea708a06815a50468c95fad65702b1534ff56ab6..1645ca0b70e7ce3cfe8bb57074c10b54e0c52e87 100644 (file)
@@ -80,6 +80,53 @@ GLuint brw_wm_is_scalar_result( GLuint opcode )
 }
 
 
+/**
+ * Do GPU code generation for non-GLSL shader.  non-GLSL shaders have
+ * no flow control instructions so we can more readily do SSA-style
+ * optimizations.
+ */
+static void
+brw_wm_non_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c)
+{
+   /* Augment fragment program.  Add instructions for pre- and
+    * post-fragment-program tasks such as interpolation and fogging.
+    */
+   brw_wm_pass_fp(c);
+
+   /* Translate to intermediate representation.  Build register usage
+    * chains.
+    */
+   brw_wm_pass0(c);
+
+   /* Dead code removal.
+    */
+   brw_wm_pass1(c);
+
+   /* Register allocation.
+    */
+   c->grf_limit = BRW_WM_MAX_GRF / 2;
+
+   brw_wm_pass2(c);
+
+   c->prog_data.total_grf = c->max_wm_grf;
+   if (c->last_scratch) {
+      c->prog_data.total_scratch = c->last_scratch + 0x40;
+   }
+   else {
+      c->prog_data.total_scratch = 0;
+   }
+
+   /* Emit GEN4 code.
+    */
+   brw_wm_emit(c);
+}
+
+
+/**
+ * All Mesa program -> GPU code generation goes through this function.
+ * Depending on the instructions used (i.e. flow control instructions)
+ * we'll use one of two code generators.
+ */
 static void do_wm_prog( struct brw_context *brw,
                        struct brw_fragment_program *fp, 
                        struct brw_wm_prog_key *key)
@@ -90,52 +137,32 @@ static void do_wm_prog( struct brw_context *brw,
 
    c = brw->wm.compile_data;
    if (c == NULL) {
-     brw->wm.compile_data = calloc(1, sizeof(*brw->wm.compile_data));
-     c = brw->wm.compile_data;
+      brw->wm.compile_data = calloc(1, sizeof(*brw->wm.compile_data));
+      c = brw->wm.compile_data;
    } else {
-     memset(c, 0, sizeof(*brw->wm.compile_data));
+      memset(c, 0, sizeof(*brw->wm.compile_data));
    }
    memcpy(&c->key, key, sizeof(*key));
 
    c->fp = fp;
    c->env_param = brw->intel.ctx.FragmentProgram.Parameters;
 
-    brw_init_compile(brw, &c->func);
-   if (brw_wm_is_glsl(&c->fp->program)) {
-       brw_wm_glsl_emit(brw, c);
-   } else {
-       /* Augment fragment program.  Add instructions for pre- and
-       * post-fragment-program tasks such as interpolation and fogging.
-       */
-       brw_wm_pass_fp(c);
-
-       /* Translate to intermediate representation.  Build register usage
-       * chains.
-       */
-       brw_wm_pass0(c);
-
-       /* Dead code removal.
-       */
-       brw_wm_pass1(c);
-
-       /* Register allocation.
-       */
-       c->grf_limit = BRW_WM_MAX_GRF/2;
-
-       brw_wm_pass2(c);
-
-       c->prog_data.total_grf = c->max_wm_grf;
-       if (c->last_scratch) {
-          c->prog_data.total_scratch =
-              c->last_scratch + 0x40;
-       } else {
-          c->prog_data.total_scratch = 0;
-       }
-
-       /* Emit GEN4 code.
-       */
-       brw_wm_emit(c);
+   brw_init_compile(brw, &c->func);
+
+   /* temporary sanity check assertion */
+   ASSERT(fp->isGLSL == brw_wm_is_glsl(&c->fp->program));
+
+   /*
+    * Shader which use GLSL features such as flow control are handled
+    * differently from "simple" shaders.
+    */
+   if (fp->isGLSL) {
+      brw_wm_glsl_emit(brw, c);
    }
+   else {
+      brw_wm_non_glsl_emit(brw, c);
+   }
+
    if (INTEL_DEBUG & DEBUG_WM)
       fprintf(stderr, "\n");
 
@@ -159,7 +186,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
 {
    GLcontext *ctx = &brw->intel.ctx;
    /* BRW_NEW_FRAGMENT_PROGRAM */
-   struct brw_fragment_program *fp = 
+   const struct brw_fragment_program *fp = 
       (struct brw_fragment_program *)brw->fragment_program;
    GLuint lookup = 0;
    GLuint line_aa;
@@ -174,7 +201,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
        ctx->Color.AlphaEnabled)
       lookup |= IZ_PS_KILL_ALPHATEST_BIT;
 
-   if (fp->program.Base.OutputsWritten & (1<<FRAG_RESULT_DEPR))
+   if (fp->program.Base.OutputsWritten & (1<<FRAG_RESULT_DEPTH))
       lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
 
    /* _NEW_DEPTH */
@@ -186,7 +213,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
       lookup |= IZ_DEPTH_WRITE_ENABLE_BIT;
 
    /* _NEW_STENCIL */
-   if (ctx->Stencil.Enabled) {
+   if (ctx->Stencil._Enabled) {
       lookup |= IZ_STENCIL_TEST_ENABLE_BIT;
 
       if (ctx->Stencil.WriteMask[0] ||
@@ -278,10 +305,8 @@ static void brw_wm_populate_key( struct brw_context *brw,
       key->drawable_height = brw->intel.driDrawable->h;
    }
 
-   /* Extra info:
-    */
+   /* The unique fragment program ID */
    key->program_string_id = fp->id;
-
 }
 
 
@@ -305,8 +330,6 @@ static void brw_prepare_wm_prog(struct brw_context *brw)
 }
 
 
-/* See brw_wm.c:
- */
 const struct brw_tracked_state brw_wm_prog = {
    .dirty = {
       .mesa  = (_NEW_COLOR |
index 0f46a25b1a17425e642dbaf7f71056d03c8e3df3..7f0e5702f2ebb928e48d3f6f27bf30c602cea3bb 100644 (file)
@@ -143,13 +143,12 @@ struct brw_wm_instruction {
    GLuint writemask:4;
    GLuint tex_unit:4;   /* texture unit for TEX, TXD, TXP instructions */
    GLuint tex_idx:3;    /* TEXTURE_1D,2D,3D,CUBE,RECT_INDEX source target */
+   GLuint tex_shadow:1; /* do shadow comparison? */
    GLuint eot:1;       /* End of thread indicator for FB_WRITE*/
    GLuint target:10;    /* target binding table index for FB_WRITE*/
 };
 
 
-#define PROGRAM_INTERNAL_PARAM 
-
 #define BRW_WM_MAX_INSN  (MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS*3 + FRAG_ATTRIB_MAX + 3)
 #define BRW_WM_MAX_GRF   128           /* hardware limit */
 #define BRW_WM_MAX_VREG  (BRW_WM_MAX_INSN * 4)
@@ -240,13 +239,15 @@ struct brw_wm_compile {
    GLuint max_wm_grf;
    GLuint last_scratch;
 
+   /** Mapping from Mesa registers to hardware registers */
    struct {
        GLboolean inited;
        struct brw_reg reg;
    } wm_regs[PROGRAM_PAYLOAD+1][256][4];
+
    struct brw_reg stack;
    struct brw_reg emit_mask_reg;
-   GLuint reg_index;
+   GLuint reg_index;  /**< Index of next free GRF register */
    GLuint tmp_regs[BRW_WM_MAX_GRF];
    GLuint tmp_index;
    GLuint tmp_max;
@@ -281,4 +282,6 @@ void brw_wm_lookup_iz( GLuint line_aa,
 
 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);
+
+
 #endif
index b5050a3e40b26bd7a7daab8750d9d92ecf229aa7..f2dca9caa6c725cff343f14214a922a86de2e138 100644 (file)
@@ -671,7 +671,6 @@ static void emit_tex( struct brw_wm_compile *c,
 {
    struct brw_compile *p = &c->func;
    GLuint msgLength, responseLength;
-   GLboolean shadow = (c->key.shadowtex_mask & (1<<inst->tex_unit)) ? 1 : 0;
    GLuint i, nr;
    GLuint emit;
 
@@ -693,7 +692,7 @@ static void emit_tex( struct brw_wm_compile *c,
       break;
    }
 
-   if (shadow) {
+   if (inst->tex_shadow) {
       nr = 4;
       emit |= WRITEMASK_W;
    }
@@ -718,7 +717,7 @@ static void emit_tex( struct brw_wm_compile *c,
              inst->tex_unit + MAX_DRAW_BUFFERS, /* surface */
              inst->tex_unit,     /* sampler */
              inst->writemask,
-             (shadow ? 
+             (inst->tex_shadow ? 
               BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE : 
               BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE),
              responseLength,
@@ -886,6 +885,9 @@ static void emit_aa( struct brw_wm_compile *c,
 
 /* Post-fragment-program processing.  Send the results to the
  * framebuffer.
+ * \param arg0  the fragment color
+ * \param arg1  the pass-through depth value
+ * \param arg2  the shader-computed depth value
  */
 static void emit_fb_write( struct brw_wm_compile *c,
                           struct brw_reg *arg0,
index ea3f3fc678fc0957ab95170e460d82d0e861cdf1..533be3858e96ac52ca8132aba80a5bc49975f7b5 100644 (file)
@@ -129,7 +129,7 @@ static struct prog_dst_register dst_reg(GLuint file, GLuint idx)
    reg.Index = idx;
    reg.WriteMask = WRITEMASK_XYZW;
    reg.RelAddr = 0;
-   reg.CondMask = 0;
+   reg.CondMask = COND_TR;
    reg.CondSwizzle = 0;
    reg.CondSrc = 0;
    reg.pad = 0;
@@ -183,16 +183,16 @@ static struct prog_instruction *emit_insn(struct brw_wm_compile *c,
 {
    struct prog_instruction *inst = get_fp_inst(c);
    *inst = *inst0;
-   inst->Data = (void *)inst0;
    return inst;
 }
 
-static struct prog_instruction * emit_op(struct brw_wm_compile *c,
+static struct prog_instruction * emit_tex_op(struct brw_wm_compile *c,
                                       GLuint op,
                                       struct prog_dst_register dest,
                                       GLuint saturate,
                                       GLuint tex_src_unit,
                                       GLuint tex_src_target,
+                                      GLuint tex_shadow,
                                       struct prog_src_register src0,
                                       struct prog_src_register src1,
                                       struct prog_src_register src2 )
@@ -206,6 +206,7 @@ static struct prog_instruction * emit_op(struct brw_wm_compile *c,
    inst->SaturateMode = saturate;   
    inst->TexSrcUnit = tex_src_unit;
    inst->TexSrcTarget = tex_src_target;
+   inst->TexShadow = tex_shadow;
    inst->SrcReg[0] = src0;
    inst->SrcReg[1] = src1;
    inst->SrcReg[2] = src2;
@@ -213,6 +214,20 @@ static struct prog_instruction * emit_op(struct brw_wm_compile *c,
 }
    
 
+static struct prog_instruction * emit_op(struct brw_wm_compile *c,
+                                      GLuint op,
+                                      struct prog_dst_register dest,
+                                      GLuint saturate,
+                                      struct prog_src_register src0,
+                                      struct prog_src_register src1,
+                                      struct prog_src_register src2 )
+{
+   return emit_tex_op(c, op, dest, saturate,
+                      0, 0, 0,  /* tex unit, target, shadow */
+                      src0, src1, src2);
+}
+   
+
 
 
 /***********************************************************************
@@ -234,7 +249,7 @@ static struct prog_src_register get_pixel_xy( struct brw_wm_compile *c )
       emit_op(c,
              WM_PIXELXY,
              dst_mask(pixel_xy, WRITEMASK_XY),
-             0, 0, 0,
+             0,
              payload_r0_depth,
              src_undef(),
              src_undef());
@@ -257,7 +272,7 @@ static struct prog_src_register get_delta_xy( struct brw_wm_compile *c )
       emit_op(c,
              WM_DELTAXY,
              dst_mask(delta_xy, WRITEMASK_XY),
-             0, 0, 0,
+             0,
              pixel_xy, 
              payload_r0_depth,
              src_undef());
@@ -274,14 +289,13 @@ static struct prog_src_register get_pixel_w( struct brw_wm_compile *c )
       struct prog_dst_register pixel_w = get_temp(c);
       struct prog_src_register deltas = get_delta_xy(c);
       struct prog_src_register interp_wpos = src_reg(PROGRAM_PAYLOAD, FRAG_ATTRIB_WPOS);
-      
-      
+
       /* deltas.xyw = DELTAS2 deltas.xy, payload.interp_wpos.x
        */
       emit_op(c,
              WM_PIXELW,
              dst_mask(pixel_w, WRITEMASK_W),
-             0, 0, 0,
+             0,
              interp_wpos,
              deltas, 
              src_undef());
@@ -316,7 +330,7 @@ static void emit_interp( struct brw_wm_compile *c,
       emit_op(c,
              WM_WPOSXY,
              dst_mask(dst, WRITEMASK_XY),
-             0, 0, 0,
+             0,
              get_pixel_xy(c),
              src_undef(),
              src_undef());
@@ -328,7 +342,7 @@ static void emit_interp( struct brw_wm_compile *c,
       emit_op(c,
              WM_LINTERP,
              dst,
-             0, 0, 0,
+             0,
              interp,
              deltas,
              arg2);
@@ -339,7 +353,7 @@ static void emit_interp( struct brw_wm_compile *c,
         emit_op(c,
                 WM_CINTERP,
                 dst,
-                0, 0, 0,
+                0,
                 interp,
                 src_undef(),
                 src_undef());
@@ -348,7 +362,7 @@ static void emit_interp( struct brw_wm_compile *c,
         emit_op(c,
                 WM_LINTERP,
                 dst,
-                0, 0, 0,
+                0,
                 interp,
                 deltas,
                 src_undef());
@@ -358,7 +372,7 @@ static void emit_interp( struct brw_wm_compile *c,
       emit_op(c,
              WM_PINTERP,
              dst,
-             0, 0, 0,
+             0,
              interp,
              deltas,
              get_pixel_w(c));
@@ -378,7 +392,7 @@ static void emit_ddx( struct brw_wm_compile *c,
     emit_op(c,
             OPCODE_DDX,
             inst->DstReg,
-            0, 0, 0,
+            0,
             interp,
             get_pixel_w(c),
             src_undef());
@@ -394,7 +408,7 @@ static void emit_ddy( struct brw_wm_compile *c,
     emit_op(c,
             OPCODE_DDY,
             inst->DstReg,
-            0, 0, 0,
+            0,
             interp,
             get_pixel_w(c),
             src_undef());
@@ -489,13 +503,12 @@ static void precalc_dst( struct brw_wm_compile *c,
       emit_op(c,
              OPCODE_MUL,
              dst_mask(dst, WRITEMASK_Y),
-             inst->SaturateMode, 0, 0,
+             inst->SaturateMode,
              src0,
              src1,
              src_undef());
    }
 
-
    if (dst.WriteMask & WRITEMASK_XZ) {
       struct prog_instruction *swz;
       GLuint z = GET_SWZ(src0.Swizzle, Z);
@@ -505,7 +518,7 @@ static void precalc_dst( struct brw_wm_compile *c,
       swz = emit_op(c,
                    OPCODE_SWZ,
                    dst_mask(dst, WRITEMASK_XZ),
-                   inst->SaturateMode, 0, 0,
+                   inst->SaturateMode,
                    src_swizzle(src0, SWIZZLE_ONE, z, z, z),
                    src_undef(),
                    src_undef());
@@ -518,7 +531,7 @@ static void precalc_dst( struct brw_wm_compile *c,
       emit_op(c,
              OPCODE_MOV,
              dst_mask(dst, WRITEMASK_W),
-             inst->SaturateMode, 0, 0,
+             inst->SaturateMode,
              src1,
              src_undef(),
              src_undef());
@@ -540,7 +553,7 @@ static void precalc_lit( struct brw_wm_compile *c,
       swz = emit_op(c,
                    OPCODE_SWZ,
                    dst_mask(dst, WRITEMASK_XW),
-                   0, 0, 0,
+                   0,
                    src_swizzle1(src0, SWIZZLE_ONE),
                    src_undef(),
                    src_undef());
@@ -548,12 +561,11 @@ static void precalc_lit( struct brw_wm_compile *c,
       swz->SrcReg[0].NegateBase = 0;
    }
 
-
    if (dst.WriteMask & WRITEMASK_YZ) {
       emit_op(c,
              OPCODE_LIT,
              dst_mask(dst, WRITEMASK_YZ),
-             inst->SaturateMode, 0, 0,
+             inst->SaturateMode,
              src0,
              src_undef(),
              src_undef());
@@ -589,7 +601,7 @@ static void precalc_tex( struct brw_wm_compile *c,
        /* tmpcoord = src0 (i.e.: coord = src0) */
        out = emit_op(c, OPCODE_MOV,
                      tmpcoord,
-                     0, 0, 0,
+                     0,
                      src0,
                      src_undef(),
                      src_undef());
@@ -599,7 +611,7 @@ static void precalc_tex( struct brw_wm_compile *c,
        /* tmp0 = MAX(coord.X, coord.Y) */
        emit_op(c, OPCODE_MAX,
                tmp0,
-               0, 0, 0,
+               0,
                src_swizzle1(coord, X),
                src_swizzle1(coord, Y),
                src_undef());
@@ -607,7 +619,7 @@ static void precalc_tex( struct brw_wm_compile *c,
        /* tmp1 = MAX(tmp0, coord.Z) */
        emit_op(c, OPCODE_MAX,
                tmp1,
-               0, 0, 0,
+               0,
                tmp0src,
                src_swizzle1(coord, Z),
                src_undef());
@@ -615,7 +627,7 @@ static void precalc_tex( struct brw_wm_compile *c,
        /* tmp0 = 1 / tmp1 */
        emit_op(c, OPCODE_RCP,
                tmp0,
-               0, 0, 0,
+               0,
                tmp1src,
                src_undef(),
                src_undef());
@@ -623,7 +635,7 @@ static void precalc_tex( struct brw_wm_compile *c,
        /* tmpCoord = src0 * tmp0 */
        emit_op(c, OPCODE_MUL,
                tmpcoord,
-               0, 0, 0,
+               0,
                src0,
                tmp0src,
                src_undef());
@@ -646,7 +658,7 @@ static void precalc_tex( struct brw_wm_compile *c,
       emit_op(c,
              OPCODE_MUL,
              tmpcoord,
-             0, 0, 0,
+             0,
              inst->SrcReg[0],
              scale,
              src_undef());
@@ -686,22 +698,23 @@ static void precalc_tex( struct brw_wm_compile *c,
      
       /* tmp     = TEX ...
        */
-      emit_op(c, 
-             OPCODE_TEX,
-             tmp,
-             inst->SaturateMode,
-             unit,
-             inst->TexSrcTarget,
-             coord,
-             src_undef(),
-             src_undef());
+      emit_tex_op(c, 
+                  OPCODE_TEX,
+                  tmp,
+                  inst->SaturateMode,
+                  unit,
+                  inst->TexSrcTarget,
+                  inst->TexShadow,
+                  coord,
+                  src_undef(),
+                  src_undef());
 
       /* tmp.xyz =  ADD TMP, C0
        */
       emit_op(c,
              OPCODE_ADD,
              dst_mask(tmp, WRITEMASK_XYZ),
-             0, 0, 0,
+             0,
              tmpsrc,
              C0,
              src_undef());
@@ -712,7 +725,7 @@ static void precalc_tex( struct brw_wm_compile *c,
       emit_op(c,
              OPCODE_MUL,
              dst_mask(tmp, WRITEMASK_Y),
-             0, 0, 0,
+             0,
              tmpsrc,
              src_swizzle1(C0, W),
              src_undef());
@@ -727,7 +740,7 @@ static void precalc_tex( struct brw_wm_compile *c,
       emit_op(c,
              OPCODE_MAD,
              dst_mask(dst, WRITEMASK_XYZ),
-             0, 0, 0,
+             0,
              swap_uv?src_swizzle(tmpsrc, Z,Z,X,X):src_swizzle(tmpsrc, X,X,Z,Z),
              C1,
              src_swizzle1(tmpsrc, Y));
@@ -737,7 +750,7 @@ static void precalc_tex( struct brw_wm_compile *c,
       emit_op(c,
              OPCODE_MAD,
              dst_mask(dst, WRITEMASK_Y),
-             0, 0, 0,
+             0,
              src_swizzle1(tmpsrc, Z),
              src_swizzle1(C1, W),
              src_swizzle1(src_reg_from_dst(dst), Y));
@@ -746,15 +759,16 @@ static void precalc_tex( struct brw_wm_compile *c,
    }
    else {
       /* ordinary RGBA tex instruction */
-      emit_op(c, 
-             OPCODE_TEX,
-             inst->DstReg,
-             inst->SaturateMode,
-             unit,
-             inst->TexSrcTarget,
-             coord,
-             src_undef(),
-             src_undef());
+      emit_tex_op(c, 
+                  OPCODE_TEX,
+                  inst->DstReg,
+                  inst->SaturateMode,
+                  unit,
+                  inst->TexSrcTarget,
+                  inst->TexShadow,
+                  coord,
+                  src_undef(),
+                  src_undef());
    }
 
    /* For GL_EXT_texture_swizzle: */
@@ -764,7 +778,6 @@ static void precalc_tex( struct brw_wm_compile *c,
       emit_op(c, OPCODE_SWZ,
               inst->DstReg,
               SATURATE_OFF, /* saturate already done above */
-              0, 0,   /* tex unit, target N/A */
               src_swizzle4(tmpsrc, c->key.tex_swizzles[unit]),
               src_undef(),
               src_undef());
@@ -813,7 +826,7 @@ static void precalc_txp( struct brw_wm_compile *c,
       emit_op(c,
              OPCODE_RCP,
              dst_mask(tmp, WRITEMASK_W),
-             0, 0, 0,
+             0,
              src_swizzle1(src0, GET_SWZ(src0.Swizzle, W)),
              src_undef(),
              src_undef());
@@ -823,7 +836,7 @@ static void precalc_txp( struct brw_wm_compile *c,
       emit_op(c,
              OPCODE_MUL,
              dst_mask(tmp, WRITEMASK_XYZ),
-             0, 0, 0,
+             0,
              src0,
              src_swizzle1(src_reg_from_dst(tmp), W),
              src_undef());
@@ -849,42 +862,41 @@ static void precalc_txp( struct brw_wm_compile *c,
 static void emit_fb_write( struct brw_wm_compile *c )
 {
    struct prog_src_register payload_r0_depth = src_reg(PROGRAM_PAYLOAD, PAYLOAD_DEPTH);
-   struct prog_src_register outdepth = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DEPR);
+   struct prog_src_register outdepth = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DEPTH);
    struct prog_src_register outcolor;
    GLuint i;
 
    struct prog_instruction *inst, *last_inst;
    struct brw_context *brw = c->func.brw;
 
-   /* inst->Sampler is not used by backend, 
-      use it for fb write target and eot */
-
-   if (brw->state.nr_draw_regions > 1) {
-       for (i = 0 ; i < brw->state.nr_draw_regions; i++) {
-          outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i);
-          last_inst = inst = emit_op(c,
-                  WM_FB_WRITE, dst_mask(dst_undef(),0), 0, 0, 0,
-                  outcolor, payload_r0_depth, outdepth);
-          inst->Sampler = (i<<1);
-          if (c->fp_fragcolor_emitted) {
-              outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
-              last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
-                      0, 0, 0, outcolor, payload_r0_depth, outdepth);
-              inst->Sampler = (i<<1);
-          }
-       }
-       last_inst->Sampler |= 1; //eot
+   /* The inst->Aux field is used for FB write target and the EOT marker */
+
+   if (brw->state.nr_color_regions > 1) {
+      for (i = 0 ; i < brw->state.nr_color_regions; i++) {
+         outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i);
+         last_inst = inst = emit_op(c,
+                                    WM_FB_WRITE, dst_mask(dst_undef(),0), 0,
+                                    outcolor, payload_r0_depth, outdepth);
+         inst->Aux = (i<<1);
+         if (c->fp_fragcolor_emitted) {
+            outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
+            last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
+                                       0, outcolor, payload_r0_depth, outdepth);
+            inst->Aux = (i<<1);
+         }
+      }
+      last_inst->Aux |= 1; //eot
    }
    else {
       /* if gl_FragData[0] is written, use it, else use gl_FragColor */
       if (c->fp->program.Base.OutputsWritten & (1 << FRAG_RESULT_DATA0))
          outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0);
       else 
-         outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
+         outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
 
-       inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
-              0, 0, 0, outcolor, payload_r0_depth, outdepth);
-       inst->Sampler = 1|(0<<1);
+      inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
+                     0, outcolor, payload_r0_depth, outdepth);
+      inst->Aux = 1|(0<<1);
    }
 }
 
@@ -915,9 +927,9 @@ static void validate_dst_regs( struct brw_wm_compile *c,
                               const struct prog_instruction *inst )
 {
    if (inst->DstReg.File == PROGRAM_OUTPUT) {
-       GLuint idx = inst->DstReg.Index;
-       if (idx == FRAG_RESULT_COLR)
-          c->fp_fragcolor_emitted = 1;
+      GLuint idx = inst->DstReg.Index;
+      if (idx == FRAG_RESULT_COLOR)
+         c->fp_fragcolor_emitted = 1;
    }
 }
 
@@ -937,11 +949,15 @@ static void print_insns( const struct prog_instruction *insn,
                                     3);
       }
       else 
-        _mesa_printf("UNKNOWN\n");
-          
+        _mesa_printf("965 Opcode %d\n", insn->Opcode);
    }
 }
 
+
+/**
+ * Initial pass for fragment program code generation.
+ * This function is used by both the GLSL and non-GLSL paths.
+ */
 void brw_wm_pass_fp( struct brw_wm_compile *c )
 {
    struct brw_fragment_program *fp = c->fp;
@@ -958,15 +974,19 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
    c->pixel_w = src_undef();
    c->nr_fp_insns = 0;
 
-   /* Emit preamble instructions:
+   /* Emit preamble instructions.  This is where special instructions such as
+    * WM_CINTERP, WM_LINTERP, WM_PINTERP and WM_WPOSXY are emitted to
+    * compute shader inputs from varying vars.
     */
-
-
    for (insn = 0; insn < fp->program.Base.NumInstructions; insn++) {
       const struct prog_instruction *inst = &fp->program.Base.Instructions[insn];
       validate_src_regs(c, inst);
       validate_dst_regs(c, inst);
    }
+
+   /* Loop over all instructions doing assorted simplifications and
+    * transformations.
+    */
    for (insn = 0; insn < fp->program.Base.NumInstructions; insn++) {
       const struct prog_instruction *inst = &fp->program.Base.Instructions[insn];
       struct prog_instruction *out;
@@ -975,7 +995,6 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
        * necessary:
        */
 
-
       switch (inst->Opcode) {
       case OPCODE_SWZ: 
         out = emit_insn(c, inst);
@@ -1055,9 +1074,9 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
    }
 
    if (INTEL_DEBUG & DEBUG_WM) {
-          _mesa_printf("pass_fp:\n");
-          print_insns( c->prog_instructions, c->nr_fp_insns );
-          _mesa_printf("\n");
+      _mesa_printf("pass_fp:\n");
+      print_insns( c->prog_instructions, c->nr_fp_insns );
+      _mesa_printf("\n");
    }
 }
 
index 8fd776ac3932f69988c09a5b18e634971691c539..4cf092226cf2bda902bcfc845508ec3015662e62 100644 (file)
@@ -8,12 +8,17 @@ enum _subroutine {
     SUB_NOISE1, SUB_NOISE2, SUB_NOISE3, SUB_NOISE4
 };
 
-/* Only guess, need a flag in gl_fragment_program later */
+
+/**
+ * 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;
     for (i = 0; i < fp->Base.NumInstructions; i++) {
-       struct prog_instruction *inst = &fp->Base.Instructions[i];
+       const struct prog_instruction *inst = &fp->Base.Instructions[i];
        switch (inst->Opcode) {
            case OPCODE_IF:
            case OPCODE_TRUNC:
@@ -36,6 +41,10 @@ GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp)
     return GL_FALSE; 
 }
 
+
+/**
+ * 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)
 {
@@ -43,6 +52,10 @@ static void set_reg(struct brw_wm_compile *c, int file, int index,
     c->wm_regs[file][index][component].inited = GL_TRUE;
 }
 
+/**
+ * Examine instruction's write mask to find index of first component
+ * enabled for writing.
+ */
 static int get_scalar_dst_index(struct prog_instruction *inst)
 {
     int i;
@@ -62,6 +75,10 @@ static struct brw_reg alloc_tmp(struct brw_wm_compile *c)
     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;
@@ -77,8 +94,22 @@ 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)
+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) {
@@ -89,21 +120,46 @@ get_reg(struct brw_wm_compile *c, int file, int index, int component, int nr, GL
            break;
        case PROGRAM_UNDEFINED:
            return brw_null_reg();      
-       default:
+       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();
     }
 
-    if(c->wm_regs[file][index][component].inited)
+    /* 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 
+    }
+    else {
+       /* no, allocate new register */
        reg = brw_vec8_grf(c->reg_index, 0);
+    }
 
-    if(!c->wm_regs[file][index][component].inited) {
+    /* if this is a new register allocation, record it in the table */
+    if (!c->wm_regs[file][index][component].inited) {
        set_reg(c, file, index, component, reg);
        c->reg_index++;
     }
 
-    if (neg & (1<< component)) {
+    if (c->reg_index >= BRW_WM_MAX_GRF - 12) {
+       /* ran out of temporary registers! */
+#if 1
+        /* This is a big hack for now.
+         * Return bad register index, just don't hang the GPU.
+         */
+        _mesa_fprintf(stderr, "out of regs %d\n", c->reg_index);
+        c->reg_index = BRW_WM_MAX_GRF - 13;
+#else
+       return brw_null_reg();
+#endif
+    }
+    if (neg & (1 << component)) {
        reg = negate(reg);
     }
     if (abs)
@@ -111,6 +167,12 @@ get_reg(struct brw_wm_compile *c, int file, int index, int component, int nr, GL
     return reg;
 }
 
+
+/**
+ * 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)
 {
     int i, j;
@@ -119,29 +181,42 @@ static void prealloc_reg(struct brw_wm_compile *c)
     GLuint inputs = FRAG_BIT_WPOS | c->fp_interp_emitted | c->fp_deriv_emitted;
 
     for (i = 0; i < 4; i++) {
-       reg = (i < c->key.nr_depth_regs) 
-           ? brw_vec8_grf(i*2, 0) : brw_vec8_grf(0, 0);
+        if (i < c->key.nr_depth_regs) 
+            reg = brw_vec8_grf(i * 2, 0);
+        else
+            reg = brw_vec8_grf(0, 0);
        set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, i, reg);
     }
-    c->reg_index += 2*c->key.nr_depth_regs;
+    c->reg_index += 2 * c->key.nr_depth_regs;
+
+    /* constants */
     {
-       int nr_params = c->fp->program.Base.Parameters->NumParameters;
-       struct gl_program_parameter_list *plist = 
+        const int nr_params = c->fp->program.Base.Parameters->NumParameters;
+        const struct gl_program_parameter_list *plist = 
            c->fp->program.Base.Parameters;
        int index = 0;
-       c->prog_data.nr_params = 4*nr_params;
+
+        /* number of float constants */
+       c->prog_data.nr_params = 4 * nr_params;
+
+        /* loop over program constants (float[4]) */
        for (i = 0; i < nr_params; i++) {
-           for (j = 0; j < 4; j++, index++) {
-               reg = brw_vec1_grf(c->reg_index + index/8, 
-                       index%8);
-               c->prog_data.param[index] = 
-                   &plist->ParameterValues[i][j];
-               set_reg(c, PROGRAM_STATE_VAR, i, j, reg);
+            /* loop over XYZW channels */
+            for (j = 0; j < 4; j++, index++) {
+                reg = brw_vec1_grf(c->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);
            }
        }
-       c->nr_creg = 2*((4*nr_params+15)/16);
+        /* number of constant regs used (each reg is float[8]) */
+       c->nr_creg = 2 * ((4 * nr_params + 15) / 16);
        c->reg_index += c->nr_creg;
     }
+
+    /* fragment shader inputs */
     for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
        if (inputs & (1<<i)) {
            nr_interp_regs++;
@@ -149,9 +224,9 @@ static void prealloc_reg(struct brw_wm_compile *c)
            for (j = 0; j < 4; j++)
                set_reg(c, PROGRAM_PAYLOAD, i, j, reg);
            c->reg_index += 2;
-
        }
     }
+
     c->prog_data.first_curbe_grf = c->key.nr_depth_regs * 2;
     c->prog_data.urb_read_length = nr_interp_regs * 2;
     c->prog_data.curb_read_length = c->nr_creg;
@@ -161,6 +236,10 @@ static void prealloc_reg(struct brw_wm_compile *c)
     c->reg_index += 2;
 }
 
+
+/**
+ * Convert Mesa dst register to brw register.
+ */
 static struct brw_reg get_dst_reg(struct brw_wm_compile *c, 
        struct prog_instruction *inst, int component, int nr)
 {
@@ -168,6 +247,10 @@ static struct brw_reg get_dst_reg(struct brw_wm_compile *c,
            0, 0);
 }
 
+
+/**
+ * Convert Mesa src register to brw register.
+ */
 static struct brw_reg get_src_reg(struct brw_wm_compile *c, 
        struct prog_src_register *src, int index, int nr)
 {
@@ -176,13 +259,15 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c,
            src->NegateBase, src->Abs);
 }
 
-/* Subroutines are minimal support for resusable instruction sequences.
-   They are implemented as simply as possible to minimise overhead: there
-   is no explicit support for communication between the caller and callee
-   other than saving the return address in a temporary register, nor is
-   there any automatic local storage.  This implies that great care is
-   required before attempting reentrancy or any kind of nested
-   subroutine invocations. */
+/**
+ * Subroutines are minimal support for resusable instruction sequences.
+ * They are implemented as simply as possible to minimise overhead: there
+ * is no explicit support for communication between the caller and callee
+ * other than saving the return address in a temporary register, nor is
+ * there any automatic local storage.  This implies that great care is
+ * required before attempting reentrancy or any kind of nested
+ * subroutine invocations.
+ */
 static void invoke_subroutine( struct brw_wm_compile *c,
                               enum _subroutine subroutine,
                               void (*emit)( struct brw_wm_compile * ) )
@@ -319,11 +404,10 @@ static void emit_pixel_xy(struct brw_wm_compile *c,
                stride(suboffset(r1_uw, 5), 2, 4, 0),
                brw_imm_v(0x11001100));
     }
-
 }
 
 static void emit_delta_xy(struct brw_wm_compile *c,
-               struct prog_instruction *inst)
+                          struct prog_instruction *inst)
 {
     struct brw_reg r1 = brw_vec1_grf(1, 0);
     struct brw_reg dst0, dst1, src0, src1;
@@ -351,10 +435,8 @@ static void emit_delta_xy(struct brw_wm_compile *c,
                negate(suboffset(r1,1)));
 
     }
-
 }
 
-
 static void fire_fb_write( struct brw_wm_compile *c,
                            GLuint base_reg,
                            GLuint nr,
@@ -397,33 +479,59 @@ static void emit_fb_write(struct brw_wm_compile *c,
      */
     if (c->key.aa_dest_stencil_reg)
        nr += 1;
-    {
-       brw_push_insn_state(p);
-       for (channel = 0; channel < 4; channel++) {
-           src0 = get_src_reg(c,  &inst->SrcReg[0], channel, 1);
-           /*  mov (8) m2.0<1>:ud   r28.0<8;8,1>:ud  { Align1 } */
-           /*  mov (8) m6.0<1>:ud   r29.0<8;8,1>:ud  { Align1 SecHalf } */
-           brw_MOV(p, brw_message_reg(nr + channel), src0);
-       }
-       /* skip over the regs populated above: */
-       nr += 8;
-       brw_pop_insn_state(p);
+
+    brw_push_insn_state(p);
+    for (channel = 0; channel < 4; channel++) {
+        src0 = get_src_reg(c,  &inst->SrcReg[0], channel, 1);
+        /*  mov (8) m2.0<1>:ud   r28.0<8;8,1>:ud  { Align1 } */
+        /*  mov (8) m6.0<1>:ud   r29.0<8;8,1>:ud  { Align1 SecHalf } */
+        brw_MOV(p, brw_message_reg(nr + channel), src0);
     }
+    /* skip over the regs populated above: */
+    nr += 8;
+    brw_pop_insn_state(p);
 
-   if (c->key.source_depth_to_render_target)
-   {
-      if (c->key.computes_depth) {
-         src0 = get_src_reg(c, &inst->SrcReg[2], 2, 1);
-         brw_MOV(p, brw_message_reg(nr), src0);
-      } else {
-         src0 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
-         brw_MOV(p, brw_message_reg(nr), src0);
-      }
-
-      nr += 2;
+    if (c->key.source_depth_to_render_target) {
+       if (c->key.computes_depth) {
+          src0 = get_src_reg(c, &inst->SrcReg[2], 2, 1);
+          brw_MOV(p, brw_message_reg(nr), src0);
+       }
+       else {
+          src0 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
+          brw_MOV(p, brw_message_reg(nr), src0);
+       }
+
+       nr += 2;
+    }
+
+    if (c->key.dest_depth_reg) {
+        GLuint comp = c->key.dest_depth_reg / 2;
+        GLuint off = c->key.dest_depth_reg % 2;
+
+        assert(comp == 1);
+        assert(off == 0);
+#if 0
+        /* XXX do we need this code?   comp always 1, off always 0, it seems */
+        if (off != 0) {
+            brw_push_insn_state(p);
+            brw_set_compression_control(p, BRW_COMPRESSION_NONE);
+
+            brw_MOV(p, brw_message_reg(nr), offset(arg1[comp],1));
+            /* 2nd half? */
+            brw_MOV(p, brw_message_reg(nr+1), arg1[comp+1]);
+            brw_pop_insn_state(p);
+        }
+        else
+#endif
+        {
+           struct brw_reg src =  get_src_reg(c, &inst->SrcReg[1], 1, 1);
+           brw_MOV(p, brw_message_reg(nr), src);
+        }
+        nr += 2;
    }
-    target = inst->Sampler >> 1;
-    eot = inst->Sampler & 1;
+
+    target = inst->Aux >> 1;
+    eot = inst->Aux & 1;
     fire_fb_write(c, 0, nr, target, eot);
 }
 
@@ -465,12 +573,12 @@ static void emit_linterp(struct brw_wm_compile *c,
     struct brw_reg interp[4];
     struct brw_reg dst, delta0, delta1;
     struct brw_reg src0;
+    GLuint nr, i;
 
     src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
     delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1);
     delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
-    GLuint nr = src0.nr;
-    int i;
+    nr = src0.nr;
 
     interp[0] = brw_vec1_grf(nr, 0);
     interp[1] = brw_vec1_grf(nr, 4);
@@ -494,10 +602,10 @@ static void emit_cinterp(struct brw_wm_compile *c,
 
     struct brw_reg interp[4];
     struct brw_reg dst, src0;
+    GLuint nr, i;
 
     src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
-    GLuint nr = src0.nr;
-    int i;
+    nr = src0.nr;
 
     interp[0] = brw_vec1_grf(nr, 0);
     interp[1] = brw_vec1_grf(nr, 4);
@@ -521,13 +629,13 @@ static void emit_pinterp(struct brw_wm_compile *c,
     struct brw_reg interp[4];
     struct brw_reg dst, delta0, delta1;
     struct brw_reg src0, w;
+    GLuint nr, i;
 
     src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
     delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1);
     delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
     w = get_src_reg(c, &inst->SrcReg[2], 3, 1);
-    GLuint nr = src0.nr;
-    int i;
+    nr = src0.nr;
 
     interp[0] = brw_vec1_grf(nr, 0);
     interp[1] = brw_vec1_grf(nr, 4);
@@ -627,23 +735,46 @@ static void emit_dph(struct brw_wm_compile *c,
     brw_set_saturate(p, 0);
 }
 
+/**
+ * Emit a scalar instruction, like RCP, RSQ, LOG, EXP.
+ * Note that the result of the function is smeared across the dest
+ * register's X, Y, Z and W channels (subject to writemasking of course).
+ */
 static void emit_math1(struct brw_wm_compile *c,
                struct prog_instruction *inst, GLuint func)
 {
     struct brw_compile *p = &c->func;
-    struct brw_reg src0, dst;
+    struct brw_reg src0, dst, tmp;
+    const int mark = mark_tmps( c );
+    int i;
+
+    tmp = alloc_tmp(c);
 
+    /* Get first component of source register */
     src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
-    dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1);
+
+    /* tmp = func(src0) */
     brw_MOV(p, brw_message_reg(2), src0);
     brw_math(p,
-           dst,
-           func,
-           (inst->SaturateMode != SATURATE_OFF) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE,
-           2,
-           brw_null_reg(),
-           BRW_MATH_DATA_VECTOR,
-           BRW_MATH_PRECISION_FULL);
+             tmp,
+             func,
+             (inst->SaturateMode != SATURATE_OFF) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE,
+             2,
+             brw_null_reg(),
+             BRW_MATH_DATA_VECTOR,
+             BRW_MATH_PRECISION_FULL);
+
+    /*tmp.dw1.bits.swizzle = SWIZZLE_XXXX;*/
+
+    /* replicate tmp value across enabled dest channels */
+    for (i = 0; i < 4; i++) {
+       if (inst->DstReg.WriteMask & (1 << i)) {
+          dst = get_dst_reg(c, inst, i, 1);    
+          brw_MOV(p, dst, tmp);
+       }
+    }
+
+    release_tmps(c, mark);
 }
 
 static void emit_rcp(struct brw_wm_compile *c,
@@ -1045,23 +1176,23 @@ static void emit_ddy(struct brw_wm_compile *c,
     brw_set_saturate(p, 0);
 }
 
-static __inline struct brw_reg high_words( struct brw_reg reg )
+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 )
+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 )
+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 )
+static INLINE struct brw_reg odd_bytes( struct brw_reg reg )
 {
     return stride( suboffset( retype( reg, BRW_REGISTER_TYPE_B ), 1 ),
                   0, 16, 2 );
@@ -1366,9 +1497,11 @@ static void emit_noise2( struct brw_wm_compile *c,
     release_tmps( c, mark );
 }
 
-/* The three-dimensional case is much like the one- and two- versions above,
-   but since the number of corners is rapidly growing we now pack 16 16-bit
-   hashes into each register to extract more parallelism from the EUs. */
+/**
+ * The three-dimensional case is much like the one- and two- versions above,
+ * but since the number of corners is rapidly growing we now pack 16 16-bit
+ * hashes into each register to extract more parallelism from the EUs.
+ */
 static void noise3_sub( struct brw_wm_compile *c ) {
 
     struct brw_compile *p = &c->func;
@@ -1670,13 +1803,15 @@ static void emit_noise3( struct brw_wm_compile *c,
     release_tmps( c, mark );
 }
     
-/* For the four-dimensional case, the little micro-optimisation benefits
-   we obtain by unrolling all the loops aren't worth the massive bloat it
-   now causes.  Instead, we loop twice around performing a similar operation
-   to noise3, once for the w=0 cube and once for the w=1, with a bit more
-   code to glue it all together. */
-static void noise4_sub( struct brw_wm_compile *c ) {
-
+/**
+ * For the four-dimensional case, the little micro-optimisation benefits
+ * we obtain by unrolling all the loops aren't worth the massive bloat it
+ * now causes.  Instead, we loop twice around performing a similar operation
+ * to noise3, once for the w=0 cube and once for the w=1, with a bit more
+ * code to glue it all together.
+ */
+static void noise4_sub( struct brw_wm_compile *c )
+{
     struct brw_compile *p = &c->func;
     struct brw_reg param[ 4 ],
        x0y0, x0y1, x1y0, x1y1, /* gradients at four of the corners */
@@ -2244,28 +2379,12 @@ static void emit_tex(struct brw_wm_compile *c,
        brw_MOV(p, dst[3], brw_imm_f(1.0));
 }
 
+/**
+ * Resolve subroutine calls after code emit is done.
+ */
 static void post_wm_emit( struct brw_wm_compile *c )
 {
-    GLuint nr_insns = c->fp->program.Base.NumInstructions;
-    GLuint insn, target_insn;
-    struct prog_instruction *inst1, *inst2;
-    struct brw_instruction *brw_inst1, *brw_inst2;
-    int offset;
-    for (insn = 0; insn < nr_insns; insn++) {
-       inst1 = &c->fp->program.Base.Instructions[insn];
-       brw_inst1 = inst1->Data;
-       switch (inst1->Opcode) {
-           case OPCODE_CAL:
-               target_insn = inst1->BranchTarget;
-               inst2 = &c->fp->program.Base.Instructions[target_insn];
-               brw_inst2 = inst2->Data;
-               offset = brw_inst2 - brw_inst1;
-               brw_set_src1(brw_inst1, brw_imm_d(offset*16));
-               break;
-           default:
-               break;
-       }
-    }
+    brw_resolve_cals(&c->func);
 }
 
 static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
@@ -2285,10 +2404,6 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
 
     for (i = 0; i < c->nr_fp_insns; i++) {
        struct prog_instruction *inst = &c->prog_instructions[i];
-       struct prog_instruction *orig_inst;
-
-       if ((orig_inst = inst->Data) != 0)
-           orig_inst->Data = current_insn(p);
 
        if (inst->CondUpdate)
            brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
@@ -2446,7 +2561,10 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
                brw_ENDIF(p, if_inst[--if_insn]);
                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);
@@ -2456,8 +2574,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
                 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));
-                orig_inst = inst->Data;
-                orig_inst->Data = &p->store[p->nr_insn];
+               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;
@@ -2510,14 +2627,34 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
            brw_set_predicate_control(p, BRW_PREDICATE_NONE);
     }
     post_wm_emit(c);
-    for (i = 0; i < c->fp->program.Base.NumInstructions; i++)
-       c->fp->program.Base.Instructions[i].Data = NULL;
+
+    if (c->reg_index >= BRW_WM_MAX_GRF) {
+        _mesa_problem(NULL, "Ran out of registers in brw_wm_emit_glsl()");
+        /* XXX we need to do some proper error recovery here */
+    }
 }
 
+
+/**
+ * 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 (INTEL_DEBUG & DEBUG_WM) {
+        _mesa_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 (INTEL_DEBUG & DEBUG_WM) {
+        brw_wm_print_program(c, "brw_wm_glsl_emit done");
+    }
+
     c->prog_data.total_grf = c->reg_index;
     c->prog_data.total_scratch = 0;
 }
index 590cd946ec394640227235dd71d8c68d0c9473f4..2debd0678a58cbec7c6af2f44dd30d999ff0c211 100644 (file)
@@ -334,8 +334,9 @@ static struct brw_wm_ref *get_new_ref( struct brw_wm_compile *c,
 }
 
 
-static struct brw_wm_instruction *translate_insn( struct brw_wm_compile *c,
-                                                 const struct prog_instruction *inst )
+static void
+translate_insn(struct brw_wm_compile *c,
+               const struct prog_instruction *inst)
 {
    struct brw_wm_instruction *out = get_instruction(c);
    GLuint writemask = inst->DstReg.WriteMask;
@@ -348,8 +349,9 @@ static struct brw_wm_instruction *translate_insn( struct brw_wm_compile *c,
    out->saturate = (inst->SaturateMode != SATURATE_OFF);
    out->tex_unit = inst->TexSrcUnit;
    out->tex_idx = inst->TexSrcTarget;
-   out->eot = inst->Sampler & 1;
-   out->target = inst->Sampler>>1;
+   out->tex_shadow = inst->TexShadow;
+   out->eot = inst->Aux & 1;
+   out->target = inst->Aux >> 1;
 
    /* Args:
     */
@@ -365,8 +367,6 @@ static struct brw_wm_instruction *translate_insn( struct brw_wm_compile *c,
       pass0_set_dst_scalar(c, out, inst, writemask);
    else 
       pass0_set_dst(c, out, inst, writemask);
-
-   return out;
 }
 
 
index 6eaed8a665b30233505094f8be93031682fe76e3..cf031899dd23c6d6aaa6b6e7d9d225e9501e25fd 100644 (file)
@@ -210,9 +210,10 @@ void brw_wm_pass1( struct brw_wm_compile *c )
         break;
 
       case OPCODE_TEX:
+      case OPCODE_TXP:
         read0 = get_texcoord_mask(inst->tex_idx);
 
-        if (c->key.shadowtex_mask & (1<<inst->tex_unit))
+         if (inst->tex_shadow)
            read0 |= WRITEMASK_Z;
         break;
 
@@ -267,7 +268,6 @@ void brw_wm_pass1( struct brw_wm_compile *c )
         break;
 
       case OPCODE_DST:
-      case OPCODE_TXP:
       default:
         break;
       }
index b6dac0d69834c578147e236168fef18438152796..68a9296a713a825fcd59878873bdcc4f2cde7881 100644 (file)
@@ -95,6 +95,7 @@ struct wm_sampler_key {
    int sampler_count;
 
    struct wm_sampler_entry {
+      GLenum tex_target;
       GLenum wrap_r, wrap_s, wrap_t;
       float maxlod, minlod;
       float lod_bias;
@@ -168,19 +169,20 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key,
       }  
    }
 
-   sampler->ss1.r_wrap_mode = translate_wrap_mode(key->wrap_r);
-   sampler->ss1.s_wrap_mode = translate_wrap_mode(key->wrap_s);
-   sampler->ss1.t_wrap_mode = translate_wrap_mode(key->wrap_t);
-
-   /* Fulsim complains if I don't do this.  Hardware doesn't mind:
-    */
-#if 0
-   if (texObj->Target == GL_TEXTURE_CUBE_MAP_ARB) {
+   if (key->tex_target == GL_TEXTURE_CUBE_MAP &&
+       (key->minfilter != GL_NEAREST || key->magfilter != GL_NEAREST)) {
+      /* If we're using anything but nearest sampling for a cube map, we
+       * need to set this wrap mode to avoid GPU lock-ups.
+       */
       sampler->ss1.r_wrap_mode = BRW_TEXCOORDMODE_CUBE;
       sampler->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CUBE;
       sampler->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CUBE;
    }
-#endif
+   else {
+      sampler->ss1.r_wrap_mode = translate_wrap_mode(key->wrap_r);
+      sampler->ss1.s_wrap_mode = translate_wrap_mode(key->wrap_s);
+      sampler->ss1.t_wrap_mode = translate_wrap_mode(key->wrap_t);
+   }
 
    /* Set shadow function: 
     */
@@ -234,6 +236,8 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
         struct gl_texture_image *firstImage =
            texObj->Image[0][intelObj->firstLevel];
 
+         entry->tex_target = texObj->Target;
+
         entry->wrap_r = texObj->WrapR;
         entry->wrap_s = texObj->WrapS;
         entry->wrap_t = texObj->WrapT;
index 3c3b3473d63b785760445605e5d403aa5b77df24..63fc8a004fd466a833675edef355a6d4279949f8 100644 (file)
@@ -62,6 +62,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
 {
    GLcontext *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));
@@ -103,11 +104,14 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
 
    /* as far as we can tell */
    key->computes_depth =
-      (fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) != 0;
+      (fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) != 0;
 
    /* _NEW_COLOR */
    key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled;
-   key->is_glsl = brw_wm_is_glsl(fp);
+   key->is_glsl = bfp->isGLSL;
+
+   /* temporary sanity check assertion */
+   ASSERT(bfp->isGLSL == brw_wm_is_glsl(fp));
 
    /* XXX: This needs a flag to indicate when it changes. */
    key->stats_wm = intel->stats_wm;
index d70f9c646cdae439c3b95051e95a17c73304e421..9b320480b6d0411862f569230c008ba8362585da 100644 (file)
@@ -139,7 +139,18 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum depth_mode )
       return BRW_SURFACEFORMAT_BC1_UNORM_SRGB;
 
    case MESA_FORMAT_S8_Z24:
-      return BRW_SURFACEFORMAT_I24X8_UNORM;
+      /* XXX: these different surface formats don't seem to
+       * make any difference for shadow sampler/compares.
+       */
+      if (depth_mode == GL_INTENSITY) 
+         return BRW_SURFACEFORMAT_I24X8_UNORM;
+      else if (depth_mode == GL_ALPHA)
+         return BRW_SURFACEFORMAT_A24X8_UNORM;
+      else
+         return BRW_SURFACEFORMAT_L24X8_UNORM;
+
+   case MESA_FORMAT_DUDV8:
+      return BRW_SURFACEFORMAT_R8G8_SNORM;
 
    default:
       assert(0);
@@ -381,8 +392,7 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region,
          * a more restrictive relocation to emit.
          */
         dri_bo_emit_reloc(brw->wm.surf_bo[unit],
-                          I915_GEM_DOMAIN_RENDER |
-                          I915_GEM_DOMAIN_SAMPLER,
+                          I915_GEM_DOMAIN_RENDER,
                           I915_GEM_DOMAIN_RENDER,
                           0,
                           offsetof(struct brw_surface_state, ss1),
@@ -447,13 +457,13 @@ static void prepare_wm_surfaces(struct brw_context *brw )
    GLuint i;
    int old_nr_surfaces;
 
-   if (brw->state.nr_draw_regions  > 1) {
-      for (i = 0; i < brw->state.nr_draw_regions; i++) {
-         brw_update_region_surface(brw, brw->state.draw_regions[i], i,
+   if (brw->state.nr_color_regions  > 1) {
+      for (i = 0; i < brw->state.nr_color_regions; i++) {
+         brw_update_region_surface(brw, brw->state.color_regions[i], i,
                                   GL_FALSE);
       }
-   }else {
-      brw_update_region_surface(brw, brw->state.draw_regions[0], 0, GL_TRUE);
+   } else {
+      brw_update_region_surface(brw, brw->state.color_regions[0], 0, GL_TRUE);
    }
 
    old_nr_surfaces = brw->wm.nr_surfaces;
index 9d9937289a89e3f18ff31d8ba4ad640f5f95042c..29dc05c518e4a8c099b6da2b37e5501e09651ddb 100644 (file)
@@ -207,7 +207,7 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
              used);
 
    /* Emit a flush if the bufmgr doesn't do it for us. */
-   if (!intel->ttm) {
+   if (intel->always_flush_cache || !intel->ttm) {
       *(GLuint *) (batch->ptr) = intel->vtbl.flush_cmd();
       batch->ptr += 4;
       used = batch->ptr - batch->map;
index 208f90c0abbd67174ce06be281437dbc0f468aef..4e033082b4d6e7af655718fa7be2ec181cca5b65 100644 (file)
@@ -332,6 +332,8 @@ intelEmitCopyBlit(struct intel_context *intel,
 
    switch (cpp) {
    case 1:
+      CMD = XY_SRC_COPY_BLT_CMD;
+      break;
    case 2:
    case 3:
       BR13 |= (1 << 24);
@@ -562,7 +564,6 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
             }
          }
       }
-      intel_batchbuffer_emit_mi_flush(intel->batch);
    }
 
    UNLOCK_HARDWARE(intel);
index 60d7bb3770cdff552ff41ee10fa75a1f7bbbd9f8..b7c7eeb368ff09a047c100bed74df426d56918d9 100644 (file)
@@ -35,9 +35,6 @@
 #include "intel_batchbuffer.h"
 #include "intel_regions.h"
 
-static GLboolean intel_bufferobj_unmap(GLcontext * ctx,
-                                      GLenum target,
-                                      struct gl_buffer_object *obj);
 
 /** Allocates a new dri_bo to store the data for the buffer object. */
 static void
@@ -103,12 +100,7 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj)
    struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
 
    assert(intel_obj);
-
-   /* Buffer objects are automatically unmapped when deleting according
-    * to the spec.
-    */
-   if (obj->Pointer)
-      intel_bufferobj_unmap(ctx, 0, obj);
+   assert(!obj->Pointer); /* Mesa should have unmapped it */
 
    if (intel_obj->region) {
       intel_bufferobj_release_region(intel, intel_obj);
@@ -141,11 +133,7 @@ intel_bufferobj_data(GLcontext * ctx,
    intel_obj->Base.Size = size;
    intel_obj->Base.Usage = usage;
 
-   /* Buffer objects are automatically unmapped when creating new data buffers
-    * according to the spec.
-    */
-   if (obj->Pointer)
-      intel_bufferobj_unmap(ctx, 0, obj);
+   assert(!obj->Pointer); /* Mesa should have unmapped it */
 
    if (intel_obj->region)
       intel_bufferobj_release_region(intel, intel_obj);
index 7f2144abd4b93adb55620b5503113ac98d017a3e..0929a2c223cc49bbb0f49619a010739b5117772c 100644 (file)
@@ -263,7 +263,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
       }
    }
    else {
-      /* XXX FBO: instead of FALSE, pass ctx->Stencil.Enabled ??? */
+      /* XXX FBO: instead of FALSE, pass ctx->Stencil._Enabled ??? */
       FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, GL_FALSE);
    }
 
@@ -274,9 +274,14 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
       ctx->Driver.Enable(ctx, GL_DEPTH_TEST,
                          (ctx->Depth.Test && fb->Visual.depthBits > 0));
       ctx->Driver.Enable(ctx, GL_STENCIL_TEST,
-                         (ctx->Stencil.Enabled && fb->Visual.stencilBits > 0));
+                         (ctx->Stencil._Enabled && fb->Visual.stencilBits > 0));
    }
    else {
+      /* Mesa's Stencil._Enabled field is updated when
+       * _NEW_BUFFERS | _NEW_STENCIL, but i965 code assumes that the value
+       * only changes with _NEW_STENCIL (which seems sensible).  So flag it
+       * here since this is the _NEW_BUFFERS path.
+       */
       ctx->NewState |= (_NEW_DEPTH | _NEW_STENCIL);
    }
 
index d1b4941601e63e44aaddbffc07a09409a5cfe076..4593d90df3d2f95e2bf8a059a604bbbce8034ee6 100644 (file)
 #define PCI_CHIP_G33_G                 0x29C2
 #define PCI_CHIP_Q33_G                 0x29D2
 
+#define PCI_CHIP_IGD_GM                        0xA011
+#define PCI_CHIP_IGD_G                 0xA001
+
+#define IS_IGDGM(devid)        (devid == PCI_CHIP_IGD_GM)
+#define IS_IGDG(devid) (devid == PCI_CHIP_IGD_G)
+#define IS_IGD(devid) (IS_IGDG(devid) || IS_IGDGM(devid))
+
 #define PCI_CHIP_I965_G                        0x29A2
 #define PCI_CHIP_I965_Q                        0x2992
 #define PCI_CHIP_I965_G_1              0x2982
@@ -66,7 +73,7 @@
                                 devid == PCI_CHIP_I945_GME || \
                                 devid == PCI_CHIP_I965_GM || \
                                 devid == PCI_CHIP_I965_GME || \
-                                devid == PCI_CHIP_GM45_GM)
+                                devid == PCI_CHIP_GM45_GM || IS_IGD(devid))
 
 #define IS_G45(devid)           (devid == PCI_CHIP_IGD_E_G || \
                                  devid == PCI_CHIP_Q45_G || \
@@ -84,7 +91,7 @@
                                 devid == PCI_CHIP_I945_GME || \
                                 devid == PCI_CHIP_G33_G || \
                                 devid == PCI_CHIP_Q33_G || \
-                                devid == PCI_CHIP_Q35_G)
+                                devid == PCI_CHIP_Q35_G || IS_IGD(devid))
 
 #define IS_965(devid)          (devid == PCI_CHIP_I965_G || \
                                 devid == PCI_CHIP_I965_Q || \
index b229136316447af3721c11a5b08cb0653b61fdfa..28281b38615d008ac08864bbc083497f719a9aeb 100644 (file)
 
 #define FILE_DEBUG_FLAG DEBUG_BLIT
 
+#define TRI_CLEAR_COLOR_BITS (BUFFER_BIT_BACK_LEFT |                   \
+                             BUFFER_BIT_FRONT_LEFT |                   \
+                             BUFFER_BIT_COLOR0 |                       \
+                             BUFFER_BIT_COLOR1 |                       \
+                             BUFFER_BIT_COLOR2 |                       \
+                             BUFFER_BIT_COLOR3 |                       \
+                             BUFFER_BIT_COLOR4 |                       \
+                             BUFFER_BIT_COLOR5 |                       \
+                             BUFFER_BIT_COLOR6 |                       \
+                             BUFFER_BIT_COLOR7)
+
 /**
  * Perform glClear where mask contains only color, depth, and/or stencil.
  *
@@ -72,11 +83,11 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
    struct gl_framebuffer *fb = ctx->DrawBuffer;
    int i;
    GLboolean saved_fp_enable = GL_FALSE, saved_vp_enable = GL_FALSE;
-   GLboolean saved_shader_program = 0;
+   GLuint saved_shader_program = 0;
    unsigned int saved_active_texture;
 
-   assert((mask & ~(BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT |
-                   BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) == 0);
+   assert((mask & ~(TRI_CLEAR_COLOR_BITS | BUFFER_BIT_DEPTH |
+                   BUFFER_BIT_STENCIL)) == 0);
 
    _mesa_PushAttrib(GL_COLOR_BUFFER_BIT |
                    GL_CURRENT_BIT |
@@ -170,11 +181,11 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
 
    while (mask != 0) {
       GLuint this_mask = 0;
+      GLuint color_bit;
 
-      if (mask & BUFFER_BIT_BACK_LEFT)
-        this_mask = BUFFER_BIT_BACK_LEFT;
-      else if (mask & BUFFER_BIT_FRONT_LEFT)
-        this_mask = BUFFER_BIT_FRONT_LEFT;
+      color_bit = _mesa_ffs(mask & TRI_CLEAR_COLOR_BITS);
+      if (color_bit != 0)
+        this_mask |= (1 << (color_bit - 1));
 
       /* Clear depth/stencil in the same pass as color. */
       this_mask |= (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL));
@@ -186,6 +197,9 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
         _mesa_DrawBuffer(GL_FRONT_LEFT);
       else if (this_mask & BUFFER_BIT_BACK_LEFT)
         _mesa_DrawBuffer(GL_BACK_LEFT);
+      else if (color_bit != 0)
+        _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0 +
+                         (color_bit - BUFFER_COLOR0 - 1));
       else
         _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
 
@@ -233,13 +247,10 @@ static const char *buffer_names[] = {
    [BUFFER_BACK_LEFT] = "back",
    [BUFFER_FRONT_RIGHT] = "front right",
    [BUFFER_BACK_RIGHT] = "back right",
-   [BUFFER_AUX0] = "aux0",
-   [BUFFER_AUX1] = "aux1",
-   [BUFFER_AUX2] = "aux2",
-   [BUFFER_AUX3] = "aux3",
    [BUFFER_DEPTH] = "depth",
    [BUFFER_STENCIL] = "stencil",
    [BUFFER_ACCUM] = "accum",
+   [BUFFER_AUX0] = "aux0",
    [BUFFER_COLOR0] = "color0",
    [BUFFER_COLOR1] = "color1",
    [BUFFER_COLOR2] = "color2",
@@ -313,8 +324,11 @@ intelClear(GLcontext *ctx, GLbitfield mask)
     * buffer with it.
     */
    if (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) {
-      tri_mask |= blit_mask & BUFFER_BIT_BACK_LEFT;
-      blit_mask &= ~BUFFER_BIT_BACK_LEFT;
+      int color_bit = _mesa_ffs(mask & TRI_CLEAR_COLOR_BITS);
+      if (color_bit != 0) {
+        tri_mask |= blit_mask & (1 << (color_bit - 1));
+        blit_mask &= ~(1 << (color_bit - 1));
+      }
    }
 
    /* SW fallback clearing */
index d7ccfa0605890e43c179510e719a4862bc3dcf29..888bb3f18f6fe2f6239b90e45592a03124d0bdd8 100644 (file)
@@ -123,6 +123,10 @@ intelGetString(GLcontext * ctx, GLenum name)
       case PCI_CHIP_Q33_G:
         chipset = "Intel(R) Q33";
         break;
+      case PCI_CHIP_IGD_GM:
+      case PCI_CHIP_IGD_G:
+        chipset = "Intel(R) IGD";
+        break;
       case PCI_CHIP_I965_Q:
         chipset = "Intel(R) 965Q";
         break;
@@ -502,10 +506,16 @@ intelInitContext(struct intel_context *intel,
     * start.
     */
    if (getenv("INTEL_STRICT_CONFORMANCE")) {
-      intel->strict_conformance = 1;
+      unsigned int value = atoi(getenv("INTEL_STRICT_CONFORMANCE"));
+      if (value > 0) {
+         intel->conformance_mode = value;
+      }
+      else {
+         intel->conformance_mode = 1;
+      }
    }
 
-   if (intel->strict_conformance) {
+   if (intel->conformance_mode > 0) {
       ctx->Const.MinLineWidth = 1.0;
       ctx->Const.MinLineWidthAA = 1.0;
       ctx->Const.MaxLineWidth = 1.0;
@@ -573,8 +583,6 @@ intelInitContext(struct intel_context *intel,
 
    intel->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
 
-   _math_matrix_ctr(&intel->ViewportMatrix);
-
    if (IS_965(intelScreen->deviceID) && !intel->intelScreen->irq_active) {
       _mesa_printf("IRQs not active.  Exiting\n");
       exit(1);
@@ -610,6 +618,16 @@ intelInitContext(struct intel_context *intel,
       intel->no_rast = 1;
    }
 
+   if (driQueryOptionb(&intel->optionCache, "always_flush_batch")) {
+      fprintf(stderr, "flushing batchbuffer before/after each draw call\n");
+      intel->always_flush_batch = 1;
+   }
+
+   if (driQueryOptionb(&intel->optionCache, "always_flush_cache")) {
+      fprintf(stderr, "flushing GPU caches before/after each draw call\n");
+      intel->always_flush_cache = 1;
+   }
+
    /* Disable all hardware rendering (skip emitting batches and fences/waits
     * to the kernel)
     */
index 18dc43c4a42b6ee5e8c054a2960efa85ced9b1b8..e520ecf220d1b508963b0434a58129bf9447a217 100644 (file)
@@ -100,7 +100,6 @@ struct intel_context
                               GLuint num_regions);
 
       GLuint (*flush_cmd) (void);
-      void (*emit_flush) (struct intel_context *intel, GLuint unused);
 
       void (*reduced_primitive_state) (struct intel_context * intel,
                                        GLenum rprim);
@@ -229,7 +228,14 @@ struct intel_context
    GLboolean hw_stipple;
    GLboolean depth_buffer_is_float;
    GLboolean no_rast;
-   GLboolean strict_conformance;
+   GLboolean always_flush_batch;
+   GLboolean always_flush_cache;
+
+   /* 0 - nonconformant, best performance;
+    * 1 - fallback to sw for known conformance bugs
+    * 2 - always fallback to sw
+    */
+   GLuint conformance_mode;
 
    /* State for intelvb.c and inteltris.c.
     */
index 136221c37fc536de53c33e30122ca7f918850c18..f2e2e6193584107b0413b2f0eae78a0950da4d39 100644 (file)
@@ -1595,7 +1595,7 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
                  "3DPRIMITIVE: %s %s\n",
                  get_965_prim_type(data[0]),
                  (data[0] & (1 << 15)) ? "random" : "sequential");
-       instr_out(data, hw_offset, 1, "primitive count\n");
+       instr_out(data, hw_offset, 1, "vertex count\n");
        instr_out(data, hw_offset, 2, "start vertex\n");
        instr_out(data, hw_offset, 3, "instance count\n");
        instr_out(data, hw_offset, 4, "start instance\n");
diff --git a/src/mesa/drivers/dri/intel/intel_depthtmp.h b/src/mesa/drivers/dri/intel/intel_depthtmp.h
new file mode 100644 (file)
index 0000000..16d7708
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright Â© 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/**
+ * Wrapper around the depthtmp.h macrofest to generate spans code for
+ * all the tiling styles.
+ */
+
+#define VALUE_TYPE INTEL_VALUE_TYPE
+#define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(NO_TILE(_x, _y), d)
+#define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(NO_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel##x)
+#include "depthtmp.h"
+
+#define VALUE_TYPE INTEL_VALUE_TYPE
+#define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(X_TILE(_x, _y), d)
+#define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(X_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel_XTile_##x)
+#include "depthtmp.h"
+
+#define VALUE_TYPE INTEL_VALUE_TYPE
+#define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(Y_TILE(_x, _y), d)
+#define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(Y_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel_YTile_##x)
+#include "depthtmp.h"
+
+#undef INTEL_VALUE_TYPE
+#undef INTEL_WRITE_DEPTH
+#undef INTEL_READ_DEPTH
+#undef INTEL_TAG
index 28223ca1415c69a448df0b5fffaf0d29bf662760..8dd0b2461bde3a826f242e0db3fcefedc63d6588 100644 (file)
@@ -49,6 +49,7 @@
 #define need_GL_EXT_secondary_color
 #define need_GL_EXT_stencil_two_side
 #define need_GL_ATI_separate_stencil
+#define need_GL_ATI_envmap_bumpmap
 #define need_GL_NV_point_sprite
 #define need_GL_NV_vertex_program
 #define need_GL_VERSION_2_0
@@ -129,11 +130,7 @@ static const struct dri_extension brw_extensions[] = {
    { "GL_ARB_point_sprite",              NULL },
    { "GL_ARB_shader_objects",             GL_ARB_shader_objects_functions },
    { "GL_ARB_shading_language_100",       GL_VERSION_2_0_functions },
-#if 0
-   /* Support for GLSL 1.20 is currently broken in core Mesa.
-    */
    { "GL_ARB_shading_language_120",       GL_VERSION_2_1_functions },
-#endif
    { "GL_ARB_shadow",                     NULL },
    { "GL_ARB_texture_non_power_of_two",   NULL },
    { "GL_ARB_vertex_shader",              GL_ARB_vertex_shader_functions },
@@ -142,6 +139,7 @@ static const struct dri_extension brw_extensions[] = {
    { "GL_EXT_texture_sRGB",              NULL },
    { "GL_EXT_texture_swizzle",           NULL },
    { "GL_EXT_vertex_array_bgra",         NULL },
+   { "GL_ATI_envmap_bumpmap",             GL_ATI_envmap_bumpmap_functions },
    { "GL_ATI_separate_stencil",           GL_ATI_separate_stencil_functions },
    { "GL_ATI_texture_env_combine3",       NULL },
    { "GL_NV_texture_env_combine4",        NULL },
index 54d6044ad3b6796b6bac2f5429540906c6c78a37..a401f730ba219c71656d65f86148ba163a546a08 100644 (file)
@@ -210,7 +210,8 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
       DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width,
          height, pitch);
 
-      irb->region = intel_region_alloc(intel, cpp, width, height, pitch);
+      irb->region = intel_region_alloc(intel, cpp, width, height, pitch,
+                                      GL_TRUE);
       if (!irb->region)
          return GL_FALSE;       /* out of memory? */
 
@@ -322,6 +323,15 @@ intel_create_renderbuffer(GLenum intFormat)
       irb->Base.BlueBits = 5;
       irb->Base.DataType = GL_UNSIGNED_BYTE;
       break;
+   case GL_RGB8:
+      irb->Base._ActualFormat = GL_RGB8;
+      irb->Base._BaseFormat = GL_RGB;
+      irb->Base.RedBits = 8;
+      irb->Base.GreenBits = 8;
+      irb->Base.BlueBits = 8;
+      irb->Base.AlphaBits = 0;
+      irb->Base.DataType = GL_UNSIGNED_BYTE;
+      break;
    case GL_RGBA8:
       irb->Base._ActualFormat = GL_RGBA8;
       irb->Base._BaseFormat = GL_RGBA;
@@ -602,19 +612,16 @@ static void
 intel_finish_render_texture(GLcontext * ctx,
                             struct gl_renderbuffer_attachment *att)
 {
-   struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer);
-
-   DBG("End render texture (tid %x) tex %u\n", _glthread_GetID(), att->Texture->Name);
-
-   if (irb) {
-      /* just release the region */
-      intel_region_release(&irb->region);
-   }
-   else if (att->Renderbuffer) {
-      /* software fallback */
-      _mesa_finish_render_texture(ctx, att);
-      /* XXX FBO: Need to unmap the buffer (or in intelSpanRenderStart???) */
-   }
+   /* no-op
+    * Previously we released the renderbuffer's intel_region but
+    * that's not necessary and actually caused problems when trying
+    * to do a glRead/CopyPixels from the renderbuffer later.
+    * The region will be released later if the texture is replaced
+    * or the renderbuffer deleted.
+    *
+    * The intention of this driver hook is more of a "done rendering
+    * to texture, please re-twiddle/etc if necessary".
+    */
 }
 
 
@@ -624,6 +631,7 @@ intel_finish_render_texture(GLcontext * ctx,
 static void
 intel_validate_framebuffer(GLcontext *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 =
@@ -635,6 +643,35 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
        */
       fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
    }
+
+   /* check that texture color buffers are a format we can render into */
+   {
+      const struct gl_texture_format *supportedFormat;
+      GLuint i;
+
+      /* The texture format we can render into seems to depend on the
+       * screen depth.  There currently seems to be a problem when
+       * rendering into a rgb565 texture when the screen is abgr8888.
+       */
+
+      if (intel->ctx.Visual.rgbBits >= 24)
+         supportedFormat = &_mesa_texformat_argb8888;
+      else 
+         supportedFormat = &_mesa_texformat_rgb565;
+
+      for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+         const struct gl_texture_object *texObj =
+            fb->Attachment[BUFFER_COLOR0 + i].Texture;
+         if (texObj) {
+            const struct gl_texture_image *texImg =
+               texObj->Image[0][texObj->BaseLevel];
+            if (texImg && texImg->TexFormat != supportedFormat) {
+               fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+               break;
+            }
+         }
+      }
+   }
 }
 
 
index bf1c3f03f0e1983e3d09e8bb9e2fe3467e01c094..6e1e034e53d60936f237ea76495de4e4ae6da769 100644 (file)
@@ -103,7 +103,8 @@ intel_miptree_create(struct intel_context *intel,
                     GLuint last_level,
                     GLuint width0,
                     GLuint height0,
-                    GLuint depth0, GLuint cpp, GLuint compress_byte)
+                    GLuint depth0, GLuint cpp, GLuint compress_byte,
+                    GLboolean expect_accelerated_upload)
 {
    struct intel_mipmap_tree *mt;
 
@@ -120,7 +121,8 @@ intel_miptree_create(struct intel_context *intel,
                                   mt->cpp,
                                   mt->pitch,
                                   mt->total_height,
-                                  mt->pitch);
+                                  mt->pitch,
+                                  expect_accelerated_upload);
 
    if (!mt->region) {
        free(mt);
index c9537dbb9a48908a63c0361ab75199a100ebee59..4060b9df78f8857e1329c959a6d8e36958e69495 100644 (file)
@@ -133,7 +133,8 @@ struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel,
                                                GLuint height0,
                                                GLuint depth0,
                                                GLuint cpp,
-                                               GLuint compress_byte);
+                                               GLuint compress_byte,
+                                              GLboolean expect_accelerated_upload);
 
 struct intel_mipmap_tree *
 intel_miptree_create_for_region(struct intel_context *intel,
index 5e32288844c48b0eb664866d5391f45d260aaf42..7041ff389ac53b2058a53204ebf2d55802f8f5d9 100644 (file)
@@ -30,6 +30,7 @@
 #include "main/context.h"
 #include "main/enable.h"
 #include "main/matrix.h"
+#include "main/viewport.h"
 #include "swrast/swrast.h"
 #include "shader/arbprogram.h"
 #include "shader/program.h"
@@ -112,7 +113,7 @@ intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one)
       return GL_FALSE;
    }
 
-   if (ctx->Stencil.Enabled) {
+   if (ctx->Stencil._Enabled) {
       DBG("fallback due to image stencil\n");
       return GL_FALSE;
    }
index 7c7aa6097c847ba717ef7a76af7dab0f64568d1a..d50dd68092d8827fdbf8e6b7676e6f8786c20571 100644 (file)
@@ -87,7 +87,7 @@ intel_check_copypixel_blit_fragment_ops(GLcontext * ctx)
             ctx->Color.AlphaEnabled ||
             ctx->Depth.Test ||
             ctx->Fog.Enabled ||
-            ctx->Stencil.Enabled ||
+            ctx->Stencil._Enabled ||
             !ctx->Color.ColorMask[0] ||
             !ctx->Color.ColorMask[1] ||
             !ctx->Color.ColorMask[2] ||
index 7be7ea82b3562db053ae648fd9d2b0435d7dd46a..e8d5ac8569d58f9b25afbb1f237320e0174ace8a 100644 (file)
@@ -233,7 +233,7 @@ intel_stencil_drawpixels(GLcontext * ctx,
    }
 
    /* We don't support stencil testing/ops here */
-   if (ctx->Stencil.Enabled)
+   if (ctx->Stencil._Enabled)
       return GL_FALSE;
 
    /* We use FBOs for our wrapping of the depthbuffer into a color
index ec85c4131a13a20dab211523e79d6ec185ca197f..0aa5b8c02c904a2b31c7ea51b49357db9a6dabd4 100644 (file)
@@ -109,12 +109,18 @@ intel_region_alloc_internal(struct intel_context *intel,
 
 struct intel_region *
 intel_region_alloc(struct intel_context *intel,
-                   GLuint cpp, GLuint width, GLuint height, GLuint pitch)
+                   GLuint cpp, GLuint width, GLuint height, GLuint pitch,
+                  GLboolean expect_accelerated_upload)
 {
    dri_bo *buffer;
 
-   buffer = dri_bo_alloc(intel->bufmgr, "region",
-                        pitch * cpp * height, 64);
+   if (expect_accelerated_upload) {
+      buffer = drm_intel_bo_alloc_for_render(intel->bufmgr, "region",
+                                            pitch * cpp * height, 64);
+   } else {
+      buffer = drm_intel_bo_alloc(intel->bufmgr, "region",
+                                 pitch * cpp * height, 64);
+   }
 
    return intel_region_alloc_internal(intel, cpp, width, height, pitch, buffer);
 }
@@ -460,7 +466,8 @@ intel_recreate_static(struct intel_context *intel,
    else
       region->cpp = intel->ctx.Visual.rgbBits / 8;
    region->pitch = intelScreen->pitch;
-   region->height = intelScreen->height;     /* needed? */
+   region->width = intelScreen->width;
+   region->height = intelScreen->height;
 
    if (region->buffer != NULL) {
       dri_bo_unreference(region->buffer);
index 4b120ba4cee6c62bc0c4b5f8df5ff355a66075d5..45e2bf4e77ab3626b7c1493380b1561f428823a6 100644 (file)
@@ -74,7 +74,8 @@ struct intel_region
  */
 struct intel_region *intel_region_alloc(struct intel_context *intel,
                                         GLuint cpp, GLuint width,
-                                        GLuint height, GLuint pitch);
+                                        GLuint height, GLuint pitch,
+                                       GLboolean expect_accelerated_upload);
 
 struct intel_region *
 intel_region_alloc_for_handle(struct intel_context *intel,
index a52271158c6bf43bea362d7ad7658aa47b7d753b..e8c074712cd759f7bd6b7767abc9dc91654f614d 100644 (file)
@@ -71,10 +71,12 @@ PUBLIC const char __driConfigOptions[] =
    DRI_CONF_SECTION_END
    DRI_CONF_SECTION_DEBUG
      DRI_CONF_NO_RAST(false)
+     DRI_CONF_ALWAYS_FLUSH_BATCH(false)
+     DRI_CONF_ALWAYS_FLUSH_CACHE(false)
    DRI_CONF_SECTION_END
 DRI_CONF_END;
 
-const GLuint __driNConfigOptions = 6;
+const GLuint __driNConfigOptions = 8;
 
 #ifdef USE_NEW_INTERFACE
 static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
@@ -302,6 +304,7 @@ intelDestroyScreen(__DRIscreenPrivate * sPriv)
 
    dri_bufmgr_destroy(intelScreen->bufmgr);
    intelUnmapScreenRegions(intelScreen);
+   driDestroyOptionCache(&intelScreen->optionCache);
 
    FREE(intelScreen);
    sPriv->private = NULL;
@@ -322,7 +325,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
    else {
       GLboolean swStencil = (mesaVis->stencilBits > 0 &&
                              mesaVis->depthBits != 24);
-      GLenum rgbFormat = (mesaVis->redBits == 5 ? GL_RGB5 : GL_RGBA8);
+      GLenum rgbFormat;
 
       struct intel_framebuffer *intel_fb = CALLOC_STRUCT(intel_framebuffer);
 
@@ -331,6 +334,13 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
 
       _mesa_initialize_framebuffer(&intel_fb->Base, mesaVis);
 
+      if (mesaVis->redBits == 5)
+        rgbFormat = GL_RGB5;
+      else if (mesaVis->alphaBits == 0)
+        rgbFormat = GL_RGB8;
+      else
+        rgbFormat = GL_RGBA8;
+
       /* setup the hardware-based renderbuffers */
       intel_fb->color_rb[0] = intel_create_renderbuffer(rgbFormat);
       _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT,
@@ -384,7 +394,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
 static void
 intelDestroyBuffer(__DRIdrawablePrivate * driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 
@@ -757,13 +767,34 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
    fb_format[2] = GL_BGRA;
    fb_type[2] = GL_UNSIGNED_INT_8_8_8_8_REV;
 
+   depth_bits[0] = 0;
+   stencil_bits[0] = 0;
+
    for (color = 0; color < ARRAY_SIZE(fb_format); color++) {
       __DRIconfig **new_configs;
+      int depth_factor;
 
+      /* With DRI2 right now, GetBuffers always returns a depth/stencil buffer
+       * with the same cpp as the drawable.  So we can't support depth cpp !=
+       * color cpp currently.
+       */
+      if (fb_type[color] == GL_UNSIGNED_SHORT_5_6_5) {
+        depth_bits[1] = 16;
+        stencil_bits[1] = 0;
+
+        depth_factor = 2;
+      } else {
+        depth_bits[1] = 24;
+        stencil_bits[1] = 0;
+        depth_bits[2] = 24;
+        stencil_bits[2] = 8;
+
+        depth_factor = 3;
+      }
       new_configs = driCreateConfigs(fb_format[color], fb_type[color],
                                     depth_bits,
                                     stencil_bits,
-                                    ARRAY_SIZE(depth_bits),
+                                    depth_factor,
                                     back_buffer_modes,
                                     ARRAY_SIZE(back_buffer_modes),
                                     msaa_samples_array,
index bdd2fd9e85758ec274315c88cbb7ff1365dc4ee0..c3a873f1abdc42e299c0ce46ec1aac1b7fd9cb89 100644 (file)
@@ -131,6 +131,18 @@ pwrite_8(struct intel_renderbuffer *irb, uint32_t offset, uint8_t val)
    dri_bo_subdata(irb->region->buffer, offset, 1, &val);
 }
 
+static uint32_t
+z24s8_to_s8z24(uint32_t val)
+{
+   return (val << 24) | (val >> 8);
+}
+
+static uint32_t
+s8z24_to_z24s8(uint32_t val)
+{
+   return (val >> 24) | (val << 8);
+}
+
 static uint32_t no_tile_swizzle(struct intel_renderbuffer *irb,
                                int x, int y)
 {
@@ -293,101 +305,29 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
 #define X_TILE(_X, _Y) x_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off)
 #define Y_TILE(_X, _Y) y_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off)
 
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x)    intel##x##_RGB565
-#define TAG2(x,y) intel##x##_RGB565##y
-#define GET_VALUE(X, Y) pread_16(irb, NO_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_16(irb, NO_TILE(X, Y), V)
-#include "spantmp2.h"
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x)    intel##x##_ARGB8888
-#define TAG2(x,y) intel##x##_ARGB8888##y
-#define GET_VALUE(X, Y) pread_32(irb, NO_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_32(irb, NO_TILE(X, Y), V)
-#include "spantmp2.h"
-
-/* 32 bit, xRGB8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x)    intel##x##_xRGB8888
-#define TAG2(x,y) intel##x##_xRGB8888##y
-#define GET_VALUE(X, Y) pread_xrgb8888(irb, NO_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_xrgb8888(irb, NO_TILE(X, Y), V)
-#include "spantmp2.h"
-
-/* 16 bit RGB565 color tile spanline and pixel functions
- */
-
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x)    intel_XTile_##x##_RGB565
-#define TAG2(x,y) intel_XTile_##x##_RGB565##y
-#define GET_VALUE(X, Y) pread_16(irb, X_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_16(irb, X_TILE(X, Y), V)
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x)    intel_YTile_##x##_RGB565
-#define TAG2(x,y) intel_YTile_##x##_RGB565##y
-#define GET_VALUE(X, Y) pread_16(irb, Y_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_16(irb, Y_TILE(X, Y), V)
-#include "spantmp2.h"
-
-/* 32 bit ARGB888 color tile spanline and pixel functions
- */
-
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x)    intel_XTile_##x##_ARGB8888
-#define TAG2(x,y) intel_XTile_##x##_ARGB8888##y
-#define GET_VALUE(X, Y) pread_32(irb, X_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_32(irb, X_TILE(X, Y), V)
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x)    intel_YTile_##x##_ARGB8888
-#define TAG2(x,y) intel_YTile_##x##_ARGB8888##y
-#define GET_VALUE(X, Y) pread_32(irb, Y_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_32(irb, Y_TILE(X, Y), V)
-#include "spantmp2.h"
-
-/* 32 bit xRGB888 color tile spanline and pixel functions
- */
-
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x)    intel_XTile_##x##_xRGB8888
-#define TAG2(x,y) intel_XTile_##x##_xRGB8888##y
-#define GET_VALUE(X, Y) pread_xrgb8888(irb, X_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_xrgb8888(irb, X_TILE(X, Y), V)
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x)    intel_YTile_##x##_xRGB8888
-#define TAG2(x,y) intel_YTile_##x##_xRGB8888##y
-#define GET_VALUE(X, Y) pread_xrgb8888(irb, Y_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_xrgb8888(irb, Y_TILE(X, Y), V)
-#include "spantmp2.h"
+/* r5g6b5 color span and pixel functions */
+#define INTEL_PIXEL_FMT GL_RGB
+#define INTEL_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
+#define INTEL_READ_VALUE(offset) pread_16(irb, offset)
+#define INTEL_WRITE_VALUE(offset, v) pwrite_16(irb, offset, v)
+#define INTEL_TAG(x) x##_RGB565
+#include "intel_spantmp.h"
+
+/* a8r8g8b8 color span and pixel functions */
+#define INTEL_PIXEL_FMT GL_BGRA
+#define INTEL_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
+#define INTEL_READ_VALUE(offset) pread_32(irb, offset)
+#define INTEL_WRITE_VALUE(offset, v) pwrite_32(irb, offset, v)
+#define INTEL_TAG(x) x##_ARGB8888
+#include "intel_spantmp.h"
+
+/* x8r8g8b8 color span and pixel functions */
+#define INTEL_PIXEL_FMT GL_BGRA
+#define INTEL_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
+#define INTEL_READ_VALUE(offset) pread_xrgb8888(irb, offset)
+#define INTEL_WRITE_VALUE(offset, v) pwrite_xrgb8888(irb, offset, v)
+#define INTEL_TAG(x) x##_xRGB8888
+#include "intel_spantmp.h"
 
 #define LOCAL_DEPTH_VARS                                               \
    struct intel_context *intel = intel_context(ctx);                   \
@@ -402,98 +342,26 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
 
 #define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
 
-/**
- ** 16-bit depthbuffer functions.
- **/
-#define VALUE_TYPE GLushort
-#define WRITE_DEPTH(_x, _y, d) pwrite_16(irb, NO_TILE(_x, _y), d)
-#define READ_DEPTH(d, _x, _y) d = pread_16(irb, NO_TILE(_x, _y))
-#define TAG(x) intel##x##_z16
-#include "depthtmp.h"
+/* z16 depthbuffer functions. */
+#define INTEL_VALUE_TYPE GLushort
+#define INTEL_WRITE_DEPTH(offset, d) pwrite_16(irb, offset, d)
+#define INTEL_READ_DEPTH(offset) pread_16(irb, offset)
+#define INTEL_TAG(name) name##_z16
+#include "intel_depthtmp.h"
 
+/* z24 depthbuffer functions. */
+#define INTEL_VALUE_TYPE GLuint
+#define INTEL_WRITE_DEPTH(offset, d) pwrite_32(irb, offset, d)
+#define INTEL_READ_DEPTH(offset) pread_32(irb, offset)
+#define INTEL_TAG(name) name##_z24
+#include "intel_depthtmp.h"
 
-/**
- ** 16-bit x tile depthbuffer functions.
- **/
-#define VALUE_TYPE GLushort
-#define WRITE_DEPTH(_x, _y, d) pwrite_16(irb, X_TILE(_x, _y), d)
-#define READ_DEPTH(d, _x, _y) d = pread_16(irb, X_TILE(_x, _y))
-#define TAG(x) intel_XTile_##x##_z16
-#include "depthtmp.h"
-
-/**
- ** 16-bit y tile depthbuffer functions.
- **/
-#define VALUE_TYPE GLushort
-#define WRITE_DEPTH(_x, _y, d) pwrite_16(irb, Y_TILE(_x, _y), d)
-#define READ_DEPTH(d, _x, _y) d = pread_16(irb, Y_TILE(_x, _y))
-#define TAG(x) intel_YTile_##x##_z16
-#include "depthtmp.h"
-
-
-/**
- ** 24/8-bit interleaved depth/stencil functions
- ** Note: we're actually reading back combined depth+stencil values.
- ** The wrappers in main/depthstencil.c are used to extract the depth
- ** and stencil values.
- **/
-#define VALUE_TYPE GLuint
-
-/* Change ZZZS -> SZZZ */
-#define WRITE_DEPTH(_x, _y, d)                                 \
-   pwrite_32(irb, NO_TILE(_x, _y), ((d) >> 8) | ((d) << 24))
-
-/* Change SZZZ -> ZZZS */
-#define READ_DEPTH( d, _x, _y ) {                              \
-   GLuint tmp = pread_32(irb, NO_TILE(_x, _y));                        \
-   d = (tmp << 8) | (tmp >> 24);                               \
-}
-
-#define TAG(x) intel##x##_z24_s8
-#include "depthtmp.h"
-
-
-/**
- ** 24/8-bit x-tile interleaved depth/stencil functions
- ** Note: we're actually reading back combined depth+stencil values.
- ** The wrappers in main/depthstencil.c are used to extract the depth
- ** and stencil values.
- **/
-#define VALUE_TYPE GLuint
-
-/* Change ZZZS -> SZZZ */
-#define WRITE_DEPTH(_x, _y, d)                                 \
-   pwrite_32(irb, X_TILE(_x, _y), ((d) >> 8) | ((d) << 24))
-
-/* Change SZZZ -> ZZZS */
-#define READ_DEPTH( d, _x, _y ) {                              \
-   GLuint tmp = pread_32(irb, X_TILE(_x, _y));         \
-   d = (tmp << 8) | (tmp >> 24);                               \
-}
-
-#define TAG(x) intel_XTile_##x##_z24_s8
-#include "depthtmp.h"
-
-/**
- ** 24/8-bit y-tile interleaved depth/stencil functions
- ** Note: we're actually reading back combined depth+stencil values.
- ** The wrappers in main/depthstencil.c are used to extract the depth
- ** and stencil values.
- **/
-#define VALUE_TYPE GLuint
-
-/* Change ZZZS -> SZZZ */
-#define WRITE_DEPTH(_x, _y, d)                                 \
-   pwrite_32(irb, Y_TILE(_x, _y), ((d) >> 8) | ((d) << 24))
-
-/* Change SZZZ -> ZZZS */
-#define READ_DEPTH( d, _x, _y ) {                              \
-   GLuint tmp = pread_32(irb, Y_TILE(_x, _y));                 \
-   d = (tmp << 8) | (tmp >> 24);                               \
-}
-
-#define TAG(x) intel_YTile_##x##_z24_s8
-#include "depthtmp.h"
+/* z24s8 depthbuffer functions. */
+#define INTEL_VALUE_TYPE GLuint
+#define INTEL_WRITE_DEPTH(offset, d) pwrite_32(irb, offset, z24s8_to_s8z24(d))
+#define INTEL_READ_DEPTH(offset) s8z24_to_z24s8(pread_32(irb, offset))
+#define INTEL_TAG(name) name##_z24_s8
+#include "intel_depthtmp.h"
 
 
 /**
@@ -752,8 +620,21 @@ intel_set_span_functions(struct intel_context *intel,
         break;
       }
    }
-   else if (rb->_ActualFormat == GL_DEPTH_COMPONENT24 ||        /* XXX FBO remove */
-            rb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) {
+   else if (rb->_ActualFormat == GL_DEPTH_COMPONENT24) {
+      switch (tiling) {
+      case I915_TILING_NONE:
+      default:
+        intelInitDepthPointers_z24(rb);
+        break;
+      case I915_TILING_X:
+        intel_XTile_InitDepthPointers_z24(rb);
+        break;
+      case I915_TILING_Y:
+        intel_YTile_InitDepthPointers_z24(rb);
+        break;
+      }
+   }
+   else if (rb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) {
       switch (tiling) {
       case I915_TILING_NONE:
       default:
diff --git a/src/mesa/drivers/dri/intel/intel_spantmp.h b/src/mesa/drivers/dri/intel/intel_spantmp.h
new file mode 100644 (file)
index 0000000..ead0b1c
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright Â© 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/**
+ * Wrapper around the spantmp.h macrofest to generate spans code for
+ * all the tiling styles.
+ */
+
+#define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT
+#define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE
+#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(NO_TILE(_x, _y), v)
+#define GET_VALUE(_x, _y) INTEL_READ_VALUE(NO_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel##x)
+#define TAG2(x, y) INTEL_TAG(intel##x)##y
+#include "spantmp2.h"
+
+#define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT
+#define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE
+#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(X_TILE(_x, _y), v)
+#define GET_VALUE(_x, _y) INTEL_READ_VALUE(X_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel_XTile_##x)
+#define TAG2(x, y) INTEL_TAG(intel_XTile_##x)##y
+#include "spantmp2.h"
+
+#define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT
+#define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE
+#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(X_TILE(_x, _y), v)
+#define GET_VALUE(_x, _y) INTEL_READ_VALUE(X_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel_YTile_##x)
+#define TAG2(x, y) INTEL_TAG(intel_YTile_##x)##y
+#include "spantmp2.h"
+
+#undef INTEL_PIXEL_FMT
+#undef INTEL_PIXEL_TYPE
+#undef INTEL_WRITE_VALUE
+#undef INTEL_READ_VALUE
+#undef INTEL_TAG
index 2715a540d02799728f6e65c67a072dbffc847e62..8732354e7a5c42eff2da528dbfee76282a7d08a3 100644 (file)
@@ -3,11 +3,15 @@
 #include "main/texformat.h"
 #include "main/enums.h"
 
-/* It works out that this function is fine for all the supported
+
+/**
+ * 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
+ *
+ * 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...
  */
@@ -18,6 +22,11 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
    struct intel_context *intel = intel_context(ctx);
    const GLboolean do32bpt = (intel->ctx.Visual.rgbBits >= 24);
 
+#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:
@@ -165,6 +174,10 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
       return &_mesa_texformat_srgb_dxt1;
+
+   case GL_DUDV_ATI:
+   case GL_DU8DV8_ATI:
+      return &_mesa_texformat_dudv8;
 #endif
 
    default:
index 866022d0ce210af2a1ee0b76ea987948f728e3eb..943636c37b241daf682f535144c08685ce18cdc6 100644 (file)
@@ -62,7 +62,8 @@ logbase2(int n)
 static void
 guess_and_alloc_mipmap_tree(struct intel_context *intel,
                             struct intel_texture_object *intelObj,
-                            struct intel_texture_image *intelImage)
+                            struct intel_texture_image *intelImage,
+                           GLboolean expect_accelerated_upload)
 {
    GLuint firstLevel;
    GLuint lastLevel;
@@ -136,7 +137,8 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel,
                                        height,
                                        depth,
                                        intelImage->base.TexFormat->TexelBytes,
-                                       comp_byte);
+                                       comp_byte,
+                                      expect_accelerated_upload);
 
    DBG("%s - success\n", __FUNCTION__);
 }
@@ -385,7 +387,7 @@ intelTexImage(GLcontext * ctx,
    }
 
    if (!intelObj->mt) {
-      guess_and_alloc_mipmap_tree(intel, intelObj, intelImage);
+      guess_and_alloc_mipmap_tree(intel, intelObj, intelImage, pixels == NULL);
       if (!intelObj->mt) {
         DBG("guess_and_alloc_mipmap_tree: failed\n");
       }
@@ -415,7 +417,7 @@ intelTexImage(GLcontext * ctx,
                                            level, level,
                                            width, height, depth,
                                            intelImage->base.TexFormat->TexelBytes,
-                                           comp_byte);
+                                           comp_byte, pixels == NULL);
 
    }
 
@@ -753,16 +755,21 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
 
    _mesa_lock_texture(&intel->ctx, texObj);
 
+   texImage = _mesa_get_tex_image(&intel->ctx, texObj, target, level);
+   intelImage = intel_texture_image(texImage);
+
+   if (intelImage->mt) {
+      intel_miptree_release(intel, &intelImage->mt);
+      assert(!texImage->Data);
+   }
    if (intelObj->mt)
       intel_miptree_release(intel, &intelObj->mt);
 
    intelObj->mt = mt;
-   texImage = _mesa_get_tex_image(&intel->ctx, texObj, target, level);
    _mesa_init_teximage_fields(&intel->ctx, target, texImage,
                              rb->region->width, rb->region->height, 1,
                              0, internalFormat);
 
-   intelImage = intel_texture_image(texImage);
    intelImage->face = target_to_face(target);
    intelImage->level = level;
    texImage->TexFormat = intelChooseTextureFormat(&intel->ctx, internalFormat,
index 820683d42eb6d5e86922694e403b7953e5eaf25b..05a375e1f3b375c4e28f6af64777bb595dbd81de 100644 (file)
@@ -206,7 +206,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
                                           firstImage->base.Height,
                                           firstImage->base.Depth,
                                           cpp,
-                                          comp_byte);
+                                          comp_byte,
+                                         GL_TRUE);
    }
 
    /* Pull in any images not in the object's tree:
index 43e59594dd5ea0157be9a8e417d0d89f6cc6904d..6440027ca4a6f0976c3c0c1c83ca295859e81e59 100644 (file)
@@ -374,7 +374,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
 static void
 mach64DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 
index d4c5b6fd97bf3f9dd6bee1d928fdb119946daa2e..ad765d1dd76f5ae29d80220b2a1b7ab6e0bd8bce 100644 (file)
@@ -206,8 +206,8 @@ static void mgaUpdateTextureEnvG200( GLcontext *ctx, GLuint unit )
    mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
    GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat;
 
-   if (tObj != ctx->Texture.Unit[0].Current2D &&
-       tObj != ctx->Texture.Unit[0].CurrentRect)
+   if (tObj != ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX] &&
+       tObj != ctx->Texture.Unit[0].CurrentTex[TEXTURE_RECT_INDEX])
       return;
 
 
@@ -635,8 +635,8 @@ static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit )
    mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
    GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat;
 
-   if (tObj != ctx->Texture.Unit[source].Current2D &&
-       tObj != ctx->Texture.Unit[source].CurrentRect)
+   if (tObj != ctx->Texture.Unit[source].CurrentTex[TEXTURE_2D_INDEX] &&
+       tObj != ctx->Texture.Unit[source].CurrentTex[TEXTURE_RECT_INDEX])
       return;
 
    switch (ctx->Texture.Unit[source].EnvMode) {
index 926534d6dff7845b6ada697a4fa379046c3b77de..0dc76fea50a490ad6a850c17f09940250b3c591d 100644 (file)
@@ -816,7 +816,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
 static void
 mgaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 static void
index 9f90047ba5985f61a0479ece921d9e15a30d75ee..977dfa0b760dfac393321e76f6b21e7671a18157 100644 (file)
@@ -133,7 +133,7 @@ check_color_per_fragment_ops( const GLcontext *ctx )
                    ctx->Depth.Test ||
                    ctx->Fog.Enabled ||
                    ctx->Scissor.Enabled ||
-                   ctx->Stencil.Enabled ||
+                   ctx->Stencil._Enabled ||
                    !ctx->Color.ColorMask[0] ||
                    !ctx->Color.ColorMask[1] ||
                    !ctx->Color.ColorMask[2] ||
index 7cda4ca5d38a952559c607185d5249dd3619671c..f5bcc2f2906bd414486c3d0319c8d858e5a68c14 100644 (file)
@@ -353,7 +353,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
 static void
 r128DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 
index a6c655866ac4bfb2a2ec49d5e47962cee57b5fd7..354daef07f62d5709ce1d9da2d1f002f0be2381a 100644 (file)
@@ -87,7 +87,7 @@ check_color_per_fragment_ops( const GLcontext *ctx )
                    ctx->Depth.Test ||
                    ctx->Fog.Enabled ||
                    ctx->Scissor.Enabled ||
-                   ctx->Stencil.Enabled ||
+                   ctx->Stencil._Enabled ||
                    !ctx->Color.ColorMask[0] ||
                    !ctx->Color.ColorMask[1] ||
                    !ctx->Color.ColorMask[2] ||
index 058e0ee5bec394be4ae64eaa4da352e7351b8198..e9cee1a637d0a9d9f9cddfebed09187ff0617531 100644 (file)
@@ -1234,26 +1234,26 @@ static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
       fprintf(stderr, "%s unit %d\n", __FUNCTION__, unit);
 
    if (texUnit->TexGenEnabled & S_BIT) {
-      mode = texUnit->GenModeS;
+      mode = texUnit->GenS.Mode;
    } else {
       tgcm |= R200_TEXGEN_COMP_S << (unit * 4);
    }
 
    if (texUnit->TexGenEnabled & T_BIT) {
-      if (texUnit->GenModeT != mode)
+      if (texUnit->GenT.Mode != mode)
         mixed_fallback = GL_TRUE;
    } else {
       tgcm |= R200_TEXGEN_COMP_T << (unit * 4);
    }
    if (texUnit->TexGenEnabled & R_BIT) {
-      if (texUnit->GenModeR != mode)
+      if (texUnit->GenR.Mode != mode)
         mixed_fallback = GL_TRUE;
    } else {
       tgcm |= R200_TEXGEN_COMP_R << (unit * 4);
    }
 
    if (texUnit->TexGenEnabled & Q_BIT) {
-      if (texUnit->GenModeQ != mode)
+      if (texUnit->GenQ.Mode != mode)
         mixed_fallback = GL_TRUE;
    } else {
       tgcm |= R200_TEXGEN_COMP_Q << (unit * 4);
@@ -1262,8 +1262,8 @@ static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
    if (mixed_fallback) {
       if (R200_DEBUG & DEBUG_FALLBACKS)
         fprintf(stderr, "fallback mixed texgen, 0x%x (0x%x 0x%x 0x%x 0x%x)\n",
-                texUnit->TexGenEnabled, texUnit->GenModeS, texUnit->GenModeT,
-                texUnit->GenModeR, texUnit->GenModeQ);
+                texUnit->TexGenEnabled, texUnit->GenS.Mode, texUnit->GenT.Mode,
+                texUnit->GenR.Mode, texUnit->GenQ.Mode);
       return GL_FALSE;
    }
 
@@ -1281,8 +1281,10 @@ static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
    switch (mode) {
    case GL_OBJECT_LINEAR: {
       GLuint needtgenable = r200_need_dis_texgen( texUnit->TexGenEnabled,
-                               texUnit->ObjectPlaneS, texUnit->ObjectPlaneT,
-                               texUnit->ObjectPlaneR, texUnit->ObjectPlaneQ );
+                                                  texUnit->GenS.ObjectPlane,
+                                                  texUnit->GenT.ObjectPlane,
+                                                  texUnit->GenR.ObjectPlane,
+                                                  texUnit->GenQ.ObjectPlane );
       if (needtgenable & (S_BIT | T_BIT)) {
         if (R200_DEBUG & DEBUG_FALLBACKS)
         fprintf(stderr, "fallback mixed texgen / obj plane, 0x%x\n",
@@ -1298,17 +1300,19 @@ static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
 
       tgi |= R200_TEXGEN_INPUT_OBJ << inputshift;
       set_texgen_matrix( rmesa, unit, 
-        (texUnit->TexGenEnabled & S_BIT) ? texUnit->ObjectPlaneS : I,
-        (texUnit->TexGenEnabled & T_BIT) ? texUnit->ObjectPlaneT : I + 4,
-        (texUnit->TexGenEnabled & R_BIT) ? texUnit->ObjectPlaneR : I + 8,
-        (texUnit->TexGenEnabled & Q_BIT) ? texUnit->ObjectPlaneQ : I + 12);
+        (texUnit->TexGenEnabled & S_BIT) ? texUnit->GenS.ObjectPlane : I,
+        (texUnit->TexGenEnabled & T_BIT) ? texUnit->GenT.ObjectPlane : I + 4,
+        (texUnit->TexGenEnabled & R_BIT) ? texUnit->GenR.ObjectPlane : I + 8,
+        (texUnit->TexGenEnabled & Q_BIT) ? texUnit->GenQ.ObjectPlane : I + 12);
       }
       break;
 
    case GL_EYE_LINEAR: {
       GLuint needtgenable = r200_need_dis_texgen( texUnit->TexGenEnabled,
-                               texUnit->EyePlaneS, texUnit->EyePlaneT,
-                               texUnit->EyePlaneR, texUnit->EyePlaneQ );
+                                                  texUnit->GenS.EyePlane,
+                                                  texUnit->GenT.EyePlane,
+                                                  texUnit->GenR.EyePlane,
+                                                  texUnit->GenQ.EyePlane );
       if (needtgenable & (S_BIT | T_BIT)) {
         if (R200_DEBUG & DEBUG_FALLBACKS)
         fprintf(stderr, "fallback mixed texgen / eye plane, 0x%x\n",
@@ -1323,10 +1327,10 @@ static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
       }
       tgi |= R200_TEXGEN_INPUT_EYE << inputshift;
       set_texgen_matrix( rmesa, unit,
-        (texUnit->TexGenEnabled & S_BIT) ? texUnit->EyePlaneS : I,
-        (texUnit->TexGenEnabled & T_BIT) ? texUnit->EyePlaneT : I + 4,
-        (texUnit->TexGenEnabled & R_BIT) ? texUnit->EyePlaneR : I + 8,
-        (texUnit->TexGenEnabled & Q_BIT) ? texUnit->EyePlaneQ : I + 12);
+        (texUnit->TexGenEnabled & S_BIT) ? texUnit->GenS.EyePlane : I,
+        (texUnit->TexGenEnabled & T_BIT) ? texUnit->GenT.EyePlane : I + 4,
+        (texUnit->TexGenEnabled & R_BIT) ? texUnit->GenR.EyePlane : I + 8,
+        (texUnit->TexGenEnabled & Q_BIT) ? texUnit->GenQ.EyePlane : I + 12);
       }
       break;
 
@@ -1362,7 +1366,7 @@ static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
        */
       if (R200_DEBUG & DEBUG_FALLBACKS)
         fprintf(stderr, "fallback unsupported texgen, %d\n",
-                texUnit->GenModeS);
+                texUnit->GenS.Mode);
       return GL_FALSE;
    }
 
index 888f91db73d21149a9f5c936e44b9ef6cc2b640a..aadd1443ad90ecbdf3e33d0d88889929d798fa13 100644 (file)
@@ -202,7 +202,7 @@ static unsigned long t_dst(struct prog_dst_register *dst)
    }
 }
 
-static unsigned long t_src_class(enum register_file file)
+static unsigned long t_src_class(gl_register_file file)
 {
 
    switch(file){
index 488fd44740c650d98eed3b17d09054c9bc8e8412..5bae37e1b1ed334c9aace2d2e7ec941cdcecffc9 100644 (file)
@@ -82,7 +82,7 @@ int hw_tcl_on = 1;
 #define need_GL_EXT_blend_equation_separate
 #define need_GL_EXT_blend_func_separate
 #define need_GL_EXT_blend_minmax
-//#define need_GL_EXT_fog_coord
+#define need_GL_EXT_fog_coord
 #define need_GL_EXT_gpu_program_parameters
 #define need_GL_EXT_secondary_color
 #define need_GL_EXT_stencil_two_side
@@ -110,7 +110,7 @@ const struct dri_extension card_extensions[] = {
   {"GL_EXT_blend_func_separate",       GL_EXT_blend_func_separate_functions},
   {"GL_EXT_blend_minmax",              GL_EXT_blend_minmax_functions},
   {"GL_EXT_blend_subtract",            NULL},
-//  {"GL_EXT_fog_coord",                       GL_EXT_fog_coord_functions },
+  {"GL_EXT_fog_coord",                 GL_EXT_fog_coord_functions },
   {"GL_EXT_gpu_program_parameters",     GL_EXT_gpu_program_parameters_functions},
   {"GL_EXT_secondary_color",           GL_EXT_secondary_color_functions},
   {"GL_EXT_shadow_funcs",              NULL},
index 1512e906e89c17f4dfe2f7809478591059635e17..4bf0e7a1898bc13c84044121a63c413b2985a6c6 100644 (file)
@@ -177,14 +177,23 @@ GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten)
 
 GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint OutputsWritten)
 {
-       GLuint i, ret = 0;
+       GLuint i, ret = 0, first_free_texcoord = 0;
 
        for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
                if (OutputsWritten & (1 << (VERT_RESULT_TEX0 + i))) {
                        ret |= (4 << (3 * i));
+                       ++first_free_texcoord;
                }
        }
 
+       if (OutputsWritten & (1 << VERT_RESULT_FOGC)) {
+               if (first_free_texcoord > 8) {
+                       fprintf(stderr, "\tout of free texcoords to write fog coord\n");
+                       _mesa_exit(-1);
+               }
+               ret |= 4 << (3 * first_free_texcoord);
+       }
+
        return ret;
 }
 
index 8d030c63fb3f41e39fb3121984830a8d98451349..32182bb66744ea18ca219eca4749e8ce75c1d2ee 100644 (file)
@@ -356,8 +356,8 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler)
 
 static void nqssadce_init(struct nqssadce_state* s)
 {
-       s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW;
-       s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W;
+       s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW;
+       s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W;
 }
 
 
index 5f344be11636633bec3cbab9f3d53281c3a63650..ed552d09bbc6b765de201866140e7c1a1a021607 100644 (file)
@@ -1224,6 +1224,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define R500_RS_INST_COL_ADDR_SHIFT                    18
 #define R500_RS_INST_TEX_ADJ                           (1 << 25)
 #define R500_RS_INST_W_CN                              (1 << 26)
+#define R500_RS_INST_TEX_ID(x)                         ((x) << R500_RS_INST_TEX_ID_SHIFT)
+#define R500_RS_INST_TEX_ADDR(x)                       ((x) << R500_RS_INST_TEX_ADDR_SHIFT)
+#define R500_RS_INST_COL_ID(x)                         ((x) << R500_RS_INST_COL_ID_SHIFT)
+#define R500_RS_INST_COL_ADDR(x)                       ((x) << R500_RS_INST_COL_ADDR_SHIFT)
 
 /* These DWORDs control how vertex data is routed into fragment program
  * registers, after interpolators.
@@ -1239,9 +1243,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define R300_RS_INST_TEX_ID(x)           ((x) << 0)
 #      define R300_RS_INST_TEX_CN_WRITE        (1 << 3)
 #      define R300_RS_INST_TEX_ADDR_SHIFT      6
+#      define R300_RS_INST_TEX_ADDR(x)         ((x) << R300_RS_INST_TEX_ADDR_SHIFT)
 #      define R300_RS_INST_COL_ID(x)           ((x) << 11)
 #      define R300_RS_INST_COL_CN_WRITE        (1 << 14)
 #      define R300_RS_INST_COL_ADDR_SHIFT      17
+#      define R300_RS_INST_COL_ADDR(x)         ((x) << R300_RS_INST_COL_ADDR_SHIFT)
 #      define R300_RS_INST_TEX_ADJ             (1 << 22)
 #      define R300_RS_COL_BIAS_UNUSED_SHIFT    23
 
index 17e7b5227ab8719c771b08dd334e6be33b9cfe68..f423029ee6886811d3a3c48a447673febf57eabb 100644 (file)
@@ -727,134 +727,6 @@ static void r300ColorMask(GLcontext * ctx,
        }
 }
 
-/* =============================================================
- * Fog
- */
-static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
-{
-       r300ContextPtr r300 = R300_CONTEXT(ctx);
-       union {
-               int i;
-               float f;
-       } fogScale, fogStart;
-
-       (void)param;
-
-       fogScale.i = r300->hw.fogp.cmd[R300_FOGP_SCALE];
-       fogStart.i = r300->hw.fogp.cmd[R300_FOGP_START];
-
-       switch (pname) {
-       case GL_FOG_MODE:
-               switch (ctx->Fog.Mode) {
-               case GL_LINEAR:
-                       R300_STATECHANGE(r300, fogs);
-                       r300->hw.fogs.cmd[R300_FOGS_STATE] =
-                           (r300->hw.fogs.
-                            cmd[R300_FOGS_STATE] & ~R300_FG_FOG_BLEND_FN_MASK) |
-                           R300_FG_FOG_BLEND_FN_LINEAR;
-
-                       if (ctx->Fog.Start == ctx->Fog.End) {
-                               fogScale.f = -1.0;
-                               fogStart.f = 1.0;
-                       } else {
-                               fogScale.f =
-                                   1.0 / (ctx->Fog.End - ctx->Fog.Start);
-                               fogStart.f =
-                                   -ctx->Fog.Start / (ctx->Fog.End -
-                                                      ctx->Fog.Start);
-                       }
-                       break;
-               case GL_EXP:
-                       R300_STATECHANGE(r300, fogs);
-                       r300->hw.fogs.cmd[R300_FOGS_STATE] =
-                           (r300->hw.fogs.
-                            cmd[R300_FOGS_STATE] & ~R300_FG_FOG_BLEND_FN_MASK) |
-                           R300_FG_FOG_BLEND_FN_EXP;
-                       fogScale.f = 0.0933 * ctx->Fog.Density;
-                       fogStart.f = 0.0;
-                       break;
-               case GL_EXP2:
-                       R300_STATECHANGE(r300, fogs);
-                       r300->hw.fogs.cmd[R300_FOGS_STATE] =
-                           (r300->hw.fogs.
-                            cmd[R300_FOGS_STATE] & ~R300_FG_FOG_BLEND_FN_MASK) |
-                           R300_FG_FOG_BLEND_FN_EXP2;
-                       fogScale.f = 0.3 * ctx->Fog.Density;
-                       fogStart.f = 0.0;
-                        break;
-               default:
-                       return;
-               }
-               break;
-       case GL_FOG_DENSITY:
-               switch (ctx->Fog.Mode) {
-               case GL_EXP:
-                       fogScale.f = 0.0933 * ctx->Fog.Density;
-                       fogStart.f = 0.0;
-                       break;
-               case GL_EXP2:
-                       fogScale.f = 0.3 * ctx->Fog.Density;
-                       fogStart.f = 0.0;
-               default:
-                       break;
-               }
-               break;
-       case GL_FOG_START:
-       case GL_FOG_END:
-               if (ctx->Fog.Mode == GL_LINEAR) {
-                       if (ctx->Fog.Start == ctx->Fog.End) {
-                               fogScale.f = -1.0;
-                               fogStart.f = 1.0;
-                       } else {
-                               fogScale.f =
-                                   1.0 / (ctx->Fog.End - ctx->Fog.Start);
-                               fogStart.f =
-                                   -ctx->Fog.Start / (ctx->Fog.End -
-                                                      ctx->Fog.Start);
-                       }
-               }
-               break;
-       case GL_FOG_COLOR:
-               R300_STATECHANGE(r300, fogc);
-               r300->hw.fogc.cmd[R300_FOGC_R] =
-                   (GLuint) (ctx->Fog.Color[0] * 1023.0F) & 0x3FF;
-               r300->hw.fogc.cmd[R300_FOGC_G] =
-                   (GLuint) (ctx->Fog.Color[1] * 1023.0F) & 0x3FF;
-               r300->hw.fogc.cmd[R300_FOGC_B] =
-                   (GLuint) (ctx->Fog.Color[2] * 1023.0F) & 0x3FF;
-               break;
-       case GL_FOG_COORD_SRC:
-               break;
-       default:
-               return;
-       }
-
-       if (fogScale.i != r300->hw.fogp.cmd[R300_FOGP_SCALE] ||
-           fogStart.i != r300->hw.fogp.cmd[R300_FOGP_START]) {
-               R300_STATECHANGE(r300, fogp);
-               r300->hw.fogp.cmd[R300_FOGP_SCALE] = fogScale.i;
-               r300->hw.fogp.cmd[R300_FOGP_START] = fogStart.i;
-       }
-}
-
-static void r300SetFogState(GLcontext * ctx, GLboolean state)
-{
-       r300ContextPtr r300 = R300_CONTEXT(ctx);
-
-       R300_STATECHANGE(r300, fogs);
-       if (state) {
-               r300->hw.fogs.cmd[R300_FOGS_STATE] |= R300_FG_FOG_BLEND_ENABLE;
-
-               r300Fogfv(ctx, GL_FOG_MODE, NULL);
-               r300Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density);
-               r300Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start);
-               r300Fogfv(ctx, GL_FOG_END, &ctx->Fog.End);
-               r300Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color);
-       } else {
-               r300->hw.fogs.cmd[R300_FOGS_STATE] &= ~R300_FG_FOG_BLEND_ENABLE;
-       }
-}
-
 /* =============================================================
  * Point state
  */
@@ -1140,7 +1012,7 @@ r300FetchStateParameter(GLcontext * ctx,
 
                case STATE_R300_TEXRECT_FACTOR:{
                                struct gl_texture_object *t =
-                                   ctx->Texture.Unit[state[2]].CurrentRect;
+                                   ctx->Texture.Unit[state[2]].CurrentTex[TEXTURE_RECT_INDEX];
 
                                if (t && t->Image[0][t->BaseLevel]) {
                                        struct gl_texture_image *image =
@@ -1531,18 +1403,14 @@ union r300_outputs_written {
 static void r300SetupRSUnit(GLcontext * ctx)
 {
        r300ContextPtr r300 = R300_CONTEXT(ctx);
-       /* I'm still unsure if these are needed */
-       GLuint interp_col[8];
         TNLcontext *tnl = TNL_CONTEXT(ctx);
        struct vertex_buffer *VB = &tnl->vb;
        union r300_outputs_written OutputsWritten;
        GLuint InputsRead;
        int fp_reg, high_rr;
-       int col_interp_nr;
-       int rs_tex_count = 0, rs_col_count = 0;
-       int i, count;
-
-       memset(interp_col, 0, sizeof(interp_col));
+       int col_ip, tex_ip;
+       int rs_tex_count = 0;
+       int i, count, col_fmt;
 
        if (hw_tcl_on)
                OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten;
@@ -1560,51 +1428,66 @@ static void r300SetupRSUnit(GLcontext * ctx)
        R300_STATECHANGE(r300, rc);
        R300_STATECHANGE(r300, rr);
 
-       fp_reg = col_interp_nr = high_rr = 0;
+       fp_reg = col_ip = tex_ip = col_fmt = 0;
 
-       r300->hw.rr.cmd[R300_RR_INST_1] = 0;
-
-       if (InputsRead & FRAG_BIT_WPOS) {
-               for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
-                       if (!(InputsRead & (FRAG_BIT_TEX0 << i)))
-                               break;
+       r300->hw.rc.cmd[1] = 0;
+       r300->hw.rc.cmd[2] = 0;
+       for (i=0; i<R300_RR_CMDSIZE-1; ++i)
+               r300->hw.rr.cmd[R300_RR_INST_0 + i] = 0;
 
-               if (i == ctx->Const.MaxTextureUnits) {
-                       fprintf(stderr, "\tno free texcoord found...\n");
-                       _mesa_exit(-1);
-               }
+       for (i=0; i<R300_RI_CMDSIZE-1; ++i)
+               r300->hw.ri.cmd[R300_RI_INTERP_0 + i] = 0;
 
-               InputsRead |= (FRAG_BIT_TEX0 << i);
-               InputsRead &= ~FRAG_BIT_WPOS;
-       }
 
        if (InputsRead & FRAG_BIT_COL0) {
-               count = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size;
-               interp_col[0] |= R300_RS_COL_PTR(rs_col_count);
-               if (count == 3)
-                       interp_col[0] |= R300_RS_COL_FMT(R300_RS_COL_FMT_RGB1);
-               rs_col_count += count;
+               if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) {
+                       count = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size;
+                       if (count == 4)
+                           col_fmt = R300_RS_COL_FMT_RGBA;
+                       else if (count == 3)
+                           col_fmt = R300_RS_COL_FMT_RGB1;
+                       else
+                           col_fmt = R300_RS_COL_FMT_0001;
+
+                       r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R300_RS_COL_PTR(col_ip) | R300_RS_COL_FMT(col_fmt);
+                       r300->hw.rr.cmd[R300_RR_INST_0 + col_ip] = R300_RS_INST_COL_ID(col_ip) | R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_reg);
+                       InputsRead &= ~FRAG_BIT_COL0;
+                       ++col_ip;
+                       ++fp_reg;
+               } else {
+                       WARN_ONCE("fragprog wants col0, vp doesn't provide it\n");
+               }
        }
-       else
-               interp_col[0] = R300_RS_COL_FMT(R300_RS_COL_FMT_0001);
 
        if (InputsRead & FRAG_BIT_COL1) {
-               count = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->size;
-               if (count == 3)
-                       interp_col[1] |= R300_RS_COL_FMT(R300_RS_COL_FMT_RGB0);
-               interp_col[1] |= R300_RS_COL_PTR(1);
-               rs_col_count += count;
-       }
-
-       if (InputsRead & FRAG_BIT_FOGC) {
-               /* XXX FIX THIS
-                * Just turn off the bit for now.
-                * Need to do something similar to the color/texcoord inputs.
-                */
-               InputsRead &= ~FRAG_BIT_FOGC;
+               if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) {
+                       count = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->size;
+                       if (count == 4)
+                           col_fmt = R300_RS_COL_FMT_RGBA;
+                       else if (count == 3)
+                           col_fmt = R300_RS_COL_FMT_RGB1;
+                       else
+                           col_fmt = R300_RS_COL_FMT_0001;
+
+                       r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R300_RS_COL_PTR(col_ip) | R300_RS_COL_FMT(col_fmt);
+                       r300->hw.rr.cmd[R300_RR_INST_0 + col_ip] = R300_RS_INST_COL_ID(col_ip) | R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_reg);
+                       InputsRead &= ~FRAG_BIT_COL1;
+                       ++col_ip;
+                       ++fp_reg;
+               } else {
+                       WARN_ONCE("fragprog wants col1, vp doesn't provide it\n");
+               }
        }
 
        for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+               if (! ( InputsRead & FRAG_BIT_TEX(i) ) )
+                   continue;
+
+               if (!R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_TEX0 + i, _TNL_ATTRIB_TEX(i))) {
+                   WARN_ONCE("fragprog wants coords for tex%d, vp doesn't provide them!\n", i);
+                   continue;
+               }
+
                int swiz;
 
                /* with TCL we always seem to route 4 components */
@@ -1613,7 +1496,6 @@ static void r300SetupRSUnit(GLcontext * ctx)
                else
                  count = VB->AttribPtr[_TNL_ATTRIB_TEX(i)]->size;
 
-               r300->hw.ri.cmd[R300_RI_INTERP_0 + i] = interp_col[i] | rs_tex_count;
                switch(count) {
                case 4: swiz = R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3); break;
                case 3: swiz = R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(R300_RS_SEL_K1); break;
@@ -1622,63 +1504,48 @@ static void r300SetupRSUnit(GLcontext * ctx)
                case 2: swiz = R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(R300_RS_SEL_K0) | R300_RS_SEL_Q(R300_RS_SEL_K1); break;
                };
 
-               r300->hw.ri.cmd[R300_RI_INTERP_0 + i] |= swiz;
-
-               r300->hw.rr.cmd[R300_RR_INST_0 + fp_reg] = 0;
-               if (InputsRead & (FRAG_BIT_TEX0 << i)) {
-
-                       rs_tex_count += count;
-
-                       //assert(r300->state.texture.tc_count != 0);
-                       r300->hw.rr.cmd[R300_RR_INST_0 + fp_reg] |= R300_RS_INST_TEX_CN_WRITE | i       /* source INTERP */
-                           | (fp_reg << R300_RS_INST_TEX_ADDR_SHIFT);
-                       high_rr = fp_reg;
-
-                       /* Passing invalid data here can lock the GPU. */
-                       if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_TEX0 + i, _TNL_ATTRIB_TEX(i))) {
-                               InputsRead &= ~(FRAG_BIT_TEX0 << i);
-                               fp_reg++;
-                       } else {
-                               WARN_ONCE("fragprog wants coords for tex%d, vp doesn't provide them!\n", i);
-                       }
-               }
+               r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= swiz | R300_RS_TEX_PTR(rs_tex_count);
+               r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R300_RS_INST_TEX_ID(tex_ip) | R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_reg);
+               InputsRead &= ~(FRAG_BIT_TEX0 << i);
+               rs_tex_count += count;
+               ++tex_ip;
+               ++fp_reg;
        }
 
-       if (InputsRead & FRAG_BIT_COL0) {
-               if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) {
-                       r300->hw.rr.cmd[R300_RR_INST_0] |= R300_RS_INST_COL_ID(0) | R300_RS_INST_COL_CN_WRITE | (fp_reg++ << R300_RS_INST_COL_ADDR_SHIFT);
-                       InputsRead &= ~FRAG_BIT_COL0;
-                       col_interp_nr++;
+       if (InputsRead & FRAG_BIT_FOGC) {
+               if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_FOGC, _TNL_ATTRIB_FOG)) {
+                       r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |=  R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3) |  R300_RS_TEX_PTR(rs_tex_count);
+                       r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R300_RS_INST_TEX_ID(tex_ip) | R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_reg);
+                       InputsRead &= ~FRAG_BIT_FOGC;
+                       rs_tex_count += 4;
+                       ++tex_ip;
+                       ++fp_reg;
                } else {
-                       WARN_ONCE("fragprog wants col0, vp doesn't provide it\n");
+                       WARN_ONCE("fragprog wants fogc, vp doesn't provide it\n");
                }
        }
 
-       if (InputsRead & FRAG_BIT_COL1) {
-               if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) {
-                       r300->hw.rr.cmd[R300_RR_INST_1] |= R300_RS_INST_COL_ID(1) | R300_RS_INST_COL_CN_WRITE | (fp_reg++ << R300_RS_INST_COL_ADDR_SHIFT);
-                       InputsRead &= ~FRAG_BIT_COL1;
-                       if (high_rr < 1)
-                               high_rr = 1;
-                       col_interp_nr++;
-               } else {
-                       WARN_ONCE("fragprog wants col1, vp doesn't provide it\n");
-               }
+       if (InputsRead & FRAG_BIT_WPOS) {
+               r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |=  R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3) |  R300_RS_TEX_PTR(rs_tex_count);
+               r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R300_RS_INST_TEX_ID(tex_ip) | R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_reg);
+               InputsRead &= ~FRAG_BIT_WPOS;
+               rs_tex_count += 4;
+               ++tex_ip;
+               ++fp_reg;
        }
+       InputsRead &= ~FRAG_BIT_WPOS;
 
-       /* Need at least one. This might still lock as the values are undefined... */
-       if (rs_tex_count == 0 && col_interp_nr == 0) {
-               r300->hw.rr.cmd[R300_RR_INST_0] |= R300_RS_INST_COL_ID(0) | R300_RS_INST_COL_CN_WRITE | (fp_reg++ << R300_RS_INST_COL_ADDR_SHIFT);
-               col_interp_nr++;
+       /* Setup default color if no color or tex was set */
+       if (rs_tex_count == 0 && col_ip == 0) {
+               r300->hw.rr.cmd[R300_RR_INST_0] = R300_RS_INST_COL_ID(0) | R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(0) | R300_RS_COL_FMT(R300_RS_COL_FMT_0001);
+               ++col_ip;
        }
 
-       r300->hw.rc.cmd[1] = 0 | (rs_tex_count << R300_IT_COUNT_SHIFT)
-         | (col_interp_nr << R300_IC_COUNT_SHIFT)
-         | R300_HIRES_EN;
+       high_rr = (col_ip > tex_ip) ? col_ip : tex_ip;
+       r300->hw.rc.cmd[1] |= (rs_tex_count << R300_IT_COUNT_SHIFT)  | (col_ip << R300_IC_COUNT_SHIFT) | R300_HIRES_EN;
+       r300->hw.rc.cmd[2] |= high_rr - 1;
 
-       assert(high_rr >= 0);
-       r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_RS_INST_0, high_rr + 1);
-       r300->hw.rc.cmd[2] = high_rr;
+        r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_RS_INST_0, high_rr);
 
        if (InputsRead)
                WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead);
@@ -1687,18 +1554,15 @@ static void r300SetupRSUnit(GLcontext * ctx)
 static void r500SetupRSUnit(GLcontext * ctx)
 {
        r300ContextPtr r300 = R300_CONTEXT(ctx);
-       /* I'm still unsure if these are needed */
-       GLuint interp_col[8];
-       union r300_outputs_written OutputsWritten;
         TNLcontext *tnl = TNL_CONTEXT(ctx);
        struct vertex_buffer *VB = &tnl->vb;
+       union r300_outputs_written OutputsWritten;
        GLuint InputsRead;
        int fp_reg, high_rr;
-       int rs_col_count = 0;
-       int in_texcoords, col_interp_nr;
-       int i, count;
+       int col_ip, tex_ip;
+       int rs_tex_count = 0;
+       int i, count, col_fmt;
 
-       memset(interp_col, 0, sizeof(interp_col));
        if (hw_tcl_on)
                OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten;
        else
@@ -1715,130 +1579,151 @@ static void r500SetupRSUnit(GLcontext * ctx)
        R300_STATECHANGE(r300, rc);
        R300_STATECHANGE(r300, rr);
 
-       fp_reg = col_interp_nr = high_rr = in_texcoords = 0;
-
-       r300->hw.rr.cmd[R300_RR_INST_1] = 0;
+       fp_reg = col_ip = tex_ip = col_fmt = 0;
 
-       if (InputsRead & FRAG_BIT_WPOS) {
-               for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
-                       if (!(InputsRead & (FRAG_BIT_TEX0 << i)))
-                               break;
+       r300->hw.rc.cmd[1] = 0;
+       r300->hw.rc.cmd[2] = 0;
+       for (i=0; i<R300_RR_CMDSIZE-1; ++i)
+               r300->hw.rr.cmd[R300_RR_INST_0 + i] = 0;
 
-               if (i == ctx->Const.MaxTextureUnits) {
-                       fprintf(stderr, "\tno free texcoord found...\n");
-                       _mesa_exit(-1);
-               }
+       for (i=0; i<R500_RI_CMDSIZE-1; ++i)
+               r300->hw.ri.cmd[R300_RI_INTERP_0 + i] = 0;
 
-               InputsRead |= (FRAG_BIT_TEX0 << i);
-               InputsRead &= ~FRAG_BIT_WPOS;
-       }
 
        if (InputsRead & FRAG_BIT_COL0) {
-               count = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size;
-               interp_col[0] |= R500_RS_COL_PTR(rs_col_count);
-               if (count == 3)
-                       interp_col[0] |= R500_RS_COL_FMT(R300_RS_COL_FMT_RGB1);
-               rs_col_count += count;
+               if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) {
+                       count = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size;
+                       if (count == 4)
+                           col_fmt = R300_RS_COL_FMT_RGBA;
+                       else if (count == 3)
+                           col_fmt = R300_RS_COL_FMT_RGB1;
+                       else
+                           col_fmt = R300_RS_COL_FMT_0001;
+
+                       r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R500_RS_COL_PTR(col_ip) | R500_RS_COL_FMT(col_fmt);
+                       r300->hw.rr.cmd[R300_RR_INST_0 + col_ip] = R500_RS_INST_COL_ID(col_ip) | R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(fp_reg);
+                       InputsRead &= ~FRAG_BIT_COL0;
+                       ++col_ip;
+                       ++fp_reg;
+               } else {
+                       WARN_ONCE("fragprog wants col0, vp doesn't provide it\n");
+               }
        }
-       else
-               interp_col[0] = R500_RS_COL_FMT(R300_RS_COL_FMT_0001);
 
        if (InputsRead & FRAG_BIT_COL1) {
-               count = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->size;
-               interp_col[1] |= R500_RS_COL_PTR(1);
-               if (count == 3)
-                       interp_col[1] |= R500_RS_COL_FMT(R300_RS_COL_FMT_RGB0);
-               rs_col_count += count;
+               if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) {
+                       count = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->size;
+                       if (count == 4)
+                           col_fmt = R300_RS_COL_FMT_RGBA;
+                       else if (count == 3)
+                           col_fmt = R300_RS_COL_FMT_RGB1;
+                       else
+                           col_fmt = R300_RS_COL_FMT_0001;
+
+                       r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R500_RS_COL_PTR(col_ip) | R500_RS_COL_FMT(col_fmt);
+                       r300->hw.rr.cmd[R300_RR_INST_0 + col_ip] = R500_RS_INST_COL_ID(col_ip) | R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(fp_reg);
+                       InputsRead &= ~FRAG_BIT_COL1;
+                       ++col_ip;
+                       ++fp_reg;
+               } else {
+                       WARN_ONCE("fragprog wants col1, vp doesn't provide it\n");
+               }
        }
 
+
        for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
-               GLuint swiz = 0;
+               if (! ( InputsRead & FRAG_BIT_TEX(i) ) )
+                   continue;
 
-               /* with TCL we always seem to route 4 components */
-               if (InputsRead & (FRAG_BIT_TEX0 << i)) {
-
-                 if (hw_tcl_on)
-                   count = 4;
-                 else
-                   count = VB->AttribPtr[_TNL_ATTRIB_TEX(i)]->size;
-
-                 /* always have on texcoord */
-                 swiz |= in_texcoords++ << R500_RS_IP_TEX_PTR_S_SHIFT;
-                 if (count >= 2)
-                   swiz |= in_texcoords++ << R500_RS_IP_TEX_PTR_T_SHIFT;
-                 else
-                   swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT;
-
-                 if (count >= 3)
-                   swiz |= in_texcoords++ << R500_RS_IP_TEX_PTR_R_SHIFT;
-                 else
-                   swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT;
-
-                 if (count == 4)
-                   swiz |= in_texcoords++ << R500_RS_IP_TEX_PTR_Q_SHIFT;
-                 else
-                   swiz |= R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT;
-
-               } else
-                  swiz = (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_S_SHIFT) |
-                         (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT) |
-                         (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) |
-                         (R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT);
-
-               r300->hw.ri.cmd[R300_RI_INTERP_0 + i] = interp_col[i] | swiz;
-
-               r300->hw.rr.cmd[R300_RR_INST_0 + fp_reg] = 0;
-               if (InputsRead & (FRAG_BIT_TEX0 << i)) {
-                       //assert(r300->state.texture.tc_count != 0);
-                       r300->hw.rr.cmd[R300_RR_INST_0 + fp_reg] |= R500_RS_INST_TEX_CN_WRITE | i       /* source INTERP */
-                           | (fp_reg << R500_RS_INST_TEX_ADDR_SHIFT);
-                       high_rr = fp_reg;
-
-                       /* Passing invalid data here can lock the GPU. */
-                       if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_TEX0 + i, _TNL_ATTRIB_TEX(i))) {
-                               InputsRead &= ~(FRAG_BIT_TEX0 << i);
-                               fp_reg++;
-                       } else {
-                               WARN_ONCE("fragprog wants coords for tex%d, vp doesn't provide them!\n", i);
-                       }
+               if (!R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_TEX0 + i, _TNL_ATTRIB_TEX(i))) {
+                   WARN_ONCE("fragprog wants coords for tex%d, vp doesn't provide them!\n", i);
+                   continue;
                }
-       }
 
-       if (InputsRead & FRAG_BIT_COL0) {
-               if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) {
-                       r300->hw.rr.cmd[R300_RR_INST_0] |= R500_RS_INST_COL_CN_WRITE | (fp_reg++ << R500_RS_INST_COL_ADDR_SHIFT);
-                       InputsRead &= ~FRAG_BIT_COL0;
-                       col_interp_nr++;
+               int swiz = 0;
+
+               /* with TCL we always seem to route 4 components */
+               if (hw_tcl_on)
+                 count = 4;
+               else
+                 count = VB->AttribPtr[_TNL_ATTRIB_TEX(i)]->size;
+
+               if (count == 4) {
+                       swiz |= (rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT;
+                       swiz |= (rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT;
+                       swiz |= (rs_tex_count + 2) << R500_RS_IP_TEX_PTR_R_SHIFT;
+                       swiz |= (rs_tex_count + 3) << R500_RS_IP_TEX_PTR_Q_SHIFT;
+               } else if (count == 3) {
+                       swiz |= (rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT;
+                       swiz |= (rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT;
+                       swiz |= (rs_tex_count + 2) << R500_RS_IP_TEX_PTR_R_SHIFT;
+                       swiz |= R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT;
+               } else if (count == 2) {
+                       swiz |= (rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT;
+                       swiz |= (rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT;
+                       swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT;
+                       swiz |= R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT;
+               } else if (count == 1) {
+                       swiz |= (rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT;
+                       swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT;
+                       swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT;
+                       swiz |= R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT;
                } else {
-                       WARN_ONCE("fragprog wants col0, vp doesn't provide it\n");
+                       swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_S_SHIFT;
+                       swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT;
+                       swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT;
+                       swiz |= R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT;
                }
+
+               r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= swiz;
+               r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R500_RS_INST_TEX_ID(tex_ip) | R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_reg);
+               InputsRead &= ~(FRAG_BIT_TEX0 << i);
+               rs_tex_count += count;
+               ++tex_ip;
+               ++fp_reg;
        }
 
-       if (InputsRead & FRAG_BIT_COL1) {
-               if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) {
-                       r300->hw.rr.cmd[R300_RR_INST_1] |= (1 << 12) | R500_RS_INST_COL_CN_WRITE |  (fp_reg++ << R500_RS_INST_COL_ADDR_SHIFT);
-                       InputsRead &= ~FRAG_BIT_COL1;
-                       if (high_rr < 1)
-                               high_rr = 1;
-                       col_interp_nr++;
+       if (InputsRead & FRAG_BIT_FOGC) {
+               if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_FOGC, _TNL_ATTRIB_FOG)) {
+                       r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= ((rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT) |
+                               ((rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT) |
+                               ((rs_tex_count + 2) << R500_RS_IP_TEX_PTR_R_SHIFT) |
+                               ((rs_tex_count + 3) << R500_RS_IP_TEX_PTR_Q_SHIFT);
+
+                       r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R500_RS_INST_TEX_ID(tex_ip) | R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_reg);
+                       InputsRead &= ~FRAG_BIT_FOGC;
+                       rs_tex_count += 4;
+                       ++tex_ip;
+                       ++fp_reg;
                } else {
-                       WARN_ONCE("fragprog wants col1, vp doesn't provide it\n");
+                       WARN_ONCE("fragprog wants fogc, vp doesn't provide it\n");
                }
        }
 
-       /* Need at least one. This might still lock as the values are undefined... */
-       if (in_texcoords == 0 && col_interp_nr == 0) {
-               r300->hw.rr.cmd[R300_RR_INST_0] |= 0 | R500_RS_INST_COL_CN_WRITE | (fp_reg++ << R500_RS_INST_COL_ADDR_SHIFT);
-               col_interp_nr++;
+       if (InputsRead & FRAG_BIT_WPOS) {
+               r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= ((rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT) |
+                               ((rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT) |
+                               ((rs_tex_count + 2) << R500_RS_IP_TEX_PTR_R_SHIFT) |
+                               ((rs_tex_count + 3) << R500_RS_IP_TEX_PTR_Q_SHIFT);
+
+               r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R500_RS_INST_TEX_ID(tex_ip) | R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_reg);
+               InputsRead &= ~FRAG_BIT_WPOS;
+               rs_tex_count += 4;
+               ++tex_ip;
+               ++fp_reg;
        }
 
-       r300->hw.rc.cmd[1] = 0 | (in_texcoords << R300_IT_COUNT_SHIFT)
-         | (col_interp_nr << R300_IC_COUNT_SHIFT)
-         | R300_HIRES_EN;
+       /* Setup default color if no color or tex was set */
+       if (rs_tex_count == 0 && col_ip == 0) {
+               r300->hw.rr.cmd[R300_RR_INST_0] |= R500_RS_INST_COL_ID(0) | R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(0) | R500_RS_COL_FMT(R300_RS_COL_FMT_0001);
+               ++col_ip;
+       }
+
+       high_rr = (col_ip > tex_ip) ? col_ip : tex_ip;
+       r300->hw.rc.cmd[1] |= (rs_tex_count << R300_IT_COUNT_SHIFT)  | (col_ip << R300_IC_COUNT_SHIFT) | R300_HIRES_EN;
+       r300->hw.rc.cmd[2] |= 0xC0 | (high_rr - 1);
 
-       assert(high_rr >= 0);
-       r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R500_RS_INST_0, high_rr + 1);
-       r300->hw.rc.cmd[2] = 0xC0 | high_rr;
+       r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R500_RS_INST_0, high_rr);
 
        if (InputsRead)
                WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead);
@@ -2078,7 +1963,7 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state)
                /* empty */
                break;
        case GL_FOG:
-               r300SetFogState(ctx, state);
+               /* empty */
                break;
        case GL_ALPHA_TEST:
                r300SetAlphaState(ctx);
@@ -2149,7 +2034,7 @@ static void r300ResetHwState(r300ContextPtr r300)
        r300DepthFunc(ctx, ctx->Depth.Func);
 
        /* stencil */
-       r300Enable(ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled);
+       r300Enable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled);
        r300StencilMaskSeparate(ctx, 0, ctx->Stencil.WriteMask[0]);
        r300StencilFuncSeparate(ctx, 0, ctx->Stencil.Function[0],
                                ctx->Stencil.Ref[0], ctx->Stencil.ValueMask[0]);
@@ -2236,11 +2121,9 @@ static void r300ResetHwState(r300ContextPtr r300)
                break;
        }
 
-       /* XXX: set to 0 when fog is disabled? */
-       r300->hw.gb_misc.cmd[R300_GB_MISC_SELECT] = R300_GB_FOG_SELECT_1_1_W;
-
        /* XXX: Enable anti-aliasing? */
        r300->hw.gb_misc.cmd[R300_GB_MISC_AA_CONFIG] = GB_AA_CONFIG_AA_DISABLE;
+       r300->hw.gb_misc.cmd[R300_GB_MISC_SELECT] = 0;
 
        r300->hw.ga_point_s0.cmd[1] = r300PackFloat32(0.0);
        r300->hw.ga_point_s0.cmd[2] = r300PackFloat32(0.0);
@@ -2289,17 +2172,11 @@ static void r300ResetHwState(r300ContextPtr r300)
          R500_C0_SEL_B | R500_C1_SEL_G | R500_C2_SEL_R | R500_C3_SEL_A;
        r300->hw.us_out_fmt.cmd[4] = R500_OUT_FMT_UNUSED |
          R500_C0_SEL_B | R500_C1_SEL_G | R500_C2_SEL_R | R500_C3_SEL_A;
-       r300->hw.us_out_fmt.cmd[5] = R300_W_FMT_W24;
+       r300->hw.us_out_fmt.cmd[5] = R300_W_FMT_W0 | R300_W_SRC_US;
 
-       r300Enable(ctx, GL_FOG, ctx->Fog.Enabled);
-       r300Fogfv(ctx, GL_FOG_MODE, NULL);
-       r300Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density);
-       r300Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start);
-       r300Fogfv(ctx, GL_FOG_END, &ctx->Fog.End);
-       r300Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color);
-       r300Fogfv(ctx, GL_FOG_COORDINATE_SOURCE_EXT, NULL);
-
-       r300->hw.fg_depth_src.cmd[1] = 0;
+       /* disable fog unit */
+       r300->hw.fogs.cmd[R300_FOGS_STATE] = 0;
+       r300->hw.fg_depth_src.cmd[1] = R300_FG_DEPTH_SRC_SCAN;
 
        r300->hw.rb3d_cctl.cmd[1] = 0;
 
@@ -2524,16 +2401,6 @@ static void r500SetupPixelShader(r300ContextPtr rmesa)
        }
        code = &fp->code;
 
-       if (fp->mesa_program.FogOption != GL_NONE) {
-               /* Enable HW fog. Try not to squish GL context.
-                * (Anybody sane remembered to set glFog() opts first!) */
-               r300SetFogState(ctx, GL_TRUE);
-               ctx->Fog.Mode = fp->mesa_program.FogOption;
-               r300Fogfv(ctx, GL_FOG_MODE, NULL);
-       } else
-               /* Make sure HW is matching GL context. */
-               r300SetFogState(ctx, ctx->Fog.Enabled);
-
        r300SetupTextures(ctx);
 
        R300_STATECHANGE(rmesa, fp);
@@ -2581,9 +2448,22 @@ void r300UpdateShaderStates(r300ContextPtr rmesa)
 
        r300SetEarlyZState(ctx);
 
-       GLuint fgdepthsrc = R300_FG_DEPTH_SRC_SCAN;
-       if (current_fragment_program_writes_depth(ctx))
+       /* w_fmt value is set to get best performance
+        * see p.130 R5xx 3D acceleration guide v1.3 */
+       GLuint w_fmt, fgdepthsrc;
+       if (current_fragment_program_writes_depth(ctx)) {
                fgdepthsrc = R300_FG_DEPTH_SRC_SHADER;
+               w_fmt = R300_W_FMT_W24 | R300_W_SRC_US;
+       } else {
+               fgdepthsrc = R300_FG_DEPTH_SRC_SCAN;
+               w_fmt = R300_W_FMT_W0 | R300_W_SRC_US;
+       }
+
+       if (w_fmt != rmesa->hw.us_out_fmt.cmd[5]) {
+               R300_STATECHANGE(rmesa, us_out_fmt);
+               rmesa->hw.us_out_fmt.cmd[5] = w_fmt;
+       }
+
        if (fgdepthsrc != rmesa->hw.fg_depth_src.cmd[1]) {
                R300_STATECHANGE(rmesa, fg_depth_src);
                rmesa->hw.fg_depth_src.cmd[1] = fgdepthsrc;
@@ -2690,7 +2570,6 @@ void r300InitStateFuncs(struct dd_function_table *functions)
        functions->DepthFunc = r300DepthFunc;
        functions->DepthMask = r300DepthMask;
        functions->CullFace = r300CullFace;
-       functions->Fogfv = r300Fogfv;
        functions->FrontFace = r300FrontFace;
        functions->ShadeModel = r300ShadeModel;
        functions->LogicOpcode = r300LogicOpcode;
index 153582ce4894d19627c8afd8242ebee680bbbe36..f57516acf413795dde1d09a0ae7bd158dcd2fd8f 100644 (file)
@@ -82,14 +82,15 @@ static void r300SetVertexFormat( GLcontext *ctx )
        struct vertex_buffer *VB = &tnl->vb;
        DECLARE_RENDERINPUTS(index_bitset);
        GLuint InputsRead = 0, OutputsWritten = 0;
-       int vap_fmt_0 = 0;
+       int vap_fmt_1 = 0;
        int offset = 0;
        int vte = 0;
+       int fog_id;
        GLint inputs[VERT_ATTRIB_MAX];
        GLint tab[VERT_ATTRIB_MAX];
        int swizzle[VERT_ATTRIB_MAX][4];
        GLuint i, nr;
-       GLuint sz, vap_fmt_1 = 0;
+       GLuint sz;
 
        DECLARE_RENDERINPUTS(render_inputs_bitset);
        RENDERINPUTS_COPY(render_inputs_bitset, tnl->render_inputs_bitset);
@@ -125,13 +126,12 @@ static void r300SetVertexFormat( GLcontext *ctx )
                offset = 4;
                EMIT_PAD(4 * sizeof(float));
        }
-
+/*
        if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE )) {
                EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F );
-               vap_fmt_0 |=  R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
                offset += 1;
        }
-
+*/
        if (RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_COLOR0)) {
                sz = VB->AttribPtr[VERT_ATTRIB_COLOR0]->size;
                rmesa->swtcl.coloroffset = offset;
@@ -150,6 +150,33 @@ static void r300SetVertexFormat( GLcontext *ctx )
                OutputsWritten |= 1 << VERT_RESULT_COL1;
        }
 
+       fog_id = -1;
+       if (RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_FOG)) {
+               /* find first free tex coord slot */
+               if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
+                       int i;
+                       for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+                               if (!RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
+                                       fog_id = i;
+                                       break;
+                               }
+                       }
+               } else {
+                       fog_id = 0;
+               }
+
+               if (fog_id == -1) {
+                       fprintf(stderr, "\tout of free texcoords to do fog\n");
+                       _mesa_exit(-1);
+               }
+
+               sz = VB->AttribPtr[VERT_ATTRIB_FOG]->size;
+               EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F + sz - 1);
+               InputsRead |= 1 << VERT_ATTRIB_FOG;
+               OutputsWritten |= 1 << VERT_RESULT_FOGC;
+               vap_fmt_1 |= sz << (3 * fog_id);
+       }
+
        if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
                int i;
 
@@ -164,6 +191,37 @@ static void r300SetVertexFormat( GLcontext *ctx )
                }
        }
 
+       /* RS can't put fragment position on the pixel stack, so stuff it in texcoord if needed */
+       if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POS) && (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_WPOS)) {
+               int first_free_tex = -1;
+               if (fog_id >= 0) {
+                       first_free_tex = fog_id+1;
+               } else {
+                       if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
+                               int i;
+                               for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+                                       if (!RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
+                                               first_free_tex = i;
+                                               break;
+                                       }
+                               }
+                       } else {
+                               first_free_tex = 0;
+                       }
+               }
+
+               if (first_free_tex == -1) {
+                       fprintf(stderr, "\tout of free texcoords to write w pos\n");
+                       _mesa_exit(-1);
+               }
+
+               sz = VB->AttribPtr[VERT_ATTRIB_POS]->size;
+               InputsRead |= 1 << (VERT_ATTRIB_TEX0 + first_free_tex);
+               OutputsWritten |= 1 << (VERT_RESULT_TEX0 + first_free_tex);
+               EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_1F + sz - 1 );
+               vap_fmt_1 |= sz << (3 * first_free_tex);
+       }
+
        for (i = 0, nr = 0; i < VERT_ATTRIB_MAX; i++) {
                if (InputsRead & (1 << i)) {
                        inputs[i] = nr++;
@@ -179,6 +237,8 @@ static void r300SetVertexFormat( GLcontext *ctx )
                inputs[VERT_ATTRIB_COLOR0] = 2;
        if (InputsRead & (1 << VERT_ATTRIB_COLOR1))
                inputs[VERT_ATTRIB_COLOR1] = 3;
+       if (InputsRead & (1 << VERT_ATTRIB_FOG))
+               inputs[VERT_ATTRIB_FOG] = 6 + fog_id;
        for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++)
                if (InputsRead & (1 << i))
                        inputs[i] = 6 + (i - VERT_ATTRIB_TEX0);
@@ -224,6 +284,7 @@ static void r300SetVertexFormat( GLcontext *ctx )
                r300VAPInputRoute1(&rmesa->hw.vir[1].cmd[R300_VIR_CNTL_0], swizzle,
                                   nr);
        }
+
        R300_STATECHANGE(rmesa, vic);
        rmesa->hw.vic.cmd[R300_VIC_CNTL_0] = r300VAPInputCntl0(ctx, InputsRead);
        rmesa->hw.vic.cmd[R300_VIC_CNTL_1] = r300VAPInputCntl1(ctx, InputsRead);
@@ -520,9 +581,12 @@ static void r300RenderStart(GLcontext *ctx)
        r300UpdateShaderStates(rmesa);
 
        r300EmitCacheFlush(rmesa);
+
+       /* investigate if we can put back flush optimisation if needed */
        if (rmesa->radeon.dma.flush != NULL) {
                rmesa->radeon.dma.flush(ctx);
        }
+
 }
 
 static void r300RenderFinish(GLcontext *ctx)
@@ -652,5 +716,4 @@ void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset)
                   rmesa->radeon.swtcl.numverts);
   r300EmitCacheFlush(rmesa);
   COMMIT_BATCH();
-
 }
index c4e325e6a762a2a21dad256f70dc5ca15f414704..50806575ced0a659e264543f9fecc1871ce9cb1b 100644 (file)
@@ -126,7 +126,7 @@ static unsigned long t_dst_mask(GLuint mask)
        return mask & VSF_FLAG_ALL;
 }
 
-static unsigned long t_dst_class(enum register_file file)
+static unsigned long t_dst_class(gl_register_file file)
 {
 
        switch (file) {
@@ -161,7 +161,7 @@ static unsigned long t_dst_index(struct r300_vertex_program *vp,
        return dst->Index;
 }
 
-static unsigned long t_src_class(enum register_file file)
+static unsigned long t_src_class(gl_register_file file)
 {
        switch (file) {
        case PROGRAM_TEMPORARY:
@@ -993,17 +993,16 @@ static void t_inputs_outputs(struct r300_vertex_program *vp)
                    vp->outputs[VERT_RESULT_COL0] + 3;
                cur_reg = vp->outputs[VERT_RESULT_BFC1] + 1;
        }
-#if 0
-       if (vp->key.OutputsWritten & (1 << VERT_RESULT_FOGC)) {
-               vp->outputs[VERT_RESULT_FOGC] = cur_reg++;
-       }
-#endif
 
        for (i = VERT_RESULT_TEX0; i <= VERT_RESULT_TEX7; i++) {
                if (vp->key.OutputsWritten & (1 << i)) {
                        vp->outputs[i] = cur_reg++;
                }
        }
+
+       if (vp->key.OutputsWritten & (1 << VERT_RESULT_FOGC)) {
+               vp->outputs[VERT_RESULT_FOGC] = cur_reg++;
+       }
 }
 
 static void r300TranslateVertexShader(struct r300_vertex_program *vp,
@@ -1271,7 +1270,6 @@ static void position_invariant(struct gl_program *prog)
                else
                        vpi[i].Opcode = OPCODE_MAD;
 
-               vpi[i].StringPos = 0;
                vpi[i].Data = 0;
 
                if (i == 3)
index 926ddd5964435f7b940a92b9c0c20b540097eb02..07a2a7b17ce5ca3b102460e2d5989ef0131e6d94 100644 (file)
@@ -298,8 +298,8 @@ static void insert_WPOS_trailer(struct r500_fragment_program_compiler *compiler)
 
 static void nqssadce_init(struct nqssadce_state* s)
 {
-       s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW;
-       s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W;
+       s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW;
+       s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W;
 }
 
 static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg)
index 97ce016c99cd09c727d4c8fd21fdac38f5f343af..a083c3d2436321b1f2a49ee40fb8f7deb325b37d 100644 (file)
@@ -191,7 +191,7 @@ static void process_instruction(struct nqssadce_state* s)
 
        if (inst->Opcode != OPCODE_KIL) {
                if (s->Descr->RewriteDepthOut) {
-                       if (inst->DstReg.File == PROGRAM_OUTPUT && inst->DstReg.Index == FRAG_RESULT_DEPR)
+                       if (inst->DstReg.File == PROGRAM_OUTPUT && inst->DstReg.Index == FRAG_RESULT_DEPTH)
                                rewrite_depth_out(inst);
                }
 
index 8a945d8537c9b29ed350bbae3f010033e4aebee8..49aa90dd94ab51172d3b4e16ecabf0141d08e04f 100644 (file)
@@ -451,19 +451,7 @@ static void allocate_input_registers(struct pair_state *s)
        int i;
        GLuint hwindex = 0;
 
-       /* Texcoords come first */
-       for (i = 0; i < s->Ctx->Const.MaxTextureUnits; i++) {
-               if (InputsRead & (FRAG_BIT_TEX0 << i))
-                       alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_TEX0+i, hwindex++);
-       }
-       InputsRead &= ~FRAG_BITS_TEX_ANY;
-
-       /* fragment position treated as a texcoord */
-       if (InputsRead & FRAG_BIT_WPOS)
-               alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_WPOS, hwindex++);
-       InputsRead &= ~FRAG_BIT_WPOS;
-
-       /* Then primary colour */
+       /* Primary colour */
        if (InputsRead & FRAG_BIT_COL0)
                alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_COL0, hwindex++);
        InputsRead &= ~FRAG_BIT_COL0;
@@ -473,11 +461,23 @@ static void allocate_input_registers(struct pair_state *s)
                alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_COL1, hwindex++);
        InputsRead &= ~FRAG_BIT_COL1;
 
-       /* Fog coordinate */
+       /* Texcoords */
+       for (i = 0; i < s->Ctx->Const.MaxTextureUnits; i++) {
+               if (InputsRead & (FRAG_BIT_TEX0 << i))
+                       alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_TEX0+i, hwindex++);
+       }
+       InputsRead &= ~FRAG_BITS_TEX_ANY;
+
+       /* Fogcoords treated as a texcoord */
        if (InputsRead & FRAG_BIT_FOGC)
                alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_FOGC, hwindex++);
        InputsRead &= ~FRAG_BIT_FOGC;
 
+       /* fragment position treated as a texcoord */
+       if (InputsRead & FRAG_BIT_WPOS)
+               alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_WPOS, hwindex++);
+       InputsRead &= ~FRAG_BIT_WPOS;
+
        /* Anything else */
        if (InputsRead)
                error("Don't know how to handle inputs 0x%x\n", InputsRead);
@@ -778,10 +778,10 @@ static void fill_dest_into_pair(struct pair_state *s, struct radeon_pair_instruc
        struct prog_instruction *inst = s->Program->Instructions + ip;
 
        if (inst->DstReg.File == PROGRAM_OUTPUT) {
-               if (inst->DstReg.Index == FRAG_RESULT_COLR) {
+               if (inst->DstReg.Index == FRAG_RESULT_COLOR) {
                        pair->RGB.OutputWriteMask |= inst->DstReg.WriteMask & WRITEMASK_XYZ;
                        pair->Alpha.OutputWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3);
-               } else if (inst->DstReg.Index == FRAG_RESULT_DEPR) {
+               } else if (inst->DstReg.Index == FRAG_RESULT_DEPTH) {
                        pair->Alpha.DepthWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3);
                }
        } else {
index 5c34ca89fab2591b98b223450d2532c70f9539de..840233ff89657180d2db5c13033a69bc3ca42d96 100644 (file)
@@ -245,7 +245,7 @@ static uint32_t radeonGetLastFrame(radeonContextPtr radeon)
 {
        drm_radeon_getparam_t gp;
        int ret;
-       uint32_t frame;
+       uint32_t frame = 0;
 
        gp.param = RADEON_PARAM_LAST_FRAME;
        gp.value = (int *)&frame;
index 02101978ac4ce38e7ac4284e63a37b82e6cb56a2..1d4f008cbc7acc63df419836b14ab526f677e3ff 100644 (file)
@@ -732,7 +732,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
    unsigned char *RADEONMMIO = NULL;
    int i;
    int ret;
-   uint32_t temp;
+   uint32_t temp = 0;
 
    if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) {
       fprintf(stderr,"\nERROR!  sizeof(RADEONDRIRec) does not match passed size from device driver\n");
@@ -1359,7 +1359,7 @@ radeonDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
         radeon_bo_unref(rb->bo);
         rb->bo = NULL;
     }
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+    _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)
index b9adab18d491e493b0cfe4e943e2de7f6aee1b91..0ece1acbeb23ec5f9e6c3f9c0f6e85fb7e5fe8fa 100644 (file)
@@ -915,11 +915,11 @@ static GLboolean radeon_validate_texgen( GLcontext *ctx, GLuint unit )
     */
    else if ( (texUnit->TexGenEnabled & S_BIT) &&
             (texUnit->TexGenEnabled & T_BIT) &&
-            (texUnit->GenModeS == texUnit->GenModeT) ) {
+            (texUnit->GenS.Mode == texUnit->GenT.Mode) ) {
       if ( ((texUnit->TexGenEnabled & R_BIT) &&
-           (texUnit->GenModeS != texUnit->GenModeR)) ||
+           (texUnit->GenS.Mode != texUnit->GenR.Mode)) ||
           ((texUnit->TexGenEnabled & Q_BIT) &&
-           (texUnit->GenModeS != texUnit->GenModeQ)) ) {
+           (texUnit->GenS.Mode != texUnit->GenQ.Mode)) ) {
         /* Mixed modes, fallback:
          */
         if (RADEON_DEBUG & DEBUG_FALLBACKS)
@@ -943,23 +943,23 @@ static GLboolean radeon_validate_texgen( GLcontext *ctx, GLuint unit )
       rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_Q_BIT(unit);
    }
 
-   switch (texUnit->GenModeS) {
+   switch (texUnit->GenS.Mode) {
    case GL_OBJECT_LINEAR:
       rmesa->TexGenEnabled |= RADEON_TEXGEN_INPUT_OBJ << inputshift;
       set_texgen_matrix( rmesa, unit,
-                        texUnit->ObjectPlaneS,
-                        texUnit->ObjectPlaneT,
-                        texUnit->ObjectPlaneR,
-                        texUnit->ObjectPlaneQ);
+                        texUnit->GenS.ObjectPlane,
+                        texUnit->GenT.ObjectPlane,
+                        texUnit->GenR.ObjectPlane,
+                        texUnit->GenQ.ObjectPlane);
       break;
 
    case GL_EYE_LINEAR:
       rmesa->TexGenEnabled |= RADEON_TEXGEN_INPUT_EYE << inputshift;
       set_texgen_matrix( rmesa, unit,
-                        texUnit->EyePlaneS,
-                        texUnit->EyePlaneT,
-                        texUnit->EyePlaneR,
-                        texUnit->EyePlaneQ);
+                        texUnit->GenS.EyePlane,
+                        texUnit->GenT.EyePlane,
+                        texUnit->GenR.EyePlane,
+                        texUnit->GenQ.EyePlane);
       break;
 
    case GL_REFLECTION_MAP_NV:
index 0df634b84db909cab19e6b3cff5427ff105ecc99..866807462a4302c8c6983a52d06020417e839d4c 100644 (file)
 #       define RADEON_ALPHA_ARG_C_T1_ALPHA       (6   << 8)
 #       define RADEON_ALPHA_ARG_C_T2_ALPHA       (7   << 8)
 #       define RADEON_ALPHA_ARG_C_T3_ALPHA       (8   << 8)
-#       define RADEON_DOT_ALPHA_DONT_REPLICATE   (1   << 9)
+#       define RADEON_DOT_ALPHA_DONT_REPLICATE   (1   << 12)
 #       define RADEON_ALPHA_ARG_MASK             0xf
 
 #define RADEON_PP_TFACTOR_0                 0x1c68
index 8bf2ea98783f4bd7871017bc98aa69792989e0ac..db6602636382bf337074b83f081a73ef93dbcd8e 100644 (file)
@@ -502,20 +502,20 @@ static void s3vInitTextureObjects( GLcontext *ctx )
 #if 1
        ctx->Texture.CurrentUnit = 0;
 
-       texObj = ctx->Texture.Unit[0].Current1D;
+       texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_1D_INDEX];
        s3vBindTexture( ctx, GL_TEXTURE_1D, texObj );
 
-       texObj = ctx->Texture.Unit[0].Current2D;
+       texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];
        s3vBindTexture( ctx, GL_TEXTURE_2D, texObj );
 #endif
 
 #if 0
        ctx->Texture.CurrentUnit = 1;
 
-       texObj = ctx->Texture.Unit[1].Current1D;
+       texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_1D_INDEX];
        s3vBindTexture( ctx, GL_TEXTURE_1D, texObj );
 
-       texObj = ctx->Texture.Unit[1].Current2D;
+       texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_2D_INDEX];
        s3vBindTexture( ctx, GL_TEXTURE_2D, texObj );
 #endif
 
index b18c8763c3aed3b7f3fd4130620f1a24c0282c5d..85f148176965912d87993bfed1b45a5d249bf3fd 100644 (file)
@@ -4,11 +4,12 @@
 
 #include "s3v_context.h"
 #include "s3v_vb.h"
+#include "s3v_dri.h"
 #include "main/context.h"
 #include "main/matrix.h"
-#include "s3v_dri.h"
 #include "main/framebuffer.h"
 #include "main/renderbuffer.h"
+#include "main/viewport.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
@@ -131,7 +132,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
 static void
 s3vDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 static void
index 326d595352ff03109114e877c10d51e8c0901f85..a94f1c076ca2780cd673fcc9e2166ade4eb28811 100644 (file)
@@ -678,7 +678,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
 static void
 savageDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 #if 0
index 73d85ed57b452b621b3680b90f8707ad1d030e68..84e1b5258544f5bba0437100bd30145e8f95e413 100644 (file)
@@ -514,7 +514,7 @@ static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func)
        imesa->regs.s4.drawLocalCtrl.ni.flushPdZbufWrites = GL_TRUE;
        imesa->regs.s4.zBufCtrl.ni.zBufEn = GL_TRUE;
     }
-    else if (imesa->glCtx->Stencil.Enabled && imesa->hw_stencil)
+    else if (imesa->glCtx->Stencil._Enabled && imesa->hw_stencil)
     {
         /* Need to keep Z on for Stencil. */
        imesa->regs.s4.zBufCtrl.ni.zCmpFunc = CF_Always;
@@ -1092,7 +1092,7 @@ static void savageDDEnable_s4(GLcontext *ctx, GLenum cap, GLboolean state)
                FALLBACK (ctx, SAVAGE_FALLBACK_STENCIL, state);
            else {
                imesa->regs.s4.stencilCtrl.ni.stencilEn = state;
-               if (ctx->Stencil.Enabled &&
+               if (ctx->Stencil._Enabled &&
                    imesa->regs.s4.zBufCtrl.ni.zBufEn != GL_TRUE)
                {
                    /* Stencil buffer requires Z enabled. */
index 9eb27fef0872accd3c5e355191ed811b030cf3a3..b5f04ae28d09170776a46667ee2372f34ccf764c 100644 (file)
@@ -221,7 +221,7 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv,
 static void
 sisDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 static void sisCopyBuffer( __DRIdrawablePrivate *dPriv )
index 2e7f11327e6301e987d9ca76930cedd8bdde6895..fbfa49c99d02a5fa0f510eec9ccdab274ca98014 100644 (file)
@@ -476,7 +476,7 @@ driDestroyDrawable(__DRIdrawable *buf)
        _mesa_free(buf->row);
 
        fb->DeletePending = GL_TRUE;
-       _mesa_unreference_framebuffer(&fb);
+       _mesa_reference_framebuffer(&fb, NULL);
     }
 }
 
index 20046fcb3af2c4eb03cacbbbd99d96b1534e0568..68b5027561bd651def0939373df3619ba0fe079a 100644 (file)
@@ -67,7 +67,6 @@
 #define need_GL_EXT_fog_coord
 #define need_GL_EXT_paletted_texture
 /* #define need_GL_EXT_secondary_color */
-/* #define need_GL_MESA_program_debug */
 /* #define need_GL_NV_vertex_program */
 #include "extension_helper.h"
 
@@ -101,9 +100,6 @@ const struct dri_extension card_extensions[] =
 #ifdef need_GL_NV_vertex_program
     { "GL_NV_vertex_program",              GL_NV_vertex_program_functions }
     { "GL_NV_vertex_program1_1",           NULL },
-#endif
-#ifdef need_GL_MESA_program_debug
-    { "GL_MESA_program_debug",             GL_MESA_program_debug_functions },
 #endif
     { NULL,                                NULL }
 };
index 9ab9c05f2bd083e49d900e4dcd0a5c3fd0a9c0c6..18729d5ae08c4adcaab342fb7ef35f3a4b4931d3 100644 (file)
@@ -610,7 +610,7 @@ tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
        ctx->Depth.Test ||
        ctx->Fog.Enabled ||
        ctx->Scissor.Enabled ||
-       ctx->Stencil.Enabled ||
+       ctx->Stencil._Enabled ||
        !ctx->Color.ColorMask[0] ||
        !ctx->Color.ColorMask[1] ||
        !ctx->Color.ColorMask[2] ||
index cf840c57a7a6bced9ce3f8bf170a9ddcd40e0c60..2cd8e12d955cdb92cb39a6378c105d0bad3f357d 100644 (file)
@@ -740,7 +740,7 @@ void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa )
    }
 
    if ( fxMesa->dirty & TDFX_UPLOAD_STENCIL ) {
-      if (fxMesa->glCtx->Stencil.Enabled) {
+      if (fxMesa->glCtx->Stencil._Enabled) {
          fxMesa->Glide.grEnable(GR_STENCIL_MODE_EXT);
          fxMesa->Glide.grStencilOp(fxMesa->Stencil.FailFunc,
                                    fxMesa->Stencil.ZFailFunc,
index 5f2f5cfff5179cbe03c37ad15cda0d739e71291d..58bd48b294ce63e15cf776d4f7ef094be8114290 100644 (file)
@@ -232,7 +232,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv,
 static void
 tdfxDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 
index a2d7bcd97d9fed2a6f7634a6b1f9135c70d1becd..591df8a905a9db7cb9677437f023be34a3e3b710 100644 (file)
@@ -459,7 +459,7 @@ static void tdfxUpdateStencil( GLcontext *ctx )
    }
 
    if (fxMesa->haveHwStencil) {
-      if (ctx->Stencil.Enabled) {
+      if (ctx->Stencil._Enabled) {
          fxMesa->Stencil.Function = ctx->Stencil.Function[0] - GL_NEVER + GR_CMP_NEVER;
          fxMesa->Stencil.RefValue = ctx->Stencil.Ref[0] & 0xff;
          fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask[0] & 0xff;
index aefd8a243f6749e5745e170e4579eb0195f5feb0..b5126b07ea641595dd602111a4606cea99ccac7b 100644 (file)
@@ -41,6 +41,7 @@
 #include "main/extensions.h"
 #include "main/framebuffer.h"
 #include "main/renderbuffer.h"
+#include "main/viewport.h"
 #if defined(USE_X86_ASM)
 #include "x86/common_x86_asm.h"
 #endif
@@ -281,7 +282,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv,
 static void
 tridentDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 static void
index e9f566161c267ecd4c20bcbbbc938611dbee3cd2..3dbb5705710382e7e723df17c506e2744b663117 100644 (file)
@@ -316,7 +316,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
 static void
 viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
 {
-   _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 static const __DRIconfig **
index 1cef01ab033038539849361c777baa6ff3cb6b69..840e4e42da95d887e462da971b8bd155fff62ccf 100644 (file)
@@ -1342,7 +1342,7 @@ static void viaChooseStencilState(GLcontext *ctx)
 {
     struct via_context *vmesa = VIA_CONTEXT(ctx);
     
-    if (ctx->Stencil.Enabled) {
+    if (ctx->Stencil._Enabled) {
         GLuint temp;
 
         vmesa->regEnable |= HC_HenST_MASK;
index 7b442b6d20bbf7f8eed25f3fa027fa5d16f7c827..62722972b2aa65c6060348c2f7b74ae0e07e1eaf 100644 (file)
@@ -472,7 +472,7 @@ static void GGItriangle_flat_depth(GLcontext *ctx, const SWvertex *v0, const SWv
 
 static swrast_tri_func ggimesa_stubs_get_triangle_func(GLcontext *ctx)
 {
-       if (ctx->Stencil.Enabled) return NULL;
+       if (ctx->Stencil._Enabled) return NULL;
        if (ctx->Polygon.SmoothFlag) return NULL;
        if (ctx->Polygon.StippleFlag) return NULL;
        if (ctx->Texture._ReallyEnabled) return NULL;  
index 338cd37382affa9d758c3801c02b8b67cbeecbfd..2bc60399ea2d5358e65166f525216e922aac7b4c 100644 (file)
@@ -1922,7 +1922,6 @@ fxDDInitExtensions(GLcontext * ctx)
       _mesa_enable_extension(ctx, "GL_ARB_vertex_program");
       _mesa_enable_extension(ctx, "GL_NV_vertex_program");
       _mesa_enable_extension(ctx, "GL_NV_vertex_program1_1");
-      _mesa_enable_extension(ctx, "GL_MESA_program_debug");
    }
 #if 0
    /* this requires _tnl_vertex_cull_stage in the pipeline */
@@ -1948,7 +1947,7 @@ fx_check_IsInHardware(GLcontext * ctx)
       return FX_FALLBACK_RENDER_MODE;
    }
 
-   if (ctx->Stencil.Enabled && !fxMesa->haveHwStencil) {
+   if (ctx->Stencil._Enabled && !fxMesa->haveHwStencil) {
       return FX_FALLBACK_STENCIL;
    }
 
index 918ec418563cc3e8c47c41b7fb0a7dda620d4974..e4527abdeca583c6220e1e8aa91771a63611d4c0 100644 (file)
@@ -72,6 +72,8 @@ struct options {
    const char *VertFile;
    const char *FragFile;
    const char *OutputFile;
+   GLboolean Params;
+   struct gl_sl_pragmas Pragmas;
 };
 
 static struct options Options;
@@ -147,6 +149,9 @@ CreateContext(void)
    TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
    _swsetup_Wakeup( ctx );
 
+   /* Override the context's default pragma settings */
+   ctx->Shader.DefaultPragmas = Options.Pragmas;
+
    _mesa_make_current(ctx, buf, buf);
 
    return GL_TRUE;
@@ -228,6 +233,8 @@ PrintShaderInstructions(GLuint shader, FILE *f)
    struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
    struct gl_program *prog = sh->Program;
    _mesa_fprint_program_opt(stdout, prog, Options.Mode, Options.LineNumbers);
+   if (Options.Params)
+      _mesa_print_program_parameters(ctx, prog);
 }
 
 
@@ -253,11 +260,15 @@ Usage(void)
    printf("Usage:\n");
    printf("  --vs FILE          vertex shader input filename\n");
    printf("  --fs FILE          fragment shader input filename\n");
-   printf("  --arb              emit ARB-style instructions (the default)\n");
+   printf("  --arb              emit ARB-style instructions\n");
    printf("  --nv               emit NV-style instructions\n");
-   printf("  --debug            emit debug-style instructions\n");
-   printf("  --number, -n       emit line numbers\n");
+   printf("  --debug            force #pragma debug(on)\n");
+   printf("  --nodebug          force #pragma debug(off)\n");
+   printf("  --opt              force #pragma optimize(on)\n");
+   printf("  --noopt            force #pragma optimize(off)\n");
+   printf("  --number, -n       emit line numbers (if --arb or --nv)\n");
    printf("  --output, -o FILE  output filename\n");
+   printf("  --params           also emit program parameter info\n");
    printf("  --help             display this information\n");
 }
 
@@ -268,10 +279,15 @@ ParseOptions(int argc, char *argv[])
    int i;
 
    Options.LineNumbers = GL_FALSE;
-   Options.Mode = PROG_PRINT_ARB;
+   Options.Mode = PROG_PRINT_DEBUG;
    Options.VertFile = NULL;
    Options.FragFile = NULL;
    Options.OutputFile = NULL;
+   Options.Params = GL_FALSE;
+   Options.Pragmas.IgnoreOptimize = GL_FALSE;
+   Options.Pragmas.IgnoreDebug = GL_FALSE;
+   Options.Pragmas.Debug = GL_FALSE;
+   Options.Pragmas.Optimize = GL_TRUE;
 
    if (argc == 1) {
       Usage();
@@ -294,7 +310,20 @@ ParseOptions(int argc, char *argv[])
          Options.Mode = PROG_PRINT_NV;
       }
       else if (strcmp(argv[i], "--debug") == 0) {
-         Options.Mode = PROG_PRINT_DEBUG;
+         Options.Pragmas.IgnoreDebug = GL_TRUE;
+         Options.Pragmas.Debug = GL_TRUE;
+      }
+      else if (strcmp(argv[i], "--nodebug") == 0) {
+         Options.Pragmas.IgnoreDebug = GL_TRUE;
+         Options.Pragmas.Debug = GL_FALSE;
+      }
+      else if (strcmp(argv[i], "--opt") == 0) {
+         Options.Pragmas.IgnoreOptimize = GL_TRUE;
+         Options.Pragmas.Optimize = GL_TRUE;
+      }
+      else if (strcmp(argv[i], "--noopt") == 0) {
+         Options.Pragmas.IgnoreOptimize = GL_TRUE;
+         Options.Pragmas.Optimize = GL_FALSE;
       }
       else if (strcmp(argv[i], "--number") == 0 ||
                strcmp(argv[i], "-n") == 0) {
@@ -305,6 +334,9 @@ ParseOptions(int argc, char *argv[])
          Options.OutputFile = argv[i + 1];
          i++;
       }
+      else if (strcmp(argv[i], "--params") == 0) {
+         Options.Params = GL_TRUE;
+      }
       else if (strcmp(argv[i], "--help") == 0) {
          Usage();
          exit(0);
@@ -315,6 +347,11 @@ ParseOptions(int argc, char *argv[])
          exit(1);
       }
    }
+
+   if (Options.Mode == PROG_PRINT_DEBUG) {
+      /* always print line numbers when emitting debug-style output */
+      Options.LineNumbers = GL_TRUE;
+   }
 }
 
 
@@ -323,13 +360,13 @@ main(int argc, char *argv[])
 {
    GLuint shader = 0;
 
+   ParseOptions(argc, argv);
+
    if (!CreateContext()) {
       fprintf(stderr, "%s: Failed to create compiler context\n", Prog);
       exit(1);
    }
 
-   ParseOptions(argc, argv);
-
    if (Options.VertFile) {
       shader = CompileShader(Options.VertFile, GL_VERTEX_SHADER);
    }
index b386e34aadf38dd2194b409e23892742263a537b..ede43ef4c0f61db7f76f395c4128a8adbac10b90 100644 (file)
@@ -940,7 +940,7 @@ EXPORTS
        _mesa_store_texsubimage3d
        _mesa_strcmp
        _mesa_test_proxy_teximage
-       _mesa_unreference_framebuffer
+       _mesa_reference_framebuffer
        _mesa_update_framebuffer_visual
        _mesa_use_program
        _mesa_Viewport
index 80746950c714aa898dfecbdc2f8819e2d3a4a880..d1103f31670efca92fbdee8c6d61cc22ebc323cc 100644 (file)
@@ -62,7 +62,7 @@ wmesa_free_framebuffer(HDC hdc)
        else
            prev->next = pwfb->next;
         fb = &pwfb->Base;
-        _mesa_unreference_framebuffer(&fb); 
+        _mesa_reference_framebuffer(&fb, NULL); 
     }
 }
 
index d2780e62c979fa10f64587ce964c5f136712192d..5e427d2d5c6013dbfd1e0b4cd923bbd616a0e952 100644 (file)
@@ -41,7 +41,8 @@ OBJECTS = $(SOURCES:.c=.o)
 INCLUDE_DIRS = \
        -I$(TOP)/include \
        -I$(TOP)/src/mesa \
-       -I$(TOP)/src/mesa/main
+       -I$(TOP)/src/mesa/main \
+       $(X11_INCLUDES)
 
 CORE_MESA = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a
 
index c2ccce6f520801c7f47e33c7d916a03830543e5b..02eea25a7129a90aa616ddeae938b31af46db0fb 100644 (file)
@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <string.h>
 #include "main/glheader.h"
+#include "main/compiler.h"
 #include "glapi/glapi.h"
 #include "glxapi.h"
 
@@ -1374,7 +1375,12 @@ _glxapi_get_proc_address(const char *funcName)
 {
    GLuint i;
    for (i = 0; GLX_functions[i].Name; i++) {
+#ifdef MANGLE
+      /* skip the "m" prefix on the name */
+      if (strcmp(GLX_functions[i].Name, funcName+1) == 0)
+#else
       if (strcmp(GLX_functions[i].Name, funcName) == 0)
+#endif
          return GLX_functions[i].Address;
    }
    return NULL;
index 2a8c3a4fd36c44f44668c9f0f43f41935e2109fa..6ae5b6fd5800f3402c051a82487e7025ca9d11d2 100644 (file)
@@ -1584,6 +1584,14 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
       return NULL;
    }
 
+   /* Enable this to exercise fixed function -> shader translation
+    * with software rendering.
+    */
+   if (0) {
+      mesaCtx->VertexProgram._MaintainTnlProgram = GL_TRUE;
+      mesaCtx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
+   }
+
    _mesa_enable_sw_extensions(mesaCtx);
    _mesa_enable_1_3_extensions(mesaCtx);
    _mesa_enable_1_4_extensions(mesaCtx);
@@ -2410,11 +2418,8 @@ xbuffer_to_renderbuffer(int buffer)
    case GLX_AUX0_EXT:
       return BUFFER_AUX0;
    case GLX_AUX1_EXT:
-      return BUFFER_AUX1;
    case GLX_AUX2_EXT:
-      return BUFFER_AUX2;
    case GLX_AUX3_EXT:
-      return BUFFER_AUX3;
    case GLX_AUX4_EXT:
    case GLX_AUX5_EXT:
    case GLX_AUX6_EXT:
@@ -2461,13 +2466,13 @@ XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer,
 #if 0
    switch (drawable->TextureTarget) {
    case GLX_TEXTURE_1D_EXT:
-      texObj = texUnit->Current1D;
+      texObj = texUnit->CurrentTex[TEXTURE_1D_INDEX];
       break;
    case GLX_TEXTURE_2D_EXT:
-      texObj = texUnit->Current2D;
+      texObj = texUnit->CurrentTex[TEXTURE_2D_INDEX];
       break;
    case GLX_TEXTURE_RECTANGLE_EXT:
-      texObj = texUnit->CurrentRect;
+      texObj = texUnit->CurrentTex[TEXTURE_RECT_INDEX];
       break;
    default:
       return; /* BadMatch error */
index 7ad67bc34dae15b7001aec578ebda0243b06ada4..821e2a8e082e42198d0655836f2e080192865708 100644 (file)
@@ -229,6 +229,7 @@ alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
       }
 
       b->backxrb->ximage = NULL;
+      b->backxrb->drawable = b->backxrb->pixmap;
    }
 }
 
index 57b574944834179b9ced9b4b22b9c318d37ed529..309cefcb8e8152dc7b6afdafa4afa0a93c866bfd 100644 (file)
@@ -471,8 +471,26 @@ static void put_row_8R8G8B_pixmap( PUT_ROW_ARGS )
    if (mask) {
       for (i=0;i<n;i++,x++) {
          if (mask[i]) {
+#if 1
+            /*
+             * XXX Something funny is going on here.
+             * If we're drawing into a window that uses a depth 32 TrueColor
+             * visual, we see the right pixels on screen, but when we read
+             * them back with XGetImage() we get random colors.
+             * The alternative code below which uses XPutImage() instead
+             * seems to mostly fix the problem, but not always.
+             * We don't normally create windows with this visual, but glean
+             * does and we're seeing some failures there.
+             */
             XMesaSetForeground( dpy, gc, PACK_8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ));
             XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y );
+#else
+            /* This code works more often, but not always */
+            XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage;
+            GLuint *ptr4 = (GLuint *) rowimg->data;
+            *ptr4 = PACK_8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
+            XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, 1, 1 );
+#endif
          }
       }
    }
index d7f21692ed1a0d79dc5a76023b2541b974c87353..45b2fa077ae05c899b01f9f6879e878f89cd5e49 100644 (file)
 #define CALL_VertexAttribs4ubvNV(disp, parameters) (*((disp)->VertexAttribs4ubvNV)) parameters
 #define GET_VertexAttribs4ubvNV(disp) ((disp)->VertexAttribs4ubvNV)
 #define SET_VertexAttribs4ubvNV(disp, fn) ((disp)->VertexAttribs4ubvNV = fn)
+#define CALL_GetTexBumpParameterfvATI(disp, parameters) (*((disp)->GetTexBumpParameterfvATI)) parameters
+#define GET_GetTexBumpParameterfvATI(disp) ((disp)->GetTexBumpParameterfvATI)
+#define SET_GetTexBumpParameterfvATI(disp, fn) ((disp)->GetTexBumpParameterfvATI = fn)
+#define CALL_GetTexBumpParameterivATI(disp, parameters) (*((disp)->GetTexBumpParameterivATI)) parameters
+#define GET_GetTexBumpParameterivATI(disp) ((disp)->GetTexBumpParameterivATI)
+#define SET_GetTexBumpParameterivATI(disp, fn) ((disp)->GetTexBumpParameterivATI = fn)
+#define CALL_TexBumpParameterfvATI(disp, parameters) (*((disp)->TexBumpParameterfvATI)) parameters
+#define GET_TexBumpParameterfvATI(disp) ((disp)->TexBumpParameterfvATI)
+#define SET_TexBumpParameterfvATI(disp, fn) ((disp)->TexBumpParameterfvATI = fn)
+#define CALL_TexBumpParameterivATI(disp, parameters) (*((disp)->TexBumpParameterivATI)) parameters
+#define GET_TexBumpParameterivATI(disp) ((disp)->TexBumpParameterivATI)
+#define SET_TexBumpParameterivATI(disp, fn) ((disp)->TexBumpParameterivATI = fn)
 #define CALL_AlphaFragmentOp1ATI(disp, parameters) (*((disp)->AlphaFragmentOp1ATI)) parameters
 #define GET_AlphaFragmentOp1ATI(disp) ((disp)->AlphaFragmentOp1ATI)
 #define SET_AlphaFragmentOp1ATI(disp, fn) ((disp)->AlphaFragmentOp1ATI = fn)
 
 #else
 
-#define driDispatchRemapTable_size 363
+#define driDispatchRemapTable_size 367
 extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 
 #define AttachShader_remap_index 0
@@ -2689,59 +2701,63 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 #define VertexAttribs4fvNV_remap_index 307
 #define VertexAttribs4svNV_remap_index 308
 #define VertexAttribs4ubvNV_remap_index 309
-#define AlphaFragmentOp1ATI_remap_index 310
-#define AlphaFragmentOp2ATI_remap_index 311
-#define AlphaFragmentOp3ATI_remap_index 312
-#define BeginFragmentShaderATI_remap_index 313
-#define BindFragmentShaderATI_remap_index 314
-#define ColorFragmentOp1ATI_remap_index 315
-#define ColorFragmentOp2ATI_remap_index 316
-#define ColorFragmentOp3ATI_remap_index 317
-#define DeleteFragmentShaderATI_remap_index 318
-#define EndFragmentShaderATI_remap_index 319
-#define GenFragmentShadersATI_remap_index 320
-#define PassTexCoordATI_remap_index 321
-#define SampleMapATI_remap_index 322
-#define SetFragmentShaderConstantATI_remap_index 323
-#define PointParameteriNV_remap_index 324
-#define PointParameterivNV_remap_index 325
-#define ActiveStencilFaceEXT_remap_index 326
-#define BindVertexArrayAPPLE_remap_index 327
-#define DeleteVertexArraysAPPLE_remap_index 328
-#define GenVertexArraysAPPLE_remap_index 329
-#define IsVertexArrayAPPLE_remap_index 330
-#define GetProgramNamedParameterdvNV_remap_index 331
-#define GetProgramNamedParameterfvNV_remap_index 332
-#define ProgramNamedParameter4dNV_remap_index 333
-#define ProgramNamedParameter4dvNV_remap_index 334
-#define ProgramNamedParameter4fNV_remap_index 335
-#define ProgramNamedParameter4fvNV_remap_index 336
-#define DepthBoundsEXT_remap_index 337
-#define BlendEquationSeparateEXT_remap_index 338
-#define BindFramebufferEXT_remap_index 339
-#define BindRenderbufferEXT_remap_index 340
-#define CheckFramebufferStatusEXT_remap_index 341
-#define DeleteFramebuffersEXT_remap_index 342
-#define DeleteRenderbuffersEXT_remap_index 343
-#define FramebufferRenderbufferEXT_remap_index 344
-#define FramebufferTexture1DEXT_remap_index 345
-#define FramebufferTexture2DEXT_remap_index 346
-#define FramebufferTexture3DEXT_remap_index 347
-#define GenFramebuffersEXT_remap_index 348
-#define GenRenderbuffersEXT_remap_index 349
-#define GenerateMipmapEXT_remap_index 350
-#define GetFramebufferAttachmentParameterivEXT_remap_index 351
-#define GetRenderbufferParameterivEXT_remap_index 352
-#define IsFramebufferEXT_remap_index 353
-#define IsRenderbufferEXT_remap_index 354
-#define RenderbufferStorageEXT_remap_index 355
-#define BlitFramebufferEXT_remap_index 356
-#define FramebufferTextureLayerEXT_remap_index 357
-#define StencilFuncSeparateATI_remap_index 358
-#define ProgramEnvParameters4fvEXT_remap_index 359
-#define ProgramLocalParameters4fvEXT_remap_index 360
-#define GetQueryObjecti64vEXT_remap_index 361
-#define GetQueryObjectui64vEXT_remap_index 362
+#define GetTexBumpParameterfvATI_remap_index 310
+#define GetTexBumpParameterivATI_remap_index 311
+#define TexBumpParameterfvATI_remap_index 312
+#define TexBumpParameterivATI_remap_index 313
+#define AlphaFragmentOp1ATI_remap_index 314
+#define AlphaFragmentOp2ATI_remap_index 315
+#define AlphaFragmentOp3ATI_remap_index 316
+#define BeginFragmentShaderATI_remap_index 317
+#define BindFragmentShaderATI_remap_index 318
+#define ColorFragmentOp1ATI_remap_index 319
+#define ColorFragmentOp2ATI_remap_index 320
+#define ColorFragmentOp3ATI_remap_index 321
+#define DeleteFragmentShaderATI_remap_index 322
+#define EndFragmentShaderATI_remap_index 323
+#define GenFragmentShadersATI_remap_index 324
+#define PassTexCoordATI_remap_index 325
+#define SampleMapATI_remap_index 326
+#define SetFragmentShaderConstantATI_remap_index 327
+#define PointParameteriNV_remap_index 328
+#define PointParameterivNV_remap_index 329
+#define ActiveStencilFaceEXT_remap_index 330
+#define BindVertexArrayAPPLE_remap_index 331
+#define DeleteVertexArraysAPPLE_remap_index 332
+#define GenVertexArraysAPPLE_remap_index 333
+#define IsVertexArrayAPPLE_remap_index 334
+#define GetProgramNamedParameterdvNV_remap_index 335
+#define GetProgramNamedParameterfvNV_remap_index 336
+#define ProgramNamedParameter4dNV_remap_index 337
+#define ProgramNamedParameter4dvNV_remap_index 338
+#define ProgramNamedParameter4fNV_remap_index 339
+#define ProgramNamedParameter4fvNV_remap_index 340
+#define DepthBoundsEXT_remap_index 341
+#define BlendEquationSeparateEXT_remap_index 342
+#define BindFramebufferEXT_remap_index 343
+#define BindRenderbufferEXT_remap_index 344
+#define CheckFramebufferStatusEXT_remap_index 345
+#define DeleteFramebuffersEXT_remap_index 346
+#define DeleteRenderbuffersEXT_remap_index 347
+#define FramebufferRenderbufferEXT_remap_index 348
+#define FramebufferTexture1DEXT_remap_index 349
+#define FramebufferTexture2DEXT_remap_index 350
+#define FramebufferTexture3DEXT_remap_index 351
+#define GenFramebuffersEXT_remap_index 352
+#define GenRenderbuffersEXT_remap_index 353
+#define GenerateMipmapEXT_remap_index 354
+#define GetFramebufferAttachmentParameterivEXT_remap_index 355
+#define GetRenderbufferParameterivEXT_remap_index 356
+#define IsFramebufferEXT_remap_index 357
+#define IsRenderbufferEXT_remap_index 358
+#define RenderbufferStorageEXT_remap_index 359
+#define BlitFramebufferEXT_remap_index 360
+#define FramebufferTextureLayerEXT_remap_index 361
+#define StencilFuncSeparateATI_remap_index 362
+#define ProgramEnvParameters4fvEXT_remap_index 363
+#define ProgramLocalParameters4fvEXT_remap_index 364
+#define GetQueryObjecti64vEXT_remap_index 365
+#define GetQueryObjectui64vEXT_remap_index 366
 
 #define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters)
 #define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index])
@@ -3673,6 +3689,18 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 #define CALL_VertexAttribs4ubvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *)), driDispatchRemapTable[VertexAttribs4ubvNV_remap_index], parameters)
 #define GET_VertexAttribs4ubvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4ubvNV_remap_index])
 #define SET_VertexAttribs4ubvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4ubvNV_remap_index], fn)
+#define CALL_GetTexBumpParameterfvATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index], parameters)
+#define GET_GetTexBumpParameterfvATI(disp) GET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index])
+#define SET_GetTexBumpParameterfvATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index], fn)
+#define CALL_GetTexBumpParameterivATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *)), driDispatchRemapTable[GetTexBumpParameterivATI_remap_index], parameters)
+#define GET_GetTexBumpParameterivATI(disp) GET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterivATI_remap_index])
+#define SET_GetTexBumpParameterivATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterivATI_remap_index], fn)
+#define CALL_TexBumpParameterfvATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[TexBumpParameterfvATI_remap_index], parameters)
+#define GET_TexBumpParameterfvATI(disp) GET_by_offset(disp, driDispatchRemapTable[TexBumpParameterfvATI_remap_index])
+#define SET_TexBumpParameterfvATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexBumpParameterfvATI_remap_index], fn)
+#define CALL_TexBumpParameterivATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[TexBumpParameterivATI_remap_index], parameters)
+#define GET_TexBumpParameterivATI(disp) GET_by_offset(disp, driDispatchRemapTable[TexBumpParameterivATI_remap_index])
+#define SET_TexBumpParameterivATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexBumpParameterivATI_remap_index], fn)
 #define CALL_AlphaFragmentOp1ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index], parameters)
 #define GET_AlphaFragmentOp1ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index])
 #define SET_AlphaFragmentOp1ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index], fn)
index 923c1958f0fab361f06a4cb997d2ec4b7926b486..f423c6db08476aa4f97f4758bb2c774b7d202fbe 100644 (file)
@@ -277,7 +277,7 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                        if param.is_image():
                                offset = f.offset_of( param.name )
 
-                               print '%s    %s const %s = (%s) %s(pc + %s);' % (indent, type_string, param.name, type_string, cond, offset)
+                               print '%s    %s const %s = (%s) (%s(pc + %s));' % (indent, type_string, param.name, type_string, cond, offset)
                                
                                if param.depth:
                                        print '%s    __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);' % (indent)
index 8212fc24770d52e969cf72aeec43a20daa996060..cc3e3ae6bffbcffe9397007f8e1c5faf38bf7c3a 100644 (file)
     <enum name="DEPTH_STENCIL_TO_BGRA_NV"                 value="0x886F"/>
 </category>
 
+<category name="GL_ATI_envmap_bumpmap" number="244">
+    <enum name="BUMP_ROT_MATRIX_ATI"          count="4"   value="0x8775">
+        <size name="TexBumpParameterfv"/>
+        <size name="TexBumpParameteriv"/>
+        <size name="GetTexBumpParameterfv" mode="get"/>
+        <size name="GetTexBumpParameteriv" mode="get"/>
+    </enum>
+    <enum name="BUMP_ROT_MATRIX_SIZE_ATI"     count="1"   value="0x8776">
+        <size name="GetTexBumpParameterfv" mode="get"/>
+        <size name="GetTexBumpParameteriv" mode="get"/>
+    </enum>
+    <enum name="BUMP_NUM_TEX_UNITS_ATI"       count="1"   value="0x8777">
+        <size name="GetTexBumpParameterfv" mode="get"/>
+        <size name="GetTexBumpParameteriv" mode="get"/>
+    </enum>
+    <enum name="BUMP_TEX_UNITS_ATI"           count="-1"  value="0x8778">
+        <size name="GetTexBumpParameterfv" mode="get"/>
+        <size name="GetTexBumpParameteriv" mode="get"/>
+    </enum>
+    <enum name="DUDV_ATI"                                 value="0x8779"/>
+    <enum name="DU8DV8_ATI"                               value="0x877A"/>
+    <enum name="BUMP_ENVMAP_ATI"                          value="0x877B"/>
+    <enum name="BUMP_TARGET_ATI"              count="1"   value="0x877C">
+        <size name="TexEnviv"/>
+        <size name="TexEnvfv"/>
+        <size name="GetTexEnviv" mode="get"/>
+        <size name="GetTexEnvfv" mode="get"/>
+    </enum>
+    <function name="TexBumpParameterfvATI" offset="assign">
+      <param name="pname" type="GLenum"/>
+      <param name="param" type="const GLfloat *" variable_param="pname"/>
+      <glx ignore="true"/>
+    </function>
+    <function name="TexBumpParameterivATI" offset="assign">
+      <param name="pname" type="GLenum"/>
+      <param name="param" type="const GLint *" variable_param="pname"/>
+      <glx ignore="true"/>
+    </function>
+    <function name="GetTexBumpParameterfvATI" offset="assign">
+      <param name="pname" type="GLenum"/>
+      <param name="param" type="GLfloat *" variable_param="pname"/>
+      <glx ignore="true"/>
+    </function>
+    <function name="GetTexBumpParameterivATI" offset="assign">
+      <param name="pname" type="GLenum"/>
+      <param name="param" type="GLint *" variable_param="pname"/>
+      <glx ignore="true"/>
+    </function>
+</category>
+
 <category name="GL_ATI_fragment_shader" number="245">
     <function name="GenFragmentShadersATI" offset="assign">
       <return type="GLuint"/>
index 178c00a227f50e809bb26ba0147ff2bfb6cbdd9e..33e752df38ca0117bf7c0612ffd48e2c08e19b8d 100644 (file)
@@ -39,80 +39,202 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 
 
        def printRealHeader(self):
-               print '#include "glapioffsets.h"'
+               print '#include "glapi/glapioffsets.h"'
                print ''
                print '#ifdef __arch64__'
-               print '#  define GL_STUB(fn,off)\t\t\t\t\\'
-               print 'fn:\t\t\t\t\t\\'
-               print '\tsethi\t%hi(0xDEADBEEF), %g4 ;\t\t\t\\'
-               print '\tsethi\t%hi(0xDEADBEEF), %g1 ;\t\t\t\\'
-               print '\tor\t%g4, %lo(0xDEADBEEF), %g4 ;\t\t\\'
-               print '\tor\t%g1, %lo(0xDEADBEEF), %g1 ;\t\t\\'
-               print '\tsllx\t%g4, 32, %g4 ;\t\t\t\t\\'
-               print '\tldx\t[%g1 + %g4], %g1 ;\t\t\t\\'
-               print '\tsethi\t%hi(8 * off), %g4 ;\t\t\t\\'
-               print '\tor\t%g4, %lo(8 * off), %g4 ;\t\t\\'
-               print '\tldx\t[%g1 + %g4], %g5 ;\t\t\t\\'
-               print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\'
-               print '\tnop'
+               print '#define GL_OFF(N)\t((N) * 8)'
+               print '#define GL_LL\t\tldx'
+               print '#define GL_TIE_LD(SYM)\t%tie_ldx(SYM)'
+               print '#define GL_STACK_SIZE\t128'
                print '#else'
-               print '#  define GL_STUB(fn,off)\t\t\t\t\\'
-               print 'fn:\t\t\t\t\t\\'
-               print '\tsethi\t%hi(0xDEADBEEF), %g1 ;\t\t\t\\'
-               print '\tld\t[%g1 + %lo(0xDEADBEEF)], %g1 ;\t\t\\'
-               print '\tld\t[%g1 + (4 * off)], %g5 ;\t\t\\'
-               print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\'
-               print '\tnop'
+               print '#define GL_OFF(N)\t((N) * 4)'
+               print '#define GL_LL\t\tld'
+               print '#define GL_TIE_LD(SYM)\t%tie_ld(SYM)'
+               print '#define GL_STACK_SIZE\t64'
                print '#endif'
                print ''
-               print '#define GL_STUB_ALIAS(fn,alias) fn = alias'
+               print '#define GLOBL_FN(x) .globl x ; .type x, @function'
+               print '#define HIDDEN(x) .hidden x'
                print ''
-               print '.text'
-               print '.align 32'
-               print '\t\t.globl __glapi_sparc_icache_flush ; .type __glapi_sparc_icache_flush,#function'
+               print '\t.register %g2, #scratch'
+               print '\t.register %g3, #scratch'
+               print ''
+               print '\t.text'
+               print ''
+               print '\tGLOBL_FN(__glapi_sparc_icache_flush)'
+               print '\tHIDDEN(__glapi_sparc_icache_flush)'
+               print '\t.type\t__glapi_sparc_icache_flush, @function'
                print '__glapi_sparc_icache_flush: /* %o0 = insn_addr */'
                print '\tflush\t%o0'
                print '\tretl'
-               print '\tnop'
+               print '\t nop'
+               print ''
+               print '\t.align\t32'
+               print ''
+               print '\t.type\t__glapi_sparc_get_pc, @function'
+               print '__glapi_sparc_get_pc:'
+               print '\tretl'
+               print '\t add\t%o7, %g2, %g2'
+               print '\t.size\t__glapi_sparc_get_pc, .-__glapi_sparc_get_pc'
+               print ''
+               print '#ifdef GLX_USE_TLS'
+               print ''
+               print '\tGLOBL_FN(__glapi_sparc_get_dispatch)'
+               print '\tHIDDEN(__glapi_sparc_get_dispatch)'
+               print '__glapi_sparc_get_dispatch:'
+               print '\tmov\t%o7, %g1'
+               print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+               print '\tcall\t__glapi_sparc_get_pc'
+               print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+               print '\tmov\t%g1, %o7'
+               print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1'
+               print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1'
+               print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)'
+               print '\tretl'
+               print '\t mov\t%g2, %o0'
+               print ''
+               print '\t.data'
+               print '\t.align\t32'
+               print ''
+               print '\t/* --> sethi %hi(_glapi_tls_Dispatch), %g1 */'
+               print '\t/* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */'
+               print '\tGLOBL_FN(__glapi_sparc_tls_stub)'
+               print '\tHIDDEN(__glapi_sparc_tls_stub)'
+               print '__glapi_sparc_tls_stub: /* Call offset in %g3 */'
+               print '\tmov\t%o7, %g1'
+               print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+               print '\tcall\t__glapi_sparc_get_pc'
+               print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+               print '\tmov\t%g1, %o7'
+               print '\tsrl\t%g3, 10, %g3'
+               print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1'
+               print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1'
+               print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)'
+               print '\tGL_LL\t[%g7+%g2], %g1'
+               print '\tGL_LL\t[%g1 + %g3], %g1'
+               print '\tjmp\t%g1'
+               print '\t nop'
+               print '\t.size\t__glapi_sparc_tls_stub, .-__glapi_sparc_tls_stub'
+               print ''
+               print '#define GL_STUB(fn, off)\t\t\t\t\\'
+               print '\tGLOBL_FN(fn);\t\t\t\t\t\\'
+               print 'fn:\tba\t__glapi_sparc_tls_stub;\t\t\t\\'
+               print '\t sethi\tGL_OFF(off), %g3;\t\t\t\\'
+               print '\t.size\tfn,.-fn;'
+               print ''
+               print '#elif defined(PTHREADS)'
+               print ''
+               print '\t/* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */'
+               print '\t/* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */'
+               print '\t/* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */'
+               print '\t/* 64-bit 0x0c --> sllx %g1, 32, %g1 */'
+               print '\t/* 64-bit 0x10 --> add %g1, %g2, %g1 */'
+               print '\t/* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */'
+               print ''
+               print '\t/* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */'
+               print '\t/* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */'
+               print ''
+               print '\t.data'
+               print '\t.align\t32'
+               print ''
+               print '\tGLOBL_FN(__glapi_sparc_pthread_stub)'
+               print '\tHIDDEN(__glapi_sparc_pthread_stub)'
+               print '__glapi_sparc_pthread_stub: /* Call offset in %g3 */'
+               print '\tmov\t%o7, %g1'
+               print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+               print '\tcall\t__glapi_sparc_get_pc'
+               print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+               print '\tmov\t%g1, %o7'
+               print '\tsethi\t%hi(_glapi_Dispatch), %g1'
+               print '\tor\t%g1, %lo(_glapi_Dispatch), %g1'
+               print '\tsrl\t%g3, 10, %g3'
+               print '\tGL_LL\t[%g2+%g1], %g2'
+               print '\tGL_LL\t[%g2], %g1'
+               print '\tcmp\t%g1, 0'
+               print '\tbe\t2f'
+               print '\t nop'
+               print '1:\tGL_LL\t[%g1 + %g3], %g1'
+               print '\tjmp\t%g1'
+               print '\t nop'
+               print '2:\tsave\t%sp, GL_STACK_SIZE, %sp'
+               print '\tmov\t%g3, %l0'
+               print '\tcall\t_glapi_get_dispatch'
+               print '\t nop'
+               print '\tmov\t%o0, %g1'
+               print '\tmov\t%l0, %g3'
+               print '\tba\t1b'
+               print '\t restore %g0, %g0, %g0'
+               print '\t.size\t__glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub'
+               print ''
+               print '#define GL_STUB(fn, off)\t\t\t\\'
+               print '\tGLOBL_FN(fn);\t\t\t\t\\'
+               print 'fn:\tba\t__glapi_sparc_pthread_stub;\t\\'
+               print '\t sethi\tGL_OFF(off), %g3;\t\t\\'
+               print '\t.size\tfn,.-fn;'
+               print ''
+               print '#else /* Non-threaded version. */'
                print ''
-               print '.data'
-               print '.align 64'
+               print '\t.type  __glapi_sparc_nothread_stub, @function'
+               print '__glapi_sparc_nothread_stub: /* Call offset in %g3 */'
+               print '\tmov\t%o7, %g1'
+               print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+               print '\tcall\t__glapi_sparc_get_pc'
+               print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+               print '\tmov\t%g1, %o7'
+               print '\tsrl\t%g3, 10, %g3'
+               print '\tsethi\t%hi(_glapi_Dispatch), %g1'
+               print '\tor\t%g1, %lo(_glapi_Dispatch), %g1'
+               print '\tGL_LL\t[%g2+%g1], %g2'
+               print '\tGL_LL\t[%g2], %g1'
+               print '\tGL_LL\t[%g1 + %g3], %g1'
+               print '\tjmp\t%g1'
+               print '\t nop'
+               print '\t.size\t__glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub'
+               print ''
+               print '#define GL_STUB(fn, off)\t\t\t\\'
+               print '\tGLOBL_FN(fn);\t\t\t\t\\'
+               print 'fn:\tba\t__glapi_sparc_nothread_stub;\t\\'
+               print '\t sethi\tGL_OFF(off), %g3;\t\t\\'
+               print '\t.size\tfn,.-fn;'
+               print ''
+               print '#endif'
+               print ''
+               print '#define GL_STUB_ALIAS(fn, alias)         \\'
+               print ' .globl  fn;                             \\'
+               print ' .set    fn, alias'
+               print ''
+               print '\t.text'
+               print '\t.align\t32'
+               print ''
+               print '\t.globl\tgl_dispatch_functions_start'
+               print '\tHIDDEN(gl_dispatch_functions_start)'
+               print 'gl_dispatch_functions_start:'
                print ''
                return
 
+       def printRealFooter(self):
+               print ''
+               print '\t.globl\tgl_dispatch_functions_end'
+               print '\tHIDDEN(gl_dispatch_functions_end)'
+               print 'gl_dispatch_functions_end:'
+               return
 
        def printBody(self, api):
                for f in api.functionIterateByOffset():
-                       if f.is_static_entry_point(f.name):
-                               name = f.name
-                       else:
-                               name = "_dispatch_stub_%u" % (f.offset)
+                       name = f.dispatch_name()
 
-                       print '\t\t.globl gl%s ; .type gl%s,#function' % (name, name)
+                       print '\tGL_STUB(gl%s, _gloffset_%s)' % (name, f.name)
 
-               print '\t\t.globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function'
-               print '_mesa_sparc_glapi_begin:'
-               print ''
+                       if not f.is_static_entry_point(f.name):
+                               print '\tHIDDEN(gl%s)' % (name)
 
                for f in api.functionIterateByOffset():
-                       if f.is_static_entry_point(f.name):
-                               name = f.name
-                       else:
-                               name = "_dispatch_stub_%u" % (f.offset)
-
-                       print '\tGL_STUB(gl%s, _gloffset_%s)' % (name, name)
+                       name = f.dispatch_name()
 
-               print ''
-               print '\t\t.globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function'
-               print '_mesa_sparc_glapi_end:'
-               print ''
-
-
-               for f in api.functionIterateByOffset():
-                       for n in f.entry_points:
-                               if n != f.name:
-                                       if f.is_static_entry_point(n):
-                                               text = '\t.globl gl%s ; .type gl%s,#function ; gl%s = gl%s' % (n, n, n, f.name)
+                       if f.is_static_entry_point(f.name):
+                               for n in f.entry_points:
+                                       if n != f.name:
+                                               text = '\tGL_STUB_ALIAS(gl%s, gl%s)' % (n, f.name)
 
                                                if f.has_different_protocol(n):
                                                        print '#ifndef GLX_INDIRECT_RENDERING'
index 67fec7968a97d56b8900cf0dbc01321f771184c6..b32e0126631c174ade347f679d18fad4ad0e87a5 100644 (file)
@@ -43,6 +43,7 @@ class PrintGlEnums(gl_XML.gl_print_base):
 
        def printRealHeader(self):
                print '#include "glheader.h"'
+               print '#include "mfeatures.h"'
                print '#include "enums.h"'
                print '#include "imports.h"'
                print ''
@@ -55,8 +56,6 @@ class PrintGlEnums(gl_XML.gl_print_base):
 
        def print_code(self):
                print """
-#define Elements(x) sizeof(x)/sizeof(*x)
-
 typedef int (*cfunc)(const void *, const void *);
 
 /**
index 9b5144a88b6a16a61dde005b491872e1a293f382..2b105d0f17ddda1cbf9b295901839fc70173d4ce 100644 (file)
@@ -61,6 +61,8 @@
 
 #endif
 
+#include "main/compiler.h"
+
 #include <stdlib.h>
 #include <string.h>
 #ifdef DEBUG
@@ -316,6 +318,14 @@ extern const GLubyte gl_dispatch_functions_start[];
 # endif
 #endif
 
+#ifdef USE_SPARC_ASM
+#ifdef GLX_USE_TLS
+extern unsigned int __glapi_sparc_tls_stub;
+#else
+extern unsigned int __glapi_sparc_pthread_stub;
+#endif
+#endif
+
 #if !defined(DISPATCH_FUNCTION_SIZE) && !defined(XFree86Server) && !defined(XGLServer)
 # define NEED_FUNCTION_POINTER
 #endif
@@ -342,6 +352,129 @@ init_glapi_relocs( void )
        curr_func += DISPATCH_FUNCTION_SIZE;
     }
 #endif
+#ifdef USE_SPARC_ASM
+    extern void __glapi_sparc_icache_flush(unsigned int *);
+    static const unsigned int template[] = {
+#ifdef GLX_USE_TLS
+       0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */
+       0x8730e00a, /* srl %g3, 10, %g3 */
+       0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */
+#ifdef __arch64__
+       0xc259c002, /* ldx [%g7 + %g2], %g1 */
+       0xc2584003, /* ldx [%g1 + %g3], %g1 */
+#else
+       0xc201c002, /* ld [%g7 + %g2], %g1 */
+       0xc2004003, /* ld [%g1 + %g3], %g1 */
+#endif
+       0x81c04000, /* jmp %g1 */
+       0x01000000, /* nop  */
+#else
+#ifdef __arch64__
+       0x03000000, /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */
+       0x05000000, /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */
+       0x82106000, /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */
+       0x8730e00a, /* 64-bit 0x0c --> srl %g3, 10, %g3 */
+       0x83287020, /* 64-bit 0x10 --> sllx %g1, 32, %g1 */
+       0x82004002, /* 64-bit 0x14 --> add %g1, %g2, %g1 */
+       0xc2586000, /* 64-bit 0x18 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */
+#else
+       0x03000000, /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */
+       0x8730e00a, /* 32-bit 0x04 --> srl %g3, 10, %g3 */
+       0xc2006000, /* 32-bit 0x08 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */
+#endif
+       0x80a06000, /*             --> cmp %g1, 0 */
+       0x02800005, /*             --> be +4*5 */
+       0x01000000, /*             -->  nop  */
+#ifdef __arch64__
+       0xc2584003, /* 64-bit      --> ldx [%g1 + %g3], %g1 */
+#else
+       0xc2004003, /* 32-bit      --> ld [%g1 + %g3], %g1 */
+#endif
+       0x81c04000, /*             --> jmp %g1 */
+       0x01000000, /*             --> nop  */
+#ifdef __arch64__
+       0x9de3bf80, /* 64-bit      --> save  %sp, -128, %sp */
+#else
+       0x9de3bfc0, /* 32-bit      --> save  %sp, -64, %sp */
+#endif
+       0xa0100003, /*             --> mov  %g3, %l0 */
+       0x40000000, /*             --> call _glapi_get_dispatch */
+       0x01000000, /*             -->  nop */
+       0x82100008, /*             --> mov %o0, %g1 */
+       0x86100010, /*             --> mov %l0, %g3 */
+       0x10bffff7, /*             --> ba -4*9 */
+       0x81e80000, /*             -->  restore  */
+#endif
+    };
+#ifdef GLX_USE_TLS
+    extern unsigned long __glapi_sparc_get_dispatch(void);
+    unsigned int *code = &__glapi_sparc_tls_stub;
+    unsigned long dispatch = __glapi_sparc_get_dispatch();
+#else
+    unsigned int *code = &__glapi_sparc_pthread_stub;
+    unsigned long dispatch = (unsigned long) &_glapi_Dispatch;
+    unsigned long call_dest = (unsigned long ) &_glapi_get_dispatch;
+    int idx;
+#endif
+
+#if defined(GLX_USE_TLS)
+    code[0] = template[0] | (dispatch >> 10);
+    code[1] = template[1];
+    __glapi_sparc_icache_flush(&code[0]);
+    code[2] = template[2] | (dispatch & 0x3ff);
+    code[3] = template[3];
+    __glapi_sparc_icache_flush(&code[2]);
+    code[4] = template[4];
+    code[5] = template[5];
+    __glapi_sparc_icache_flush(&code[4]);
+    code[6] = template[6];
+    __glapi_sparc_icache_flush(&code[6]);
+#else
+#if defined(__arch64__)
+    code[0] = template[0] | (dispatch >> (32 + 10));
+    code[1] = template[1] | ((dispatch & 0xffffffff) >> 10);
+    __glapi_sparc_icache_flush(&code[0]);
+    code[2] = template[2] | ((dispatch >> 32) & 0x3ff);
+    code[3] = template[3];
+    __glapi_sparc_icache_flush(&code[2]);
+    code[4] = template[4];
+    code[5] = template[5];
+    __glapi_sparc_icache_flush(&code[4]);
+    code[6] = template[6] | (dispatch & 0x3ff);
+    idx = 7;
+#else
+    code[0] = template[0] | (dispatch >> 10);
+    code[1] = template[1];
+    __glapi_sparc_icache_flush(&code[0]);
+    code[2] = template[2] | (dispatch & 0x3ff);
+    idx = 3;
+#endif
+    code[idx + 0] = template[idx + 0];
+    __glapi_sparc_icache_flush(&code[idx - 1]);
+    code[idx + 1] = template[idx + 1];
+    code[idx + 2] = template[idx + 2];
+    __glapi_sparc_icache_flush(&code[idx + 1]);
+    code[idx + 3] = template[idx + 3];
+    code[idx + 4] = template[idx + 4];
+    __glapi_sparc_icache_flush(&code[idx + 3]);
+    code[idx + 5] = template[idx + 5];
+    code[idx + 6] = template[idx + 6];
+    __glapi_sparc_icache_flush(&code[idx + 5]);
+    code[idx + 7] = template[idx + 7];
+    code[idx + 8] = template[idx + 8] |
+           (((call_dest - ((unsigned long) &code[idx + 8]))
+             >> 2) & 0x3fffffff);
+    __glapi_sparc_icache_flush(&code[idx + 7]);
+    code[idx + 9] = template[idx + 9];
+    code[idx + 10] = template[idx + 10];
+    __glapi_sparc_icache_flush(&code[idx + 9]);
+    code[idx + 11] = template[idx + 11];
+    code[idx + 12] = template[idx + 12];
+    __glapi_sparc_icache_flush(&code[idx + 11]);
+    code[idx + 13] = template[idx + 13];
+    __glapi_sparc_icache_flush(&code[idx + 13]);
+#endif
+#endif
 }
 #endif /* defined(PTHREADS) || defined(GLX_USE_TLS) */
 
index 6d40b495c7e71424d264bcba09d354c67e556a21..ed443c12c89f2e1f327f1973f09ff4a974f4ffac 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /**
- * \file glapi_getproc.
+ * \file glapi_getproc.c
  *
  * Code for implementing glXGetProcAddress(), etc.
  * This was originally in glapi.c but refactored out.
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "main/glheader.h"
+#include "main/compiler.h"
 #include "glapi.h"
 #include "glapioffsets.h"
 #include "glapitable.h"
@@ -87,7 +88,13 @@ find_entry( const char * n )
    GLuint i;
    for (i = 0; static_functions[i].Name_offset >= 0; i++) {
       const char *testName = gl_string_table + static_functions[i].Name_offset;
-      if (strcmp(testName, n) == 0) {
+#ifdef MANGLE
+      /* skip the "m" prefix on the name */
+      if (strcmp(testName, n + 1) == 0)
+#else
+      if (strcmp(testName, n) == 0)
+#endif
+      {
         return &static_functions[i];
       }
    }
@@ -252,53 +259,30 @@ generate_entrypoint(GLuint functionOffset)
    }
 
    return (_glapi_proc) code;
-#elif defined(USE_SPARC_ASM)
-
-#ifdef __arch64__
-   static const unsigned int insn_template[] = {
-          0x05000000,  /* sethi        %uhi(_glapi_Dispatch), %g2      */
-          0x03000000,  /* sethi        %hi(_glapi_Dispatch), %g1       */
-          0x8410a000,  /* or           %g2, %ulo(_glapi_Dispatch), %g2 */
-          0x82106000,  /* or           %g1, %lo(_glapi_Dispatch), %g1  */
-          0x8528b020,  /* sllx         %g2, 32, %g2                    */
-          0xc2584002,  /* ldx          [%g1 + %g2], %g1                */
-          0x05000000,  /* sethi        %hi(8 * glapioffset), %g2       */
-          0x8410a000,  /* or           %g2, %lo(8 * glapioffset), %g2  */
-          0xc6584002,  /* ldx          [%g1 + %g2], %g3                */
-          0x81c0c000,  /* jmpl         %g3, %g0                        */
-          0x01000000   /*  nop                                         */
+#elif defined(USE_SPARC_ASM) && (defined(PTHREADS) || defined(GLX_USE_TLS))
+   static const unsigned int template[] = {
+      0x07000000, /* sethi %hi(0), %g3 */
+      0x8210000f, /* mov  %o7, %g1 */
+      0x40000000, /* call */
+      0x9e100001, /* mov  %g1, %o7 */
    };
+#ifdef GLX_USE_TLS
+   extern unsigned int __glapi_sparc_tls_stub;
+   unsigned long call_dest = (unsigned long ) &__glapi_sparc_tls_stub;
 #else
-   static const unsigned int insn_template[] = {
-          0x03000000,  /* sethi        %hi(_glapi_Dispatch), %g1         */
-          0xc2006000,  /* ld           [%g1 + %lo(_glapi_Dispatch)], %g1 */
-          0xc6006000,  /* ld           [%g1 + %lo(4*glapioffset)], %g3   */
-          0x81c0c000,  /* jmpl         %g3, %g0                          */
-          0x01000000   /*  nop                                           */
-   };
-#endif /* __arch64__ */
-   unsigned int *code = (unsigned int *) malloc(sizeof(insn_template));
-   unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch;
+   extern unsigned int __glapi_sparc_pthread_stub;
+   unsigned long call_dest = (unsigned long ) &__glapi_sparc_pthread_stub;
+#endif
+   unsigned int *code = (unsigned int *) malloc(sizeof(template));
    if (code) {
-      memcpy(code, insn_template, sizeof(insn_template));
-
-#ifdef __arch64__
-      code[0] |= (glapi_addr >> (32 + 10));
-      code[1] |= ((glapi_addr & 0xffffffff) >> 10);
-      __glapi_sparc_icache_flush(&code[0]);
-      code[2] |= ((glapi_addr >> 32) & ((1 << 10) - 1));
-      code[3] |= (glapi_addr & ((1 << 10) - 1));
-      __glapi_sparc_icache_flush(&code[2]);
-      code[6] |= ((functionOffset * 8) >> 10);
-      code[7] |= ((functionOffset * 8) & ((1 << 10) - 1));
-      __glapi_sparc_icache_flush(&code[6]);
-#else
-      code[0] |= (glapi_addr >> 10);
-      code[1] |= (glapi_addr & ((1 << 10) - 1));
+      code[0] = template[0] | (functionOffset & 0x3fffff);
+      code[1] = template[1];
       __glapi_sparc_icache_flush(&code[0]);
-      code[2] |= (functionOffset * 4);
+      code[2] = template[2] |
+         (((call_dest - ((unsigned long) &code[2]))
+          >> 2) & 0x3fffffff);
+      code[3] = template[3];
       __glapi_sparc_icache_flush(&code[2]);
-#endif /* __arch64__ */
    }
    return (_glapi_proc) code;
 #else
@@ -330,21 +314,10 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
 #endif
 
 #elif defined(USE_SPARC_ASM)
-
-   /* XXX this hasn't been tested! */
    unsigned int *code = (unsigned int *) entrypoint;
-#ifdef __arch64__
-   code[6] = 0x05000000;  /* sethi     %hi(8 * glapioffset), %g2       */
-   code[7] = 0x8410a000;  /* or                %g2, %lo(8 * glapioffset), %g2  */
-   code[6] |= ((offset * 8) >> 10);
-   code[7] |= ((offset * 8) & ((1 << 10) - 1));
-   __glapi_sparc_icache_flush(&code[6]);
-#else /* __arch64__ */
-   code[2] = 0xc6006000;  /* ld                [%g1 + %lo(4*glapioffset)], %g3   */
-   code[2] |= (offset * 4);
-   __glapi_sparc_icache_flush(&code[2]);
-#endif /* __arch64__ */
-
+   code[0] &= ~0x3fffff;
+   code[0] |= (offset * sizeof(void *)) & 0x3fffff;
+   __glapi_sparc_icache_flush(&code[0]);
 #else
 
    /* an unimplemented architecture */
index f412234ac5f578c586c066310fef5282871f21c3..14f305f0256290c8cdffa146044c0a83e5702795 100644 (file)
 #define _gloffset_VertexAttribs4fvNV 715
 #define _gloffset_VertexAttribs4svNV 716
 #define _gloffset_VertexAttribs4ubvNV 717
-#define _gloffset_AlphaFragmentOp1ATI 718
-#define _gloffset_AlphaFragmentOp2ATI 719
-#define _gloffset_AlphaFragmentOp3ATI 720
-#define _gloffset_BeginFragmentShaderATI 721
-#define _gloffset_BindFragmentShaderATI 722
-#define _gloffset_ColorFragmentOp1ATI 723
-#define _gloffset_ColorFragmentOp2ATI 724
-#define _gloffset_ColorFragmentOp3ATI 725
-#define _gloffset_DeleteFragmentShaderATI 726
-#define _gloffset_EndFragmentShaderATI 727
-#define _gloffset_GenFragmentShadersATI 728
-#define _gloffset_PassTexCoordATI 729
-#define _gloffset_SampleMapATI 730
-#define _gloffset_SetFragmentShaderConstantATI 731
-#define _gloffset_PointParameteriNV 732
-#define _gloffset_PointParameterivNV 733
-#define _gloffset_ActiveStencilFaceEXT 734
-#define _gloffset_BindVertexArrayAPPLE 735
-#define _gloffset_DeleteVertexArraysAPPLE 736
-#define _gloffset_GenVertexArraysAPPLE 737
-#define _gloffset_IsVertexArrayAPPLE 738
-#define _gloffset_GetProgramNamedParameterdvNV 739
-#define _gloffset_GetProgramNamedParameterfvNV 740
-#define _gloffset_ProgramNamedParameter4dNV 741
-#define _gloffset_ProgramNamedParameter4dvNV 742
-#define _gloffset_ProgramNamedParameter4fNV 743
-#define _gloffset_ProgramNamedParameter4fvNV 744
-#define _gloffset_DepthBoundsEXT 745
-#define _gloffset_BlendEquationSeparateEXT 746
-#define _gloffset_BindFramebufferEXT 747
-#define _gloffset_BindRenderbufferEXT 748
-#define _gloffset_CheckFramebufferStatusEXT 749
-#define _gloffset_DeleteFramebuffersEXT 750
-#define _gloffset_DeleteRenderbuffersEXT 751
-#define _gloffset_FramebufferRenderbufferEXT 752
-#define _gloffset_FramebufferTexture1DEXT 753
-#define _gloffset_FramebufferTexture2DEXT 754
-#define _gloffset_FramebufferTexture3DEXT 755
-#define _gloffset_GenFramebuffersEXT 756
-#define _gloffset_GenRenderbuffersEXT 757
-#define _gloffset_GenerateMipmapEXT 758
-#define _gloffset_GetFramebufferAttachmentParameterivEXT 759
-#define _gloffset_GetRenderbufferParameterivEXT 760
-#define _gloffset_IsFramebufferEXT 761
-#define _gloffset_IsRenderbufferEXT 762
-#define _gloffset_RenderbufferStorageEXT 763
-#define _gloffset_BlitFramebufferEXT 764
-#define _gloffset_FramebufferTextureLayerEXT 765
-#define _gloffset_StencilFuncSeparateATI 766
-#define _gloffset_ProgramEnvParameters4fvEXT 767
-#define _gloffset_ProgramLocalParameters4fvEXT 768
-#define _gloffset_GetQueryObjecti64vEXT 769
-#define _gloffset_GetQueryObjectui64vEXT 770
-#define _gloffset_FIRST_DYNAMIC 771
+#define _gloffset_GetTexBumpParameterfvATI 718
+#define _gloffset_GetTexBumpParameterivATI 719
+#define _gloffset_TexBumpParameterfvATI 720
+#define _gloffset_TexBumpParameterivATI 721
+#define _gloffset_AlphaFragmentOp1ATI 722
+#define _gloffset_AlphaFragmentOp2ATI 723
+#define _gloffset_AlphaFragmentOp3ATI 724
+#define _gloffset_BeginFragmentShaderATI 725
+#define _gloffset_BindFragmentShaderATI 726
+#define _gloffset_ColorFragmentOp1ATI 727
+#define _gloffset_ColorFragmentOp2ATI 728
+#define _gloffset_ColorFragmentOp3ATI 729
+#define _gloffset_DeleteFragmentShaderATI 730
+#define _gloffset_EndFragmentShaderATI 731
+#define _gloffset_GenFragmentShadersATI 732
+#define _gloffset_PassTexCoordATI 733
+#define _gloffset_SampleMapATI 734
+#define _gloffset_SetFragmentShaderConstantATI 735
+#define _gloffset_PointParameteriNV 736
+#define _gloffset_PointParameterivNV 737
+#define _gloffset_ActiveStencilFaceEXT 738
+#define _gloffset_BindVertexArrayAPPLE 739
+#define _gloffset_DeleteVertexArraysAPPLE 740
+#define _gloffset_GenVertexArraysAPPLE 741
+#define _gloffset_IsVertexArrayAPPLE 742
+#define _gloffset_GetProgramNamedParameterdvNV 743
+#define _gloffset_GetProgramNamedParameterfvNV 744
+#define _gloffset_ProgramNamedParameter4dNV 745
+#define _gloffset_ProgramNamedParameter4dvNV 746
+#define _gloffset_ProgramNamedParameter4fNV 747
+#define _gloffset_ProgramNamedParameter4fvNV 748
+#define _gloffset_DepthBoundsEXT 749
+#define _gloffset_BlendEquationSeparateEXT 750
+#define _gloffset_BindFramebufferEXT 751
+#define _gloffset_BindRenderbufferEXT 752
+#define _gloffset_CheckFramebufferStatusEXT 753
+#define _gloffset_DeleteFramebuffersEXT 754
+#define _gloffset_DeleteRenderbuffersEXT 755
+#define _gloffset_FramebufferRenderbufferEXT 756
+#define _gloffset_FramebufferTexture1DEXT 757
+#define _gloffset_FramebufferTexture2DEXT 758
+#define _gloffset_FramebufferTexture3DEXT 759
+#define _gloffset_GenFramebuffersEXT 760
+#define _gloffset_GenRenderbuffersEXT 761
+#define _gloffset_GenerateMipmapEXT 762
+#define _gloffset_GetFramebufferAttachmentParameterivEXT 763
+#define _gloffset_GetRenderbufferParameterivEXT 764
+#define _gloffset_IsFramebufferEXT 765
+#define _gloffset_IsRenderbufferEXT 766
+#define _gloffset_RenderbufferStorageEXT 767
+#define _gloffset_BlitFramebufferEXT 768
+#define _gloffset_FramebufferTextureLayerEXT 769
+#define _gloffset_StencilFuncSeparateATI 770
+#define _gloffset_ProgramEnvParameters4fvEXT 771
+#define _gloffset_ProgramLocalParameters4fvEXT 772
+#define _gloffset_GetQueryObjecti64vEXT 773
+#define _gloffset_GetQueryObjectui64vEXT 774
+#define _gloffset_FIRST_DYNAMIC 775
 
 #else
 
 #define _gloffset_VertexAttribs4fvNV driDispatchRemapTable[VertexAttribs4fvNV_remap_index]
 #define _gloffset_VertexAttribs4svNV driDispatchRemapTable[VertexAttribs4svNV_remap_index]
 #define _gloffset_VertexAttribs4ubvNV driDispatchRemapTable[VertexAttribs4ubvNV_remap_index]
+#define _gloffset_GetTexBumpParameterfvATI driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index]
+#define _gloffset_GetTexBumpParameterivATI driDispatchRemapTable[GetTexBumpParameterivATI_remap_index]
+#define _gloffset_TexBumpParameterfvATI driDispatchRemapTable[TexBumpParameterfvATI_remap_index]
+#define _gloffset_TexBumpParameterivATI driDispatchRemapTable[TexBumpParameterivATI_remap_index]
 #define _gloffset_AlphaFragmentOp1ATI driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index]
 #define _gloffset_AlphaFragmentOp2ATI driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index]
 #define _gloffset_AlphaFragmentOp3ATI driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index]
index 2ae9bf6738cdd835cdb9807eb83b1423626ec2f8..9ecb0364614a24ae2f5285b2595da560fe19e223 100644 (file)
@@ -758,59 +758,63 @@ struct _glapi_table
    void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 715 */
    void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 716 */
    void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 717 */
-   void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 718 */
-   void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 719 */
-   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); /* 720 */
-   void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 721 */
-   void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 722 */
-   void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 723 */
-   void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 724 */
-   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); /* 725 */
-   void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 726 */
-   void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 727 */
-   GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 728 */
-   void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 729 */
-   void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 730 */
-   void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 731 */
-   void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 732 */
-   void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 733 */
-   void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 734 */
-   void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 735 */
-   void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 736 */
-   void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 737 */
-   GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 738 */
-   void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 739 */
-   void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 740 */
-   void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 741 */
-   void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 742 */
-   void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 743 */
-   void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 744 */
-   void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 745 */
-   void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 746 */
-   void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 747 */
-   void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 748 */
-   GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 749 */
-   void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 750 */
-   void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 751 */
-   void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 752 */
-   void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 753 */
-   void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 754 */
-   void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 755 */
-   void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 756 */
-   void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 757 */
-   void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 758 */
-   void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 759 */
-   void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 760 */
-   GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 761 */
-   GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 762 */
-   void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 763 */
-   void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 764 */
-   void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 765 */
-   void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 766 */
-   void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 767 */
-   void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 768 */
-   void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 769 */
-   void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 770 */
+   void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 718 */
+   void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 719 */
+   void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 720 */
+   void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 721 */
+   void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 722 */
+   void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 723 */
+   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); /* 724 */
+   void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 725 */
+   void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 726 */
+   void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 727 */
+   void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 728 */
+   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); /* 729 */
+   void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 730 */
+   void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 731 */
+   GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 732 */
+   void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 733 */
+   void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 734 */
+   void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 735 */
+   void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 736 */
+   void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 737 */
+   void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 738 */
+   void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 739 */
+   void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 740 */
+   void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 741 */
+   GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 742 */
+   void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 743 */
+   void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 744 */
+   void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 745 */
+   void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 746 */
+   void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 747 */
+   void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 748 */
+   void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 749 */
+   void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 750 */
+   void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 751 */
+   void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 752 */
+   GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 753 */
+   void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 754 */
+   void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 755 */
+   void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 756 */
+   void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 757 */
+   void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 758 */
+   void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 759 */
+   void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 760 */
+   void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 761 */
+   void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 762 */
+   void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 763 */
+   void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 764 */
+   GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 765 */
+   GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 766 */
+   void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 767 */
+   void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 768 */
+   void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 769 */
+   void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 770 */
+   void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 771 */
+   void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 772 */
+   void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 773 */
+   void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 774 */
 };
 
 #endif /* !defined( _GLAPI_TABLE_H_ ) */
index 960d70e0812c4157ea0c0f21beb5c2ec008c237c..7ccd9707c3694c46aa46b73263a230c10ae0ac54 100644 (file)
@@ -5187,6 +5187,26 @@ KEYWORD1 void KEYWORD2 NAME(VertexAttribs4ubvNV)(GLuint index, GLsizei n, const
    DISPATCH(VertexAttribs4ubvNV, (index, n, v), (F, "glVertexAttribs4ubvNV(%d, %d, %p);\n", index, n, (const void *) v));
 }
 
+KEYWORD1 void KEYWORD2 NAME(GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param)
+{
+   DISPATCH(GetTexBumpParameterfvATI, (pname, param), (F, "glGetTexBumpParameterfvATI(0x%x, %p);\n", pname, (const void *) param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTexBumpParameterivATI)(GLenum pname, GLint * param)
+{
+   DISPATCH(GetTexBumpParameterivATI, (pname, param), (F, "glGetTexBumpParameterivATI(0x%x, %p);\n", pname, (const void *) param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexBumpParameterfvATI)(GLenum pname, const GLfloat * param)
+{
+   DISPATCH(TexBumpParameterfvATI, (pname, param), (F, "glTexBumpParameterfvATI(0x%x, %p);\n", pname, (const void *) param));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TexBumpParameterivATI)(GLenum pname, const GLint * param)
+{
+   DISPATCH(TexBumpParameterivATI, (pname, param), (F, "glTexBumpParameterivATI(0x%x, %p);\n", pname, (const void *) param));
+}
+
 KEYWORD1 void KEYWORD2 NAME(AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod)
 {
    DISPATCH(AlphaFragmentOp1ATI, (op, dst, dstMod, arg1, arg1Rep, arg1Mod), (F, "glAlphaFragmentOp1ATI(0x%x, %d, %d, %d, %d, %d);\n", op, dst, dstMod, arg1, arg1Rep, arg1Mod));
@@ -5277,37 +5297,37 @@ 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_734)(GLenum face);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_738)(GLenum face);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_734)(GLenum face)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_738)(GLenum face)
 {
    DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_735)(GLuint array);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_739)(GLuint array);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_735)(GLuint array)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_739)(GLuint array)
 {
    DISPATCH(BindVertexArrayAPPLE, (array), (F, "glBindVertexArrayAPPLE(%d);\n", array));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_736)(GLsizei n, const GLuint * arrays);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_740)(GLsizei n, const GLuint * arrays);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_736)(GLsizei n, const GLuint * arrays)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_740)(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_737)(GLsizei n, GLuint * arrays);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_741)(GLsizei n, GLuint * arrays);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_737)(GLsizei n, GLuint * arrays)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_741)(GLsizei n, GLuint * arrays)
 {
    DISPATCH(GenVertexArraysAPPLE, (n, arrays), (F, "glGenVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays));
 }
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_738)(GLuint array);
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_742)(GLuint array);
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_738)(GLuint array)
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_742)(GLuint array)
 {
    RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArrayAPPLE(%d);\n", array));
 }
@@ -5342,9 +5362,9 @@ KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4fvNV)(GLuint id, GLsizei len,
    DISPATCH(ProgramNamedParameter4fvNV, (id, len, name, v), (F, "glProgramNamedParameter4fvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) v));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_745)(GLclampd zmin, GLclampd zmax);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_749)(GLclampd zmin, GLclampd zmax);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_745)(GLclampd zmin, GLclampd zmax)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_749)(GLclampd zmin, GLclampd zmax)
 {
    DISPATCH(DepthBoundsEXT, (zmin, zmax), (F, "glDepthBoundsEXT(%f, %f);\n", zmin, zmax));
 }
@@ -5354,9 +5374,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_746)(GLenum modeRGB, GLenum modeA);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_750)(GLenum modeRGB, GLenum modeA);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_746)(GLenum modeRGB, GLenum modeA)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_750)(GLenum modeRGB, GLenum modeA)
 {
    DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateEXT(0x%x, 0x%x);\n", modeRGB, modeA));
 }
@@ -5536,9 +5556,9 @@ 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_764)(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_768)(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_764)(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_768)(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));
 }
@@ -5553,37 +5573,37 @@ KEYWORD1 void KEYWORD2 NAME(FramebufferTextureLayerEXT)(GLenum target, GLenum at
    DISPATCH(FramebufferTextureLayerEXT, (target, attachment, texture, level, layer), (F, "glFramebufferTextureLayerEXT(0x%x, 0x%x, %d, %d, %d);\n", target, attachment, texture, level, layer));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_766)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_766)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(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_767)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_767)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(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_768)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(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_769)(GLuint id, GLenum pname, GLint64EXT * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLint64EXT * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLuint id, GLenum pname, GLint64EXT * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(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_770)(GLuint id, GLenum pname, GLuint64EXT * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLuint id, GLenum pname, GLuint64EXT * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params)
 {
    DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params));
 }
@@ -6320,6 +6340,10 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(VertexAttribs4fvNV),
    TABLE_ENTRY(VertexAttribs4svNV),
    TABLE_ENTRY(VertexAttribs4ubvNV),
+   TABLE_ENTRY(GetTexBumpParameterfvATI),
+   TABLE_ENTRY(GetTexBumpParameterivATI),
+   TABLE_ENTRY(TexBumpParameterfvATI),
+   TABLE_ENTRY(TexBumpParameterivATI),
    TABLE_ENTRY(AlphaFragmentOp1ATI),
    TABLE_ENTRY(AlphaFragmentOp2ATI),
    TABLE_ENTRY(AlphaFragmentOp3ATI),
@@ -6336,19 +6360,19 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(SetFragmentShaderConstantATI),
    TABLE_ENTRY(PointParameteriNV),
    TABLE_ENTRY(PointParameterivNV),
-   TABLE_ENTRY(_dispatch_stub_734),
-   TABLE_ENTRY(_dispatch_stub_735),
-   TABLE_ENTRY(_dispatch_stub_736),
-   TABLE_ENTRY(_dispatch_stub_737),
    TABLE_ENTRY(_dispatch_stub_738),
+   TABLE_ENTRY(_dispatch_stub_739),
+   TABLE_ENTRY(_dispatch_stub_740),
+   TABLE_ENTRY(_dispatch_stub_741),
+   TABLE_ENTRY(_dispatch_stub_742),
    TABLE_ENTRY(GetProgramNamedParameterdvNV),
    TABLE_ENTRY(GetProgramNamedParameterfvNV),
    TABLE_ENTRY(ProgramNamedParameter4dNV),
    TABLE_ENTRY(ProgramNamedParameter4dvNV),
    TABLE_ENTRY(ProgramNamedParameter4fNV),
    TABLE_ENTRY(ProgramNamedParameter4fvNV),
-   TABLE_ENTRY(_dispatch_stub_745),
-   TABLE_ENTRY(_dispatch_stub_746),
+   TABLE_ENTRY(_dispatch_stub_749),
+   TABLE_ENTRY(_dispatch_stub_750),
    TABLE_ENTRY(BindFramebufferEXT),
    TABLE_ENTRY(BindRenderbufferEXT),
    TABLE_ENTRY(CheckFramebufferStatusEXT),
@@ -6366,13 +6390,13 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(IsFramebufferEXT),
    TABLE_ENTRY(IsRenderbufferEXT),
    TABLE_ENTRY(RenderbufferStorageEXT),
-   TABLE_ENTRY(_dispatch_stub_764),
-   TABLE_ENTRY(FramebufferTextureLayerEXT),
-   TABLE_ENTRY(_dispatch_stub_766),
-   TABLE_ENTRY(_dispatch_stub_767),
    TABLE_ENTRY(_dispatch_stub_768),
-   TABLE_ENTRY(_dispatch_stub_769),
+   TABLE_ENTRY(FramebufferTextureLayerEXT),
    TABLE_ENTRY(_dispatch_stub_770),
+   TABLE_ENTRY(_dispatch_stub_771),
+   TABLE_ENTRY(_dispatch_stub_772),
+   TABLE_ENTRY(_dispatch_stub_773),
+   TABLE_ENTRY(_dispatch_stub_774),
    /* A whole bunch of no-op functions.  These might be called
     * when someone tries to call a dynamically-registered
     * extension function without a current rendering context.
index ba652bc3c6ef70e101a2b2d4bd57d9c631e20482..021a64efcd945b4fec21f7b40f1be85cf558e996 100644 (file)
@@ -770,6 +770,10 @@ static const char gl_string_table[] =
     "glVertexAttribs4fvNV\0"
     "glVertexAttribs4svNV\0"
     "glVertexAttribs4ubvNV\0"
+    "glGetTexBumpParameterfvATI\0"
+    "glGetTexBumpParameterivATI\0"
+    "glTexBumpParameterfvATI\0"
+    "glTexBumpParameterivATI\0"
     "glAlphaFragmentOp1ATI\0"
     "glAlphaFragmentOp2ATI\0"
     "glAlphaFragmentOp3ATI\0"
@@ -1158,19 +1162,19 @@ static const char gl_string_table[] =
 #define gl_dispatch_stub_655 mgl_dispatch_stub_655
 #define gl_dispatch_stub_656 mgl_dispatch_stub_656
 #define gl_dispatch_stub_657 mgl_dispatch_stub_657
-#define gl_dispatch_stub_734 mgl_dispatch_stub_734
-#define gl_dispatch_stub_735 mgl_dispatch_stub_735
-#define gl_dispatch_stub_736 mgl_dispatch_stub_736
-#define gl_dispatch_stub_737 mgl_dispatch_stub_737
 #define gl_dispatch_stub_738 mgl_dispatch_stub_738
-#define gl_dispatch_stub_745 mgl_dispatch_stub_745
-#define gl_dispatch_stub_746 mgl_dispatch_stub_746
-#define gl_dispatch_stub_764 mgl_dispatch_stub_764
-#define gl_dispatch_stub_766 mgl_dispatch_stub_766
-#define gl_dispatch_stub_767 mgl_dispatch_stub_767
+#define gl_dispatch_stub_739 mgl_dispatch_stub_739
+#define gl_dispatch_stub_740 mgl_dispatch_stub_740
+#define gl_dispatch_stub_741 mgl_dispatch_stub_741
+#define gl_dispatch_stub_742 mgl_dispatch_stub_742
+#define gl_dispatch_stub_749 mgl_dispatch_stub_749
+#define gl_dispatch_stub_750 mgl_dispatch_stub_750
 #define gl_dispatch_stub_768 mgl_dispatch_stub_768
-#define gl_dispatch_stub_769 mgl_dispatch_stub_769
 #define gl_dispatch_stub_770 mgl_dispatch_stub_770
+#define gl_dispatch_stub_771 mgl_dispatch_stub_771
+#define gl_dispatch_stub_772 mgl_dispatch_stub_772
+#define gl_dispatch_stub_773 mgl_dispatch_stub_773
+#define gl_dispatch_stub_774 mgl_dispatch_stub_774
 #endif /* USE_MGL_NAMESPACE */
 
 
@@ -1209,19 +1213,19 @@ extern void gl_dispatch_stub_654(void);
 extern void gl_dispatch_stub_655(void);
 extern void gl_dispatch_stub_656(void);
 extern void gl_dispatch_stub_657(void);
-extern void gl_dispatch_stub_734(void);
-extern void gl_dispatch_stub_735(void);
-extern void gl_dispatch_stub_736(void);
-extern void gl_dispatch_stub_737(void);
 extern void gl_dispatch_stub_738(void);
-extern void gl_dispatch_stub_745(void);
-extern void gl_dispatch_stub_746(void);
-extern void gl_dispatch_stub_764(void);
-extern void gl_dispatch_stub_766(void);
-extern void gl_dispatch_stub_767(void);
+extern void gl_dispatch_stub_739(void);
+extern void gl_dispatch_stub_740(void);
+extern void gl_dispatch_stub_741(void);
+extern void gl_dispatch_stub_742(void);
+extern void gl_dispatch_stub_749(void);
+extern void gl_dispatch_stub_750(void);
 extern void gl_dispatch_stub_768(void);
-extern void gl_dispatch_stub_769(void);
 extern void gl_dispatch_stub_770(void);
+extern void gl_dispatch_stub_771(void);
+extern void gl_dispatch_stub_772(void);
+extern void gl_dispatch_stub_773(void);
+extern void gl_dispatch_stub_774(void);
 #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */
 
 static const glprocs_table_t static_functions[] = {
@@ -1943,357 +1947,361 @@ static const glprocs_table_t static_functions[] = {
     NAME_FUNC_OFFSET(12202, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, _gloffset_VertexAttribs4fvNV),
     NAME_FUNC_OFFSET(12223, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, _gloffset_VertexAttribs4svNV),
     NAME_FUNC_OFFSET(12244, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, _gloffset_VertexAttribs4ubvNV),
-    NAME_FUNC_OFFSET(12266, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, _gloffset_AlphaFragmentOp1ATI),
-    NAME_FUNC_OFFSET(12288, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, _gloffset_AlphaFragmentOp2ATI),
-    NAME_FUNC_OFFSET(12310, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, _gloffset_AlphaFragmentOp3ATI),
-    NAME_FUNC_OFFSET(12332, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, _gloffset_BeginFragmentShaderATI),
-    NAME_FUNC_OFFSET(12357, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, _gloffset_BindFragmentShaderATI),
-    NAME_FUNC_OFFSET(12381, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, _gloffset_ColorFragmentOp1ATI),
-    NAME_FUNC_OFFSET(12403, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, _gloffset_ColorFragmentOp2ATI),
-    NAME_FUNC_OFFSET(12425, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, _gloffset_ColorFragmentOp3ATI),
-    NAME_FUNC_OFFSET(12447, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, _gloffset_DeleteFragmentShaderATI),
-    NAME_FUNC_OFFSET(12473, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, _gloffset_EndFragmentShaderATI),
-    NAME_FUNC_OFFSET(12496, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, _gloffset_GenFragmentShadersATI),
-    NAME_FUNC_OFFSET(12520, glPassTexCoordATI, glPassTexCoordATI, NULL, _gloffset_PassTexCoordATI),
-    NAME_FUNC_OFFSET(12538, glSampleMapATI, glSampleMapATI, NULL, _gloffset_SampleMapATI),
-    NAME_FUNC_OFFSET(12553, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, _gloffset_SetFragmentShaderConstantATI),
-    NAME_FUNC_OFFSET(12584, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV),
-    NAME_FUNC_OFFSET(12604, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV),
-    NAME_FUNC_OFFSET(12625, gl_dispatch_stub_734, gl_dispatch_stub_734, NULL, _gloffset_ActiveStencilFaceEXT),
-    NAME_FUNC_OFFSET(12648, gl_dispatch_stub_735, gl_dispatch_stub_735, NULL, _gloffset_BindVertexArrayAPPLE),
-    NAME_FUNC_OFFSET(12671, gl_dispatch_stub_736, gl_dispatch_stub_736, NULL, _gloffset_DeleteVertexArraysAPPLE),
-    NAME_FUNC_OFFSET(12697, gl_dispatch_stub_737, gl_dispatch_stub_737, NULL, _gloffset_GenVertexArraysAPPLE),
-    NAME_FUNC_OFFSET(12720, gl_dispatch_stub_738, gl_dispatch_stub_738, NULL, _gloffset_IsVertexArrayAPPLE),
-    NAME_FUNC_OFFSET(12741, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, _gloffset_GetProgramNamedParameterdvNV),
-    NAME_FUNC_OFFSET(12772, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, _gloffset_GetProgramNamedParameterfvNV),
-    NAME_FUNC_OFFSET(12803, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, _gloffset_ProgramNamedParameter4dNV),
-    NAME_FUNC_OFFSET(12831, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, _gloffset_ProgramNamedParameter4dvNV),
-    NAME_FUNC_OFFSET(12860, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, _gloffset_ProgramNamedParameter4fNV),
-    NAME_FUNC_OFFSET(12888, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, _gloffset_ProgramNamedParameter4fvNV),
-    NAME_FUNC_OFFSET(12917, gl_dispatch_stub_745, gl_dispatch_stub_745, NULL, _gloffset_DepthBoundsEXT),
-    NAME_FUNC_OFFSET(12934, gl_dispatch_stub_746, gl_dispatch_stub_746, NULL, _gloffset_BlendEquationSeparateEXT),
-    NAME_FUNC_OFFSET(12961, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT),
-    NAME_FUNC_OFFSET(12982, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT),
-    NAME_FUNC_OFFSET(13004, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT),
-    NAME_FUNC_OFFSET(13032, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT),
-    NAME_FUNC_OFFSET(13056, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT),
-    NAME_FUNC_OFFSET(13081, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT),
-    NAME_FUNC_OFFSET(13110, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT),
-    NAME_FUNC_OFFSET(13136, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT),
-    NAME_FUNC_OFFSET(13162, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT),
-    NAME_FUNC_OFFSET(13188, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT),
-    NAME_FUNC_OFFSET(13209, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT),
-    NAME_FUNC_OFFSET(13231, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT),
-    NAME_FUNC_OFFSET(13251, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT),
-    NAME_FUNC_OFFSET(13292, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT),
-    NAME_FUNC_OFFSET(13324, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT),
-    NAME_FUNC_OFFSET(13343, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT),
-    NAME_FUNC_OFFSET(13363, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT),
-    NAME_FUNC_OFFSET(13388, gl_dispatch_stub_764, gl_dispatch_stub_764, NULL, _gloffset_BlitFramebufferEXT),
-    NAME_FUNC_OFFSET(13409, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT),
-    NAME_FUNC_OFFSET(13438, gl_dispatch_stub_766, gl_dispatch_stub_766, NULL, _gloffset_StencilFuncSeparateATI),
-    NAME_FUNC_OFFSET(13463, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_ProgramEnvParameters4fvEXT),
-    NAME_FUNC_OFFSET(13492, gl_dispatch_stub_768, gl_dispatch_stub_768, NULL, _gloffset_ProgramLocalParameters4fvEXT),
-    NAME_FUNC_OFFSET(13523, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_GetQueryObjecti64vEXT),
-    NAME_FUNC_OFFSET(13547, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_GetQueryObjectui64vEXT),
-    NAME_FUNC_OFFSET(13572, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement),
-    NAME_FUNC_OFFSET(13590, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture),
-    NAME_FUNC_OFFSET(13607, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays),
-    NAME_FUNC_OFFSET(13623, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident),
-    NAME_FUNC_OFFSET(13648, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D),
-    NAME_FUNC_OFFSET(13668, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D),
-    NAME_FUNC_OFFSET(13688, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D),
-    NAME_FUNC_OFFSET(13711, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D),
-    NAME_FUNC_OFFSET(13734, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures),
-    NAME_FUNC_OFFSET(13754, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures),
-    NAME_FUNC_OFFSET(13771, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv),
-    NAME_FUNC_OFFSET(13788, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture),
-    NAME_FUNC_OFFSET(13803, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures),
-    NAME_FUNC_OFFSET(13827, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D),
-    NAME_FUNC_OFFSET(13846, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D),
-    NAME_FUNC_OFFSET(13865, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor),
-    NAME_FUNC_OFFSET(13881, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation),
-    NAME_FUNC_OFFSET(13900, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements),
-    NAME_FUNC_OFFSET(13923, glColorTable, glColorTable, NULL, _gloffset_ColorTable),
-    NAME_FUNC_OFFSET(13939, glColorTable, glColorTable, NULL, _gloffset_ColorTable),
-    NAME_FUNC_OFFSET(13955, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv),
-    NAME_FUNC_OFFSET(13982, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv),
-    NAME_FUNC_OFFSET(14009, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable),
-    NAME_FUNC_OFFSET(14029, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable),
-    NAME_FUNC_OFFSET(14048, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable),
-    NAME_FUNC_OFFSET(14067, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv),
-    NAME_FUNC_OFFSET(14097, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv),
-    NAME_FUNC_OFFSET(14127, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv),
-    NAME_FUNC_OFFSET(14157, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv),
-    NAME_FUNC_OFFSET(14187, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable),
-    NAME_FUNC_OFFSET(14206, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable),
-    NAME_FUNC_OFFSET(14229, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D),
-    NAME_FUNC_OFFSET(14254, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D),
-    NAME_FUNC_OFFSET(14279, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf),
-    NAME_FUNC_OFFSET(14306, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv),
-    NAME_FUNC_OFFSET(14334, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri),
-    NAME_FUNC_OFFSET(14361, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv),
-    NAME_FUNC_OFFSET(14389, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D),
-    NAME_FUNC_OFFSET(14418, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D),
-    NAME_FUNC_OFFSET(14447, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter),
-    NAME_FUNC_OFFSET(14473, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv),
-    NAME_FUNC_OFFSET(14504, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv),
-    NAME_FUNC_OFFSET(14535, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter),
-    NAME_FUNC_OFFSET(14559, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D),
-    NAME_FUNC_OFFSET(14582, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram),
-    NAME_FUNC_OFFSET(14600, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv),
-    NAME_FUNC_OFFSET(14629, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv),
-    NAME_FUNC_OFFSET(14658, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax),
-    NAME_FUNC_OFFSET(14673, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv),
-    NAME_FUNC_OFFSET(14699, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv),
-    NAME_FUNC_OFFSET(14725, glHistogram, glHistogram, NULL, _gloffset_Histogram),
-    NAME_FUNC_OFFSET(14740, glMinmax, glMinmax, NULL, _gloffset_Minmax),
-    NAME_FUNC_OFFSET(14752, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram),
-    NAME_FUNC_OFFSET(14772, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax),
-    NAME_FUNC_OFFSET(14789, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D),
-    NAME_FUNC_OFFSET(14805, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D),
-    NAME_FUNC_OFFSET(14824, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D),
-    NAME_FUNC_OFFSET(14847, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB),
-    NAME_FUNC_OFFSET(14863, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB),
-    NAME_FUNC_OFFSET(14885, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB),
-    NAME_FUNC_OFFSET(14903, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB),
-    NAME_FUNC_OFFSET(14922, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB),
-    NAME_FUNC_OFFSET(14940, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB),
-    NAME_FUNC_OFFSET(14959, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB),
-    NAME_FUNC_OFFSET(14977, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB),
-    NAME_FUNC_OFFSET(14996, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB),
-    NAME_FUNC_OFFSET(15014, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB),
-    NAME_FUNC_OFFSET(15033, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB),
-    NAME_FUNC_OFFSET(15051, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB),
-    NAME_FUNC_OFFSET(15070, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB),
-    NAME_FUNC_OFFSET(15088, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB),
-    NAME_FUNC_OFFSET(15107, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB),
-    NAME_FUNC_OFFSET(15125, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB),
-    NAME_FUNC_OFFSET(15144, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB),
-    NAME_FUNC_OFFSET(15162, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB),
-    NAME_FUNC_OFFSET(15181, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB),
-    NAME_FUNC_OFFSET(15199, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB),
-    NAME_FUNC_OFFSET(15218, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB),
-    NAME_FUNC_OFFSET(15236, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB),
-    NAME_FUNC_OFFSET(15255, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB),
-    NAME_FUNC_OFFSET(15273, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB),
-    NAME_FUNC_OFFSET(15292, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB),
-    NAME_FUNC_OFFSET(15310, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB),
-    NAME_FUNC_OFFSET(15329, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB),
-    NAME_FUNC_OFFSET(15347, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB),
-    NAME_FUNC_OFFSET(15366, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB),
-    NAME_FUNC_OFFSET(15384, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB),
-    NAME_FUNC_OFFSET(15403, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB),
-    NAME_FUNC_OFFSET(15421, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB),
-    NAME_FUNC_OFFSET(15440, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB),
-    NAME_FUNC_OFFSET(15458, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB),
-    NAME_FUNC_OFFSET(15477, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate),
-    NAME_FUNC_OFFSET(15500, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB),
-    NAME_FUNC_OFFSET(15523, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB),
-    NAME_FUNC_OFFSET(15546, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB),
-    NAME_FUNC_OFFSET(15569, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB),
-    NAME_FUNC_OFFSET(15592, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB),
-    NAME_FUNC_OFFSET(15609, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB),
-    NAME_FUNC_OFFSET(15632, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB),
-    NAME_FUNC_OFFSET(15655, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB),
-    NAME_FUNC_OFFSET(15678, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB),
-    NAME_FUNC_OFFSET(15704, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB),
-    NAME_FUNC_OFFSET(15730, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB),
-    NAME_FUNC_OFFSET(15756, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB),
-    NAME_FUNC_OFFSET(15780, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB),
-    NAME_FUNC_OFFSET(15807, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB),
-    NAME_FUNC_OFFSET(15833, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB),
-    NAME_FUNC_OFFSET(15853, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB),
-    NAME_FUNC_OFFSET(15873, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB),
-    NAME_FUNC_OFFSET(15893, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB),
-    NAME_FUNC_OFFSET(15916, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB),
-    NAME_FUNC_OFFSET(15940, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB),
-    NAME_FUNC_OFFSET(15963, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB),
-    NAME_FUNC_OFFSET(15987, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB),
-    NAME_FUNC_OFFSET(16004, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB),
-    NAME_FUNC_OFFSET(16022, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB),
-    NAME_FUNC_OFFSET(16039, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB),
-    NAME_FUNC_OFFSET(16057, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB),
-    NAME_FUNC_OFFSET(16074, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB),
-    NAME_FUNC_OFFSET(16092, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB),
-    NAME_FUNC_OFFSET(16109, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB),
-    NAME_FUNC_OFFSET(16127, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB),
-    NAME_FUNC_OFFSET(16144, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB),
-    NAME_FUNC_OFFSET(16162, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB),
-    NAME_FUNC_OFFSET(16179, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB),
-    NAME_FUNC_OFFSET(16197, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB),
-    NAME_FUNC_OFFSET(16214, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB),
-    NAME_FUNC_OFFSET(16232, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB),
-    NAME_FUNC_OFFSET(16249, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB),
-    NAME_FUNC_OFFSET(16267, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB),
-    NAME_FUNC_OFFSET(16284, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB),
-    NAME_FUNC_OFFSET(16302, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB),
-    NAME_FUNC_OFFSET(16321, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB),
-    NAME_FUNC_OFFSET(16340, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB),
-    NAME_FUNC_OFFSET(16359, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB),
-    NAME_FUNC_OFFSET(16378, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB),
-    NAME_FUNC_OFFSET(16398, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB),
-    NAME_FUNC_OFFSET(16418, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB),
-    NAME_FUNC_OFFSET(16438, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB),
-    NAME_FUNC_OFFSET(16456, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB),
-    NAME_FUNC_OFFSET(16473, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB),
-    NAME_FUNC_OFFSET(16491, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB),
-    NAME_FUNC_OFFSET(16508, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB),
-    NAME_FUNC_OFFSET(16526, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB),
-    NAME_FUNC_OFFSET(16544, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB),
-    NAME_FUNC_OFFSET(16561, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB),
-    NAME_FUNC_OFFSET(16579, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB),
-    NAME_FUNC_OFFSET(16598, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB),
-    NAME_FUNC_OFFSET(16617, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB),
-    NAME_FUNC_OFFSET(16636, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB),
-    NAME_FUNC_OFFSET(16658, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB),
-    NAME_FUNC_OFFSET(16671, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB),
-    NAME_FUNC_OFFSET(16684, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB),
-    NAME_FUNC_OFFSET(16700, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB),
-    NAME_FUNC_OFFSET(16716, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB),
-    NAME_FUNC_OFFSET(16729, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB),
-    NAME_FUNC_OFFSET(16752, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB),
-    NAME_FUNC_OFFSET(16772, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB),
-    NAME_FUNC_OFFSET(16791, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB),
-    NAME_FUNC_OFFSET(16802, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB),
-    NAME_FUNC_OFFSET(16814, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB),
-    NAME_FUNC_OFFSET(16828, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB),
-    NAME_FUNC_OFFSET(16841, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB),
-    NAME_FUNC_OFFSET(16857, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB),
-    NAME_FUNC_OFFSET(16868, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB),
-    NAME_FUNC_OFFSET(16881, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB),
-    NAME_FUNC_OFFSET(16900, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB),
-    NAME_FUNC_OFFSET(16920, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB),
-    NAME_FUNC_OFFSET(16933, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB),
-    NAME_FUNC_OFFSET(16943, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB),
-    NAME_FUNC_OFFSET(16959, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB),
-    NAME_FUNC_OFFSET(16978, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB),
-    NAME_FUNC_OFFSET(16996, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB),
-    NAME_FUNC_OFFSET(17017, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB),
-    NAME_FUNC_OFFSET(17032, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB),
-    NAME_FUNC_OFFSET(17047, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB),
-    NAME_FUNC_OFFSET(17061, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB),
-    NAME_FUNC_OFFSET(17076, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB),
-    NAME_FUNC_OFFSET(17088, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB),
-    NAME_FUNC_OFFSET(17101, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB),
-    NAME_FUNC_OFFSET(17113, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB),
-    NAME_FUNC_OFFSET(17126, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB),
-    NAME_FUNC_OFFSET(17138, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB),
-    NAME_FUNC_OFFSET(17151, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB),
-    NAME_FUNC_OFFSET(17163, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB),
-    NAME_FUNC_OFFSET(17176, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB),
-    NAME_FUNC_OFFSET(17188, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB),
-    NAME_FUNC_OFFSET(17201, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB),
-    NAME_FUNC_OFFSET(17213, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB),
-    NAME_FUNC_OFFSET(17226, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB),
-    NAME_FUNC_OFFSET(17238, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB),
-    NAME_FUNC_OFFSET(17251, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB),
-    NAME_FUNC_OFFSET(17263, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB),
-    NAME_FUNC_OFFSET(17276, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB),
-    NAME_FUNC_OFFSET(17295, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB),
-    NAME_FUNC_OFFSET(17314, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB),
-    NAME_FUNC_OFFSET(17333, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB),
-    NAME_FUNC_OFFSET(17346, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB),
-    NAME_FUNC_OFFSET(17364, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB),
-    NAME_FUNC_OFFSET(17385, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB),
-    NAME_FUNC_OFFSET(17403, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB),
-    NAME_FUNC_OFFSET(17423, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB),
-    NAME_FUNC_OFFSET(17437, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB),
-    NAME_FUNC_OFFSET(17454, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SampleMaskSGIS),
-    NAME_FUNC_OFFSET(17470, gl_dispatch_stub_570, gl_dispatch_stub_570, NULL, _gloffset_SamplePatternSGIS),
-    NAME_FUNC_OFFSET(17489, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
-    NAME_FUNC_OFFSET(17507, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
-    NAME_FUNC_OFFSET(17528, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
-    NAME_FUNC_OFFSET(17550, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
-    NAME_FUNC_OFFSET(17569, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
-    NAME_FUNC_OFFSET(17591, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
-    NAME_FUNC_OFFSET(17614, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT),
-    NAME_FUNC_OFFSET(17633, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT),
-    NAME_FUNC_OFFSET(17653, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT),
-    NAME_FUNC_OFFSET(17672, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT),
-    NAME_FUNC_OFFSET(17692, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT),
-    NAME_FUNC_OFFSET(17711, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT),
-    NAME_FUNC_OFFSET(17731, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT),
-    NAME_FUNC_OFFSET(17750, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT),
-    NAME_FUNC_OFFSET(17770, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT),
-    NAME_FUNC_OFFSET(17789, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT),
-    NAME_FUNC_OFFSET(17809, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT),
-    NAME_FUNC_OFFSET(17829, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT),
-    NAME_FUNC_OFFSET(17850, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT),
-    NAME_FUNC_OFFSET(17870, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT),
-    NAME_FUNC_OFFSET(17891, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT),
-    NAME_FUNC_OFFSET(17911, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT),
-    NAME_FUNC_OFFSET(17932, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT),
-    NAME_FUNC_OFFSET(17956, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT),
-    NAME_FUNC_OFFSET(17974, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT),
-    NAME_FUNC_OFFSET(17994, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT),
-    NAME_FUNC_OFFSET(18012, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT),
-    NAME_FUNC_OFFSET(18024, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT),
-    NAME_FUNC_OFFSET(18037, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT),
-    NAME_FUNC_OFFSET(18049, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT),
-    NAME_FUNC_OFFSET(18062, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
-    NAME_FUNC_OFFSET(18082, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
-    NAME_FUNC_OFFSET(18106, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
-    NAME_FUNC_OFFSET(18120, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
-    NAME_FUNC_OFFSET(18137, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
-    NAME_FUNC_OFFSET(18152, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
-    NAME_FUNC_OFFSET(18170, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
-    NAME_FUNC_OFFSET(18184, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
-    NAME_FUNC_OFFSET(18201, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
-    NAME_FUNC_OFFSET(18216, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
-    NAME_FUNC_OFFSET(18234, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
-    NAME_FUNC_OFFSET(18248, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
-    NAME_FUNC_OFFSET(18265, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
-    NAME_FUNC_OFFSET(18280, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
-    NAME_FUNC_OFFSET(18298, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
-    NAME_FUNC_OFFSET(18312, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
-    NAME_FUNC_OFFSET(18329, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
-    NAME_FUNC_OFFSET(18344, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
-    NAME_FUNC_OFFSET(18362, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
-    NAME_FUNC_OFFSET(18376, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
-    NAME_FUNC_OFFSET(18393, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
-    NAME_FUNC_OFFSET(18408, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
-    NAME_FUNC_OFFSET(18426, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
-    NAME_FUNC_OFFSET(18440, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
-    NAME_FUNC_OFFSET(18457, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
-    NAME_FUNC_OFFSET(18472, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
-    NAME_FUNC_OFFSET(18490, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
-    NAME_FUNC_OFFSET(18504, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
-    NAME_FUNC_OFFSET(18521, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
-    NAME_FUNC_OFFSET(18536, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
-    NAME_FUNC_OFFSET(18554, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
-    NAME_FUNC_OFFSET(18568, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
-    NAME_FUNC_OFFSET(18585, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
-    NAME_FUNC_OFFSET(18600, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
-    NAME_FUNC_OFFSET(18618, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV),
-    NAME_FUNC_OFFSET(18635, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV),
-    NAME_FUNC_OFFSET(18655, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV),
-    NAME_FUNC_OFFSET(18672, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
-    NAME_FUNC_OFFSET(18698, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
-    NAME_FUNC_OFFSET(18727, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV),
-    NAME_FUNC_OFFSET(18742, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV),
-    NAME_FUNC_OFFSET(18760, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV),
-    NAME_FUNC_OFFSET(18779, gl_dispatch_stub_746, gl_dispatch_stub_746, NULL, _gloffset_BlendEquationSeparateEXT),
-    NAME_FUNC_OFFSET(18803, gl_dispatch_stub_746, gl_dispatch_stub_746, NULL, _gloffset_BlendEquationSeparateEXT),
-    NAME_FUNC_OFFSET(18830, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT),
-    NAME_FUNC_OFFSET(18848, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT),
-    NAME_FUNC_OFFSET(18867, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT),
-    NAME_FUNC_OFFSET(18892, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT),
-    NAME_FUNC_OFFSET(18913, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT),
-    NAME_FUNC_OFFSET(18935, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT),
-    NAME_FUNC_OFFSET(18961, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT),
-    NAME_FUNC_OFFSET(18984, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT),
-    NAME_FUNC_OFFSET(19007, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT),
-    NAME_FUNC_OFFSET(19030, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT),
-    NAME_FUNC_OFFSET(19048, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT),
-    NAME_FUNC_OFFSET(19067, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT),
-    NAME_FUNC_OFFSET(19084, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT),
-    NAME_FUNC_OFFSET(19122, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT),
-    NAME_FUNC_OFFSET(19151, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT),
-    NAME_FUNC_OFFSET(19167, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT),
-    NAME_FUNC_OFFSET(19184, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT),
-    NAME_FUNC_OFFSET(19206, gl_dispatch_stub_764, gl_dispatch_stub_764, NULL, _gloffset_BlitFramebufferEXT),
-    NAME_FUNC_OFFSET(19224, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT),
+    NAME_FUNC_OFFSET(12266, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, _gloffset_GetTexBumpParameterfvATI),
+    NAME_FUNC_OFFSET(12293, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, _gloffset_GetTexBumpParameterivATI),
+    NAME_FUNC_OFFSET(12320, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, _gloffset_TexBumpParameterfvATI),
+    NAME_FUNC_OFFSET(12344, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, _gloffset_TexBumpParameterivATI),
+    NAME_FUNC_OFFSET(12368, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, _gloffset_AlphaFragmentOp1ATI),
+    NAME_FUNC_OFFSET(12390, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, _gloffset_AlphaFragmentOp2ATI),
+    NAME_FUNC_OFFSET(12412, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, _gloffset_AlphaFragmentOp3ATI),
+    NAME_FUNC_OFFSET(12434, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, _gloffset_BeginFragmentShaderATI),
+    NAME_FUNC_OFFSET(12459, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, _gloffset_BindFragmentShaderATI),
+    NAME_FUNC_OFFSET(12483, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, _gloffset_ColorFragmentOp1ATI),
+    NAME_FUNC_OFFSET(12505, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, _gloffset_ColorFragmentOp2ATI),
+    NAME_FUNC_OFFSET(12527, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, _gloffset_ColorFragmentOp3ATI),
+    NAME_FUNC_OFFSET(12549, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, _gloffset_DeleteFragmentShaderATI),
+    NAME_FUNC_OFFSET(12575, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, _gloffset_EndFragmentShaderATI),
+    NAME_FUNC_OFFSET(12598, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, _gloffset_GenFragmentShadersATI),
+    NAME_FUNC_OFFSET(12622, glPassTexCoordATI, glPassTexCoordATI, NULL, _gloffset_PassTexCoordATI),
+    NAME_FUNC_OFFSET(12640, glSampleMapATI, glSampleMapATI, NULL, _gloffset_SampleMapATI),
+    NAME_FUNC_OFFSET(12655, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, _gloffset_SetFragmentShaderConstantATI),
+    NAME_FUNC_OFFSET(12686, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV),
+    NAME_FUNC_OFFSET(12706, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV),
+    NAME_FUNC_OFFSET(12727, gl_dispatch_stub_738, gl_dispatch_stub_738, NULL, _gloffset_ActiveStencilFaceEXT),
+    NAME_FUNC_OFFSET(12750, gl_dispatch_stub_739, gl_dispatch_stub_739, NULL, _gloffset_BindVertexArrayAPPLE),
+    NAME_FUNC_OFFSET(12773, gl_dispatch_stub_740, gl_dispatch_stub_740, NULL, _gloffset_DeleteVertexArraysAPPLE),
+    NAME_FUNC_OFFSET(12799, gl_dispatch_stub_741, gl_dispatch_stub_741, NULL, _gloffset_GenVertexArraysAPPLE),
+    NAME_FUNC_OFFSET(12822, gl_dispatch_stub_742, gl_dispatch_stub_742, NULL, _gloffset_IsVertexArrayAPPLE),
+    NAME_FUNC_OFFSET(12843, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, _gloffset_GetProgramNamedParameterdvNV),
+    NAME_FUNC_OFFSET(12874, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, _gloffset_GetProgramNamedParameterfvNV),
+    NAME_FUNC_OFFSET(12905, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, _gloffset_ProgramNamedParameter4dNV),
+    NAME_FUNC_OFFSET(12933, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, _gloffset_ProgramNamedParameter4dvNV),
+    NAME_FUNC_OFFSET(12962, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, _gloffset_ProgramNamedParameter4fNV),
+    NAME_FUNC_OFFSET(12990, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, _gloffset_ProgramNamedParameter4fvNV),
+    NAME_FUNC_OFFSET(13019, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_DepthBoundsEXT),
+    NAME_FUNC_OFFSET(13036, gl_dispatch_stub_750, gl_dispatch_stub_750, NULL, _gloffset_BlendEquationSeparateEXT),
+    NAME_FUNC_OFFSET(13063, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT),
+    NAME_FUNC_OFFSET(13084, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT),
+    NAME_FUNC_OFFSET(13106, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT),
+    NAME_FUNC_OFFSET(13134, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT),
+    NAME_FUNC_OFFSET(13158, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT),
+    NAME_FUNC_OFFSET(13183, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT),
+    NAME_FUNC_OFFSET(13212, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT),
+    NAME_FUNC_OFFSET(13238, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT),
+    NAME_FUNC_OFFSET(13264, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT),
+    NAME_FUNC_OFFSET(13290, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT),
+    NAME_FUNC_OFFSET(13311, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT),
+    NAME_FUNC_OFFSET(13333, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT),
+    NAME_FUNC_OFFSET(13353, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT),
+    NAME_FUNC_OFFSET(13394, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT),
+    NAME_FUNC_OFFSET(13426, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT),
+    NAME_FUNC_OFFSET(13445, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT),
+    NAME_FUNC_OFFSET(13465, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT),
+    NAME_FUNC_OFFSET(13490, gl_dispatch_stub_768, gl_dispatch_stub_768, NULL, _gloffset_BlitFramebufferEXT),
+    NAME_FUNC_OFFSET(13511, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT),
+    NAME_FUNC_OFFSET(13540, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_StencilFuncSeparateATI),
+    NAME_FUNC_OFFSET(13565, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_ProgramEnvParameters4fvEXT),
+    NAME_FUNC_OFFSET(13594, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_ProgramLocalParameters4fvEXT),
+    NAME_FUNC_OFFSET(13625, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_GetQueryObjecti64vEXT),
+    NAME_FUNC_OFFSET(13649, gl_dispatch_stub_774, gl_dispatch_stub_774, NULL, _gloffset_GetQueryObjectui64vEXT),
+    NAME_FUNC_OFFSET(13674, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement),
+    NAME_FUNC_OFFSET(13692, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture),
+    NAME_FUNC_OFFSET(13709, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays),
+    NAME_FUNC_OFFSET(13725, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident),
+    NAME_FUNC_OFFSET(13750, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D),
+    NAME_FUNC_OFFSET(13770, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D),
+    NAME_FUNC_OFFSET(13790, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D),
+    NAME_FUNC_OFFSET(13813, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D),
+    NAME_FUNC_OFFSET(13836, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures),
+    NAME_FUNC_OFFSET(13856, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures),
+    NAME_FUNC_OFFSET(13873, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv),
+    NAME_FUNC_OFFSET(13890, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture),
+    NAME_FUNC_OFFSET(13905, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures),
+    NAME_FUNC_OFFSET(13929, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D),
+    NAME_FUNC_OFFSET(13948, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D),
+    NAME_FUNC_OFFSET(13967, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor),
+    NAME_FUNC_OFFSET(13983, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation),
+    NAME_FUNC_OFFSET(14002, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements),
+    NAME_FUNC_OFFSET(14025, glColorTable, glColorTable, NULL, _gloffset_ColorTable),
+    NAME_FUNC_OFFSET(14041, glColorTable, glColorTable, NULL, _gloffset_ColorTable),
+    NAME_FUNC_OFFSET(14057, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv),
+    NAME_FUNC_OFFSET(14084, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv),
+    NAME_FUNC_OFFSET(14111, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable),
+    NAME_FUNC_OFFSET(14131, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable),
+    NAME_FUNC_OFFSET(14150, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable),
+    NAME_FUNC_OFFSET(14169, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv),
+    NAME_FUNC_OFFSET(14199, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv),
+    NAME_FUNC_OFFSET(14229, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv),
+    NAME_FUNC_OFFSET(14259, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv),
+    NAME_FUNC_OFFSET(14289, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable),
+    NAME_FUNC_OFFSET(14308, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable),
+    NAME_FUNC_OFFSET(14331, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D),
+    NAME_FUNC_OFFSET(14356, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D),
+    NAME_FUNC_OFFSET(14381, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf),
+    NAME_FUNC_OFFSET(14408, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv),
+    NAME_FUNC_OFFSET(14436, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri),
+    NAME_FUNC_OFFSET(14463, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv),
+    NAME_FUNC_OFFSET(14491, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D),
+    NAME_FUNC_OFFSET(14520, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D),
+    NAME_FUNC_OFFSET(14549, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter),
+    NAME_FUNC_OFFSET(14575, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv),
+    NAME_FUNC_OFFSET(14606, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv),
+    NAME_FUNC_OFFSET(14637, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter),
+    NAME_FUNC_OFFSET(14661, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D),
+    NAME_FUNC_OFFSET(14684, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram),
+    NAME_FUNC_OFFSET(14702, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv),
+    NAME_FUNC_OFFSET(14731, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv),
+    NAME_FUNC_OFFSET(14760, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax),
+    NAME_FUNC_OFFSET(14775, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv),
+    NAME_FUNC_OFFSET(14801, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv),
+    NAME_FUNC_OFFSET(14827, glHistogram, glHistogram, NULL, _gloffset_Histogram),
+    NAME_FUNC_OFFSET(14842, glMinmax, glMinmax, NULL, _gloffset_Minmax),
+    NAME_FUNC_OFFSET(14854, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram),
+    NAME_FUNC_OFFSET(14874, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax),
+    NAME_FUNC_OFFSET(14891, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D),
+    NAME_FUNC_OFFSET(14907, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D),
+    NAME_FUNC_OFFSET(14926, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D),
+    NAME_FUNC_OFFSET(14949, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB),
+    NAME_FUNC_OFFSET(14965, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB),
+    NAME_FUNC_OFFSET(14987, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB),
+    NAME_FUNC_OFFSET(15005, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB),
+    NAME_FUNC_OFFSET(15024, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB),
+    NAME_FUNC_OFFSET(15042, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB),
+    NAME_FUNC_OFFSET(15061, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB),
+    NAME_FUNC_OFFSET(15079, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB),
+    NAME_FUNC_OFFSET(15098, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB),
+    NAME_FUNC_OFFSET(15116, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB),
+    NAME_FUNC_OFFSET(15135, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB),
+    NAME_FUNC_OFFSET(15153, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB),
+    NAME_FUNC_OFFSET(15172, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB),
+    NAME_FUNC_OFFSET(15190, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB),
+    NAME_FUNC_OFFSET(15209, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB),
+    NAME_FUNC_OFFSET(15227, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB),
+    NAME_FUNC_OFFSET(15246, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB),
+    NAME_FUNC_OFFSET(15264, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB),
+    NAME_FUNC_OFFSET(15283, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB),
+    NAME_FUNC_OFFSET(15301, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB),
+    NAME_FUNC_OFFSET(15320, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB),
+    NAME_FUNC_OFFSET(15338, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB),
+    NAME_FUNC_OFFSET(15357, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB),
+    NAME_FUNC_OFFSET(15375, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB),
+    NAME_FUNC_OFFSET(15394, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB),
+    NAME_FUNC_OFFSET(15412, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB),
+    NAME_FUNC_OFFSET(15431, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB),
+    NAME_FUNC_OFFSET(15449, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB),
+    NAME_FUNC_OFFSET(15468, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB),
+    NAME_FUNC_OFFSET(15486, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB),
+    NAME_FUNC_OFFSET(15505, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB),
+    NAME_FUNC_OFFSET(15523, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB),
+    NAME_FUNC_OFFSET(15542, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB),
+    NAME_FUNC_OFFSET(15560, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB),
+    NAME_FUNC_OFFSET(15579, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate),
+    NAME_FUNC_OFFSET(15602, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB),
+    NAME_FUNC_OFFSET(15625, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB),
+    NAME_FUNC_OFFSET(15648, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB),
+    NAME_FUNC_OFFSET(15671, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB),
+    NAME_FUNC_OFFSET(15694, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB),
+    NAME_FUNC_OFFSET(15711, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB),
+    NAME_FUNC_OFFSET(15734, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB),
+    NAME_FUNC_OFFSET(15757, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB),
+    NAME_FUNC_OFFSET(15780, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB),
+    NAME_FUNC_OFFSET(15806, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB),
+    NAME_FUNC_OFFSET(15832, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB),
+    NAME_FUNC_OFFSET(15858, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB),
+    NAME_FUNC_OFFSET(15882, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB),
+    NAME_FUNC_OFFSET(15909, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB),
+    NAME_FUNC_OFFSET(15935, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB),
+    NAME_FUNC_OFFSET(15955, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB),
+    NAME_FUNC_OFFSET(15975, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB),
+    NAME_FUNC_OFFSET(15995, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB),
+    NAME_FUNC_OFFSET(16018, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB),
+    NAME_FUNC_OFFSET(16042, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB),
+    NAME_FUNC_OFFSET(16065, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB),
+    NAME_FUNC_OFFSET(16089, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB),
+    NAME_FUNC_OFFSET(16106, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB),
+    NAME_FUNC_OFFSET(16124, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB),
+    NAME_FUNC_OFFSET(16141, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB),
+    NAME_FUNC_OFFSET(16159, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB),
+    NAME_FUNC_OFFSET(16176, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB),
+    NAME_FUNC_OFFSET(16194, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB),
+    NAME_FUNC_OFFSET(16211, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB),
+    NAME_FUNC_OFFSET(16229, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB),
+    NAME_FUNC_OFFSET(16246, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB),
+    NAME_FUNC_OFFSET(16264, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB),
+    NAME_FUNC_OFFSET(16281, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB),
+    NAME_FUNC_OFFSET(16299, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB),
+    NAME_FUNC_OFFSET(16316, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB),
+    NAME_FUNC_OFFSET(16334, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB),
+    NAME_FUNC_OFFSET(16351, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB),
+    NAME_FUNC_OFFSET(16369, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB),
+    NAME_FUNC_OFFSET(16386, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB),
+    NAME_FUNC_OFFSET(16404, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB),
+    NAME_FUNC_OFFSET(16423, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB),
+    NAME_FUNC_OFFSET(16442, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB),
+    NAME_FUNC_OFFSET(16461, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB),
+    NAME_FUNC_OFFSET(16480, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB),
+    NAME_FUNC_OFFSET(16500, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB),
+    NAME_FUNC_OFFSET(16520, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB),
+    NAME_FUNC_OFFSET(16540, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB),
+    NAME_FUNC_OFFSET(16558, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB),
+    NAME_FUNC_OFFSET(16575, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB),
+    NAME_FUNC_OFFSET(16593, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB),
+    NAME_FUNC_OFFSET(16610, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB),
+    NAME_FUNC_OFFSET(16628, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB),
+    NAME_FUNC_OFFSET(16646, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB),
+    NAME_FUNC_OFFSET(16663, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB),
+    NAME_FUNC_OFFSET(16681, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB),
+    NAME_FUNC_OFFSET(16700, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB),
+    NAME_FUNC_OFFSET(16719, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB),
+    NAME_FUNC_OFFSET(16738, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB),
+    NAME_FUNC_OFFSET(16760, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB),
+    NAME_FUNC_OFFSET(16773, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB),
+    NAME_FUNC_OFFSET(16786, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB),
+    NAME_FUNC_OFFSET(16802, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB),
+    NAME_FUNC_OFFSET(16818, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB),
+    NAME_FUNC_OFFSET(16831, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB),
+    NAME_FUNC_OFFSET(16854, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB),
+    NAME_FUNC_OFFSET(16874, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB),
+    NAME_FUNC_OFFSET(16893, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB),
+    NAME_FUNC_OFFSET(16904, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB),
+    NAME_FUNC_OFFSET(16916, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB),
+    NAME_FUNC_OFFSET(16930, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB),
+    NAME_FUNC_OFFSET(16943, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB),
+    NAME_FUNC_OFFSET(16959, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB),
+    NAME_FUNC_OFFSET(16970, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB),
+    NAME_FUNC_OFFSET(16983, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB),
+    NAME_FUNC_OFFSET(17002, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB),
+    NAME_FUNC_OFFSET(17022, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB),
+    NAME_FUNC_OFFSET(17035, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB),
+    NAME_FUNC_OFFSET(17045, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB),
+    NAME_FUNC_OFFSET(17061, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB),
+    NAME_FUNC_OFFSET(17080, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB),
+    NAME_FUNC_OFFSET(17098, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB),
+    NAME_FUNC_OFFSET(17119, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB),
+    NAME_FUNC_OFFSET(17134, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB),
+    NAME_FUNC_OFFSET(17149, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB),
+    NAME_FUNC_OFFSET(17163, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB),
+    NAME_FUNC_OFFSET(17178, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB),
+    NAME_FUNC_OFFSET(17190, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB),
+    NAME_FUNC_OFFSET(17203, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB),
+    NAME_FUNC_OFFSET(17215, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB),
+    NAME_FUNC_OFFSET(17228, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB),
+    NAME_FUNC_OFFSET(17240, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB),
+    NAME_FUNC_OFFSET(17253, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB),
+    NAME_FUNC_OFFSET(17265, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB),
+    NAME_FUNC_OFFSET(17278, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB),
+    NAME_FUNC_OFFSET(17290, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB),
+    NAME_FUNC_OFFSET(17303, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB),
+    NAME_FUNC_OFFSET(17315, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB),
+    NAME_FUNC_OFFSET(17328, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB),
+    NAME_FUNC_OFFSET(17340, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB),
+    NAME_FUNC_OFFSET(17353, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB),
+    NAME_FUNC_OFFSET(17365, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB),
+    NAME_FUNC_OFFSET(17378, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB),
+    NAME_FUNC_OFFSET(17397, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB),
+    NAME_FUNC_OFFSET(17416, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB),
+    NAME_FUNC_OFFSET(17435, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB),
+    NAME_FUNC_OFFSET(17448, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB),
+    NAME_FUNC_OFFSET(17466, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB),
+    NAME_FUNC_OFFSET(17487, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB),
+    NAME_FUNC_OFFSET(17505, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB),
+    NAME_FUNC_OFFSET(17525, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB),
+    NAME_FUNC_OFFSET(17539, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB),
+    NAME_FUNC_OFFSET(17556, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SampleMaskSGIS),
+    NAME_FUNC_OFFSET(17572, gl_dispatch_stub_570, gl_dispatch_stub_570, NULL, _gloffset_SamplePatternSGIS),
+    NAME_FUNC_OFFSET(17591, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
+    NAME_FUNC_OFFSET(17609, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
+    NAME_FUNC_OFFSET(17630, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
+    NAME_FUNC_OFFSET(17652, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
+    NAME_FUNC_OFFSET(17671, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
+    NAME_FUNC_OFFSET(17693, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
+    NAME_FUNC_OFFSET(17716, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT),
+    NAME_FUNC_OFFSET(17735, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT),
+    NAME_FUNC_OFFSET(17755, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT),
+    NAME_FUNC_OFFSET(17774, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT),
+    NAME_FUNC_OFFSET(17794, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT),
+    NAME_FUNC_OFFSET(17813, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT),
+    NAME_FUNC_OFFSET(17833, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT),
+    NAME_FUNC_OFFSET(17852, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT),
+    NAME_FUNC_OFFSET(17872, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT),
+    NAME_FUNC_OFFSET(17891, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT),
+    NAME_FUNC_OFFSET(17911, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT),
+    NAME_FUNC_OFFSET(17931, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT),
+    NAME_FUNC_OFFSET(17952, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT),
+    NAME_FUNC_OFFSET(17972, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT),
+    NAME_FUNC_OFFSET(17993, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT),
+    NAME_FUNC_OFFSET(18013, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT),
+    NAME_FUNC_OFFSET(18034, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT),
+    NAME_FUNC_OFFSET(18058, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT),
+    NAME_FUNC_OFFSET(18076, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT),
+    NAME_FUNC_OFFSET(18096, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT),
+    NAME_FUNC_OFFSET(18114, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT),
+    NAME_FUNC_OFFSET(18126, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT),
+    NAME_FUNC_OFFSET(18139, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT),
+    NAME_FUNC_OFFSET(18151, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT),
+    NAME_FUNC_OFFSET(18164, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
+    NAME_FUNC_OFFSET(18184, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
+    NAME_FUNC_OFFSET(18208, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
+    NAME_FUNC_OFFSET(18222, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
+    NAME_FUNC_OFFSET(18239, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
+    NAME_FUNC_OFFSET(18254, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
+    NAME_FUNC_OFFSET(18272, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
+    NAME_FUNC_OFFSET(18286, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
+    NAME_FUNC_OFFSET(18303, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
+    NAME_FUNC_OFFSET(18318, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
+    NAME_FUNC_OFFSET(18336, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
+    NAME_FUNC_OFFSET(18350, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
+    NAME_FUNC_OFFSET(18367, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
+    NAME_FUNC_OFFSET(18382, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
+    NAME_FUNC_OFFSET(18400, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
+    NAME_FUNC_OFFSET(18414, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
+    NAME_FUNC_OFFSET(18431, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
+    NAME_FUNC_OFFSET(18446, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
+    NAME_FUNC_OFFSET(18464, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
+    NAME_FUNC_OFFSET(18478, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
+    NAME_FUNC_OFFSET(18495, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
+    NAME_FUNC_OFFSET(18510, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
+    NAME_FUNC_OFFSET(18528, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
+    NAME_FUNC_OFFSET(18542, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
+    NAME_FUNC_OFFSET(18559, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
+    NAME_FUNC_OFFSET(18574, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
+    NAME_FUNC_OFFSET(18592, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
+    NAME_FUNC_OFFSET(18606, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
+    NAME_FUNC_OFFSET(18623, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
+    NAME_FUNC_OFFSET(18638, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
+    NAME_FUNC_OFFSET(18656, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
+    NAME_FUNC_OFFSET(18670, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
+    NAME_FUNC_OFFSET(18687, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
+    NAME_FUNC_OFFSET(18702, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
+    NAME_FUNC_OFFSET(18720, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV),
+    NAME_FUNC_OFFSET(18737, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV),
+    NAME_FUNC_OFFSET(18757, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV),
+    NAME_FUNC_OFFSET(18774, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
+    NAME_FUNC_OFFSET(18800, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
+    NAME_FUNC_OFFSET(18829, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV),
+    NAME_FUNC_OFFSET(18844, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV),
+    NAME_FUNC_OFFSET(18862, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV),
+    NAME_FUNC_OFFSET(18881, gl_dispatch_stub_750, gl_dispatch_stub_750, NULL, _gloffset_BlendEquationSeparateEXT),
+    NAME_FUNC_OFFSET(18905, gl_dispatch_stub_750, gl_dispatch_stub_750, NULL, _gloffset_BlendEquationSeparateEXT),
+    NAME_FUNC_OFFSET(18932, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT),
+    NAME_FUNC_OFFSET(18950, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT),
+    NAME_FUNC_OFFSET(18969, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT),
+    NAME_FUNC_OFFSET(18994, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT),
+    NAME_FUNC_OFFSET(19015, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT),
+    NAME_FUNC_OFFSET(19037, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT),
+    NAME_FUNC_OFFSET(19063, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT),
+    NAME_FUNC_OFFSET(19086, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT),
+    NAME_FUNC_OFFSET(19109, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT),
+    NAME_FUNC_OFFSET(19132, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT),
+    NAME_FUNC_OFFSET(19150, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT),
+    NAME_FUNC_OFFSET(19169, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT),
+    NAME_FUNC_OFFSET(19186, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT),
+    NAME_FUNC_OFFSET(19224, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT),
+    NAME_FUNC_OFFSET(19253, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT),
+    NAME_FUNC_OFFSET(19269, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT),
+    NAME_FUNC_OFFSET(19286, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT),
+    NAME_FUNC_OFFSET(19308, gl_dispatch_stub_768, gl_dispatch_stub_768, NULL, _gloffset_BlitFramebufferEXT),
+    NAME_FUNC_OFFSET(19326, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT),
     NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)
 };
 
index 56ddf7c25acceea2bf038c37e30235d2b1ac41f5..e3abb0f4aeefa2a0c8a2fc1d08ddf1c5709b56c9 100644 (file)
@@ -32,7 +32,7 @@
 #include <dix-config.h>
 #endif
 
-#include "main/glheader.h"
+#include "main/compiler.h"
 #include "glthread.h"
 
 
index ae2f79f37ddb6d9035066c64f3a31251d185ede9..dfe09a9d59f8a77d7e9f1a4ab4d6320db7bc8f4d 100644 (file)
@@ -265,9 +265,21 @@ typedef xmutex_rec _glthread_Mutex;
  */
 #ifdef BEOS_THREADS
 
+/* Problem with OS.h and this file on haiku */
+#ifndef __HAIKU__
 #include <kernel/OS.h>
+#endif
+
 #include <support/TLS.h>
 
+/* The only two typedefs required here
+ * this is cause of the OS.h problem
+ */
+#ifdef __HAIKU__
+typedef int32 thread_id;
+typedef int32 sem_id;
+#endif
+
 typedef struct {
    int32        key;
    int          initMagic;
@@ -299,11 +311,11 @@ typedef benaphore _glthread_Mutex;
  * THREADS not defined
  */
 
-typedef GLuint _glthread_TSD;
+typedef unsigned _glthread_TSD;
 
-typedef GLuint _glthread_Thread;
+typedef unsigned _glthread_Thread;
 
-typedef GLuint _glthread_Mutex;
+typedef unsigned _glthread_Mutex;
 
 #define _glthread_DECLARE_STATIC_MUTEX(name)  static _glthread_Mutex name = 0
 
index f8ee0d59dda3274cfcb0e626817411540118afe3..6f66ff47a0822c627b27022ff533b510fa2f88fa 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 
-#include "glheader.h"
+#include "mfeatures.h"
 #if FEATURE_accum
 #include "accum.h"
 #endif
 #include "texstate.h"
 #include "mtypes.h"
 #include "varray.h"
+#include "viewport.h"
 #if FEATURE_NV_vertex_program
 #include "shader/nvprogram.h"
 #endif
@@ -838,6 +839,12 @@ _mesa_init_exec_table(struct _glapi_table *exec)
    SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI);
 #endif
 
+  /* GL_ATI_envmap_bumpmap */
+   SET_GetTexBumpParameterivATI(exec, _mesa_GetTexBumpParameterivATI);
+   SET_GetTexBumpParameterfvATI(exec, _mesa_GetTexBumpParameterfvATI);
+   SET_TexBumpParameterivATI(exec, _mesa_TexBumpParameterivATI);
+   SET_TexBumpParameterfvATI(exec, _mesa_TexBumpParameterfvATI);
+
 #if FEATURE_EXT_framebuffer_object
    SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT);
    SET_BindRenderbufferEXT(exec, _mesa_BindRenderbufferEXT);
index 5c8955d7c8df8968d5c2d6c82b8d881dafb9eab8..42d1e579e08a8244f798bd13dcb7d7776f0fbbcb 100644 (file)
@@ -87,11 +87,20 @@ check_valid_to_render(GLcontext *ctx, char *function)
       return GL_FALSE;
    }
 
-   /* Always need vertex positions, unless a vertex program is in use */
-   if (!ctx->VertexProgram._Current &&
-       !ctx->Array.ArrayObj->Vertex.Enabled &&
+#if FEATURE_es2_glsl
+   /* For ES2, we can draw if any vertex array is enabled (and we should
+    * always have a vertex program/shader).
+    */
+   if (ctx->Array.ArrayObj->_Enabled == 0x0 || !ctx->VertexProgram._Current)
+      return GL_FALSE;
+#else
+   /* For regular OpenGL, only draw if we have vertex positions (regardless
+    * of whether or not we have a vertex program/shader).
+    */
+   if (!ctx->Array.ArrayObj->Vertex.Enabled &&
        !ctx->Array.ArrayObj->VertexAttrib[0].Enabled)
       return GL_FALSE;
+#endif
 
    return GL_TRUE;
 }
index 218e0aeb6b750913d1a75f995938423c88104418..1d2c46048847ec08b3743d69b4e5c05cce0b37b6 100644 (file)
 #include "texparam.h"
 #include "texstate.h"
 #include "varray.h"
+#include "viewport.h"
 #include "mtypes.h"
-#include "math/m_xform.h"
+
+
+/**
+ * glEnable()/glDisable() attribute group (GL_ENABLE_BIT).
+ */
+struct gl_enable_attrib
+{
+   GLboolean AlphaTest;
+   GLboolean AutoNormal;
+   GLboolean Blend;
+   GLbitfield ClipPlanes;
+   GLboolean ColorMaterial;
+   GLboolean ColorTable[COLORTABLE_MAX];
+   GLboolean Convolution1D;
+   GLboolean Convolution2D;
+   GLboolean Separable2D;
+   GLboolean CullFace;
+   GLboolean DepthTest;
+   GLboolean Dither;
+   GLboolean Fog;
+   GLboolean Histogram;
+   GLboolean Light[MAX_LIGHTS];
+   GLboolean Lighting;
+   GLboolean LineSmooth;
+   GLboolean LineStipple;
+   GLboolean IndexLogicOp;
+   GLboolean ColorLogicOp;
+
+   GLboolean Map1Color4;
+   GLboolean Map1Index;
+   GLboolean Map1Normal;
+   GLboolean Map1TextureCoord1;
+   GLboolean Map1TextureCoord2;
+   GLboolean Map1TextureCoord3;
+   GLboolean Map1TextureCoord4;
+   GLboolean Map1Vertex3;
+   GLboolean Map1Vertex4;
+   GLboolean Map1Attrib[16];  /* GL_NV_vertex_program */
+   GLboolean Map2Color4;
+   GLboolean Map2Index;
+   GLboolean Map2Normal;
+   GLboolean Map2TextureCoord1;
+   GLboolean Map2TextureCoord2;
+   GLboolean Map2TextureCoord3;
+   GLboolean Map2TextureCoord4;
+   GLboolean Map2Vertex3;
+   GLboolean Map2Vertex4;
+   GLboolean Map2Attrib[16];  /* GL_NV_vertex_program */
+
+   GLboolean MinMax;
+   GLboolean Normalize;
+   GLboolean PixelTexture;
+   GLboolean PointSmooth;
+   GLboolean PolygonOffsetPoint;
+   GLboolean PolygonOffsetLine;
+   GLboolean PolygonOffsetFill;
+   GLboolean PolygonSmooth;
+   GLboolean PolygonStipple;
+   GLboolean RescaleNormals;
+   GLboolean Scissor;
+   GLboolean Stencil;
+   GLboolean StencilTwoSide;          /* GL_EXT_stencil_two_side */
+   GLboolean MultisampleEnabled;      /* GL_ARB_multisample */
+   GLboolean SampleAlphaToCoverage;   /* GL_ARB_multisample */
+   GLboolean SampleAlphaToOne;        /* GL_ARB_multisample */
+   GLboolean SampleCoverage;          /* GL_ARB_multisample */
+   GLboolean SampleCoverageInvert;    /* GL_ARB_multisample */
+   GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */
+
+   GLbitfield Texture[MAX_TEXTURE_UNITS];
+   GLbitfield TexGen[MAX_TEXTURE_UNITS];
+
+   /* SGI_texture_color_table */
+   GLboolean TextureColorTable[MAX_TEXTURE_UNITS];
+
+   /* GL_ARB_vertex_program / GL_NV_vertex_program */
+   GLboolean VertexProgram;
+   GLboolean VertexProgramPointSize;
+   GLboolean VertexProgramTwoSide;
+
+   /* GL_ARB_point_sprite / GL_NV_point_sprite */
+   GLboolean PointSprite;
+   GLboolean FragmentShaderATI;
+};
+
+
+/**
+ * Node for the attribute stack.
+ */
+struct gl_attrib_node
+{
+   GLbitfield kind;
+   void *data;
+   struct gl_attrib_node *next;
+};
+
+
 
 /**
  * Special struct for saving/restoring texture state (GL_TEXTURE_BIT)
@@ -365,7 +462,7 @@ _mesa_PushAttrib(GLbitfield mask)
 
    if (mask & GL_TEXTURE_BIT) {
       struct texture_state *texstate = CALLOC_STRUCT(texture_state);
-      GLuint u;
+      GLuint u, tex;
 
       if (!texstate) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_TEXTURE_BIT)");
@@ -381,38 +478,18 @@ _mesa_PushAttrib(GLbitfield mask)
        * accidentally get deleted while referenced in the attribute stack.
        */
       for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
-         _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_1D_INDEX],
-                                ctx->Texture.Unit[u].Current1D);
-         _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_2D_INDEX],
-                                ctx->Texture.Unit[u].Current2D);
-         _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_3D_INDEX],
-                                ctx->Texture.Unit[u].Current3D);
-         _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_CUBE_INDEX],
-                                ctx->Texture.Unit[u].CurrentCubeMap);
-         _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_RECT_INDEX],
-                                ctx->Texture.Unit[u].CurrentRect);
-         _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_1D_ARRAY_INDEX],
-                                ctx->Texture.Unit[u].Current1DArray);
-         _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_2D_ARRAY_INDEX],
-                                ctx->Texture.Unit[u].Current2DArray);
+         for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
+            _mesa_reference_texobj(&texstate->SavedTexRef[u][tex],
+                                   ctx->Texture.Unit[u].CurrentTex[tex]);
+         }
       }
 
       /* copy state/contents of the currently bound texture objects */
       for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
-         _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_1D_INDEX],
-                                   ctx->Texture.Unit[u].Current1D);
-         _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_2D_INDEX],
-                                   ctx->Texture.Unit[u].Current2D);
-         _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_3D_INDEX],
-                                   ctx->Texture.Unit[u].Current3D);
-         _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_CUBE_INDEX],
-                                   ctx->Texture.Unit[u].CurrentCubeMap);
-         _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_RECT_INDEX],
-                                   ctx->Texture.Unit[u].CurrentRect);
-         _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_1D_ARRAY_INDEX],
-                                   ctx->Texture.Unit[u].Current1DArray);
-         _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_2D_ARRAY_INDEX],
-                                   ctx->Texture.Unit[u].Current2DArray);
+         for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
+            _mesa_copy_texture_object(&texstate->SavedObj[u][tex],
+                                      ctx->Texture.Unit[u].CurrentTex[tex]);
+         }
       }
 
       _mesa_unlock_context_textures(ctx);
@@ -699,26 +776,26 @@ pop_texture_group(GLcontext *ctx, struct texture_state *texstate)
       }
       _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode);
       _mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor);
-      _mesa_TexGeni(GL_S, GL_TEXTURE_GEN_MODE, unit->GenModeS);
-      _mesa_TexGeni(GL_T, GL_TEXTURE_GEN_MODE, unit->GenModeT);
-      _mesa_TexGeni(GL_R, GL_TEXTURE_GEN_MODE, unit->GenModeR);
-      _mesa_TexGeni(GL_Q, GL_TEXTURE_GEN_MODE, unit->GenModeQ);
-      _mesa_TexGenfv(GL_S, GL_OBJECT_PLANE, unit->ObjectPlaneS);
-      _mesa_TexGenfv(GL_T, GL_OBJECT_PLANE, unit->ObjectPlaneT);
-      _mesa_TexGenfv(GL_R, GL_OBJECT_PLANE, unit->ObjectPlaneR);
-      _mesa_TexGenfv(GL_Q, GL_OBJECT_PLANE, unit->ObjectPlaneQ);
+      _mesa_TexGeni(GL_S, GL_TEXTURE_GEN_MODE, unit->GenS.Mode);
+      _mesa_TexGeni(GL_T, GL_TEXTURE_GEN_MODE, unit->GenT.Mode);
+      _mesa_TexGeni(GL_R, GL_TEXTURE_GEN_MODE, unit->GenR.Mode);
+      _mesa_TexGeni(GL_Q, GL_TEXTURE_GEN_MODE, unit->GenQ.Mode);
+      _mesa_TexGenfv(GL_S, GL_OBJECT_PLANE, unit->GenS.ObjectPlane);
+      _mesa_TexGenfv(GL_T, GL_OBJECT_PLANE, unit->GenT.ObjectPlane);
+      _mesa_TexGenfv(GL_R, GL_OBJECT_PLANE, unit->GenR.ObjectPlane);
+      _mesa_TexGenfv(GL_Q, GL_OBJECT_PLANE, unit->GenQ.ObjectPlane);
       /* Eye plane done differently to avoid re-transformation */
       {
          struct gl_texture_unit *destUnit = &ctx->Texture.Unit[u];
-         COPY_4FV(destUnit->EyePlaneS, unit->EyePlaneS);
-         COPY_4FV(destUnit->EyePlaneT, unit->EyePlaneT);
-         COPY_4FV(destUnit->EyePlaneR, unit->EyePlaneR);
-         COPY_4FV(destUnit->EyePlaneQ, unit->EyePlaneQ);
+         COPY_4FV(destUnit->GenS.EyePlane, unit->GenS.EyePlane);
+         COPY_4FV(destUnit->GenT.EyePlane, unit->GenT.EyePlane);
+         COPY_4FV(destUnit->GenR.EyePlane, unit->GenR.EyePlane);
+         COPY_4FV(destUnit->GenQ.EyePlane, unit->GenQ.EyePlane);
          if (ctx->Driver.TexGen) {
-            ctx->Driver.TexGen(ctx, GL_S, GL_EYE_PLANE, unit->EyePlaneS);
-            ctx->Driver.TexGen(ctx, GL_T, GL_EYE_PLANE, unit->EyePlaneT);
-            ctx->Driver.TexGen(ctx, GL_R, GL_EYE_PLANE, unit->EyePlaneR);
-            ctx->Driver.TexGen(ctx, GL_Q, GL_EYE_PLANE, unit->EyePlaneQ);
+            ctx->Driver.TexGen(ctx, GL_S, GL_EYE_PLANE, unit->GenS.EyePlane);
+            ctx->Driver.TexGen(ctx, GL_T, GL_EYE_PLANE, unit->GenT.EyePlane);
+            ctx->Driver.TexGen(ctx, GL_R, GL_EYE_PLANE, unit->GenR.EyePlane);
+            ctx->Driver.TexGen(ctx, GL_Q, GL_EYE_PLANE, unit->GenQ.EyePlane);
          }
       }
       _mesa_set_enable(ctx, GL_TEXTURE_GEN_S,
index 016543da01f2b6cb09dda538ffcc0392a498e30d..c8d160baa9a88c302bc1e094df5ac678df9bd272 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.2
+ * Version:  7.5
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-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"),
@@ -25,7 +26,7 @@
 
 /**
  * \file bufferobj.c
- * \brief Functions for the GL_ARB_vertex_buffer_object extension.
+ * \brief Functions for the GL_ARB_vertex/pixel_buffer_object extensions.
  * \author Brian Paul, Ian Romanick
  */
 
@@ -144,8 +145,7 @@ buffer_object_subdata_range_good( GLcontext * ctx, GLenum target,
 /**
  * Allocate and initialize a new buffer object.
  * 
- * This function is intended to be called via
- * \c dd_function_table::NewBufferObject.
+ * Default callback for the \c dd_function_table::NewBufferObject() hook.
  */
 struct gl_buffer_object *
 _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target )
@@ -163,8 +163,7 @@ _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target )
 /**
  * Delete a buffer object.
  * 
- * This function is intended to be called via
- * \c dd_function_table::DeleteBuffer.
+ * Default callback for the \c dd_function_table::DeleteBuffer() hook.
  */
 void
 _mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj )
@@ -271,9 +270,8 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj,
  * previously stored in the buffer object is lost.  If \c data is \c NULL,
  * memory will be allocated, but no copy will occur.
  *
- * This function is intended to be called via
- * \c dd_function_table::BufferData.  This function need not set GL error
- * codes.  The input parameters will have been tested before calling.
+ * This is the default callback for \c dd_function_table::BufferData()
+ * Note that all GL error checking will have been done already.
  *
  * \param ctx     GL context.
  * \param target  Buffer object target on which to operate.
@@ -312,9 +310,8 @@ _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
  * specified by \c size + \c offset extends beyond the end of the buffer or
  * if \c data is \c NULL, no copy is performed.
  *
- * This function is intended to be called by
- * \c dd_function_table::BufferSubData.  This function need not set GL error
- * codes.  The input parameters will have been tested before calling.
+ * This is the default callback for \c dd_function_table::BufferSubData()
+ * Note that all GL error checking will have been done already.
  *
  * \param ctx     GL context.
  * \param target  Buffer object target on which to operate.
@@ -346,15 +343,14 @@ _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
  * specified by \c size + \c offset extends beyond the end of the buffer or
  * if \c data is \c NULL, no copy is performed.
  *
- * This function is intended to be called by
- * \c dd_function_table::BufferGetSubData.  This function need not set GL error
- * codes.  The input parameters will have been tested before calling.
+ * This is the default callback for \c dd_function_table::GetBufferSubData()
+ * Note that all GL error checking will have been done already.
  *
  * \param ctx     GL context.
  * \param target  Buffer object target on which to operate.
- * \param offset  Offset of the first byte to be modified.
+ * \param offset  Offset of the first byte to be fetched.
  * \param size    Size, in bytes, of the data range.
- * \param data    Pointer to the data to store in the buffer object.
+ * \param data    Destination for data
  * \param bufObj  Object to be used.
  *
  * \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData.
@@ -373,9 +369,7 @@ _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
 
 
 /**
- * Fallback function called via ctx->Driver.MapBuffer().
- * Hardware drivers that really implement buffer objects should never use
- * this function.
+ * Default callback for \c dd_function_tabel::MapBuffer().
  *
  * The function parameters will have been already tested for errors.
  *
@@ -407,9 +401,7 @@ _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access,
 
 
 /**
- * Fallback function called via ctx->Driver.MapBuffer().
- * Hardware drivers that really implement buffer objects should never use
- * function.
+ * Default callback for \c dd_function_table::MapBuffer().
  *
  * The input parameters will have been already tested for errors.
  *
@@ -446,6 +438,7 @@ _mesa_init_buffer_objects( GLcontext *ctx )
    ctx->Array.ElementArrayBufferObj = ctx->Array.NullBufferObj;
 }
 
+
 /**
  * Bind the specified target to buffer for the specified context.
  */
@@ -796,11 +789,18 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
    for (i = 0; i < n; i++) {
       struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]);
       if (bufObj) {
-         /* unbind any vertex pointers bound to this buffer */
          GLuint j;
 
          ASSERT(bufObj->Name == ids[i]);
 
+         if (bufObj->Pointer) {
+            /* if mapped, unmap it now */
+            ctx->Driver.UnmapBuffer(ctx, 0, bufObj);
+            bufObj->Access = DEFAULT_ACCESS;
+            bufObj->Pointer = NULL;
+         }
+
+         /* unbind any vertex pointers bound to this buffer */
          unbind(ctx, &ctx->Array.ArrayObj->Vertex.BufferObj, bufObj);
          unbind(ctx, &ctx->Array.ArrayObj->Normal.BufferObj, bufObj);
          unbind(ctx, &ctx->Array.ArrayObj->Color.BufferObj, bufObj);
@@ -822,6 +822,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
             _mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
          }
 
+         /* unbind any pixel pack/unpack pointers bound to this buffer */
          if (ctx->Pack.BufferObj == bufObj) {
             _mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 );
          }
@@ -951,8 +952,10 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
    }
    
    if (bufObj->Pointer) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer is mapped)" );
-      return;
+      /* Unmap the existing buffer.  We'll replace it now.  Not an error. */
+      ctx->Driver.UnmapBuffer(ctx, target, bufObj);
+      bufObj->Access = DEFAULT_ACCESS;
+      bufObj->Pointer = NULL;
    }  
 
    ASSERT(ctx->Driver.BufferData);
@@ -1068,10 +1071,7 @@ _mesa_UnmapBufferARB(GLenum target)
       return GL_FALSE;
    }
 
-   if (ctx->Driver.UnmapBuffer) {
-      status = ctx->Driver.UnmapBuffer( ctx, target, bufObj );
-   }
-
+   status = ctx->Driver.UnmapBuffer( ctx, target, bufObj );
    bufObj->Access = DEFAULT_ACCESS;
    bufObj->Pointer = NULL;
 
index 818d068a12b635632d92fb56298192e8d5316a95..c5f13345f0481cf9a9316f2c6d21d4dbc21231f3 100644 (file)
@@ -120,11 +120,9 @@ draw_buffer_enum_to_bitmask(GLenum buffer)
       case GL_AUX0:
          return BUFFER_BIT_AUX0;
       case GL_AUX1:
-         return BUFFER_BIT_AUX1;
       case GL_AUX2:
-         return BUFFER_BIT_AUX2;
       case GL_AUX3:
-         return BUFFER_BIT_AUX3;
+         return 1 << BUFFER_COUNT; /* invalid, but not BAD_MASK */
       case GL_COLOR_ATTACHMENT0_EXT:
          return BUFFER_BIT_COLOR0;
       case GL_COLOR_ATTACHMENT1_EXT:
@@ -177,11 +175,9 @@ read_buffer_enum_to_index(GLenum buffer)
       case GL_AUX0:
          return BUFFER_AUX0;
       case GL_AUX1:
-         return BUFFER_AUX1;
       case GL_AUX2:
-         return BUFFER_AUX2;
       case GL_AUX3:
-         return BUFFER_AUX3;
+         return BUFFER_COUNT; /* invalid, but not -1 */
       case GL_COLOR_ATTACHMENT0_EXT:
          return BUFFER_COLOR0;
       case GL_COLOR_ATTACHMENT1_EXT:
@@ -290,7 +286,10 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers)
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   if (n < 1 || n > (GLsizei) ctx->Const.MaxDrawBuffers) {
+   /* Turns out n==0 is a valid input that should not produce an error.
+    * The remaining code below correctly handles the n==0 case.
+    */
+   if (n < 0 || n > (GLsizei) ctx->Const.MaxDrawBuffers) {
       _mesa_error(ctx, GL_INVALID_VALUE, "glDrawBuffersARB(n)");
       return;
    }
@@ -332,12 +331,14 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers)
    _mesa_drawbuffers(ctx, n, buffers, destMask);
 
    /*
-    * Call device driver function.
+    * Call device driver function.  Note that n can be equal to 0,
+    * in which case we don't want to reference buffers[0], which
+    * may not be valid.
     */
    if (ctx->Driver.DrawBuffers)
       ctx->Driver.DrawBuffers(ctx, n, buffers);
    else if (ctx->Driver.DrawBuffer)
-      ctx->Driver.DrawBuffer(ctx, buffers[0]);
+      ctx->Driver.DrawBuffer(ctx, n>0? buffers[0]:GL_NONE);
 }
 
 
index 43ef55ee3b542c7a9b32c3b7c5015bbbf82b3696..96c80e6ef8dd1a8f1c6e120156bddb856210548c 100644 (file)
@@ -29,7 +29,6 @@
 #include "macros.h"
 #include "mtypes.h"
 
-#include "math/m_xform.h"
 #include "math/m_matrix.h"
 
 
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
new file mode 100644 (file)
index 0000000..39b19bb
--- /dev/null
@@ -0,0 +1,479 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 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, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file compiler.h
+ * Compiler-related stuff.
+ */
+
+
+#ifndef COMPILER_H
+#define COMPILER_H
+
+
+#include <assert.h>
+#include <ctype.h>
+#if defined(__alpha__) && defined(CCPML)
+#include <cpml.h> /* use Compaq's Fast Math Library on Alpha */
+#else
+#include <math.h>
+#endif
+#include <limits.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#if defined(__linux__) && defined(__i386__)
+#include <fpu_control.h>
+#endif
+#include <float.h>
+#include <stdarg.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * Get standard integer types
+ */
+#if defined(_MSC_VER)
+   typedef __int8             int8_t;
+   typedef unsigned __int8    uint8_t;
+   typedef __int16            int16_t;
+   typedef unsigned __int16   uint16_t;
+#  ifndef __eglplatform_h_
+     typedef __int32            int32_t;
+#  endif
+   typedef unsigned __int32   uint32_t;
+   typedef __int64            int64_t;
+   typedef unsigned __int64   uint64_t;
+
+#  if defined(_WIN64)
+     typedef __int64            intptr_t;
+     typedef unsigned __int64   uintptr_t;
+#  else
+     typedef __int32            intptr_t;
+     typedef unsigned __int32   uintptr_t;
+#  endif
+
+#  define INT64_C(__val) __val##i64
+#  define UINT64_C(__val) __val##ui64
+#else
+#  include <stdint.h>
+#endif
+
+
+/**
+  * Sun compilers define __i386 instead of the gcc-style __i386__
+ */
+#ifdef __SUNPRO_C
+# if !defined(__i386__) && defined(__i386)
+#  define __i386__
+# elif !defined(__amd64__) && defined(__amd64)
+#  define __amd64__
+# elif !defined(__sparc__) && defined(__sparc)
+#  define __sparc__
+# endif
+# if !defined(__volatile)
+#  define __volatile volatile
+# endif
+#endif
+
+
+/**
+ * finite macro.
+ */
+#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
+#  define __WIN32__
+#  define finite _finite
+#endif
+#if defined(__WATCOMC__)
+#  define finite _finite
+#  pragma disable_message(201) /* Disable unreachable code warnings */
+#endif
+
+
+/**
+ * Disable assorted warnings
+ */
+#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
+#  if !defined(__GNUC__) /* mingw environment */
+#    pragma warning( disable : 4068 ) /* unknown pragma */
+#    pragma warning( disable : 4710 ) /* function 'foo' not inlined */
+#    pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */
+#    pragma warning( disable : 4127 ) /* conditional expression is constant */
+#    if defined(MESA_MINWARN)
+#      pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
+#      pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
+#      pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
+#      pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */
+#      pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
+#    endif
+#  endif
+#endif
+
+
+/**
+ * Function inlining
+ */
+#if defined(__GNUC__)
+#  define INLINE __inline__
+#elif defined(__MSC__)
+#  define INLINE __inline
+#elif defined(_MSC_VER)
+#  define INLINE __inline
+#elif defined(__ICL)
+#  define INLINE __inline
+#elif defined(__INTEL_COMPILER)
+#  define INLINE inline
+#elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
+#  define INLINE __inline
+#elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
+#  define INLINE inline
+#  define __inline inline
+#  define __inline__ inline
+#elif (__STDC_VERSION__ >= 199901L) /* C99 */
+#  define INLINE inline
+#else
+#  define INLINE
+#endif
+
+
+/**
+ * PUBLIC/USED macros
+ *
+ * If we build the library with gcc's -fvisibility=hidden flag, we'll
+ * use the PUBLIC macro to mark functions that are to be exported.
+ *
+ * We also need to define a USED attribute, so the optimizer doesn't 
+ * inline a static function that we later use in an alias. - ajax
+ */
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
+#  define PUBLIC __attribute__((visibility("default")))
+#  define USED __attribute__((used))
+#else
+#  define PUBLIC
+#  define USED
+#endif
+
+
+/**
+ * Some compilers don't like some of Mesa's const usage.  In those places use
+ * CONST instead of const.  Pass -DNO_CONST to compilers where this matters.
+ */
+#ifdef NO_CONST
+#  define CONST
+#else
+#  define CONST const
+#endif
+
+
+/**
+ * __builtin_expect macros
+ */
+#if (!defined(__GNUC__) || __GNUC__ < 3) && (!defined(__IBMC__) || __IBMC__ < 900)
+#  define __builtin_expect(x, y) x
+#endif
+
+
+/**
+ * The __FUNCTION__ gcc variable is generally only used for debugging.
+ * If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
+ * Don't define it if using a newer Windows compiler.
+ */
+#ifndef __FUNCTION__
+# if defined(__VMS)
+#  define __FUNCTION__ "VMS$NL:"
+# elif ((!defined __GNUC__) || (__GNUC__ < 2)) && (!defined __xlC__) && \
+      (!defined(_MSC_VER) || _MSC_VER < 1300)
+#  if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
+    (defined(__SUNPRO_C) && defined(__C99FEATURES__))
+#   define __FUNCTION__ __func__
+#  else
+#   define __FUNCTION__ "<unknown>"
+#  endif
+# endif
+#endif
+
+
+/**
+ * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
+ * Do not use them unless absolutely necessary!
+ * Try to use a runtime test instead.
+ * For now, only used by some DRI hardware drivers for color/texel packing.
+ */
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
+#if defined(__linux__)
+#include <byteswap.h>
+#define CPU_TO_LE32( x )       bswap_32( x )
+#else /*__linux__*/
+#include <sys/endian.h>
+#define CPU_TO_LE32( x )       bswap32( x )
+#endif /*__linux__*/
+#define MESA_BIG_ENDIAN 1
+#else
+#define CPU_TO_LE32( x )       ( x )
+#define MESA_LITTLE_ENDIAN 1
+#endif
+#define LE32_TO_CPU( x )       CPU_TO_LE32( x )
+
+
+
+#if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP)
+#define CAPI _cdecl
+#endif
+
+
+/**
+ * Create a macro so that asm functions can be linked into compilers other
+ * than GNU C
+ */
+#ifndef _ASMAPI
+#if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/
+#define _ASMAPI __cdecl
+#else
+#define _ASMAPI
+#endif
+#ifdef PTR_DECL_IN_FRONT
+#define        _ASMAPIP * _ASMAPI
+#else
+#define        _ASMAPIP _ASMAPI *
+#endif
+#endif
+
+#ifdef USE_X86_ASM
+#define _NORMAPI _ASMAPI
+#define _NORMAPIP _ASMAPIP
+#else
+#define _NORMAPI
+#define _NORMAPIP *
+#endif
+
+
+/* This is a macro on IRIX */
+#ifdef _P
+#undef _P
+#endif
+
+
+/* Turn off macro checking systems used by other libraries */
+#ifdef CHECK
+#undef CHECK
+#endif
+
+
+/**
+ * ASSERT macro
+ */
+#if !defined(_WIN32_WCE)
+#if defined(BUILD_FOR_SNAP) && defined(CHECKED)
+#  define ASSERT(X)   _CHECK(X) 
+#elif defined(DEBUG)
+#  define ASSERT(X)   assert(X)
+#else
+#  define ASSERT(X)
+#endif
+#endif
+
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+
+/**
+ * LONGSTRING macro
+ * gcc -pedantic warns about long string literals, LONGSTRING silences that.
+ */
+#if !defined(__GNUC__) || (__GNUC__ < 2) || \
+    ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7))
+# define LONGSTRING
+#else
+# define LONGSTRING __extension__
+#endif
+
+
+#ifndef M_PI
+#define M_PI (3.1415926536)
+#endif
+
+#ifndef M_E
+#define M_E (2.7182818284590452354)
+#endif
+
+#ifndef ONE_DIV_LN2
+#define ONE_DIV_LN2 (1.442695040888963456)
+#endif
+
+#ifndef ONE_DIV_SQRT_LN2
+#define ONE_DIV_SQRT_LN2 (1.201122408786449815)
+#endif
+
+#ifndef FLT_MAX_EXP
+#define FLT_MAX_EXP 128
+#endif
+
+
+/**
+ * USE_IEEE: Determine if we're using IEEE floating point
+ */
+#if defined(__i386__) || defined(__386__) || defined(__sparc__) || \
+    defined(__s390x__) || defined(__powerpc__) || \
+    defined(__x86_64__) || \
+    defined(ia64) || defined(__ia64__) || \
+    defined(__hppa__) || defined(hpux) || \
+    defined(__mips) || defined(_MIPS_ARCH) || \
+    defined(__arm__) || \
+    defined(__sh__) || defined(__m32r__) || \
+    (defined(__sun) && defined(_IEEE_754)) || \
+    (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS)))
+#define USE_IEEE
+#define IEEE_ONE 0x3f800000
+#endif
+
+
+/**
+ * START/END_FAST_MATH macros:
+ *
+ * START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save
+ *                  original mode to a temporary).
+ * END_FAST_MATH: Restore x86 FPU to original mode.
+ */
+#if defined(__GNUC__) && defined(__i386__)
+/*
+ * Set the x86 FPU control word to guarentee only 32 bits of precision
+ * are stored in registers.  Allowing the FPU to store more introduces
+ * differences between situations where numbers are pulled out of memory
+ * vs. situations where the compiler is able to optimize register usage.
+ *
+ * In the worst case, we force the compiler to use a memory access to
+ * truncate the float, by specifying the 'volatile' keyword.
+ */
+/* Hardware default: All exceptions masked, extended double precision,
+ * round to nearest (IEEE compliant):
+ */
+#define DEFAULT_X86_FPU                0x037f
+/* All exceptions masked, single precision, round to nearest:
+ */
+#define FAST_X86_FPU           0x003f
+/* The fldcw instruction will cause any pending FP exceptions to be
+ * raised prior to entering the block, and we clear any pending
+ * exceptions before exiting the block.  Hence, asm code has free
+ * reign over the FPU while in the fast math block.
+ */
+#if defined(NO_FAST_MATH)
+#define START_FAST_MATH(x)                                             \
+do {                                                                   \
+   static GLuint mask = DEFAULT_X86_FPU;                               \
+   __asm__ ( "fnstcw %0" : "=m" (*&(x)) );                             \
+   __asm__ ( "fldcw %0" : : "m" (mask) );                              \
+} while (0)
+#else
+#define START_FAST_MATH(x)                                             \
+do {                                                                   \
+   static GLuint mask = FAST_X86_FPU;                                  \
+   __asm__ ( "fnstcw %0" : "=m" (*&(x)) );                             \
+   __asm__ ( "fldcw %0" : : "m" (mask) );                              \
+} while (0)
+#endif
+/* Restore original FPU mode, and clear any exceptions that may have
+ * occurred in the FAST_MATH block.
+ */
+#define END_FAST_MATH(x)                                               \
+do {                                                                   \
+   __asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) );                    \
+} while (0)
+
+#elif defined(__WATCOMC__) && defined(__386__)
+#define DEFAULT_X86_FPU                0x037f /* See GCC comments above */
+#define FAST_X86_FPU           0x003f /* See GCC comments above */
+void _watcom_start_fast_math(unsigned short *x,unsigned short *mask);
+#pragma aux _watcom_start_fast_math =                                   \
+   "fnstcw  word ptr [eax]"                                             \
+   "fldcw   word ptr [ecx]"                                             \
+   parm [eax] [ecx]                                                     \
+   modify exact [];
+void _watcom_end_fast_math(unsigned short *x);
+#pragma aux _watcom_end_fast_math =                                     \
+   "fnclex"                                                             \
+   "fldcw   word ptr [eax]"                                             \
+   parm [eax]                                                           \
+   modify exact [];
+#if defined(NO_FAST_MATH)
+#define START_FAST_MATH(x)                                              \
+do {                                                                    \
+   static GLushort mask = DEFAULT_X86_FPU;                             \
+   _watcom_start_fast_math(&x,&mask);                                   \
+} while (0)
+#else
+#define START_FAST_MATH(x)                                              \
+do {                                                                    \
+   static GLushort mask = FAST_X86_FPU;                                 \
+   _watcom_start_fast_math(&x,&mask);                                   \
+} while (0)
+#endif
+#define END_FAST_MATH(x)  _watcom_end_fast_math(&x)
+
+#elif defined(_MSC_VER) && defined(_M_IX86)
+#define DEFAULT_X86_FPU                0x037f /* See GCC comments above */
+#define FAST_X86_FPU           0x003f /* See GCC comments above */
+#if defined(NO_FAST_MATH)
+#define START_FAST_MATH(x) do {\
+       static GLuint mask = DEFAULT_X86_FPU;\
+       __asm fnstcw word ptr [x]\
+       __asm fldcw word ptr [mask]\
+} while(0)
+#else
+#define START_FAST_MATH(x) do {\
+       static GLuint mask = FAST_X86_FPU;\
+       __asm fnstcw word ptr [x]\
+       __asm fldcw word ptr [mask]\
+} while(0)
+#endif
+#define END_FAST_MATH(x) do {\
+       __asm fnclex\
+       __asm fldcw word ptr [x]\
+} while(0)
+
+#else
+#define START_FAST_MATH(x)  x = 0
+#define END_FAST_MATH(x)  (void)(x)
+#endif
+
+
+
+#define Elements(x) (sizeof(x)/sizeof(*(x)))
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* COMPILER_H */
index c3feffda9869e1e4a7729ae9329db17e62e448c7..fc31155b35bd88204adfdbae4201c98a7e5995ae 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.3
+ * Version:  7.5
  *
  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  * Copyright (C) 2008  VMware, Inc.  All Rights Reserved.
@@ -32,9 +32,6 @@
 #define MESA_CONFIG_H_INCLUDED
 
 
-#include "main/mfeatures.h"
-
-
 /**
  * \name OpenGL implementation limits
  */
@@ -71,7 +68,7 @@
 #define MAX_PIXEL_MAP_TABLE 256
 
 /** Maximum number of auxillary color buffers */
-#define MAX_AUX_BUFFERS 4
+#define MAX_AUX_BUFFERS 1
 
 /** Maximum order (degree) of curves */
 #ifdef AMIGA
 #define MAX_COLOR_TABLE_SIZE 256
 
 /** Number of 1D/2D texture mipmap levels */
-#define MAX_TEXTURE_LEVELS 12
+#define MAX_TEXTURE_LEVELS 13
 
 /** Number of 3D texture mipmap levels */
 #define MAX_3D_TEXTURE_LEVELS 9
 
 /** Number of cube texture mipmap levels - GL_ARB_texture_cube_map */
-#define MAX_CUBE_TEXTURE_LEVELS 12
+#define MAX_CUBE_TEXTURE_LEVELS 13
 
 /** Maximum rectangular texture size - GL_NV_texture_rectangle */
-#define MAX_TEXTURE_RECT_SIZE 2048
+#define MAX_TEXTURE_RECT_SIZE 4096
 
 /** Maximum number of layers in a 1D or 2D array texture - GL_MESA_texture_array */
 #define MAX_ARRAY_TEXTURE_LAYERS 64
 #define MAX_TEXTURE_MAX_ANISOTROPY 16.0
 
 /** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */
-#define MAX_TEXTURE_LOD_BIAS 11.0
+#define MAX_TEXTURE_LOD_BIAS 12.0
 
 /** For GL_ARB_vertex_program */
 /*@{*/
 #define MAX_PROGRAM_CALL_DEPTH 8
 #define MAX_PROGRAM_TEMPS 128
 #define MAX_PROGRAM_ADDRESS_REGS 2
-#define MAX_UNIFORMS 256   /**< number of vec4 uniforms */
+#define MAX_UNIFORMS 1024  /**< number of vec4 uniforms */
 #define MAX_VARYING 8      /**< number of float[4] vectors */
 #define MAX_SAMPLERS MAX_TEXTURE_IMAGE_UNITS
 #define MAX_PROGRAM_INPUTS 32
 #define MAX_COLOR_ATTACHMENTS 8
 /*@}*/
 
-
+/** For GL_ATI_envmap_bump - support bump mapping on first 8 units */
+#define SUPPORTED_ATI_BUMP_UNITS 0xff
 
 /**
  * \name Mesa-specific parameters
index c5b90d9cda79511950281c98b06f9742ac6d5d7d..b24a3b4409bd103dca34d915ff4f9d1d91af5204 100644 (file)
@@ -77,6 +77,7 @@
 
 
 #include "glheader.h"
+#include "mfeatures.h"
 #include "imports.h"
 #if FEATURE_accum
 #include "accum.h"
@@ -93,6 +94,7 @@
 #include "colortab.h"
 #endif
 #include "context.h"
+#include "cpuinfo.h"
 #include "debug.h"
 #include "depth.h"
 #if FEATURE_dlist
 #include "rastpos.h"
 #endif
 #include "scissor.h"
+#include "shared.h"
 #include "simple_list.h"
 #include "state.h"
 #include "stencil.h"
 #include "mtypes.h"
 #include "varray.h"
 #include "version.h"
+#include "viewport.h"
 #include "vtxfmt.h"
 #include "glapi/glthread.h"
 #include "glapi/glapioffsets.h"
@@ -175,7 +179,7 @@ GLfloat _mesa_ubyte_to_float_color_tab[256];
 /**
  * Swap buffers notification callback.
  * 
- * \param gc GL context.
+ * \param ctx GL context.
  *
  * Called by window system just before swapping buffers.
  * We have to finish any pending rendering.
@@ -183,6 +187,7 @@ GLfloat _mesa_ubyte_to_float_color_tab[256];
 void
 _mesa_notifySwapBuffers(__GLcontext *ctx)
 {
+   FLUSH_VERTICES( ctx, 0 );
    if (ctx->Driver.Flush) {
       ctx->Driver.Flush(ctx);
    }
@@ -349,6 +354,36 @@ _mesa_destroy_visual( GLvisual *vis )
 /**********************************************************************/
 /*@{*/
 
+
+/**
+ * This is lame.  gdb only seems to recognize enum types that are
+ * actually used somewhere.  We want to be able to print/use enum
+ * values such as TEXTURE_2D_INDEX in gdb.  But we don't actually use
+ * the gl_texture_index type anywhere.  Thus, this lame function.
+ */
+static void
+dummy_enum_func(void)
+{
+   gl_buffer_index bi;
+   gl_colortable_index ci;
+   gl_face_index fi;
+   gl_frag_attrib fa;
+   gl_frag_result fr;
+   gl_texture_index ti;
+   gl_vert_attrib va;
+   gl_vert_result vr;
+
+   (void) bi;
+   (void) ci;
+   (void) fi;
+   (void) fa;
+   (void) fr;
+   (void) ti;
+   (void) va;
+   (void) vr;
+}
+
+
 /**
  * One-time initialization mutex lock.
  *
@@ -382,15 +417,14 @@ one_time_init( GLcontext *ctx )
       assert( sizeof(GLint) == 4 );
       assert( sizeof(GLuint) == 4 );
 
+      _mesa_get_cpu_features();
+
       _mesa_init_sqrt_table();
 
       for (i = 0; i < 256; i++) {
          _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
       }
 
-#ifdef USE_SPARC_ASM
-      _mesa_init_sparc_glapi_relocs();
-#endif
       if (_mesa_getenv("MESA_DEBUG")) {
          _glapi_noop_enable_warnings(GL_TRUE);
          _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning );
@@ -407,384 +441,8 @@ one_time_init( GLcontext *ctx )
       alreadyCalled = GL_TRUE;
    }
    _glthread_UNLOCK_MUTEX(OneTimeLock);
-}
-
-
-/**
- * Allocate and initialize a shared context state structure.
- * Initializes the display list, texture objects and vertex programs hash
- * tables, allocates the texture objects. If it runs out of memory, frees
- * everything already allocated before returning NULL.
- *
- * \return pointer to a gl_shared_state structure on success, or NULL on
- * failure.
- */
-static GLboolean
-alloc_shared_state( GLcontext *ctx )
-{
-   struct gl_shared_state *ss = CALLOC_STRUCT(gl_shared_state);
-   if (!ss)
-      return GL_FALSE;
-
-   ctx->Shared = ss;
-
-   _glthread_INIT_MUTEX(ss->Mutex);
 
-   ss->DisplayList = _mesa_NewHashTable();
-   ss->TexObjects = _mesa_NewHashTable();
-   ss->Programs = _mesa_NewHashTable();
-
-#if FEATURE_ARB_vertex_program
-   ss->DefaultVertexProgram = (struct gl_vertex_program *)
-      ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
-   if (!ss->DefaultVertexProgram)
-      goto cleanup;
-#endif
-#if FEATURE_ARB_fragment_program
-   ss->DefaultFragmentProgram = (struct gl_fragment_program *)
-      ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
-   if (!ss->DefaultFragmentProgram)
-      goto cleanup;
-#endif
-#if FEATURE_ATI_fragment_shader
-   ss->ATIShaders = _mesa_NewHashTable();
-   ss->DefaultFragmentShader = _mesa_new_ati_fragment_shader(ctx, 0);
-   if (!ss->DefaultFragmentShader)
-      goto cleanup;
-#endif
-
-#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object
-   ss->BufferObjects = _mesa_NewHashTable();
-#endif
-
-   ss->ArrayObjects = _mesa_NewHashTable();
-
-#if FEATURE_ARB_shader_objects
-   ss->ShaderObjects = _mesa_NewHashTable();
-#endif
-
-   ss->Default1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D);
-   if (!ss->Default1D)
-      goto cleanup;
-
-   ss->Default2D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D);
-   if (!ss->Default2D)
-      goto cleanup;
-
-   ss->Default3D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_3D);
-   if (!ss->Default3D)
-      goto cleanup;
-
-   ss->DefaultCubeMap = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_CUBE_MAP_ARB);
-   if (!ss->DefaultCubeMap)
-      goto cleanup;
-
-   ss->DefaultRect = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_RECTANGLE_NV);
-   if (!ss->DefaultRect)
-      goto cleanup;
-
-   ss->Default1DArray = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D_ARRAY_EXT);
-   if (!ss->Default1DArray)
-      goto cleanup;
-
-   ss->Default2DArray = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D_ARRAY_EXT);
-   if (!ss->Default2DArray)
-      goto cleanup;
-
-   /* sanity check */
-   assert(ss->Default1D->RefCount == 1);
-
-   _glthread_INIT_MUTEX(ss->TexMutex);
-   ss->TextureStateStamp = 0;
-
-#if FEATURE_EXT_framebuffer_object
-   ss->FrameBuffers = _mesa_NewHashTable();
-   if (!ss->FrameBuffers)
-      goto cleanup;
-   ss->RenderBuffers = _mesa_NewHashTable();
-   if (!ss->RenderBuffers)
-      goto cleanup;
-#endif
-
-   return GL_TRUE;
-
-cleanup:
-   /* Ran out of memory at some point.  Free everything and return NULL */
-   if (ss->DisplayList)
-      _mesa_DeleteHashTable(ss->DisplayList);
-   if (ss->TexObjects)
-      _mesa_DeleteHashTable(ss->TexObjects);
-   if (ss->Programs)
-      _mesa_DeleteHashTable(ss->Programs);
-#if FEATURE_ARB_vertex_program
-   _mesa_reference_vertprog(ctx, &ss->DefaultVertexProgram, NULL);
-#endif
-#if FEATURE_ARB_fragment_program
-   _mesa_reference_fragprog(ctx, &ss->DefaultFragmentProgram, NULL);
-#endif
-#if FEATURE_ATI_fragment_shader
-   if (ss->DefaultFragmentShader)
-      _mesa_delete_ati_fragment_shader(ctx, ss->DefaultFragmentShader);
-#endif
-#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object
-   if (ss->BufferObjects)
-      _mesa_DeleteHashTable(ss->BufferObjects);
-#endif
-
-   if (ss->ArrayObjects)
-      _mesa_DeleteHashTable (ss->ArrayObjects);
-
-#if FEATURE_ARB_shader_objects
-   if (ss->ShaderObjects)
-      _mesa_DeleteHashTable (ss->ShaderObjects);
-#endif
-
-#if FEATURE_EXT_framebuffer_object
-   if (ss->FrameBuffers)
-      _mesa_DeleteHashTable(ss->FrameBuffers);
-   if (ss->RenderBuffers)
-      _mesa_DeleteHashTable(ss->RenderBuffers);
-#endif
-
-   if (ss->Default1D)
-      (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D);
-   if (ss->Default2D)
-      (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D);
-   if (ss->Default3D)
-      (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D);
-   if (ss->DefaultCubeMap)
-      (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap);
-   if (ss->DefaultRect)
-      (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect);
-   if (ss->Default1DArray)
-      (*ctx->Driver.DeleteTexture)(ctx, ss->Default1DArray);
-   if (ss->Default2DArray)
-      (*ctx->Driver.DeleteTexture)(ctx, ss->Default2DArray);
-
-   _mesa_free(ss);
-
-   return GL_FALSE;
-}
-
-
-/**
- * Callback for deleting a display list.  Called by _mesa_HashDeleteAll().
- */
-static void
-delete_displaylist_cb(GLuint id, void *data, void *userData)
-{
-#if FEATURE_dlist
-   struct gl_display_list *list = (struct gl_display_list *) data;
-   GLcontext *ctx = (GLcontext *) userData;
-   _mesa_delete_list(ctx, list);
-#endif
-}
-
-/**
- * Callback for deleting a texture object.  Called by _mesa_HashDeleteAll().
- */
-static void
-delete_texture_cb(GLuint id, void *data, void *userData)
-{
-   struct gl_texture_object *texObj = (struct gl_texture_object *) data;
-   GLcontext *ctx = (GLcontext *) userData;
-   ctx->Driver.DeleteTexture(ctx, texObj);
-}
-
-/**
- * Callback for deleting a program object.  Called by _mesa_HashDeleteAll().
- */
-static void
-delete_program_cb(GLuint id, void *data, void *userData)
-{
-   struct gl_program *prog = (struct gl_program *) data;
-   GLcontext *ctx = (GLcontext *) userData;
-   ASSERT(prog->RefCount == 1); /* should only be referenced by hash table */
-   prog->RefCount = 0;  /* now going away */
-   ctx->Driver.DeleteProgram(ctx, prog);
-}
-
-#if FEATURE_ATI_fragment_shader
-/**
- * Callback for deleting an ATI fragment shader object.
- * Called by _mesa_HashDeleteAll().
- */
-static void
-delete_fragshader_cb(GLuint id, void *data, void *userData)
-{
-   struct ati_fragment_shader *shader = (struct ati_fragment_shader *) data;
-   GLcontext *ctx = (GLcontext *) userData;
-   _mesa_delete_ati_fragment_shader(ctx, shader);
-}
-#endif
-
-/**
- * Callback for deleting a buffer object.  Called by _mesa_HashDeleteAll().
- */
-static void
-delete_bufferobj_cb(GLuint id, void *data, void *userData)
-{
-   struct gl_buffer_object *bufObj = (struct gl_buffer_object *) data;
-   GLcontext *ctx = (GLcontext *) userData;
-   ctx->Driver.DeleteBuffer(ctx, bufObj);
-}
-
-/**
- * Callback for deleting an array object.  Called by _mesa_HashDeleteAll().
- */
-static void
-delete_arrayobj_cb(GLuint id, void *data, void *userData)
-{
-   struct gl_array_object *arrayObj = (struct gl_array_object *) data;
-   GLcontext *ctx = (GLcontext *) userData;
-   _mesa_delete_array_object(ctx, arrayObj);
-}
-
-/**
- * Callback for freeing shader program data. Call it before delete_shader_cb
- * to avoid memory access error.
- */
-static void
-free_shader_program_data_cb(GLuint id, void *data, void *userData)
-{
-   GLcontext *ctx = (GLcontext *) userData;
-   struct gl_shader_program *shProg = (struct gl_shader_program *) data;
-
-   if (shProg->Type == GL_SHADER_PROGRAM_MESA) {
-       _mesa_free_shader_program_data(ctx, shProg);
-   }
-}
-
-/**
- * Callback for deleting shader and shader programs objects.
- * Called by _mesa_HashDeleteAll().
- */
-static void
-delete_shader_cb(GLuint id, void *data, void *userData)
-{
-   GLcontext *ctx = (GLcontext *) userData;
-   struct gl_shader *sh = (struct gl_shader *) data;
-   if (sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER) {
-      _mesa_free_shader(ctx, sh);
-   }
-   else {
-      struct gl_shader_program *shProg = (struct gl_shader_program *) data;
-      ASSERT(shProg->Type == GL_SHADER_PROGRAM_MESA);
-      _mesa_free_shader_program(ctx, shProg);
-   }
-}
-
-/**
- * Callback for deleting a framebuffer object.  Called by _mesa_HashDeleteAll()
- */
-static void
-delete_framebuffer_cb(GLuint id, void *data, void *userData)
-{
-   struct gl_framebuffer *fb = (struct gl_framebuffer *) data;
-   /* The fact that the framebuffer is in the hashtable means its refcount
-    * is one, but we're removing from the hashtable now.  So clear refcount.
-    */
-   /*assert(fb->RefCount == 1);*/
-   fb->RefCount = 0;
-
-   /* NOTE: Delete should always be defined but there are two reports
-    * of it being NULL (bugs 13507, 14293).  Work-around for now.
-    */
-   if (fb->Delete)
-      fb->Delete(fb);
-}
-
-/**
- * Callback for deleting a renderbuffer object. Called by _mesa_HashDeleteAll()
- */
-static void
-delete_renderbuffer_cb(GLuint id, void *data, void *userData)
-{
-   struct gl_renderbuffer *rb = (struct gl_renderbuffer *) data;
-   rb->RefCount = 0;  /* see comment for FBOs above */
-   if (rb->Delete)
-      rb->Delete(rb);
-}
-
-
-/**
- * Deallocate a shared state object and all children structures.
- *
- * \param ctx GL context.
- * \param ss shared state pointer.
- * 
- * Frees the display lists, the texture objects (calling the driver texture
- * deletion callback to free its private data) and the vertex programs, as well
- * as their hash tables.
- *
- * \sa alloc_shared_state().
- */
-static void
-free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
-{
-   /*
-    * Free display lists
-    */
-   _mesa_HashDeleteAll(ss->DisplayList, delete_displaylist_cb, ctx);
-   _mesa_DeleteHashTable(ss->DisplayList);
-
-#if FEATURE_ARB_shader_objects
-   _mesa_HashWalk(ss->ShaderObjects, free_shader_program_data_cb, ctx);
-   _mesa_HashDeleteAll(ss->ShaderObjects, delete_shader_cb, ctx);
-   _mesa_DeleteHashTable(ss->ShaderObjects);
-#endif
-
-   _mesa_HashDeleteAll(ss->Programs, delete_program_cb, ctx);
-   _mesa_DeleteHashTable(ss->Programs);
-
-#if FEATURE_ARB_vertex_program
-   _mesa_reference_vertprog(ctx, &ss->DefaultVertexProgram, NULL);
-#endif
-#if FEATURE_ARB_fragment_program
-   _mesa_reference_fragprog(ctx, &ss->DefaultFragmentProgram, NULL);
-#endif
-
-#if FEATURE_ATI_fragment_shader
-   _mesa_HashDeleteAll(ss->ATIShaders, delete_fragshader_cb, ctx);
-   _mesa_DeleteHashTable(ss->ATIShaders);
-   _mesa_delete_ati_fragment_shader(ctx, ss->DefaultFragmentShader);
-#endif
-
-#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object
-   _mesa_HashDeleteAll(ss->BufferObjects, delete_bufferobj_cb, ctx);
-   _mesa_DeleteHashTable(ss->BufferObjects);
-#endif
-
-   _mesa_HashDeleteAll(ss->ArrayObjects, delete_arrayobj_cb, ctx);
-   _mesa_DeleteHashTable(ss->ArrayObjects);
-
-#if FEATURE_EXT_framebuffer_object
-   _mesa_HashDeleteAll(ss->FrameBuffers, delete_framebuffer_cb, ctx);
-   _mesa_DeleteHashTable(ss->FrameBuffers);
-   _mesa_HashDeleteAll(ss->RenderBuffers, delete_renderbuffer_cb, ctx);
-   _mesa_DeleteHashTable(ss->RenderBuffers);
-#endif
-
-   /*
-    * Free texture objects (after FBOs since some textures might have
-    * been bound to FBOs).
-    */
-   ASSERT(ctx->Driver.DeleteTexture);
-   /* the default textures */
-   ctx->Driver.DeleteTexture(ctx, ss->Default1D);
-   ctx->Driver.DeleteTexture(ctx, ss->Default2D);
-   ctx->Driver.DeleteTexture(ctx, ss->Default3D);
-   ctx->Driver.DeleteTexture(ctx, ss->DefaultCubeMap);
-   ctx->Driver.DeleteTexture(ctx, ss->DefaultRect);
-   ctx->Driver.DeleteTexture(ctx, ss->Default1DArray);
-   ctx->Driver.DeleteTexture(ctx, ss->Default2DArray);
-   /* all other textures */
-   _mesa_HashDeleteAll(ss->TexObjects, delete_texture_cb, ctx);
-   _mesa_DeleteHashTable(ss->TexObjects);
-
-   _glthread_DESTROY_MUTEX(ss->Mutex);
-
-   _mesa_free(ss);
+   dummy_enum_func();
 }
 
 
@@ -863,6 +521,9 @@ _mesa_init_constants(GLcontext *ctx)
    assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS);
    assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS);
 
+   /* Max texture size should be <= max viewport size (render to texture) */
+   assert((1 << (MAX_TEXTURE_LEVELS - 1)) <= MAX_WIDTH);
+
    /* Constants, may be overriden (usually only reduced) by device drivers */
    ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
    ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
@@ -928,6 +589,9 @@ _mesa_init_constants(GLcontext *ctx)
    /* GL_ARB_framebuffer_object */
    ctx->Const.MaxSamples = 0;
 
+   /* GL_ATI_envmap_bumpmap */
+   ctx->Const.SupportedBumpUnits = SUPPORTED_ATI_BUMP_UNITS;
+
    /* sanity checks */
    ASSERT(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.MaxTextureImageUnits,
                                              ctx->Const.MaxTextureCoordUnits));
@@ -959,13 +623,18 @@ check_context_limits(GLcontext *ctx)
    /* number of coord units cannot be greater than number of image units */
    assert(ctx->Const.MaxTextureCoordUnits <= ctx->Const.MaxTextureImageUnits);
 
-   assert(ctx->Const.MaxViewportWidth <= MAX_WIDTH);
-   assert(ctx->Const.MaxViewportHeight <= MAX_WIDTH);
+   assert(ctx->Const.MaxTextureLevels <= MAX_TEXTURE_LEVELS);
+   assert(ctx->Const.Max3DTextureLevels <= MAX_3D_TEXTURE_LEVELS);
+   assert(ctx->Const.MaxCubeTextureLevels <= MAX_CUBE_TEXTURE_LEVELS);
+   assert(ctx->Const.MaxTextureRectSize <= MAX_TEXTURE_RECT_SIZE);
 
    /* make sure largest texture image is <= MAX_WIDTH in size */
-   assert((1 << (ctx->Const.MaxTextureLevels -1 )) <= MAX_WIDTH);
-   assert((1 << (ctx->Const.MaxCubeTextureLevels -1 )) <= MAX_WIDTH);
-   assert((1 << (ctx->Const.Max3DTextureLevels -1 )) <= MAX_WIDTH);
+   assert((1 << (ctx->Const.MaxTextureLevels - 1)) <= MAX_WIDTH);
+   assert((1 << (ctx->Const.MaxCubeTextureLevels - 1)) <= MAX_WIDTH);
+   assert((1 << (ctx->Const.Max3DTextureLevels - 1)) <= MAX_WIDTH);
+
+   assert(ctx->Const.MaxViewportWidth <= MAX_WIDTH);
+   assert(ctx->Const.MaxViewportHeight <= MAX_WIDTH);
 
    assert(ctx->Const.MaxDrawBuffers <= MAX_DRAW_BUFFERS);
 
@@ -1159,6 +828,8 @@ _mesa_initialize_context(GLcontext *ctx,
                          const struct dd_function_table *driverFunctions,
                          void *driverContext)
 {
+   struct gl_shared_state *shared;
+
    /*ASSERT(driverContext);*/
    assert(driverFunctions->NewTextureObject);
    assert(driverFunctions->FreeTexImageData);
@@ -1182,20 +853,22 @@ _mesa_initialize_context(GLcontext *ctx,
 
    if (share_list) {
       /* share state with another context */
-      ctx->Shared = share_list->Shared;
+      shared = share_list->Shared;
    }
    else {
       /* allocate new, unshared state */
-      if (!alloc_shared_state( ctx )) {
+      shared = _mesa_alloc_shared_state(ctx);
+      if (!shared)
          return GL_FALSE;
-      }
    }
-   _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
-   ctx->Shared->RefCount++;
-   _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+
+   _glthread_LOCK_MUTEX(shared->Mutex);
+   ctx->Shared = shared;
+   shared->RefCount++;
+   _glthread_UNLOCK_MUTEX(shared->Mutex);
 
    if (!init_attrib_groups( ctx )) {
-      free_shared_state(ctx, ctx->Shared);
+      _mesa_free_shared_state(ctx, ctx->Shared);
       return GL_FALSE;
    }
 
@@ -1203,7 +876,7 @@ _mesa_initialize_context(GLcontext *ctx,
    ctx->Exec = alloc_dispatch_table();
    ctx->Save = alloc_dispatch_table();
    if (!ctx->Exec || !ctx->Save) {
-      free_shared_state(ctx, ctx->Shared);
+      _mesa_free_shared_state(ctx, ctx->Shared);
       if (ctx->Exec)
          _mesa_free(ctx->Exec);
    }
@@ -1250,7 +923,7 @@ _mesa_initialize_context(GLcontext *ctx,
  * \param share_list another context to share display lists with or NULL
  * \param driverFunctions points to the dd_function_table into which the
  *        driver has plugged in all its special functions.
- * \param driverCtx points to the device driver's private context state
+ * \param driverContext points to the device driver's private context state
  * 
  * \return pointer to a new __GLcontextRec or NULL if error.
  */
@@ -1290,6 +963,8 @@ _mesa_create_context(const GLvisual *visual,
 void
 _mesa_free_context_data( GLcontext *ctx )
 {
+   GLint RefCount;
+
    if (!_mesa_get_current_context()){
       /* No current context, but we may need one in order to delete
        * texture objs, etc.  So temporarily bind the context now.
@@ -1341,12 +1016,12 @@ _mesa_free_context_data( GLcontext *ctx )
 
    /* Shared context state (display lists, textures, etc) */
    _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
-   ctx->Shared->RefCount--;
-   assert(ctx->Shared->RefCount >= 0);
+   RefCount = --ctx->Shared->RefCount;
    _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
-   if (ctx->Shared->RefCount == 0) {
+   assert(RefCount >= 0);
+   if (RefCount == 0) {
       /* free shared state */
-      free_shared_state( ctx, ctx->Shared );
+      _mesa_free_shared_state( ctx, ctx->Shared );
    }
 
    if (ctx->Extensions.String)
@@ -1730,7 +1405,7 @@ _mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare)
 
       oldSharedState->RefCount--;
       if (oldSharedState->RefCount == 0) {
-         free_shared_state(ctx, oldSharedState);
+         _mesa_free_shared_state(ctx, oldSharedState);
       }
 
       return GL_TRUE;
index 54f1af911d3b95d0942278af356469fd65d4f791..ecc1cec77998afff97738b1e714114edd3c4e16b 100644 (file)
 #define CONTEXT_H
 
 
-#include "glapi/glapi.h"
 #include "imports.h"
 #include "mtypes.h"
 
 
+struct _glapi_table;
+
+
 /** \name Visual-related functions */
 /*@{*/
  
diff --git a/src/mesa/main/cpuinfo.c b/src/mesa/main/cpuinfo.c
new file mode 100644 (file)
index 0000000..b4bfb40
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 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, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "main/imports.h"
+#include "main/cpuinfo.h"
+
+
+/**
+ * This function should be called before the various "cpu_has_foo" macros
+ * are used.
+ */
+void
+_mesa_get_cpu_features(void)
+{
+#ifdef USE_X86_ASM
+   _mesa_get_x86_features();
+#endif
+}
+
+
+/**
+ * Return a string describing the CPU architexture and extensions that
+ * Mesa is using (such as SSE or Altivec).
+ * \return information string, free it with _mesa_free()
+ */
+char *
+_mesa_get_cpu_string(void)
+{
+#define MAX_STRING 50
+   char *buffer;
+
+   buffer = (char *) _mesa_malloc(MAX_STRING);
+   if (!buffer)
+      return NULL;
+
+   buffer[0] = 0;
+
+#ifdef USE_X86_ASM
+
+   if (_mesa_x86_cpu_features) {
+      strcat(buffer, "x86");
+   }
+
+# ifdef USE_MMX_ASM
+   if (cpu_has_mmx) {
+      strcat(buffer, (cpu_has_mmxext) ? "/MMX+" : "/MMX");
+   }
+# endif
+# ifdef USE_3DNOW_ASM
+   if (cpu_has_3dnow) {
+      strcat(buffer, (cpu_has_3dnowext) ? "/3DNow!+" : "/3DNow!");
+   }
+# endif
+# ifdef USE_SSE_ASM
+   if (cpu_has_xmm) {
+      strcat(buffer, (cpu_has_xmm2) ? "/SSE2" : "/SSE");
+   }
+# endif
+
+#elif defined(USE_SPARC_ASM)
+
+   strcat(buffer, "SPARC");
+
+#elif defined(USE_PPC_ASM)
+
+   if (_mesa_ppc_cpu_features) {
+      strcat(buffer, (cpu_has_64) ? "PowerPC 64" : "PowerPC");
+   }
+
+# ifdef USE_VMX_ASM
+
+   if (cpu_has_vmx) {
+      strcat(buffer, "/Altivec");
+   }
+
+# endif
+
+   if (! cpu_has_fpu) {
+      strcat(buffer, "/No FPU");
+   }
+
+#endif
+
+   assert(_mesa_strlen(buffer) < MAX_STRING);
+
+   return buffer;
+}
diff --git a/src/mesa/main/cpuinfo.h b/src/mesa/main/cpuinfo.h
new file mode 100644 (file)
index 0000000..c41a90b
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 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, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef CPUINFO_H
+#define CPUINFO_H
+
+
+#if defined(USE_X86_ASM)
+#include "x86/common_x86_asm.h"
+#endif
+
+#if defined(USE_PPC_ASM)
+#include "ppc/common_ppc_features.h"
+#endif
+
+
+extern void
+_mesa_get_cpu_features(void);
+
+
+extern char *
+_mesa_get_cpu_string(void);
+
+
+#endif /* CPUINFO_H */
index 411b6a7b21f794a9d65dd1b01b87b812de403143..d994401e55f8086b538ef0eef145328ce1e388ad 100644 (file)
 struct gl_pixelstore_attrib;
 struct gl_display_list;
 
+#if FEATURE_ARB_vertex_buffer_object
+/* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return
+ * NULL) if buffer is unavailable for immediate mapping.
+ *
+ * Does GL_MAP_INVALIDATE_RANGE_BIT do this?  It seems so, but it
+ * would require more book-keeping in the driver than seems necessary
+ * at this point.
+ *
+ * Does GL_MAP_INVALDIATE_BUFFER_BIT do this?  Not really -- we don't
+ * want to provoke the driver to throw away the old storage, we will
+ * respect the contents of already referenced data.
+ */
+#define MESA_MAP_NOWAIT_BIT       0x0040
+#endif
+
+
 /**
  * Device driver function table.
  * Core Mesa uses these function pointers to call into device drivers.
@@ -586,9 +602,6 @@ struct dd_function_table {
    /** Notify driver that a program string has been specified. */
    void (*ProgramStringNotify)(GLcontext *ctx, GLenum target, 
                               struct gl_program *prog);
-   /** Get value of a program register during program execution. */
-   void (*GetProgramRegister)(GLcontext *ctx, enum register_file file,
-                              GLuint index, GLfloat val[4]);
 
    /** Query if program can be loaded onto hardware */
    GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target, 
@@ -785,6 +798,16 @@ struct dd_function_table {
    void * (*MapBuffer)( GLcontext *ctx, GLenum target, GLenum access,
                        struct gl_buffer_object *obj );
 
+   /* May return NULL if MESA_MAP_NOWAIT_BIT is set in access:
+    */
+   void * (*MapBufferRange)( GLcontext *ctx, GLenum target,
+                             GLintptr offset, GLsizeiptr length, GLbitfield access,
+                             struct gl_buffer_object *obj);
+
+   void (*FlushMappedBufferRange) (GLcontext *ctx, GLenum target, 
+                                   GLintptr offset, GLsizeiptr length,
+                                   struct gl_buffer_object *obj);
+
    GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target,
                             struct gl_buffer_object *obj );
    /*@}*/
@@ -954,6 +977,12 @@ struct dd_function_table {
    GLuint NeedFlush;
    GLuint SaveNeedFlush;
 
+
+   /* Called prior to any of the GLvertexformat functions being
+    * called.  Paired with Driver.FlushVertices().
+    */
+   void (*BeginVertices)( GLcontext *ctx );
+
    /**
     * If inside glBegin()/glEnd(), it should ASSERT(0).  Otherwise, if
     * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
index fcef093ac35c6443bad1043a6e1b15dc42a3e78e..fdd10dd30746cd7ff6a89bb85a4fc9a2da91948f 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include "mtypes.h"
+#include "colormac.h"
 #include "context.h"
 #include "hash.h"
 #include "imports.h"
@@ -274,6 +275,27 @@ write_texture_image(struct gl_texture_object *texObj)
       case MESA_FORMAT_ARGB8888:
          write_ppm(s, img->Data, img->Width, img->Height, 4, 2, 1, 0);
          break;
+      case MESA_FORMAT_RGB888:
+         write_ppm(s, img->Data, img->Width, img->Height, 3, 2, 1, 0);
+         break;
+      case MESA_FORMAT_RGB565:
+         {
+            GLubyte *buf2 = (GLubyte *) _mesa_malloc(img->Width * img->Height * 3);
+            GLint i;
+            for (i = 0; i < img->Width * img->Height; i++) {
+               GLint r, g, b;
+               GLushort s = ((GLushort *) img->Data)[i];
+               r = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) );
+               g = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) | ((s >>  9) & 0x3) );
+               b = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >>  2) & 0x7) );
+               buf2[i*3+1] = r;
+               buf2[i*3+2] = g;
+               buf2[i*3+3] = b;
+            }
+            write_ppm(s, buf2, img->Width, img->Height, 3, 2, 1, 0);
+            _mesa_free(buf2);
+         }
+         break;
       default:
          printf("XXXX unsupported mesa tex format %d in %s\n",
                 img->TexFormat->MesaFormat, __FUNCTION__);
index 34127cb248ad07a84d21491ccf7c7585e8be73fa..bf1a01378968cf6bc5379fee6923a7b4bdbfb2a0 100644 (file)
@@ -40,6 +40,7 @@
 #ifndef GLX_USE_APPLEGL
 
 #include "main/glheader.h"
+#include "main/compiler.h"
 #include "glapi/glapi.h"
 #include "glapi/glapitable.h"
 #include "glapi/glthread.h"
index db1415bc061e60a52b0d410a8e179efca6acafc9..8f7f703da9605557a6b8f72cc6f998217bded93c 100644 (file)
@@ -33,6 +33,7 @@
 #include "api_arrayelt.h"
 #include "api_loopback.h"
 #include "config.h"
+#include "mfeatures.h"
 #include "attrib.h"
 #include "blend.h"
 #include "buffers.h"
@@ -85,7 +86,6 @@
 #endif
 
 #include "math/m_matrix.h"
-#include "math/m_xform.h"
 
 #include "glapi/dispatch.h"
 
@@ -320,6 +320,8 @@ typedef enum
    /* GL_ARB_draw_buffers */
    OPCODE_DRAW_BUFFERS_ARB,
    /* GL_ATI_fragment_shader */
+   OPCODE_TEX_BUMP_PARAMETER_ATI,
+   /* GL_ATI_fragment_shader */
    OPCODE_BIND_FRAGMENT_SHADER_ATI,
    OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
    /* OpenGL 2.0 */
@@ -705,7 +707,7 @@ unpack_image(GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth,
 /**
  * Allocate space for a display list instruction.
  * \param opcode  the instruction opcode (OPCODE_* value)
- * \param size   instruction size in bytes, not counting opcode.
+ * \param bytes   instruction size in bytes, not counting opcode.
  * \return pointer to the usable data area (not including the internal
  *         opcode).
  */
@@ -4803,6 +4805,36 @@ save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
    }
 }
 
+static void GLAPIENTRY
+save_TexBumpParameterfvATI(GLenum pname, const GLfloat *param)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+
+   n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_BUMP_PARAMETER_ATI, 5);
+   if (n) {
+      n[1].ui = pname;
+      n[2].f = param[0];
+      n[3].f = param[1];
+      n[4].f = param[2];
+      n[5].f = param[3];
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_TexBumpParameterfvATI(ctx->Exec, (pname, param));
+   }
+}
+
+static void GLAPIENTRY
+save_TexBumpParameterivATI(GLenum pname, const GLint *param)
+{
+   GLfloat p[4];
+   p[0] = INT_TO_FLOAT(param[0]);
+   p[1] = INT_TO_FLOAT(param[1]);
+   p[2] = INT_TO_FLOAT(param[2]);
+   p[3] = INT_TO_FLOAT(param[3]);
+   save_TexBumpParameterfvATI(pname, p);
+}
+
 #if FEATURE_ATI_fragment_shader
 static void GLAPIENTRY
 save_BindFragmentShaderATI(GLuint id)
@@ -6505,6 +6537,16 @@ execute_list(GLcontext *ctx, GLuint list)
                                                 n[9].i, n[10].e));
            break;
 #endif
+         case OPCODE_TEX_BUMP_PARAMETER_ATI:
+            {
+               GLfloat values[4];
+               GLuint i, pname = n[1].ui;
+
+               for (i = 0; i < 4; i++)
+                  values[i] = n[1 + i].f;
+               CALL_TexBumpParameterfvATI(ctx->Exec, (pname, values));
+            }
+            break;
 #if FEATURE_ATI_fragment_shader
          case OPCODE_BIND_FRAGMENT_SHADER_ATI:
             CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
@@ -8043,6 +8085,10 @@ _mesa_init_dlist_table(struct _glapi_table *table)
    SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV);
 #endif
 
+   /* 244. GL_ATI_envmap_bumpmap */
+   SET_TexBumpParameterivATI(table, save_TexBumpParameterivATI);
+   SET_TexBumpParameterfvATI(table, save_TexBumpParameterfvATI);
+
    /* 245. GL_ATI_fragment_shader */
 #if FEATURE_ATI_fragment_shader
    SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
index 8bc83c094fd736f84451de19779eb2f276ea0439..414cfad8e269ee178493bf74367c860a14245fcd 100644 (file)
  */
 
 
-#include "glheader.h"
-#include "imports.h"
+#include "compiler.h"
 #include "dlopen.h"
 
 #if defined(_GNU_SOURCE) && !defined(__MINGW32__)
 #include <dlfcn.h>
 #endif
+#if defined(_WIN32)
+#include <windows.h>
+#endif
 
 
 /**
index 13cfa0e756e28d2573c6c3e5c71530731fd47f5a..e9de0c097a0b8ce06573563051d8425ed731c574 100644 (file)
@@ -103,7 +103,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
    else if (ctx->RenderMode == GL_FEEDBACK) {
       /* Feedback the current raster pos info */
       FLUSH_CURRENT( ctx, 0 );
-      FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
+      _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
       _mesa_feedback_vertex( ctx,
                              ctx->Current.RasterPos,
                              ctx->Current.RasterColor,
@@ -166,7 +166,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
    }
    else if (ctx->RenderMode == GL_FEEDBACK) {
       FLUSH_CURRENT( ctx, 0 );
-      FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN );
+      _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN );
       _mesa_feedback_vertex( ctx, 
                              ctx->Current.RasterPos,
                              ctx->Current.RasterColor,
@@ -243,7 +243,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
 #if _HAVE_FULL_GL
    else if (ctx->RenderMode == GL_FEEDBACK) {
       FLUSH_CURRENT(ctx, 0);
-      FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN );
+      _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN );
       _mesa_feedback_vertex( ctx,
                              ctx->Current.RasterPos,
                              ctx->Current.RasterColor,
@@ -311,7 +311,7 @@ _mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height,
    else if (ctx->RenderMode == GL_FEEDBACK) {
       /* Feedback the current raster pos info */
       FLUSH_CURRENT( ctx, 0 );
-      FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
+      _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
       _mesa_feedback_vertex( ctx,
                              ctx->Current.RasterPos,
                              ctx->Current.RasterColor,
index 2b54fac69496c1c72c39e10947662fb0a48c12fa..f432be183cb8bad6899e134b45b8100d1c284e61 100644 (file)
@@ -37,7 +37,6 @@
 #include "mtypes.h"
 #include "enums.h"
 #include "math/m_matrix.h"
-#include "math/m_xform.h"
 #include "api_arrayelt.h"
 
 
@@ -603,11 +602,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
          ctx->Texture.SharedPalette = state;
          break;
       case GL_STENCIL_TEST:
-         if (state && ctx->DrawBuffer->Visual.stencilBits == 0) {
-            _mesa_warning(ctx,
-                          "glEnable(GL_STENCIL_TEST) but no stencil buffer");
-            return;
-         }
          if (ctx->Stencil.Enabled == state)
             return;
          FLUSH_VERTICES(ctx, _NEW_STENCIL);
@@ -950,18 +944,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
          ctx->Depth.BoundsTest = state;
          break;
 
-      /* GL_MESA_program_debug */
-#if FEATURE_MESA_program_debug
-      case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
-         CHECK_EXTENSION(MESA_program_debug, cap);
-         ctx->FragmentProgram.CallbackEnabled = state;
-         break;
-      case GL_VERTEX_PROGRAM_CALLBACK_MESA:
-         CHECK_EXTENSION(MESA_program_debug, cap);
-         ctx->VertexProgram.CallbackEnabled = state;
-         break;
-#endif
-
 #if FEATURE_ATI_fragment_shader
       case GL_FRAGMENT_SHADER_ATI:
         CHECK_EXTENSION(ATI_fragment_shader, cap);
@@ -1404,16 +1386,6 @@ _mesa_IsEnabled( GLenum cap )
          CHECK_EXTENSION(EXT_depth_bounds_test);
          return ctx->Depth.BoundsTest;
 
-      /* GL_MESA_program_debug */
-#if FEATURE_MESA_program_debug
-      case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
-         CHECK_EXTENSION(MESA_program_debug);
-         return ctx->FragmentProgram.CallbackEnabled;
-      case GL_VERTEX_PROGRAM_CALLBACK_MESA:
-         CHECK_EXTENSION(MESA_program_debug);
-         return ctx->VertexProgram.CallbackEnabled;
-#endif
-
 #if FEATURE_ATI_fragment_shader
       case GL_FRAGMENT_SHADER_ATI:
         CHECK_EXTENSION(ATI_fragment_shader);
index a864f5a0704d3311e85751d4952c6f92ba81478a..e63a04e915decd91c66edf54798182be475608b1 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include "glheader.h"
+#include "mfeatures.h"
 #include "enums.h"
 #include "imports.h"
 
@@ -145,6 +146,12 @@ LONGSTRING static const char enum_string_table[] =
    "GL_BUFFER_SIZE_ARB\0"
    "GL_BUFFER_USAGE\0"
    "GL_BUFFER_USAGE_ARB\0"
+   "GL_BUMP_ENVMAP_ATI\0"
+   "GL_BUMP_NUM_TEX_UNITS_ATI\0"
+   "GL_BUMP_ROT_MATRIX_ATI\0"
+   "GL_BUMP_ROT_MATRIX_SIZE_ATI\0"
+   "GL_BUMP_TARGET_ATI\0"
+   "GL_BUMP_TEX_UNITS_ATI\0"
    "GL_BYTE\0"
    "GL_C3F_V3F\0"
    "GL_C4F_N3F_V3F\0"
@@ -463,6 +470,8 @@ LONGSTRING static const char enum_string_table[] =
    "GL_DRAW_PIXEL_TOKEN\0"
    "GL_DST_ALPHA\0"
    "GL_DST_COLOR\0"
+   "GL_DU8DV8_ATI\0"
+   "GL_DUDV_ATI\0"
    "GL_DYNAMIC_COPY\0"
    "GL_DYNAMIC_COPY_ARB\0"
    "GL_DYNAMIC_DRAW\0"
@@ -1847,7 +1856,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_ZOOM_Y\0"
    ;
 
-static const enum_elt all_enums[1810] =
+static const enum_elt all_enums[1818] =
 {
    {     0, 0x00000600 }, /* GL_2D */
    {     6, 0x00001407 }, /* GL_2_BYTES */
@@ -1959,3022 +1968,3036 @@ static const enum_elt all_enums[1810] =
    {  1766, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */
    {  1785, 0x00008765 }, /* GL_BUFFER_USAGE */
    {  1801, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */
-   {  1821, 0x00001400 }, /* GL_BYTE */
-   {  1829, 0x00002A24 }, /* GL_C3F_V3F */
-   {  1840, 0x00002A26 }, /* GL_C4F_N3F_V3F */
-   {  1855, 0x00002A22 }, /* GL_C4UB_V2F */
-   {  1867, 0x00002A23 }, /* GL_C4UB_V3F */
-   {  1879, 0x00000901 }, /* GL_CCW */
-   {  1886, 0x00002900 }, /* GL_CLAMP */
-   {  1895, 0x0000812D }, /* GL_CLAMP_TO_BORDER */
-   {  1914, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */
-   {  1937, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */
-   {  1961, 0x0000812F }, /* GL_CLAMP_TO_EDGE */
-   {  1978, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */
-   {  2000, 0x00001500 }, /* GL_CLEAR */
-   {  2009, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */
-   {  2034, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */
-   {  2063, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */
-   {  2089, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
-   {  2118, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */
-   {  2144, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */
-   {  2171, 0x00003000 }, /* GL_CLIP_PLANE0 */
-   {  2186, 0x00003001 }, /* GL_CLIP_PLANE1 */
-   {  2201, 0x00003002 }, /* GL_CLIP_PLANE2 */
-   {  2216, 0x00003003 }, /* GL_CLIP_PLANE3 */
-   {  2231, 0x00003004 }, /* GL_CLIP_PLANE4 */
-   {  2246, 0x00003005 }, /* GL_CLIP_PLANE5 */
-   {  2261, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
-   {  2294, 0x00000A00 }, /* GL_COEFF */
-   {  2303, 0x00001800 }, /* GL_COLOR */
-   {  2312, 0x00008076 }, /* GL_COLOR_ARRAY */
-   {  2327, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */
-   {  2357, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */
-   {  2391, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */
-   {  2414, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */
-   {  2434, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */
-   {  2456, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */
-   {  2476, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0 */
-   {  2497, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */
-   {  2522, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1 */
-   {  2543, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10 */
-   {  2565, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */
-   {  2591, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11 */
-   {  2613, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */
-   {  2639, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12 */
-   {  2661, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */
-   {  2687, 0x00008CED }, /* GL_COLOR_ATTACHMENT13 */
-   {  2709, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */
-   {  2735, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14 */
-   {  2757, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */
-   {  2783, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15 */
-   {  2805, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */
-   {  2831, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */
-   {  2856, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2 */
-   {  2877, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */
-   {  2902, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3 */
-   {  2923, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */
-   {  2948, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4 */
-   {  2969, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */
-   {  2994, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5 */
-   {  3015, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */
-   {  3040, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6 */
-   {  3061, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */
-   {  3086, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7 */
-   {  3107, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */
-   {  3132, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8 */
-   {  3153, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */
-   {  3178, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9 */
-   {  3199, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */
-   {  3224, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */
-   {  3244, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */
-   {  3265, 0x00001900 }, /* GL_COLOR_INDEX */
-   {  3280, 0x00001603 }, /* GL_COLOR_INDEXES */
-   {  3297, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */
-   {  3315, 0x00000B57 }, /* GL_COLOR_MATERIAL */
-   {  3333, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */
-   {  3356, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */
-   {  3384, 0x000080B1 }, /* GL_COLOR_MATRIX */
-   {  3400, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */
-   {  3420, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */
-   {  3448, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */
-   {  3480, 0x00008458 }, /* GL_COLOR_SUM */
-   {  3493, 0x00008458 }, /* GL_COLOR_SUM_ARB */
-   {  3510, 0x000080D0 }, /* GL_COLOR_TABLE */
-   {  3525, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */
-   {  3551, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */
-   {  3581, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_SGI */
-   {  3611, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */
-   {  3631, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS_SGI */
-   {  3655, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */
-   {  3680, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */
-   {  3709, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_SGI */
-   {  3738, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */
-   {  3760, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */
-   {  3786, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_SGI */
-   {  3812, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */
-   {  3838, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */
-   {  3868, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_SGI */
-   {  3898, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */
-   {  3928, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */
-   {  3962, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_SGI */
-   {  3996, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */
-   {  4026, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */
-   {  4060, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_SGI */
-   {  4094, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */
-   {  4118, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */
-   {  4146, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_SGI */
-   {  4174, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */
-   {  4195, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE_SGI */
-   {  4220, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */
-   {  4241, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */
-   {  4266, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_SGI */
-   {  4291, 0x00000C23 }, /* GL_COLOR_WRITEMASK */
-   {  4310, 0x00008570 }, /* GL_COMBINE */
-   {  4321, 0x00008503 }, /* GL_COMBINE4 */
-   {  4333, 0x00008572 }, /* GL_COMBINE_ALPHA */
-   {  4350, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */
-   {  4371, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */
-   {  4392, 0x00008570 }, /* GL_COMBINE_ARB */
-   {  4407, 0x00008570 }, /* GL_COMBINE_EXT */
-   {  4422, 0x00008571 }, /* GL_COMBINE_RGB */
-   {  4437, 0x00008571 }, /* GL_COMBINE_RGB_ARB */
-   {  4456, 0x00008571 }, /* GL_COMBINE_RGB_EXT */
-   {  4475, 0x0000884E }, /* GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT */
-   {  4511, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */
-   {  4535, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */
-   {  4563, 0x00001300 }, /* GL_COMPILE */
-   {  4574, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */
-   {  4597, 0x00008B81 }, /* GL_COMPILE_STATUS */
-   {  4615, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */
-   {  4635, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */
-   {  4659, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */
-   {  4683, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */
-   {  4711, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */
-   {  4735, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */
-   {  4765, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */
-   {  4799, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */
-   {  4827, 0x000084ED }, /* GL_COMPRESSED_RGB */
-   {  4845, 0x000084EE }, /* GL_COMPRESSED_RGBA */
-   {  4864, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */
-   {  4887, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
-   {  4916, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
-   {  4949, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
-   {  4982, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
-   {  5015, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */
-   {  5037, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */
-   {  5065, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
-   {  5097, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */
-   {  5127, 0x00008576 }, /* GL_CONSTANT */
-   {  5139, 0x00008003 }, /* GL_CONSTANT_ALPHA */
-   {  5157, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */
-   {  5179, 0x00008576 }, /* GL_CONSTANT_ARB */
-   {  5195, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */
-   {  5219, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */
-   {  5241, 0x00008001 }, /* GL_CONSTANT_COLOR */
-   {  5259, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */
-   {  5281, 0x00008576 }, /* GL_CONSTANT_EXT */
-   {  5297, 0x00008010 }, /* GL_CONVOLUTION_1D */
-   {  5315, 0x00008011 }, /* GL_CONVOLUTION_2D */
-   {  5333, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */
-   {  5361, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */
-   {  5392, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */
-   {  5419, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */
-   {  5450, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */
-   {  5477, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */
-   {  5508, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */
-   {  5536, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */
-   {  5568, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */
-   {  5590, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */
-   {  5616, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */
-   {  5638, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */
-   {  5664, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */
-   {  5685, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */
-   {  5710, 0x00008862 }, /* GL_COORD_REPLACE */
-   {  5727, 0x00008862 }, /* GL_COORD_REPLACE_ARB */
-   {  5748, 0x00008862 }, /* GL_COORD_REPLACE_NV */
-   {  5768, 0x00001503 }, /* GL_COPY */
-   {  5776, 0x0000150C }, /* GL_COPY_INVERTED */
-   {  5793, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */
-   {  5813, 0x00000B44 }, /* GL_CULL_FACE */
-   {  5826, 0x00000B45 }, /* GL_CULL_FACE_MODE */
-   {  5844, 0x000081AA }, /* GL_CULL_VERTEX_EXT */
-   {  5863, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
-   {  5895, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
-   {  5930, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */
-   {  5951, 0x00000001 }, /* GL_CURRENT_BIT */
-   {  5966, 0x00000B00 }, /* GL_CURRENT_COLOR */
-   {  5983, 0x00008453 }, /* GL_CURRENT_FOG_COORD */
-   {  6004, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */
-   {  6030, 0x00000B01 }, /* GL_CURRENT_INDEX */
-   {  6047, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */
-   {  6069, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */
-   {  6097, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */
-   {  6118, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
-   {  6152, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */
-   {  6185, 0x00000B02 }, /* GL_CURRENT_NORMAL */
-   {  6203, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */
-   {  6233, 0x00008B8D }, /* GL_CURRENT_PROGRAM */
-   {  6252, 0x00008865 }, /* GL_CURRENT_QUERY */
-   {  6269, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */
-   {  6290, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */
-   {  6314, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */
-   {  6341, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */
-   {  6365, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */
-   {  6392, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */
-   {  6425, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
-   {  6458, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */
-   {  6485, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */
-   {  6511, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */
-   {  6536, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */
-   {  6565, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */
-   {  6587, 0x00000900 }, /* GL_CW */
-   {  6593, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */
-   {  6614, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */
-   {  6635, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */
-   {  6655, 0x00002101 }, /* GL_DECAL */
-   {  6664, 0x00001E03 }, /* GL_DECR */
-   {  6672, 0x00008508 }, /* GL_DECR_WRAP */
-   {  6685, 0x00008508 }, /* GL_DECR_WRAP_EXT */
-   {  6702, 0x00008B80 }, /* GL_DELETE_STATUS */
-   {  6719, 0x00001801 }, /* GL_DEPTH */
-   {  6728, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */
-   {  6748, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */
-   {  6768, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */
-   {  6792, 0x00000D1F }, /* GL_DEPTH_BIAS */
-   {  6806, 0x00000D56 }, /* GL_DEPTH_BITS */
-   {  6820, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */
-   {  6840, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */
-   {  6865, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */
-   {  6885, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */
-   {  6903, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */
-   {  6924, 0x00001902 }, /* GL_DEPTH_COMPONENT */
-   {  6943, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */
-   {  6964, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */
-   {  6989, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */
-   {  7015, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */
-   {  7036, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */
-   {  7061, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */
-   {  7087, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */
-   {  7108, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */
-   {  7133, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */
-   {  7159, 0x00000B74 }, /* GL_DEPTH_FUNC */
-   {  7173, 0x00000B70 }, /* GL_DEPTH_RANGE */
-   {  7188, 0x00000D1E }, /* GL_DEPTH_SCALE */
-   {  7203, 0x000084F9 }, /* GL_DEPTH_STENCIL */
-   {  7220, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */
-   {  7248, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */
-   {  7268, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
-   {  7296, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
-   {  7324, 0x00000B71 }, /* GL_DEPTH_TEST */
-   {  7338, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */
-   {  7360, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */
-   {  7386, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */
-   {  7405, 0x00001201 }, /* GL_DIFFUSE */
-   {  7416, 0x00000BD0 }, /* GL_DITHER */
-   {  7426, 0x00000A02 }, /* GL_DOMAIN */
-   {  7436, 0x00001100 }, /* GL_DONT_CARE */
-   {  7449, 0x000086AE }, /* GL_DOT3_RGB */
-   {  7461, 0x000086AF }, /* GL_DOT3_RGBA */
-   {  7474, 0x000086AF }, /* GL_DOT3_RGBA_ARB */
-   {  7491, 0x00008741 }, /* GL_DOT3_RGBA_EXT */
-   {  7508, 0x000086AE }, /* GL_DOT3_RGB_ARB */
-   {  7524, 0x00008740 }, /* GL_DOT3_RGB_EXT */
-   {  7540, 0x0000140A }, /* GL_DOUBLE */
-   {  7550, 0x00000C32 }, /* GL_DOUBLEBUFFER */
-   {  7566, 0x00000C01 }, /* GL_DRAW_BUFFER */
-   {  7581, 0x00008825 }, /* GL_DRAW_BUFFER0 */
-   {  7597, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */
-   {  7617, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */
-   {  7637, 0x00008826 }, /* GL_DRAW_BUFFER1 */
-   {  7653, 0x0000882F }, /* GL_DRAW_BUFFER10 */
-   {  7670, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */
-   {  7691, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */
-   {  7712, 0x00008830 }, /* GL_DRAW_BUFFER11 */
-   {  7729, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */
-   {  7750, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */
-   {  7771, 0x00008831 }, /* GL_DRAW_BUFFER12 */
-   {  7788, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */
-   {  7809, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */
-   {  7830, 0x00008832 }, /* GL_DRAW_BUFFER13 */
-   {  7847, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */
-   {  7868, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */
-   {  7889, 0x00008833 }, /* GL_DRAW_BUFFER14 */
-   {  7906, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */
-   {  7927, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */
-   {  7948, 0x00008834 }, /* GL_DRAW_BUFFER15 */
-   {  7965, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */
-   {  7986, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */
-   {  8007, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */
-   {  8027, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */
-   {  8047, 0x00008827 }, /* GL_DRAW_BUFFER2 */
-   {  8063, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */
-   {  8083, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */
-   {  8103, 0x00008828 }, /* GL_DRAW_BUFFER3 */
-   {  8119, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */
-   {  8139, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */
-   {  8159, 0x00008829 }, /* GL_DRAW_BUFFER4 */
-   {  8175, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */
-   {  8195, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */
-   {  8215, 0x0000882A }, /* GL_DRAW_BUFFER5 */
-   {  8231, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */
-   {  8251, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */
-   {  8271, 0x0000882B }, /* GL_DRAW_BUFFER6 */
-   {  8287, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */
-   {  8307, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */
-   {  8327, 0x0000882C }, /* GL_DRAW_BUFFER7 */
-   {  8343, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */
-   {  8363, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */
-   {  8383, 0x0000882D }, /* GL_DRAW_BUFFER8 */
-   {  8399, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */
-   {  8419, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */
-   {  8439, 0x0000882E }, /* GL_DRAW_BUFFER9 */
-   {  8455, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */
-   {  8475, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */
-   {  8495, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */
-   {  8515, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
-   {  8547, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */
-   {  8571, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */
-   {  8591, 0x00000304 }, /* GL_DST_ALPHA */
-   {  8604, 0x00000306 }, /* GL_DST_COLOR */
-   {  8617, 0x000088EA }, /* GL_DYNAMIC_COPY */
-   {  8633, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */
-   {  8653, 0x000088E8 }, /* GL_DYNAMIC_DRAW */
-   {  8669, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */
-   {  8689, 0x000088E9 }, /* GL_DYNAMIC_READ */
-   {  8705, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */
-   {  8725, 0x00000B43 }, /* GL_EDGE_FLAG */
-   {  8738, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */
-   {  8757, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
-   {  8791, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */
-   {  8829, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */
-   {  8856, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */
-   {  8882, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */
-   {  8906, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
-   {  8938, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */
-   {  8974, 0x00001600 }, /* GL_EMISSION */
-   {  8986, 0x00002000 }, /* GL_ENABLE_BIT */
-   {  9000, 0x00000202 }, /* GL_EQUAL */
-   {  9009, 0x00001509 }, /* GL_EQUIV */
-   {  9018, 0x00010000 }, /* GL_EVAL_BIT */
-   {  9030, 0x00000800 }, /* GL_EXP */
-   {  9037, 0x00000801 }, /* GL_EXP2 */
-   {  9045, 0x00001F03 }, /* GL_EXTENSIONS */
-   {  9059, 0x00002400 }, /* GL_EYE_LINEAR */
-   {  9073, 0x00002502 }, /* GL_EYE_PLANE */
-   {  9086, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */
-   {  9111, 0x0000855B }, /* GL_EYE_RADIAL_NV */
-   {  9128, 0x00000000 }, /* GL_FALSE */
-   {  9137, 0x00001101 }, /* GL_FASTEST */
-   {  9148, 0x00001C01 }, /* GL_FEEDBACK */
-   {  9160, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */
-   {  9187, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */
-   {  9211, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */
-   {  9235, 0x00001B02 }, /* GL_FILL */
-   {  9243, 0x00001D00 }, /* GL_FLAT */
-   {  9251, 0x00001406 }, /* GL_FLOAT */
-   {  9260, 0x00008B5A }, /* GL_FLOAT_MAT2 */
-   {  9274, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */
-   {  9292, 0x00008B5B }, /* GL_FLOAT_MAT3 */
-   {  9306, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */
-   {  9324, 0x00008B5C }, /* GL_FLOAT_MAT4 */
-   {  9338, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */
-   {  9356, 0x00008B50 }, /* GL_FLOAT_VEC2 */
-   {  9370, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */
-   {  9388, 0x00008B51 }, /* GL_FLOAT_VEC3 */
-   {  9402, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */
-   {  9420, 0x00008B52 }, /* GL_FLOAT_VEC4 */
-   {  9434, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */
-   {  9452, 0x00000B60 }, /* GL_FOG */
-   {  9459, 0x00000080 }, /* GL_FOG_BIT */
-   {  9470, 0x00000B66 }, /* GL_FOG_COLOR */
-   {  9483, 0x00008451 }, /* GL_FOG_COORD */
-   {  9496, 0x00008451 }, /* GL_FOG_COORDINATE */
-   {  9514, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */
-   {  9538, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
-   {  9577, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */
-   {  9620, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */
-   {  9652, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
-   {  9683, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */
-   {  9712, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */
-   {  9737, 0x00008457 }, /* GL_FOG_COORD_ARRAY */
-   {  9756, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */
-   {  9790, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */
-   {  9817, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */
-   {  9843, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */
-   {  9867, 0x00008450 }, /* GL_FOG_COORD_SRC */
-   {  9884, 0x00000B62 }, /* GL_FOG_DENSITY */
-   {  9899, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */
-   {  9923, 0x00000B64 }, /* GL_FOG_END */
-   {  9934, 0x00000C54 }, /* GL_FOG_HINT */
-   {  9946, 0x00000B61 }, /* GL_FOG_INDEX */
-   {  9959, 0x00000B65 }, /* GL_FOG_MODE */
-   {  9971, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */
-   {  9990, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */
-   { 10015, 0x00000B63 }, /* GL_FOG_START */
-   { 10028, 0x00008452 }, /* GL_FRAGMENT_DEPTH */
-   { 10046, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */
-   { 10070, 0x00008B30 }, /* GL_FRAGMENT_SHADER */
-   { 10089, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */
-   { 10112, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
-   { 10147, 0x00008D40 }, /* GL_FRAMEBUFFER */
-   { 10162, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
-   { 10199, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
-   { 10235, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
-   { 10276, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
-   { 10317, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
-   { 10354, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
-   { 10391, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
-   { 10429, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */
-   { 10471, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
-   { 10509, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */
-   { 10551, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
-   { 10586, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
-   { 10625, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */
-   { 10674, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
-   { 10722, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */
-   { 10774, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
-   { 10814, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
-   { 10858, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
-   { 10898, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */
-   { 10942, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */
-   { 10969, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */
-   { 10993, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */
-   { 11021, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */
-   { 11044, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */
-   { 11063, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
-   { 11100, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */
-   { 11141, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
-   { 11182, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
-   { 11224, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
-   { 11275, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
-   { 11313, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
-   { 11358, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */
-   { 11407, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
-   { 11445, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
-   { 11487, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
-   { 11519, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */
-   { 11544, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */
-   { 11571, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */
-   { 11602, 0x00000404 }, /* GL_FRONT */
-   { 11611, 0x00000408 }, /* GL_FRONT_AND_BACK */
-   { 11629, 0x00000B46 }, /* GL_FRONT_FACE */
-   { 11643, 0x00000400 }, /* GL_FRONT_LEFT */
-   { 11657, 0x00000401 }, /* GL_FRONT_RIGHT */
-   { 11672, 0x00008006 }, /* GL_FUNC_ADD */
-   { 11684, 0x00008006 }, /* GL_FUNC_ADD_EXT */
-   { 11700, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */
-   { 11725, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */
-   { 11754, 0x0000800A }, /* GL_FUNC_SUBTRACT */
-   { 11771, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */
-   { 11792, 0x00008191 }, /* GL_GENERATE_MIPMAP */
-   { 11811, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */
-   { 11835, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */
-   { 11864, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */
-   { 11888, 0x00000206 }, /* GL_GEQUAL */
-   { 11898, 0x00008009 }, /* GL_GL_BLEND_EQUATION_RGB */
-   { 11923, 0x00008C4A }, /* GL_GL_COMPRESSED_SLUMINANCE */
-   { 11951, 0x00008C4B }, /* GL_GL_COMPRESSED_SLUMINANCE_ALPHA */
-   { 11985, 0x00008C48 }, /* GL_GL_COMPRESSED_SRGB */
-   { 12007, 0x00008C49 }, /* GL_GL_COMPRESSED_SRGB_ALPHA */
-   { 12035, 0x0000845F }, /* GL_GL_CURRENT_RASTER_SECONDARY_COLOR */
-   { 12072, 0x00008B65 }, /* GL_GL_FLOAT_MAT2x3 */
-   { 12091, 0x00008B66 }, /* GL_GL_FLOAT_MAT2x4 */
-   { 12110, 0x00008B67 }, /* GL_GL_FLOAT_MAT3x2 */
-   { 12129, 0x00008B68 }, /* GL_GL_FLOAT_MAT3x4 */
-   { 12148, 0x00008B69 }, /* GL_GL_FLOAT_MAT4x2 */
-   { 12167, 0x00008B6A }, /* GL_GL_FLOAT_MAT4x3 */
-   { 12186, 0x000088EB }, /* GL_GL_PIXEL_PACK_BUFFER */
-   { 12210, 0x000088ED }, /* GL_GL_PIXEL_PACK_BUFFER_BINDING */
-   { 12242, 0x000088EC }, /* GL_GL_PIXEL_UNPACK_BUFFER */
-   { 12268, 0x000088EF }, /* GL_GL_PIXEL_UNPACK_BUFFER_BINDING */
-   { 12302, 0x00008C46 }, /* GL_GL_SLUMINANCE */
-   { 12319, 0x00008C47 }, /* GL_GL_SLUMINANCE8 */
-   { 12337, 0x00008C45 }, /* GL_GL_SLUMINANCE8_ALPHA8 */
-   { 12362, 0x00008C44 }, /* GL_GL_SLUMINANCE_ALPHA */
-   { 12385, 0x00008C40 }, /* GL_GL_SRGB */
-   { 12396, 0x00008C41 }, /* GL_GL_SRGB8 */
-   { 12408, 0x00008C43 }, /* GL_GL_SRGB8_ALPHA8 */
-   { 12427, 0x00008C42 }, /* GL_GL_SRGB_ALPHA */
-   { 12444, 0x00000204 }, /* GL_GREATER */
-   { 12455, 0x00001904 }, /* GL_GREEN */
-   { 12464, 0x00000D19 }, /* GL_GREEN_BIAS */
-   { 12478, 0x00000D53 }, /* GL_GREEN_BITS */
-   { 12492, 0x00000D18 }, /* GL_GREEN_SCALE */
-   { 12507, 0x00008000 }, /* GL_HINT_BIT */
-   { 12519, 0x00008024 }, /* GL_HISTOGRAM */
-   { 12532, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
-   { 12556, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
-   { 12584, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
-   { 12607, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
-   { 12634, 0x00008024 }, /* GL_HISTOGRAM_EXT */
-   { 12651, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
-   { 12671, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
-   { 12695, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
-   { 12719, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
-   { 12747, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
-   { 12775, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
-   { 12807, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
-   { 12829, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
-   { 12855, 0x0000802D }, /* GL_HISTOGRAM_SINK */
-   { 12873, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
-   { 12895, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
-   { 12914, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
-   { 12937, 0x0000862A }, /* GL_IDENTITY_NV */
-   { 12952, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
-   { 12972, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
-   { 13012, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
-   { 13050, 0x00001E02 }, /* GL_INCR */
-   { 13058, 0x00008507 }, /* GL_INCR_WRAP */
-   { 13071, 0x00008507 }, /* GL_INCR_WRAP_EXT */
-   { 13088, 0x00008222 }, /* GL_INDEX */
-   { 13097, 0x00008077 }, /* GL_INDEX_ARRAY */
-   { 13112, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
-   { 13142, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
-   { 13176, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
-   { 13199, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
-   { 13221, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
-   { 13241, 0x00000D51 }, /* GL_INDEX_BITS */
-   { 13255, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
-   { 13276, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
-   { 13294, 0x00000C30 }, /* GL_INDEX_MODE */
-   { 13308, 0x00000D13 }, /* GL_INDEX_OFFSET */
-   { 13324, 0x00000D12 }, /* GL_INDEX_SHIFT */
-   { 13339, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
-   { 13358, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
-   { 13377, 0x00001404 }, /* GL_INT */
-   { 13384, 0x00008049 }, /* GL_INTENSITY */
-   { 13397, 0x0000804C }, /* GL_INTENSITY12 */
-   { 13412, 0x0000804C }, /* GL_INTENSITY12_EXT */
-   { 13431, 0x0000804D }, /* GL_INTENSITY16 */
-   { 13446, 0x0000804D }, /* GL_INTENSITY16_EXT */
-   { 13465, 0x0000804A }, /* GL_INTENSITY4 */
-   { 13479, 0x0000804A }, /* GL_INTENSITY4_EXT */
-   { 13497, 0x0000804B }, /* GL_INTENSITY8 */
-   { 13511, 0x0000804B }, /* GL_INTENSITY8_EXT */
-   { 13529, 0x00008049 }, /* GL_INTENSITY_EXT */
-   { 13546, 0x00008575 }, /* GL_INTERPOLATE */
-   { 13561, 0x00008575 }, /* GL_INTERPOLATE_ARB */
-   { 13580, 0x00008575 }, /* GL_INTERPOLATE_EXT */
-   { 13599, 0x00008B53 }, /* GL_INT_VEC2 */
-   { 13611, 0x00008B53 }, /* GL_INT_VEC2_ARB */
-   { 13627, 0x00008B54 }, /* GL_INT_VEC3 */
-   { 13639, 0x00008B54 }, /* GL_INT_VEC3_ARB */
-   { 13655, 0x00008B55 }, /* GL_INT_VEC4 */
-   { 13667, 0x00008B55 }, /* GL_INT_VEC4_ARB */
-   { 13683, 0x00000500 }, /* GL_INVALID_ENUM */
-   { 13699, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
-   { 13732, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
-   { 13769, 0x00000502 }, /* GL_INVALID_OPERATION */
-   { 13790, 0x00000501 }, /* GL_INVALID_VALUE */
-   { 13807, 0x0000862B }, /* GL_INVERSE_NV */
-   { 13821, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
-   { 13845, 0x0000150A }, /* GL_INVERT */
-   { 13855, 0x00001E00 }, /* GL_KEEP */
-   { 13863, 0x00000406 }, /* GL_LEFT */
-   { 13871, 0x00000203 }, /* GL_LEQUAL */
-   { 13881, 0x00000201 }, /* GL_LESS */
-   { 13889, 0x00004000 }, /* GL_LIGHT0 */
-   { 13899, 0x00004001 }, /* GL_LIGHT1 */
-   { 13909, 0x00004002 }, /* GL_LIGHT2 */
-   { 13919, 0x00004003 }, /* GL_LIGHT3 */
-   { 13929, 0x00004004 }, /* GL_LIGHT4 */
-   { 13939, 0x00004005 }, /* GL_LIGHT5 */
-   { 13949, 0x00004006 }, /* GL_LIGHT6 */
-   { 13959, 0x00004007 }, /* GL_LIGHT7 */
-   { 13969, 0x00000B50 }, /* GL_LIGHTING */
-   { 13981, 0x00000040 }, /* GL_LIGHTING_BIT */
-   { 13997, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
-   { 14020, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
-   { 14049, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
-   { 14082, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
-   { 14110, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
-   { 14134, 0x00001B01 }, /* GL_LINE */
-   { 14142, 0x00002601 }, /* GL_LINEAR */
-   { 14152, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
-   { 14174, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
-   { 14204, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
-   { 14235, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
-   { 14259, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
-   { 14284, 0x00000001 }, /* GL_LINES */
-   { 14293, 0x00000004 }, /* GL_LINE_BIT */
-   { 14305, 0x00000002 }, /* GL_LINE_LOOP */
-   { 14318, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
-   { 14338, 0x00000B20 }, /* GL_LINE_SMOOTH */
-   { 14353, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
-   { 14373, 0x00000B24 }, /* GL_LINE_STIPPLE */
-   { 14389, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
-   { 14413, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
-   { 14436, 0x00000003 }, /* GL_LINE_STRIP */
-   { 14450, 0x00000702 }, /* GL_LINE_TOKEN */
-   { 14464, 0x00000B21 }, /* GL_LINE_WIDTH */
-   { 14478, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
-   { 14504, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
-   { 14524, 0x00008B82 }, /* GL_LINK_STATUS */
-   { 14539, 0x00000B32 }, /* GL_LIST_BASE */
-   { 14552, 0x00020000 }, /* GL_LIST_BIT */
-   { 14564, 0x00000B33 }, /* GL_LIST_INDEX */
-   { 14578, 0x00000B30 }, /* GL_LIST_MODE */
-   { 14591, 0x00000101 }, /* GL_LOAD */
-   { 14599, 0x00000BF1 }, /* GL_LOGIC_OP */
-   { 14611, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
-   { 14628, 0x00008CA1 }, /* GL_LOWER_LEFT */
-   { 14642, 0x00001909 }, /* GL_LUMINANCE */
-   { 14655, 0x00008041 }, /* GL_LUMINANCE12 */
-   { 14670, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
-   { 14693, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
-   { 14720, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
-   { 14742, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
-   { 14768, 0x00008041 }, /* GL_LUMINANCE12_EXT */
-   { 14787, 0x00008042 }, /* GL_LUMINANCE16 */
-   { 14802, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
-   { 14825, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
-   { 14852, 0x00008042 }, /* GL_LUMINANCE16_EXT */
-   { 14871, 0x0000803F }, /* GL_LUMINANCE4 */
-   { 14885, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
-   { 14906, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
-   { 14931, 0x0000803F }, /* GL_LUMINANCE4_EXT */
-   { 14949, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
-   { 14970, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
-   { 14995, 0x00008040 }, /* GL_LUMINANCE8 */
-   { 15009, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
-   { 15030, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
-   { 15055, 0x00008040 }, /* GL_LUMINANCE8_EXT */
-   { 15073, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
-   { 15092, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
-   { 15108, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
-   { 15128, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
-   { 15150, 0x00000D91 }, /* GL_MAP1_INDEX */
-   { 15164, 0x00000D92 }, /* GL_MAP1_NORMAL */
-   { 15179, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
-   { 15203, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
-   { 15227, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
-   { 15251, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
-   { 15275, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
-   { 15292, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
-   { 15309, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
-   { 15337, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
-   { 15366, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
-   { 15395, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
-   { 15424, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
-   { 15453, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
-   { 15482, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
-   { 15511, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
-   { 15539, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
-   { 15567, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
-   { 15595, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
-   { 15623, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
-   { 15651, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
-   { 15679, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
-   { 15707, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
-   { 15735, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
-   { 15763, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
-   { 15779, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
-   { 15799, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
-   { 15821, 0x00000DB1 }, /* GL_MAP2_INDEX */
-   { 15835, 0x00000DB2 }, /* GL_MAP2_NORMAL */
-   { 15850, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
-   { 15874, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
-   { 15898, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
-   { 15922, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
-   { 15946, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
-   { 15963, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
-   { 15980, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
-   { 16008, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
-   { 16037, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
-   { 16066, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
-   { 16095, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
-   { 16124, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
-   { 16153, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
-   { 16182, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
-   { 16210, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
-   { 16238, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
-   { 16266, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
-   { 16294, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
-   { 16322, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
-   { 16350, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
-   { 16378, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
-   { 16406, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
-   { 16434, 0x00000D10 }, /* GL_MAP_COLOR */
-   { 16447, 0x00000D11 }, /* GL_MAP_STENCIL */
-   { 16462, 0x000088C0 }, /* GL_MATRIX0_ARB */
-   { 16477, 0x00008630 }, /* GL_MATRIX0_NV */
-   { 16491, 0x000088CA }, /* GL_MATRIX10_ARB */
-   { 16507, 0x000088CB }, /* GL_MATRIX11_ARB */
-   { 16523, 0x000088CC }, /* GL_MATRIX12_ARB */
-   { 16539, 0x000088CD }, /* GL_MATRIX13_ARB */
-   { 16555, 0x000088CE }, /* GL_MATRIX14_ARB */
-   { 16571, 0x000088CF }, /* GL_MATRIX15_ARB */
-   { 16587, 0x000088D0 }, /* GL_MATRIX16_ARB */
-   { 16603, 0x000088D1 }, /* GL_MATRIX17_ARB */
-   { 16619, 0x000088D2 }, /* GL_MATRIX18_ARB */
-   { 16635, 0x000088D3 }, /* GL_MATRIX19_ARB */
-   { 16651, 0x000088C1 }, /* GL_MATRIX1_ARB */
-   { 16666, 0x00008631 }, /* GL_MATRIX1_NV */
-   { 16680, 0x000088D4 }, /* GL_MATRIX20_ARB */
-   { 16696, 0x000088D5 }, /* GL_MATRIX21_ARB */
-   { 16712, 0x000088D6 }, /* GL_MATRIX22_ARB */
-   { 16728, 0x000088D7 }, /* GL_MATRIX23_ARB */
-   { 16744, 0x000088D8 }, /* GL_MATRIX24_ARB */
-   { 16760, 0x000088D9 }, /* GL_MATRIX25_ARB */
-   { 16776, 0x000088DA }, /* GL_MATRIX26_ARB */
-   { 16792, 0x000088DB }, /* GL_MATRIX27_ARB */
-   { 16808, 0x000088DC }, /* GL_MATRIX28_ARB */
-   { 16824, 0x000088DD }, /* GL_MATRIX29_ARB */
-   { 16840, 0x000088C2 }, /* GL_MATRIX2_ARB */
-   { 16855, 0x00008632 }, /* GL_MATRIX2_NV */
-   { 16869, 0x000088DE }, /* GL_MATRIX30_ARB */
-   { 16885, 0x000088DF }, /* GL_MATRIX31_ARB */
-   { 16901, 0x000088C3 }, /* GL_MATRIX3_ARB */
-   { 16916, 0x00008633 }, /* GL_MATRIX3_NV */
-   { 16930, 0x000088C4 }, /* GL_MATRIX4_ARB */
-   { 16945, 0x00008634 }, /* GL_MATRIX4_NV */
-   { 16959, 0x000088C5 }, /* GL_MATRIX5_ARB */
-   { 16974, 0x00008635 }, /* GL_MATRIX5_NV */
-   { 16988, 0x000088C6 }, /* GL_MATRIX6_ARB */
-   { 17003, 0x00008636 }, /* GL_MATRIX6_NV */
-   { 17017, 0x000088C7 }, /* GL_MATRIX7_ARB */
-   { 17032, 0x00008637 }, /* GL_MATRIX7_NV */
-   { 17046, 0x000088C8 }, /* GL_MATRIX8_ARB */
-   { 17061, 0x000088C9 }, /* GL_MATRIX9_ARB */
-   { 17076, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
-   { 17102, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
-   { 17136, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
-   { 17167, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
-   { 17200, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
-   { 17231, 0x00000BA0 }, /* GL_MATRIX_MODE */
-   { 17246, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
-   { 17268, 0x00008008 }, /* GL_MAX */
-   { 17275, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
-   { 17298, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
-   { 17330, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
-   { 17356, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
-   { 17389, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
-   { 17415, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-   { 17449, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
-   { 17468, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
-   { 17497, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
-   { 17529, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
-   { 17565, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
-   { 17601, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
-   { 17641, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
-   { 17667, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
-   { 17697, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
-   { 17722, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
-   { 17751, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
-   { 17780, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
-   { 17813, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
-   { 17833, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
-   { 17857, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
-   { 17881, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
-   { 17905, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
-   { 17930, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
-   { 17948, 0x00008008 }, /* GL_MAX_EXT */
-   { 17959, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
-   { 17994, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
-   { 18033, 0x00000D31 }, /* GL_MAX_LIGHTS */
-   { 18047, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
-   { 18067, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
-   { 18105, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
-   { 18134, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
-   { 18158, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
-   { 18186, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
-   { 18209, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
-   { 18246, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
-   { 18282, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
-   { 18309, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
-   { 18338, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
-   { 18372, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
-   { 18408, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
-   { 18435, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
-   { 18467, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
-   { 18503, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
-   { 18532, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
-   { 18561, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
-   { 18589, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
-   { 18627, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-   { 18671, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-   { 18714, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
-   { 18748, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-   { 18787, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
-   { 18824, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
-   { 18862, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-   { 18905, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-   { 18948, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
-   { 18978, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
-   { 19009, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
-   { 19045, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
-   { 19081, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
-   { 19111, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
-   { 19145, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
-   { 19178, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
-   { 19207, 0x00008D57 }, /* GL_MAX_SAMPLES */
-   { 19222, 0x00008504 }, /* GL_MAX_SHININESS_NV */
-   { 19242, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
-   { 19266, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
-   { 19288, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
-   { 19314, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
-   { 19341, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
-   { 19372, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
-   { 19396, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
-   { 19430, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
-   { 19450, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
-   { 19477, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
-   { 19498, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
-   { 19523, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
-   { 19548, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
-   { 19583, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
-   { 19605, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
-   { 19631, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
-   { 19653, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
-   { 19679, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
-   { 19713, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
-   { 19751, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
-   { 19784, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
-   { 19821, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
-   { 19845, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
-   { 19866, 0x00008007 }, /* GL_MIN */
-   { 19873, 0x0000802E }, /* GL_MINMAX */
-   { 19883, 0x0000802E }, /* GL_MINMAX_EXT */
-   { 19897, 0x0000802F }, /* GL_MINMAX_FORMAT */
-   { 19914, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
-   { 19935, 0x00008030 }, /* GL_MINMAX_SINK */
-   { 19950, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
-   { 19969, 0x00008007 }, /* GL_MIN_EXT */
-   { 19980, 0x00008370 }, /* GL_MIRRORED_REPEAT */
-   { 19999, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
-   { 20022, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
-   { 20045, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
-   { 20065, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
-   { 20085, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
-   { 20115, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
-   { 20143, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
-   { 20171, 0x00001700 }, /* GL_MODELVIEW */
-   { 20184, 0x00001700 }, /* GL_MODELVIEW0_ARB */
-   { 20202, 0x0000872A }, /* GL_MODELVIEW10_ARB */
-   { 20221, 0x0000872B }, /* GL_MODELVIEW11_ARB */
-   { 20240, 0x0000872C }, /* GL_MODELVIEW12_ARB */
-   { 20259, 0x0000872D }, /* GL_MODELVIEW13_ARB */
-   { 20278, 0x0000872E }, /* GL_MODELVIEW14_ARB */
-   { 20297, 0x0000872F }, /* GL_MODELVIEW15_ARB */
-   { 20316, 0x00008730 }, /* GL_MODELVIEW16_ARB */
-   { 20335, 0x00008731 }, /* GL_MODELVIEW17_ARB */
-   { 20354, 0x00008732 }, /* GL_MODELVIEW18_ARB */
-   { 20373, 0x00008733 }, /* GL_MODELVIEW19_ARB */
-   { 20392, 0x0000850A }, /* GL_MODELVIEW1_ARB */
-   { 20410, 0x00008734 }, /* GL_MODELVIEW20_ARB */
-   { 20429, 0x00008735 }, /* GL_MODELVIEW21_ARB */
-   { 20448, 0x00008736 }, /* GL_MODELVIEW22_ARB */
-   { 20467, 0x00008737 }, /* GL_MODELVIEW23_ARB */
-   { 20486, 0x00008738 }, /* GL_MODELVIEW24_ARB */
-   { 20505, 0x00008739 }, /* GL_MODELVIEW25_ARB */
-   { 20524, 0x0000873A }, /* GL_MODELVIEW26_ARB */
-   { 20543, 0x0000873B }, /* GL_MODELVIEW27_ARB */
-   { 20562, 0x0000873C }, /* GL_MODELVIEW28_ARB */
-   { 20581, 0x0000873D }, /* GL_MODELVIEW29_ARB */
-   { 20600, 0x00008722 }, /* GL_MODELVIEW2_ARB */
-   { 20618, 0x0000873E }, /* GL_MODELVIEW30_ARB */
-   { 20637, 0x0000873F }, /* GL_MODELVIEW31_ARB */
-   { 20656, 0x00008723 }, /* GL_MODELVIEW3_ARB */
-   { 20674, 0x00008724 }, /* GL_MODELVIEW4_ARB */
-   { 20692, 0x00008725 }, /* GL_MODELVIEW5_ARB */
-   { 20710, 0x00008726 }, /* GL_MODELVIEW6_ARB */
-   { 20728, 0x00008727 }, /* GL_MODELVIEW7_ARB */
-   { 20746, 0x00008728 }, /* GL_MODELVIEW8_ARB */
-   { 20764, 0x00008729 }, /* GL_MODELVIEW9_ARB */
-   { 20782, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
-   { 20802, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
-   { 20829, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
-   { 20854, 0x00002100 }, /* GL_MODULATE */
-   { 20866, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
-   { 20886, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
-   { 20913, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
-   { 20938, 0x00000103 }, /* GL_MULT */
-   { 20946, 0x0000809D }, /* GL_MULTISAMPLE */
-   { 20961, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
-   { 20981, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
-   { 21000, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
-   { 21019, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
-   { 21043, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
-   { 21066, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
-   { 21096, 0x00002A25 }, /* GL_N3F_V3F */
-   { 21107, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
-   { 21127, 0x0000150E }, /* GL_NAND */
-   { 21135, 0x00002600 }, /* GL_NEAREST */
-   { 21146, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
-   { 21177, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
-   { 21209, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
-   { 21234, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
-   { 21260, 0x00000200 }, /* GL_NEVER */
-   { 21269, 0x00001102 }, /* GL_NICEST */
-   { 21279, 0x00000000 }, /* GL_NONE */
-   { 21287, 0x00001505 }, /* GL_NOOP */
-   { 21295, 0x00001508 }, /* GL_NOR */
-   { 21302, 0x00000BA1 }, /* GL_NORMALIZE */
-   { 21315, 0x00008075 }, /* GL_NORMAL_ARRAY */
-   { 21331, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
-   { 21362, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
-   { 21397, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
-   { 21421, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
-   { 21444, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
-   { 21465, 0x00008511 }, /* GL_NORMAL_MAP */
-   { 21479, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
-   { 21497, 0x00008511 }, /* GL_NORMAL_MAP_NV */
-   { 21514, 0x00000205 }, /* GL_NOTEQUAL */
-   { 21526, 0x00000000 }, /* GL_NO_ERROR */
-   { 21538, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
-   { 21572, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
-   { 21610, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
-   { 21642, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
-   { 21684, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
-   { 21714, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
-   { 21754, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
-   { 21785, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
-   { 21814, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
-   { 21842, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
-   { 21872, 0x00002401 }, /* GL_OBJECT_LINEAR */
-   { 21889, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
-   { 21915, 0x00002501 }, /* GL_OBJECT_PLANE */
-   { 21931, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
-   { 21966, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
-   { 21988, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
-   { 22007, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
-   { 22037, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
-   { 22058, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
-   { 22086, 0x00000001 }, /* GL_ONE */
-   { 22093, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
-   { 22121, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
-   { 22153, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
-   { 22181, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
-   { 22213, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
-   { 22236, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
-   { 22259, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
-   { 22282, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
-   { 22305, 0x00008598 }, /* GL_OPERAND0_ALPHA */
-   { 22323, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
-   { 22345, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
-   { 22367, 0x00008590 }, /* GL_OPERAND0_RGB */
-   { 22383, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
-   { 22403, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
-   { 22423, 0x00008599 }, /* GL_OPERAND1_ALPHA */
-   { 22441, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
-   { 22463, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
-   { 22485, 0x00008591 }, /* GL_OPERAND1_RGB */
-   { 22501, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
-   { 22521, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
-   { 22541, 0x0000859A }, /* GL_OPERAND2_ALPHA */
-   { 22559, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
-   { 22581, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
-   { 22603, 0x00008592 }, /* GL_OPERAND2_RGB */
-   { 22619, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
-   { 22639, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
-   { 22659, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
-   { 22680, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
-   { 22699, 0x00001507 }, /* GL_OR */
-   { 22705, 0x00000A01 }, /* GL_ORDER */
-   { 22714, 0x0000150D }, /* GL_OR_INVERTED */
-   { 22729, 0x0000150B }, /* GL_OR_REVERSE */
-   { 22743, 0x00000505 }, /* GL_OUT_OF_MEMORY */
-   { 22760, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
-   { 22778, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
-   { 22799, 0x00008758 }, /* GL_PACK_INVERT_MESA */
-   { 22819, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
-   { 22837, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
-   { 22856, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
-   { 22876, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
-   { 22896, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
-   { 22914, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
-   { 22933, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
-   { 22958, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
-   { 22982, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
-   { 23003, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
-   { 23025, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
-   { 23047, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
-   { 23072, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
-   { 23096, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
-   { 23117, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
-   { 23139, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
-   { 23161, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
-   { 23183, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
-   { 23214, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
-   { 23234, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
-   { 23259, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
-   { 23279, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
-   { 23304, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
-   { 23324, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
-   { 23349, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
-   { 23369, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
-   { 23394, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
-   { 23414, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
-   { 23439, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
-   { 23459, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
-   { 23484, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
-   { 23504, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
-   { 23529, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
-   { 23549, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
-   { 23574, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
-   { 23594, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
-   { 23619, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
-   { 23639, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
-   { 23664, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
-   { 23682, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
-   { 23715, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
-   { 23740, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
-   { 23775, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
-   { 23802, 0x00001B00 }, /* GL_POINT */
-   { 23811, 0x00000000 }, /* GL_POINTS */
-   { 23821, 0x00000002 }, /* GL_POINT_BIT */
-   { 23834, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
-   { 23864, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
-   { 23898, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
-   { 23932, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
-   { 23967, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
-   { 23996, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
-   { 24029, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
-   { 24062, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
-   { 24096, 0x00000B11 }, /* GL_POINT_SIZE */
-   { 24110, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
-   { 24136, 0x00008127 }, /* GL_POINT_SIZE_MAX */
-   { 24154, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
-   { 24176, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
-   { 24198, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
-   { 24221, 0x00008126 }, /* GL_POINT_SIZE_MIN */
-   { 24239, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
-   { 24261, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
-   { 24283, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
-   { 24306, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
-   { 24326, 0x00000B10 }, /* GL_POINT_SMOOTH */
-   { 24342, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
-   { 24363, 0x00008861 }, /* GL_POINT_SPRITE */
-   { 24379, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
-   { 24399, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
-   { 24428, 0x00008861 }, /* GL_POINT_SPRITE_NV */
-   { 24447, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
-   { 24473, 0x00000701 }, /* GL_POINT_TOKEN */
-   { 24488, 0x00000009 }, /* GL_POLYGON */
-   { 24499, 0x00000008 }, /* GL_POLYGON_BIT */
-   { 24514, 0x00000B40 }, /* GL_POLYGON_MODE */
-   { 24530, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
-   { 24553, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
-   { 24578, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
-   { 24601, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
-   { 24624, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
-   { 24648, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
-   { 24672, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
-   { 24690, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
-   { 24713, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
-   { 24732, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
-   { 24755, 0x00000703 }, /* GL_POLYGON_TOKEN */
-   { 24772, 0x00001203 }, /* GL_POSITION */
-   { 24784, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
-   { 24816, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
-   { 24852, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
-   { 24885, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
-   { 24922, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
-   { 24953, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
-   { 24988, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
-   { 25020, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
-   { 25056, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
-   { 25089, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
-   { 25121, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
-   { 25157, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
-   { 25190, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
-   { 25227, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
-   { 25257, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
-   { 25291, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
-   { 25322, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
-   { 25357, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
-   { 25388, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
-   { 25423, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
-   { 25455, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
-   { 25491, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
-   { 25521, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
-   { 25555, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
-   { 25586, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
-   { 25621, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
-   { 25653, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
-   { 25684, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
-   { 25719, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
-   { 25751, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
-   { 25787, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
-   { 25816, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
-   { 25849, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
-   { 25879, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
-   { 25913, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
-   { 25952, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
-   { 25985, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
-   { 26025, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
-   { 26059, 0x00008578 }, /* GL_PREVIOUS */
-   { 26071, 0x00008578 }, /* GL_PREVIOUS_ARB */
-   { 26087, 0x00008578 }, /* GL_PREVIOUS_EXT */
-   { 26103, 0x00008577 }, /* GL_PRIMARY_COLOR */
-   { 26120, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
-   { 26141, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
-   { 26162, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
-   { 26195, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
-   { 26227, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
-   { 26250, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
-   { 26273, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
-   { 26303, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
-   { 26332, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
-   { 26360, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
-   { 26382, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
-   { 26410, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
-   { 26438, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
-   { 26460, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
-   { 26481, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-   { 26521, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-   { 26560, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
-   { 26590, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-   { 26625, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
-   { 26658, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
-   { 26692, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-   { 26731, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-   { 26770, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
-   { 26792, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
-   { 26818, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
-   { 26842, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
-   { 26865, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
-   { 26887, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
-   { 26908, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
-   { 26929, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
-   { 26956, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
-   { 26988, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
-   { 27020, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
-   { 27055, 0x00001701 }, /* GL_PROJECTION */
-   { 27069, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
-   { 27090, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
-   { 27116, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
-   { 27137, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
-   { 27156, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
-   { 27179, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
-   { 27218, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
-   { 27256, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
-   { 27276, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
-   { 27306, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
-   { 27330, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
-   { 27350, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
-   { 27380, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
-   { 27404, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
-   { 27424, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
-   { 27457, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
-   { 27483, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
-   { 27513, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
-   { 27544, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
-   { 27574, 0x00002003 }, /* GL_Q */
-   { 27579, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
-   { 27604, 0x00000007 }, /* GL_QUADS */
-   { 27613, 0x00008614 }, /* GL_QUAD_MESH_SUN */
-   { 27630, 0x00000008 }, /* GL_QUAD_STRIP */
-   { 27644, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
-   { 27666, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
-   { 27692, 0x00008866 }, /* GL_QUERY_RESULT */
-   { 27708, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
-   { 27728, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
-   { 27754, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
-   { 27784, 0x00002002 }, /* GL_R */
-   { 27789, 0x00002A10 }, /* GL_R3_G3_B2 */
-   { 27801, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
-   { 27834, 0x00000C02 }, /* GL_READ_BUFFER */
-   { 27849, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
-   { 27869, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
-   { 27901, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
-   { 27925, 0x000088B8 }, /* GL_READ_ONLY */
-   { 27938, 0x000088B8 }, /* GL_READ_ONLY_ARB */
-   { 27955, 0x000088BA }, /* GL_READ_WRITE */
-   { 27969, 0x000088BA }, /* GL_READ_WRITE_ARB */
-   { 27987, 0x00001903 }, /* GL_RED */
-   { 27994, 0x00008016 }, /* GL_REDUCE */
-   { 28004, 0x00008016 }, /* GL_REDUCE_EXT */
-   { 28018, 0x00000D15 }, /* GL_RED_BIAS */
-   { 28030, 0x00000D52 }, /* GL_RED_BITS */
-   { 28042, 0x00000D14 }, /* GL_RED_SCALE */
-   { 28055, 0x00008512 }, /* GL_REFLECTION_MAP */
-   { 28073, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
-   { 28095, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
-   { 28116, 0x00001C00 }, /* GL_RENDER */
-   { 28126, 0x00008D41 }, /* GL_RENDERBUFFER */
-   { 28142, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
-   { 28169, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
-   { 28197, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
-   { 28223, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
-   { 28250, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
-   { 28270, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
-   { 28297, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
-   { 28320, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
-   { 28347, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
-   { 28379, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
-   { 28415, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
-   { 28440, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
-   { 28464, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
-   { 28493, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
-   { 28515, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
-   { 28541, 0x00001F01 }, /* GL_RENDERER */
-   { 28553, 0x00000C40 }, /* GL_RENDER_MODE */
-   { 28568, 0x00002901 }, /* GL_REPEAT */
-   { 28578, 0x00001E01 }, /* GL_REPLACE */
-   { 28589, 0x00008062 }, /* GL_REPLACE_EXT */
-   { 28604, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
-   { 28627, 0x0000803A }, /* GL_RESCALE_NORMAL */
-   { 28645, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
-   { 28667, 0x00000102 }, /* GL_RETURN */
-   { 28677, 0x00001907 }, /* GL_RGB */
-   { 28684, 0x00008052 }, /* GL_RGB10 */
-   { 28693, 0x00008059 }, /* GL_RGB10_A2 */
-   { 28705, 0x00008059 }, /* GL_RGB10_A2_EXT */
-   { 28721, 0x00008052 }, /* GL_RGB10_EXT */
-   { 28734, 0x00008053 }, /* GL_RGB12 */
-   { 28743, 0x00008053 }, /* GL_RGB12_EXT */
-   { 28756, 0x00008054 }, /* GL_RGB16 */
-   { 28765, 0x00008054 }, /* GL_RGB16_EXT */
-   { 28778, 0x0000804E }, /* GL_RGB2_EXT */
-   { 28790, 0x0000804F }, /* GL_RGB4 */
-   { 28798, 0x0000804F }, /* GL_RGB4_EXT */
-   { 28810, 0x000083A1 }, /* GL_RGB4_S3TC */
-   { 28823, 0x00008050 }, /* GL_RGB5 */
-   { 28831, 0x00008057 }, /* GL_RGB5_A1 */
-   { 28842, 0x00008057 }, /* GL_RGB5_A1_EXT */
-   { 28857, 0x00008050 }, /* GL_RGB5_EXT */
-   { 28869, 0x00008051 }, /* GL_RGB8 */
-   { 28877, 0x00008051 }, /* GL_RGB8_EXT */
-   { 28889, 0x00001908 }, /* GL_RGBA */
-   { 28897, 0x0000805A }, /* GL_RGBA12 */
-   { 28907, 0x0000805A }, /* GL_RGBA12_EXT */
-   { 28921, 0x0000805B }, /* GL_RGBA16 */
-   { 28931, 0x0000805B }, /* GL_RGBA16_EXT */
-   { 28945, 0x00008055 }, /* GL_RGBA2 */
-   { 28954, 0x00008055 }, /* GL_RGBA2_EXT */
-   { 28967, 0x00008056 }, /* GL_RGBA4 */
-   { 28976, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
-   { 28995, 0x00008056 }, /* GL_RGBA4_EXT */
-   { 29008, 0x000083A3 }, /* GL_RGBA4_S3TC */
-   { 29022, 0x00008058 }, /* GL_RGBA8 */
-   { 29031, 0x00008058 }, /* GL_RGBA8_EXT */
-   { 29044, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
-   { 29062, 0x00000C31 }, /* GL_RGBA_MODE */
-   { 29075, 0x000083A2 }, /* GL_RGBA_S3TC */
-   { 29088, 0x000083A0 }, /* GL_RGB_S3TC */
-   { 29100, 0x00008573 }, /* GL_RGB_SCALE */
-   { 29113, 0x00008573 }, /* GL_RGB_SCALE_ARB */
-   { 29130, 0x00008573 }, /* GL_RGB_SCALE_EXT */
-   { 29147, 0x00000407 }, /* GL_RIGHT */
-   { 29156, 0x00002000 }, /* GL_S */
-   { 29161, 0x00008B5D }, /* GL_SAMPLER_1D */
-   { 29175, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
-   { 29196, 0x00008B5E }, /* GL_SAMPLER_2D */
-   { 29210, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
-   { 29231, 0x00008B5F }, /* GL_SAMPLER_3D */
-   { 29245, 0x00008B60 }, /* GL_SAMPLER_CUBE */
-   { 29261, 0x000080A9 }, /* GL_SAMPLES */
-   { 29272, 0x000086B4 }, /* GL_SAMPLES_3DFX */
-   { 29288, 0x000080A9 }, /* GL_SAMPLES_ARB */
-   { 29303, 0x00008914 }, /* GL_SAMPLES_PASSED */
-   { 29321, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
-   { 29343, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
-   { 29371, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
-   { 29403, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
-   { 29426, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
-   { 29453, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
-   { 29471, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
-   { 29494, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
-   { 29516, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
-   { 29535, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
-   { 29558, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
-   { 29584, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
-   { 29614, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
-   { 29639, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
-   { 29668, 0x00080000 }, /* GL_SCISSOR_BIT */
-   { 29683, 0x00000C10 }, /* GL_SCISSOR_BOX */
-   { 29698, 0x00000C11 }, /* GL_SCISSOR_TEST */
-   { 29714, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
-   { 29739, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
-   { 29779, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
-   { 29823, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
-   { 29856, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
-   { 29886, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
-   { 29918, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
-   { 29948, 0x00001C02 }, /* GL_SELECT */
-   { 29958, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
-   { 29986, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
-   { 30011, 0x00008012 }, /* GL_SEPARABLE_2D */
-   { 30027, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
-   { 30054, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
-   { 30085, 0x0000150F }, /* GL_SET */
-   { 30092, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
-   { 30113, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
-   { 30137, 0x00008B4F }, /* GL_SHADER_TYPE */
-   { 30152, 0x00000B54 }, /* GL_SHADE_MODEL */
-   { 30167, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
-   { 30195, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
-   { 30218, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
-   { 30248, 0x00001601 }, /* GL_SHININESS */
-   { 30261, 0x00001402 }, /* GL_SHORT */
-   { 30270, 0x000081F9 }, /* GL_SINGLE_COLOR */
-   { 30286, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
-   { 30306, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
-   { 30325, 0x00001D01 }, /* GL_SMOOTH */
-   { 30335, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
-   { 30368, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
-   { 30395, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
-   { 30428, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
-   { 30455, 0x00008588 }, /* GL_SOURCE0_ALPHA */
-   { 30472, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
-   { 30493, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
-   { 30514, 0x00008580 }, /* GL_SOURCE0_RGB */
-   { 30529, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
-   { 30548, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
-   { 30567, 0x00008589 }, /* GL_SOURCE1_ALPHA */
-   { 30584, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
-   { 30605, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
-   { 30626, 0x00008581 }, /* GL_SOURCE1_RGB */
-   { 30641, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
-   { 30660, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
-   { 30679, 0x0000858A }, /* GL_SOURCE2_ALPHA */
-   { 30696, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
-   { 30717, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
-   { 30738, 0x00008582 }, /* GL_SOURCE2_RGB */
-   { 30753, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
-   { 30772, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
-   { 30791, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
-   { 30811, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
-   { 30829, 0x00001202 }, /* GL_SPECULAR */
-   { 30841, 0x00002402 }, /* GL_SPHERE_MAP */
-   { 30855, 0x00001206 }, /* GL_SPOT_CUTOFF */
-   { 30870, 0x00001204 }, /* GL_SPOT_DIRECTION */
-   { 30888, 0x00001205 }, /* GL_SPOT_EXPONENT */
-   { 30905, 0x00008588 }, /* GL_SRC0_ALPHA */
-   { 30919, 0x00008580 }, /* GL_SRC0_RGB */
-   { 30931, 0x00008589 }, /* GL_SRC1_ALPHA */
-   { 30945, 0x00008581 }, /* GL_SRC1_RGB */
-   { 30957, 0x0000858A }, /* GL_SRC2_ALPHA */
-   { 30971, 0x00008582 }, /* GL_SRC2_RGB */
-   { 30983, 0x00000302 }, /* GL_SRC_ALPHA */
-   { 30996, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
-   { 31018, 0x00000300 }, /* GL_SRC_COLOR */
-   { 31031, 0x00008C40 }, /* GL_SRGB */
-   { 31039, 0x00000503 }, /* GL_STACK_OVERFLOW */
-   { 31057, 0x00000504 }, /* GL_STACK_UNDERFLOW */
-   { 31076, 0x000088E6 }, /* GL_STATIC_COPY */
-   { 31091, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
-   { 31110, 0x000088E4 }, /* GL_STATIC_DRAW */
-   { 31125, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
-   { 31144, 0x000088E5 }, /* GL_STATIC_READ */
-   { 31159, 0x000088E5 }, /* GL_STATIC_READ_ARB */
-   { 31178, 0x00001802 }, /* GL_STENCIL */
-   { 31189, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
-   { 31211, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
-   { 31237, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
-   { 31258, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
-   { 31283, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
-   { 31304, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
-   { 31329, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
-   { 31361, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
-   { 31397, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
-   { 31429, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
-   { 31465, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
-   { 31485, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
-   { 31512, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
-   { 31538, 0x00000D57 }, /* GL_STENCIL_BITS */
-   { 31554, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
-   { 31576, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
-   { 31599, 0x00000B94 }, /* GL_STENCIL_FAIL */
-   { 31615, 0x00000B92 }, /* GL_STENCIL_FUNC */
-   { 31631, 0x00001901 }, /* GL_STENCIL_INDEX */
-   { 31648, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
-   { 31671, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
-   { 31693, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
-   { 31715, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
-   { 31737, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
-   { 31758, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
-   { 31785, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
-   { 31812, 0x00000B97 }, /* GL_STENCIL_REF */
-   { 31827, 0x00000B90 }, /* GL_STENCIL_TEST */
-   { 31843, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
-   { 31872, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
-   { 31894, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
-   { 31915, 0x00000C33 }, /* GL_STEREO */
-   { 31925, 0x000088E2 }, /* GL_STREAM_COPY */
-   { 31940, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
-   { 31959, 0x000088E0 }, /* GL_STREAM_DRAW */
-   { 31974, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
-   { 31993, 0x000088E1 }, /* GL_STREAM_READ */
-   { 32008, 0x000088E1 }, /* GL_STREAM_READ_ARB */
-   { 32027, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
-   { 32044, 0x000084E7 }, /* GL_SUBTRACT */
-   { 32056, 0x000084E7 }, /* GL_SUBTRACT_ARB */
-   { 32072, 0x00002001 }, /* GL_T */
-   { 32077, 0x00002A2A }, /* GL_T2F_C3F_V3F */
-   { 32092, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
-   { 32111, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
-   { 32127, 0x00002A2B }, /* GL_T2F_N3F_V3F */
-   { 32142, 0x00002A27 }, /* GL_T2F_V3F */
-   { 32153, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
-   { 32172, 0x00002A28 }, /* GL_T4F_V4F */
-   { 32183, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
-   { 32206, 0x00001702 }, /* GL_TEXTURE */
-   { 32217, 0x000084C0 }, /* GL_TEXTURE0 */
-   { 32229, 0x000084C0 }, /* GL_TEXTURE0_ARB */
-   { 32245, 0x000084C1 }, /* GL_TEXTURE1 */
-   { 32257, 0x000084CA }, /* GL_TEXTURE10 */
-   { 32270, 0x000084CA }, /* GL_TEXTURE10_ARB */
-   { 32287, 0x000084CB }, /* GL_TEXTURE11 */
-   { 32300, 0x000084CB }, /* GL_TEXTURE11_ARB */
-   { 32317, 0x000084CC }, /* GL_TEXTURE12 */
-   { 32330, 0x000084CC }, /* GL_TEXTURE12_ARB */
-   { 32347, 0x000084CD }, /* GL_TEXTURE13 */
-   { 32360, 0x000084CD }, /* GL_TEXTURE13_ARB */
-   { 32377, 0x000084CE }, /* GL_TEXTURE14 */
-   { 32390, 0x000084CE }, /* GL_TEXTURE14_ARB */
-   { 32407, 0x000084CF }, /* GL_TEXTURE15 */
-   { 32420, 0x000084CF }, /* GL_TEXTURE15_ARB */
-   { 32437, 0x000084D0 }, /* GL_TEXTURE16 */
-   { 32450, 0x000084D0 }, /* GL_TEXTURE16_ARB */
-   { 32467, 0x000084D1 }, /* GL_TEXTURE17 */
-   { 32480, 0x000084D1 }, /* GL_TEXTURE17_ARB */
-   { 32497, 0x000084D2 }, /* GL_TEXTURE18 */
-   { 32510, 0x000084D2 }, /* GL_TEXTURE18_ARB */
-   { 32527, 0x000084D3 }, /* GL_TEXTURE19 */
-   { 32540, 0x000084D3 }, /* GL_TEXTURE19_ARB */
-   { 32557, 0x000084C1 }, /* GL_TEXTURE1_ARB */
-   { 32573, 0x000084C2 }, /* GL_TEXTURE2 */
-   { 32585, 0x000084D4 }, /* GL_TEXTURE20 */
-   { 32598, 0x000084D4 }, /* GL_TEXTURE20_ARB */
-   { 32615, 0x000084D5 }, /* GL_TEXTURE21 */
-   { 32628, 0x000084D5 }, /* GL_TEXTURE21_ARB */
-   { 32645, 0x000084D6 }, /* GL_TEXTURE22 */
-   { 32658, 0x000084D6 }, /* GL_TEXTURE22_ARB */
-   { 32675, 0x000084D7 }, /* GL_TEXTURE23 */
-   { 32688, 0x000084D7 }, /* GL_TEXTURE23_ARB */
-   { 32705, 0x000084D8 }, /* GL_TEXTURE24 */
-   { 32718, 0x000084D8 }, /* GL_TEXTURE24_ARB */
-   { 32735, 0x000084D9 }, /* GL_TEXTURE25 */
-   { 32748, 0x000084D9 }, /* GL_TEXTURE25_ARB */
-   { 32765, 0x000084DA }, /* GL_TEXTURE26 */
-   { 32778, 0x000084DA }, /* GL_TEXTURE26_ARB */
-   { 32795, 0x000084DB }, /* GL_TEXTURE27 */
-   { 32808, 0x000084DB }, /* GL_TEXTURE27_ARB */
-   { 32825, 0x000084DC }, /* GL_TEXTURE28 */
-   { 32838, 0x000084DC }, /* GL_TEXTURE28_ARB */
-   { 32855, 0x000084DD }, /* GL_TEXTURE29 */
-   { 32868, 0x000084DD }, /* GL_TEXTURE29_ARB */
-   { 32885, 0x000084C2 }, /* GL_TEXTURE2_ARB */
-   { 32901, 0x000084C3 }, /* GL_TEXTURE3 */
-   { 32913, 0x000084DE }, /* GL_TEXTURE30 */
-   { 32926, 0x000084DE }, /* GL_TEXTURE30_ARB */
-   { 32943, 0x000084DF }, /* GL_TEXTURE31 */
-   { 32956, 0x000084DF }, /* GL_TEXTURE31_ARB */
-   { 32973, 0x000084C3 }, /* GL_TEXTURE3_ARB */
-   { 32989, 0x000084C4 }, /* GL_TEXTURE4 */
-   { 33001, 0x000084C4 }, /* GL_TEXTURE4_ARB */
-   { 33017, 0x000084C5 }, /* GL_TEXTURE5 */
-   { 33029, 0x000084C5 }, /* GL_TEXTURE5_ARB */
-   { 33045, 0x000084C6 }, /* GL_TEXTURE6 */
-   { 33057, 0x000084C6 }, /* GL_TEXTURE6_ARB */
-   { 33073, 0x000084C7 }, /* GL_TEXTURE7 */
-   { 33085, 0x000084C7 }, /* GL_TEXTURE7_ARB */
-   { 33101, 0x000084C8 }, /* GL_TEXTURE8 */
-   { 33113, 0x000084C8 }, /* GL_TEXTURE8_ARB */
-   { 33129, 0x000084C9 }, /* GL_TEXTURE9 */
-   { 33141, 0x000084C9 }, /* GL_TEXTURE9_ARB */
-   { 33157, 0x00000DE0 }, /* GL_TEXTURE_1D */
-   { 33171, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
-   { 33195, 0x00000DE1 }, /* GL_TEXTURE_2D */
-   { 33209, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
-   { 33233, 0x0000806F }, /* GL_TEXTURE_3D */
-   { 33247, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
-   { 33269, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
-   { 33295, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
-   { 33317, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
-   { 33339, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
-   { 33371, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
-   { 33393, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
-   { 33425, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
-   { 33447, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
-   { 33475, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
-   { 33507, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
-   { 33540, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
-   { 33572, 0x00040000 }, /* GL_TEXTURE_BIT */
-   { 33587, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
-   { 33608, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
-   { 33633, 0x00001005 }, /* GL_TEXTURE_BORDER */
-   { 33651, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
-   { 33675, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
-   { 33706, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
-   { 33736, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
-   { 33766, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
-   { 33801, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
-   { 33832, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-   { 33870, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
-   { 33897, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
-   { 33929, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
-   { 33963, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
-   { 33987, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
-   { 34015, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
-   { 34039, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
-   { 34067, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
-   { 34100, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
-   { 34124, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
-   { 34146, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
-   { 34168, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
-   { 34194, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
-   { 34228, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
-   { 34261, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
-   { 34298, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
-   { 34326, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
-   { 34358, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
-   { 34381, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
-   { 34419, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
-   { 34461, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
-   { 34492, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
-   { 34520, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
-   { 34550, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
-   { 34578, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
-   { 34598, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
-   { 34622, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
-   { 34653, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
-   { 34688, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
-   { 34719, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
-   { 34754, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
-   { 34785, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
-   { 34820, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
-   { 34851, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
-   { 34886, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
-   { 34917, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
-   { 34952, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
-   { 34983, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
-   { 35018, 0x00008071 }, /* GL_TEXTURE_DEPTH */
-   { 35035, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
-   { 35057, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
-   { 35083, 0x00002300 }, /* GL_TEXTURE_ENV */
-   { 35098, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
-   { 35119, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
-   { 35139, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
-   { 35165, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
-   { 35185, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
-   { 35202, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
-   { 35219, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
-   { 35236, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
-   { 35253, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
-   { 35278, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
-   { 35300, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
-   { 35326, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
-   { 35344, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
-   { 35370, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
-   { 35396, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
-   { 35426, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
-   { 35453, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
-   { 35478, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
-   { 35498, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
-   { 35522, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
-   { 35549, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
-   { 35576, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
-   { 35603, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
-   { 35629, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
-   { 35659, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
-   { 35681, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
-   { 35699, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
-   { 35729, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
-   { 35757, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
-   { 35785, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
-   { 35813, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
-   { 35834, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
-   { 35853, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
-   { 35875, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
-   { 35894, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
-   { 35914, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
-   { 35939, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
-   { 35963, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
-   { 35983, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
-   { 36007, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
-   { 36027, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
-   { 36050, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
-   { 36074, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
-   { 36099, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
-   { 36133, 0x00001000 }, /* GL_TEXTURE_WIDTH */
-   { 36150, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
-   { 36168, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
-   { 36186, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
-   { 36204, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
-   { 36224, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
-   { 36243, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
-   { 36272, 0x00001000 }, /* GL_TRANSFORM_BIT */
-   { 36289, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
-   { 36315, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
-   { 36345, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
-   { 36377, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
-   { 36407, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
-   { 36441, 0x0000862C }, /* GL_TRANSPOSE_NV */
-   { 36457, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
-   { 36488, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
-   { 36523, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
-   { 36551, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
-   { 36583, 0x00000004 }, /* GL_TRIANGLES */
-   { 36596, 0x00000006 }, /* GL_TRIANGLE_FAN */
-   { 36612, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
-   { 36633, 0x00000005 }, /* GL_TRIANGLE_STRIP */
-   { 36651, 0x00000001 }, /* GL_TRUE */
-   { 36659, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
-   { 36679, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
-   { 36702, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
-   { 36722, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
-   { 36743, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
-   { 36765, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
-   { 36787, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
-   { 36807, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
-   { 36828, 0x00001401 }, /* GL_UNSIGNED_BYTE */
-   { 36845, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
-   { 36872, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
-   { 36895, 0x00001405 }, /* GL_UNSIGNED_INT */
-   { 36911, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
-   { 36938, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
-   { 36959, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
-   { 36983, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
-   { 37014, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
-   { 37038, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
-   { 37066, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
-   { 37089, 0x00001403 }, /* GL_UNSIGNED_SHORT */
-   { 37107, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
-   { 37137, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
-   { 37163, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
-   { 37193, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
-   { 37219, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
-   { 37243, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
-   { 37271, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
-   { 37299, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
-   { 37326, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
-   { 37358, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
-   { 37389, 0x00008CA2 }, /* GL_UPPER_LEFT */
-   { 37403, 0x00002A20 }, /* GL_V2F */
-   { 37410, 0x00002A21 }, /* GL_V3F */
-   { 37417, 0x00008B83 }, /* GL_VALIDATE_STATUS */
-   { 37436, 0x00001F00 }, /* GL_VENDOR */
-   { 37446, 0x00001F02 }, /* GL_VERSION */
-   { 37457, 0x00008074 }, /* GL_VERTEX_ARRAY */
-   { 37473, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
-   { 37503, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
-   { 37534, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
-   { 37569, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
-   { 37593, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
-   { 37614, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
-   { 37637, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
-   { 37658, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
-   { 37685, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
-   { 37713, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
-   { 37741, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
-   { 37769, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
-   { 37797, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
-   { 37825, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
-   { 37853, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
-   { 37880, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
-   { 37907, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
-   { 37934, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
-   { 37961, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
-   { 37988, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
-   { 38015, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
-   { 38042, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
-   { 38069, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
-   { 38096, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
-   { 38134, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
-   { 38176, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
-   { 38207, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
-   { 38242, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
-   { 38276, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
-   { 38314, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
-   { 38345, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
-   { 38380, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
-   { 38408, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
-   { 38440, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
-   { 38470, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
-   { 38504, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
-   { 38532, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
-   { 38564, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
-   { 38584, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
-   { 38606, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
-   { 38635, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
-   { 38656, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
-   { 38685, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
-   { 38718, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
-   { 38750, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
-   { 38777, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
-   { 38808, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
-   { 38838, 0x00008B31 }, /* GL_VERTEX_SHADER */
-   { 38855, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
-   { 38876, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
-   { 38903, 0x00000BA2 }, /* GL_VIEWPORT */
-   { 38915, 0x00000800 }, /* GL_VIEWPORT_BIT */
-   { 38931, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
-   { 38951, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
-   { 38982, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
-   { 39017, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
-   { 39045, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
-   { 39070, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
-   { 39097, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
-   { 39122, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
-   { 39146, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
-   { 39165, 0x000088B9 }, /* GL_WRITE_ONLY */
-   { 39179, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
-   { 39197, 0x00001506 }, /* GL_XOR */
-   { 39204, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
-   { 39223, 0x00008757 }, /* GL_YCBCR_MESA */
-   { 39237, 0x00000000 }, /* GL_ZERO */
-   { 39245, 0x00000D16 }, /* GL_ZOOM_X */
-   { 39255, 0x00000D17 }, /* GL_ZOOM_Y */
+   {  1821, 0x0000877B }, /* GL_BUMP_ENVMAP_ATI */
+   {  1840, 0x00008777 }, /* GL_BUMP_NUM_TEX_UNITS_ATI */
+   {  1866, 0x00008775 }, /* GL_BUMP_ROT_MATRIX_ATI */
+   {  1889, 0x00008776 }, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */
+   {  1917, 0x0000877C }, /* GL_BUMP_TARGET_ATI */
+   {  1936, 0x00008778 }, /* GL_BUMP_TEX_UNITS_ATI */
+   {  1958, 0x00001400 }, /* GL_BYTE */
+   {  1966, 0x00002A24 }, /* GL_C3F_V3F */
+   {  1977, 0x00002A26 }, /* GL_C4F_N3F_V3F */
+   {  1992, 0x00002A22 }, /* GL_C4UB_V2F */
+   {  2004, 0x00002A23 }, /* GL_C4UB_V3F */
+   {  2016, 0x00000901 }, /* GL_CCW */
+   {  2023, 0x00002900 }, /* GL_CLAMP */
+   {  2032, 0x0000812D }, /* GL_CLAMP_TO_BORDER */
+   {  2051, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */
+   {  2074, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */
+   {  2098, 0x0000812F }, /* GL_CLAMP_TO_EDGE */
+   {  2115, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */
+   {  2137, 0x00001500 }, /* GL_CLEAR */
+   {  2146, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */
+   {  2171, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */
+   {  2200, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */
+   {  2226, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
+   {  2255, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */
+   {  2281, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */
+   {  2308, 0x00003000 }, /* GL_CLIP_PLANE0 */
+   {  2323, 0x00003001 }, /* GL_CLIP_PLANE1 */
+   {  2338, 0x00003002 }, /* GL_CLIP_PLANE2 */
+   {  2353, 0x00003003 }, /* GL_CLIP_PLANE3 */
+   {  2368, 0x00003004 }, /* GL_CLIP_PLANE4 */
+   {  2383, 0x00003005 }, /* GL_CLIP_PLANE5 */
+   {  2398, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
+   {  2431, 0x00000A00 }, /* GL_COEFF */
+   {  2440, 0x00001800 }, /* GL_COLOR */
+   {  2449, 0x00008076 }, /* GL_COLOR_ARRAY */
+   {  2464, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */
+   {  2494, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */
+   {  2528, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */
+   {  2551, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */
+   {  2571, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */
+   {  2593, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */
+   {  2613, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0 */
+   {  2634, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */
+   {  2659, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1 */
+   {  2680, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10 */
+   {  2702, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */
+   {  2728, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11 */
+   {  2750, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */
+   {  2776, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12 */
+   {  2798, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */
+   {  2824, 0x00008CED }, /* GL_COLOR_ATTACHMENT13 */
+   {  2846, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */
+   {  2872, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14 */
+   {  2894, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */
+   {  2920, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15 */
+   {  2942, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */
+   {  2968, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */
+   {  2993, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2 */
+   {  3014, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */
+   {  3039, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3 */
+   {  3060, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */
+   {  3085, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4 */
+   {  3106, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */
+   {  3131, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5 */
+   {  3152, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */
+   {  3177, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6 */
+   {  3198, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */
+   {  3223, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7 */
+   {  3244, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */
+   {  3269, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8 */
+   {  3290, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */
+   {  3315, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9 */
+   {  3336, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */
+   {  3361, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */
+   {  3381, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */
+   {  3402, 0x00001900 }, /* GL_COLOR_INDEX */
+   {  3417, 0x00001603 }, /* GL_COLOR_INDEXES */
+   {  3434, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */
+   {  3452, 0x00000B57 }, /* GL_COLOR_MATERIAL */
+   {  3470, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */
+   {  3493, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */
+   {  3521, 0x000080B1 }, /* GL_COLOR_MATRIX */
+   {  3537, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */
+   {  3557, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */
+   {  3585, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */
+   {  3617, 0x00008458 }, /* GL_COLOR_SUM */
+   {  3630, 0x00008458 }, /* GL_COLOR_SUM_ARB */
+   {  3647, 0x000080D0 }, /* GL_COLOR_TABLE */
+   {  3662, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */
+   {  3688, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */
+   {  3718, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_SGI */
+   {  3748, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */
+   {  3768, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS_SGI */
+   {  3792, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */
+   {  3817, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */
+   {  3846, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_SGI */
+   {  3875, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */
+   {  3897, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */
+   {  3923, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_SGI */
+   {  3949, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */
+   {  3975, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */
+   {  4005, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_SGI */
+   {  4035, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */
+   {  4065, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */
+   {  4099, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_SGI */
+   {  4133, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */
+   {  4163, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */
+   {  4197, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_SGI */
+   {  4231, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */
+   {  4255, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */
+   {  4283, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_SGI */
+   {  4311, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */
+   {  4332, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE_SGI */
+   {  4357, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */
+   {  4378, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */
+   {  4403, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_SGI */
+   {  4428, 0x00000C23 }, /* GL_COLOR_WRITEMASK */
+   {  4447, 0x00008570 }, /* GL_COMBINE */
+   {  4458, 0x00008503 }, /* GL_COMBINE4 */
+   {  4470, 0x00008572 }, /* GL_COMBINE_ALPHA */
+   {  4487, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */
+   {  4508, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */
+   {  4529, 0x00008570 }, /* GL_COMBINE_ARB */
+   {  4544, 0x00008570 }, /* GL_COMBINE_EXT */
+   {  4559, 0x00008571 }, /* GL_COMBINE_RGB */
+   {  4574, 0x00008571 }, /* GL_COMBINE_RGB_ARB */
+   {  4593, 0x00008571 }, /* GL_COMBINE_RGB_EXT */
+   {  4612, 0x0000884E }, /* GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT */
+   {  4648, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */
+   {  4672, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */
+   {  4700, 0x00001300 }, /* GL_COMPILE */
+   {  4711, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */
+   {  4734, 0x00008B81 }, /* GL_COMPILE_STATUS */
+   {  4752, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */
+   {  4772, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */
+   {  4796, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */
+   {  4820, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */
+   {  4848, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */
+   {  4872, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */
+   {  4902, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */
+   {  4936, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */
+   {  4964, 0x000084ED }, /* GL_COMPRESSED_RGB */
+   {  4982, 0x000084EE }, /* GL_COMPRESSED_RGBA */
+   {  5001, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */
+   {  5024, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
+   {  5053, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
+   {  5086, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
+   {  5119, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
+   {  5152, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */
+   {  5174, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */
+   {  5202, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
+   {  5234, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */
+   {  5264, 0x00008576 }, /* GL_CONSTANT */
+   {  5276, 0x00008003 }, /* GL_CONSTANT_ALPHA */
+   {  5294, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */
+   {  5316, 0x00008576 }, /* GL_CONSTANT_ARB */
+   {  5332, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */
+   {  5356, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */
+   {  5378, 0x00008001 }, /* GL_CONSTANT_COLOR */
+   {  5396, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */
+   {  5418, 0x00008576 }, /* GL_CONSTANT_EXT */
+   {  5434, 0x00008010 }, /* GL_CONVOLUTION_1D */
+   {  5452, 0x00008011 }, /* GL_CONVOLUTION_2D */
+   {  5470, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */
+   {  5498, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */
+   {  5529, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */
+   {  5556, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */
+   {  5587, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */
+   {  5614, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */
+   {  5645, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */
+   {  5673, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */
+   {  5705, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */
+   {  5727, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */
+   {  5753, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */
+   {  5775, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */
+   {  5801, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */
+   {  5822, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */
+   {  5847, 0x00008862 }, /* GL_COORD_REPLACE */
+   {  5864, 0x00008862 }, /* GL_COORD_REPLACE_ARB */
+   {  5885, 0x00008862 }, /* GL_COORD_REPLACE_NV */
+   {  5905, 0x00001503 }, /* GL_COPY */
+   {  5913, 0x0000150C }, /* GL_COPY_INVERTED */
+   {  5930, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */
+   {  5950, 0x00000B44 }, /* GL_CULL_FACE */
+   {  5963, 0x00000B45 }, /* GL_CULL_FACE_MODE */
+   {  5981, 0x000081AA }, /* GL_CULL_VERTEX_EXT */
+   {  6000, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
+   {  6032, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
+   {  6067, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */
+   {  6088, 0x00000001 }, /* GL_CURRENT_BIT */
+   {  6103, 0x00000B00 }, /* GL_CURRENT_COLOR */
+   {  6120, 0x00008453 }, /* GL_CURRENT_FOG_COORD */
+   {  6141, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */
+   {  6167, 0x00000B01 }, /* GL_CURRENT_INDEX */
+   {  6184, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */
+   {  6206, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */
+   {  6234, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */
+   {  6255, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
+   {  6289, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */
+   {  6322, 0x00000B02 }, /* GL_CURRENT_NORMAL */
+   {  6340, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */
+   {  6370, 0x00008B8D }, /* GL_CURRENT_PROGRAM */
+   {  6389, 0x00008865 }, /* GL_CURRENT_QUERY */
+   {  6406, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */
+   {  6427, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */
+   {  6451, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */
+   {  6478, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */
+   {  6502, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */
+   {  6529, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */
+   {  6562, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
+   {  6595, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */
+   {  6622, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */
+   {  6648, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */
+   {  6673, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */
+   {  6702, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */
+   {  6724, 0x00000900 }, /* GL_CW */
+   {  6730, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */
+   {  6751, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */
+   {  6772, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */
+   {  6792, 0x00002101 }, /* GL_DECAL */
+   {  6801, 0x00001E03 }, /* GL_DECR */
+   {  6809, 0x00008508 }, /* GL_DECR_WRAP */
+   {  6822, 0x00008508 }, /* GL_DECR_WRAP_EXT */
+   {  6839, 0x00008B80 }, /* GL_DELETE_STATUS */
+   {  6856, 0x00001801 }, /* GL_DEPTH */
+   {  6865, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */
+   {  6885, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */
+   {  6905, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */
+   {  6929, 0x00000D1F }, /* GL_DEPTH_BIAS */
+   {  6943, 0x00000D56 }, /* GL_DEPTH_BITS */
+   {  6957, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */
+   {  6977, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */
+   {  7002, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */
+   {  7022, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */
+   {  7040, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */
+   {  7061, 0x00001902 }, /* GL_DEPTH_COMPONENT */
+   {  7080, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */
+   {  7101, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */
+   {  7126, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */
+   {  7152, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */
+   {  7173, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */
+   {  7198, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */
+   {  7224, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */
+   {  7245, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */
+   {  7270, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */
+   {  7296, 0x00000B74 }, /* GL_DEPTH_FUNC */
+   {  7310, 0x00000B70 }, /* GL_DEPTH_RANGE */
+   {  7325, 0x00000D1E }, /* GL_DEPTH_SCALE */
+   {  7340, 0x000084F9 }, /* GL_DEPTH_STENCIL */
+   {  7357, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */
+   {  7385, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */
+   {  7405, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
+   {  7433, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
+   {  7461, 0x00000B71 }, /* GL_DEPTH_TEST */
+   {  7475, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */
+   {  7497, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */
+   {  7523, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */
+   {  7542, 0x00001201 }, /* GL_DIFFUSE */
+   {  7553, 0x00000BD0 }, /* GL_DITHER */
+   {  7563, 0x00000A02 }, /* GL_DOMAIN */
+   {  7573, 0x00001100 }, /* GL_DONT_CARE */
+   {  7586, 0x000086AE }, /* GL_DOT3_RGB */
+   {  7598, 0x000086AF }, /* GL_DOT3_RGBA */
+   {  7611, 0x000086AF }, /* GL_DOT3_RGBA_ARB */
+   {  7628, 0x00008741 }, /* GL_DOT3_RGBA_EXT */
+   {  7645, 0x000086AE }, /* GL_DOT3_RGB_ARB */
+   {  7661, 0x00008740 }, /* GL_DOT3_RGB_EXT */
+   {  7677, 0x0000140A }, /* GL_DOUBLE */
+   {  7687, 0x00000C32 }, /* GL_DOUBLEBUFFER */
+   {  7703, 0x00000C01 }, /* GL_DRAW_BUFFER */
+   {  7718, 0x00008825 }, /* GL_DRAW_BUFFER0 */
+   {  7734, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */
+   {  7754, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */
+   {  7774, 0x00008826 }, /* GL_DRAW_BUFFER1 */
+   {  7790, 0x0000882F }, /* GL_DRAW_BUFFER10 */
+   {  7807, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */
+   {  7828, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */
+   {  7849, 0x00008830 }, /* GL_DRAW_BUFFER11 */
+   {  7866, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */
+   {  7887, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */
+   {  7908, 0x00008831 }, /* GL_DRAW_BUFFER12 */
+   {  7925, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */
+   {  7946, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */
+   {  7967, 0x00008832 }, /* GL_DRAW_BUFFER13 */
+   {  7984, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */
+   {  8005, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */
+   {  8026, 0x00008833 }, /* GL_DRAW_BUFFER14 */
+   {  8043, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */
+   {  8064, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */
+   {  8085, 0x00008834 }, /* GL_DRAW_BUFFER15 */
+   {  8102, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */
+   {  8123, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */
+   {  8144, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */
+   {  8164, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */
+   {  8184, 0x00008827 }, /* GL_DRAW_BUFFER2 */
+   {  8200, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */
+   {  8220, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */
+   {  8240, 0x00008828 }, /* GL_DRAW_BUFFER3 */
+   {  8256, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */
+   {  8276, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */
+   {  8296, 0x00008829 }, /* GL_DRAW_BUFFER4 */
+   {  8312, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */
+   {  8332, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */
+   {  8352, 0x0000882A }, /* GL_DRAW_BUFFER5 */
+   {  8368, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */
+   {  8388, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */
+   {  8408, 0x0000882B }, /* GL_DRAW_BUFFER6 */
+   {  8424, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */
+   {  8444, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */
+   {  8464, 0x0000882C }, /* GL_DRAW_BUFFER7 */
+   {  8480, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */
+   {  8500, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */
+   {  8520, 0x0000882D }, /* GL_DRAW_BUFFER8 */
+   {  8536, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */
+   {  8556, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */
+   {  8576, 0x0000882E }, /* GL_DRAW_BUFFER9 */
+   {  8592, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */
+   {  8612, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */
+   {  8632, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */
+   {  8652, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
+   {  8684, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */
+   {  8708, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */
+   {  8728, 0x00000304 }, /* GL_DST_ALPHA */
+   {  8741, 0x00000306 }, /* GL_DST_COLOR */
+   {  8754, 0x0000877A }, /* GL_DU8DV8_ATI */
+   {  8768, 0x00008779 }, /* GL_DUDV_ATI */
+   {  8780, 0x000088EA }, /* GL_DYNAMIC_COPY */
+   {  8796, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */
+   {  8816, 0x000088E8 }, /* GL_DYNAMIC_DRAW */
+   {  8832, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */
+   {  8852, 0x000088E9 }, /* GL_DYNAMIC_READ */
+   {  8868, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */
+   {  8888, 0x00000B43 }, /* GL_EDGE_FLAG */
+   {  8901, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */
+   {  8920, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
+   {  8954, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */
+   {  8992, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */
+   {  9019, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */
+   {  9045, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */
+   {  9069, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
+   {  9101, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */
+   {  9137, 0x00001600 }, /* GL_EMISSION */
+   {  9149, 0x00002000 }, /* GL_ENABLE_BIT */
+   {  9163, 0x00000202 }, /* GL_EQUAL */
+   {  9172, 0x00001509 }, /* GL_EQUIV */
+   {  9181, 0x00010000 }, /* GL_EVAL_BIT */
+   {  9193, 0x00000800 }, /* GL_EXP */
+   {  9200, 0x00000801 }, /* GL_EXP2 */
+   {  9208, 0x00001F03 }, /* GL_EXTENSIONS */
+   {  9222, 0x00002400 }, /* GL_EYE_LINEAR */
+   {  9236, 0x00002502 }, /* GL_EYE_PLANE */
+   {  9249, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */
+   {  9274, 0x0000855B }, /* GL_EYE_RADIAL_NV */
+   {  9291, 0x00000000 }, /* GL_FALSE */
+   {  9300, 0x00001101 }, /* GL_FASTEST */
+   {  9311, 0x00001C01 }, /* GL_FEEDBACK */
+   {  9323, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */
+   {  9350, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */
+   {  9374, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */
+   {  9398, 0x00001B02 }, /* GL_FILL */
+   {  9406, 0x00001D00 }, /* GL_FLAT */
+   {  9414, 0x00001406 }, /* GL_FLOAT */
+   {  9423, 0x00008B5A }, /* GL_FLOAT_MAT2 */
+   {  9437, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */
+   {  9455, 0x00008B5B }, /* GL_FLOAT_MAT3 */
+   {  9469, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */
+   {  9487, 0x00008B5C }, /* GL_FLOAT_MAT4 */
+   {  9501, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */
+   {  9519, 0x00008B50 }, /* GL_FLOAT_VEC2 */
+   {  9533, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */
+   {  9551, 0x00008B51 }, /* GL_FLOAT_VEC3 */
+   {  9565, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */
+   {  9583, 0x00008B52 }, /* GL_FLOAT_VEC4 */
+   {  9597, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */
+   {  9615, 0x00000B60 }, /* GL_FOG */
+   {  9622, 0x00000080 }, /* GL_FOG_BIT */
+   {  9633, 0x00000B66 }, /* GL_FOG_COLOR */
+   {  9646, 0x00008451 }, /* GL_FOG_COORD */
+   {  9659, 0x00008451 }, /* GL_FOG_COORDINATE */
+   {  9677, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */
+   {  9701, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
+   {  9740, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */
+   {  9783, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */
+   {  9815, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
+   {  9846, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */
+   {  9875, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */
+   {  9900, 0x00008457 }, /* GL_FOG_COORD_ARRAY */
+   {  9919, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */
+   {  9953, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */
+   {  9980, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */
+   { 10006, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */
+   { 10030, 0x00008450 }, /* GL_FOG_COORD_SRC */
+   { 10047, 0x00000B62 }, /* GL_FOG_DENSITY */
+   { 10062, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */
+   { 10086, 0x00000B64 }, /* GL_FOG_END */
+   { 10097, 0x00000C54 }, /* GL_FOG_HINT */
+   { 10109, 0x00000B61 }, /* GL_FOG_INDEX */
+   { 10122, 0x00000B65 }, /* GL_FOG_MODE */
+   { 10134, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */
+   { 10153, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */
+   { 10178, 0x00000B63 }, /* GL_FOG_START */
+   { 10191, 0x00008452 }, /* GL_FRAGMENT_DEPTH */
+   { 10209, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */
+   { 10233, 0x00008B30 }, /* GL_FRAGMENT_SHADER */
+   { 10252, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */
+   { 10275, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
+   { 10310, 0x00008D40 }, /* GL_FRAMEBUFFER */
+   { 10325, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+   { 10362, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+   { 10398, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+   { 10439, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+   { 10480, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+   { 10517, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+   { 10554, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+   { 10592, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */
+   { 10634, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+   { 10672, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */
+   { 10714, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+   { 10749, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+   { 10788, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */
+   { 10837, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+   { 10885, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */
+   { 10937, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+   { 10977, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
+   { 11021, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+   { 11061, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */
+   { 11105, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */
+   { 11132, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */
+   { 11156, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */
+   { 11184, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */
+   { 11207, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */
+   { 11226, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+   { 11263, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */
+   { 11304, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
+   { 11345, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
+   { 11387, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
+   { 11438, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
+   { 11476, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+   { 11521, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */
+   { 11570, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+   { 11608, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
+   { 11650, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
+   { 11682, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */
+   { 11707, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */
+   { 11734, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */
+   { 11765, 0x00000404 }, /* GL_FRONT */
+   { 11774, 0x00000408 }, /* GL_FRONT_AND_BACK */
+   { 11792, 0x00000B46 }, /* GL_FRONT_FACE */
+   { 11806, 0x00000400 }, /* GL_FRONT_LEFT */
+   { 11820, 0x00000401 }, /* GL_FRONT_RIGHT */
+   { 11835, 0x00008006 }, /* GL_FUNC_ADD */
+   { 11847, 0x00008006 }, /* GL_FUNC_ADD_EXT */
+   { 11863, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */
+   { 11888, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */
+   { 11917, 0x0000800A }, /* GL_FUNC_SUBTRACT */
+   { 11934, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */
+   { 11955, 0x00008191 }, /* GL_GENERATE_MIPMAP */
+   { 11974, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */
+   { 11998, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */
+   { 12027, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */
+   { 12051, 0x00000206 }, /* GL_GEQUAL */
+   { 12061, 0x00008009 }, /* GL_GL_BLEND_EQUATION_RGB */
+   { 12086, 0x00008C4A }, /* GL_GL_COMPRESSED_SLUMINANCE */
+   { 12114, 0x00008C4B }, /* GL_GL_COMPRESSED_SLUMINANCE_ALPHA */
+   { 12148, 0x00008C48 }, /* GL_GL_COMPRESSED_SRGB */
+   { 12170, 0x00008C49 }, /* GL_GL_COMPRESSED_SRGB_ALPHA */
+   { 12198, 0x0000845F }, /* GL_GL_CURRENT_RASTER_SECONDARY_COLOR */
+   { 12235, 0x00008B65 }, /* GL_GL_FLOAT_MAT2x3 */
+   { 12254, 0x00008B66 }, /* GL_GL_FLOAT_MAT2x4 */
+   { 12273, 0x00008B67 }, /* GL_GL_FLOAT_MAT3x2 */
+   { 12292, 0x00008B68 }, /* GL_GL_FLOAT_MAT3x4 */
+   { 12311, 0x00008B69 }, /* GL_GL_FLOAT_MAT4x2 */
+   { 12330, 0x00008B6A }, /* GL_GL_FLOAT_MAT4x3 */
+   { 12349, 0x000088EB }, /* GL_GL_PIXEL_PACK_BUFFER */
+   { 12373, 0x000088ED }, /* GL_GL_PIXEL_PACK_BUFFER_BINDING */
+   { 12405, 0x000088EC }, /* GL_GL_PIXEL_UNPACK_BUFFER */
+   { 12431, 0x000088EF }, /* GL_GL_PIXEL_UNPACK_BUFFER_BINDING */
+   { 12465, 0x00008C46 }, /* GL_GL_SLUMINANCE */
+   { 12482, 0x00008C47 }, /* GL_GL_SLUMINANCE8 */
+   { 12500, 0x00008C45 }, /* GL_GL_SLUMINANCE8_ALPHA8 */
+   { 12525, 0x00008C44 }, /* GL_GL_SLUMINANCE_ALPHA */
+   { 12548, 0x00008C40 }, /* GL_GL_SRGB */
+   { 12559, 0x00008C41 }, /* GL_GL_SRGB8 */
+   { 12571, 0x00008C43 }, /* GL_GL_SRGB8_ALPHA8 */
+   { 12590, 0x00008C42 }, /* GL_GL_SRGB_ALPHA */
+   { 12607, 0x00000204 }, /* GL_GREATER */
+   { 12618, 0x00001904 }, /* GL_GREEN */
+   { 12627, 0x00000D19 }, /* GL_GREEN_BIAS */
+   { 12641, 0x00000D53 }, /* GL_GREEN_BITS */
+   { 12655, 0x00000D18 }, /* GL_GREEN_SCALE */
+   { 12670, 0x00008000 }, /* GL_HINT_BIT */
+   { 12682, 0x00008024 }, /* GL_HISTOGRAM */
+   { 12695, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
+   { 12719, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
+   { 12747, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
+   { 12770, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
+   { 12797, 0x00008024 }, /* GL_HISTOGRAM_EXT */
+   { 12814, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
+   { 12834, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
+   { 12858, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
+   { 12882, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
+   { 12910, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+   { 12938, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
+   { 12970, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
+   { 12992, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
+   { 13018, 0x0000802D }, /* GL_HISTOGRAM_SINK */
+   { 13036, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
+   { 13058, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
+   { 13077, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
+   { 13100, 0x0000862A }, /* GL_IDENTITY_NV */
+   { 13115, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
+   { 13135, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+   { 13175, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
+   { 13213, 0x00001E02 }, /* GL_INCR */
+   { 13221, 0x00008507 }, /* GL_INCR_WRAP */
+   { 13234, 0x00008507 }, /* GL_INCR_WRAP_EXT */
+   { 13251, 0x00008222 }, /* GL_INDEX */
+   { 13260, 0x00008077 }, /* GL_INDEX_ARRAY */
+   { 13275, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+   { 13305, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
+   { 13339, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
+   { 13362, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
+   { 13384, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
+   { 13404, 0x00000D51 }, /* GL_INDEX_BITS */
+   { 13418, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
+   { 13439, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
+   { 13457, 0x00000C30 }, /* GL_INDEX_MODE */
+   { 13471, 0x00000D13 }, /* GL_INDEX_OFFSET */
+   { 13487, 0x00000D12 }, /* GL_INDEX_SHIFT */
+   { 13502, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
+   { 13521, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
+   { 13540, 0x00001404 }, /* GL_INT */
+   { 13547, 0x00008049 }, /* GL_INTENSITY */
+   { 13560, 0x0000804C }, /* GL_INTENSITY12 */
+   { 13575, 0x0000804C }, /* GL_INTENSITY12_EXT */
+   { 13594, 0x0000804D }, /* GL_INTENSITY16 */
+   { 13609, 0x0000804D }, /* GL_INTENSITY16_EXT */
+   { 13628, 0x0000804A }, /* GL_INTENSITY4 */
+   { 13642, 0x0000804A }, /* GL_INTENSITY4_EXT */
+   { 13660, 0x0000804B }, /* GL_INTENSITY8 */
+   { 13674, 0x0000804B }, /* GL_INTENSITY8_EXT */
+   { 13692, 0x00008049 }, /* GL_INTENSITY_EXT */
+   { 13709, 0x00008575 }, /* GL_INTERPOLATE */
+   { 13724, 0x00008575 }, /* GL_INTERPOLATE_ARB */
+   { 13743, 0x00008575 }, /* GL_INTERPOLATE_EXT */
+   { 13762, 0x00008B53 }, /* GL_INT_VEC2 */
+   { 13774, 0x00008B53 }, /* GL_INT_VEC2_ARB */
+   { 13790, 0x00008B54 }, /* GL_INT_VEC3 */
+   { 13802, 0x00008B54 }, /* GL_INT_VEC3_ARB */
+   { 13818, 0x00008B55 }, /* GL_INT_VEC4 */
+   { 13830, 0x00008B55 }, /* GL_INT_VEC4_ARB */
+   { 13846, 0x00000500 }, /* GL_INVALID_ENUM */
+   { 13862, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+   { 13895, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
+   { 13932, 0x00000502 }, /* GL_INVALID_OPERATION */
+   { 13953, 0x00000501 }, /* GL_INVALID_VALUE */
+   { 13970, 0x0000862B }, /* GL_INVERSE_NV */
+   { 13984, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
+   { 14008, 0x0000150A }, /* GL_INVERT */
+   { 14018, 0x00001E00 }, /* GL_KEEP */
+   { 14026, 0x00000406 }, /* GL_LEFT */
+   { 14034, 0x00000203 }, /* GL_LEQUAL */
+   { 14044, 0x00000201 }, /* GL_LESS */
+   { 14052, 0x00004000 }, /* GL_LIGHT0 */
+   { 14062, 0x00004001 }, /* GL_LIGHT1 */
+   { 14072, 0x00004002 }, /* GL_LIGHT2 */
+   { 14082, 0x00004003 }, /* GL_LIGHT3 */
+   { 14092, 0x00004004 }, /* GL_LIGHT4 */
+   { 14102, 0x00004005 }, /* GL_LIGHT5 */
+   { 14112, 0x00004006 }, /* GL_LIGHT6 */
+   { 14122, 0x00004007 }, /* GL_LIGHT7 */
+   { 14132, 0x00000B50 }, /* GL_LIGHTING */
+   { 14144, 0x00000040 }, /* GL_LIGHTING_BIT */
+   { 14160, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
+   { 14183, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+   { 14212, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
+   { 14245, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+   { 14273, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
+   { 14297, 0x00001B01 }, /* GL_LINE */
+   { 14305, 0x00002601 }, /* GL_LINEAR */
+   { 14315, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
+   { 14337, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+   { 14367, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+   { 14398, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
+   { 14422, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
+   { 14447, 0x00000001 }, /* GL_LINES */
+   { 14456, 0x00000004 }, /* GL_LINE_BIT */
+   { 14468, 0x00000002 }, /* GL_LINE_LOOP */
+   { 14481, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
+   { 14501, 0x00000B20 }, /* GL_LINE_SMOOTH */
+   { 14516, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
+   { 14536, 0x00000B24 }, /* GL_LINE_STIPPLE */
+   { 14552, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
+   { 14576, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
+   { 14599, 0x00000003 }, /* GL_LINE_STRIP */
+   { 14613, 0x00000702 }, /* GL_LINE_TOKEN */
+   { 14627, 0x00000B21 }, /* GL_LINE_WIDTH */
+   { 14641, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
+   { 14667, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
+   { 14687, 0x00008B82 }, /* GL_LINK_STATUS */
+   { 14702, 0x00000B32 }, /* GL_LIST_BASE */
+   { 14715, 0x00020000 }, /* GL_LIST_BIT */
+   { 14727, 0x00000B33 }, /* GL_LIST_INDEX */
+   { 14741, 0x00000B30 }, /* GL_LIST_MODE */
+   { 14754, 0x00000101 }, /* GL_LOAD */
+   { 14762, 0x00000BF1 }, /* GL_LOGIC_OP */
+   { 14774, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
+   { 14791, 0x00008CA1 }, /* GL_LOWER_LEFT */
+   { 14805, 0x00001909 }, /* GL_LUMINANCE */
+   { 14818, 0x00008041 }, /* GL_LUMINANCE12 */
+   { 14833, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
+   { 14856, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
+   { 14883, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
+   { 14905, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
+   { 14931, 0x00008041 }, /* GL_LUMINANCE12_EXT */
+   { 14950, 0x00008042 }, /* GL_LUMINANCE16 */
+   { 14965, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
+   { 14988, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
+   { 15015, 0x00008042 }, /* GL_LUMINANCE16_EXT */
+   { 15034, 0x0000803F }, /* GL_LUMINANCE4 */
+   { 15048, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
+   { 15069, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
+   { 15094, 0x0000803F }, /* GL_LUMINANCE4_EXT */
+   { 15112, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
+   { 15133, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
+   { 15158, 0x00008040 }, /* GL_LUMINANCE8 */
+   { 15172, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
+   { 15193, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
+   { 15218, 0x00008040 }, /* GL_LUMINANCE8_EXT */
+   { 15236, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
+   { 15255, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
+   { 15271, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
+   { 15291, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
+   { 15313, 0x00000D91 }, /* GL_MAP1_INDEX */
+   { 15327, 0x00000D92 }, /* GL_MAP1_NORMAL */
+   { 15342, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
+   { 15366, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
+   { 15390, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
+   { 15414, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
+   { 15438, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
+   { 15455, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
+   { 15472, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+   { 15500, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+   { 15529, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+   { 15558, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+   { 15587, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+   { 15616, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+   { 15645, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+   { 15674, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+   { 15702, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+   { 15730, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+   { 15758, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+   { 15786, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+   { 15814, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+   { 15842, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+   { 15870, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+   { 15898, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+   { 15926, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
+   { 15942, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
+   { 15962, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
+   { 15984, 0x00000DB1 }, /* GL_MAP2_INDEX */
+   { 15998, 0x00000DB2 }, /* GL_MAP2_NORMAL */
+   { 16013, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
+   { 16037, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
+   { 16061, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
+   { 16085, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
+   { 16109, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
+   { 16126, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
+   { 16143, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+   { 16171, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+   { 16200, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+   { 16229, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+   { 16258, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+   { 16287, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+   { 16316, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+   { 16345, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+   { 16373, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+   { 16401, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+   { 16429, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+   { 16457, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+   { 16485, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+   { 16513, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
+   { 16541, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+   { 16569, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+   { 16597, 0x00000D10 }, /* GL_MAP_COLOR */
+   { 16610, 0x00000D11 }, /* GL_MAP_STENCIL */
+   { 16625, 0x000088C0 }, /* GL_MATRIX0_ARB */
+   { 16640, 0x00008630 }, /* GL_MATRIX0_NV */
+   { 16654, 0x000088CA }, /* GL_MATRIX10_ARB */
+   { 16670, 0x000088CB }, /* GL_MATRIX11_ARB */
+   { 16686, 0x000088CC }, /* GL_MATRIX12_ARB */
+   { 16702, 0x000088CD }, /* GL_MATRIX13_ARB */
+   { 16718, 0x000088CE }, /* GL_MATRIX14_ARB */
+   { 16734, 0x000088CF }, /* GL_MATRIX15_ARB */
+   { 16750, 0x000088D0 }, /* GL_MATRIX16_ARB */
+   { 16766, 0x000088D1 }, /* GL_MATRIX17_ARB */
+   { 16782, 0x000088D2 }, /* GL_MATRIX18_ARB */
+   { 16798, 0x000088D3 }, /* GL_MATRIX19_ARB */
+   { 16814, 0x000088C1 }, /* GL_MATRIX1_ARB */
+   { 16829, 0x00008631 }, /* GL_MATRIX1_NV */
+   { 16843, 0x000088D4 }, /* GL_MATRIX20_ARB */
+   { 16859, 0x000088D5 }, /* GL_MATRIX21_ARB */
+   { 16875, 0x000088D6 }, /* GL_MATRIX22_ARB */
+   { 16891, 0x000088D7 }, /* GL_MATRIX23_ARB */
+   { 16907, 0x000088D8 }, /* GL_MATRIX24_ARB */
+   { 16923, 0x000088D9 }, /* GL_MATRIX25_ARB */
+   { 16939, 0x000088DA }, /* GL_MATRIX26_ARB */
+   { 16955, 0x000088DB }, /* GL_MATRIX27_ARB */
+   { 16971, 0x000088DC }, /* GL_MATRIX28_ARB */
+   { 16987, 0x000088DD }, /* GL_MATRIX29_ARB */
+   { 17003, 0x000088C2 }, /* GL_MATRIX2_ARB */
+   { 17018, 0x00008632 }, /* GL_MATRIX2_NV */
+   { 17032, 0x000088DE }, /* GL_MATRIX30_ARB */
+   { 17048, 0x000088DF }, /* GL_MATRIX31_ARB */
+   { 17064, 0x000088C3 }, /* GL_MATRIX3_ARB */
+   { 17079, 0x00008633 }, /* GL_MATRIX3_NV */
+   { 17093, 0x000088C4 }, /* GL_MATRIX4_ARB */
+   { 17108, 0x00008634 }, /* GL_MATRIX4_NV */
+   { 17122, 0x000088C5 }, /* GL_MATRIX5_ARB */
+   { 17137, 0x00008635 }, /* GL_MATRIX5_NV */
+   { 17151, 0x000088C6 }, /* GL_MATRIX6_ARB */
+   { 17166, 0x00008636 }, /* GL_MATRIX6_NV */
+   { 17180, 0x000088C7 }, /* GL_MATRIX7_ARB */
+   { 17195, 0x00008637 }, /* GL_MATRIX7_NV */
+   { 17209, 0x000088C8 }, /* GL_MATRIX8_ARB */
+   { 17224, 0x000088C9 }, /* GL_MATRIX9_ARB */
+   { 17239, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
+   { 17265, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+   { 17299, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+   { 17330, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+   { 17363, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+   { 17394, 0x00000BA0 }, /* GL_MATRIX_MODE */
+   { 17409, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
+   { 17431, 0x00008008 }, /* GL_MAX */
+   { 17438, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
+   { 17461, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+   { 17493, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
+   { 17519, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+   { 17552, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+   { 17578, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+   { 17612, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
+   { 17631, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
+   { 17660, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+   { 17692, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
+   { 17728, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+   { 17764, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
+   { 17804, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
+   { 17830, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
+   { 17860, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
+   { 17885, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
+   { 17914, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+   { 17943, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
+   { 17976, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
+   { 17996, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
+   { 18020, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
+   { 18044, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
+   { 18068, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
+   { 18093, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
+   { 18111, 0x00008008 }, /* GL_MAX_EXT */
+   { 18122, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+   { 18157, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
+   { 18196, 0x00000D31 }, /* GL_MAX_LIGHTS */
+   { 18210, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
+   { 18230, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+   { 18268, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+   { 18297, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
+   { 18321, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
+   { 18349, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
+   { 18372, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+   { 18409, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+   { 18445, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+   { 18472, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+   { 18501, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+   { 18535, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
+   { 18571, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+   { 18598, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+   { 18630, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+   { 18666, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+   { 18695, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+   { 18724, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
+   { 18752, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+   { 18790, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+   { 18834, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+   { 18877, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+   { 18911, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+   { 18950, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+   { 18987, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+   { 19025, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+   { 19068, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+   { 19111, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+   { 19141, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+   { 19172, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+   { 19208, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+   { 19244, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
+   { 19274, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+   { 19308, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
+   { 19341, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
+   { 19370, 0x00008D57 }, /* GL_MAX_SAMPLES */
+   { 19385, 0x00008504 }, /* GL_MAX_SHININESS_NV */
+   { 19405, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
+   { 19429, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
+   { 19451, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
+   { 19477, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+   { 19504, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
+   { 19535, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
+   { 19559, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+   { 19593, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
+   { 19613, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
+   { 19640, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
+   { 19661, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
+   { 19686, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
+   { 19711, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
+   { 19746, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
+   { 19768, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
+   { 19794, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
+   { 19816, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
+   { 19842, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+   { 19876, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
+   { 19914, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+   { 19947, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
+   { 19984, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
+   { 20008, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
+   { 20029, 0x00008007 }, /* GL_MIN */
+   { 20036, 0x0000802E }, /* GL_MINMAX */
+   { 20046, 0x0000802E }, /* GL_MINMAX_EXT */
+   { 20060, 0x0000802F }, /* GL_MINMAX_FORMAT */
+   { 20077, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
+   { 20098, 0x00008030 }, /* GL_MINMAX_SINK */
+   { 20113, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
+   { 20132, 0x00008007 }, /* GL_MIN_EXT */
+   { 20143, 0x00008370 }, /* GL_MIRRORED_REPEAT */
+   { 20162, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
+   { 20185, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
+   { 20208, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
+   { 20228, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
+   { 20248, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+   { 20278, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
+   { 20306, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+   { 20334, 0x00001700 }, /* GL_MODELVIEW */
+   { 20347, 0x00001700 }, /* GL_MODELVIEW0_ARB */
+   { 20365, 0x0000872A }, /* GL_MODELVIEW10_ARB */
+   { 20384, 0x0000872B }, /* GL_MODELVIEW11_ARB */
+   { 20403, 0x0000872C }, /* GL_MODELVIEW12_ARB */
+   { 20422, 0x0000872D }, /* GL_MODELVIEW13_ARB */
+   { 20441, 0x0000872E }, /* GL_MODELVIEW14_ARB */
+   { 20460, 0x0000872F }, /* GL_MODELVIEW15_ARB */
+   { 20479, 0x00008730 }, /* GL_MODELVIEW16_ARB */
+   { 20498, 0x00008731 }, /* GL_MODELVIEW17_ARB */
+   { 20517, 0x00008732 }, /* GL_MODELVIEW18_ARB */
+   { 20536, 0x00008733 }, /* GL_MODELVIEW19_ARB */
+   { 20555, 0x0000850A }, /* GL_MODELVIEW1_ARB */
+   { 20573, 0x00008734 }, /* GL_MODELVIEW20_ARB */
+   { 20592, 0x00008735 }, /* GL_MODELVIEW21_ARB */
+   { 20611, 0x00008736 }, /* GL_MODELVIEW22_ARB */
+   { 20630, 0x00008737 }, /* GL_MODELVIEW23_ARB */
+   { 20649, 0x00008738 }, /* GL_MODELVIEW24_ARB */
+   { 20668, 0x00008739 }, /* GL_MODELVIEW25_ARB */
+   { 20687, 0x0000873A }, /* GL_MODELVIEW26_ARB */
+   { 20706, 0x0000873B }, /* GL_MODELVIEW27_ARB */
+   { 20725, 0x0000873C }, /* GL_MODELVIEW28_ARB */
+   { 20744, 0x0000873D }, /* GL_MODELVIEW29_ARB */
+   { 20763, 0x00008722 }, /* GL_MODELVIEW2_ARB */
+   { 20781, 0x0000873E }, /* GL_MODELVIEW30_ARB */
+   { 20800, 0x0000873F }, /* GL_MODELVIEW31_ARB */
+   { 20819, 0x00008723 }, /* GL_MODELVIEW3_ARB */
+   { 20837, 0x00008724 }, /* GL_MODELVIEW4_ARB */
+   { 20855, 0x00008725 }, /* GL_MODELVIEW5_ARB */
+   { 20873, 0x00008726 }, /* GL_MODELVIEW6_ARB */
+   { 20891, 0x00008727 }, /* GL_MODELVIEW7_ARB */
+   { 20909, 0x00008728 }, /* GL_MODELVIEW8_ARB */
+   { 20927, 0x00008729 }, /* GL_MODELVIEW9_ARB */
+   { 20945, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
+   { 20965, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
+   { 20992, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
+   { 21017, 0x00002100 }, /* GL_MODULATE */
+   { 21029, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
+   { 21049, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
+   { 21076, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
+   { 21101, 0x00000103 }, /* GL_MULT */
+   { 21109, 0x0000809D }, /* GL_MULTISAMPLE */
+   { 21124, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
+   { 21144, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
+   { 21163, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
+   { 21182, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
+   { 21206, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
+   { 21229, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+   { 21259, 0x00002A25 }, /* GL_N3F_V3F */
+   { 21270, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
+   { 21290, 0x0000150E }, /* GL_NAND */
+   { 21298, 0x00002600 }, /* GL_NEAREST */
+   { 21309, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+   { 21340, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+   { 21372, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
+   { 21397, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
+   { 21423, 0x00000200 }, /* GL_NEVER */
+   { 21432, 0x00001102 }, /* GL_NICEST */
+   { 21442, 0x00000000 }, /* GL_NONE */
+   { 21450, 0x00001505 }, /* GL_NOOP */
+   { 21458, 0x00001508 }, /* GL_NOR */
+   { 21465, 0x00000BA1 }, /* GL_NORMALIZE */
+   { 21478, 0x00008075 }, /* GL_NORMAL_ARRAY */
+   { 21494, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+   { 21525, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
+   { 21560, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
+   { 21584, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
+   { 21607, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
+   { 21628, 0x00008511 }, /* GL_NORMAL_MAP */
+   { 21642, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
+   { 21660, 0x00008511 }, /* GL_NORMAL_MAP_NV */
+   { 21677, 0x00000205 }, /* GL_NOTEQUAL */
+   { 21689, 0x00000000 }, /* GL_NO_ERROR */
+   { 21701, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+   { 21735, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
+   { 21773, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
+   { 21805, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
+   { 21847, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
+   { 21877, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
+   { 21917, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
+   { 21948, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
+   { 21977, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
+   { 22005, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
+   { 22035, 0x00002401 }, /* GL_OBJECT_LINEAR */
+   { 22052, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
+   { 22078, 0x00002501 }, /* GL_OBJECT_PLANE */
+   { 22094, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
+   { 22129, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
+   { 22151, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
+   { 22170, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
+   { 22200, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
+   { 22221, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
+   { 22249, 0x00000001 }, /* GL_ONE */
+   { 22256, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+   { 22284, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
+   { 22316, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
+   { 22344, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
+   { 22376, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
+   { 22399, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
+   { 22422, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
+   { 22445, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
+   { 22468, 0x00008598 }, /* GL_OPERAND0_ALPHA */
+   { 22486, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
+   { 22508, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
+   { 22530, 0x00008590 }, /* GL_OPERAND0_RGB */
+   { 22546, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
+   { 22566, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
+   { 22586, 0x00008599 }, /* GL_OPERAND1_ALPHA */
+   { 22604, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
+   { 22626, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
+   { 22648, 0x00008591 }, /* GL_OPERAND1_RGB */
+   { 22664, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
+   { 22684, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
+   { 22704, 0x0000859A }, /* GL_OPERAND2_ALPHA */
+   { 22722, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
+   { 22744, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
+   { 22766, 0x00008592 }, /* GL_OPERAND2_RGB */
+   { 22782, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
+   { 22802, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
+   { 22822, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
+   { 22843, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
+   { 22862, 0x00001507 }, /* GL_OR */
+   { 22868, 0x00000A01 }, /* GL_ORDER */
+   { 22877, 0x0000150D }, /* GL_OR_INVERTED */
+   { 22892, 0x0000150B }, /* GL_OR_REVERSE */
+   { 22906, 0x00000505 }, /* GL_OUT_OF_MEMORY */
+   { 22923, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
+   { 22941, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
+   { 22962, 0x00008758 }, /* GL_PACK_INVERT_MESA */
+   { 22982, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
+   { 23000, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
+   { 23019, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
+   { 23039, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
+   { 23059, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
+   { 23077, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
+   { 23096, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
+   { 23121, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
+   { 23145, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
+   { 23166, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
+   { 23188, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
+   { 23210, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
+   { 23235, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
+   { 23259, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
+   { 23280, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
+   { 23302, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
+   { 23324, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
+   { 23346, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
+   { 23377, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
+   { 23397, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+   { 23422, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
+   { 23442, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+   { 23467, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
+   { 23487, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+   { 23512, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
+   { 23532, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+   { 23557, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
+   { 23577, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+   { 23602, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
+   { 23622, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+   { 23647, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
+   { 23667, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+   { 23692, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
+   { 23712, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+   { 23737, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
+   { 23757, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+   { 23782, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
+   { 23802, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+   { 23827, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
+   { 23845, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
+   { 23878, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
+   { 23903, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
+   { 23938, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
+   { 23965, 0x00001B00 }, /* GL_POINT */
+   { 23974, 0x00000000 }, /* GL_POINTS */
+   { 23984, 0x00000002 }, /* GL_POINT_BIT */
+   { 23997, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
+   { 24027, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
+   { 24061, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
+   { 24095, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
+   { 24130, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
+   { 24159, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
+   { 24192, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
+   { 24225, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
+   { 24259, 0x00000B11 }, /* GL_POINT_SIZE */
+   { 24273, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
+   { 24299, 0x00008127 }, /* GL_POINT_SIZE_MAX */
+   { 24317, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
+   { 24339, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
+   { 24361, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
+   { 24384, 0x00008126 }, /* GL_POINT_SIZE_MIN */
+   { 24402, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
+   { 24424, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
+   { 24446, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
+   { 24469, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
+   { 24489, 0x00000B10 }, /* GL_POINT_SMOOTH */
+   { 24505, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
+   { 24526, 0x00008861 }, /* GL_POINT_SPRITE */
+   { 24542, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
+   { 24562, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
+   { 24591, 0x00008861 }, /* GL_POINT_SPRITE_NV */
+   { 24610, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
+   { 24636, 0x00000701 }, /* GL_POINT_TOKEN */
+   { 24651, 0x00000009 }, /* GL_POLYGON */
+   { 24662, 0x00000008 }, /* GL_POLYGON_BIT */
+   { 24677, 0x00000B40 }, /* GL_POLYGON_MODE */
+   { 24693, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
+   { 24716, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
+   { 24741, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
+   { 24764, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
+   { 24787, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
+   { 24811, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
+   { 24835, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
+   { 24853, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
+   { 24876, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
+   { 24895, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
+   { 24918, 0x00000703 }, /* GL_POLYGON_TOKEN */
+   { 24935, 0x00001203 }, /* GL_POSITION */
+   { 24947, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+   { 24979, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
+   { 25015, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+   { 25048, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
+   { 25085, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+   { 25116, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
+   { 25151, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+   { 25183, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
+   { 25219, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+   { 25252, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+   { 25284, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
+   { 25320, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+   { 25353, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
+   { 25390, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+   { 25420, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
+   { 25454, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+   { 25485, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
+   { 25520, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+   { 25551, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
+   { 25586, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+   { 25618, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
+   { 25654, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+   { 25684, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
+   { 25718, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+   { 25749, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
+   { 25784, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+   { 25816, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+   { 25847, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
+   { 25882, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+   { 25914, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
+   { 25950, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
+   { 25979, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
+   { 26012, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
+   { 26042, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
+   { 26076, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+   { 26115, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+   { 26148, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+   { 26188, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+   { 26222, 0x00008578 }, /* GL_PREVIOUS */
+   { 26234, 0x00008578 }, /* GL_PREVIOUS_ARB */
+   { 26250, 0x00008578 }, /* GL_PREVIOUS_EXT */
+   { 26266, 0x00008577 }, /* GL_PRIMARY_COLOR */
+   { 26283, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
+   { 26304, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
+   { 26325, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+   { 26358, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+   { 26390, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
+   { 26413, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
+   { 26436, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
+   { 26466, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
+   { 26495, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
+   { 26523, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
+   { 26545, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+   { 26573, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+   { 26601, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
+   { 26623, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
+   { 26644, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+   { 26684, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+   { 26723, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+   { 26753, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+   { 26788, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+   { 26821, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+   { 26855, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+   { 26894, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+   { 26933, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
+   { 26955, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
+   { 26981, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
+   { 27005, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
+   { 27028, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
+   { 27050, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
+   { 27071, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
+   { 27092, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
+   { 27119, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+   { 27151, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+   { 27183, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+   { 27218, 0x00001701 }, /* GL_PROJECTION */
+   { 27232, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
+   { 27253, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
+   { 27279, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
+   { 27300, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
+   { 27319, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
+   { 27342, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+   { 27381, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+   { 27419, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
+   { 27439, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+   { 27469, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
+   { 27493, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
+   { 27513, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+   { 27543, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
+   { 27567, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
+   { 27587, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+   { 27620, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
+   { 27646, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
+   { 27676, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+   { 27707, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
+   { 27737, 0x00002003 }, /* GL_Q */
+   { 27742, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
+   { 27767, 0x00000007 }, /* GL_QUADS */
+   { 27776, 0x00008614 }, /* GL_QUAD_MESH_SUN */
+   { 27793, 0x00000008 }, /* GL_QUAD_STRIP */
+   { 27807, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
+   { 27829, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
+   { 27855, 0x00008866 }, /* GL_QUERY_RESULT */
+   { 27871, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
+   { 27891, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
+   { 27917, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
+   { 27947, 0x00002002 }, /* GL_R */
+   { 27952, 0x00002A10 }, /* GL_R3_G3_B2 */
+   { 27964, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+   { 27997, 0x00000C02 }, /* GL_READ_BUFFER */
+   { 28012, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
+   { 28032, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
+   { 28064, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
+   { 28088, 0x000088B8 }, /* GL_READ_ONLY */
+   { 28101, 0x000088B8 }, /* GL_READ_ONLY_ARB */
+   { 28118, 0x000088BA }, /* GL_READ_WRITE */
+   { 28132, 0x000088BA }, /* GL_READ_WRITE_ARB */
+   { 28150, 0x00001903 }, /* GL_RED */
+   { 28157, 0x00008016 }, /* GL_REDUCE */
+   { 28167, 0x00008016 }, /* GL_REDUCE_EXT */
+   { 28181, 0x00000D15 }, /* GL_RED_BIAS */
+   { 28193, 0x00000D52 }, /* GL_RED_BITS */
+   { 28205, 0x00000D14 }, /* GL_RED_SCALE */
+   { 28218, 0x00008512 }, /* GL_REFLECTION_MAP */
+   { 28236, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
+   { 28258, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
+   { 28279, 0x00001C00 }, /* GL_RENDER */
+   { 28289, 0x00008D41 }, /* GL_RENDERBUFFER */
+   { 28305, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
+   { 28332, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
+   { 28360, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
+   { 28386, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
+   { 28413, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
+   { 28433, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
+   { 28460, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
+   { 28483, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
+   { 28510, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+   { 28542, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
+   { 28578, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
+   { 28603, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
+   { 28627, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
+   { 28656, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
+   { 28678, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
+   { 28704, 0x00001F01 }, /* GL_RENDERER */
+   { 28716, 0x00000C40 }, /* GL_RENDER_MODE */
+   { 28731, 0x00002901 }, /* GL_REPEAT */
+   { 28741, 0x00001E01 }, /* GL_REPLACE */
+   { 28752, 0x00008062 }, /* GL_REPLACE_EXT */
+   { 28767, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
+   { 28790, 0x0000803A }, /* GL_RESCALE_NORMAL */
+   { 28808, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
+   { 28830, 0x00000102 }, /* GL_RETURN */
+   { 28840, 0x00001907 }, /* GL_RGB */
+   { 28847, 0x00008052 }, /* GL_RGB10 */
+   { 28856, 0x00008059 }, /* GL_RGB10_A2 */
+   { 28868, 0x00008059 }, /* GL_RGB10_A2_EXT */
+   { 28884, 0x00008052 }, /* GL_RGB10_EXT */
+   { 28897, 0x00008053 }, /* GL_RGB12 */
+   { 28906, 0x00008053 }, /* GL_RGB12_EXT */
+   { 28919, 0x00008054 }, /* GL_RGB16 */
+   { 28928, 0x00008054 }, /* GL_RGB16_EXT */
+   { 28941, 0x0000804E }, /* GL_RGB2_EXT */
+   { 28953, 0x0000804F }, /* GL_RGB4 */
+   { 28961, 0x0000804F }, /* GL_RGB4_EXT */
+   { 28973, 0x000083A1 }, /* GL_RGB4_S3TC */
+   { 28986, 0x00008050 }, /* GL_RGB5 */
+   { 28994, 0x00008057 }, /* GL_RGB5_A1 */
+   { 29005, 0x00008057 }, /* GL_RGB5_A1_EXT */
+   { 29020, 0x00008050 }, /* GL_RGB5_EXT */
+   { 29032, 0x00008051 }, /* GL_RGB8 */
+   { 29040, 0x00008051 }, /* GL_RGB8_EXT */
+   { 29052, 0x00001908 }, /* GL_RGBA */
+   { 29060, 0x0000805A }, /* GL_RGBA12 */
+   { 29070, 0x0000805A }, /* GL_RGBA12_EXT */
+   { 29084, 0x0000805B }, /* GL_RGBA16 */
+   { 29094, 0x0000805B }, /* GL_RGBA16_EXT */
+   { 29108, 0x00008055 }, /* GL_RGBA2 */
+   { 29117, 0x00008055 }, /* GL_RGBA2_EXT */
+   { 29130, 0x00008056 }, /* GL_RGBA4 */
+   { 29139, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
+   { 29158, 0x00008056 }, /* GL_RGBA4_EXT */
+   { 29171, 0x000083A3 }, /* GL_RGBA4_S3TC */
+   { 29185, 0x00008058 }, /* GL_RGBA8 */
+   { 29194, 0x00008058 }, /* GL_RGBA8_EXT */
+   { 29207, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
+   { 29225, 0x00000C31 }, /* GL_RGBA_MODE */
+   { 29238, 0x000083A2 }, /* GL_RGBA_S3TC */
+   { 29251, 0x000083A0 }, /* GL_RGB_S3TC */
+   { 29263, 0x00008573 }, /* GL_RGB_SCALE */
+   { 29276, 0x00008573 }, /* GL_RGB_SCALE_ARB */
+   { 29293, 0x00008573 }, /* GL_RGB_SCALE_EXT */
+   { 29310, 0x00000407 }, /* GL_RIGHT */
+   { 29319, 0x00002000 }, /* GL_S */
+   { 29324, 0x00008B5D }, /* GL_SAMPLER_1D */
+   { 29338, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
+   { 29359, 0x00008B5E }, /* GL_SAMPLER_2D */
+   { 29373, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
+   { 29394, 0x00008B5F }, /* GL_SAMPLER_3D */
+   { 29408, 0x00008B60 }, /* GL_SAMPLER_CUBE */
+   { 29424, 0x000080A9 }, /* GL_SAMPLES */
+   { 29435, 0x000086B4 }, /* GL_SAMPLES_3DFX */
+   { 29451, 0x000080A9 }, /* GL_SAMPLES_ARB */
+   { 29466, 0x00008914 }, /* GL_SAMPLES_PASSED */
+   { 29484, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
+   { 29506, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+   { 29534, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
+   { 29566, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
+   { 29589, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
+   { 29616, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
+   { 29634, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
+   { 29657, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
+   { 29679, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
+   { 29698, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
+   { 29721, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
+   { 29747, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
+   { 29777, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
+   { 29802, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
+   { 29831, 0x00080000 }, /* GL_SCISSOR_BIT */
+   { 29846, 0x00000C10 }, /* GL_SCISSOR_BOX */
+   { 29861, 0x00000C11 }, /* GL_SCISSOR_TEST */
+   { 29877, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
+   { 29902, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+   { 29942, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
+   { 29986, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+   { 30019, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+   { 30049, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+   { 30081, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+   { 30111, 0x00001C02 }, /* GL_SELECT */
+   { 30121, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
+   { 30149, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
+   { 30174, 0x00008012 }, /* GL_SEPARABLE_2D */
+   { 30190, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
+   { 30217, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
+   { 30248, 0x0000150F }, /* GL_SET */
+   { 30255, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
+   { 30276, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
+   { 30300, 0x00008B4F }, /* GL_SHADER_TYPE */
+   { 30315, 0x00000B54 }, /* GL_SHADE_MODEL */
+   { 30330, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
+   { 30358, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
+   { 30381, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+   { 30411, 0x00001601 }, /* GL_SHININESS */
+   { 30424, 0x00001402 }, /* GL_SHORT */
+   { 30433, 0x000081F9 }, /* GL_SINGLE_COLOR */
+   { 30449, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
+   { 30469, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
+   { 30488, 0x00001D01 }, /* GL_SMOOTH */
+   { 30498, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
+   { 30531, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
+   { 30558, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
+   { 30591, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
+   { 30618, 0x00008588 }, /* GL_SOURCE0_ALPHA */
+   { 30635, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
+   { 30656, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
+   { 30677, 0x00008580 }, /* GL_SOURCE0_RGB */
+   { 30692, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
+   { 30711, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
+   { 30730, 0x00008589 }, /* GL_SOURCE1_ALPHA */
+   { 30747, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
+   { 30768, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
+   { 30789, 0x00008581 }, /* GL_SOURCE1_RGB */
+   { 30804, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
+   { 30823, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
+   { 30842, 0x0000858A }, /* GL_SOURCE2_ALPHA */
+   { 30859, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
+   { 30880, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
+   { 30901, 0x00008582 }, /* GL_SOURCE2_RGB */
+   { 30916, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
+   { 30935, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
+   { 30954, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
+   { 30974, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
+   { 30992, 0x00001202 }, /* GL_SPECULAR */
+   { 31004, 0x00002402 }, /* GL_SPHERE_MAP */
+   { 31018, 0x00001206 }, /* GL_SPOT_CUTOFF */
+   { 31033, 0x00001204 }, /* GL_SPOT_DIRECTION */
+   { 31051, 0x00001205 }, /* GL_SPOT_EXPONENT */
+   { 31068, 0x00008588 }, /* GL_SRC0_ALPHA */
+   { 31082, 0x00008580 }, /* GL_SRC0_RGB */
+   { 31094, 0x00008589 }, /* GL_SRC1_ALPHA */
+   { 31108, 0x00008581 }, /* GL_SRC1_RGB */
+   { 31120, 0x0000858A }, /* GL_SRC2_ALPHA */
+   { 31134, 0x00008582 }, /* GL_SRC2_RGB */
+   { 31146, 0x00000302 }, /* GL_SRC_ALPHA */
+   { 31159, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
+   { 31181, 0x00000300 }, /* GL_SRC_COLOR */
+   { 31194, 0x00008C40 }, /* GL_SRGB */
+   { 31202, 0x00000503 }, /* GL_STACK_OVERFLOW */
+   { 31220, 0x00000504 }, /* GL_STACK_UNDERFLOW */
+   { 31239, 0x000088E6 }, /* GL_STATIC_COPY */
+   { 31254, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
+   { 31273, 0x000088E4 }, /* GL_STATIC_DRAW */
+   { 31288, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
+   { 31307, 0x000088E5 }, /* GL_STATIC_READ */
+   { 31322, 0x000088E5 }, /* GL_STATIC_READ_ARB */
+   { 31341, 0x00001802 }, /* GL_STENCIL */
+   { 31352, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
+   { 31374, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
+   { 31400, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
+   { 31421, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
+   { 31446, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
+   { 31467, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
+   { 31492, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+   { 31524, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
+   { 31560, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+   { 31592, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
+   { 31628, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
+   { 31648, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
+   { 31675, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
+   { 31701, 0x00000D57 }, /* GL_STENCIL_BITS */
+   { 31717, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
+   { 31739, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
+   { 31762, 0x00000B94 }, /* GL_STENCIL_FAIL */
+   { 31778, 0x00000B92 }, /* GL_STENCIL_FUNC */
+   { 31794, 0x00001901 }, /* GL_STENCIL_INDEX */
+   { 31811, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
+   { 31834, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
+   { 31856, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
+   { 31878, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
+   { 31900, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
+   { 31921, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
+   { 31948, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
+   { 31975, 0x00000B97 }, /* GL_STENCIL_REF */
+   { 31990, 0x00000B90 }, /* GL_STENCIL_TEST */
+   { 32006, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+   { 32035, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
+   { 32057, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
+   { 32078, 0x00000C33 }, /* GL_STEREO */
+   { 32088, 0x000088E2 }, /* GL_STREAM_COPY */
+   { 32103, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
+   { 32122, 0x000088E0 }, /* GL_STREAM_DRAW */
+   { 32137, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
+   { 32156, 0x000088E1 }, /* GL_STREAM_READ */
+   { 32171, 0x000088E1 }, /* GL_STREAM_READ_ARB */
+   { 32190, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
+   { 32207, 0x000084E7 }, /* GL_SUBTRACT */
+   { 32219, 0x000084E7 }, /* GL_SUBTRACT_ARB */
+   { 32235, 0x00002001 }, /* GL_T */
+   { 32240, 0x00002A2A }, /* GL_T2F_C3F_V3F */
+   { 32255, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
+   { 32274, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
+   { 32290, 0x00002A2B }, /* GL_T2F_N3F_V3F */
+   { 32305, 0x00002A27 }, /* GL_T2F_V3F */
+   { 32316, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
+   { 32335, 0x00002A28 }, /* GL_T4F_V4F */
+   { 32346, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
+   { 32369, 0x00001702 }, /* GL_TEXTURE */
+   { 32380, 0x000084C0 }, /* GL_TEXTURE0 */
+   { 32392, 0x000084C0 }, /* GL_TEXTURE0_ARB */
+   { 32408, 0x000084C1 }, /* GL_TEXTURE1 */
+   { 32420, 0x000084CA }, /* GL_TEXTURE10 */
+   { 32433, 0x000084CA }, /* GL_TEXTURE10_ARB */
+   { 32450, 0x000084CB }, /* GL_TEXTURE11 */
+   { 32463, 0x000084CB }, /* GL_TEXTURE11_ARB */
+   { 32480, 0x000084CC }, /* GL_TEXTURE12 */
+   { 32493, 0x000084CC }, /* GL_TEXTURE12_ARB */
+   { 32510, 0x000084CD }, /* GL_TEXTURE13 */
+   { 32523, 0x000084CD }, /* GL_TEXTURE13_ARB */
+   { 32540, 0x000084CE }, /* GL_TEXTURE14 */
+   { 32553, 0x000084CE }, /* GL_TEXTURE14_ARB */
+   { 32570, 0x000084CF }, /* GL_TEXTURE15 */
+   { 32583, 0x000084CF }, /* GL_TEXTURE15_ARB */
+   { 32600, 0x000084D0 }, /* GL_TEXTURE16 */
+   { 32613, 0x000084D0 }, /* GL_TEXTURE16_ARB */
+   { 32630, 0x000084D1 }, /* GL_TEXTURE17 */
+   { 32643, 0x000084D1 }, /* GL_TEXTURE17_ARB */
+   { 32660, 0x000084D2 }, /* GL_TEXTURE18 */
+   { 32673, 0x000084D2 }, /* GL_TEXTURE18_ARB */
+   { 32690, 0x000084D3 }, /* GL_TEXTURE19 */
+   { 32703, 0x000084D3 }, /* GL_TEXTURE19_ARB */
+   { 32720, 0x000084C1 }, /* GL_TEXTURE1_ARB */
+   { 32736, 0x000084C2 }, /* GL_TEXTURE2 */
+   { 32748, 0x000084D4 }, /* GL_TEXTURE20 */
+   { 32761, 0x000084D4 }, /* GL_TEXTURE20_ARB */
+   { 32778, 0x000084D5 }, /* GL_TEXTURE21 */
+   { 32791, 0x000084D5 }, /* GL_TEXTURE21_ARB */
+   { 32808, 0x000084D6 }, /* GL_TEXTURE22 */
+   { 32821, 0x000084D6 }, /* GL_TEXTURE22_ARB */
+   { 32838, 0x000084D7 }, /* GL_TEXTURE23 */
+   { 32851, 0x000084D7 }, /* GL_TEXTURE23_ARB */
+   { 32868, 0x000084D8 }, /* GL_TEXTURE24 */
+   { 32881, 0x000084D8 }, /* GL_TEXTURE24_ARB */
+   { 32898, 0x000084D9 }, /* GL_TEXTURE25 */
+   { 32911, 0x000084D9 }, /* GL_TEXTURE25_ARB */
+   { 32928, 0x000084DA }, /* GL_TEXTURE26 */
+   { 32941, 0x000084DA }, /* GL_TEXTURE26_ARB */
+   { 32958, 0x000084DB }, /* GL_TEXTURE27 */
+   { 32971, 0x000084DB }, /* GL_TEXTURE27_ARB */
+   { 32988, 0x000084DC }, /* GL_TEXTURE28 */
+   { 33001, 0x000084DC }, /* GL_TEXTURE28_ARB */
+   { 33018, 0x000084DD }, /* GL_TEXTURE29 */
+   { 33031, 0x000084DD }, /* GL_TEXTURE29_ARB */
+   { 33048, 0x000084C2 }, /* GL_TEXTURE2_ARB */
+   { 33064, 0x000084C3 }, /* GL_TEXTURE3 */
+   { 33076, 0x000084DE }, /* GL_TEXTURE30 */
+   { 33089, 0x000084DE }, /* GL_TEXTURE30_ARB */
+   { 33106, 0x000084DF }, /* GL_TEXTURE31 */
+   { 33119, 0x000084DF }, /* GL_TEXTURE31_ARB */
+   { 33136, 0x000084C3 }, /* GL_TEXTURE3_ARB */
+   { 33152, 0x000084C4 }, /* GL_TEXTURE4 */
+   { 33164, 0x000084C4 }, /* GL_TEXTURE4_ARB */
+   { 33180, 0x000084C5 }, /* GL_TEXTURE5 */
+   { 33192, 0x000084C5 }, /* GL_TEXTURE5_ARB */
+   { 33208, 0x000084C6 }, /* GL_TEXTURE6 */
+   { 33220, 0x000084C6 }, /* GL_TEXTURE6_ARB */
+   { 33236, 0x000084C7 }, /* GL_TEXTURE7 */
+   { 33248, 0x000084C7 }, /* GL_TEXTURE7_ARB */
+   { 33264, 0x000084C8 }, /* GL_TEXTURE8 */
+   { 33276, 0x000084C8 }, /* GL_TEXTURE8_ARB */
+   { 33292, 0x000084C9 }, /* GL_TEXTURE9 */
+   { 33304, 0x000084C9 }, /* GL_TEXTURE9_ARB */
+   { 33320, 0x00000DE0 }, /* GL_TEXTURE_1D */
+   { 33334, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
+   { 33358, 0x00000DE1 }, /* GL_TEXTURE_2D */
+   { 33372, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
+   { 33396, 0x0000806F }, /* GL_TEXTURE_3D */
+   { 33410, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
+   { 33432, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
+   { 33458, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
+   { 33480, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
+   { 33502, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+   { 33534, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
+   { 33556, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+   { 33588, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
+   { 33610, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
+   { 33638, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
+   { 33670, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+   { 33703, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
+   { 33735, 0x00040000 }, /* GL_TEXTURE_BIT */
+   { 33750, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
+   { 33771, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
+   { 33796, 0x00001005 }, /* GL_TEXTURE_BORDER */
+   { 33814, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
+   { 33838, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+   { 33869, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+   { 33899, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+   { 33929, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+   { 33964, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+   { 33995, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+   { 34033, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
+   { 34060, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+   { 34092, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+   { 34126, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
+   { 34150, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
+   { 34178, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
+   { 34202, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
+   { 34230, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+   { 34263, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
+   { 34287, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
+   { 34309, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
+   { 34331, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
+   { 34357, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
+   { 34391, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+   { 34424, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
+   { 34461, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
+   { 34489, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
+   { 34521, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
+   { 34544, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+   { 34582, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
+   { 34624, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+   { 34655, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+   { 34683, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+   { 34713, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+   { 34741, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
+   { 34761, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
+   { 34785, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+   { 34816, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
+   { 34851, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+   { 34882, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
+   { 34917, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+   { 34948, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
+   { 34983, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+   { 35014, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
+   { 35049, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+   { 35080, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
+   { 35115, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+   { 35146, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
+   { 35181, 0x00008071 }, /* GL_TEXTURE_DEPTH */
+   { 35198, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
+   { 35220, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
+   { 35246, 0x00002300 }, /* GL_TEXTURE_ENV */
+   { 35261, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
+   { 35282, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
+   { 35302, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
+   { 35328, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
+   { 35348, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
+   { 35365, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
+   { 35382, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
+   { 35399, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
+   { 35416, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
+   { 35441, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
+   { 35463, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
+   { 35489, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
+   { 35507, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
+   { 35533, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
+   { 35559, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
+   { 35589, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
+   { 35616, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
+   { 35641, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
+   { 35661, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
+   { 35685, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+   { 35712, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+   { 35739, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+   { 35766, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
+   { 35792, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
+   { 35822, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
+   { 35844, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
+   { 35862, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+   { 35892, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+   { 35920, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+   { 35948, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+   { 35976, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
+   { 35997, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
+   { 36016, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
+   { 36038, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
+   { 36057, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
+   { 36077, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
+   { 36102, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
+   { 36126, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
+   { 36146, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
+   { 36170, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
+   { 36190, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
+   { 36213, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
+   { 36237, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
+   { 36262, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+   { 36296, 0x00001000 }, /* GL_TEXTURE_WIDTH */
+   { 36313, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
+   { 36331, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
+   { 36349, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
+   { 36367, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
+   { 36387, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
+   { 36406, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+   { 36435, 0x00001000 }, /* GL_TRANSFORM_BIT */
+   { 36452, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
+   { 36478, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
+   { 36508, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+   { 36540, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+   { 36570, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
+   { 36604, 0x0000862C }, /* GL_TRANSPOSE_NV */
+   { 36620, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+   { 36651, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
+   { 36686, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+   { 36714, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
+   { 36746, 0x00000004 }, /* GL_TRIANGLES */
+   { 36759, 0x00000006 }, /* GL_TRIANGLE_FAN */
+   { 36775, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
+   { 36796, 0x00000005 }, /* GL_TRIANGLE_STRIP */
+   { 36814, 0x00000001 }, /* GL_TRUE */
+   { 36822, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
+   { 36842, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
+   { 36865, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
+   { 36885, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
+   { 36906, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
+   { 36928, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
+   { 36950, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
+   { 36970, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
+   { 36991, 0x00001401 }, /* GL_UNSIGNED_BYTE */
+   { 37008, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+   { 37035, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
+   { 37058, 0x00001405 }, /* GL_UNSIGNED_INT */
+   { 37074, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
+   { 37101, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
+   { 37122, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
+   { 37146, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+   { 37177, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
+   { 37201, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+   { 37229, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
+   { 37252, 0x00001403 }, /* GL_UNSIGNED_SHORT */
+   { 37270, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+   { 37300, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+   { 37326, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+   { 37356, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+   { 37382, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
+   { 37406, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+   { 37434, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+   { 37462, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
+   { 37489, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+   { 37521, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
+   { 37552, 0x00008CA2 }, /* GL_UPPER_LEFT */
+   { 37566, 0x00002A20 }, /* GL_V2F */
+   { 37573, 0x00002A21 }, /* GL_V3F */
+   { 37580, 0x00008B83 }, /* GL_VALIDATE_STATUS */
+   { 37599, 0x00001F00 }, /* GL_VENDOR */
+   { 37609, 0x00001F02 }, /* GL_VERSION */
+   { 37620, 0x00008074 }, /* GL_VERTEX_ARRAY */
+   { 37636, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
+   { 37666, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+   { 37697, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
+   { 37732, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
+   { 37756, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
+   { 37777, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
+   { 37800, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
+   { 37821, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+   { 37848, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+   { 37876, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+   { 37904, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+   { 37932, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+   { 37960, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+   { 37988, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+   { 38016, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+   { 38043, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+   { 38070, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+   { 38097, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+   { 38124, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+   { 38151, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+   { 38178, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+   { 38205, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+   { 38232, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+   { 38259, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+   { 38297, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
+   { 38339, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+   { 38370, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
+   { 38405, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+   { 38439, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
+   { 38477, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+   { 38508, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
+   { 38543, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+   { 38571, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
+   { 38603, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+   { 38633, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
+   { 38667, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+   { 38695, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
+   { 38727, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
+   { 38747, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
+   { 38769, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
+   { 38798, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
+   { 38819, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+   { 38848, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
+   { 38881, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
+   { 38913, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+   { 38940, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
+   { 38971, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
+   { 39001, 0x00008B31 }, /* GL_VERTEX_SHADER */
+   { 39018, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
+   { 39039, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
+   { 39066, 0x00000BA2 }, /* GL_VIEWPORT */
+   { 39078, 0x00000800 }, /* GL_VIEWPORT_BIT */
+   { 39094, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
+   { 39114, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+   { 39145, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
+   { 39180, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+   { 39208, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+   { 39233, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+   { 39260, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+   { 39285, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
+   { 39309, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
+   { 39328, 0x000088B9 }, /* GL_WRITE_ONLY */
+   { 39342, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
+   { 39360, 0x00001506 }, /* GL_XOR */
+   { 39367, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
+   { 39386, 0x00008757 }, /* GL_YCBCR_MESA */
+   { 39400, 0x00000000 }, /* GL_ZERO */
+   { 39408, 0x00000D16 }, /* GL_ZOOM_X */
+   { 39418, 0x00000D17 }, /* GL_ZOOM_Y */
 };
 
-static const unsigned reduced_enums[1308] =
+static const unsigned reduced_enums[1316] =
 {
-       455, /* GL_FALSE */
-       687, /* GL_LINES */
-       689, /* GL_LINE_LOOP */
-       696, /* GL_LINE_STRIP */
-      1699, /* GL_TRIANGLES */
-      1702, /* GL_TRIANGLE_STRIP */
-      1700, /* GL_TRIANGLE_FAN */
-      1254, /* GL_QUADS */
-      1256, /* GL_QUAD_STRIP */
-      1142, /* GL_POLYGON */
-      1154, /* GL_POLYGON_STIPPLE_BIT */
-      1107, /* GL_PIXEL_MODE_BIT */
-       674, /* GL_LIGHTING_BIT */
-       477, /* GL_FOG_BIT */
+       463, /* GL_FALSE */
+       695, /* GL_LINES */
+       697, /* GL_LINE_LOOP */
+       704, /* GL_LINE_STRIP */
+      1707, /* GL_TRIANGLES */
+      1710, /* GL_TRIANGLE_STRIP */
+      1708, /* GL_TRIANGLE_FAN */
+      1262, /* GL_QUADS */
+      1264, /* GL_QUAD_STRIP */
+      1150, /* GL_POLYGON */
+      1162, /* GL_POLYGON_STIPPLE_BIT */
+      1115, /* GL_PIXEL_MODE_BIT */
+       682, /* GL_LIGHTING_BIT */
+       485, /* GL_FOG_BIT */
          8, /* GL_ACCUM */
-       706, /* GL_LOAD */
-      1308, /* GL_RETURN */
-       980, /* GL_MULT */
+       714, /* GL_LOAD */
+      1316, /* GL_RETURN */
+       988, /* GL_MULT */
         23, /* GL_ADD */
-       996, /* GL_NEVER */
-       664, /* GL_LESS */
-       445, /* GL_EQUAL */
-       663, /* GL_LEQUAL */
-       587, /* GL_GREATER */
-      1011, /* GL_NOTEQUAL */
-       562, /* GL_GEQUAL */
+      1004, /* GL_NEVER */
+       672, /* GL_LESS */
+       453, /* GL_EQUAL */
+       671, /* GL_LEQUAL */
+       595, /* GL_GREATER */
+      1019, /* GL_NOTEQUAL */
+       570, /* GL_GEQUAL */
         46, /* GL_ALWAYS */
-      1441, /* GL_SRC_COLOR */
-      1040, /* GL_ONE_MINUS_SRC_COLOR */
-      1439, /* GL_SRC_ALPHA */
-      1039, /* GL_ONE_MINUS_SRC_ALPHA */
-       426, /* GL_DST_ALPHA */
-      1037, /* GL_ONE_MINUS_DST_ALPHA */
-       427, /* GL_DST_COLOR */
-      1038, /* GL_ONE_MINUS_DST_COLOR */
-      1440, /* GL_SRC_ALPHA_SATURATE */
-       550, /* GL_FRONT_LEFT */
-       551, /* GL_FRONT_RIGHT */
+      1449, /* GL_SRC_COLOR */
+      1048, /* GL_ONE_MINUS_SRC_COLOR */
+      1447, /* GL_SRC_ALPHA */
+      1047, /* GL_ONE_MINUS_SRC_ALPHA */
+       432, /* GL_DST_ALPHA */
+      1045, /* GL_ONE_MINUS_DST_ALPHA */
+       433, /* GL_DST_COLOR */
+      1046, /* GL_ONE_MINUS_DST_COLOR */
+      1448, /* GL_SRC_ALPHA_SATURATE */
+       558, /* GL_FRONT_LEFT */
+       559, /* GL_FRONT_RIGHT */
         68, /* GL_BACK_LEFT */
         69, /* GL_BACK_RIGHT */
-       547, /* GL_FRONT */
+       555, /* GL_FRONT */
         67, /* GL_BACK */
-       662, /* GL_LEFT */
-      1348, /* GL_RIGHT */
-       548, /* GL_FRONT_AND_BACK */
+       670, /* GL_LEFT */
+      1356, /* GL_RIGHT */
+       556, /* GL_FRONT_AND_BACK */
         62, /* GL_AUX0 */
         63, /* GL_AUX1 */
         64, /* GL_AUX2 */
         65, /* GL_AUX3 */
-       653, /* GL_INVALID_ENUM */
-       657, /* GL_INVALID_VALUE */
-       656, /* GL_INVALID_OPERATION */
-      1443, /* GL_STACK_OVERFLOW */
-      1444, /* GL_STACK_UNDERFLOW */
-      1065, /* GL_OUT_OF_MEMORY */
-       654, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+       661, /* GL_INVALID_ENUM */
+       665, /* GL_INVALID_VALUE */
+       664, /* GL_INVALID_OPERATION */
+      1451, /* GL_STACK_OVERFLOW */
+      1452, /* GL_STACK_UNDERFLOW */
+      1073, /* GL_OUT_OF_MEMORY */
+       662, /* GL_INVALID_FRAMEBUFFER_OPERATION */
          0, /* GL_2D */
          2, /* GL_3D */
          3, /* GL_3D_COLOR */
          4, /* GL_3D_COLOR_TEXTURE */
          6, /* GL_4D_COLOR_TEXTURE */
-      1085, /* GL_PASS_THROUGH_TOKEN */
-      1141, /* GL_POINT_TOKEN */
-       697, /* GL_LINE_TOKEN */
-      1155, /* GL_POLYGON_TOKEN */
+      1093, /* GL_PASS_THROUGH_TOKEN */
+      1149, /* GL_POINT_TOKEN */
+       705, /* GL_LINE_TOKEN */
+      1163, /* GL_POLYGON_TOKEN */
         73, /* GL_BITMAP_TOKEN */
-       425, /* GL_DRAW_PIXEL_TOKEN */
-       286, /* GL_COPY_PIXEL_TOKEN */
-       690, /* GL_LINE_RESET_TOKEN */
-       448, /* GL_EXP */
-       449, /* GL_EXP2 */
-       319, /* GL_CW */
-       115, /* GL_CCW */
-       136, /* GL_COEFF */
-      1062, /* GL_ORDER */
-       363, /* GL_DOMAIN */
-       294, /* GL_CURRENT_COLOR */
-       297, /* GL_CURRENT_INDEX */
-       303, /* GL_CURRENT_NORMAL */
-       315, /* GL_CURRENT_TEXTURE_COORDS */
-       308, /* GL_CURRENT_RASTER_COLOR */
-       310, /* GL_CURRENT_RASTER_INDEX */
-       313, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
-       311, /* GL_CURRENT_RASTER_POSITION */
-       312, /* GL_CURRENT_RASTER_POSITION_VALID */
-       309, /* GL_CURRENT_RASTER_DISTANCE */
-      1134, /* GL_POINT_SMOOTH */
-      1123, /* GL_POINT_SIZE */
-      1133, /* GL_POINT_SIZE_RANGE */
-      1124, /* GL_POINT_SIZE_GRANULARITY */
-       691, /* GL_LINE_SMOOTH */
-       698, /* GL_LINE_WIDTH */
-       700, /* GL_LINE_WIDTH_RANGE */
-       699, /* GL_LINE_WIDTH_GRANULARITY */
-       693, /* GL_LINE_STIPPLE */
-       694, /* GL_LINE_STIPPLE_PATTERN */
-       695, /* GL_LINE_STIPPLE_REPEAT */
-       705, /* GL_LIST_MODE */
-       864, /* GL_MAX_LIST_NESTING */
-       702, /* GL_LIST_BASE */
-       704, /* GL_LIST_INDEX */
-      1144, /* GL_POLYGON_MODE */
-      1151, /* GL_POLYGON_SMOOTH */
-      1153, /* GL_POLYGON_STIPPLE */
-       434, /* GL_EDGE_FLAG */
-       287, /* GL_CULL_FACE */
-       288, /* GL_CULL_FACE_MODE */
-       549, /* GL_FRONT_FACE */
-       673, /* GL_LIGHTING */
-       678, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
-       679, /* GL_LIGHT_MODEL_TWO_SIDE */
-       675, /* GL_LIGHT_MODEL_AMBIENT */
-      1394, /* GL_SHADE_MODEL */
-       183, /* GL_COLOR_MATERIAL_FACE */
-       184, /* GL_COLOR_MATERIAL_PARAMETER */
-       182, /* GL_COLOR_MATERIAL */
-       476, /* GL_FOG */
-       498, /* GL_FOG_INDEX */
-       494, /* GL_FOG_DENSITY */
-       502, /* GL_FOG_START */
-       496, /* GL_FOG_END */
-       499, /* GL_FOG_MODE */
-       478, /* GL_FOG_COLOR */
-       350, /* GL_DEPTH_RANGE */
-       357, /* GL_DEPTH_TEST */
-       360, /* GL_DEPTH_WRITEMASK */
-       338, /* GL_DEPTH_CLEAR_VALUE */
-       349, /* GL_DEPTH_FUNC */
+       431, /* GL_DRAW_PIXEL_TOKEN */
+       292, /* GL_COPY_PIXEL_TOKEN */
+       698, /* GL_LINE_RESET_TOKEN */
+       456, /* GL_EXP */
+       457, /* GL_EXP2 */
+       325, /* GL_CW */
+       121, /* GL_CCW */
+       142, /* GL_COEFF */
+      1070, /* GL_ORDER */
+       369, /* GL_DOMAIN */
+       300, /* GL_CURRENT_COLOR */
+       303, /* GL_CURRENT_INDEX */
+       309, /* GL_CURRENT_NORMAL */
+       321, /* GL_CURRENT_TEXTURE_COORDS */
+       314, /* GL_CURRENT_RASTER_COLOR */
+       316, /* GL_CURRENT_RASTER_INDEX */
+       319, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
+       317, /* GL_CURRENT_RASTER_POSITION */
+       318, /* GL_CURRENT_RASTER_POSITION_VALID */
+       315, /* GL_CURRENT_RASTER_DISTANCE */
+      1142, /* GL_POINT_SMOOTH */
+      1131, /* GL_POINT_SIZE */
+      1141, /* GL_POINT_SIZE_RANGE */
+      1132, /* GL_POINT_SIZE_GRANULARITY */
+       699, /* GL_LINE_SMOOTH */
+       706, /* GL_LINE_WIDTH */
+       708, /* GL_LINE_WIDTH_RANGE */
+       707, /* GL_LINE_WIDTH_GRANULARITY */
+       701, /* GL_LINE_STIPPLE */
+       702, /* GL_LINE_STIPPLE_PATTERN */
+       703, /* GL_LINE_STIPPLE_REPEAT */
+       713, /* GL_LIST_MODE */
+       872, /* GL_MAX_LIST_NESTING */
+       710, /* GL_LIST_BASE */
+       712, /* GL_LIST_INDEX */
+      1152, /* GL_POLYGON_MODE */
+      1159, /* GL_POLYGON_SMOOTH */
+      1161, /* GL_POLYGON_STIPPLE */
+       442, /* GL_EDGE_FLAG */
+       293, /* GL_CULL_FACE */
+       294, /* GL_CULL_FACE_MODE */
+       557, /* GL_FRONT_FACE */
+       681, /* GL_LIGHTING */
+       686, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+       687, /* GL_LIGHT_MODEL_TWO_SIDE */
+       683, /* GL_LIGHT_MODEL_AMBIENT */
+      1402, /* GL_SHADE_MODEL */
+       189, /* GL_COLOR_MATERIAL_FACE */
+       190, /* GL_COLOR_MATERIAL_PARAMETER */
+       188, /* GL_COLOR_MATERIAL */
+       484, /* GL_FOG */
+       506, /* GL_FOG_INDEX */
+       502, /* GL_FOG_DENSITY */
+       510, /* GL_FOG_START */
+       504, /* GL_FOG_END */
+       507, /* GL_FOG_MODE */
+       486, /* GL_FOG_COLOR */
+       356, /* GL_DEPTH_RANGE */
+       363, /* GL_DEPTH_TEST */
+       366, /* GL_DEPTH_WRITEMASK */
+       344, /* GL_DEPTH_CLEAR_VALUE */
+       355, /* GL_DEPTH_FUNC */
         12, /* GL_ACCUM_CLEAR_VALUE */
-      1479, /* GL_STENCIL_TEST */
-      1467, /* GL_STENCIL_CLEAR_VALUE */
-      1469, /* GL_STENCIL_FUNC */
-      1481, /* GL_STENCIL_VALUE_MASK */
-      1468, /* GL_STENCIL_FAIL */
-      1476, /* GL_STENCIL_PASS_DEPTH_FAIL */
-      1477, /* GL_STENCIL_PASS_DEPTH_PASS */
-      1478, /* GL_STENCIL_REF */
-      1482, /* GL_STENCIL_WRITEMASK */
-       833, /* GL_MATRIX_MODE */
-      1001, /* GL_NORMALIZE */
-      1791, /* GL_VIEWPORT */
-       975, /* GL_MODELVIEW_STACK_DEPTH */
-      1234, /* GL_PROJECTION_STACK_DEPTH */
-      1677, /* GL_TEXTURE_STACK_DEPTH */
-       973, /* GL_MODELVIEW_MATRIX */
-      1233, /* GL_PROJECTION_MATRIX */
-      1662, /* GL_TEXTURE_MATRIX */
+      1487, /* GL_STENCIL_TEST */
+      1475, /* GL_STENCIL_CLEAR_VALUE */
+      1477, /* GL_STENCIL_FUNC */
+      1489, /* GL_STENCIL_VALUE_MASK */
+      1476, /* GL_STENCIL_FAIL */
+      1484, /* GL_STENCIL_PASS_DEPTH_FAIL */
+      1485, /* GL_STENCIL_PASS_DEPTH_PASS */
+      1486, /* GL_STENCIL_REF */
+      1490, /* GL_STENCIL_WRITEMASK */
+       841, /* GL_MATRIX_MODE */
+      1009, /* GL_NORMALIZE */
+      1799, /* GL_VIEWPORT */
+       983, /* GL_MODELVIEW_STACK_DEPTH */
+      1242, /* GL_PROJECTION_STACK_DEPTH */
+      1685, /* GL_TEXTURE_STACK_DEPTH */
+       981, /* GL_MODELVIEW_MATRIX */
+      1241, /* GL_PROJECTION_MATRIX */
+      1670, /* GL_TEXTURE_MATRIX */
         60, /* GL_ATTRIB_STACK_DEPTH */
-       126, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
+       132, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
         43, /* GL_ALPHA_TEST */
         44, /* GL_ALPHA_TEST_FUNC */
         45, /* GL_ALPHA_TEST_REF */
-       362, /* GL_DITHER */
+       368, /* GL_DITHER */
         77, /* GL_BLEND_DST */
         85, /* GL_BLEND_SRC */
         74, /* GL_BLEND */
-       708, /* GL_LOGIC_OP_MODE */
-       627, /* GL_INDEX_LOGIC_OP */
-       181, /* GL_COLOR_LOGIC_OP */
+       716, /* GL_LOGIC_OP_MODE */
+       635, /* GL_INDEX_LOGIC_OP */
+       187, /* GL_COLOR_LOGIC_OP */
         66, /* GL_AUX_BUFFERS */
-       373, /* GL_DRAW_BUFFER */
-      1266, /* GL_READ_BUFFER */
-      1375, /* GL_SCISSOR_BOX */
-      1376, /* GL_SCISSOR_TEST */
-       626, /* GL_INDEX_CLEAR_VALUE */
-       631, /* GL_INDEX_WRITEMASK */
-       178, /* GL_COLOR_CLEAR_VALUE */
-       220, /* GL_COLOR_WRITEMASK */
-       628, /* GL_INDEX_MODE */
-      1342, /* GL_RGBA_MODE */
-       372, /* GL_DOUBLEBUFFER */
-      1483, /* GL_STEREO */
-      1301, /* GL_RENDER_MODE */
-      1086, /* GL_PERSPECTIVE_CORRECTION_HINT */
-      1135, /* GL_POINT_SMOOTH_HINT */
-       692, /* GL_LINE_SMOOTH_HINT */
-      1152, /* GL_POLYGON_SMOOTH_HINT */
-       497, /* GL_FOG_HINT */
-      1643, /* GL_TEXTURE_GEN_S */
-      1644, /* GL_TEXTURE_GEN_T */
-      1642, /* GL_TEXTURE_GEN_R */
-      1641, /* GL_TEXTURE_GEN_Q */
-      1099, /* GL_PIXEL_MAP_I_TO_I */
-      1105, /* GL_PIXEL_MAP_S_TO_S */
-      1101, /* GL_PIXEL_MAP_I_TO_R */
-      1097, /* GL_PIXEL_MAP_I_TO_G */
-      1095, /* GL_PIXEL_MAP_I_TO_B */
-      1093, /* GL_PIXEL_MAP_I_TO_A */
-      1103, /* GL_PIXEL_MAP_R_TO_R */
-      1091, /* GL_PIXEL_MAP_G_TO_G */
-      1089, /* GL_PIXEL_MAP_B_TO_B */
-      1087, /* GL_PIXEL_MAP_A_TO_A */
-      1100, /* GL_PIXEL_MAP_I_TO_I_SIZE */
-      1106, /* GL_PIXEL_MAP_S_TO_S_SIZE */
-      1102, /* GL_PIXEL_MAP_I_TO_R_SIZE */
-      1098, /* GL_PIXEL_MAP_I_TO_G_SIZE */
-      1096, /* GL_PIXEL_MAP_I_TO_B_SIZE */
-      1094, /* GL_PIXEL_MAP_I_TO_A_SIZE */
-      1104, /* GL_PIXEL_MAP_R_TO_R_SIZE */
-      1092, /* GL_PIXEL_MAP_G_TO_G_SIZE */
-      1090, /* GL_PIXEL_MAP_B_TO_B_SIZE */
-      1088, /* GL_PIXEL_MAP_A_TO_A_SIZE */
-      1711, /* GL_UNPACK_SWAP_BYTES */
-      1706, /* GL_UNPACK_LSB_FIRST */
-      1707, /* GL_UNPACK_ROW_LENGTH */
-      1710, /* GL_UNPACK_SKIP_ROWS */
-      1709, /* GL_UNPACK_SKIP_PIXELS */
-      1704, /* GL_UNPACK_ALIGNMENT */
-      1074, /* GL_PACK_SWAP_BYTES */
-      1069, /* GL_PACK_LSB_FIRST */
-      1070, /* GL_PACK_ROW_LENGTH */
-      1073, /* GL_PACK_SKIP_ROWS */
-      1072, /* GL_PACK_SKIP_PIXELS */
-      1066, /* GL_PACK_ALIGNMENT */
-       786, /* GL_MAP_COLOR */
-       787, /* GL_MAP_STENCIL */
-       630, /* GL_INDEX_SHIFT */
-       629, /* GL_INDEX_OFFSET */
-      1279, /* GL_RED_SCALE */
-      1277, /* GL_RED_BIAS */
-      1808, /* GL_ZOOM_X */
-      1809, /* GL_ZOOM_Y */
-       591, /* GL_GREEN_SCALE */
-       589, /* GL_GREEN_BIAS */
+       379, /* GL_DRAW_BUFFER */
+      1274, /* GL_READ_BUFFER */
+      1383, /* GL_SCISSOR_BOX */
+      1384, /* GL_SCISSOR_TEST */
+       634, /* GL_INDEX_CLEAR_VALUE */
+       639, /* GL_INDEX_WRITEMASK */
+       184, /* GL_COLOR_CLEAR_VALUE */
+       226, /* GL_COLOR_WRITEMASK */
+       636, /* GL_INDEX_MODE */
+      1350, /* GL_RGBA_MODE */
+       378, /* GL_DOUBLEBUFFER */
+      1491, /* GL_STEREO */
+      1309, /* GL_RENDER_MODE */
+      1094, /* GL_PERSPECTIVE_CORRECTION_HINT */
+      1143, /* GL_POINT_SMOOTH_HINT */
+       700, /* GL_LINE_SMOOTH_HINT */
+      1160, /* GL_POLYGON_SMOOTH_HINT */
+       505, /* GL_FOG_HINT */
+      1651, /* GL_TEXTURE_GEN_S */
+      1652, /* GL_TEXTURE_GEN_T */
+      1650, /* GL_TEXTURE_GEN_R */
+      1649, /* GL_TEXTURE_GEN_Q */
+      1107, /* GL_PIXEL_MAP_I_TO_I */
+      1113, /* GL_PIXEL_MAP_S_TO_S */
+      1109, /* GL_PIXEL_MAP_I_TO_R */
+      1105, /* GL_PIXEL_MAP_I_TO_G */
+      1103, /* GL_PIXEL_MAP_I_TO_B */
+      1101, /* GL_PIXEL_MAP_I_TO_A */
+      1111, /* GL_PIXEL_MAP_R_TO_R */
+      1099, /* GL_PIXEL_MAP_G_TO_G */
+      1097, /* GL_PIXEL_MAP_B_TO_B */
+      1095, /* GL_PIXEL_MAP_A_TO_A */
+      1108, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+      1114, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+      1110, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+      1106, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+      1104, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+      1102, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+      1112, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+      1100, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+      1098, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+      1096, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+      1719, /* GL_UNPACK_SWAP_BYTES */
+      1714, /* GL_UNPACK_LSB_FIRST */
+      1715, /* GL_UNPACK_ROW_LENGTH */
+      1718, /* GL_UNPACK_SKIP_ROWS */
+      1717, /* GL_UNPACK_SKIP_PIXELS */
+      1712, /* GL_UNPACK_ALIGNMENT */
+      1082, /* GL_PACK_SWAP_BYTES */
+      1077, /* GL_PACK_LSB_FIRST */
+      1078, /* GL_PACK_ROW_LENGTH */
+      1081, /* GL_PACK_SKIP_ROWS */
+      1080, /* GL_PACK_SKIP_PIXELS */
+      1074, /* GL_PACK_ALIGNMENT */
+       794, /* GL_MAP_COLOR */
+       795, /* GL_MAP_STENCIL */
+       638, /* GL_INDEX_SHIFT */
+       637, /* GL_INDEX_OFFSET */
+      1287, /* GL_RED_SCALE */
+      1285, /* GL_RED_BIAS */
+      1816, /* GL_ZOOM_X */
+      1817, /* GL_ZOOM_Y */
+       599, /* GL_GREEN_SCALE */
+       597, /* GL_GREEN_BIAS */
         91, /* GL_BLUE_SCALE */
         89, /* GL_BLUE_BIAS */
         42, /* GL_ALPHA_SCALE */
         40, /* GL_ALPHA_BIAS */
-       351, /* GL_DEPTH_SCALE */
-       332, /* GL_DEPTH_BIAS */
-       859, /* GL_MAX_EVAL_ORDER */
-       863, /* GL_MAX_LIGHTS */
-       842, /* GL_MAX_CLIP_PLANES */
-       908, /* GL_MAX_TEXTURE_SIZE */
-       869, /* GL_MAX_PIXEL_MAP_TABLE */
-       838, /* GL_MAX_ATTRIB_STACK_DEPTH */
-       866, /* GL_MAX_MODELVIEW_STACK_DEPTH */
-       867, /* GL_MAX_NAME_STACK_DEPTH */
-       895, /* GL_MAX_PROJECTION_STACK_DEPTH */
-       909, /* GL_MAX_TEXTURE_STACK_DEPTH */
-       923, /* GL_MAX_VIEWPORT_DIMS */
-       839, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
-      1490, /* GL_SUBPIXEL_BITS */
-       625, /* GL_INDEX_BITS */
-      1278, /* GL_RED_BITS */
-       590, /* GL_GREEN_BITS */
+       357, /* GL_DEPTH_SCALE */
+       338, /* GL_DEPTH_BIAS */
+       867, /* GL_MAX_EVAL_ORDER */
+       871, /* GL_MAX_LIGHTS */
+       850, /* GL_MAX_CLIP_PLANES */
+       916, /* GL_MAX_TEXTURE_SIZE */
+       877, /* GL_MAX_PIXEL_MAP_TABLE */
+       846, /* GL_MAX_ATTRIB_STACK_DEPTH */
+       874, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+       875, /* GL_MAX_NAME_STACK_DEPTH */
+       903, /* GL_MAX_PROJECTION_STACK_DEPTH */
+       917, /* GL_MAX_TEXTURE_STACK_DEPTH */
+       931, /* GL_MAX_VIEWPORT_DIMS */
+       847, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+      1498, /* GL_SUBPIXEL_BITS */
+       633, /* GL_INDEX_BITS */
+      1286, /* GL_RED_BITS */
+       598, /* GL_GREEN_BITS */
         90, /* GL_BLUE_BITS */
         41, /* GL_ALPHA_BITS */
-       333, /* GL_DEPTH_BITS */
-      1465, /* GL_STENCIL_BITS */
+       339, /* GL_DEPTH_BITS */
+      1473, /* GL_STENCIL_BITS */
         14, /* GL_ACCUM_RED_BITS */
         13, /* GL_ACCUM_GREEN_BITS */
         10, /* GL_ACCUM_BLUE_BITS */
          9, /* GL_ACCUM_ALPHA_BITS */
-       989, /* GL_NAME_STACK_DEPTH */
+       997, /* GL_NAME_STACK_DEPTH */
         61, /* GL_AUTO_NORMAL */
-       732, /* GL_MAP1_COLOR_4 */
-       735, /* GL_MAP1_INDEX */
-       736, /* GL_MAP1_NORMAL */
-       737, /* GL_MAP1_TEXTURE_COORD_1 */
-       738, /* GL_MAP1_TEXTURE_COORD_2 */
-       739, /* GL_MAP1_TEXTURE_COORD_3 */
-       740, /* GL_MAP1_TEXTURE_COORD_4 */
-       741, /* GL_MAP1_VERTEX_3 */
-       742, /* GL_MAP1_VERTEX_4 */
-       759, /* GL_MAP2_COLOR_4 */
-       762, /* GL_MAP2_INDEX */
-       763, /* GL_MAP2_NORMAL */
-       764, /* GL_MAP2_TEXTURE_COORD_1 */
-       765, /* GL_MAP2_TEXTURE_COORD_2 */
-       766, /* GL_MAP2_TEXTURE_COORD_3 */
-       767, /* GL_MAP2_TEXTURE_COORD_4 */
-       768, /* GL_MAP2_VERTEX_3 */
-       769, /* GL_MAP2_VERTEX_4 */
-       733, /* GL_MAP1_GRID_DOMAIN */
-       734, /* GL_MAP1_GRID_SEGMENTS */
-       760, /* GL_MAP2_GRID_DOMAIN */
-       761, /* GL_MAP2_GRID_SEGMENTS */
-      1567, /* GL_TEXTURE_1D */
-      1569, /* GL_TEXTURE_2D */
-       458, /* GL_FEEDBACK_BUFFER_POINTER */
-       459, /* GL_FEEDBACK_BUFFER_SIZE */
-       460, /* GL_FEEDBACK_BUFFER_TYPE */
-      1385, /* GL_SELECTION_BUFFER_POINTER */
-      1386, /* GL_SELECTION_BUFFER_SIZE */
-      1681, /* GL_TEXTURE_WIDTH */
-      1648, /* GL_TEXTURE_HEIGHT */
-      1604, /* GL_TEXTURE_COMPONENTS */
-      1588, /* GL_TEXTURE_BORDER_COLOR */
-      1587, /* GL_TEXTURE_BORDER */
-       364, /* GL_DONT_CARE */
-       456, /* GL_FASTEST */
-       997, /* GL_NICEST */
+       740, /* GL_MAP1_COLOR_4 */
+       743, /* GL_MAP1_INDEX */
+       744, /* GL_MAP1_NORMAL */
+       745, /* GL_MAP1_TEXTURE_COORD_1 */
+       746, /* GL_MAP1_TEXTURE_COORD_2 */
+       747, /* GL_MAP1_TEXTURE_COORD_3 */
+       748, /* GL_MAP1_TEXTURE_COORD_4 */
+       749, /* GL_MAP1_VERTEX_3 */
+       750, /* GL_MAP1_VERTEX_4 */
+       767, /* GL_MAP2_COLOR_4 */
+       770, /* GL_MAP2_INDEX */
+       771, /* GL_MAP2_NORMAL */
+       772, /* GL_MAP2_TEXTURE_COORD_1 */
+       773, /* GL_MAP2_TEXTURE_COORD_2 */
+       774, /* GL_MAP2_TEXTURE_COORD_3 */
+       775, /* GL_MAP2_TEXTURE_COORD_4 */
+       776, /* GL_MAP2_VERTEX_3 */
+       777, /* GL_MAP2_VERTEX_4 */
+       741, /* GL_MAP1_GRID_DOMAIN */
+       742, /* GL_MAP1_GRID_SEGMENTS */
+       768, /* GL_MAP2_GRID_DOMAIN */
+       769, /* GL_MAP2_GRID_SEGMENTS */
+      1575, /* GL_TEXTURE_1D */
+      1577, /* GL_TEXTURE_2D */
+       466, /* GL_FEEDBACK_BUFFER_POINTER */
+       467, /* GL_FEEDBACK_BUFFER_SIZE */
+       468, /* GL_FEEDBACK_BUFFER_TYPE */
+      1393, /* GL_SELECTION_BUFFER_POINTER */
+      1394, /* GL_SELECTION_BUFFER_SIZE */
+      1689, /* GL_TEXTURE_WIDTH */
+      1656, /* GL_TEXTURE_HEIGHT */
+      1612, /* GL_TEXTURE_COMPONENTS */
+      1596, /* GL_TEXTURE_BORDER_COLOR */
+      1595, /* GL_TEXTURE_BORDER */
+       370, /* GL_DONT_CARE */
+       464, /* GL_FASTEST */
+      1005, /* GL_NICEST */
         47, /* GL_AMBIENT */
-       361, /* GL_DIFFUSE */
-      1428, /* GL_SPECULAR */
-      1156, /* GL_POSITION */
-      1431, /* GL_SPOT_DIRECTION */
-      1432, /* GL_SPOT_EXPONENT */
-      1430, /* GL_SPOT_CUTOFF */
-       260, /* GL_CONSTANT_ATTENUATION */
-       682, /* GL_LINEAR_ATTENUATION */
-      1253, /* GL_QUADRATIC_ATTENUATION */
-       234, /* GL_COMPILE */
-       235, /* GL_COMPILE_AND_EXECUTE */
-       110, /* GL_BYTE */
-      1712, /* GL_UNSIGNED_BYTE */
-      1399, /* GL_SHORT */
-      1723, /* GL_UNSIGNED_SHORT */
-       633, /* GL_INT */
-      1715, /* GL_UNSIGNED_INT */
-       463, /* GL_FLOAT */
+       367, /* GL_DIFFUSE */
+      1436, /* GL_SPECULAR */
+      1164, /* GL_POSITION */
+      1439, /* GL_SPOT_DIRECTION */
+      1440, /* GL_SPOT_EXPONENT */
+      1438, /* GL_SPOT_CUTOFF */
+       266, /* GL_CONSTANT_ATTENUATION */
+       690, /* GL_LINEAR_ATTENUATION */
+      1261, /* GL_QUADRATIC_ATTENUATION */
+       240, /* GL_COMPILE */
+       241, /* GL_COMPILE_AND_EXECUTE */
+       116, /* GL_BYTE */
+      1720, /* GL_UNSIGNED_BYTE */
+      1407, /* GL_SHORT */
+      1731, /* GL_UNSIGNED_SHORT */
+       641, /* GL_INT */
+      1723, /* GL_UNSIGNED_INT */
+       471, /* GL_FLOAT */
          1, /* GL_2_BYTES */
          5, /* GL_3_BYTES */
          7, /* GL_4_BYTES */
-       371, /* GL_DOUBLE */
-       122, /* GL_CLEAR */
+       377, /* GL_DOUBLE */
+       128, /* GL_CLEAR */
         49, /* GL_AND */
         51, /* GL_AND_REVERSE */
-       284, /* GL_COPY */
+       290, /* GL_COPY */
         50, /* GL_AND_INVERTED */
-       999, /* GL_NOOP */
-      1804, /* GL_XOR */
-      1061, /* GL_OR */
-      1000, /* GL_NOR */
-       446, /* GL_EQUIV */
-       660, /* GL_INVERT */
-      1064, /* GL_OR_REVERSE */
-       285, /* GL_COPY_INVERTED */
-      1063, /* GL_OR_INVERTED */
-       990, /* GL_NAND */
-      1390, /* GL_SET */
-       443, /* GL_EMISSION */
-      1398, /* GL_SHININESS */
+      1007, /* GL_NOOP */
+      1812, /* GL_XOR */
+      1069, /* GL_OR */
+      1008, /* GL_NOR */
+       454, /* GL_EQUIV */
+       668, /* GL_INVERT */
+      1072, /* GL_OR_REVERSE */
+       291, /* GL_COPY_INVERTED */
+      1071, /* GL_OR_INVERTED */
+       998, /* GL_NAND */
+      1398, /* GL_SET */
+       451, /* GL_EMISSION */
+      1406, /* GL_SHININESS */
         48, /* GL_AMBIENT_AND_DIFFUSE */
-       180, /* GL_COLOR_INDEXES */
-       940, /* GL_MODELVIEW */
-      1232, /* GL_PROJECTION */
-      1502, /* GL_TEXTURE */
-       137, /* GL_COLOR */
-       328, /* GL_DEPTH */
-      1451, /* GL_STENCIL */
-       179, /* GL_COLOR_INDEX */
-      1470, /* GL_STENCIL_INDEX */
-       339, /* GL_DEPTH_COMPONENT */
-      1274, /* GL_RED */
-       588, /* GL_GREEN */
+       186, /* GL_COLOR_INDEXES */
+       948, /* GL_MODELVIEW */
+      1240, /* GL_PROJECTION */
+      1510, /* GL_TEXTURE */
+       143, /* GL_COLOR */
+       334, /* GL_DEPTH */
+      1459, /* GL_STENCIL */
+       185, /* GL_COLOR_INDEX */
+      1478, /* GL_STENCIL_INDEX */
+       345, /* GL_DEPTH_COMPONENT */
+      1282, /* GL_RED */
+       596, /* GL_GREEN */
         88, /* GL_BLUE */
         31, /* GL_ALPHA */
-      1309, /* GL_RGB */
-      1328, /* GL_RGBA */
-       710, /* GL_LUMINANCE */
-       731, /* GL_LUMINANCE_ALPHA */
+      1317, /* GL_RGB */
+      1336, /* GL_RGBA */
+       718, /* GL_LUMINANCE */
+       739, /* GL_LUMINANCE_ALPHA */
         72, /* GL_BITMAP */
-      1112, /* GL_POINT */
-       680, /* GL_LINE */
-       461, /* GL_FILL */
-      1283, /* GL_RENDER */
-       457, /* GL_FEEDBACK */
-      1384, /* GL_SELECT */
-       462, /* GL_FLAT */
-      1403, /* GL_SMOOTH */
-       661, /* GL_KEEP */
-      1303, /* GL_REPLACE */
-       615, /* GL_INCR */
-       324, /* GL_DECR */
-      1738, /* GL_VENDOR */
-      1300, /* GL_RENDERER */
-      1739, /* GL_VERSION */
-       450, /* GL_EXTENSIONS */
-      1349, /* GL_S */
-      1493, /* GL_T */
-      1263, /* GL_R */
-      1252, /* GL_Q */
-       976, /* GL_MODULATE */
-       323, /* GL_DECAL */
-      1638, /* GL_TEXTURE_ENV_MODE */
-      1637, /* GL_TEXTURE_ENV_COLOR */
-      1636, /* GL_TEXTURE_ENV */
-       451, /* GL_EYE_LINEAR */
-      1023, /* GL_OBJECT_LINEAR */
-      1429, /* GL_SPHERE_MAP */
-      1640, /* GL_TEXTURE_GEN_MODE */
-      1025, /* GL_OBJECT_PLANE */
-       452, /* GL_EYE_PLANE */
-       991, /* GL_NEAREST */
-       681, /* GL_LINEAR */
-       995, /* GL_NEAREST_MIPMAP_NEAREST */
-       686, /* GL_LINEAR_MIPMAP_NEAREST */
-       994, /* GL_NEAREST_MIPMAP_LINEAR */
-       685, /* GL_LINEAR_MIPMAP_LINEAR */
-      1661, /* GL_TEXTURE_MAG_FILTER */
-      1669, /* GL_TEXTURE_MIN_FILTER */
-      1683, /* GL_TEXTURE_WRAP_S */
-      1684, /* GL_TEXTURE_WRAP_T */
-       116, /* GL_CLAMP */
-      1302, /* GL_REPEAT */
-      1150, /* GL_POLYGON_OFFSET_UNITS */
-      1149, /* GL_POLYGON_OFFSET_POINT */
-      1148, /* GL_POLYGON_OFFSET_LINE */
-      1264, /* GL_R3_G3_B2 */
-      1735, /* GL_V2F */
-      1736, /* GL_V3F */
-       113, /* GL_C4UB_V2F */
-       114, /* GL_C4UB_V3F */
-       111, /* GL_C3F_V3F */
-       988, /* GL_N3F_V3F */
-       112, /* GL_C4F_N3F_V3F */
-      1498, /* GL_T2F_V3F */
-      1500, /* GL_T4F_V4F */
-      1496, /* GL_T2F_C4UB_V3F */
-      1494, /* GL_T2F_C3F_V3F */
-      1497, /* GL_T2F_N3F_V3F */
-      1495, /* GL_T2F_C4F_N3F_V3F */
-      1499, /* GL_T4F_C4F_N3F_V4F */
-       129, /* GL_CLIP_PLANE0 */
-       130, /* GL_CLIP_PLANE1 */
-       131, /* GL_CLIP_PLANE2 */
-       132, /* GL_CLIP_PLANE3 */
-       133, /* GL_CLIP_PLANE4 */
-       134, /* GL_CLIP_PLANE5 */
-       665, /* GL_LIGHT0 */
-       666, /* GL_LIGHT1 */
-       667, /* GL_LIGHT2 */
-       668, /* GL_LIGHT3 */
-       669, /* GL_LIGHT4 */
-       670, /* GL_LIGHT5 */
-       671, /* GL_LIGHT6 */
-       672, /* GL_LIGHT7 */
-       592, /* GL_HINT_BIT */
-       262, /* GL_CONSTANT_COLOR */
-      1035, /* GL_ONE_MINUS_CONSTANT_COLOR */
-       257, /* GL_CONSTANT_ALPHA */
-      1033, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+      1120, /* GL_POINT */
+       688, /* GL_LINE */
+       469, /* GL_FILL */
+      1291, /* GL_RENDER */
+       465, /* GL_FEEDBACK */
+      1392, /* GL_SELECT */
+       470, /* GL_FLAT */
+      1411, /* GL_SMOOTH */
+       669, /* GL_KEEP */
+      1311, /* GL_REPLACE */
+       623, /* GL_INCR */
+       330, /* GL_DECR */
+      1746, /* GL_VENDOR */
+      1308, /* GL_RENDERER */
+      1747, /* GL_VERSION */
+       458, /* GL_EXTENSIONS */
+      1357, /* GL_S */
+      1501, /* GL_T */
+      1271, /* GL_R */
+      1260, /* GL_Q */
+       984, /* GL_MODULATE */
+       329, /* GL_DECAL */
+      1646, /* GL_TEXTURE_ENV_MODE */
+      1645, /* GL_TEXTURE_ENV_COLOR */
+      1644, /* GL_TEXTURE_ENV */
+       459, /* GL_EYE_LINEAR */
+      1031, /* GL_OBJECT_LINEAR */
+      1437, /* GL_SPHERE_MAP */
+      1648, /* GL_TEXTURE_GEN_MODE */
+      1033, /* GL_OBJECT_PLANE */
+       460, /* GL_EYE_PLANE */
+       999, /* GL_NEAREST */
+       689, /* GL_LINEAR */
+      1003, /* GL_NEAREST_MIPMAP_NEAREST */
+       694, /* GL_LINEAR_MIPMAP_NEAREST */
+      1002, /* GL_NEAREST_MIPMAP_LINEAR */
+       693, /* GL_LINEAR_MIPMAP_LINEAR */
+      1669, /* GL_TEXTURE_MAG_FILTER */
+      1677, /* GL_TEXTURE_MIN_FILTER */
+      1691, /* GL_TEXTURE_WRAP_S */
+      1692, /* GL_TEXTURE_WRAP_T */
+       122, /* GL_CLAMP */
+      1310, /* GL_REPEAT */
+      1158, /* GL_POLYGON_OFFSET_UNITS */
+      1157, /* GL_POLYGON_OFFSET_POINT */
+      1156, /* GL_POLYGON_OFFSET_LINE */
+      1272, /* GL_R3_G3_B2 */
+      1743, /* GL_V2F */
+      1744, /* GL_V3F */
+       119, /* GL_C4UB_V2F */
+       120, /* GL_C4UB_V3F */
+       117, /* GL_C3F_V3F */
+       996, /* GL_N3F_V3F */
+       118, /* GL_C4F_N3F_V3F */
+      1506, /* GL_T2F_V3F */
+      1508, /* GL_T4F_V4F */
+      1504, /* GL_T2F_C4UB_V3F */
+      1502, /* GL_T2F_C3F_V3F */
+      1505, /* GL_T2F_N3F_V3F */
+      1503, /* GL_T2F_C4F_N3F_V3F */
+      1507, /* GL_T4F_C4F_N3F_V4F */
+       135, /* GL_CLIP_PLANE0 */
+       136, /* GL_CLIP_PLANE1 */
+       137, /* GL_CLIP_PLANE2 */
+       138, /* GL_CLIP_PLANE3 */
+       139, /* GL_CLIP_PLANE4 */
+       140, /* GL_CLIP_PLANE5 */
+       673, /* GL_LIGHT0 */
+       674, /* GL_LIGHT1 */
+       675, /* GL_LIGHT2 */
+       676, /* GL_LIGHT3 */
+       677, /* GL_LIGHT4 */
+       678, /* GL_LIGHT5 */
+       679, /* GL_LIGHT6 */
+       680, /* GL_LIGHT7 */
+       600, /* GL_HINT_BIT */
+       268, /* GL_CONSTANT_COLOR */
+      1043, /* GL_ONE_MINUS_CONSTANT_COLOR */
+       263, /* GL_CONSTANT_ALPHA */
+      1041, /* GL_ONE_MINUS_CONSTANT_ALPHA */
         75, /* GL_BLEND_COLOR */
-       552, /* GL_FUNC_ADD */
-       924, /* GL_MIN */
-       835, /* GL_MAX */
+       560, /* GL_FUNC_ADD */
+       932, /* GL_MIN */
+       843, /* GL_MAX */
         80, /* GL_BLEND_EQUATION */
-       556, /* GL_FUNC_SUBTRACT */
-       554, /* GL_FUNC_REVERSE_SUBTRACT */
-       265, /* GL_CONVOLUTION_1D */
-       266, /* GL_CONVOLUTION_2D */
-      1387, /* GL_SEPARABLE_2D */
-       269, /* GL_CONVOLUTION_BORDER_MODE */
-       273, /* GL_CONVOLUTION_FILTER_SCALE */
-       271, /* GL_CONVOLUTION_FILTER_BIAS */
-      1275, /* GL_REDUCE */
-       275, /* GL_CONVOLUTION_FORMAT */
-       279, /* GL_CONVOLUTION_WIDTH */
-       277, /* GL_CONVOLUTION_HEIGHT */
-       850, /* GL_MAX_CONVOLUTION_WIDTH */
-       848, /* GL_MAX_CONVOLUTION_HEIGHT */
-      1189, /* GL_POST_CONVOLUTION_RED_SCALE */
-      1185, /* GL_POST_CONVOLUTION_GREEN_SCALE */
-      1180, /* GL_POST_CONVOLUTION_BLUE_SCALE */
-      1176, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
-      1187, /* GL_POST_CONVOLUTION_RED_BIAS */
-      1183, /* GL_POST_CONVOLUTION_GREEN_BIAS */
-      1178, /* GL_POST_CONVOLUTION_BLUE_BIAS */
-      1174, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
-       593, /* GL_HISTOGRAM */
-      1236, /* GL_PROXY_HISTOGRAM */
-       609, /* GL_HISTOGRAM_WIDTH */
-       599, /* GL_HISTOGRAM_FORMAT */
-       605, /* GL_HISTOGRAM_RED_SIZE */
-       601, /* GL_HISTOGRAM_GREEN_SIZE */
-       596, /* GL_HISTOGRAM_BLUE_SIZE */
-       594, /* GL_HISTOGRAM_ALPHA_SIZE */
-       603, /* GL_HISTOGRAM_LUMINANCE_SIZE */
-       607, /* GL_HISTOGRAM_SINK */
-       925, /* GL_MINMAX */
-       927, /* GL_MINMAX_FORMAT */
-       929, /* GL_MINMAX_SINK */
-      1501, /* GL_TABLE_TOO_LARGE_EXT */
-      1714, /* GL_UNSIGNED_BYTE_3_3_2 */
-      1725, /* GL_UNSIGNED_SHORT_4_4_4_4 */
-      1727, /* GL_UNSIGNED_SHORT_5_5_5_1 */
-      1720, /* GL_UNSIGNED_INT_8_8_8_8 */
-      1716, /* GL_UNSIGNED_INT_10_10_10_2 */
-      1147, /* GL_POLYGON_OFFSET_FILL */
-      1146, /* GL_POLYGON_OFFSET_FACTOR */
-      1145, /* GL_POLYGON_OFFSET_BIAS */
-      1306, /* GL_RESCALE_NORMAL */
+       564, /* GL_FUNC_SUBTRACT */
+       562, /* GL_FUNC_REVERSE_SUBTRACT */
+       271, /* GL_CONVOLUTION_1D */
+       272, /* GL_CONVOLUTION_2D */
+      1395, /* GL_SEPARABLE_2D */
+       275, /* GL_CONVOLUTION_BORDER_MODE */
+       279, /* GL_CONVOLUTION_FILTER_SCALE */
+       277, /* GL_CONVOLUTION_FILTER_BIAS */
+      1283, /* GL_REDUCE */
+       281, /* GL_CONVOLUTION_FORMAT */
+       285, /* GL_CONVOLUTION_WIDTH */
+       283, /* GL_CONVOLUTION_HEIGHT */
+       858, /* GL_MAX_CONVOLUTION_WIDTH */
+       856, /* GL_MAX_CONVOLUTION_HEIGHT */
+      1197, /* GL_POST_CONVOLUTION_RED_SCALE */
+      1193, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+      1188, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+      1184, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+      1195, /* GL_POST_CONVOLUTION_RED_BIAS */
+      1191, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+      1186, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+      1182, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+       601, /* GL_HISTOGRAM */
+      1244, /* GL_PROXY_HISTOGRAM */
+       617, /* GL_HISTOGRAM_WIDTH */
+       607, /* GL_HISTOGRAM_FORMAT */
+       613, /* GL_HISTOGRAM_RED_SIZE */
+       609, /* GL_HISTOGRAM_GREEN_SIZE */
+       604, /* GL_HISTOGRAM_BLUE_SIZE */
+       602, /* GL_HISTOGRAM_ALPHA_SIZE */
+       611, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+       615, /* GL_HISTOGRAM_SINK */
+       933, /* GL_MINMAX */
+       935, /* GL_MINMAX_FORMAT */
+       937, /* GL_MINMAX_SINK */
+      1509, /* GL_TABLE_TOO_LARGE_EXT */
+      1722, /* GL_UNSIGNED_BYTE_3_3_2 */
+      1733, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+      1735, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+      1728, /* GL_UNSIGNED_INT_8_8_8_8 */
+      1724, /* GL_UNSIGNED_INT_10_10_10_2 */
+      1155, /* GL_POLYGON_OFFSET_FILL */
+      1154, /* GL_POLYGON_OFFSET_FACTOR */
+      1153, /* GL_POLYGON_OFFSET_BIAS */
+      1314, /* GL_RESCALE_NORMAL */
         36, /* GL_ALPHA4 */
         38, /* GL_ALPHA8 */
         32, /* GL_ALPHA12 */
         34, /* GL_ALPHA16 */
-       721, /* GL_LUMINANCE4 */
-       727, /* GL_LUMINANCE8 */
-       711, /* GL_LUMINANCE12 */
-       717, /* GL_LUMINANCE16 */
-       722, /* GL_LUMINANCE4_ALPHA4 */
-       725, /* GL_LUMINANCE6_ALPHA2 */
-       728, /* GL_LUMINANCE8_ALPHA8 */
-       714, /* GL_LUMINANCE12_ALPHA4 */
-       712, /* GL_LUMINANCE12_ALPHA12 */
-       718, /* GL_LUMINANCE16_ALPHA16 */
-       634, /* GL_INTENSITY */
-       639, /* GL_INTENSITY4 */
-       641, /* GL_INTENSITY8 */
-       635, /* GL_INTENSITY12 */
-       637, /* GL_INTENSITY16 */
-      1318, /* GL_RGB2_EXT */
-      1319, /* GL_RGB4 */
-      1322, /* GL_RGB5 */
-      1326, /* GL_RGB8 */
-      1310, /* GL_RGB10 */
-      1314, /* GL_RGB12 */
-      1316, /* GL_RGB16 */
-      1333, /* GL_RGBA2 */
-      1335, /* GL_RGBA4 */
-      1323, /* GL_RGB5_A1 */
-      1339, /* GL_RGBA8 */
-      1311, /* GL_RGB10_A2 */
-      1329, /* GL_RGBA12 */
-      1331, /* GL_RGBA16 */
-      1674, /* GL_TEXTURE_RED_SIZE */
-      1646, /* GL_TEXTURE_GREEN_SIZE */
-      1585, /* GL_TEXTURE_BLUE_SIZE */
-      1572, /* GL_TEXTURE_ALPHA_SIZE */
-      1659, /* GL_TEXTURE_LUMINANCE_SIZE */
-      1650, /* GL_TEXTURE_INTENSITY_SIZE */
-      1304, /* GL_REPLACE_EXT */
-      1240, /* GL_PROXY_TEXTURE_1D */
-      1243, /* GL_PROXY_TEXTURE_2D */
-      1679, /* GL_TEXTURE_TOO_LARGE_EXT */
-      1671, /* GL_TEXTURE_PRIORITY */
-      1676, /* GL_TEXTURE_RESIDENT */
-      1575, /* GL_TEXTURE_BINDING_1D */
-      1577, /* GL_TEXTURE_BINDING_2D */
-      1579, /* GL_TEXTURE_BINDING_3D */
-      1071, /* GL_PACK_SKIP_IMAGES */
-      1067, /* GL_PACK_IMAGE_HEIGHT */
-      1708, /* GL_UNPACK_SKIP_IMAGES */
-      1705, /* GL_UNPACK_IMAGE_HEIGHT */
-      1571, /* GL_TEXTURE_3D */
-      1246, /* GL_PROXY_TEXTURE_3D */
-      1633, /* GL_TEXTURE_DEPTH */
-      1682, /* GL_TEXTURE_WRAP_R */
-       836, /* GL_MAX_3D_TEXTURE_SIZE */
-      1740, /* GL_VERTEX_ARRAY */
-      1002, /* GL_NORMAL_ARRAY */
-       138, /* GL_COLOR_ARRAY */
-       619, /* GL_INDEX_ARRAY */
-      1612, /* GL_TEXTURE_COORD_ARRAY */
-       435, /* GL_EDGE_FLAG_ARRAY */
-      1745, /* GL_VERTEX_ARRAY_SIZE */
-      1747, /* GL_VERTEX_ARRAY_TYPE */
-      1746, /* GL_VERTEX_ARRAY_STRIDE */
-      1007, /* GL_NORMAL_ARRAY_TYPE */
-      1006, /* GL_NORMAL_ARRAY_STRIDE */
-       142, /* GL_COLOR_ARRAY_SIZE */
-       144, /* GL_COLOR_ARRAY_TYPE */
-       143, /* GL_COLOR_ARRAY_STRIDE */
-       624, /* GL_INDEX_ARRAY_TYPE */
-       623, /* GL_INDEX_ARRAY_STRIDE */
-      1616, /* GL_TEXTURE_COORD_ARRAY_SIZE */
-      1618, /* GL_TEXTURE_COORD_ARRAY_TYPE */
-      1617, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
-       439, /* GL_EDGE_FLAG_ARRAY_STRIDE */
-      1744, /* GL_VERTEX_ARRAY_POINTER */
-      1005, /* GL_NORMAL_ARRAY_POINTER */
-       141, /* GL_COLOR_ARRAY_POINTER */
-       622, /* GL_INDEX_ARRAY_POINTER */
-      1615, /* GL_TEXTURE_COORD_ARRAY_POINTER */
-       438, /* GL_EDGE_FLAG_ARRAY_POINTER */
-       981, /* GL_MULTISAMPLE */
-      1361, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
-      1363, /* GL_SAMPLE_ALPHA_TO_ONE */
-      1368, /* GL_SAMPLE_COVERAGE */
-      1365, /* GL_SAMPLE_BUFFERS */
-      1356, /* GL_SAMPLES */
-      1372, /* GL_SAMPLE_COVERAGE_VALUE */
-      1370, /* GL_SAMPLE_COVERAGE_INVERT */
-       185, /* GL_COLOR_MATRIX */
-       187, /* GL_COLOR_MATRIX_STACK_DEPTH */
-       844, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
-      1172, /* GL_POST_COLOR_MATRIX_RED_SCALE */
-      1168, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
-      1163, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
-      1159, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
-      1170, /* GL_POST_COLOR_MATRIX_RED_BIAS */
-      1166, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
-      1161, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
-      1157, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
-      1595, /* GL_TEXTURE_COLOR_TABLE_SGI */
-      1247, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
-      1597, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+       729, /* GL_LUMINANCE4 */
+       735, /* GL_LUMINANCE8 */
+       719, /* GL_LUMINANCE12 */
+       725, /* GL_LUMINANCE16 */
+       730, /* GL_LUMINANCE4_ALPHA4 */
+       733, /* GL_LUMINANCE6_ALPHA2 */
+       736, /* GL_LUMINANCE8_ALPHA8 */
+       722, /* GL_LUMINANCE12_ALPHA4 */
+       720, /* GL_LUMINANCE12_ALPHA12 */
+       726, /* GL_LUMINANCE16_ALPHA16 */
+       642, /* GL_INTENSITY */
+       647, /* GL_INTENSITY4 */
+       649, /* GL_INTENSITY8 */
+       643, /* GL_INTENSITY12 */
+       645, /* GL_INTENSITY16 */
+      1326, /* GL_RGB2_EXT */
+      1327, /* GL_RGB4 */
+      1330, /* GL_RGB5 */
+      1334, /* GL_RGB8 */
+      1318, /* GL_RGB10 */
+      1322, /* GL_RGB12 */
+      1324, /* GL_RGB16 */
+      1341, /* GL_RGBA2 */
+      1343, /* GL_RGBA4 */
+      1331, /* GL_RGB5_A1 */
+      1347, /* GL_RGBA8 */
+      1319, /* GL_RGB10_A2 */
+      1337, /* GL_RGBA12 */
+      1339, /* GL_RGBA16 */
+      1682, /* GL_TEXTURE_RED_SIZE */
+      1654, /* GL_TEXTURE_GREEN_SIZE */
+      1593, /* GL_TEXTURE_BLUE_SIZE */
+      1580, /* GL_TEXTURE_ALPHA_SIZE */
+      1667, /* GL_TEXTURE_LUMINANCE_SIZE */
+      1658, /* GL_TEXTURE_INTENSITY_SIZE */
+      1312, /* GL_REPLACE_EXT */
+      1248, /* GL_PROXY_TEXTURE_1D */
+      1251, /* GL_PROXY_TEXTURE_2D */
+      1687, /* GL_TEXTURE_TOO_LARGE_EXT */
+      1679, /* GL_TEXTURE_PRIORITY */
+      1684, /* GL_TEXTURE_RESIDENT */
+      1583, /* GL_TEXTURE_BINDING_1D */
+      1585, /* GL_TEXTURE_BINDING_2D */
+      1587, /* GL_TEXTURE_BINDING_3D */
+      1079, /* GL_PACK_SKIP_IMAGES */
+      1075, /* GL_PACK_IMAGE_HEIGHT */
+      1716, /* GL_UNPACK_SKIP_IMAGES */
+      1713, /* GL_UNPACK_IMAGE_HEIGHT */
+      1579, /* GL_TEXTURE_3D */
+      1254, /* GL_PROXY_TEXTURE_3D */
+      1641, /* GL_TEXTURE_DEPTH */
+      1690, /* GL_TEXTURE_WRAP_R */
+       844, /* GL_MAX_3D_TEXTURE_SIZE */
+      1748, /* GL_VERTEX_ARRAY */
+      1010, /* GL_NORMAL_ARRAY */
+       144, /* GL_COLOR_ARRAY */
+       627, /* GL_INDEX_ARRAY */
+      1620, /* GL_TEXTURE_COORD_ARRAY */
+       443, /* GL_EDGE_FLAG_ARRAY */
+      1753, /* GL_VERTEX_ARRAY_SIZE */
+      1755, /* GL_VERTEX_ARRAY_TYPE */
+      1754, /* GL_VERTEX_ARRAY_STRIDE */
+      1015, /* GL_NORMAL_ARRAY_TYPE */
+      1014, /* GL_NORMAL_ARRAY_STRIDE */
+       148, /* GL_COLOR_ARRAY_SIZE */
+       150, /* GL_COLOR_ARRAY_TYPE */
+       149, /* GL_COLOR_ARRAY_STRIDE */
+       632, /* GL_INDEX_ARRAY_TYPE */
+       631, /* GL_INDEX_ARRAY_STRIDE */
+      1624, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+      1626, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+      1625, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+       447, /* GL_EDGE_FLAG_ARRAY_STRIDE */
+      1752, /* GL_VERTEX_ARRAY_POINTER */
+      1013, /* GL_NORMAL_ARRAY_POINTER */
+       147, /* GL_COLOR_ARRAY_POINTER */
+       630, /* GL_INDEX_ARRAY_POINTER */
+      1623, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+       446, /* GL_EDGE_FLAG_ARRAY_POINTER */
+       989, /* GL_MULTISAMPLE */
+      1369, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+      1371, /* GL_SAMPLE_ALPHA_TO_ONE */
+      1376, /* GL_SAMPLE_COVERAGE */
+      1373, /* GL_SAMPLE_BUFFERS */
+      1364, /* GL_SAMPLES */
+      1380, /* GL_SAMPLE_COVERAGE_VALUE */
+      1378, /* GL_SAMPLE_COVERAGE_INVERT */
+       191, /* GL_COLOR_MATRIX */
+       193, /* GL_COLOR_MATRIX_STACK_DEPTH */
+       852, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+      1180, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+      1176, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+      1171, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+      1167, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+      1178, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+      1174, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+      1169, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+      1165, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+      1603, /* GL_TEXTURE_COLOR_TABLE_SGI */
+      1255, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+      1605, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
         79, /* GL_BLEND_DST_RGB */
         87, /* GL_BLEND_SRC_RGB */
         78, /* GL_BLEND_DST_ALPHA */
         86, /* GL_BLEND_SRC_ALPHA */
-       191, /* GL_COLOR_TABLE */
-      1182, /* GL_POST_CONVOLUTION_COLOR_TABLE */
-      1165, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
-      1235, /* GL_PROXY_COLOR_TABLE */
-      1239, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
-      1238, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
-       215, /* GL_COLOR_TABLE_SCALE */
-       195, /* GL_COLOR_TABLE_BIAS */
-       200, /* GL_COLOR_TABLE_FORMAT */
-       217, /* GL_COLOR_TABLE_WIDTH */
-       212, /* GL_COLOR_TABLE_RED_SIZE */
-       203, /* GL_COLOR_TABLE_GREEN_SIZE */
-       197, /* GL_COLOR_TABLE_BLUE_SIZE */
-       192, /* GL_COLOR_TABLE_ALPHA_SIZE */
-       209, /* GL_COLOR_TABLE_LUMINANCE_SIZE */
-       206, /* GL_COLOR_TABLE_INTENSITY_SIZE */
+       197, /* GL_COLOR_TABLE */
+      1190, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+      1173, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+      1243, /* GL_PROXY_COLOR_TABLE */
+      1247, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+      1246, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+       221, /* GL_COLOR_TABLE_SCALE */
+       201, /* GL_COLOR_TABLE_BIAS */
+       206, /* GL_COLOR_TABLE_FORMAT */
+       223, /* GL_COLOR_TABLE_WIDTH */
+       218, /* GL_COLOR_TABLE_RED_SIZE */
+       209, /* GL_COLOR_TABLE_GREEN_SIZE */
+       203, /* GL_COLOR_TABLE_BLUE_SIZE */
+       198, /* GL_COLOR_TABLE_ALPHA_SIZE */
+       215, /* GL_COLOR_TABLE_LUMINANCE_SIZE */
+       212, /* GL_COLOR_TABLE_INTENSITY_SIZE */
         70, /* GL_BGR */
         71, /* GL_BGRA */
-       858, /* GL_MAX_ELEMENTS_VERTICES */
-       857, /* GL_MAX_ELEMENTS_INDICES */
-      1649, /* GL_TEXTURE_INDEX_SIZE_EXT */
-       135, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
-      1129, /* GL_POINT_SIZE_MIN */
-      1125, /* GL_POINT_SIZE_MAX */
-      1119, /* GL_POINT_FADE_THRESHOLD_SIZE */
-      1115, /* GL_POINT_DISTANCE_ATTENUATION */
-       117, /* GL_CLAMP_TO_BORDER */
-       120, /* GL_CLAMP_TO_EDGE */
-      1670, /* GL_TEXTURE_MIN_LOD */
-      1668, /* GL_TEXTURE_MAX_LOD */
-      1574, /* GL_TEXTURE_BASE_LEVEL */
-      1667, /* GL_TEXTURE_MAX_LEVEL */
-       612, /* GL_IGNORE_BORDER_HP */
-       261, /* GL_CONSTANT_BORDER_HP */
-      1305, /* GL_REPLICATE_BORDER_HP */
-       267, /* GL_CONVOLUTION_BORDER_COLOR */
-      1030, /* GL_OCCLUSION_TEST_HP */
-      1031, /* GL_OCCLUSION_TEST_RESULT_HP */
-       683, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
-      1589, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
-      1591, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
-      1593, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
-      1594, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-      1592, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
-      1590, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
-       840, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
-       841, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-      1192, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
-      1194, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
-      1191, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
-      1193, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
-      1657, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
-      1658, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
-      1656, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
-       558, /* GL_GENERATE_MIPMAP */
-       559, /* GL_GENERATE_MIPMAP_HINT */
-       500, /* GL_FOG_OFFSET_SGIX */
-       501, /* GL_FOG_OFFSET_VALUE_SGIX */
-      1603, /* GL_TEXTURE_COMPARE_SGIX */
-      1602, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
-      1653, /* GL_TEXTURE_LEQUAL_R_SGIX */
-      1645, /* GL_TEXTURE_GEQUAL_R_SGIX */
-       340, /* GL_DEPTH_COMPONENT16 */
-       343, /* GL_DEPTH_COMPONENT24 */
-       346, /* GL_DEPTH_COMPONENT32 */
-       289, /* GL_CULL_VERTEX_EXT */
-       291, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
-       290, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
-      1801, /* GL_WRAP_BORDER_SUN */
-      1596, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
-       676, /* GL_LIGHT_MODEL_COLOR_CONTROL */
-      1400, /* GL_SINGLE_COLOR */
-      1388, /* GL_SEPARATE_SPECULAR_COLOR */
-      1397, /* GL_SHARED_TEXTURE_PALETTE_EXT */
-       511, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
-       512, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
-       519, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
-       514, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
-       510, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
-       509, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
-       513, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
-       520, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
-       531, /* GL_FRAMEBUFFER_DEFAULT */
-       544, /* GL_FRAMEBUFFER_UNDEFINED */
-       353, /* GL_DEPTH_STENCIL_ATTACHMENT */
-       618, /* GL_INDEX */
-      1713, /* GL_UNSIGNED_BYTE_2_3_3_REV */
-      1728, /* GL_UNSIGNED_SHORT_5_6_5 */
-      1729, /* GL_UNSIGNED_SHORT_5_6_5_REV */
-      1726, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
-      1724, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
-      1721, /* GL_UNSIGNED_INT_8_8_8_8_REV */
-      1719, /* GL_UNSIGNED_INT_2_10_10_10_REV */
-      1665, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
-      1666, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
-      1664, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
-       932, /* GL_MIRRORED_REPEAT */
-      1344, /* GL_RGB_S3TC */
-      1321, /* GL_RGB4_S3TC */
-      1343, /* GL_RGBA_S3TC */
-      1338, /* GL_RGBA4_S3TC */
-      1341, /* GL_RGBA_DXT5_S3TC */
-      1336, /* GL_RGBA4_DXT5_S3TC */
-       254, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
-       249, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
-       250, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
-       251, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
-       993, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
-       992, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
-       684, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
-       487, /* GL_FOG_COORDINATE_SOURCE */
-       479, /* GL_FOG_COORD */
-       503, /* GL_FRAGMENT_DEPTH */
-       295, /* GL_CURRENT_FOG_COORD */
-       486, /* GL_FOG_COORDINATE_ARRAY_TYPE */
-       485, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
-       484, /* GL_FOG_COORDINATE_ARRAY_POINTER */
-       481, /* GL_FOG_COORDINATE_ARRAY */
-       189, /* GL_COLOR_SUM */
-       314, /* GL_CURRENT_SECONDARY_COLOR */
-      1381, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
-      1383, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
-      1382, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
-      1380, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
-      1377, /* GL_SECONDARY_COLOR_ARRAY */
-       568, /* GL_GL_CURRENT_RASTER_SECONDARY_COLOR */
+       866, /* GL_MAX_ELEMENTS_VERTICES */
+       865, /* GL_MAX_ELEMENTS_INDICES */
+      1657, /* GL_TEXTURE_INDEX_SIZE_EXT */
+       141, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
+      1137, /* GL_POINT_SIZE_MIN */
+      1133, /* GL_POINT_SIZE_MAX */
+      1127, /* GL_POINT_FADE_THRESHOLD_SIZE */
+      1123, /* GL_POINT_DISTANCE_ATTENUATION */
+       123, /* GL_CLAMP_TO_BORDER */
+       126, /* GL_CLAMP_TO_EDGE */
+      1678, /* GL_TEXTURE_MIN_LOD */
+      1676, /* GL_TEXTURE_MAX_LOD */
+      1582, /* GL_TEXTURE_BASE_LEVEL */
+      1675, /* GL_TEXTURE_MAX_LEVEL */
+       620, /* GL_IGNORE_BORDER_HP */
+       267, /* GL_CONSTANT_BORDER_HP */
+      1313, /* GL_REPLICATE_BORDER_HP */
+       273, /* GL_CONVOLUTION_BORDER_COLOR */
+      1038, /* GL_OCCLUSION_TEST_HP */
+      1039, /* GL_OCCLUSION_TEST_RESULT_HP */
+       691, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+      1597, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+      1599, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+      1601, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+      1602, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+      1600, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+      1598, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+       848, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+       849, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+      1200, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+      1202, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+      1199, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+      1201, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+      1665, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+      1666, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+      1664, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+       566, /* GL_GENERATE_MIPMAP */
+       567, /* GL_GENERATE_MIPMAP_HINT */
+       508, /* GL_FOG_OFFSET_SGIX */
+       509, /* GL_FOG_OFFSET_VALUE_SGIX */
+      1611, /* GL_TEXTURE_COMPARE_SGIX */
+      1610, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+      1661, /* GL_TEXTURE_LEQUAL_R_SGIX */
+      1653, /* GL_TEXTURE_GEQUAL_R_SGIX */
+       346, /* GL_DEPTH_COMPONENT16 */
+       349, /* GL_DEPTH_COMPONENT24 */
+       352, /* GL_DEPTH_COMPONENT32 */
+       295, /* GL_CULL_VERTEX_EXT */
+       297, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
+       296, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
+      1809, /* GL_WRAP_BORDER_SUN */
+      1604, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+       684, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+      1408, /* GL_SINGLE_COLOR */
+      1396, /* GL_SEPARATE_SPECULAR_COLOR */
+      1405, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+       519, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+       520, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+       527, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+       522, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+       518, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+       517, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+       521, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+       528, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+       539, /* GL_FRAMEBUFFER_DEFAULT */
+       552, /* GL_FRAMEBUFFER_UNDEFINED */
+       359, /* GL_DEPTH_STENCIL_ATTACHMENT */
+       626, /* GL_INDEX */
+      1721, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+      1736, /* GL_UNSIGNED_SHORT_5_6_5 */
+      1737, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+      1734, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+      1732, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+      1729, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+      1727, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+      1673, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+      1674, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+      1672, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+       940, /* GL_MIRRORED_REPEAT */
+      1352, /* GL_RGB_S3TC */
+      1329, /* GL_RGB4_S3TC */
+      1351, /* GL_RGBA_S3TC */
+      1346, /* GL_RGBA4_S3TC */
+      1349, /* GL_RGBA_DXT5_S3TC */
+      1344, /* GL_RGBA4_DXT5_S3TC */
+       260, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
+       255, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
+       256, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
+       257, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
+      1001, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+      1000, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+       692, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+       495, /* GL_FOG_COORDINATE_SOURCE */
+       487, /* GL_FOG_COORD */
+       511, /* GL_FRAGMENT_DEPTH */
+       301, /* GL_CURRENT_FOG_COORD */
+       494, /* GL_FOG_COORDINATE_ARRAY_TYPE */
+       493, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
+       492, /* GL_FOG_COORDINATE_ARRAY_POINTER */
+       489, /* GL_FOG_COORDINATE_ARRAY */
+       195, /* GL_COLOR_SUM */
+       320, /* GL_CURRENT_SECONDARY_COLOR */
+      1389, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+      1391, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+      1390, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+      1388, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+      1385, /* GL_SECONDARY_COLOR_ARRAY */
+       576, /* GL_GL_CURRENT_RASTER_SECONDARY_COLOR */
         28, /* GL_ALIASED_POINT_SIZE_RANGE */
         27, /* GL_ALIASED_LINE_WIDTH_RANGE */
-      1503, /* GL_TEXTURE0 */
-      1505, /* GL_TEXTURE1 */
-      1527, /* GL_TEXTURE2 */
-      1549, /* GL_TEXTURE3 */
-      1555, /* GL_TEXTURE4 */
-      1557, /* GL_TEXTURE5 */
-      1559, /* GL_TEXTURE6 */
-      1561, /* GL_TEXTURE7 */
-      1563, /* GL_TEXTURE8 */
-      1565, /* GL_TEXTURE9 */
-      1506, /* GL_TEXTURE10 */
-      1508, /* GL_TEXTURE11 */
-      1510, /* GL_TEXTURE12 */
-      1512, /* GL_TEXTURE13 */
-      1514, /* GL_TEXTURE14 */
-      1516, /* GL_TEXTURE15 */
-      1518, /* GL_TEXTURE16 */
-      1520, /* GL_TEXTURE17 */
-      1522, /* GL_TEXTURE18 */
-      1524, /* GL_TEXTURE19 */
-      1528, /* GL_TEXTURE20 */
-      1530, /* GL_TEXTURE21 */
-      1532, /* GL_TEXTURE22 */
-      1534, /* GL_TEXTURE23 */
-      1536, /* GL_TEXTURE24 */
-      1538, /* GL_TEXTURE25 */
-      1540, /* GL_TEXTURE26 */
-      1542, /* GL_TEXTURE27 */
-      1544, /* GL_TEXTURE28 */
-      1546, /* GL_TEXTURE29 */
-      1550, /* GL_TEXTURE30 */
-      1552, /* GL_TEXTURE31 */
+      1511, /* GL_TEXTURE0 */
+      1513, /* GL_TEXTURE1 */
+      1535, /* GL_TEXTURE2 */
+      1557, /* GL_TEXTURE3 */
+      1563, /* GL_TEXTURE4 */
+      1565, /* GL_TEXTURE5 */
+      1567, /* GL_TEXTURE6 */
+      1569, /* GL_TEXTURE7 */
+      1571, /* GL_TEXTURE8 */
+      1573, /* GL_TEXTURE9 */
+      1514, /* GL_TEXTURE10 */
+      1516, /* GL_TEXTURE11 */
+      1518, /* GL_TEXTURE12 */
+      1520, /* GL_TEXTURE13 */
+      1522, /* GL_TEXTURE14 */
+      1524, /* GL_TEXTURE15 */
+      1526, /* GL_TEXTURE16 */
+      1528, /* GL_TEXTURE17 */
+      1530, /* GL_TEXTURE18 */
+      1532, /* GL_TEXTURE19 */
+      1536, /* GL_TEXTURE20 */
+      1538, /* GL_TEXTURE21 */
+      1540, /* GL_TEXTURE22 */
+      1542, /* GL_TEXTURE23 */
+      1544, /* GL_TEXTURE24 */
+      1546, /* GL_TEXTURE25 */
+      1548, /* GL_TEXTURE26 */
+      1550, /* GL_TEXTURE27 */
+      1552, /* GL_TEXTURE28 */
+      1554, /* GL_TEXTURE29 */
+      1558, /* GL_TEXTURE30 */
+      1560, /* GL_TEXTURE31 */
         18, /* GL_ACTIVE_TEXTURE */
-       123, /* GL_CLIENT_ACTIVE_TEXTURE */
-       910, /* GL_MAX_TEXTURE_UNITS */
-      1692, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
-      1695, /* GL_TRANSPOSE_PROJECTION_MATRIX */
-      1697, /* GL_TRANSPOSE_TEXTURE_MATRIX */
-      1689, /* GL_TRANSPOSE_COLOR_MATRIX */
-      1491, /* GL_SUBTRACT */
-       898, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
-       237, /* GL_COMPRESSED_ALPHA */
-       241, /* GL_COMPRESSED_LUMINANCE */
-       242, /* GL_COMPRESSED_LUMINANCE_ALPHA */
-       239, /* GL_COMPRESSED_INTENSITY */
-       245, /* GL_COMPRESSED_RGB */
-       246, /* GL_COMPRESSED_RGBA */
-      1610, /* GL_TEXTURE_COMPRESSION_HINT */
-      1672, /* GL_TEXTURE_RECTANGLE_ARB */
-      1582, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
-      1250, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
-       896, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
-       352, /* GL_DEPTH_STENCIL */
-      1717, /* GL_UNSIGNED_INT_24_8 */
-       906, /* GL_MAX_TEXTURE_LOD_BIAS */
-      1663, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
-       907, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
-      1639, /* GL_TEXTURE_FILTER_CONTROL */
-      1654, /* GL_TEXTURE_LOD_BIAS */
-       222, /* GL_COMBINE4 */
-       900, /* GL_MAX_SHININESS_NV */
-       901, /* GL_MAX_SPOT_EXPONENT_NV */
-       616, /* GL_INCR_WRAP */
-       325, /* GL_DECR_WRAP */
-       952, /* GL_MODELVIEW1_ARB */
-      1008, /* GL_NORMAL_MAP */
-      1280, /* GL_REFLECTION_MAP */
-      1619, /* GL_TEXTURE_CUBE_MAP */
-      1580, /* GL_TEXTURE_BINDING_CUBE_MAP */
-      1627, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
-      1621, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
-      1629, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
-      1623, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
-      1631, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
-      1625, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
-      1248, /* GL_PROXY_TEXTURE_CUBE_MAP */
-       852, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
-       987, /* GL_MULTISAMPLE_FILTER_HINT_NV */
-       495, /* GL_FOG_DISTANCE_MODE_NV */
-       454, /* GL_EYE_RADIAL_NV */
-       453, /* GL_EYE_PLANE_ABSOLUTE_NV */
-       221, /* GL_COMBINE */
-       228, /* GL_COMBINE_RGB */
-       223, /* GL_COMBINE_ALPHA */
-      1345, /* GL_RGB_SCALE */
+       129, /* GL_CLIENT_ACTIVE_TEXTURE */
+       918, /* GL_MAX_TEXTURE_UNITS */
+      1700, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+      1703, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+      1705, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+      1697, /* GL_TRANSPOSE_COLOR_MATRIX */
+      1499, /* GL_SUBTRACT */
+       906, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
+       243, /* GL_COMPRESSED_ALPHA */
+       247, /* GL_COMPRESSED_LUMINANCE */
+       248, /* GL_COMPRESSED_LUMINANCE_ALPHA */
+       245, /* GL_COMPRESSED_INTENSITY */
+       251, /* GL_COMPRESSED_RGB */
+       252, /* GL_COMPRESSED_RGBA */
+      1618, /* GL_TEXTURE_COMPRESSION_HINT */
+      1680, /* GL_TEXTURE_RECTANGLE_ARB */
+      1590, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+      1258, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+       904, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+       358, /* GL_DEPTH_STENCIL */
+      1725, /* GL_UNSIGNED_INT_24_8 */
+       914, /* GL_MAX_TEXTURE_LOD_BIAS */
+      1671, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+       915, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+      1647, /* GL_TEXTURE_FILTER_CONTROL */
+      1662, /* GL_TEXTURE_LOD_BIAS */
+       228, /* GL_COMBINE4 */
+       908, /* GL_MAX_SHININESS_NV */
+       909, /* GL_MAX_SPOT_EXPONENT_NV */
+       624, /* GL_INCR_WRAP */
+       331, /* GL_DECR_WRAP */
+       960, /* GL_MODELVIEW1_ARB */
+      1016, /* GL_NORMAL_MAP */
+      1288, /* GL_REFLECTION_MAP */
+      1627, /* GL_TEXTURE_CUBE_MAP */
+      1588, /* GL_TEXTURE_BINDING_CUBE_MAP */
+      1635, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+      1629, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+      1637, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+      1631, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+      1639, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+      1633, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+      1256, /* GL_PROXY_TEXTURE_CUBE_MAP */
+       860, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+       995, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+       503, /* GL_FOG_DISTANCE_MODE_NV */
+       462, /* GL_EYE_RADIAL_NV */
+       461, /* GL_EYE_PLANE_ABSOLUTE_NV */
+       227, /* GL_COMBINE */
+       234, /* GL_COMBINE_RGB */
+       229, /* GL_COMBINE_ALPHA */
+      1353, /* GL_RGB_SCALE */
         24, /* GL_ADD_SIGNED */
-       644, /* GL_INTERPOLATE */
-       256, /* GL_CONSTANT */
-      1198, /* GL_PRIMARY_COLOR */
-      1195, /* GL_PREVIOUS */
-      1411, /* GL_SOURCE0_RGB */
-      1417, /* GL_SOURCE1_RGB */
-      1423, /* GL_SOURCE2_RGB */
-      1427, /* GL_SOURCE3_RGB_NV */
-      1408, /* GL_SOURCE0_ALPHA */
-      1414, /* GL_SOURCE1_ALPHA */
-      1420, /* GL_SOURCE2_ALPHA */
-      1426, /* GL_SOURCE3_ALPHA_NV */
-      1044, /* GL_OPERAND0_RGB */
-      1050, /* GL_OPERAND1_RGB */
-      1056, /* GL_OPERAND2_RGB */
-      1060, /* GL_OPERAND3_RGB_NV */
-      1041, /* GL_OPERAND0_ALPHA */
-      1047, /* GL_OPERAND1_ALPHA */
-      1053, /* GL_OPERAND2_ALPHA */
-      1059, /* GL_OPERAND3_ALPHA_NV */
-      1741, /* GL_VERTEX_ARRAY_BINDING_APPLE */
-      1805, /* GL_YCBCR_422_APPLE */
-      1730, /* GL_UNSIGNED_SHORT_8_8_APPLE */
-      1732, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
-      1402, /* GL_SLICE_ACCUM_SUN */
-      1255, /* GL_QUAD_MESH_SUN */
-      1701, /* GL_TRIANGLE_MESH_SUN */
-      1779, /* GL_VERTEX_PROGRAM_ARB */
-      1790, /* GL_VERTEX_STATE_PROGRAM_NV */
-      1766, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
-      1772, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
-      1774, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
-      1776, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
-       316, /* GL_CURRENT_VERTEX_ATTRIB */
-      1211, /* GL_PROGRAM_LENGTH_ARB */
-      1225, /* GL_PROGRAM_STRING_ARB */
-       974, /* GL_MODELVIEW_PROJECTION_NV */
-       611, /* GL_IDENTITY_NV */
-       658, /* GL_INVERSE_NV */
-      1694, /* GL_TRANSPOSE_NV */
-       659, /* GL_INVERSE_TRANSPOSE_NV */
-       882, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
-       881, /* GL_MAX_PROGRAM_MATRICES_ARB */
-       789, /* GL_MATRIX0_NV */
-       801, /* GL_MATRIX1_NV */
-       813, /* GL_MATRIX2_NV */
-       817, /* GL_MATRIX3_NV */
-       819, /* GL_MATRIX4_NV */
-       821, /* GL_MATRIX5_NV */
-       823, /* GL_MATRIX6_NV */
-       825, /* GL_MATRIX7_NV */
-       301, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
-       298, /* GL_CURRENT_MATRIX_ARB */
-      1782, /* GL_VERTEX_PROGRAM_POINT_SIZE */
-      1785, /* GL_VERTEX_PROGRAM_TWO_SIDE */
-      1223, /* GL_PROGRAM_PARAMETER_NV */
-      1770, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
-      1227, /* GL_PROGRAM_TARGET_NV */
-      1224, /* GL_PROGRAM_RESIDENT_NV */
-      1686, /* GL_TRACK_MATRIX_NV */
-      1687, /* GL_TRACK_MATRIX_TRANSFORM_NV */
-      1780, /* GL_VERTEX_PROGRAM_BINDING_NV */
-      1205, /* GL_PROGRAM_ERROR_POSITION_ARB */
-       337, /* GL_DEPTH_CLAMP_NV */
-      1748, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
-      1755, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
-      1756, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
-      1757, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
-      1758, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
-      1759, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
-      1760, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
-      1761, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
-      1762, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
-      1763, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
-      1749, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
-      1750, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
-      1751, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
-      1752, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
-      1753, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
-      1754, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
-       743, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
-       750, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
-       751, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
-       752, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
-       753, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
-       754, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
-       755, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
-       756, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
-       757, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
-       758, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
-       744, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
-       745, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
-       746, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
-       747, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
-       748, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
-       749, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
-       770, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
-       777, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
-       778, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
-       779, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
-       780, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
-       781, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
-       782, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
-      1204, /* GL_PROGRAM_BINDING_ARB */
-       784, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
-       785, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
-       771, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
-       772, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
-       773, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
-       774, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
-       775, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
-       776, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
-      1608, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
-      1605, /* GL_TEXTURE_COMPRESSED */
-      1013, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
-       255, /* GL_COMPRESSED_TEXTURE_FORMATS */
-       922, /* GL_MAX_VERTEX_UNITS_ARB */
+       652, /* GL_INTERPOLATE */
+       262, /* GL_CONSTANT */
+      1206, /* GL_PRIMARY_COLOR */
+      1203, /* GL_PREVIOUS */
+      1419, /* GL_SOURCE0_RGB */
+      1425, /* GL_SOURCE1_RGB */
+      1431, /* GL_SOURCE2_RGB */
+      1435, /* GL_SOURCE3_RGB_NV */
+      1416, /* GL_SOURCE0_ALPHA */
+      1422, /* GL_SOURCE1_ALPHA */
+      1428, /* GL_SOURCE2_ALPHA */
+      1434, /* GL_SOURCE3_ALPHA_NV */
+      1052, /* GL_OPERAND0_RGB */
+      1058, /* GL_OPERAND1_RGB */
+      1064, /* GL_OPERAND2_RGB */
+      1068, /* GL_OPERAND3_RGB_NV */
+      1049, /* GL_OPERAND0_ALPHA */
+      1055, /* GL_OPERAND1_ALPHA */
+      1061, /* GL_OPERAND2_ALPHA */
+      1067, /* GL_OPERAND3_ALPHA_NV */
+      1749, /* GL_VERTEX_ARRAY_BINDING_APPLE */
+      1813, /* GL_YCBCR_422_APPLE */
+      1738, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+      1740, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+      1410, /* GL_SLICE_ACCUM_SUN */
+      1263, /* GL_QUAD_MESH_SUN */
+      1709, /* GL_TRIANGLE_MESH_SUN */
+      1787, /* GL_VERTEX_PROGRAM_ARB */
+      1798, /* GL_VERTEX_STATE_PROGRAM_NV */
+      1774, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+      1780, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+      1782, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+      1784, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+       322, /* GL_CURRENT_VERTEX_ATTRIB */
+      1219, /* GL_PROGRAM_LENGTH_ARB */
+      1233, /* GL_PROGRAM_STRING_ARB */
+       982, /* GL_MODELVIEW_PROJECTION_NV */
+       619, /* GL_IDENTITY_NV */
+       666, /* GL_INVERSE_NV */
+      1702, /* GL_TRANSPOSE_NV */
+       667, /* GL_INVERSE_TRANSPOSE_NV */
+       890, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+       889, /* GL_MAX_PROGRAM_MATRICES_ARB */
+       797, /* GL_MATRIX0_NV */
+       809, /* GL_MATRIX1_NV */
+       821, /* GL_MATRIX2_NV */
+       825, /* GL_MATRIX3_NV */
+       827, /* GL_MATRIX4_NV */
+       829, /* GL_MATRIX5_NV */
+       831, /* GL_MATRIX6_NV */
+       833, /* GL_MATRIX7_NV */
+       307, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
+       304, /* GL_CURRENT_MATRIX_ARB */
+      1790, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+      1793, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+      1231, /* GL_PROGRAM_PARAMETER_NV */
+      1778, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+      1235, /* GL_PROGRAM_TARGET_NV */
+      1232, /* GL_PROGRAM_RESIDENT_NV */
+      1694, /* GL_TRACK_MATRIX_NV */
+      1695, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+      1788, /* GL_VERTEX_PROGRAM_BINDING_NV */
+      1213, /* GL_PROGRAM_ERROR_POSITION_ARB */
+       343, /* GL_DEPTH_CLAMP_NV */
+      1756, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+      1763, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+      1764, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+      1765, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+      1766, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+      1767, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+      1768, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+      1769, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+      1770, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+      1771, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+      1757, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+      1758, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+      1759, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+      1760, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+      1761, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+      1762, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+       751, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+       758, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+       759, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+       760, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+       761, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+       762, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+       763, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+       764, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+       765, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+       766, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+       752, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+       753, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+       754, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+       755, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+       756, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+       757, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+       778, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+       785, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+       786, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+       787, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+       788, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+       789, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+       790, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+      1212, /* GL_PROGRAM_BINDING_ARB */
+       792, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+       793, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+       779, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+       780, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+       781, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+       782, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+       783, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+       784, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+      1616, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+      1613, /* GL_TEXTURE_COMPRESSED */
+      1021, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+       261, /* GL_COMPRESSED_TEXTURE_FORMATS */
+       930, /* GL_MAX_VERTEX_UNITS_ARB */
         22, /* GL_ACTIVE_VERTEX_UNITS_ARB */
-      1800, /* GL_WEIGHT_SUM_UNITY_ARB */
-      1778, /* GL_VERTEX_BLEND_ARB */
-       318, /* GL_CURRENT_WEIGHT_ARB */
-      1799, /* GL_WEIGHT_ARRAY_TYPE_ARB */
-      1798, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
-      1797, /* GL_WEIGHT_ARRAY_SIZE_ARB */
-      1796, /* GL_WEIGHT_ARRAY_POINTER_ARB */
-      1793, /* GL_WEIGHT_ARRAY_ARB */
-       365, /* GL_DOT3_RGB */
-       366, /* GL_DOT3_RGBA */
-       253, /* GL_COMPRESSED_RGB_FXT1_3DFX */
-       248, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
-       982, /* GL_MULTISAMPLE_3DFX */
-      1366, /* GL_SAMPLE_BUFFERS_3DFX */
-      1357, /* GL_SAMPLES_3DFX */
-       963, /* GL_MODELVIEW2_ARB */
-       966, /* GL_MODELVIEW3_ARB */
-       967, /* GL_MODELVIEW4_ARB */
-       968, /* GL_MODELVIEW5_ARB */
-       969, /* GL_MODELVIEW6_ARB */
-       970, /* GL_MODELVIEW7_ARB */
-       971, /* GL_MODELVIEW8_ARB */
-       972, /* GL_MODELVIEW9_ARB */
-       942, /* GL_MODELVIEW10_ARB */
-       943, /* GL_MODELVIEW11_ARB */
-       944, /* GL_MODELVIEW12_ARB */
-       945, /* GL_MODELVIEW13_ARB */
-       946, /* GL_MODELVIEW14_ARB */
-       947, /* GL_MODELVIEW15_ARB */
-       948, /* GL_MODELVIEW16_ARB */
-       949, /* GL_MODELVIEW17_ARB */
-       950, /* GL_MODELVIEW18_ARB */
-       951, /* GL_MODELVIEW19_ARB */
-       953, /* GL_MODELVIEW20_ARB */
-       954, /* GL_MODELVIEW21_ARB */
-       955, /* GL_MODELVIEW22_ARB */
-       956, /* GL_MODELVIEW23_ARB */
-       957, /* GL_MODELVIEW24_ARB */
-       958, /* GL_MODELVIEW25_ARB */
-       959, /* GL_MODELVIEW26_ARB */
-       960, /* GL_MODELVIEW27_ARB */
-       961, /* GL_MODELVIEW28_ARB */
-       962, /* GL_MODELVIEW29_ARB */
-       964, /* GL_MODELVIEW30_ARB */
-       965, /* GL_MODELVIEW31_ARB */
-       370, /* GL_DOT3_RGB_EXT */
-       368, /* GL_DOT3_RGBA_EXT */
-       936, /* GL_MIRROR_CLAMP_EXT */
-       939, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
-       977, /* GL_MODULATE_ADD_ATI */
-       978, /* GL_MODULATE_SIGNED_ADD_ATI */
-       979, /* GL_MODULATE_SUBTRACT_ATI */
-      1806, /* GL_YCBCR_MESA */
-      1068, /* GL_PACK_INVERT_MESA */
-       321, /* GL_DEBUG_OBJECT_MESA */
-       322, /* GL_DEBUG_PRINT_MESA */
-       320, /* GL_DEBUG_ASSERT_MESA */
+      1808, /* GL_WEIGHT_SUM_UNITY_ARB */
+      1786, /* GL_VERTEX_BLEND_ARB */
+       324, /* GL_CURRENT_WEIGHT_ARB */
+      1807, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+      1806, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+      1805, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+      1804, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+      1801, /* GL_WEIGHT_ARRAY_ARB */
+       371, /* GL_DOT3_RGB */
+       372, /* GL_DOT3_RGBA */
+       259, /* GL_COMPRESSED_RGB_FXT1_3DFX */
+       254, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
+       990, /* GL_MULTISAMPLE_3DFX */
+      1374, /* GL_SAMPLE_BUFFERS_3DFX */
+      1365, /* GL_SAMPLES_3DFX */
+       971, /* GL_MODELVIEW2_ARB */
+       974, /* GL_MODELVIEW3_ARB */
+       975, /* GL_MODELVIEW4_ARB */
+       976, /* GL_MODELVIEW5_ARB */
+       977, /* GL_MODELVIEW6_ARB */
+       978, /* GL_MODELVIEW7_ARB */
+       979, /* GL_MODELVIEW8_ARB */
+       980, /* GL_MODELVIEW9_ARB */
+       950, /* GL_MODELVIEW10_ARB */
+       951, /* GL_MODELVIEW11_ARB */
+       952, /* GL_MODELVIEW12_ARB */
+       953, /* GL_MODELVIEW13_ARB */
+       954, /* GL_MODELVIEW14_ARB */
+       955, /* GL_MODELVIEW15_ARB */
+       956, /* GL_MODELVIEW16_ARB */
+       957, /* GL_MODELVIEW17_ARB */
+       958, /* GL_MODELVIEW18_ARB */
+       959, /* GL_MODELVIEW19_ARB */
+       961, /* GL_MODELVIEW20_ARB */
+       962, /* GL_MODELVIEW21_ARB */
+       963, /* GL_MODELVIEW22_ARB */
+       964, /* GL_MODELVIEW23_ARB */
+       965, /* GL_MODELVIEW24_ARB */
+       966, /* GL_MODELVIEW25_ARB */
+       967, /* GL_MODELVIEW26_ARB */
+       968, /* GL_MODELVIEW27_ARB */
+       969, /* GL_MODELVIEW28_ARB */
+       970, /* GL_MODELVIEW29_ARB */
+       972, /* GL_MODELVIEW30_ARB */
+       973, /* GL_MODELVIEW31_ARB */
+       376, /* GL_DOT3_RGB_EXT */
+       374, /* GL_DOT3_RGBA_EXT */
+       944, /* GL_MIRROR_CLAMP_EXT */
+       947, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+       985, /* GL_MODULATE_ADD_ATI */
+       986, /* GL_MODULATE_SIGNED_ADD_ATI */
+       987, /* GL_MODULATE_SUBTRACT_ATI */
+      1814, /* GL_YCBCR_MESA */
+      1076, /* GL_PACK_INVERT_MESA */
+       327, /* GL_DEBUG_OBJECT_MESA */
+       328, /* GL_DEBUG_PRINT_MESA */
+       326, /* GL_DEBUG_ASSERT_MESA */
        106, /* GL_BUFFER_SIZE */
        108, /* GL_BUFFER_USAGE */
-      1456, /* GL_STENCIL_BACK_FUNC */
-      1454, /* GL_STENCIL_BACK_FAIL */
-      1458, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
-      1460, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
-       504, /* GL_FRAGMENT_PROGRAM_ARB */
-      1202, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
-      1230, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
-      1229, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
-      1214, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-      1220, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-      1219, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-       871, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
-       894, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
-       893, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
-       884, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-       890, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-       889, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-       854, /* GL_MAX_DRAW_BUFFERS */
-       374, /* GL_DRAW_BUFFER0 */
-       377, /* GL_DRAW_BUFFER1 */
-       398, /* GL_DRAW_BUFFER2 */
-       401, /* GL_DRAW_BUFFER3 */
-       404, /* GL_DRAW_BUFFER4 */
-       407, /* GL_DRAW_BUFFER5 */
-       410, /* GL_DRAW_BUFFER6 */
-       413, /* GL_DRAW_BUFFER7 */
-       416, /* GL_DRAW_BUFFER8 */
-       419, /* GL_DRAW_BUFFER9 */
-       378, /* GL_DRAW_BUFFER10 */
-       381, /* GL_DRAW_BUFFER11 */
-       384, /* GL_DRAW_BUFFER12 */
-       387, /* GL_DRAW_BUFFER13 */
-       390, /* GL_DRAW_BUFFER14 */
-       393, /* GL_DRAW_BUFFER15 */
+       112, /* GL_BUMP_ROT_MATRIX_ATI */
+       113, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */
+       111, /* GL_BUMP_NUM_TEX_UNITS_ATI */
+       115, /* GL_BUMP_TEX_UNITS_ATI */
+       435, /* GL_DUDV_ATI */
+       434, /* GL_DU8DV8_ATI */
+       110, /* GL_BUMP_ENVMAP_ATI */
+       114, /* GL_BUMP_TARGET_ATI */
+      1464, /* GL_STENCIL_BACK_FUNC */
+      1462, /* GL_STENCIL_BACK_FAIL */
+      1466, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+      1468, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+       512, /* GL_FRAGMENT_PROGRAM_ARB */
+      1210, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+      1238, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+      1237, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+      1222, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+      1228, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+      1227, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+       879, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+       902, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+       901, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+       892, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+       898, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+       897, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+       862, /* GL_MAX_DRAW_BUFFERS */
+       380, /* GL_DRAW_BUFFER0 */
+       383, /* GL_DRAW_BUFFER1 */
+       404, /* GL_DRAW_BUFFER2 */
+       407, /* GL_DRAW_BUFFER3 */
+       410, /* GL_DRAW_BUFFER4 */
+       413, /* GL_DRAW_BUFFER5 */
+       416, /* GL_DRAW_BUFFER6 */
+       419, /* GL_DRAW_BUFFER7 */
+       422, /* GL_DRAW_BUFFER8 */
+       425, /* GL_DRAW_BUFFER9 */
+       384, /* GL_DRAW_BUFFER10 */
+       387, /* GL_DRAW_BUFFER11 */
+       390, /* GL_DRAW_BUFFER12 */
+       393, /* GL_DRAW_BUFFER13 */
+       396, /* GL_DRAW_BUFFER14 */
+       399, /* GL_DRAW_BUFFER15 */
         81, /* GL_BLEND_EQUATION_ALPHA */
-       834, /* GL_MATRIX_PALETTE_ARB */
-       865, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
-       868, /* GL_MAX_PALETTE_MATRICES_ARB */
-       304, /* GL_CURRENT_PALETTE_MATRIX_ARB */
-       828, /* GL_MATRIX_INDEX_ARRAY_ARB */
-       299, /* GL_CURRENT_MATRIX_INDEX_ARB */
-       830, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
-       832, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
-       831, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
-       829, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
-      1634, /* GL_TEXTURE_DEPTH_SIZE */
-       358, /* GL_DEPTH_TEXTURE_MODE */
-      1600, /* GL_TEXTURE_COMPARE_MODE */
-      1598, /* GL_TEXTURE_COMPARE_FUNC */
-       232, /* GL_COMPARE_R_TO_TEXTURE */
-      1136, /* GL_POINT_SPRITE */
-       281, /* GL_COORD_REPLACE */
-      1140, /* GL_POINT_SPRITE_R_MODE_NV */
-      1257, /* GL_QUERY_COUNTER_BITS */
-       306, /* GL_CURRENT_QUERY */
-      1259, /* GL_QUERY_RESULT */
-      1261, /* GL_QUERY_RESULT_AVAILABLE */
-       916, /* GL_MAX_VERTEX_ATTRIBS */
-      1768, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
-       356, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
-       355, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
-       902, /* GL_MAX_TEXTURE_COORDS */
-       904, /* GL_MAX_TEXTURE_IMAGE_UNITS */
-      1207, /* GL_PROGRAM_ERROR_STRING_ARB */
-      1209, /* GL_PROGRAM_FORMAT_ASCII_ARB */
-      1208, /* GL_PROGRAM_FORMAT_ARB */
-      1680, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
-       335, /* GL_DEPTH_BOUNDS_TEST_EXT */
-       334, /* GL_DEPTH_BOUNDS_EXT */
+       842, /* GL_MATRIX_PALETTE_ARB */
+       873, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+       876, /* GL_MAX_PALETTE_MATRICES_ARB */
+       310, /* GL_CURRENT_PALETTE_MATRIX_ARB */
+       836, /* GL_MATRIX_INDEX_ARRAY_ARB */
+       305, /* GL_CURRENT_MATRIX_INDEX_ARB */
+       838, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+       840, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+       839, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+       837, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+      1642, /* GL_TEXTURE_DEPTH_SIZE */
+       364, /* GL_DEPTH_TEXTURE_MODE */
+      1608, /* GL_TEXTURE_COMPARE_MODE */
+      1606, /* GL_TEXTURE_COMPARE_FUNC */
+       238, /* GL_COMPARE_R_TO_TEXTURE */
+      1144, /* GL_POINT_SPRITE */
+       287, /* GL_COORD_REPLACE */
+      1148, /* GL_POINT_SPRITE_R_MODE_NV */
+      1265, /* GL_QUERY_COUNTER_BITS */
+       312, /* GL_CURRENT_QUERY */
+      1267, /* GL_QUERY_RESULT */
+      1269, /* GL_QUERY_RESULT_AVAILABLE */
+       924, /* GL_MAX_VERTEX_ATTRIBS */
+      1776, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+       362, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
+       361, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
+       910, /* GL_MAX_TEXTURE_COORDS */
+       912, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+      1215, /* GL_PROGRAM_ERROR_STRING_ARB */
+      1217, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+      1216, /* GL_PROGRAM_FORMAT_ARB */
+      1688, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+       341, /* GL_DEPTH_BOUNDS_TEST_EXT */
+       340, /* GL_DEPTH_BOUNDS_EXT */
         52, /* GL_ARRAY_BUFFER */
-       440, /* GL_ELEMENT_ARRAY_BUFFER */
+       448, /* GL_ELEMENT_ARRAY_BUFFER */
         53, /* GL_ARRAY_BUFFER_BINDING */
-       441, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
-      1742, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
-      1003, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
-       139, /* GL_COLOR_ARRAY_BUFFER_BINDING */
-       620, /* GL_INDEX_ARRAY_BUFFER_BINDING */
-      1613, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
-       436, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
-      1378, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
-       482, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
-      1794, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
-      1764, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
-      1210, /* GL_PROGRAM_INSTRUCTIONS_ARB */
-       877, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
-      1216, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-       886, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-      1228, /* GL_PROGRAM_TEMPORARIES_ARB */
-       892, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
-      1218, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
-       888, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
-      1222, /* GL_PROGRAM_PARAMETERS_ARB */
-       891, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
-      1217, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
-       887, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
-      1203, /* GL_PROGRAM_ATTRIBS_ARB */
-       872, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
-      1215, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
-       885, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
-      1201, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
-       870, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
-      1213, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-       883, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-       878, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
-       874, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
-      1231, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
-      1691, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
-      1270, /* GL_READ_ONLY */
-      1802, /* GL_WRITE_ONLY */
-      1272, /* GL_READ_WRITE */
+       449, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
+      1750, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+      1011, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+       145, /* GL_COLOR_ARRAY_BUFFER_BINDING */
+       628, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+      1621, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+       444, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
+      1386, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+       490, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
+      1802, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+      1772, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+      1218, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+       885, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+      1224, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+       894, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+      1236, /* GL_PROGRAM_TEMPORARIES_ARB */
+       900, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+      1226, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+       896, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+      1230, /* GL_PROGRAM_PARAMETERS_ARB */
+       899, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+      1225, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+       895, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+      1211, /* GL_PROGRAM_ATTRIBS_ARB */
+       880, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+      1223, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+       893, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+      1209, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+       878, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+      1221, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+       891, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+       886, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+       882, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+      1239, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+      1699, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+      1278, /* GL_READ_ONLY */
+      1810, /* GL_WRITE_ONLY */
+      1280, /* GL_READ_WRITE */
        100, /* GL_BUFFER_ACCESS */
        102, /* GL_BUFFER_MAPPED */
        104, /* GL_BUFFER_MAP_POINTER */
-      1685, /* GL_TIME_ELAPSED_EXT */
-       788, /* GL_MATRIX0_ARB */
-       800, /* GL_MATRIX1_ARB */
-       812, /* GL_MATRIX2_ARB */
-       816, /* GL_MATRIX3_ARB */
-       818, /* GL_MATRIX4_ARB */
-       820, /* GL_MATRIX5_ARB */
-       822, /* GL_MATRIX6_ARB */
-       824, /* GL_MATRIX7_ARB */
-       826, /* GL_MATRIX8_ARB */
-       827, /* GL_MATRIX9_ARB */
-       790, /* GL_MATRIX10_ARB */
-       791, /* GL_MATRIX11_ARB */
-       792, /* GL_MATRIX12_ARB */
-       793, /* GL_MATRIX13_ARB */
-       794, /* GL_MATRIX14_ARB */
-       795, /* GL_MATRIX15_ARB */
-       796, /* GL_MATRIX16_ARB */
-       797, /* GL_MATRIX17_ARB */
-       798, /* GL_MATRIX18_ARB */
-       799, /* GL_MATRIX19_ARB */
-       802, /* GL_MATRIX20_ARB */
-       803, /* GL_MATRIX21_ARB */
-       804, /* GL_MATRIX22_ARB */
-       805, /* GL_MATRIX23_ARB */
-       806, /* GL_MATRIX24_ARB */
-       807, /* GL_MATRIX25_ARB */
-       808, /* GL_MATRIX26_ARB */
-       809, /* GL_MATRIX27_ARB */
-       810, /* GL_MATRIX28_ARB */
-       811, /* GL_MATRIX29_ARB */
-       814, /* GL_MATRIX30_ARB */
-       815, /* GL_MATRIX31_ARB */
-      1486, /* GL_STREAM_DRAW */
-      1488, /* GL_STREAM_READ */
-      1484, /* GL_STREAM_COPY */
-      1447, /* GL_STATIC_DRAW */
-      1449, /* GL_STATIC_READ */
-      1445, /* GL_STATIC_COPY */
-       430, /* GL_DYNAMIC_DRAW */
-       432, /* GL_DYNAMIC_READ */
-       428, /* GL_DYNAMIC_COPY */
-       575, /* GL_GL_PIXEL_PACK_BUFFER */
-       577, /* GL_GL_PIXEL_UNPACK_BUFFER */
-       576, /* GL_GL_PIXEL_PACK_BUFFER_BINDING */
-       578, /* GL_GL_PIXEL_UNPACK_BUFFER_BINDING */
-       329, /* GL_DEPTH24_STENCIL8 */
-      1678, /* GL_TEXTURE_STENCIL_SIZE */
-       875, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
-       873, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
-       876, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
-       880, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
-       879, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
-       837, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
-      1480, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+      1693, /* GL_TIME_ELAPSED_EXT */
+       796, /* GL_MATRIX0_ARB */
+       808, /* GL_MATRIX1_ARB */
+       820, /* GL_MATRIX2_ARB */
+       824, /* GL_MATRIX3_ARB */
+       826, /* GL_MATRIX4_ARB */
+       828, /* GL_MATRIX5_ARB */
+       830, /* GL_MATRIX6_ARB */
+       832, /* GL_MATRIX7_ARB */
+       834, /* GL_MATRIX8_ARB */
+       835, /* GL_MATRIX9_ARB */
+       798, /* GL_MATRIX10_ARB */
+       799, /* GL_MATRIX11_ARB */
+       800, /* GL_MATRIX12_ARB */
+       801, /* GL_MATRIX13_ARB */
+       802, /* GL_MATRIX14_ARB */
+       803, /* GL_MATRIX15_ARB */
+       804, /* GL_MATRIX16_ARB */
+       805, /* GL_MATRIX17_ARB */
+       806, /* GL_MATRIX18_ARB */
+       807, /* GL_MATRIX19_ARB */
+       810, /* GL_MATRIX20_ARB */
+       811, /* GL_MATRIX21_ARB */
+       812, /* GL_MATRIX22_ARB */
+       813, /* GL_MATRIX23_ARB */
+       814, /* GL_MATRIX24_ARB */
+       815, /* GL_MATRIX25_ARB */
+       816, /* GL_MATRIX26_ARB */
+       817, /* GL_MATRIX27_ARB */
+       818, /* GL_MATRIX28_ARB */
+       819, /* GL_MATRIX29_ARB */
+       822, /* GL_MATRIX30_ARB */
+       823, /* GL_MATRIX31_ARB */
+      1494, /* GL_STREAM_DRAW */
+      1496, /* GL_STREAM_READ */
+      1492, /* GL_STREAM_COPY */
+      1455, /* GL_STATIC_DRAW */
+      1457, /* GL_STATIC_READ */
+      1453, /* GL_STATIC_COPY */
+       438, /* GL_DYNAMIC_DRAW */
+       440, /* GL_DYNAMIC_READ */
+       436, /* GL_DYNAMIC_COPY */
+       583, /* GL_GL_PIXEL_PACK_BUFFER */
+       585, /* GL_GL_PIXEL_UNPACK_BUFFER */
+       584, /* GL_GL_PIXEL_PACK_BUFFER_BINDING */
+       586, /* GL_GL_PIXEL_UNPACK_BUFFER_BINDING */
+       335, /* GL_DEPTH24_STENCIL8 */
+      1686, /* GL_TEXTURE_STENCIL_SIZE */
+       883, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
+       881, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+       884, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+       888, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+       887, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+       845, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+      1488, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
         17, /* GL_ACTIVE_STENCIL_FACE_EXT */
-       937, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
-      1359, /* GL_SAMPLES_PASSED */
-       505, /* GL_FRAGMENT_SHADER */
-      1788, /* GL_VERTEX_SHADER */
-      1221, /* GL_PROGRAM_OBJECT_ARB */
-      1391, /* GL_SHADER_OBJECT_ARB */
-       861, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
-       920, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
-       914, /* GL_MAX_VARYING_FLOATS */
-       918, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
-       846, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
-      1028, /* GL_OBJECT_TYPE_ARB */
-      1393, /* GL_SHADER_TYPE */
-       470, /* GL_FLOAT_VEC2 */
-       472, /* GL_FLOAT_VEC3 */
-       474, /* GL_FLOAT_VEC4 */
-       647, /* GL_INT_VEC2 */
-       649, /* GL_INT_VEC3 */
-       651, /* GL_INT_VEC4 */
+       945, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+      1367, /* GL_SAMPLES_PASSED */
+       513, /* GL_FRAGMENT_SHADER */
+      1796, /* GL_VERTEX_SHADER */
+      1229, /* GL_PROGRAM_OBJECT_ARB */
+      1399, /* GL_SHADER_OBJECT_ARB */
+       869, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+       928, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+       922, /* GL_MAX_VARYING_FLOATS */
+       926, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+       854, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+      1036, /* GL_OBJECT_TYPE_ARB */
+      1401, /* GL_SHADER_TYPE */
+       478, /* GL_FLOAT_VEC2 */
+       480, /* GL_FLOAT_VEC3 */
+       482, /* GL_FLOAT_VEC4 */
+       655, /* GL_INT_VEC2 */
+       657, /* GL_INT_VEC3 */
+       659, /* GL_INT_VEC4 */
         92, /* GL_BOOL */
         94, /* GL_BOOL_VEC2 */
         96, /* GL_BOOL_VEC3 */
         98, /* GL_BOOL_VEC4 */
-       464, /* GL_FLOAT_MAT2 */
-       466, /* GL_FLOAT_MAT3 */
-       468, /* GL_FLOAT_MAT4 */
-      1350, /* GL_SAMPLER_1D */
-      1352, /* GL_SAMPLER_2D */
-      1354, /* GL_SAMPLER_3D */
-      1355, /* GL_SAMPLER_CUBE */
-      1351, /* GL_SAMPLER_1D_SHADOW */
-      1353, /* GL_SAMPLER_2D_SHADOW */
-       569, /* GL_GL_FLOAT_MAT2x3 */
-       570, /* GL_GL_FLOAT_MAT2x4 */
-       571, /* GL_GL_FLOAT_MAT3x2 */
-       572, /* GL_GL_FLOAT_MAT3x4 */
-       573, /* GL_GL_FLOAT_MAT4x2 */
-       574, /* GL_GL_FLOAT_MAT4x3 */
-       327, /* GL_DELETE_STATUS */
-       236, /* GL_COMPILE_STATUS */
-       701, /* GL_LINK_STATUS */
-      1737, /* GL_VALIDATE_STATUS */
-       632, /* GL_INFO_LOG_LENGTH */
+       472, /* GL_FLOAT_MAT2 */
+       474, /* GL_FLOAT_MAT3 */
+       476, /* GL_FLOAT_MAT4 */
+      1358, /* GL_SAMPLER_1D */
+      1360, /* GL_SAMPLER_2D */
+      1362, /* GL_SAMPLER_3D */
+      1363, /* GL_SAMPLER_CUBE */
+      1359, /* GL_SAMPLER_1D_SHADOW */
+      1361, /* GL_SAMPLER_2D_SHADOW */
+       577, /* GL_GL_FLOAT_MAT2x3 */
+       578, /* GL_GL_FLOAT_MAT2x4 */
+       579, /* GL_GL_FLOAT_MAT3x2 */
+       580, /* GL_GL_FLOAT_MAT3x4 */
+       581, /* GL_GL_FLOAT_MAT4x2 */
+       582, /* GL_GL_FLOAT_MAT4x3 */
+       333, /* GL_DELETE_STATUS */
+       242, /* GL_COMPILE_STATUS */
+       709, /* GL_LINK_STATUS */
+      1745, /* GL_VALIDATE_STATUS */
+       640, /* GL_INFO_LOG_LENGTH */
         55, /* GL_ATTACHED_SHADERS */
         20, /* GL_ACTIVE_UNIFORMS */
         21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */
-      1392, /* GL_SHADER_SOURCE_LENGTH */
+      1400, /* GL_SHADER_SOURCE_LENGTH */
         15, /* GL_ACTIVE_ATTRIBUTES */
         16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */
-       507, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
-      1395, /* GL_SHADING_LANGUAGE_VERSION */
-       305, /* GL_CURRENT_PROGRAM */
-      1077, /* GL_PALETTE4_RGB8_OES */
-      1079, /* GL_PALETTE4_RGBA8_OES */
-      1075, /* GL_PALETTE4_R5_G6_B5_OES */
-      1078, /* GL_PALETTE4_RGBA4_OES */
-      1076, /* GL_PALETTE4_RGB5_A1_OES */
-      1082, /* GL_PALETTE8_RGB8_OES */
-      1084, /* GL_PALETTE8_RGBA8_OES */
-      1080, /* GL_PALETTE8_R5_G6_B5_OES */
-      1083, /* GL_PALETTE8_RGBA4_OES */
-      1081, /* GL_PALETTE8_RGB5_A1_OES */
-       614, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
-       613, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
-      1722, /* GL_UNSIGNED_NORMALIZED */
-      1568, /* GL_TEXTURE_1D_ARRAY_EXT */
-      1241, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
-      1570, /* GL_TEXTURE_2D_ARRAY_EXT */
-      1244, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
-      1576, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
-      1578, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
-       583, /* GL_GL_SRGB */
-       584, /* GL_GL_SRGB8 */
-       586, /* GL_GL_SRGB_ALPHA */
-       585, /* GL_GL_SRGB8_ALPHA8 */
-       582, /* GL_GL_SLUMINANCE_ALPHA */
-       581, /* GL_GL_SLUMINANCE8_ALPHA8 */
-       579, /* GL_GL_SLUMINANCE */
-       580, /* GL_GL_SLUMINANCE8 */
-       566, /* GL_GL_COMPRESSED_SRGB */
-       567, /* GL_GL_COMPRESSED_SRGB_ALPHA */
-       564, /* GL_GL_COMPRESSED_SLUMINANCE */
-       565, /* GL_GL_COMPRESSED_SLUMINANCE_ALPHA */
-      1138, /* GL_POINT_SPRITE_COORD_ORIGIN */
-       709, /* GL_LOWER_LEFT */
-      1734, /* GL_UPPER_LEFT */
-      1462, /* GL_STENCIL_BACK_REF */
-      1463, /* GL_STENCIL_BACK_VALUE_MASK */
-      1464, /* GL_STENCIL_BACK_WRITEMASK */
-       423, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
-      1286, /* GL_RENDERBUFFER_BINDING_EXT */
-      1267, /* GL_READ_FRAMEBUFFER */
-       422, /* GL_DRAW_FRAMEBUFFER */
-      1268, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
-      1296, /* GL_RENDERBUFFER_SAMPLES */
-       517, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
-       515, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
-       526, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
-       522, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
-       524, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
-       529, /* GL_FRAMEBUFFER_COMPLETE */
-       533, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
-       539, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
-       537, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
-       535, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
-       538, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
-       536, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
-       542, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
-       545, /* GL_FRAMEBUFFER_UNSUPPORTED */
-       543, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
-       843, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
-       145, /* GL_COLOR_ATTACHMENT0 */
-       147, /* GL_COLOR_ATTACHMENT1 */
-       161, /* GL_COLOR_ATTACHMENT2 */
-       163, /* GL_COLOR_ATTACHMENT3 */
-       165, /* GL_COLOR_ATTACHMENT4 */
-       167, /* GL_COLOR_ATTACHMENT5 */
-       169, /* GL_COLOR_ATTACHMENT6 */
-       171, /* GL_COLOR_ATTACHMENT7 */
-       173, /* GL_COLOR_ATTACHMENT8 */
-       175, /* GL_COLOR_ATTACHMENT9 */
-       148, /* GL_COLOR_ATTACHMENT10 */
-       150, /* GL_COLOR_ATTACHMENT11 */
-       152, /* GL_COLOR_ATTACHMENT12 */
-       154, /* GL_COLOR_ATTACHMENT13 */
-       156, /* GL_COLOR_ATTACHMENT14 */
-       158, /* GL_COLOR_ATTACHMENT15 */
-       330, /* GL_DEPTH_ATTACHMENT */
-      1452, /* GL_STENCIL_ATTACHMENT */
-       508, /* GL_FRAMEBUFFER */
-      1284, /* GL_RENDERBUFFER */
-      1298, /* GL_RENDERBUFFER_WIDTH */
-      1291, /* GL_RENDERBUFFER_HEIGHT */
-      1293, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
-      1475, /* GL_STENCIL_INDEX_EXT */
-      1472, /* GL_STENCIL_INDEX1_EXT */
-      1473, /* GL_STENCIL_INDEX4_EXT */
-      1474, /* GL_STENCIL_INDEX8_EXT */
-      1471, /* GL_STENCIL_INDEX16_EXT */
-      1295, /* GL_RENDERBUFFER_RED_SIZE */
-      1290, /* GL_RENDERBUFFER_GREEN_SIZE */
-      1287, /* GL_RENDERBUFFER_BLUE_SIZE */
-      1285, /* GL_RENDERBUFFER_ALPHA_SIZE */
-      1288, /* GL_RENDERBUFFER_DEPTH_SIZE */
-      1297, /* GL_RENDERBUFFER_STENCIL_SIZE */
-       541, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
-       899, /* GL_MAX_SAMPLES */
-       447, /* GL_EVAL_BIT */
-      1265, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
-       703, /* GL_LIST_BIT */
-      1584, /* GL_TEXTURE_BIT */
-      1374, /* GL_SCISSOR_BIT */
+       515, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
+      1403, /* GL_SHADING_LANGUAGE_VERSION */
+       311, /* GL_CURRENT_PROGRAM */
+      1085, /* GL_PALETTE4_RGB8_OES */
+      1087, /* GL_PALETTE4_RGBA8_OES */
+      1083, /* GL_PALETTE4_R5_G6_B5_OES */
+      1086, /* GL_PALETTE4_RGBA4_OES */
+      1084, /* GL_PALETTE4_RGB5_A1_OES */
+      1090, /* GL_PALETTE8_RGB8_OES */
+      1092, /* GL_PALETTE8_RGBA8_OES */
+      1088, /* GL_PALETTE8_R5_G6_B5_OES */
+      1091, /* GL_PALETTE8_RGBA4_OES */
+      1089, /* GL_PALETTE8_RGB5_A1_OES */
+       622, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
+       621, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+      1730, /* GL_UNSIGNED_NORMALIZED */
+      1576, /* GL_TEXTURE_1D_ARRAY_EXT */
+      1249, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+      1578, /* GL_TEXTURE_2D_ARRAY_EXT */
+      1252, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+      1584, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+      1586, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+       591, /* GL_GL_SRGB */
+       592, /* GL_GL_SRGB8 */
+       594, /* GL_GL_SRGB_ALPHA */
+       593, /* GL_GL_SRGB8_ALPHA8 */
+       590, /* GL_GL_SLUMINANCE_ALPHA */
+       589, /* GL_GL_SLUMINANCE8_ALPHA8 */
+       587, /* GL_GL_SLUMINANCE */
+       588, /* GL_GL_SLUMINANCE8 */
+       574, /* GL_GL_COMPRESSED_SRGB */
+       575, /* GL_GL_COMPRESSED_SRGB_ALPHA */
+       572, /* GL_GL_COMPRESSED_SLUMINANCE */
+       573, /* GL_GL_COMPRESSED_SLUMINANCE_ALPHA */
+      1146, /* GL_POINT_SPRITE_COORD_ORIGIN */
+       717, /* GL_LOWER_LEFT */
+      1742, /* GL_UPPER_LEFT */
+      1470, /* GL_STENCIL_BACK_REF */
+      1471, /* GL_STENCIL_BACK_VALUE_MASK */
+      1472, /* GL_STENCIL_BACK_WRITEMASK */
+       429, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
+      1294, /* GL_RENDERBUFFER_BINDING_EXT */
+      1275, /* GL_READ_FRAMEBUFFER */
+       428, /* GL_DRAW_FRAMEBUFFER */
+      1276, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
+      1304, /* GL_RENDERBUFFER_SAMPLES */
+       525, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+       523, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+       534, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+       530, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+       532, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+       537, /* GL_FRAMEBUFFER_COMPLETE */
+       541, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+       547, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+       545, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
+       543, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
+       546, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
+       544, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
+       550, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
+       553, /* GL_FRAMEBUFFER_UNSUPPORTED */
+       551, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
+       851, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
+       151, /* GL_COLOR_ATTACHMENT0 */
+       153, /* GL_COLOR_ATTACHMENT1 */
+       167, /* GL_COLOR_ATTACHMENT2 */
+       169, /* GL_COLOR_ATTACHMENT3 */
+       171, /* GL_COLOR_ATTACHMENT4 */
+       173, /* GL_COLOR_ATTACHMENT5 */
+       175, /* GL_COLOR_ATTACHMENT6 */
+       177, /* GL_COLOR_ATTACHMENT7 */
+       179, /* GL_COLOR_ATTACHMENT8 */
+       181, /* GL_COLOR_ATTACHMENT9 */
+       154, /* GL_COLOR_ATTACHMENT10 */
+       156, /* GL_COLOR_ATTACHMENT11 */
+       158, /* GL_COLOR_ATTACHMENT12 */
+       160, /* GL_COLOR_ATTACHMENT13 */
+       162, /* GL_COLOR_ATTACHMENT14 */
+       164, /* GL_COLOR_ATTACHMENT15 */
+       336, /* GL_DEPTH_ATTACHMENT */
+      1460, /* GL_STENCIL_ATTACHMENT */
+       516, /* GL_FRAMEBUFFER */
+      1292, /* GL_RENDERBUFFER */
+      1306, /* GL_RENDERBUFFER_WIDTH */
+      1299, /* GL_RENDERBUFFER_HEIGHT */
+      1301, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+      1483, /* GL_STENCIL_INDEX_EXT */
+      1480, /* GL_STENCIL_INDEX1_EXT */
+      1481, /* GL_STENCIL_INDEX4_EXT */
+      1482, /* GL_STENCIL_INDEX8_EXT */
+      1479, /* GL_STENCIL_INDEX16_EXT */
+      1303, /* GL_RENDERBUFFER_RED_SIZE */
+      1298, /* GL_RENDERBUFFER_GREEN_SIZE */
+      1295, /* GL_RENDERBUFFER_BLUE_SIZE */
+      1293, /* GL_RENDERBUFFER_ALPHA_SIZE */
+      1296, /* GL_RENDERBUFFER_DEPTH_SIZE */
+      1305, /* GL_RENDERBUFFER_STENCIL_SIZE */
+       549, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+       907, /* GL_MAX_SAMPLES */
+       455, /* GL_EVAL_BIT */
+      1273, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+       711, /* GL_LIST_BIT */
+      1592, /* GL_TEXTURE_BIT */
+      1382, /* GL_SCISSOR_BIT */
         29, /* GL_ALL_ATTRIB_BITS */
-       984, /* GL_MULTISAMPLE_BIT */
+       992, /* GL_MULTISAMPLE_BIT */
         30, /* GL_ALL_CLIENT_ATTRIB_BITS */
 };
 
-#define Elements(x) sizeof(x)/sizeof(*x)
-
 typedef int (*cfunc)(const void *, const void *);
 
 /**
index f95c31862a5e2510659098f67e3b083409af08d8..57c1e117c89063d95cd6222847b86276e9c46892 100644 (file)
@@ -24,7 +24,7 @@
 
 
 /**
- * \file exemem.c
+ * \file execmem.c
  * Functions for allocating executable memory.
  *
  * \author Keith Whitwell
@@ -36,7 +36,7 @@
 
 
 
-#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__)
+#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun)
 
 /*
  * Allocate a large block of memory which can hold code then dole it out
index 1b31e283cd343eff50ce577408d7723051cae38a..2d2bf517843152cdeeb34de3c0d85a6f929363a5 100644 (file)
@@ -137,6 +137,7 @@ static const struct {
    { ON,  "GL_APPLE_packed_pixels",            F(APPLE_packed_pixels) },
    { OFF, "GL_APPLE_vertex_array_object",      F(APPLE_vertex_array_object) },
    { 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)},
@@ -147,7 +148,6 @@ static const struct {
    { OFF, "GL_INGR_blend_func_separate",       F(EXT_blend_func_separate) },
    { OFF, "GL_MESA_pack_invert",               F(MESA_pack_invert) },
    { OFF, "GL_MESA_packed_depth_stencil",      F(MESA_packed_depth_stencil) },
-   { OFF, "GL_MESA_program_debug",             F(MESA_program_debug) },
    { OFF, "GL_MESA_resize_buffers",            F(MESA_resize_buffers) },
    { OFF, "GL_MESA_texture_array",             F(MESA_texture_array) },
    { OFF, "GL_MESA_ycbcr_texture",             F(MESA_ycbcr_texture) },
@@ -208,7 +208,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
    ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
 #endif
 #if FEATURE_ARB_shading_language_120
-   ctx->Extensions.ARB_shading_language_120 = GL_FALSE; /* not quite done */
+   ctx->Extensions.ARB_shading_language_120 = GL_TRUE;
 #endif
    ctx->Extensions.ARB_shadow = GL_TRUE;
    ctx->Extensions.ARB_shadow_ambient = GL_TRUE;
@@ -230,6 +230,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
    /*ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;*/
 #endif
    ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
+   ctx->Extensions.ATI_envmap_bumpmap = GL_TRUE;
 #if FEATURE_ATI_fragment_shader
    ctx->Extensions.ATI_fragment_shader = GL_TRUE;
 #endif
@@ -276,9 +277,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
    ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE;
    /*ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE;*/
    ctx->Extensions.MESA_pack_invert = GL_TRUE;
-#if FEATURE_MESA_program_debug
-   ctx->Extensions.MESA_program_debug = GL_TRUE;
-#endif
    ctx->Extensions.MESA_resize_buffers = GL_TRUE;
    ctx->Extensions.MESA_texture_array = GL_TRUE;
    ctx->Extensions.MESA_ycbcr_texture = GL_TRUE;
@@ -433,7 +431,7 @@ _mesa_enable_2_1_extensions(GLcontext *ctx)
    ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
 #endif
 #ifdef FEATURE_ARB_shading_language_120
-   ctx->Extensions.ARB_shading_language_120 = GL_FALSE; /* not quite done */
+   ctx->Extensions.ARB_shading_language_120 = GL_TRUE;
 #endif
 }
 
index c3cdc110379c5a882a03b7d34f1c45fcc31ff454..151e29053ab5be66d8197fa6ea95a174c802ee15 100644 (file)
@@ -302,6 +302,20 @@ _mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
 }
 
 
+/**
+ * For debug only.
+ */
+static void
+att_incomplete(const char *msg)
+{
+#if 0
+   _mesa_printf("attachment incomplete: %s\n", msg);
+#else
+   (void) msg;
+#endif
+}
+
+
 /**
  * Test if an attachment point is complete and update its Complete field.
  * \param format if GL_COLOR, this is a color attachment point,
@@ -323,20 +337,26 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
       struct gl_texture_image *texImage;
 
       if (!texObj) {
+         att_incomplete("no texobj");
          att->Complete = GL_FALSE;
          return;
       }
 
       texImage = texObj->Image[att->CubeMapFace][att->TextureLevel];
       if (!texImage) {
+         att_incomplete("no teximage");
          att->Complete = GL_FALSE;
          return;
       }
       if (texImage->Width < 1 || texImage->Height < 1) {
+         att_incomplete("teximage width/height=0");
+         _mesa_printf("texobj = %u\n", texObj->Name);
+         _mesa_printf("level = %d\n", att->TextureLevel);
          att->Complete = GL_FALSE;
          return;
       }
       if (texObj->Target == GL_TEXTURE_3D && att->Zoffset >= texImage->Depth) {
+         att_incomplete("bad z offset");
          att->Complete = GL_FALSE;
          return;
       }
@@ -344,6 +364,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
       if (format == GL_COLOR) {
          if (texImage->TexFormat->BaseFormat != GL_RGB &&
              texImage->TexFormat->BaseFormat != GL_RGBA) {
+            att_incomplete("bad format");
             att->Complete = GL_FALSE;
             return;
          }
@@ -358,11 +379,13 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
          }
          else {
             att->Complete = GL_FALSE;
+            att_incomplete("bad depth format");
             return;
          }
       }
       else {
          /* no such thing as stencil textures */
+         att_incomplete("illegal stencil texture");
          att->Complete = GL_FALSE;
          return;
       }
@@ -372,6 +395,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
       if (!att->Renderbuffer->InternalFormat ||
           att->Renderbuffer->Width < 1 ||
           att->Renderbuffer->Height < 1) {
+         att_incomplete("0x0 renderbuffer");
          att->Complete = GL_FALSE;
          return;
       }
@@ -381,6 +405,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
             ASSERT(att->Renderbuffer->RedBits);
             ASSERT(att->Renderbuffer->GreenBits);
             ASSERT(att->Renderbuffer->BlueBits);
+            att_incomplete("bad renderbuffer color format");
             att->Complete = GL_FALSE;
             return;
          }
@@ -395,6 +420,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
             /* OK */
          }
          else {
+            att_incomplete("bad renderbuffer depth format");
             att->Complete = GL_FALSE;
             return;
          }
@@ -411,6 +437,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
          }
          else {
             att->Complete = GL_FALSE;
+            att_incomplete("bad renderbuffer stencil format");
             return;
          }
       }
@@ -1202,19 +1229,26 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
    ASSERT(newFb != &DummyFramebuffer);
 
    /*
-    * XXX check if re-binding same buffer and skip some of this code.
+    * OK, now bind the new Draw/Read framebuffers, if they're changing.
     */
 
    if (bindReadBuf) {
-      _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread);
+      if (ctx->ReadBuffer == newFbread)
+         bindReadBuf = GL_FALSE; /* no change */
+      else
+         _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread);
    }
 
    if (bindDrawBuf) {
       /* check if old FB had any texture attachments */
-      check_end_texture_render(ctx, ctx->DrawBuffer);
+      if (ctx->DrawBuffer->Name != 0) {
+         check_end_texture_render(ctx, ctx->DrawBuffer);
+      }
 
-      /* check if time to delete this framebuffer */
-      _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb);
+      if (ctx->DrawBuffer == newFb)
+         bindDrawBuf = GL_FALSE; /* no change */
+      else
+         _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb);
 
       if (newFb->Name != 0) {
          /* check if newly bound framebuffer has any texture attachments */
@@ -1222,7 +1256,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
       }
    }
 
-   if (ctx->Driver.BindFramebuffer) {
+   if ((bindDrawBuf || bindReadBuf) && ctx->Driver.BindFramebuffer) {
       ctx->Driver.BindFramebuffer(ctx, target, newFb, newFbread);
    }
 }
index 33d16cc5a03d2e3972f3b05c4a9a687386674744..54093940733450f3fb4c1c2b88667af575ab7263 100644 (file)
@@ -83,7 +83,7 @@ extern void GLAPIENTRY
 _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalformat,
                              GLsizei width, GLsizei height);
 
-void GLAPIENTRY
+extern void GLAPIENTRY
 _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples,
                                      GLenum internalformat,
                                      GLsizei width, GLsizei height);
index 48c2ccbff30c1965dcbad186d21fe8afe965e951..818a804540703de8dd26075f0a3dd09002c22fca 100644 (file)
@@ -1,13 +1,9 @@
-/**
- * \file feedback.c
- * Selection and feedback modes functions.
- */
-
 /*
  * Mesa 3-D graphics library
- * Version:  5.1
+ * Version:  7.5
  *
- * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 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"),
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+/**
+ * \file feedback.c
+ * Selection and feedback modes functions.
+ */
+
 
 #include "glheader.h"
 #include "colormac.h"
@@ -110,60 +111,49 @@ _mesa_PassThrough( GLfloat token )
 
    if (ctx->RenderMode==GL_FEEDBACK) {
       FLUSH_VERTICES(ctx, 0);
-      FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN );
-      FEEDBACK_TOKEN( ctx, token );
+      _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN );
+      _mesa_feedback_token( ctx, token );
    }
 }
 
 
-
-/*
+/**
  * Put a vertex into the feedback buffer.
  */
-void _mesa_feedback_vertex( GLcontext *ctx,
-                            const GLfloat win[4],
-                            const GLfloat color[4],
-                            GLfloat index,
-                            const GLfloat texcoord[4] )
+void
+_mesa_feedback_vertex(GLcontext *ctx,
+                      const GLfloat win[4],
+                      const GLfloat color[4],
+                      GLfloat index,
+                      const GLfloat texcoord[4])
 {
-#if 0
-   {
-      /* snap window x, y to fractional pixel position */
-      const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1);
-      GLfixed x, y;
-      x = FloatToFixed(win[0]) & snapMask;
-      y = FloatToFixed(win[1]) & snapMask;
-      FEEDBACK_TOKEN(ctx, FixedToFloat(x));
-      FEEDBACK_TOKEN(ctx, FixedToFloat(y) );
-   }
-#else
-   FEEDBACK_TOKEN( ctx, win[0] );
-   FEEDBACK_TOKEN( ctx, win[1] );
-#endif
+   _mesa_feedback_token( ctx, win[0] );
+   _mesa_feedback_token( ctx, win[1] );
    if (ctx->Feedback._Mask & FB_3D) {
-      FEEDBACK_TOKEN( ctx, win[2] );
+      _mesa_feedback_token( ctx, win[2] );
    }
    if (ctx->Feedback._Mask & FB_4D) {
-      FEEDBACK_TOKEN( ctx, win[3] );
+      _mesa_feedback_token( ctx, win[3] );
    }
    if (ctx->Feedback._Mask & FB_INDEX) {
-      FEEDBACK_TOKEN( ctx, (GLfloat) index );
+      _mesa_feedback_token( ctx, (GLfloat) index );
    }
    if (ctx->Feedback._Mask & FB_COLOR) {
-      FEEDBACK_TOKEN( ctx, color[0] );
-      FEEDBACK_TOKEN( ctx, color[1] );
-      FEEDBACK_TOKEN( ctx, color[2] );
-      FEEDBACK_TOKEN( ctx, color[3] );
+      _mesa_feedback_token( ctx, color[0] );
+      _mesa_feedback_token( ctx, color[1] );
+      _mesa_feedback_token( ctx, color[2] );
+      _mesa_feedback_token( ctx, color[3] );
    }
    if (ctx->Feedback._Mask & FB_TEXTURE) {
-      FEEDBACK_TOKEN( ctx, texcoord[0] );
-      FEEDBACK_TOKEN( ctx, texcoord[1] );
-      FEEDBACK_TOKEN( ctx, texcoord[2] );
-      FEEDBACK_TOKEN( ctx, texcoord[3] );
+      _mesa_feedback_token( ctx, texcoord[0] );
+      _mesa_feedback_token( ctx, texcoord[1] );
+      _mesa_feedback_token( ctx, texcoord[2] );
+      _mesa_feedback_token( ctx, texcoord[3] );
    }
 }
 
-#endif
+
+#endif /* _HAVE_FULL_GL */
 
 
 /**********************************************************************/
@@ -207,17 +197,20 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer )
 /**
  * Write a value of a record into the selection buffer.
  * 
- * \param CTX GL context.
- * \param V value.
+ * \param ctx GL context.
+ * \param value value.
  *
  * Verifies there is free space in the buffer to write the value and
  * increments the pointer.
  */
-#define WRITE_RECORD( CTX, V )                                 \
-       if (CTX->Select.BufferCount < CTX->Select.BufferSize) { \
-          CTX->Select.Buffer[CTX->Select.BufferCount] = (V);   \
-       }                                                       \
-       CTX->Select.BufferCount++;
+static INLINE void
+write_record(GLcontext *ctx, GLuint value)
+{
+   if (ctx->Select.BufferCount < ctx->Select.BufferSize) {
+      ctx->Select.Buffer[ctx->Select.BufferCount] = value;
+   }
+   ctx->Select.BufferCount++;
+}
 
 
 /**
@@ -229,7 +222,8 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer )
  * Sets gl_selection::HitFlag and updates gl_selection::HitMinZ and
  * gl_selection::HitMaxZ.
  */
-void _mesa_update_hitflag( GLcontext *ctx, GLfloat z )
+void
+_mesa_update_hitflag(GLcontext *ctx, GLfloat z)
 {
    ctx->Select.HitFlag = GL_TRUE;
    if (z < ctx->Select.HitMinZ) {
@@ -252,7 +246,8 @@ void _mesa_update_hitflag( GLcontext *ctx, GLfloat z )
  *
  * \sa gl_selection.
  */
-static void write_hit_record( GLcontext *ctx )
+static void
+write_hit_record(GLcontext *ctx)
 {
    GLuint i;
    GLuint zmin, zmax, zscale = (~0u);
@@ -264,11 +259,11 @@ static void write_hit_record( GLcontext *ctx )
    zmin = (GLuint) ((GLfloat) zscale * ctx->Select.HitMinZ);
    zmax = (GLuint) ((GLfloat) zscale * ctx->Select.HitMaxZ);
 
-   WRITE_RECORD( ctx, ctx->Select.NameStackDepth );
-   WRITE_RECORD( ctx, zmin );
-   WRITE_RECORD( ctx, zmax );
+   write_record( ctx, ctx->Select.NameStackDepth );
+   write_record( ctx, zmin );
+   write_record( ctx, zmax );
    for (i = 0; i < ctx->Select.NameStackDepth; i++) {
-      WRITE_RECORD( ctx, ctx->Select.NameStack[i] );
+      write_record( ctx, ctx->Select.NameStack[i] );
    }
 
    ctx->Select.Hits++;
index 6c448ad631b560758520f16cb0111e1b17f0da11..72c2acd5eddf7e5476efd5cdc36bf1cc9e36b1c6 100644 (file)
@@ -1,13 +1,9 @@
-/**
- * \file feedback.h
- * Selection and feedback modes functions.
- */
-
 /*
  * Mesa 3-D graphics library
- * Version:  3.5
+ * Version:  7.5
  *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 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"),
@@ -27,7 +23,6 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-
 #ifndef FEEDBACK_H
 #define FEEDBACK_H
 
 #include "mtypes.h"
 
 
-#define FEEDBACK_TOKEN( CTX, T )                               \
-       if (CTX->Feedback.Count < CTX->Feedback.BufferSize) {   \
-          CTX->Feedback.Buffer[CTX->Feedback.Count] = (GLfloat) (T); \
-       }                                                       \
-       CTX->Feedback.Count++;
+extern void
+_mesa_init_feedback( GLcontext *ctx );
 
+extern void
+_mesa_feedback_vertex( GLcontext *ctx,
+                       const GLfloat win[4],
+                       const GLfloat color[4],
+                       GLfloat index,
+                       const GLfloat texcoord[4] );
 
-extern void _mesa_init_feedback( GLcontext * ctx );
 
-extern void _mesa_feedback_vertex( GLcontext *ctx,
-                                const GLfloat win[4],
-                                const GLfloat color[4],
-                               GLfloat index,
-                                const GLfloat texcoord[4] );
+static INLINE void
+_mesa_feedback_token( GLcontext *ctx, GLfloat token )
+{
+   if (ctx->Feedback.Count < ctx->Feedback.BufferSize) {
+      ctx->Feedback.Buffer[ctx->Feedback.Count] = token;
+   }
+   ctx->Feedback.Count++;
+}
 
 
-extern void _mesa_update_hitflag( GLcontext *ctx, GLfloat z );
+extern void
+_mesa_update_hitflag( GLcontext *ctx, GLfloat z );
 
 
 extern void GLAPIENTRY
index d70b78f2586a304e345f6775aaedf068cd82b14f..72b880e28eef55ecbe1caac6308544aa5f4f293d 100644 (file)
@@ -293,16 +293,16 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
       
         key->unit[i].texgen_mode0 = 
            translate_texgen( texUnit->TexGenEnabled & (1<<0),
-                             texUnit->GenModeS );
+                             texUnit->GenS.Mode );
         key->unit[i].texgen_mode1 = 
            translate_texgen( texUnit->TexGenEnabled & (1<<1),
-                             texUnit->GenModeT );
+                             texUnit->GenT.Mode );
         key->unit[i].texgen_mode2 = 
            translate_texgen( texUnit->TexGenEnabled & (1<<2),
-                             texUnit->GenModeR );
+                             texUnit->GenR.Mode );
         key->unit[i].texgen_mode3 = 
            translate_texgen( texUnit->TexGenEnabled & (1<<3),
-                             texUnit->GenModeQ );
+                             texUnit->GenQ.Mode );
       }
    }
 }
@@ -655,7 +655,6 @@ static void emit_op3fn(struct tnl_program *p,
 
    inst = &p->program->Base.Instructions[nr];
    inst->Opcode = (enum prog_opcode) op; 
-   inst->StringPos = 0;
    inst->Data = 0;
    
    emit_arg( &inst->SrcReg[0], src0 );
index 351bf6959af8b911bfd3bad565e864581bff6097..5a13c88a7ab473f1db58657fc2c067dc4ade842f 100644 (file)
@@ -116,6 +116,7 @@ _mesa_new_framebuffer(GLcontext *ctx, GLuint name)
       fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT;
       fb->_ColorReadBufferIndex = BUFFER_COLOR0;
       fb->Delete = _mesa_destroy_framebuffer;
+      _glthread_INIT_MUTEX(fb->Mutex);
    }
    return fb;
 }
@@ -251,22 +252,6 @@ _mesa_reference_framebuffer(struct gl_framebuffer **ptr,
 }
 
 
-/**
- * XXX this function is deprecated.
- * Undo/remove a reference to a framebuffer object.
- * Decrement the framebuffer object's reference count and delete it when
- * the refcount hits zero.
- * Note: we pass the address of a pointer and set it to NULL.
- */
-void
-_mesa_unreference_framebuffer(struct gl_framebuffer **fb)
-{
-   _mesa_reference_framebuffer(fb, NULL);
-}
-
-
-
-
 /**
  * Resize the given framebuffer's renderbuffers to the new width and height.
  * This should only be used for window-system framebuffers, not
index e9eeed28cb52dc133fa4ec66e41ed0f40794140a..45a4703ba993ed7c9f2c1dfdfada0e4064c03d32 100644 (file)
@@ -46,9 +46,6 @@ extern void
 _mesa_reference_framebuffer(struct gl_framebuffer **ptr,
                             struct gl_framebuffer *fb);
 
-extern void
-_mesa_unreference_framebuffer(struct gl_framebuffer **fb);
-
 extern void
 _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
                          GLuint width, GLuint height);
index 87a821b12dc32a85aa1db7bdde71252014d32b0d..0937fd053c575bfaf0ed4d9df34d8816ee91b475 100644 (file)
@@ -884,21 +884,21 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = _mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT);
          break;
       case GL_TEXTURE_BINDING_1D:
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name);
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name);
          break;
       case GL_TEXTURE_BINDING_2D:
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name);
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name);
          break;
       case GL_TEXTURE_BINDING_3D:
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name);
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name);
          break;
       case GL_TEXTURE_BINDING_1D_ARRAY_EXT:
          CHECK_EXT1(MESA_texture_array, "GetBooleanv");
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name);
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name);
          break;
       case GL_TEXTURE_BINDING_2D_ARRAY_EXT:
          CHECK_EXT1(MESA_texture_array, "GetBooleanv");
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name);
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name);
          break;
       case GL_TEXTURE_GEN_S:
          params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0);
@@ -1071,7 +1071,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          break;
       case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
          CHECK_EXT1(ARB_texture_cube_map, "GetBooleanv");
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name);
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name);
          break;
       case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
          CHECK_EXT1(ARB_texture_cube_map, "GetBooleanv");
@@ -1558,7 +1558,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          break;
       case GL_TEXTURE_BINDING_RECTANGLE_NV:
          CHECK_EXT1(NV_texture_rectangle, "GetBooleanv");
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name);
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name);
          break;
       case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
          CHECK_EXT1(NV_texture_rectangle, "GetBooleanv");
@@ -1715,22 +1715,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMin);
          params[1] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMax);
          break;
-      case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetBooleanv");
-         params[0] = ctx->FragmentProgram.CallbackEnabled;
-         break;
-      case GL_VERTEX_PROGRAM_CALLBACK_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetBooleanv");
-         params[0] = ctx->VertexProgram.CallbackEnabled;
-         break;
-      case GL_FRAGMENT_PROGRAM_POSITION_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetBooleanv");
-         params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.CurrentPosition);
-         break;
-      case GL_VERTEX_PROGRAM_POSITION_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetBooleanv");
-         params[0] = INT_TO_BOOLEAN(ctx->VertexProgram.CurrentPosition);
-         break;
       case GL_MAX_DRAW_BUFFERS_ARB:
          params[0] = INT_TO_BOOLEAN(ctx->Const.MaxDrawBuffers);
          break;
@@ -2710,21 +2694,21 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT));
          break;
       case GL_TEXTURE_BINDING_1D:
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name);
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name);
          break;
       case GL_TEXTURE_BINDING_2D:
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name);
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name);
          break;
       case GL_TEXTURE_BINDING_3D:
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name);
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name);
          break;
       case GL_TEXTURE_BINDING_1D_ARRAY_EXT:
          CHECK_EXT1(MESA_texture_array, "GetFloatv");
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name);
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name);
          break;
       case GL_TEXTURE_BINDING_2D_ARRAY_EXT:
          CHECK_EXT1(MESA_texture_array, "GetFloatv");
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name);
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name);
          break;
       case GL_TEXTURE_GEN_S:
          params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0));
@@ -2897,7 +2881,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          break;
       case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
          CHECK_EXT1(ARB_texture_cube_map, "GetFloatv");
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name);
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name);
          break;
       case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
          CHECK_EXT1(ARB_texture_cube_map, "GetFloatv");
@@ -3384,7 +3368,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          break;
       case GL_TEXTURE_BINDING_RECTANGLE_NV:
          CHECK_EXT1(NV_texture_rectangle, "GetFloatv");
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name);
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name);
          break;
       case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
          CHECK_EXT1(NV_texture_rectangle, "GetFloatv");
@@ -3541,22 +3525,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = ctx->Depth.BoundsMin;
          params[1] = ctx->Depth.BoundsMax;
          break;
-      case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetFloatv");
-         params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.CallbackEnabled);
-         break;
-      case GL_VERTEX_PROGRAM_CALLBACK_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetFloatv");
-         params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.CallbackEnabled);
-         break;
-      case GL_FRAGMENT_PROGRAM_POSITION_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetFloatv");
-         params[0] = (GLfloat)(ctx->FragmentProgram.CurrentPosition);
-         break;
-      case GL_VERTEX_PROGRAM_POSITION_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetFloatv");
-         params[0] = (GLfloat)(ctx->VertexProgram.CurrentPosition);
-         break;
       case GL_MAX_DRAW_BUFFERS_ARB:
          params[0] = (GLfloat)(ctx->Const.MaxDrawBuffers);
          break;
@@ -4536,21 +4504,21 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT));
          break;
       case GL_TEXTURE_BINDING_1D:
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name;
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name;
          break;
       case GL_TEXTURE_BINDING_2D:
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name;
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name;
          break;
       case GL_TEXTURE_BINDING_3D:
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name;
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name;
          break;
       case GL_TEXTURE_BINDING_1D_ARRAY_EXT:
          CHECK_EXT1(MESA_texture_array, "GetIntegerv");
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name;
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name;
          break;
       case GL_TEXTURE_BINDING_2D_ARRAY_EXT:
          CHECK_EXT1(MESA_texture_array, "GetIntegerv");
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name;
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name;
          break;
       case GL_TEXTURE_GEN_S:
          params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0));
@@ -4723,7 +4691,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          break;
       case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
          CHECK_EXT1(ARB_texture_cube_map, "GetIntegerv");
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name;
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name;
          break;
       case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
          CHECK_EXT1(ARB_texture_cube_map, "GetIntegerv");
@@ -5210,7 +5178,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          break;
       case GL_TEXTURE_BINDING_RECTANGLE_NV:
          CHECK_EXT1(NV_texture_rectangle, "GetIntegerv");
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name;
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name;
          break;
       case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
          CHECK_EXT1(NV_texture_rectangle, "GetIntegerv");
@@ -5367,22 +5335,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = IROUND(ctx->Depth.BoundsMin);
          params[1] = IROUND(ctx->Depth.BoundsMax);
          break;
-      case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetIntegerv");
-         params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.CallbackEnabled);
-         break;
-      case GL_VERTEX_PROGRAM_CALLBACK_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetIntegerv");
-         params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.CallbackEnabled);
-         break;
-      case GL_FRAGMENT_PROGRAM_POSITION_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetIntegerv");
-         params[0] = ctx->FragmentProgram.CurrentPosition;
-         break;
-      case GL_VERTEX_PROGRAM_POSITION_MESA:
-         CHECK_EXT1(MESA_program_debug, "GetIntegerv");
-         params[0] = ctx->VertexProgram.CurrentPosition;
-         break;
       case GL_MAX_DRAW_BUFFERS_ARB:
          params[0] = ctx->Const.MaxDrawBuffers;
          break;
index 3b2496c663ebe6b88d042f4eca197d24c4fb5a98..fa695c48f1ac5b06dbe897ebe751310b5d351e08 100644 (file)
@@ -432,15 +432,15 @@ StateVars = [
        ( "GL_TEXTURE_1D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)"], "", ["MESA_texture_array"] ),
        ( "GL_TEXTURE_2D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)"], "", ["MESA_texture_array"] ),
        ( "GL_TEXTURE_BINDING_1D", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name"], "", None ),
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name"], "", None ),
        ( "GL_TEXTURE_BINDING_2D", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name"], "", None ),
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name"], "", None ),
        ( "GL_TEXTURE_BINDING_3D", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name"], "", None ),
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name"], "", None ),
        ( "GL_TEXTURE_BINDING_1D_ARRAY_EXT", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name"], "", ["MESA_texture_array"] ),
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name"], "", ["MESA_texture_array"] ),
        ( "GL_TEXTURE_BINDING_2D_ARRAY_EXT", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name"], "", ["MESA_texture_array"] ),
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name"], "", ["MESA_texture_array"] ),
        ( "GL_TEXTURE_GEN_S", GLboolean,
          ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None ),
        ( "GL_TEXTURE_GEN_T", GLboolean,
@@ -515,7 +515,7 @@ StateVars = [
        ( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean,
          ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", ["ARB_texture_cube_map"] ),
        ( "GL_TEXTURE_BINDING_CUBE_MAP_ARB", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name"],
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name"],
          "", ["ARB_texture_cube_map"] ),
        ( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", GLint,
          ["(1 << (ctx->Const.MaxCubeTextureLevels - 1))"],
@@ -795,7 +795,7 @@ StateVars = [
        ( "GL_TEXTURE_RECTANGLE_NV", GLboolean,
          ["_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)"], "", ["NV_texture_rectangle"] ),
        ( "GL_TEXTURE_BINDING_RECTANGLE_NV", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name"],
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name"],
          "", ["NV_texture_rectangle"] ),
        ( "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", GLint,
          ["ctx->Const.MaxTextureRectSize"], "", ["NV_texture_rectangle"] ),
@@ -902,16 +902,6 @@ StateVars = [
          ["ctx->Depth.BoundsMin", "ctx->Depth.BoundsMax"],
          "", ["EXT_depth_bounds_test"] ),
 
-       # GL_MESA_program_debug
-       ( "GL_FRAGMENT_PROGRAM_CALLBACK_MESA", GLboolean,
-         ["ctx->FragmentProgram.CallbackEnabled"], "", ["MESA_program_debug"] ),
-       ( "GL_VERTEX_PROGRAM_CALLBACK_MESA", GLboolean,
-         ["ctx->VertexProgram.CallbackEnabled"], "", ["MESA_program_debug"] ),
-       ( "GL_FRAGMENT_PROGRAM_POSITION_MESA", GLint,
-         ["ctx->FragmentProgram.CurrentPosition"], "", ["MESA_program_debug"] ),
-       ( "GL_VERTEX_PROGRAM_POSITION_MESA", GLint,
-         ["ctx->VertexProgram.CurrentPosition"], "", ["MESA_program_debug"] ),
-
        # GL_ARB_draw_buffers
        ( "GL_MAX_DRAW_BUFFERS_ARB", GLint,
          ["ctx->Const.MaxDrawBuffers"], "", None ),
index a9e22d340a314fdae172dcc4db437a09cf507fe6..41fd786d7d5aaaa89a097c6c7e1ba57d999a6795 100644 (file)
@@ -93,7 +93,7 @@ compute_version(const GLcontext *ctx)
                              (ctx->Extensions.EXT_stencil_two_side
                               || ctx->Extensions.ATI_separate_stencil));
    const GLboolean ver_2_1 = (ver_2_0 &&
-                              /*ctx->Extensions.ARB_shading_language_120 &&*/
+                              ctx->Extensions.ARB_shading_language_120 &&
                               ctx->Extensions.EXT_pixel_buffer_object &&
                               ctx->Extensions.EXT_texture_sRGB);
    if (ver_2_1)
@@ -242,36 +242,6 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
       case GL_SELECTION_BUFFER_POINTER:
          *params = ctx->Select.Buffer;
          break;
-#if FEATURE_MESA_program_debug
-      case GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA:
-         if (!ctx->Extensions.MESA_program_debug) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
-            return;
-         }
-         *params = *(GLvoid **) &ctx->FragmentProgram.Callback;
-         break;
-      case GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA:
-         if (!ctx->Extensions.MESA_program_debug) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
-            return;
-         }
-         *params = ctx->FragmentProgram.CallbackData;
-         break;
-      case GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA:
-         if (!ctx->Extensions.MESA_program_debug) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
-            return;
-         }
-         *params = *(GLvoid **) &ctx->VertexProgram.Callback;
-         break;
-      case GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA:
-         if (!ctx->Extensions.MESA_program_debug) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
-            return;
-         }
-         *params = ctx->VertexProgram.CallbackData;
-         break;
-#endif
       default:
          _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" );
          return;
index 5657976711efc3cbd6c1bd8f2aec8c2427d5321c..ad095321e399193bc5971cc9e96d1cdbf41daee5 100644 (file)
@@ -1,28 +1,8 @@
-/**
- * \file glheader.h
- * Top-most include file.
- *
- * This is the top-most include file of the Mesa sources.
- * It includes gl.h and all system headers which are needed.
- * Other Mesa source files should \e not directly include any system
- * headers.  This allows system-dependent hacks/workarounds to be
- * collected in one place.
- *
- * \note Actually, a lot of system-dependent stuff is now in imports.[ch].
- *
- * If you touch this file, everything gets recompiled!
- *
- * This file should be included before any other header in the .c files.
- *
- * Put compiler/OS/assembly pragmas and macros here to avoid
- * cluttering other source files.
- */
-
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
+ * Version:  7.5
  *
- * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  */
 
 
-#ifndef GLHEADER_H
-#define GLHEADER_H
-
-#include <assert.h>
-#include <ctype.h>
-#if defined(__alpha__) && defined(CCPML)
-#include <cpml.h> /* use Compaq's Fast Math Library on Alpha */
-#else
-#include <math.h>
-#endif
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#if defined(__linux__) && defined(__i386__)
-#include <fpu_control.h>
-#endif
-#include <float.h>
-#include <stdarg.h>
-
-
-/* Get standard integer types */
-#if defined(_MSC_VER)
-
-   typedef __int8             int8_t;
-   typedef unsigned __int8    uint8_t;
-   typedef __int16            int16_t;
-   typedef unsigned __int16   uint16_t;
-#  ifndef __eglplatform_h_
-     typedef __int32            int32_t;
-#  endif
-   typedef unsigned __int32   uint32_t;
-   typedef __int64            int64_t;
-   typedef unsigned __int64   uint64_t;
-
-#  if defined(_WIN64)
-     typedef __int64            intptr_t;
-     typedef unsigned __int64   uintptr_t;
-#  else
-     typedef __int32            intptr_t;
-     typedef unsigned __int32   uintptr_t;
-#  endif
-
-#  define INT64_C(__val) __val##i64
-#  define UINT64_C(__val) __val##ui64
-
-#else
-#  include <stdint.h>
-#endif
-
+/**
+ * \file glheader.h
+ * Wrapper for GL/gl.h and GL/glext.h
+ */
 
-/* Sun compilers define __i386 instead of the gcc-style __i386__ */
-#ifdef __SUNPRO_C
-# if !defined(__i386__) && defined(__i386)
-#  define __i386__
-# elif !defined(__amd64__) && defined(__amd64)
-#  define __amd64__
-# elif !defined(__sparc__) && defined(__sparc)
-#  define __sparc__
-# endif
-# if !defined(__volatile)
-#  define __volatile volatile
-# endif
-#endif
 
-#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
-#  define __WIN32__
-#  define finite _finite
-#endif
+#ifndef GLHEADER_H
+#define GLHEADER_H
 
-#if defined(__WATCOMC__)
-#  define finite _finite
-#  pragma disable_message(201) /* Disable unreachable code warnings */
-#endif
 
 #ifdef WGLAPI
-#      undef WGLAPI
+#undef WGLAPI
 #endif
 
+
 #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
-#  if !defined(__GNUC__) /* mingw environment */
-#    pragma warning( disable : 4068 ) /* unknown pragma */
-#    pragma warning( disable : 4710 ) /* function 'foo' not inlined */
-#    pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */
-#    pragma warning( disable : 4127 ) /* conditional expression is constant */
-#    if defined(MESA_MINWARN)
-#      pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
-#      pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
-#      pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
-#      pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */
-#      pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
-#    endif
-#  endif
 #  if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
 #    define WGLAPI __declspec(dllexport)
 #  elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
 #endif /* WIN32 / CYGWIN bracket */
 
 
-/*
- * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
- * Do not use them unless absolutely necessary!
- * Try to use a runtime test instead.
- * For now, only used by some DRI hardware drivers for color/texel packing.
- */
-#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
-#if defined(__linux__)
-#include <byteswap.h>
-#define CPU_TO_LE32( x )       bswap_32( x )
-#else /*__linux__*/
-#include <sys/endian.h>
-#define CPU_TO_LE32( x )       bswap32( x )
-#endif /*__linux__*/
-#define MESA_BIG_ENDIAN 1
-#else
-#define CPU_TO_LE32( x )       ( x )
-#define MESA_LITTLE_ENDIAN 1
-#endif
-#define LE32_TO_CPU( x )       CPU_TO_LE32( x )
-
-
 #define GL_GLEXT_PROTOTYPES
 #include "GL/gl.h"
 #include "GL/glext.h"
+#include "GL/internal/glcore.h"
 
 
 #ifndef GL_FIXED
 #endif
 
 
-#if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP)
-#define CAPI _cdecl
-#endif
-
-
-/* This is a macro on IRIX */
-#ifdef _P
-#undef _P
-#endif
-
-
-/* Turn off macro checking systems used by other libraries */
-#ifdef CHECK
-#undef CHECK
-#endif
-
-
-/* Create a macro so that asm functions can be linked into compilers other
- * than GNU C
- */
-#ifndef _ASMAPI
-#if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/
-#define _ASMAPI __cdecl
-#else
-#define _ASMAPI
-#endif
-#ifdef PTR_DECL_IN_FRONT
-#define        _ASMAPIP * _ASMAPI
-#else
-#define        _ASMAPIP _ASMAPI *
-#endif
-#endif
-
-#ifdef USE_X86_ASM
-#define _NORMAPI _ASMAPI
-#define _NORMAPIP _ASMAPIP
-#else
-#define _NORMAPI
-#define _NORMAPIP *
-#endif
-
-
-/* Function inlining */
-#if defined(__GNUC__)
-#  define INLINE __inline__
-#elif defined(__MSC__)
-#  define INLINE __inline
-#elif defined(_MSC_VER)
-#  define INLINE __inline
-#elif defined(__ICL)
-#  define INLINE __inline
-#elif defined(__INTEL_COMPILER)
-#  define INLINE inline
-#elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
-#  define INLINE __inline
-#elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
-#  define INLINE inline
-#  define __inline inline
-#  define __inline__ inline
-#elif (__STDC_VERSION__ >= 199901L) /* C99 */
-#  define INLINE inline
-#else
-#  define INLINE
-#endif
-
-
-/* If we build the library with gcc's -fvisibility=hidden flag, we'll
- * use the PUBLIC macro to mark functions that are to be exported.
- *
- * We also need to define a USED attribute, so the optimizer doesn't 
- * inline a static function that we later use in an alias. - ajax
- */
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
-#  define PUBLIC __attribute__((visibility("default")))
-#  define USED __attribute__((used))
-#else
-#  define PUBLIC
-#  define USED
-#endif
-
-
-/* Some compilers don't like some of Mesa's const usage */
-#ifdef NO_CONST
-#  define CONST
-#else
-#  define CONST const
-#endif
-
-
-#if !defined(_WIN32_WCE)
-#if defined(BUILD_FOR_SNAP) && defined(CHECKED)
-#  define ASSERT(X)   _CHECK(X) 
-#elif defined(DEBUG)
-#  define ASSERT(X)   assert(X)
-#else
-#  define ASSERT(X)
-#endif
-#endif
-
-
-#if (!defined(__GNUC__) || __GNUC__ < 3) && (!defined(__IBMC__) || __IBMC__ < 900)
-#  define __builtin_expect(x, y) x
-#endif
-
-/* The __FUNCTION__ gcc variable is generally only used for debugging.
- * If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
- * Don't define it if using a newer Windows compiler.
+/**
+ * Special, internal token
  */
-#ifndef __FUNCTION__
-# if defined(__VMS)
-#  define __FUNCTION__ "VMS$NL:"
-# elif ((!defined __GNUC__) || (__GNUC__ < 2)) && (!defined __xlC__) && \
-      (!defined(_MSC_VER) || _MSC_VER < 1300)
-#  if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
-    (defined(__SUNPRO_C) && defined(__C99FEATURES__))
-#   define __FUNCTION__ __func__
-#  else
-#   define __FUNCTION__ "<unknown>"
-#  endif
-# endif
-#endif
-
+#define GL_SHADER_PROGRAM_MESA 0x9999
 
-#include "config.h"
 
 #endif /* GLHEADER_H */
index ffb2c4d946e47024471f8a84ca15d1651e77989c..976f9d999b70b862d02f504131532c2d4654bdb7 100644 (file)
@@ -300,7 +300,7 @@ _mesa_HashWalk(const struct _mesa_HashTable *table,
    GLuint pos;
    ASSERT(table);
    ASSERT(callback);
-   _glthread_UNLOCK_MUTEX(table2->Mutex);
+   _glthread_LOCK_MUTEX(table2->Mutex);
    for (pos = 0; pos < TABLE_SIZE; pos++) {
       struct HashEntry *entry;
       for (entry = table->Table[pos]; entry; entry = entry->Next) {
index 4d86c5477753960575998845fbcbdab0199bf997..fa3149d56dad1522d47df0adaa72b30a5858a563 100644 (file)
@@ -293,6 +293,9 @@ _mesa_components_in_format( GLenum format )
          return 2;
       case GL_DEPTH_STENCIL_EXT:
          return 2;
+      case GL_DUDV_ATI:
+      case GL_DU8DV8_ATI:
+         return 2;
       default:
          return -1;
    }
@@ -503,6 +506,20 @@ _mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type )
             return GL_TRUE;
          else
             return GL_FALSE;
+      case GL_DUDV_ATI:
+      case GL_DU8DV8_ATI:
+         switch (type) {
+            case GL_BYTE:
+            case GL_UNSIGNED_BYTE:
+            case GL_SHORT:
+            case GL_UNSIGNED_SHORT:
+            case GL_INT:
+            case GL_UNSIGNED_INT:
+            case GL_FLOAT:
+               return GL_TRUE;
+            default:
+               return GL_FALSE;
+         }
       default:
          ; /* fall-through */
    }
@@ -1674,8 +1691,19 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
    GLfloat luminance[MAX_WIDTH];
    const GLint comps = _mesa_components_in_format(dstFormat);
    GLuint i;
-
-   if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
+   /* clamping only applies to colors, not the dudv values, but still need
+      it if converting to unsigned values (which doesn't make much sense) */
+   if (dstFormat == GL_DUDV_ATI || dstFormat == GL_DU8DV8_ATI) {
+      switch (dstType) {
+         case GL_UNSIGNED_BYTE:
+         case GL_UNSIGNED_SHORT:
+         case GL_UNSIGNED_INT:
+            transferOps |= IMAGE_CLAMP_BIT;
+            break;
+            /* actually might want clamp to [-1,1] otherwise but shouldn't matter? */
+      }
+   }
+   else if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
       /* need to clamp to [0, 1] */
       transferOps |= IMAGE_CLAMP_BIT;
    }
@@ -1774,6 +1802,13 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
                   }
                   break;
+               case GL_DUDV_ATI:
+               case GL_DU8DV8_ATI:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
+                     dst[i*2+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]);
+                  }
+                  break;
                default:
                   _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
             }
@@ -1847,6 +1882,13 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
                   }
                   break;
+               case GL_DUDV_ATI:
+               case GL_DU8DV8_ATI:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
+                     dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
+                  }
+                  break;
                default:
                   _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
             }
@@ -1920,6 +1962,13 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
                      CLAMPED_FLOAT_TO_USHORT(dst[i*4+3], rgba[i][RCOMP]);
                   }
                   break;
+               case GL_DUDV_ATI:
+               case GL_DU8DV8_ATI:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]);
+                     dst[i*2+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]);
+                  }
+                  break;
                default:
                   _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
             }
@@ -1993,6 +2042,13 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
                   }
                   break;
+               case GL_DUDV_ATI:
+               case GL_DU8DV8_ATI:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
+                     dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
+                  }
+                  break;
                default:
                   _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
             }
@@ -2066,6 +2122,13 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i*4+3] = FLOAT_TO_UINT(rgba[i][RCOMP]);
                   }
                   break;
+               case GL_DUDV_ATI:
+               case GL_DU8DV8_ATI:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = FLOAT_TO_UINT(rgba[i][RCOMP]);
+                     dst[i*2+1] = FLOAT_TO_UINT(rgba[i][GCOMP]);
+                  }
+                  break;
                default:
                   _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
             }
@@ -2139,6 +2202,13 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i*4+3] = FLOAT_TO_INT(rgba[i][RCOMP]);
                   }
                   break;
+               case GL_DUDV_ATI:
+               case GL_DU8DV8_ATI:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = FLOAT_TO_INT(rgba[i][RCOMP]);
+                     dst[i*2+1] = FLOAT_TO_INT(rgba[i][GCOMP]);
+                  }
+                  break;
                default:
                   _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
             }
@@ -2212,6 +2282,13 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i*4+3] = rgba[i][RCOMP];
                   }
                   break;
+               case GL_DUDV_ATI:
+               case GL_DU8DV8_ATI:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = rgba[i][RCOMP];
+                     dst[i*2+1] = rgba[i][GCOMP];
+                  }
+                  break;
                default:
                   _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
             }
@@ -2285,6 +2362,13 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i*4+3] = _mesa_float_to_half(rgba[i][RCOMP]);
                   }
                   break;
+               case GL_DUDV_ATI:
+               case GL_DU8DV8_ATI:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = _mesa_float_to_half(rgba[i][RCOMP]);
+                     dst[i*2+1] = _mesa_float_to_half(rgba[i][GCOMP]);
+                  }
+                  break;
                default:
                   _mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
             }
@@ -2294,9 +2378,9 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGB) {
             GLubyte *dst = (GLubyte *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) << 5)
-                      | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 2)
-                      | (((GLint) (rgba[i][BCOMP] * 3.0F))     );
+               dst[i] = (IROUND(rgba[i][RCOMP] * 7.0F) << 5)
+                      | (IROUND(rgba[i][GCOMP] * 7.0F) << 2)
+                      | (IROUND(rgba[i][BCOMP] * 3.0F)     );
             }
          }
          break;
@@ -2304,9 +2388,9 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGB) {
             GLubyte *dst = (GLubyte *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F))     )
-                      | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 3)
-                      | (((GLint) (rgba[i][BCOMP] * 3.0F)) << 6);
+               dst[i] = (IROUND(rgba[i][RCOMP] * 7.0F)     )
+                      | (IROUND(rgba[i][GCOMP] * 7.0F) << 3)
+                      | (IROUND(rgba[i][BCOMP] * 3.0F) << 6);
             }
          }
          break;
@@ -2314,9 +2398,9 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGB) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11)
-                      | (((GLint) (rgba[i][GCOMP] * 63.0F)) <<  5)
-                      | (((GLint) (rgba[i][BCOMP] * 31.0F))      );
+               dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F) << 11)
+                      | (IROUND(rgba[i][GCOMP] * 63.0F) <<  5)
+                      | (IROUND(rgba[i][BCOMP] * 31.0F)      );
             }
          }
          break;
@@ -2324,9 +2408,9 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGB) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F))      )
-                      | (((GLint) (rgba[i][GCOMP] * 63.0F)) <<  5)
-                      | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11);
+               dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F)      )
+                      | (IROUND(rgba[i][GCOMP] * 63.0F) <<  5)
+                      | (IROUND(rgba[i][BCOMP] * 31.0F) << 11);
             }
          }
          break;
@@ -2334,28 +2418,28 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGBA) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12)
-                      | (((GLint) (rgba[i][GCOMP] * 15.0F)) <<  8)
-                      | (((GLint) (rgba[i][BCOMP] * 15.0F)) <<  4)
-                      | (((GLint) (rgba[i][ACOMP] * 15.0F))      );
+               dst[i] = (IROUND(rgba[i][RCOMP] * 15.0F) << 12)
+                      | (IROUND(rgba[i][GCOMP] * 15.0F) <<  8)
+                      | (IROUND(rgba[i][BCOMP] * 15.0F) <<  4)
+                      | (IROUND(rgba[i][ACOMP] * 15.0F)      );
             }
          }
          else if (dstFormat == GL_BGRA) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][BCOMP] * 15.0F)) << 12)
-                      | (((GLint) (rgba[i][GCOMP] * 15.0F)) <<  8)
-                      | (((GLint) (rgba[i][RCOMP] * 15.0F)) <<  4)
-                      | (((GLint) (rgba[i][ACOMP] * 15.0F))      );
+               dst[i] = (IROUND(rgba[i][BCOMP] * 15.0F) << 12)
+                      | (IROUND(rgba[i][GCOMP] * 15.0F) <<  8)
+                      | (IROUND(rgba[i][RCOMP] * 15.0F) <<  4)
+                      | (IROUND(rgba[i][ACOMP] * 15.0F)      );
             }
          }
          else if (dstFormat == GL_ABGR_EXT) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12)
-                      | (((GLint) (rgba[i][BCOMP] * 15.0F)) <<  8)
-                      | (((GLint) (rgba[i][GCOMP] * 15.0F)) <<  4)
-                      | (((GLint) (rgba[i][RCOMP] * 15.0F))      );
+               dst[i] = (IROUND(rgba[i][ACOMP] * 15.0F) << 12)
+                      | (IROUND(rgba[i][BCOMP] * 15.0F) <<  8)
+                      | (IROUND(rgba[i][GCOMP] * 15.0F) <<  4)
+                      | (IROUND(rgba[i][RCOMP] * 15.0F)      );
             }
          }
          break;
@@ -2363,28 +2447,28 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGBA) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F))      )
-                      | (((GLint) (rgba[i][GCOMP] * 15.0F)) <<  4)
-                      | (((GLint) (rgba[i][BCOMP] * 15.0F)) <<  8)
-                      | (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12);
+               dst[i] = (IROUND(rgba[i][RCOMP] * 15.0F)      )
+                      | (IROUND(rgba[i][GCOMP] * 15.0F) <<  4)
+                      | (IROUND(rgba[i][BCOMP] * 15.0F) <<  8)
+                      | (IROUND(rgba[i][ACOMP] * 15.0F) << 12);
             }
          }
          else if (dstFormat == GL_BGRA) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][BCOMP] * 15.0F))      )
-                      | (((GLint) (rgba[i][GCOMP] * 15.0F)) <<  4)
-                      | (((GLint) (rgba[i][RCOMP] * 15.0F)) <<  8)
-                      | (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12);
+               dst[i] = (IROUND(rgba[i][BCOMP] * 15.0F)      )
+                      | (IROUND(rgba[i][GCOMP] * 15.0F) <<  4)
+                      | (IROUND(rgba[i][RCOMP] * 15.0F) <<  8)
+                      | (IROUND(rgba[i][ACOMP] * 15.0F) << 12);
             }
          }
          else if (dstFormat == GL_ABGR_EXT) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F))      )
-                      | (((GLint) (rgba[i][BCOMP] * 15.0F)) <<  4)
-                      | (((GLint) (rgba[i][GCOMP] * 15.0F)) <<  8)
-                      | (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12);
+               dst[i] = (IROUND(rgba[i][ACOMP] * 15.0F)      )
+                      | (IROUND(rgba[i][BCOMP] * 15.0F) <<  4)
+                      | (IROUND(rgba[i][GCOMP] * 15.0F) <<  8)
+                      | (IROUND(rgba[i][RCOMP] * 15.0F) << 12);
             }
          }
          break;
@@ -2392,28 +2476,28 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGBA) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11)
-                      | (((GLint) (rgba[i][GCOMP] * 31.0F)) <<  6)
-                      | (((GLint) (rgba[i][BCOMP] * 31.0F)) <<  1)
-                      | (((GLint) (rgba[i][ACOMP] *  1.0F))      );
+               dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F) << 11)
+                      | (IROUND(rgba[i][GCOMP] * 31.0F) <<  6)
+                      | (IROUND(rgba[i][BCOMP] * 31.0F) <<  1)
+                      | (IROUND(rgba[i][ACOMP] *  1.0F)      );
             }
          }
          else if (dstFormat == GL_BGRA) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11)
-                      | (((GLint) (rgba[i][GCOMP] * 31.0F)) <<  6)
-                      | (((GLint) (rgba[i][RCOMP] * 31.0F)) <<  1)
-                      | (((GLint) (rgba[i][ACOMP] *  1.0F))      );
+               dst[i] = (IROUND(rgba[i][BCOMP] * 31.0F) << 11)
+                      | (IROUND(rgba[i][GCOMP] * 31.0F) <<  6)
+                      | (IROUND(rgba[i][RCOMP] * 31.0F) <<  1)
+                      | (IROUND(rgba[i][ACOMP] *  1.0F)      );
             }
          }
          else if (dstFormat == GL_ABGR_EXT) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][ACOMP] * 31.0F)) << 11)
-                      | (((GLint) (rgba[i][BCOMP] * 31.0F)) <<  6)
-                      | (((GLint) (rgba[i][GCOMP] * 31.0F)) <<  1)
-                      | (((GLint) (rgba[i][RCOMP] *  1.0F))      );
+               dst[i] = (IROUND(rgba[i][ACOMP] * 31.0F) << 11)
+                      | (IROUND(rgba[i][BCOMP] * 31.0F) <<  6)
+                      | (IROUND(rgba[i][GCOMP] * 31.0F) <<  1)
+                      | (IROUND(rgba[i][RCOMP] *  1.0F)      );
             }
          }
          break;
@@ -2421,28 +2505,28 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGBA) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F))      )
-                      | (((GLint) (rgba[i][GCOMP] * 31.0F)) <<  5)
-                      | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 10)
-                      | (((GLint) (rgba[i][ACOMP] *  1.0F)) << 15);
+               dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F)      )
+                      | (IROUND(rgba[i][GCOMP] * 31.0F) <<  5)
+                      | (IROUND(rgba[i][BCOMP] * 31.0F) << 10)
+                      | (IROUND(rgba[i][ACOMP] *  1.0F) << 15);
             }
          }
          else if (dstFormat == GL_BGRA) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][BCOMP] * 31.0F))      )
-                      | (((GLint) (rgba[i][GCOMP] * 31.0F)) <<  5)
-                      | (((GLint) (rgba[i][RCOMP] * 31.0F)) << 10)
-                      | (((GLint) (rgba[i][ACOMP] *  1.0F)) << 15);
+               dst[i] = (IROUND(rgba[i][BCOMP] * 31.0F)      )
+                      | (IROUND(rgba[i][GCOMP] * 31.0F) <<  5)
+                      | (IROUND(rgba[i][RCOMP] * 31.0F) << 10)
+                      | (IROUND(rgba[i][ACOMP] *  1.0F) << 15);
             }
          }
          else if (dstFormat == GL_ABGR_EXT) {
             GLushort *dst = (GLushort *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLint) (rgba[i][ACOMP] * 31.0F))      )
-                      | (((GLint) (rgba[i][BCOMP] * 31.0F)) <<  5)
-                      | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 10)
-                      | (((GLint) (rgba[i][RCOMP] *  1.0F)) << 15);
+               dst[i] = (IROUND(rgba[i][ACOMP] * 31.0F)      )
+                      | (IROUND(rgba[i][BCOMP] * 31.0F) <<  5)
+                      | (IROUND(rgba[i][GCOMP] * 31.0F) << 10)
+                      | (IROUND(rgba[i][RCOMP] *  1.0F) << 15);
             }
          }
          break;
@@ -2450,28 +2534,28 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGBA) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24)
-                      | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16)
-                      | (((GLuint) (rgba[i][BCOMP] * 255.0F)) <<  8)
-                      | (((GLuint) (rgba[i][ACOMP] * 255.0F))      );
+               dst[i] = (IROUND(rgba[i][RCOMP] * 255.F) << 24)
+                      | (IROUND(rgba[i][GCOMP] * 255.F) << 16)
+                      | (IROUND(rgba[i][BCOMP] * 255.F) <<  8)
+                      | (IROUND(rgba[i][ACOMP] * 255.F)      );
             }
          }
          else if (dstFormat == GL_BGRA) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 24)
-                      | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16)
-                      | (((GLuint) (rgba[i][RCOMP] * 255.0F)) <<  8)
-                      | (((GLuint) (rgba[i][ACOMP] * 255.0F))      );
+               dst[i] = (IROUND(rgba[i][BCOMP] * 255.F) << 24)
+                      | (IROUND(rgba[i][GCOMP] * 255.F) << 16)
+                      | (IROUND(rgba[i][RCOMP] * 255.F) <<  8)
+                      | (IROUND(rgba[i][ACOMP] * 255.F)      );
             }
          }
          else if (dstFormat == GL_ABGR_EXT) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24)
-                      | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16)
-                      | (((GLuint) (rgba[i][GCOMP] * 255.0F)) <<  8)
-                      | (((GLuint) (rgba[i][RCOMP] * 255.0F))      );
+               dst[i] = (IROUND(rgba[i][ACOMP] * 255.F) << 24)
+                      | (IROUND(rgba[i][BCOMP] * 255.F) << 16)
+                      | (IROUND(rgba[i][GCOMP] * 255.F) <<  8)
+                      | (IROUND(rgba[i][RCOMP] * 255.F)      );
             }
          }
          break;
@@ -2479,28 +2563,28 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGBA) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F))      )
-                      | (((GLuint) (rgba[i][GCOMP] * 255.0F)) <<  8)
-                      | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16)
-                      | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24);
+               dst[i] = (IROUND(rgba[i][RCOMP] * 255.0F)      )
+                      | (IROUND(rgba[i][GCOMP] * 255.0F) <<  8)
+                      | (IROUND(rgba[i][BCOMP] * 255.0F) << 16)
+                      | (IROUND(rgba[i][ACOMP] * 255.0F) << 24);
             }
          }
          else if (dstFormat == GL_BGRA) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F))      )
-                      | (((GLuint) (rgba[i][GCOMP] * 255.0F)) <<  8)
-                      | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 16)
-                      | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24);
+               dst[i] = (IROUND(rgba[i][BCOMP] * 255.0F)      )
+                      | (IROUND(rgba[i][GCOMP] * 255.0F) <<  8)
+                      | (IROUND(rgba[i][RCOMP] * 255.0F) << 16)
+                      | (IROUND(rgba[i][ACOMP] * 255.0F) << 24);
             }
          }
          else if (dstFormat == GL_ABGR_EXT) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F))      )
-                      | (((GLuint) (rgba[i][BCOMP] * 255.0F)) <<  8)
-                      | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16)
-                      | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24);
+               dst[i] = (IROUND(rgba[i][ACOMP] * 255.0F)      )
+                      | (IROUND(rgba[i][BCOMP] * 255.0F) <<  8)
+                      | (IROUND(rgba[i][GCOMP] * 255.0F) << 16)
+                      | (IROUND(rgba[i][RCOMP] * 255.0F) << 24);
             }
          }
          break;
@@ -2508,28 +2592,28 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGBA) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 22)
-                      | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12)
-                      | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) <<  2)
-                      | (((GLuint) (rgba[i][ACOMP] *    3.0F))      );
+               dst[i] = (IROUND(rgba[i][RCOMP] * 1023.0F) << 22)
+                      | (IROUND(rgba[i][GCOMP] * 1023.0F) << 12)
+                      | (IROUND(rgba[i][BCOMP] * 1023.0F) <<  2)
+                      | (IROUND(rgba[i][ACOMP] *    3.0F)      );
             }
          }
          else if (dstFormat == GL_BGRA) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 22)
-                      | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12)
-                      | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) <<  2)
-                      | (((GLuint) (rgba[i][ACOMP] *    3.0F))      );
+               dst[i] = (IROUND(rgba[i][BCOMP] * 1023.0F) << 22)
+                      | (IROUND(rgba[i][GCOMP] * 1023.0F) << 12)
+                      | (IROUND(rgba[i][RCOMP] * 1023.0F) <<  2)
+                      | (IROUND(rgba[i][ACOMP] *    3.0F)      );
             }
          }
          else if (dstFormat == GL_ABGR_EXT) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) << 22)
-                      | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 12)
-                      | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) <<  2)
-                      | (((GLuint) (rgba[i][RCOMP] *    3.0F))      );
+               dst[i] = (IROUND(rgba[i][ACOMP] * 1023.0F) << 22)
+                      | (IROUND(rgba[i][BCOMP] * 1023.0F) << 12)
+                      | (IROUND(rgba[i][GCOMP] * 1023.0F) <<  2)
+                      | (IROUND(rgba[i][RCOMP] *    3.0F)      );
             }
          }
          break;
@@ -2537,28 +2621,28 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
          if (dstFormat == GL_RGBA) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F))      )
-                      | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10)
-                      | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 20)
-                      | (((GLuint) (rgba[i][ACOMP] *    3.0F)) << 30);
+               dst[i] = (IROUND(rgba[i][RCOMP] * 1023.0F)      )
+                      | (IROUND(rgba[i][GCOMP] * 1023.0F) << 10)
+                      | (IROUND(rgba[i][BCOMP] * 1023.0F) << 20)
+                      | (IROUND(rgba[i][ACOMP] *    3.0F) << 30);
             }
          }
          else if (dstFormat == GL_BGRA) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F))      )
-                      | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10)
-                      | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 20)
-                      | (((GLuint) (rgba[i][ACOMP] *    3.0F)) << 30);
+               dst[i] = (IROUND(rgba[i][BCOMP] * 1023.0F)      )
+                      | (IROUND(rgba[i][GCOMP] * 1023.0F) << 10)
+                      | (IROUND(rgba[i][RCOMP] * 1023.0F) << 20)
+                      | (IROUND(rgba[i][ACOMP] *    3.0F) << 30);
             }
          }
          else if (dstFormat == GL_ABGR_EXT) {
             GLuint *dst = (GLuint *) dstAddr;
             for (i=0;i<n;i++) {
-               dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F))      )
-                      | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 10)
-                      | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 20)
-                      | (((GLuint) (rgba[i][RCOMP] *    3.0F)) << 30);
+               dst[i] = (IROUND(rgba[i][ACOMP] * 1023.0F)      )
+                      | (IROUND(rgba[i][BCOMP] * 1023.0F) << 10)
+                      | (IROUND(rgba[i][GCOMP] * 1023.0F) << 20)
+                      | (IROUND(rgba[i][RCOMP] *    3.0F) << 30);
             }
          }
          break;
@@ -2834,7 +2918,8 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
           srcFormat == GL_BGR ||
           srcFormat == GL_RGBA ||
           srcFormat == GL_BGRA ||
-          srcFormat == GL_ABGR_EXT);
+          srcFormat == GL_ABGR_EXT ||
+          srcFormat == GL_DUDV_ATI);
 
    ASSERT(srcType == GL_UNSIGNED_BYTE ||
           srcType == GL_BYTE ||
@@ -2949,6 +3034,13 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
          aComp = 0;
          stride = 4;
          break;
+      case GL_DUDV_ATI:
+         redIndex = 0;
+         greenIndex = 1;
+         blueIndex = -1;
+         alphaIndex = -1;
+         stride = 2;
+         break;
       default:
          _mesa_problem(NULL, "bad srcFormat in extract float data");
          return;
@@ -3877,6 +3969,62 @@ _mesa_unpack_color_span_float( GLcontext *ctx,
    }
 }
 
+/**
+ * Similar to _mesa_unpack_color_span_float(), but for dudv data instead of rgba,
+ * directly return GLbyte data, no transfer ops apply.
+ */
+void
+_mesa_unpack_dudv_span_byte( GLcontext *ctx,
+                             GLuint n, GLenum dstFormat, GLbyte dest[],
+                             GLenum srcFormat, GLenum srcType,
+                             const GLvoid *source,
+                             const struct gl_pixelstore_attrib *srcPacking,
+                             GLbitfield transferOps )
+{
+   ASSERT(dstFormat == GL_DUDV_ATI);
+   ASSERT(srcFormat == GL_DUDV_ATI);
+
+   ASSERT(srcType == GL_UNSIGNED_BYTE ||
+          srcType == GL_BYTE ||
+          srcType == GL_UNSIGNED_SHORT ||
+          srcType == GL_SHORT ||
+          srcType == GL_UNSIGNED_INT ||
+          srcType == GL_INT ||
+          srcType == GL_HALF_FLOAT_ARB ||
+          srcType == GL_FLOAT);
+
+   /* general solution */
+   {
+      GLint dstComponents;
+      GLfloat rgba[MAX_WIDTH][4];
+      GLbyte *dst = dest;
+      GLuint i;
+
+      dstComponents = _mesa_components_in_format( dstFormat );
+      /* source & dest image formats should have been error checked by now */
+      assert(dstComponents > 0);
+
+      /*
+       * Extract image data and convert to RGBA floats
+       */
+      assert(n <= MAX_WIDTH);
+      extract_float_rgba(n, rgba, srcFormat, srcType, source,
+                         srcPacking->SwapBytes);
+
+
+      /* Now determine which color channels we need to produce.
+       * And determine the dest index (offset) within each color tuple.
+       */
+
+      /* Now pack results in the requested dstFormat */
+      for (i = 0; i < n; i++) {
+         /* not sure - need clamp[-1,1] here? */
+         dst[0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
+         dst[1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
+         dst += dstComponents;
+      }
+   }
+}
 
 /*
  * Unpack a row of color index data from a client buffer according to
index 0e0bbd96d85db1f7ea924bb9eaf81b9d45527830..b26c27e5a8ac7976781a076440e00b8ba66267cb 100644 (file)
@@ -198,6 +198,13 @@ _mesa_unpack_color_span_float( GLcontext *ctx,
                                const struct gl_pixelstore_attrib *srcPacking,
                                GLbitfield transferOps );
 
+extern void
+_mesa_unpack_dudv_span_byte( GLcontext *ctx,
+                             GLuint n, GLenum dstFormat, GLbyte dest[],
+                             GLenum srcFormat, GLenum srcType,
+                             const GLvoid *source,
+                             const struct gl_pixelstore_attrib *srcPacking,
+                             GLbitfield transferOps );
 
 extern void
 _mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
index cb04594c1fd83687c948b5e10e8c6fc42a65e403..20b8342064165fa1561b7a41dcd7816043dcaf47 100644 (file)
@@ -1011,7 +1011,7 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... )
  * Prints the message to stderr via fprintf().
  *
  * \param ctx GL context.
- * \param s problem description string.
+ * \param fmtString problem description string.
  */
 void
 _mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
index a421eb5e755bc96da57729c2a9941d2fee9016c8..7b61e22e9322b8a18a359be503b685113f0c0ed8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.1
+ * Version:  7.5
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  *
 #define IMPORTS_H
 
 
-/* XXX some of the stuff in glheader.h should be moved into this file.
- */
+#include "compiler.h"
 #include "glheader.h"
-#include <GL/internal/glcore.h>
 
 
 #ifdef __cplusplus
@@ -47,26 +45,6 @@ extern "C" {
 #endif
 
 
-/**********************************************************************/
-/** \name General macros */
-/*@{*/
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-
-/** gcc -pedantic warns about long string literals, LONGSTRING silences that */
-#if !defined(__GNUC__) || (__GNUC__ < 2) || \
-    ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7))
-# define LONGSTRING
-#else
-# define LONGSTRING __extension__
-#endif
-
-/*@}*/
-
-
 /**********************************************************************/
 /** Memory macros */
 /*@{*/
@@ -130,48 +108,10 @@ typedef union { GLfloat f; GLint i; } fi_type;
 #define MAX_GLUSHORT   0xffff
 #define MAX_GLUINT     0xffffffff
 
-#ifndef M_PI
-#define M_PI (3.1415926536)
-#endif
-
-#ifndef M_E
-#define M_E (2.7182818284590452354)
-#endif
-
-#ifndef ONE_DIV_LN2
-#define ONE_DIV_LN2 (1.442695040888963456)
-#endif
-
-#ifndef ONE_DIV_SQRT_LN2
-#define ONE_DIV_SQRT_LN2 (1.201122408786449815)
-#endif
-
-#ifndef FLT_MAX_EXP
-#define FLT_MAX_EXP 128
-#endif
-
 /* Degrees to radians conversion: */
 #define DEG2RAD (M_PI/180.0)
 
 
-/***
- *** USE_IEEE: Determine if we're using IEEE floating point
- ***/
-#if defined(__i386__) || defined(__386__) || defined(__sparc__) || \
-    defined(__s390x__) || defined(__powerpc__) || \
-    defined(__x86_64__) || \
-    defined(ia64) || defined(__ia64__) || \
-    defined(__hppa__) || defined(hpux) || \
-    defined(__mips) || defined(_MIPS_ARCH) || \
-    defined(__arm__) || \
-    defined(__sh__) || defined(__m32r__) || \
-    (defined(__sun) && defined(_IEEE_754)) || \
-    (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS)))
-#define USE_IEEE
-#define IEEE_ONE 0x3f800000
-#endif
-
-
 /***
  *** SQRTF: single-precision square root
  ***/
@@ -316,16 +256,9 @@ static INLINE int GET_FLOAT_BITS( float x )
 /***
  *** IROUND: return (as an integer) float rounded to nearest integer
  ***/
-#if defined(USE_SPARC_ASM) && defined(__GNUC__) && defined(__sparc__)
-static INLINE int iround(float f)
-{
-   int r;
-   __asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f));
-   return r;
-}
-#define IROUND(x)  iround(x)
-#elif defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) && \
-                       (!defined(__BEOS__) || (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)))
+#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) && \
+                       (!(defined(__BEOS__) || defined(__HAIKU__))  || \
+                       (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)))
 static INLINE int iround(float f)
 {
    int r;
@@ -508,113 +441,6 @@ _mesa_is_pow_two(int x)
 #endif
 
 
-/***
- *** START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save
- ***                  original mode to a temporary).
- *** END_FAST_MATH: Restore x86 FPU to original mode.
- ***/
-#if defined(__GNUC__) && defined(__i386__)
-/*
- * Set the x86 FPU control word to guarentee only 32 bits of precision
- * are stored in registers.  Allowing the FPU to store more introduces
- * differences between situations where numbers are pulled out of memory
- * vs. situations where the compiler is able to optimize register usage.
- *
- * In the worst case, we force the compiler to use a memory access to
- * truncate the float, by specifying the 'volatile' keyword.
- */
-/* Hardware default: All exceptions masked, extended double precision,
- * round to nearest (IEEE compliant):
- */
-#define DEFAULT_X86_FPU                0x037f
-/* All exceptions masked, single precision, round to nearest:
- */
-#define FAST_X86_FPU           0x003f
-/* The fldcw instruction will cause any pending FP exceptions to be
- * raised prior to entering the block, and we clear any pending
- * exceptions before exiting the block.  Hence, asm code has free
- * reign over the FPU while in the fast math block.
- */
-#if defined(NO_FAST_MATH)
-#define START_FAST_MATH(x)                                             \
-do {                                                                   \
-   static GLuint mask = DEFAULT_X86_FPU;                               \
-   __asm__ ( "fnstcw %0" : "=m" (*&(x)) );                             \
-   __asm__ ( "fldcw %0" : : "m" (mask) );                              \
-} while (0)
-#else
-#define START_FAST_MATH(x)                                             \
-do {                                                                   \
-   static GLuint mask = FAST_X86_FPU;                                  \
-   __asm__ ( "fnstcw %0" : "=m" (*&(x)) );                             \
-   __asm__ ( "fldcw %0" : : "m" (mask) );                              \
-} while (0)
-#endif
-/* Restore original FPU mode, and clear any exceptions that may have
- * occurred in the FAST_MATH block.
- */
-#define END_FAST_MATH(x)                                               \
-do {                                                                   \
-   __asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) );                    \
-} while (0)
-
-#elif defined(__WATCOMC__) && defined(__386__)
-#define DEFAULT_X86_FPU                0x037f /* See GCC comments above */
-#define FAST_X86_FPU           0x003f /* See GCC comments above */
-void _watcom_start_fast_math(unsigned short *x,unsigned short *mask);
-#pragma aux _watcom_start_fast_math =                                   \
-   "fnstcw  word ptr [eax]"                                             \
-   "fldcw   word ptr [ecx]"                                             \
-   parm [eax] [ecx]                                                     \
-   modify exact [];
-void _watcom_end_fast_math(unsigned short *x);
-#pragma aux _watcom_end_fast_math =                                     \
-   "fnclex"                                                             \
-   "fldcw   word ptr [eax]"                                             \
-   parm [eax]                                                           \
-   modify exact [];
-#if defined(NO_FAST_MATH)
-#define START_FAST_MATH(x)                                              \
-do {                                                                    \
-   static GLushort mask = DEFAULT_X86_FPU;                                 \
-   _watcom_start_fast_math(&x,&mask);                                   \
-} while (0)
-#else
-#define START_FAST_MATH(x)                                              \
-do {                                                                    \
-   static GLushort mask = FAST_X86_FPU;                                 \
-   _watcom_start_fast_math(&x,&mask);                                   \
-} while (0)
-#endif
-#define END_FAST_MATH(x)  _watcom_end_fast_math(&x)
-
-#elif defined(_MSC_VER) && defined(_M_IX86)
-#define DEFAULT_X86_FPU                0x037f /* See GCC comments above */
-#define FAST_X86_FPU           0x003f /* See GCC comments above */
-#if defined(NO_FAST_MATH)
-#define START_FAST_MATH(x) do {\
-       static GLuint mask = DEFAULT_X86_FPU;\
-       __asm fnstcw word ptr [x]\
-       __asm fldcw word ptr [mask]\
-} while(0)
-#else
-#define START_FAST_MATH(x) do {\
-       static GLuint mask = FAST_X86_FPU;\
-       __asm fnstcw word ptr [x]\
-       __asm fldcw word ptr [mask]\
-} while(0)
-#endif
-#define END_FAST_MATH(x) do {\
-       __asm fnclex\
-       __asm fldcw word ptr [x]\
-} while(0)
-
-#else
-#define START_FAST_MATH(x)  x = 0
-#define END_FAST_MATH(x)  (void)(x)
-#endif
-
-
 /**
  * Return 1 if this is a little endian machine, 0 if big endian.
  */
index 2630855a0eab022fe29bc9e1f7204249c4509b07..bfd740870ec7dd0263856dd3396c8469a6c576c5 100644 (file)
@@ -54,13 +54,16 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
 #define FLOAT_TO_BYTE(X)    ( (((GLint) (255.0F * (X))) - 1) / 2 )
 
 
-/** Convert GLushort in [0,65536] to GLfloat in [0.0,1.0] */
+/** Convert GLushort in [0,65535] to GLfloat in [0.0,1.0] */
 #define USHORT_TO_FLOAT(S)  ((GLfloat) (S) * (1.0F / 65535.0F))
 
+/** Convert GLfloat in [0.0,1.0] to GLushort in [0, 65535] */
+#define FLOAT_TO_USHORT(X)   ((GLuint) ((X) * 65535.0))
+
 /** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0] */
 #define SHORT_TO_FLOAT(S)   ((2.0F * (S) + 1.0F) * (1.0F/65535.0F))
 
-/** Convert GLfloat in [0.0,1.0] to GLshort in [-32768,32767] */
+/** Convert GLfloat in [-1.0,1.0] to GLshort in [-32768,32767] */
 #define FLOAT_TO_SHORT(X)   ( (((GLint) (65535.0F * (X))) - 1) / 2 )
 
 
index 0f96f949096ab4a6dff65d26a4807a90132d055f..aebf48134fd7d97e7f6f2662a008c706c97281cf 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.3
+ * Version:  7.5
  *
- * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 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"),
@@ -42,7 +43,6 @@
 #include "matrix.h"
 #include "mtypes.h"
 #include "math/m_matrix.h"
-#include "math/m_xform.h"
 
 
 /**
@@ -536,120 +536,6 @@ _mesa_MultTransposeMatrixdARB( const GLdouble *m )
 }
 #endif
 
-/**
- * Set the viewport.
- * 
- * \param x, y coordinates of the lower-left corner of the viewport rectangle.
- * \param width width of the viewport rectangle.
- * \param height height of the viewport rectangle.
- *
- * \sa Called via glViewport() or display list execution.
- *
- * Flushes the vertices and calls _mesa_set_viewport() with the given
- * parameters.
- */
-void GLAPIENTRY
-_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-   _mesa_set_viewport(ctx, x, y, width, height);
-}
-
-
-/**
- * Set new viewport parameters and update derived state (the _WindowMap
- * matrix).  Usually called from _mesa_Viewport().
- * 
- * \param ctx GL context.
- * \param x, y coordinates of the lower left corner of the viewport rectangle.
- * \param width width of the viewport rectangle.
- * \param height height of the viewport rectangle.
- */
-void
-_mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,
-                    GLsizei width, GLsizei height )
-{
-   if (MESA_VERBOSE & VERBOSE_API)
-      _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height);
-
-   if (width < 0 || height < 0) {
-      _mesa_error( ctx,  GL_INVALID_VALUE,
-                   "glViewport(%d, %d, %d, %d)", x, y, width, height );
-      return;
-   }
-
-   /* clamp width and height to the implementation dependent range */
-   width  = CLAMP(width,  1, (GLsizei) ctx->Const.MaxViewportWidth);
-   height = CLAMP(height, 1, (GLsizei) ctx->Const.MaxViewportHeight);
-
-   ctx->Viewport.X = x;
-   ctx->Viewport.Width = width;
-   ctx->Viewport.Y = y;
-   ctx->Viewport.Height = height;
-   ctx->NewState |= _NEW_VIEWPORT;
-
-#if 1
-   /* XXX remove this someday.  Currently the DRI drivers rely on
-    * the WindowMap matrix being up to date in the driver's Viewport
-    * and DepthRange functions.
-    */
-   _math_matrix_viewport(&ctx->Viewport._WindowMap,
-                         ctx->Viewport.X, ctx->Viewport.Y,
-                         ctx->Viewport.Width, ctx->Viewport.Height,
-                         ctx->Viewport.Near, ctx->Viewport.Far,
-                         ctx->DrawBuffer->_DepthMaxF);
-#endif
-
-   if (ctx->Driver.Viewport) {
-      /* Many drivers will use this call to check for window size changes
-       * and reallocate the z/stencil/accum/etc buffers if needed.
-       */
-      (*ctx->Driver.Viewport)( ctx, x, y, width, height );
-   }
-}
-
-
-#if _HAVE_FULL_GL
-/**
- * Called by glDepthRange
- *
- * \param nearval  specifies the Z buffer value which should correspond to
- *                 the near clip plane
- * \param farval  specifies the Z buffer value which should correspond to
- *                the far clip plane
- */
-void GLAPIENTRY
-_mesa_DepthRange( GLclampd nearval, GLclampd farval )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE&VERBOSE_API)
-      _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval);
-
-   ctx->Viewport.Near = (GLfloat) CLAMP( nearval, 0.0, 1.0 );
-   ctx->Viewport.Far = (GLfloat) CLAMP( farval, 0.0, 1.0 );
-   ctx->NewState |= _NEW_VIEWPORT;
-
-#if 1
-   /* XXX remove this someday.  Currently the DRI drivers rely on
-    * the WindowMap matrix being up to date in the driver's Viewport
-    * and DepthRange functions.
-    */
-   _math_matrix_viewport(&ctx->Viewport._WindowMap,
-                         ctx->Viewport.X, ctx->Viewport.Y,
-                         ctx->Viewport.Width, ctx->Viewport.Height,
-                         ctx->Viewport.Near, ctx->Viewport.Far,
-                         ctx->DrawBuffer->_DepthMaxF);
-#endif
-
-   if (ctx->Driver.DepthRange) {
-      (*ctx->Driver.DepthRange)( ctx, nearval, farval );
-   }
-}
-#endif
-
 
 
 /**********************************************************************/
@@ -893,41 +779,4 @@ void _mesa_init_transform( GLcontext *ctx )
 }
 
 
-/** 
- * Initialize the context viewport attribute group.
- *
- * \param ctx GL context.
- * 
- * \todo Move this to a new file with other 'viewport' routines.
- */
-void _mesa_init_viewport( GLcontext *ctx )
-{
-   GLfloat depthMax = 65535.0F; /* sorf of arbitrary */
-
-   /* Viewport group */
-   ctx->Viewport.X = 0;
-   ctx->Viewport.Y = 0;
-   ctx->Viewport.Width = 0;
-   ctx->Viewport.Height = 0;
-   ctx->Viewport.Near = 0.0;
-   ctx->Viewport.Far = 1.0;
-   _math_matrix_ctr(&ctx->Viewport._WindowMap);
-
-   _math_matrix_viewport(&ctx->Viewport._WindowMap, 0, 0, 0, 0,
-                         0.0F, 1.0F, depthMax);
-}
-
-
-/** 
- * Free the context viewport attribute group data.
- *
- * \param ctx GL context.
- * 
- * \todo Move this to a new file with other 'viewport' routines.
- */
-void _mesa_free_viewport_data( GLcontext *ctx )
-{
-   _math_matrix_dtr(&ctx->Viewport._WindowMap);
-}
-
 /*@}*/
index 38769867a757286177e8fa9cfbd414f14d791f8c..a53d1045c7dc582e5ec558b936ed491f40743e7a 100644 (file)
@@ -1,13 +1,9 @@
-/**
- * \file matrix.h
- * Matrix operations.
- */
-
 /*
  * Mesa 3-D graphics library
- * Version:  3.5
+ * Version:  7.5
  *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 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"),
@@ -99,15 +95,6 @@ _mesa_MultTransposeMatrixfARB( const GLfloat *m );
 extern void GLAPIENTRY
 _mesa_MultTransposeMatrixdARB( const GLdouble *m );
 
-extern void GLAPIENTRY
-_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height );
-
-extern void 
-_mesa_set_viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height );
-
-extern void GLAPIENTRY
-_mesa_DepthRange( GLclampd nearval, GLclampd farval );
-
 
 extern void 
 _mesa_init_matrix( GLcontext * ctx );
@@ -115,15 +102,9 @@ _mesa_init_matrix( GLcontext * ctx );
 extern void 
 _mesa_init_transform( GLcontext *ctx );
 
-extern void 
-_mesa_init_viewport( GLcontext *ctx );
-
 extern void
 _mesa_free_matrix_data( GLcontext *ctx );
 
-extern void 
-_mesa_free_viewport_data( GLcontext *ctx );
-
 extern void 
 _mesa_update_modelview_project( GLcontext *ctx, GLuint newstate );
 
index 8fb32dd7e941bd5b615d537d4788de4146cb1b69..f5706479423361fd9b95569a554923bf66efee93 100644 (file)
@@ -75,7 +75,6 @@
 #define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL
 #define FEATURE_EXT_timer_query  _HAVE_FULL_GL
 #define FEATURE_ATI_fragment_shader _HAVE_FULL_GL
-#define FEATURE_MESA_program_debug  _HAVE_FULL_GL
 #define FEATURE_NV_fence  _HAVE_FULL_GL
 #define FEATURE_NV_fragment_program  _HAVE_FULL_GL
 #define FEATURE_NV_vertex_program  _HAVE_FULL_GL
index 3dd4b3391b9b191af23cdb166bb33fa17d17346c..4a79430c34d39b82b2b25ac96326a9f565eb6c38 100644 (file)
@@ -85,7 +85,7 @@ bytes_per_pixel(GLenum datatype, GLuint comps)
                                 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] \
@@ -226,7 +226,6 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
          dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
       }
    }
-
    else if (datatype == GL_FLOAT && comps == 4) {
       GLuint i, j, k;
       const GLfloat(*rowA)[4] = (const GLfloat(*)[4]) srcRowA;
@@ -471,6 +470,17 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
          dst[i] = (blue << 5) | (green << 2) | red;
       }
    }
+   else if (datatype == GL_BYTE && comps == 2) {
+      GLuint i, j, k;
+      const GLbyte(*rowA)[2] = (const GLbyte(*)[2]) srcRowA;
+      const GLbyte(*rowB)[2] = (const GLbyte(*)[2]) srcRowB;
+      GLbyte(*dst)[2] = (GLbyte(*)[2]) dstRow;
+      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+           i++, j += colStride, k += colStride) {
+         dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) >> 2;
+         dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2;
+      }
+   }
    else {
       _mesa_problem(NULL, "bad format in do_row()");
    }
@@ -1176,7 +1186,7 @@ make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border,
 
 
 /**
- * \bugs
+ * \bug
  * There is quite a bit of refactoring that could be done with this function
  * and \c make_2d_mipmap.
  */
index be982afe39ce17a77d798c313ec65c3ccffbdc4d..52930094545b57f305871ec96bbc06f9b3f92c6c 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.3
+ * Version:  7.5
  *
- * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
- * Copyright (C) 1999-2008  VMware, Inc.  All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 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"),
  * Please try to mark derived values with a leading underscore ('_').
  */
 
-#ifndef TYPES_H
-#define TYPES_H
+#ifndef MTYPES_H
+#define MTYPES_H
 
 
-#include "glheader.h"
-#include <GL/internal/glcore.h>        /* __GLcontextModes (GLvisual) */
-#include "config.h"            /* Hardwired parameters */
+#include "main/glheader.h"
+#include "main/config.h"
+#include "main/compiler.h"
+#include "main/mfeatures.h"
 #include "glapi/glapi.h"
 #include "math/m_matrix.h"     /* GLmatrix */
-#include "bitset.h"
-
-
-/**
- * Special, internal token
- */
-#define GL_SHADER_PROGRAM_MESA 0x9999
 
 
 /**
 #endif
 
 
-/**
- * Fixed point data type.
- */
-typedef int GLfixed;
-/*
- * Fixed point arithmetic macros
- */
-#ifndef FIXED_FRAC_BITS
-#define FIXED_FRAC_BITS 11
-#endif
-
-#define FIXED_SHIFT     FIXED_FRAC_BITS
-#define FIXED_ONE       (1 << FIXED_SHIFT)
-#define FIXED_HALF      (1 << (FIXED_SHIFT-1))
-#define FIXED_FRAC_MASK (FIXED_ONE - 1)
-#define FIXED_INT_MASK  (~FIXED_FRAC_MASK)
-#define FIXED_EPSILON   1
-#define FIXED_SCALE     ((float) FIXED_ONE)
-#define FIXED_DBL_SCALE ((double) FIXED_ONE)
-#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
-#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
-#define IntToFixed(I)   ((I) << FIXED_SHIFT)
-#define FixedToInt(X)   ((X) >> FIXED_SHIFT)
-#define FixedToUns(X)   (((unsigned int)(X)) >> FIXED_SHIFT)
-#define FixedCeil(X)    (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
-#define FixedFloor(X)   ((X) & FIXED_INT_MASK)
-#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
-#define PosFloatToFixed(X)      FloatToFixed(X)
-#define SignedFloatToFixed(X)   FloatToFixed(X)
-
-
-
 /**
  * \name Some forward type declarations
  */
 /*@{*/
 struct _mesa_HashTable;
+struct gl_attrib_node;
 struct gl_pixelstore_attrib;
 struct gl_program_cache;
 struct gl_texture_format;
 struct gl_texture_image;
 struct gl_texture_object;
 struct st_context;
-struct pipe_surface;
 typedef struct __GLcontextRec GLcontext;
 typedef struct __GLcontextModesRec GLvisual;
 typedef struct gl_framebuffer GLframebuffer;
@@ -141,7 +103,7 @@ typedef struct gl_framebuffer GLframebuffer;
  * In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the
  * generic attributes are distinct/separate).
  */
-enum
+typedef enum
 {
    VERT_ATTRIB_POS = 0,
    VERT_ATTRIB_WEIGHT = 1,
@@ -177,7 +139,7 @@ enum
    VERT_ATTRIB_GENERIC14 = 30,
    VERT_ATTRIB_GENERIC15 = 31,
    VERT_ATTRIB_MAX = 32
-};
+} gl_vert_attrib;
 
 /**
  * Bitflags for vertex attributes.
@@ -225,32 +187,33 @@ enum
 /**
  * Indexes for vertex program result attributes
  */
-/*@{*/
-#define VERT_RESULT_HPOS 0
-#define VERT_RESULT_COL0 1
-#define VERT_RESULT_COL1 2
-#define VERT_RESULT_FOGC 3
-#define VERT_RESULT_TEX0 4
-#define VERT_RESULT_TEX1 5
-#define VERT_RESULT_TEX2 6
-#define VERT_RESULT_TEX3 7
-#define VERT_RESULT_TEX4 8
-#define VERT_RESULT_TEX5 9
-#define VERT_RESULT_TEX6 10
-#define VERT_RESULT_TEX7 11
-#define VERT_RESULT_PSIZ 12
-#define VERT_RESULT_BFC0 13
-#define VERT_RESULT_BFC1 14
-#define VERT_RESULT_EDGE 15
-#define VERT_RESULT_VAR0 16  /**< shader varying */
-#define VERT_RESULT_MAX  (VERT_RESULT_VAR0 + MAX_VARYING)
-/*@}*/
+typedef enum
+{
+   VERT_RESULT_HPOS = 0,
+   VERT_RESULT_COL0 = 1,
+   VERT_RESULT_COL1 = 2,
+   VERT_RESULT_FOGC = 3,
+   VERT_RESULT_TEX0 = 4,
+   VERT_RESULT_TEX1 = 5,
+   VERT_RESULT_TEX2 = 6,
+   VERT_RESULT_TEX3 = 7,
+   VERT_RESULT_TEX4 = 8,
+   VERT_RESULT_TEX5 = 9,
+   VERT_RESULT_TEX6 = 10,
+   VERT_RESULT_TEX7 = 11,
+   VERT_RESULT_PSIZ = 12,
+   VERT_RESULT_BFC0 = 13,
+   VERT_RESULT_BFC1 = 14,
+   VERT_RESULT_EDGE = 15,
+   VERT_RESULT_VAR0 = 16  /**< shader varying */,
+   VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING)
+} gl_vert_result;
 
 
 /**
  * Indexes for fragment program input attributes.
  */
-enum
+typedef enum
 {
    FRAG_ATTRIB_WPOS = 0,
    FRAG_ATTRIB_COL0 = 1,
@@ -266,7 +229,7 @@ enum
    FRAG_ATTRIB_TEX7 = 11,
    FRAG_ATTRIB_VAR0 = 12,  /**< shader varying */
    FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING)
-};
+} gl_frag_attrib;
 
 /**
  * Bitflags for fragment program input attributes.
@@ -303,41 +266,41 @@ enum
 /**
  * Fragment program results
  */
-enum
+typedef enum
 {
-   FRAG_RESULT_COLR = 0,
-   FRAG_RESULT_COLH = 1,
-   FRAG_RESULT_DEPR = 2,
-   FRAG_RESULT_DATA0 = 3,
+   FRAG_RESULT_DEPTH = 0,
+   FRAG_RESULT_COLOR = 1,
+   FRAG_RESULT_DATA0 = 2,
    FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
-};
+} gl_frag_result;
 
 
 /**
  * Indexes for all renderbuffers
  */
-enum {
-   BUFFER_FRONT_LEFT  = 0,  /* the four standard color buffers */
-   BUFFER_BACK_LEFT   = 1,
-   BUFFER_FRONT_RIGHT = 2,
-   BUFFER_BACK_RIGHT  = 3,
-   BUFFER_AUX0        = 4,  /* optional aux buffer */
-   BUFFER_AUX1        = 5,
-   BUFFER_AUX2        = 6,
-   BUFFER_AUX3        = 7,
-   BUFFER_DEPTH       = 8,
-   BUFFER_STENCIL     = 9,
-   BUFFER_ACCUM       = 10,
-   BUFFER_COLOR0      = 11, /* generic renderbuffers */
-   BUFFER_COLOR1      = 12,
-   BUFFER_COLOR2      = 13,
-   BUFFER_COLOR3      = 14,
-   BUFFER_COLOR4      = 15,
-   BUFFER_COLOR5      = 16,
-   BUFFER_COLOR6      = 17,
-   BUFFER_COLOR7      = 18,
-   BUFFER_COUNT       = 19
-};
+typedef enum
+{
+   /* the four standard color buffers */
+   BUFFER_FRONT_LEFT,
+   BUFFER_BACK_LEFT,
+   BUFFER_FRONT_RIGHT,
+   BUFFER_BACK_RIGHT,
+   BUFFER_DEPTH,
+   BUFFER_STENCIL,
+   BUFFER_ACCUM,
+   /* optional aux buffer */
+   BUFFER_AUX0,
+   /* generic renderbuffers */
+   BUFFER_COLOR0,
+   BUFFER_COLOR1,
+   BUFFER_COLOR2,
+   BUFFER_COLOR3,
+   BUFFER_COLOR4,
+   BUFFER_COLOR5,
+   BUFFER_COLOR6,
+   BUFFER_COLOR7,
+   BUFFER_COUNT
+} gl_buffer_index;
 
 /**
  * Bit flags for all renderbuffers
@@ -370,9 +333,6 @@ enum {
                             BUFFER_BIT_FRONT_RIGHT | \
                             BUFFER_BIT_BACK_RIGHT | \
                             BUFFER_BIT_AUX0 | \
-                            BUFFER_BIT_AUX1 | \
-                            BUFFER_BIT_AUX2 | \
-                            BUFFER_BIT_AUX3 | \
                             BUFFER_BIT_COLOR0 | \
                             BUFFER_BIT_COLOR1 | \
                             BUFFER_BIT_COLOR2 | \
@@ -384,12 +344,13 @@ enum {
 
 
 /** The pixel transfer path has three color tables: */
-/*@{*/
-#define COLORTABLE_PRECONVOLUTION  0
-#define COLORTABLE_POSTCONVOLUTION 1
-#define COLORTABLE_POSTCOLORMATRIX 2
-#define COLORTABLE_MAX 3
-/*@}*/
+typedef enum
+{
+   COLORTABLE_PRECONVOLUTION,
+   COLORTABLE_POSTCONVOLUTION,
+   COLORTABLE_POSTCOLORMATRIX,
+   COLORTABLE_MAX
+} gl_colortable_index;
 
 
 /**
@@ -626,9 +587,7 @@ struct gl_current_attrib
     * \note Index and Edgeflag current values are stored as floats in the 
     * SIX and SEVEN attribute slots.
     */
-   /*@{*/
    GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Position, color, texcoords, etc */
-   /*@}*/
 
    /**
     * \name Current raster position attributes (always valid).
@@ -660,84 +619,6 @@ struct gl_depthbuffer_attrib
 };
 
 
-/**
- * glEnable()/glDisable() attribute group (GL_ENABLE_BIT).
- */
-struct gl_enable_attrib
-{
-   GLboolean AlphaTest;
-   GLboolean AutoNormal;
-   GLboolean Blend;
-   GLbitfield ClipPlanes;
-   GLboolean ColorMaterial;
-   GLboolean ColorTable[COLORTABLE_MAX];
-   GLboolean Convolution1D;
-   GLboolean Convolution2D;
-   GLboolean Separable2D;
-   GLboolean CullFace;
-   GLboolean DepthTest;
-   GLboolean Dither;
-   GLboolean Fog;
-   GLboolean Histogram;
-   GLboolean Light[MAX_LIGHTS];
-   GLboolean Lighting;
-   GLboolean LineSmooth;
-   GLboolean LineStipple;
-   GLboolean IndexLogicOp;
-   GLboolean ColorLogicOp;
-   GLboolean Map1Color4;
-   GLboolean Map1Index;
-   GLboolean Map1Normal;
-   GLboolean Map1TextureCoord1;
-   GLboolean Map1TextureCoord2;
-   GLboolean Map1TextureCoord3;
-   GLboolean Map1TextureCoord4;
-   GLboolean Map1Vertex3;
-   GLboolean Map1Vertex4;
-   GLboolean Map1Attrib[16];  /* GL_NV_vertex_program */
-   GLboolean Map2Color4;
-   GLboolean Map2Index;
-   GLboolean Map2Normal;
-   GLboolean Map2TextureCoord1;
-   GLboolean Map2TextureCoord2;
-   GLboolean Map2TextureCoord3;
-   GLboolean Map2TextureCoord4;
-   GLboolean Map2Vertex3;
-   GLboolean Map2Vertex4;
-   GLboolean Map2Attrib[16];  /* GL_NV_vertex_program */
-   GLboolean MinMax;
-   GLboolean Normalize;
-   GLboolean PixelTexture;
-   GLboolean PointSmooth;
-   GLboolean PolygonOffsetPoint;
-   GLboolean PolygonOffsetLine;
-   GLboolean PolygonOffsetFill;
-   GLboolean PolygonSmooth;
-   GLboolean PolygonStipple;
-   GLboolean RescaleNormals;
-   GLboolean Scissor;
-   GLboolean Stencil;
-   GLboolean StencilTwoSide;          /* GL_EXT_stencil_two_side */
-   GLboolean MultisampleEnabled;      /* GL_ARB_multisample */
-   GLboolean SampleAlphaToCoverage;   /* GL_ARB_multisample */
-   GLboolean SampleAlphaToOne;        /* GL_ARB_multisample */
-   GLboolean SampleCoverage;          /* GL_ARB_multisample */
-   GLboolean SampleCoverageInvert;    /* GL_ARB_multisample */
-   GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */
-   GLuint Texture[MAX_TEXTURE_UNITS];
-   GLuint TexGen[MAX_TEXTURE_UNITS];
-   /* SGI_texture_color_table */
-   GLboolean TextureColorTable[MAX_TEXTURE_UNITS];
-   /* GL_ARB_vertex_program / GL_NV_vertex_program */
-   GLboolean VertexProgram;
-   GLboolean VertexProgramPointSize;
-   GLboolean VertexProgramTwoSide;
-   /* GL_ARB_point_sprite / GL_NV_point_sprite */
-   GLboolean PointSprite;
-   GLboolean FragmentShaderATI;
-};
-
-
 /**
  * Evaluator attribute group (GL_EVAL_BIT).
  */
@@ -825,11 +706,11 @@ struct gl_hint_attrib
  */
 struct gl_histogram_attrib
 {
-   GLuint Width;                               /**< number of table entries */
-   GLint Format;                               /**< GL_ALPHA, GL_RGB, etc */
-   GLuint Count[HISTOGRAM_TABLE_SIZE][4];      /**< the histogram */
-   GLboolean Sink;                             /**< terminate image transfer? */
-   GLubyte RedSize;                            /**< Bits per counter */
+   GLuint Width;                            /**< number of table entries */
+   GLint Format;                            /**< GL_ALPHA, GL_RGB, etc */
+   GLuint Count[HISTOGRAM_TABLE_SIZE][4];   /**< the histogram */
+   GLboolean Sink;                          /**< terminate image transfer? */
+   GLubyte RedSize;                         /**< Bits per counter */
    GLubyte GreenSize;
    GLubyte BlueSize;
    GLubyte AlphaSize;
@@ -1008,13 +889,15 @@ struct gl_pixel_attrib
    /*--- Begin Pixel Transfer State ---*/
    /* Fields are in the order in which they're applied... */
 
-   /* Scale & Bias (index shift, offset) */
+   /** Scale & Bias (index shift, offset) */
+   /*@{*/
    GLfloat RedBias, RedScale;
    GLfloat GreenBias, GreenScale;
    GLfloat BlueBias, BlueScale;
    GLfloat AlphaBias, AlphaScale;
    GLfloat DepthBias, DepthScale;
    GLint IndexShift, IndexOffset;
+   /*@}*/
 
    /* Pixel Maps */
    /* Note: actual pixel maps are not part of this attrib group */
@@ -1030,7 +913,7 @@ struct gl_pixel_attrib
    GLboolean Convolution1DEnabled;
    GLboolean Convolution2DEnabled;
    GLboolean Separable2DEnabled;
-   GLfloat ConvolutionBorderColor[3][4];
+   GLfloat ConvolutionBorderColor[3][4];  /**< RGBA */
    GLenum ConvolutionBorderMode[3];
    GLfloat ConvolutionFilterScale[3][4];  /**< RGBA */
    GLfloat ConvolutionFilterBias[3][4];   /**< RGBA */
@@ -1049,12 +932,12 @@ struct gl_pixel_attrib
 
    /*--- End Pixel Transfer State ---*/
 
-   /* Pixel Zoom */
+   /** glPixelZoom */
    GLfloat ZoomX, ZoomY;
 
    /** GL_SGI_texture_color_table */
-   GLfloat TextureColorTableScale[4];
-   GLfloat TextureColorTableBias[4];
+   GLfloat TextureColorTableScale[4]; /**< RGBA */
+   GLfloat TextureColorTableBias[4];  /**< RGBA */
 };
 
 
@@ -1129,8 +1012,9 @@ struct gl_stencil_attrib
    GLboolean Enabled;          /**< Enabled flag */
    GLboolean TestTwoSide;      /**< GL_EXT_stencil_two_side */
    GLubyte ActiveFace;         /**< GL_EXT_stencil_two_side (0 or 2) */
+   GLboolean _Enabled;          /**< Enabled and stencil buffer present */
    GLboolean _TestTwoSide;
-   GLubyte _BackFace;
+   GLubyte _BackFace;           /**< Current back stencil state (1 or 2) */
    GLenum Function[3];         /**< Stencil function */
    GLenum FailFunc[3];         /**< Fail function */
    GLenum ZPassFunc[3];                /**< Depth buffer pass function */
@@ -1142,34 +1026,36 @@ struct gl_stencil_attrib
 };
 
 
-/** 1D, 2D, 3D, CUBE, RECT, 1D_ARRAY, and 2D_ARRAY targets */
-#define NUM_TEXTURE_TARGETS 7
-
 /**
- * An index for each type of texture object
+ * An index for each type of texture object.  These correspond to the GL
+ * target target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc.
+ * Note: the order is from highest priority to lowest priority.
  */
-/*@{*/
-#define TEXTURE_1D_INDEX       0
-#define TEXTURE_2D_INDEX       1
-#define TEXTURE_3D_INDEX       2
-#define TEXTURE_CUBE_INDEX     3
-#define TEXTURE_RECT_INDEX     4
-#define TEXTURE_1D_ARRAY_INDEX 5
-#define TEXTURE_2D_ARRAY_INDEX 6
-/*@}*/
+typedef enum
+{
+   TEXTURE_2D_ARRAY_INDEX,
+   TEXTURE_1D_ARRAY_INDEX,
+   TEXTURE_CUBE_INDEX,
+   TEXTURE_3D_INDEX,
+   TEXTURE_RECT_INDEX,
+   TEXTURE_2D_INDEX,
+   TEXTURE_1D_INDEX,
+   NUM_TEXTURE_TARGETS
+} gl_texture_index;
+
 
 /**
  * Bit flags for each type of texture object
  * Used for Texture.Unit[]._ReallyEnabled flags.
  */
 /*@{*/
-#define TEXTURE_1D_BIT       (1 << TEXTURE_1D_INDEX)
-#define TEXTURE_2D_BIT       (1 << TEXTURE_2D_INDEX)
-#define TEXTURE_3D_BIT       (1 << TEXTURE_3D_INDEX)
+#define TEXTURE_2D_ARRAY_BIT (1 << TEXTURE_2D_ARRAY_INDEX)
+#define TEXTURE_1D_ARRAY_BIT (1 << TEXTURE_1D_ARRAY_INDEX)
 #define TEXTURE_CUBE_BIT     (1 << TEXTURE_CUBE_INDEX)
+#define TEXTURE_3D_BIT       (1 << TEXTURE_3D_INDEX)
 #define TEXTURE_RECT_BIT     (1 << TEXTURE_RECT_INDEX)
-#define TEXTURE_1D_ARRAY_BIT (1 << TEXTURE_1D_ARRAY_INDEX)
-#define TEXTURE_2D_ARRAY_BIT (1 << TEXTURE_2D_ARRAY_INDEX)
+#define TEXTURE_2D_BIT       (1 << TEXTURE_2D_INDEX)
+#define TEXTURE_1D_BIT       (1 << TEXTURE_1D_INDEX)
 /*@}*/
 
 
@@ -1204,27 +1090,12 @@ struct gl_stencil_attrib
 /*@}*/
 
 
-/* A selection of state flags to make driver and module's lives easier. */
-#define ENABLE_TEXGEN0        0x1
-#define ENABLE_TEXGEN1        0x2
-#define ENABLE_TEXGEN2        0x4
-#define ENABLE_TEXGEN3        0x8
-#define ENABLE_TEXGEN4        0x10
-#define ENABLE_TEXGEN5        0x20
-#define ENABLE_TEXGEN6        0x40
-#define ENABLE_TEXGEN7        0x80
 
-#define ENABLE_TEXMAT0        0x1      /* Ie. not the identity matrix */
-#define ENABLE_TEXMAT1        0x2
-#define ENABLE_TEXMAT2        0x4
-#define ENABLE_TEXMAT3        0x8
-#define ENABLE_TEXMAT4        0x10
-#define ENABLE_TEXMAT5        0x20
-#define ENABLE_TEXMAT6        0x40
-#define ENABLE_TEXMAT7        0x80
+/** Tex-gen enabled for texture unit? */
+#define ENABLE_TEXGEN(unit) (1 << (unit))
 
-#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
-#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
+/** Non-identity texture matrix for texture unit? */
+#define ENABLE_TEXMAT(unit) (1 << (unit))
 
 
 /**
@@ -1400,15 +1271,16 @@ struct gl_texture_image
 /**
  * Indexes for cube map faces.
  */
-/*@{*/
-#define FACE_POS_X   0
-#define FACE_NEG_X   1
-#define FACE_POS_Y   2
-#define FACE_NEG_Y   3
-#define FACE_POS_Z   4
-#define FACE_NEG_Z   5
-#define MAX_FACES    6
-/*@}*/
+typedef enum
+{
+   FACE_POS_X = 0,
+   FACE_NEG_X = 1,
+   FACE_POS_Y = 2,
+   FACE_NEG_Y = 3,
+   FACE_POS_Z = 4,
+   FACE_NEG_Z = 5,
+   MAX_FACES = 6
+} gl_face_index;
 
 
 /**
@@ -1439,10 +1311,6 @@ struct gl_texture_object
    GLenum CompareMode;         /**< GL_ARB_shadow */
    GLenum CompareFunc;         /**< GL_ARB_shadow */
    GLfloat CompareFailValue;    /**< GL_ARB_shadow_ambient */
-   GLenum _Function;           /**< Comparison function derived from 
-                                * \c CompareOperator, \c CompareMode, and
-                                * \c CompareFunc.
-                                */
    GLenum DepthMode;           /**< GL_ARB_depth_texture */
    GLint _MaxLevel;            /**< actual max mipmap level (q in the spec) */
    GLfloat _MaxLambda;         /**< = _MaxLevel - BaseLevel (q - b in spec) */
@@ -1489,6 +1357,18 @@ struct gl_tex_env_combine_state
 };
 
 
+/**
+ * Texture coord generation state.
+ */
+struct gl_texgen
+{
+   GLenum Mode;         /**< GL_EYE_LINEAR, GL_SPHERE_MAP, etc */
+   GLbitfield _ModeBit; /**< TEXGEN_x bit corresponding to Mode */
+   GLfloat ObjectPlane[4];
+   GLfloat EyePlane[4];
+};
+
+
 /**
  * Texture unit state.  Contains enable flags, texture environment/function/
  * combiners, texgen state, pointers to current texture objects and
@@ -1501,29 +1381,17 @@ struct gl_texture_unit
 
    GLenum EnvMode;              /**< GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
    GLfloat EnvColor[4];
+
+   struct gl_texgen GenS;
+   struct gl_texgen GenT;
+   struct gl_texgen GenR;
+   struct gl_texgen GenQ;
    GLbitfield TexGenEnabled;   /**< Bitwise-OR of [STRQ]_BIT values */
-   /** \name Tex coord generation mode
-    * Either GL_OBJECT_LINEAR, GL_EYE_LINEAR or GL_SPHERE_MAP. */
-   /*@{*/
-   GLenum GenModeS;            
-   GLenum GenModeT;
-   GLenum GenModeR;
-   GLenum GenModeQ;
-   /*@}*/
-   GLbitfield _GenBitS;
-   GLbitfield _GenBitT;
-   GLbitfield _GenBitR;
-   GLbitfield _GenBitQ;
-   GLbitfield _GenFlags;       /**< bitwise or of _GenBit[STRQ] */
-   GLfloat ObjectPlaneS[4];
-   GLfloat ObjectPlaneT[4];
-   GLfloat ObjectPlaneR[4];
-   GLfloat ObjectPlaneQ[4];
-   GLfloat EyePlaneS[4];
-   GLfloat EyePlaneT[4];
-   GLfloat EyePlaneR[4];
-   GLfloat EyePlaneQ[4];
+   GLbitfield _GenFlags;       /**< Bitwise-OR of Gen[STRQ]._ModeBit */
+
    GLfloat LodBias;            /**< for biasing mipmap levels */
+   GLenum BumpTarget;
+   GLfloat RotMatrix[4]; /* 2x2 matrix */
 
    /** 
     * \name GL_EXT_texture_env_combine 
@@ -1542,15 +1410,11 @@ struct gl_texture_unit
     */
    struct gl_tex_env_combine_state *_CurrentCombine;
 
-   struct gl_texture_object *Current1D;
-   struct gl_texture_object *Current2D;
-   struct gl_texture_object *Current3D;
-   struct gl_texture_object *CurrentCubeMap; /**< GL_ARB_texture_cube_map */
-   struct gl_texture_object *CurrentRect;    /**< GL_NV_texture_rectangle */
-   struct gl_texture_object *Current1DArray; /**< GL_MESA_texture_array */
-   struct gl_texture_object *Current2DArray; /**< GL_MESA_texture_array */
+   /** Current texture object pointers */
+   struct gl_texture_object *CurrentTex[NUM_TEXTURE_TARGETS];
 
-   struct gl_texture_object *_Current; /**< Points to really enabled tex obj */
+   /** Points to highest priority, complete and enabled texture object */
+   struct gl_texture_object *_Current;
 
    /** GL_SGI_texture_color_table */
    /*@{*/
@@ -1561,24 +1425,12 @@ struct gl_texture_unit
 };
 
 
-
 /**
  * Texture attribute group (GL_TEXTURE_BIT).
  */
 struct gl_texture_attrib
 {
-   /**
-    * name multitexture 
-    */
-   /**@{*/
-   GLuint CurrentUnit;   /**< Active texture unit [0, MaxTextureImageUnits-1] */
-   GLbitfield _EnabledUnits;  /**< one bit set for each really-enabled unit */
-   GLbitfield _EnabledCoordUnits;   /**< one bit per enabled coordinate unit */
-   GLbitfield _GenFlags;            /**< for texgen */
-   GLbitfield _TexGenEnabled;
-   GLbitfield _TexMatEnabled;
-   /**@}*/
-
+   GLuint CurrentUnit;   /**< GL_ACTIVE_TEXTURE */
    struct gl_texture_unit Unit[MAX_TEXTURE_UNITS];
 
    struct gl_texture_object *ProxyTex[NUM_TEXTURE_TARGETS];
@@ -1586,6 +1438,21 @@ struct gl_texture_attrib
    /** GL_EXT_shared_texture_palette */
    GLboolean SharedPalette;
    struct gl_color_table Palette;
+
+   /** Texture units/samplers used by vertex or fragment texturing */
+   GLbitfield _EnabledUnits;
+
+   /** Texture coord units/sets used for fragment texturing */
+   GLbitfield _EnabledCoordUnits;
+
+   /** Texture coord units that have texgen enabled */
+   GLbitfield _TexGenEnabled;
+
+   /** Texture coord units that have non-identity matrices */
+   GLbitfield _TexMatEnabled;
+
+   /** Bitwise-OR of all Texture.Unit[i]._GenFlags */
+   GLbitfield _GenFlags;
 };
 
 
@@ -1620,17 +1487,6 @@ struct gl_viewport_attrib
 };
 
 
-/**
- * Node for the attribute stack.
- */
-struct gl_attrib_node
-{
-   GLbitfield kind;
-   void *data;
-   struct gl_attrib_node *next;
-};
-
-
 /**
  * GL_ARB_vertex/pixel_buffer_object buffer object
  */
@@ -1641,13 +1497,14 @@ struct gl_buffer_object
    GLenum Usage;
    GLenum Access;
    GLvoid *Pointer;          /**< Only valid while buffer is mapped */
+   GLintptr Offset;          /**< mapped offset */
+   GLsizeiptr Length;        /**< mapped length */
    GLsizeiptrARB Size;       /**< Size of storage in bytes */
    GLubyte *Data;            /**< Location of storage either in RAM or VRAM. */
    GLboolean OnCard;         /**< Is buffer in VRAM? (hardware drivers) */
 };
 
 
-
 /**
  * Client pixel packing/unpacking attributes
  */
@@ -1657,8 +1514,8 @@ struct gl_pixelstore_attrib
    GLint RowLength;
    GLint SkipPixels;
    GLint SkipRows;
-   GLint ImageHeight;     /**< for GL_EXT_texture3D */
-   GLint SkipImages;      /**< for GL_EXT_texture3D */
+   GLint ImageHeight;
+   GLint SkipImages;
    GLboolean SwapBytes;
    GLboolean LsbFirst;
    GLboolean ClientStorage; /**< GL_APPLE_client_storage */
@@ -1667,7 +1524,6 @@ struct gl_pixelstore_attrib
 };
 
 
-
 /**
  * Client vertex array attributes
  */
@@ -1747,7 +1603,7 @@ struct gl_array_attrib
 struct gl_feedback
 {
    GLenum Type;
-   GLbitfield _Mask;           /* FB_* bits */
+   GLbitfield _Mask;    /**< FB_* bits */
    GLfloat *Buffer;
    GLuint BufferSize;
    GLuint Count;
@@ -1845,24 +1701,24 @@ struct gl_evaluators
  * be "uniform" variables since they can only be set outside glBegin/End.
  * They're also all stored in the same Parameters array.
  */
-enum register_file
-{
-   PROGRAM_TEMPORARY = 0,   /**< machine->Temporary[] */
-   PROGRAM_LOCAL_PARAM = 1, /**< gl_program->LocalParams[] */
-   PROGRAM_ENV_PARAM = 2,   /**< gl_program->Parameters[] */
-   PROGRAM_STATE_VAR = 3,   /**< gl_program->Parameters[] */
-   PROGRAM_INPUT = 4,       /**< machine->Inputs[] */
-   PROGRAM_OUTPUT = 5,      /**< machine->Outputs[] */
-   PROGRAM_NAMED_PARAM = 6, /**< gl_program->Parameters[] */
-   PROGRAM_CONSTANT = 7,    /**< gl_program->Parameters[] */
-   PROGRAM_UNIFORM = 8,     /**< gl_program->Parameters[] */
-   PROGRAM_VARYING = 9,     /**< machine->Inputs[]/Outputs[] */
-   PROGRAM_WRITE_ONLY = 10, /**< A dummy, write-only register */
-   PROGRAM_ADDRESS = 11,    /**< machine->AddressReg */
-   PROGRAM_SAMPLER = 12,    /**< for shader samplers, compile-time only */
-   PROGRAM_UNDEFINED = 13,  /**< Invalid value */
+typedef enum
+{
+   PROGRAM_TEMPORARY,   /**< machine->Temporary[] */
+   PROGRAM_INPUT,       /**< machine->Inputs[] */
+   PROGRAM_OUTPUT,      /**< machine->Outputs[] */
+   PROGRAM_VARYING,     /**< machine->Inputs[]/Outputs[] */
+   PROGRAM_LOCAL_PARAM, /**< gl_program->LocalParams[] */
+   PROGRAM_ENV_PARAM,   /**< gl_program->Parameters[] */
+   PROGRAM_STATE_VAR,   /**< gl_program->Parameters[] */
+   PROGRAM_NAMED_PARAM, /**< gl_program->Parameters[] */
+   PROGRAM_CONSTANT,    /**< gl_program->Parameters[] */
+   PROGRAM_UNIFORM,     /**< gl_program->Parameters[] */
+   PROGRAM_WRITE_ONLY /**< A dummy, write-only register */
+   PROGRAM_ADDRESS    /**< machine->AddressReg */
+   PROGRAM_SAMPLER    /**< for shader samplers, compile-time only */
+   PROGRAM_UNDEFINED,   /**< Invalid/TBD value */
    PROGRAM_FILE_MAX
-};
+} gl_register_file;
 
 
 /** Vertex and fragment instructions */
@@ -1971,14 +1827,14 @@ struct gl_program_state
  */
 struct gl_vertex_program_state
 {
-   GLboolean Enabled;               /**< User-set GL_VERTEX_PROGRAM_ARB/NV flag */
-   GLboolean _Enabled;              /**< Enabled and _valid_ user program? */
-   GLboolean PointSizeEnabled;      /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
-   GLboolean TwoSideEnabled;        /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
+   GLboolean Enabled;            /**< User-set GL_VERTEX_PROGRAM_ARB/NV flag */
+   GLboolean _Enabled;           /**< Enabled and _valid_ user program? */
+   GLboolean PointSizeEnabled;   /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
+   GLboolean TwoSideEnabled;     /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
    struct gl_vertex_program *Current;  /**< User-bound vertex program */
 
-   /** Currently enabled and valid vertex program (including internal programs,
-    * user-defined vertex programs and GLSL vertex shaders).
+   /** Currently enabled and valid vertex program (including internal
+    * programs, user-defined vertex programs and GLSL vertex shaders).
     * This is the program we must use when rendering.
     */
    struct gl_vertex_program *_Current;
@@ -1998,13 +1854,6 @@ struct gl_vertex_program_state
    /** Cache of fixed-function programs */
    struct gl_program_cache *Cache;
 
-#if FEATURE_MESA_program_debug
-   GLprogramcallbackMESA Callback;
-   GLvoid *CallbackData;
-   GLboolean CallbackEnabled;
-   GLuint CurrentPosition;
-#endif
-
    GLboolean _Overriden;
 };
 
@@ -2018,8 +1867,8 @@ struct gl_fragment_program_state
    GLboolean _Enabled;    /**< Enabled and _valid_ user program? */
    struct gl_fragment_program *Current;  /**< User-bound fragment program */
 
-   /** Currently enabled and valid fragment program (including internal programs,
-    * user-defined fragment programs and GLSL fragment shaders).
+   /** Currently enabled and valid fragment program (including internal
+    * programs, user-defined fragment programs and GLSL fragment shaders).
     * This is the program we must use when rendering.
     */
    struct gl_fragment_program *_Current;
@@ -2034,13 +1883,6 @@ struct gl_fragment_program_state
 
    /** Cache of fixed-function programs */
    struct gl_program_cache *Cache;
-
-#if FEATURE_MESA_program_debug
-   GLprogramcallbackMESA Callback;
-   GLvoid *CallbackData;
-   GLboolean CallbackEnabled;
-   GLuint CurrentPosition;
-#endif
 };
 
 
@@ -2114,6 +1956,8 @@ struct gl_query_state
 /** Set by #pragma directives */
 struct gl_sl_pragmas
 {
+   GLboolean IgnoreOptimize;  /**< ignore #pragma optimize(on/off) ? */
+   GLboolean IgnoreDebug;     /**< ignore #pragma debug(on/off) ? */
    GLboolean Optimize;  /**< defaults on */
    GLboolean Debug;     /**< defaults off */
 };
@@ -2184,6 +2028,7 @@ struct gl_shader_state
    GLboolean EmitComments;              /**< Annotated instructions */
    void *MemPool;
    GLbitfield Flags;                    /**< Mask of GLSL_x flags */
+   struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */
 };
 
 
@@ -2197,18 +2042,8 @@ struct gl_shared_state
    struct _mesa_HashTable *DisplayList;           /**< Display lists hash table */
    struct _mesa_HashTable *TexObjects;    /**< Texture objects hash table */
 
-   /**
-    * \name Default texture objects (shared by all multi-texture units)
-    */
-   /*@{*/
-   struct gl_texture_object *Default1D;
-   struct gl_texture_object *Default2D;
-   struct gl_texture_object *Default3D;
-   struct gl_texture_object *DefaultCubeMap;
-   struct gl_texture_object *DefaultRect;
-   struct gl_texture_object *Default1DArray;
-   struct gl_texture_object *Default2DArray;
-   /*@}*/
+   /** Default texture objects (shared by all texture units) */
+   struct gl_texture_object *DefaultTex[NUM_TEXTURE_TARGETS];
 
    /**
     * \name Thread safety and statechange notification for texture
@@ -2372,9 +2207,8 @@ struct gl_renderbuffer
 
 
 /**
- * A renderbuffer attachment point points to either a texture object
- * (and specifies a mipmap level, cube face or 3D texture slice) or
- * points to a renderbuffer.
+ * A renderbuffer attachment points to either a texture object (and specifies
+ * a mipmap level, cube face or 3D texture slice) or points to a renderbuffer.
  */
 struct gl_renderbuffer_attachment
 {
@@ -2406,14 +2240,24 @@ struct gl_renderbuffer_attachment
  */
 struct gl_framebuffer
 {
-   _glthread_Mutex Mutex;                 /**< for thread safety */
-   GLuint Name;      /* if zero, this is a window system framebuffer */
+   _glthread_Mutex Mutex;  /**< for thread safety */
+   /**
+    * If zero, this is a window system framebuffer.  If non-zero, this
+    * is a FBO framebuffer; note that for some devices (i.e. those with
+    * a natural pixel coordinate system for FBOs that differs from the
+    * OpenGL/Mesa coordinate system), this means that the viewport,
+    * polygon face orientation, and polygon stipple will have to be inverted.
+    */
+   GLuint Name;
+
    GLint RefCount;
    GLboolean DeletePending;
 
-   GLvisual Visual;    /**< The framebuffer's visual.
-                             Immutable if this is a window system buffer.
-                             Computed from attachments if user-made FBO. */
+   /**
+    * The framebuffer's visual. Immutable if this is a window system buffer.
+    * Computed from attachments if user-made FBO.
+    */
+   GLvisual Visual;
 
    GLboolean Initialized;
 
@@ -2432,9 +2276,10 @@ struct gl_framebuffer
    GLfloat _MRD;       /**< minimum resolvable difference in Z values */
    /*@}*/
 
-   GLenum _Status; /* One of the GL_FRAMEBUFFER_(IN)COMPLETE_* tokens */
+   /** One of the GL_FRAMEBUFFER_(IN)COMPLETE_* tokens */
+   GLenum _Status;
 
-   /* Array of all renderbuffer attachments, indexed by BUFFER_* tokens. */
+   /** Array of all renderbuffer attachments, indexed by BUFFER_* tokens. */
    struct gl_renderbuffer_attachment Attachment[BUFFER_COUNT];
 
    /* In unextended OpenGL these vars are part of the GL_COLOR_BUFFER
@@ -2496,52 +2341,60 @@ struct gl_program_constants
  */
 struct gl_constants
 {
-   GLint MaxTextureLevels;             /**< Maximum number of allowed mipmap levels. */ 
-   GLint Max3DTextureLevels;           /**< Maximum number of allowed mipmap levels for 3D texture targets. */
-   GLint MaxCubeTextureLevels;          /**< Maximum number of allowed mipmap levels for GL_ARB_texture_cube_map */
-   GLint MaxArrayTextureLayers;         /**< Maximum number of layers in an array texture. */
-   GLint MaxTextureRectSize;            /* GL_NV_texture_rectangle */
+   GLint MaxTextureLevels;      /**< Max mipmap levels. */ 
+   GLint Max3DTextureLevels;    /**< Max mipmap levels for 3D textures */
+   GLint MaxCubeTextureLevels;  /**< Max mipmap levels for cube textures */
+   GLint MaxArrayTextureLayers; /**< Max layers in array textures */
+   GLint MaxTextureRectSize;    /**< Max rectangle texture size, in pixes */
    GLuint MaxTextureCoordUnits;
    GLuint MaxTextureImageUnits;
-   GLuint MaxTextureUnits;              /**< = MIN(CoordUnits, ImageUnits) */
-   GLfloat MaxTextureMaxAnisotropy;     /**< GL_EXT_texture_filter_anisotropic */
-   GLfloat MaxTextureLodBias;           /**< GL_EXT_texture_lod_bias */
+   GLuint MaxVertexTextureImageUnits;
+   GLuint MaxTextureUnits;           /**< = MIN(CoordUnits, ImageUnits) */
+   GLfloat MaxTextureMaxAnisotropy;  /**< GL_EXT_texture_filter_anisotropic */
+   GLfloat MaxTextureLodBias;        /**< GL_EXT_texture_lod_bias */
+
    GLuint MaxArrayLockSize;
+
    GLint SubPixelBits;
-   GLfloat MinPointSize, MaxPointSize;         /* aliased */
-   GLfloat MinPointSizeAA, MaxPointSizeAA;     /* antialiased */
+
+   GLfloat MinPointSize, MaxPointSize;      /**< aliased */
+   GLfloat MinPointSizeAA, MaxPointSizeAA;   /**< antialiased */
    GLfloat PointSizeGranularity;
-   GLfloat MinLineWidth, MaxLineWidth;         /* aliased */
-   GLfloat MinLineWidthAA, MaxLineWidthAA;     /* antialiased */
+   GLfloat MinLineWidth, MaxLineWidth;       /**< aliased */
+   GLfloat MinLineWidthAA, MaxLineWidthAA;   /**< antialiased */
    GLfloat LineWidthGranularity;
+
    GLuint MaxColorTableSize;
    GLuint MaxConvolutionWidth;
    GLuint MaxConvolutionHeight;
+
    GLuint MaxClipPlanes;
    GLuint MaxLights;
-   GLfloat MaxShininess;                       /* GL_NV_light_max_exponent */
-   GLfloat MaxSpotExponent;                    /* GL_NV_light_max_exponent */
+   GLfloat MaxShininess;                     /**< GL_NV_light_max_exponent */
+   GLfloat MaxSpotExponent;                  /**< GL_NV_light_max_exponent */
+
    GLuint MaxViewportWidth, MaxViewportHeight;
-   struct gl_program_constants VertexProgram;    /* GL_ARB_vertex_program */
-   struct gl_program_constants FragmentProgram;  /* GL_ARB_fragment_program */
-   /* shared by vertex and fragment program: */
+
+   struct gl_program_constants VertexProgram;   /**< GL_ARB_vertex_program */
+   struct gl_program_constants FragmentProgram; /**< GL_ARB_fragment_program */
    GLuint MaxProgramMatrices;
    GLuint MaxProgramMatrixStackDepth;
-   /* vertex array / buffer object bounds checking */
+
+   /** vertex array / buffer object bounds checking */
    GLboolean CheckArrayBounds;
-   /* GL_ARB_draw_buffers */
-   GLuint MaxDrawBuffers;
-   /* GL_OES_read_format */
-   GLenum ColorReadFormat;
-   GLenum ColorReadType;
-   /* GL_EXT_framebuffer_object */
-   GLuint MaxColorAttachments;
-   GLuint MaxRenderbufferSize;
-   /* GL_ARB_vertex_shader */
-   GLuint MaxVertexTextureImageUnits;
-   GLuint MaxVarying;  /**< Number of float[4] vectors */
-   /* GL_ARB_framebuffer_object */
-   GLuint MaxSamples;
+
+   GLuint MaxDrawBuffers;    /**< GL_ARB_draw_buffers */
+
+   GLenum ColorReadFormat;   /**< GL_OES_read_format */
+   GLenum ColorReadType;     /**< GL_OES_read_format */
+
+   GLuint MaxColorAttachments;   /**< GL_EXT_framebuffer_object */
+   GLuint MaxRenderbufferSize;   /**< GL_EXT_framebuffer_object */
+   GLuint MaxSamples;            /**< GL_ARB_framebuffer_object */
+
+   GLuint MaxVarying;  /**< Number of float[4] varying parameters */
+
+   GLbitfield SupportedBumpUnits; /**> units supporting GL_ATI_envmap_bumpmap as targets */
 };
 
 
@@ -2551,12 +2404,6 @@ struct gl_constants
  */
 struct gl_extensions
 {
-   /**
-    * \name Flags to quickly test if certain extensions are available.
-    * 
-    * Not every extension needs to have such a flag, but it's encouraged.
-    */
-   /*@{*/
    GLboolean dummy;  /* don't remove this! */
    GLboolean ARB_depth_texture;
    GLboolean ARB_draw_buffers;
@@ -2644,6 +2491,7 @@ struct gl_extensions
    GLboolean APPLE_client_storage;
    GLboolean APPLE_packed_pixels;
    GLboolean APPLE_vertex_array_object;
+   GLboolean ATI_envmap_bumpmap;
    GLboolean ATI_texture_mirror_once;
    GLboolean ATI_texture_env_combine3;
    GLboolean ATI_fragment_shader;
@@ -2652,7 +2500,6 @@ struct gl_extensions
    GLboolean IBM_multimode_draw_arrays;
    GLboolean MESA_pack_invert;
    GLboolean MESA_packed_depth_stencil;
-   GLboolean MESA_program_debug;
    GLboolean MESA_resize_buffers;
    GLboolean MESA_ycbcr_texture;
    GLboolean MESA_texture_array;
@@ -2674,8 +2521,7 @@ struct gl_extensions
    GLboolean SGIS_texture_lod;
    GLboolean TDFX_texture_compression_FXT1;
    GLboolean S3_s3tc;
-   /*@}*/
-   /* The extension string */
+   /** The extension string */
    const GLubyte *String;
 };
 
@@ -2695,7 +2541,6 @@ struct gl_matrix_stack
 
 /**
  * \name Bits for image transfer operations 
- *
  * \sa __GLcontextRec::ImageTransferState.
  */
 /*@{*/
@@ -2710,7 +2555,7 @@ struct gl_matrix_stack
 #define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT   0x100
 #define IMAGE_HISTOGRAM_BIT                       0x200
 #define IMAGE_MIN_MAX_BIT                         0x400
-#define IMAGE_CLAMP_BIT                           0x800 /* extra */
+#define IMAGE_CLAMP_BIT                           0x800
 
 
 /** Pixel Transfer ops up to convolution */
@@ -3073,21 +2918,15 @@ struct __GLcontextRec
 
    struct gl_color_table ColorTable[COLORTABLE_MAX];
    struct gl_color_table ProxyColorTable[COLORTABLE_MAX];
-#if 0
-   struct gl_color_table PostConvolutionColorTable;
-   struct gl_color_table ProxyPostConvolutionColorTable;
-   struct gl_color_table PostColorMatrixColorTable;
-   struct gl_color_table ProxyPostColorMatrixColorTable;
-#endif
 
-   struct gl_program_state Program;        /**< for vertex or fragment progs */
-   struct gl_vertex_program_state VertexProgram;   /**< GL_ARB/NV_vertex_program */
-   struct gl_fragment_program_state FragmentProgram;  /**< GL_ARB/NV_vertex_program */
-   struct gl_ati_fragment_shader_state ATIFragmentShader;  /**< GL_ATI_fragment_shader */
-
-   struct gl_query_state Query;  /**< GL_ARB_occlusion_query */
+   struct gl_program_state Program;  /**< general program state */
+   struct gl_vertex_program_state VertexProgram;
+   struct gl_fragment_program_state FragmentProgram;
+   struct gl_ati_fragment_shader_state ATIFragmentShader;
 
    struct gl_shader_state Shader; /**< GLSL shader object state */
+
+   struct gl_query_state Query;  /**< occlusion, timer queries */
    /*@}*/
 
 #if FEATURE_EXT_framebuffer_object
@@ -3111,9 +2950,8 @@ struct __GLcontextRec
    GLfloat _ModelViewInvScale;
    GLboolean _NeedEyeCoords;
    GLboolean _ForceEyeCoords; 
-   GLenum _CurrentProgram;    /* currently executing program */
 
-   GLuint TextureStateTimestamp; /* detect changes to shared state */
+   GLuint TextureStateTimestamp; /**< detect changes to shared state */
 
    struct gl_shine_tab *_ShineTable[2]; /**< Active shine tables */
    struct gl_shine_tab *_ShineTabList;  /**< MRU list of inactive shine tables */
@@ -3193,7 +3031,4 @@ enum _debug
 
 
 
-#define Elements(x) sizeof(x)/sizeof(*(x))
-
-
-#endif /* TYPES_H */
+#endif /* MTYPES_H */
index 7491d00c3577c1f3453b87ba792ca73ac032a70a..be93b45a7dad9906ca457df92c97c2aff73c5446 100644 (file)
@@ -374,6 +374,43 @@ _mesa_LinkProgramARB(GLhandleARB programObj)
 }
 
 
+
+/**
+ * Read shader source code from a file.
+ * Useful for debugging to override an app's shader.
+ */
+static GLcharARB *
+_mesa_read_shader(const char *fname)
+{
+   const int max = 50*1000;
+   FILE *f = fopen(fname, "r");
+   GLcharARB *buffer, *shader;
+   int len;
+
+   if (!f) {
+      _mesa_fprintf(stderr, "Unable to open shader file %s\n", fname);
+      return NULL;
+   }
+
+   buffer = (char *) malloc(max);
+   len = fread(buffer, 1, max, f);
+   buffer[len] = 0;
+
+   fclose(f);
+
+   shader = _mesa_strdup(buffer);
+   free(buffer);
+
+   if (0) {
+      _mesa_fprintf(stderr, "Read shader %s:\n", fname);
+      _mesa_fprintf(stderr, "%s\n", shader);
+   }
+
+   return shader;
+}
+
+
+
 /**
  * Called via glShaderSource() and glShaderSourceARB() API functions.
  * Basically, concatenate the source code strings into one long string
@@ -438,6 +475,20 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
    source[totalLength - 1] = '\0';
    source[totalLength - 2] = '\0';
 
+#if 0
+   if (0) {
+      GLcharARB *newSource;
+
+      newSource = _mesa_read_shader("newshader.frag");
+      if (newSource) {
+         _mesa_free(source);
+         source = newSource;
+      }
+   }
+#else
+   (void) _mesa_read_shader;
+#endif
+
    ctx->Driver.ShaderSource(ctx, shaderObj, source);
 
    _mesa_free(offsets);
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
new file mode 100644 (file)
index 0000000..fa45e46
--- /dev/null
@@ -0,0 +1,356 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 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, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file shared.c
+ * Shared-context state
+ */
+
+
+
+#include "imports.h"
+#include "mtypes.h"
+#include "hash.h"
+#include "arrayobj.h"
+#include "shared.h"
+#include "shader/program.h"
+#include "shader/shader_api.h"
+#if FEATURE_dlist
+#include "dlist.h"
+#endif
+#if FEATURE_ATI_fragment_shader
+#include "shader/atifragshader.h"
+#endif
+
+
+/**
+ * Allocate and initialize a shared context state structure.
+ * Initializes the display list, texture objects and vertex programs hash
+ * tables, allocates the texture objects. If it runs out of memory, frees
+ * everything already allocated before returning NULL.
+ *
+ * \return pointer to a gl_shared_state structure on success, or NULL on
+ * failure.
+ */
+struct gl_shared_state *
+_mesa_alloc_shared_state(GLcontext *ctx)
+{
+   struct gl_shared_state *shared;
+   GLuint i;
+
+   shared = CALLOC_STRUCT(gl_shared_state);
+   if (!shared)
+      return NULL;
+
+   _glthread_INIT_MUTEX(shared->Mutex);
+
+   shared->DisplayList = _mesa_NewHashTable();
+   shared->TexObjects = _mesa_NewHashTable();
+   shared->Programs = _mesa_NewHashTable();
+
+#if FEATURE_ARB_vertex_program
+   shared->DefaultVertexProgram = (struct gl_vertex_program *)
+      ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
+#endif
+
+#if FEATURE_ARB_fragment_program
+   shared->DefaultFragmentProgram = (struct gl_fragment_program *)
+      ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
+#endif
+
+#if FEATURE_ATI_fragment_shader
+   shared->ATIShaders = _mesa_NewHashTable();
+   shared->DefaultFragmentShader = _mesa_new_ati_fragment_shader(ctx, 0);
+#endif
+
+#if FEATURE_ARB_shader_objects
+   shared->ShaderObjects = _mesa_NewHashTable();
+#endif
+
+#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object
+   shared->BufferObjects = _mesa_NewHashTable();
+#endif
+
+   shared->ArrayObjects = _mesa_NewHashTable();
+
+   /* Create default texture objects */
+   for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
+      /* NOTE: the order of these enums matches the TEXTURE_x_INDEX values */
+      static const GLenum targets[NUM_TEXTURE_TARGETS] = {
+         GL_TEXTURE_2D_ARRAY_EXT,
+         GL_TEXTURE_1D_ARRAY_EXT,
+         GL_TEXTURE_CUBE_MAP,
+         GL_TEXTURE_3D,
+         GL_TEXTURE_RECTANGLE_NV,
+         GL_TEXTURE_2D,
+         GL_TEXTURE_1D
+      };
+      shared->DefaultTex[i] = ctx->Driver.NewTextureObject(ctx, 0, targets[i]);
+   }
+
+   /* sanity check */
+   assert(shared->DefaultTex[TEXTURE_1D_INDEX]->RefCount == 1);
+
+   /* Mutex and timestamp for texobj state validation */
+   _glthread_INIT_MUTEX(shared->TexMutex);
+   shared->TextureStateStamp = 0;
+
+#if FEATURE_EXT_framebuffer_object
+   shared->FrameBuffers = _mesa_NewHashTable();
+   shared->RenderBuffers = _mesa_NewHashTable();
+#endif
+
+   return shared;
+}
+
+
+/**
+ * Callback for deleting a display list.  Called by _mesa_HashDeleteAll().
+ */
+static void
+delete_displaylist_cb(GLuint id, void *data, void *userData)
+{
+#if FEATURE_dlist
+   struct gl_display_list *list = (struct gl_display_list *) data;
+   GLcontext *ctx = (GLcontext *) userData;
+   _mesa_delete_list(ctx, list);
+#endif
+}
+
+
+/**
+ * Callback for deleting a texture object.  Called by _mesa_HashDeleteAll().
+ */
+static void
+delete_texture_cb(GLuint id, void *data, void *userData)
+{
+   struct gl_texture_object *texObj = (struct gl_texture_object *) data;
+   GLcontext *ctx = (GLcontext *) userData;
+   ctx->Driver.DeleteTexture(ctx, texObj);
+}
+
+
+/**
+ * Callback for deleting a program object.  Called by _mesa_HashDeleteAll().
+ */
+static void
+delete_program_cb(GLuint id, void *data, void *userData)
+{
+   struct gl_program *prog = (struct gl_program *) data;
+   GLcontext *ctx = (GLcontext *) userData;
+   ASSERT(prog->RefCount == 1); /* should only be referenced by hash table */
+   prog->RefCount = 0;  /* now going away */
+   ctx->Driver.DeleteProgram(ctx, prog);
+}
+
+
+#if FEATURE_ATI_fragment_shader
+/**
+ * Callback for deleting an ATI fragment shader object.
+ * Called by _mesa_HashDeleteAll().
+ */
+static void
+delete_fragshader_cb(GLuint id, void *data, void *userData)
+{
+   struct ati_fragment_shader *shader = (struct ati_fragment_shader *) data;
+   GLcontext *ctx = (GLcontext *) userData;
+   _mesa_delete_ati_fragment_shader(ctx, shader);
+}
+#endif
+
+
+/**
+ * Callback for deleting a buffer object.  Called by _mesa_HashDeleteAll().
+ */
+static void
+delete_bufferobj_cb(GLuint id, void *data, void *userData)
+{
+   struct gl_buffer_object *bufObj = (struct gl_buffer_object *) data;
+   GLcontext *ctx = (GLcontext *) userData;
+   ctx->Driver.DeleteBuffer(ctx, bufObj);
+}
+
+
+/**
+ * Callback for deleting an array object.  Called by _mesa_HashDeleteAll().
+ */
+static void
+delete_arrayobj_cb(GLuint id, void *data, void *userData)
+{
+   struct gl_array_object *arrayObj = (struct gl_array_object *) data;
+   GLcontext *ctx = (GLcontext *) userData;
+   _mesa_delete_array_object(ctx, arrayObj);
+}
+
+
+/**
+ * Callback for freeing shader program data. Call it before delete_shader_cb
+ * to avoid memory access error.
+ */
+static void
+free_shader_program_data_cb(GLuint id, void *data, void *userData)
+{
+   GLcontext *ctx = (GLcontext *) userData;
+   struct gl_shader_program *shProg = (struct gl_shader_program *) data;
+
+   if (shProg->Type == GL_SHADER_PROGRAM_MESA) {
+       _mesa_free_shader_program_data(ctx, shProg);
+   }
+}
+
+
+/**
+ * Callback for deleting shader and shader programs objects.
+ * Called by _mesa_HashDeleteAll().
+ */
+static void
+delete_shader_cb(GLuint id, void *data, void *userData)
+{
+   GLcontext *ctx = (GLcontext *) userData;
+   struct gl_shader *sh = (struct gl_shader *) data;
+   if (sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER) {
+      _mesa_free_shader(ctx, sh);
+   }
+   else {
+      struct gl_shader_program *shProg = (struct gl_shader_program *) data;
+      ASSERT(shProg->Type == GL_SHADER_PROGRAM_MESA);
+      _mesa_free_shader_program(ctx, shProg);
+   }
+}
+
+
+/**
+ * Callback for deleting a framebuffer object.  Called by _mesa_HashDeleteAll()
+ */
+static void
+delete_framebuffer_cb(GLuint id, void *data, void *userData)
+{
+   struct gl_framebuffer *fb = (struct gl_framebuffer *) data;
+   /* The fact that the framebuffer is in the hashtable means its refcount
+    * is one, but we're removing from the hashtable now.  So clear refcount.
+    */
+   /*assert(fb->RefCount == 1);*/
+   fb->RefCount = 0;
+
+   /* NOTE: Delete should always be defined but there are two reports
+    * of it being NULL (bugs 13507, 14293).  Work-around for now.
+    */
+   if (fb->Delete)
+      fb->Delete(fb);
+}
+
+
+/**
+ * Callback for deleting a renderbuffer object. Called by _mesa_HashDeleteAll()
+ */
+static void
+delete_renderbuffer_cb(GLuint id, void *data, void *userData)
+{
+   struct gl_renderbuffer *rb = (struct gl_renderbuffer *) data;
+   rb->RefCount = 0;  /* see comment for FBOs above */
+   if (rb->Delete)
+      rb->Delete(rb);
+}
+
+
+/**
+ * Deallocate a shared state object and all children structures.
+ *
+ * \param ctx GL context.
+ * \param shared shared state pointer.
+ * 
+ * Frees the display lists, the texture objects (calling the driver texture
+ * deletion callback to free its private data) and the vertex programs, as well
+ * as their hash tables.
+ *
+ * \sa alloc_shared_state().
+ */
+void
+_mesa_free_shared_state(GLcontext *ctx, struct gl_shared_state *shared)
+{
+   GLuint i;
+
+   /*
+    * Free display lists
+    */
+   _mesa_HashDeleteAll(shared->DisplayList, delete_displaylist_cb, ctx);
+   _mesa_DeleteHashTable(shared->DisplayList);
+
+#if FEATURE_ARB_shader_objects
+   _mesa_HashWalk(shared->ShaderObjects, free_shader_program_data_cb, ctx);
+   _mesa_HashDeleteAll(shared->ShaderObjects, delete_shader_cb, ctx);
+   _mesa_DeleteHashTable(shared->ShaderObjects);
+#endif
+
+   _mesa_HashDeleteAll(shared->Programs, delete_program_cb, ctx);
+   _mesa_DeleteHashTable(shared->Programs);
+
+   _mesa_HashDeleteAll(shared->ArrayObjects, delete_arrayobj_cb, ctx);
+   _mesa_DeleteHashTable(shared->ArrayObjects);
+
+#if FEATURE_ARB_vertex_program
+   _mesa_reference_vertprog(ctx, &shared->DefaultVertexProgram, NULL);
+#endif
+
+#if FEATURE_ARB_fragment_program
+   _mesa_reference_fragprog(ctx, &shared->DefaultFragmentProgram, NULL);
+#endif
+
+#if FEATURE_ATI_fragment_shader
+   _mesa_HashDeleteAll(shared->ATIShaders, delete_fragshader_cb, ctx);
+   _mesa_DeleteHashTable(shared->ATIShaders);
+   _mesa_delete_ati_fragment_shader(ctx, shared->DefaultFragmentShader);
+#endif
+
+#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object
+   _mesa_HashDeleteAll(shared->BufferObjects, delete_bufferobj_cb, ctx);
+   _mesa_DeleteHashTable(shared->BufferObjects);
+#endif
+
+#if FEATURE_EXT_framebuffer_object
+   _mesa_HashDeleteAll(shared->FrameBuffers, delete_framebuffer_cb, ctx);
+   _mesa_DeleteHashTable(shared->FrameBuffers);
+   _mesa_HashDeleteAll(shared->RenderBuffers, delete_renderbuffer_cb, ctx);
+   _mesa_DeleteHashTable(shared->RenderBuffers);
+#endif
+
+   /*
+    * Free texture objects (after FBOs since some textures might have
+    * been bound to FBOs).
+    */
+   ASSERT(ctx->Driver.DeleteTexture);
+   /* the default textures */
+   for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
+      ctx->Driver.DeleteTexture(ctx, shared->DefaultTex[i]);
+   }
+
+   /* all other textures */
+   _mesa_HashDeleteAll(shared->TexObjects, delete_texture_cb, ctx);
+   _mesa_DeleteHashTable(shared->TexObjects);
+
+   _glthread_DESTROY_MUTEX(shared->Mutex);
+   _glthread_DESTROY_MUTEX(shared->TexMutex);
+
+   _mesa_free(shared);
+}
diff --git a/src/mesa/main/shared.h b/src/mesa/main/shared.h
new file mode 100644 (file)
index 0000000..e59177e
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 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, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef SHARED_H
+#define SHARED_H
+
+
+struct gl_shared_state *
+_mesa_alloc_shared_state(GLcontext *ctx);
+
+
+void
+_mesa_free_shared_state(GLcontext *ctx, struct gl_shared_state *shared);
+
+
+#endif
index 0a39279bff326bffa116e60bfcfad99273ff33f5..cc37d636369c00de54c48029e860980d3ebb85e4 100644 (file)
@@ -49,6 +49,7 @@
 #include "texenvprogram.h"
 #include "texobj.h"
 #include "texstate.h"
+#include "viewport.h"
 
 
 static void
@@ -202,13 +203,17 @@ update_program_enables(GLcontext *ctx)
  *
  * This function needs to be called after texture state validation in case
  * we're generating a fragment program from fixed-function texture state.
+ *
+ * \return bitfield which will indicate _NEW_PROGRAM state if a new vertex
+ * or fragment program is being used.
  */
-static void
+static GLbitfield
 update_program(GLcontext *ctx)
 {
    const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
    const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;
    const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
+   GLbitfield new_state = 0x0;
 
    /*
     * Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current
@@ -278,15 +283,23 @@ update_program(GLcontext *ctx)
 
    /* Let the driver know what's happening:
     */
-   if (ctx->FragmentProgram._Current != prevFP && ctx->Driver.BindProgram) {
-      ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
-                              (struct gl_program *) ctx->FragmentProgram._Current);
+   if (ctx->FragmentProgram._Current != prevFP) {
+      new_state |= _NEW_PROGRAM;
+      if (ctx->Driver.BindProgram) {
+         ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
+                          (struct gl_program *) ctx->FragmentProgram._Current);
+      }
    }
    
-   if (ctx->VertexProgram._Current != prevVP && ctx->Driver.BindProgram) {
-      ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
-                              (struct gl_program *) ctx->VertexProgram._Current);
+   if (ctx->VertexProgram._Current != prevVP) {
+      new_state |= _NEW_PROGRAM;
+      if (ctx->Driver.BindProgram) {
+         ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
+                            (struct gl_program *) ctx->VertexProgram._Current);
+      }
    }
+
+   return new_state;
 }
 
 
@@ -447,6 +460,7 @@ _mesa_update_state_locked( GLcontext *ctx )
 {
    GLbitfield new_state = ctx->NewState;
    GLbitfield prog_flags = _NEW_PROGRAM;
+   GLbitfield new_prog_state = 0x0;
 
    if (new_state == _NEW_CURRENT_ATTRIB) 
       goto out;
@@ -490,7 +504,7 @@ _mesa_update_state_locked( GLcontext *ctx )
    if (new_state & _NEW_LIGHT)
       _mesa_update_lighting( ctx );
 
-   if (new_state & _NEW_STENCIL)
+   if (new_state & (_NEW_STENCIL | _NEW_BUFFERS))
       _mesa_update_stencil( ctx );
 
 #if FEATURE_pixel_transfer
@@ -531,8 +545,13 @@ _mesa_update_state_locked( GLcontext *ctx )
    if (new_state & _MESA_NEW_NEED_EYE_COORDS) 
       _mesa_update_tnl_spaces( ctx, new_state );
 
-   if (new_state & prog_flags)
-      update_program( ctx );
+   if (new_state & prog_flags) {
+      /* When we generate programs from fixed-function vertex/fragment state
+       * this call may generate/bind a new program.  If so, we need to
+       * propogate the _NEW_PROGRAM flag to the driver.
+       */
+      new_prog_state |= update_program( ctx );
+   }
 
    /*
     * Give the driver a chance to act upon the new_state flags.
@@ -544,7 +563,7 @@ _mesa_update_state_locked( GLcontext *ctx )
     * Driver.UpdateState() has to call FLUSH_VERTICES().  (fixed?)
     */
  out:
-   new_state = ctx->NewState;
+   new_state = ctx->NewState | new_prog_state;
    ctx->NewState = 0;
    ctx->Driver.UpdateState(ctx, new_state);
    ctx->Array.NewState = 0;
index b4ea9978d874bfc858083d1db81992537285c167..15c98e2015668db089dfaea90fb3697c8ed0474f 100644 (file)
  * \file stencil.c
  * Stencil operations.
  *
+ * Note: There's some conflict between GL_EXT_stencil_two_side and
+ * OpenGL 2.0's two-sided stencil feature.
+ *
+ * With GL_EXT_stencil_two_side, calling glStencilOp/Func/Mask() only the
+ * front OR back face state (as set by glActiveStencilFaceEXT) is set.
+ *
+ * But with OpenGL 2.0, calling glStencilOp/Func/Mask() sets BOTH the
+ * front AND back state.
+ *
+ * Also, note that GL_ATI_separate_stencil is different as well:
+ * glStencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, ...)  vs.
+ * glStencilFuncSeparate(GLenum face, GLenum func, ...).
+ *
+ * This problem is solved by keeping three sets of stencil state:
+ *  state[0] = GL_FRONT state.
+ *  state[1] = OpenGL 2.0 / GL_ATI_separate_stencil GL_BACK state.
+ *  state[2] = GL_EXT_stencil_two_side GL_BACK state.
  */
 
 
@@ -519,7 +536,11 @@ _mesa_update_stencil(GLcontext *ctx)
 {
    const GLint face = ctx->Stencil._BackFace;
 
-   ctx->Stencil._TestTwoSide =
+   ctx->Stencil._Enabled = (ctx->Stencil.Enabled &&
+                            ctx->DrawBuffer->Visual.stencilBits > 0);
+
+    ctx->Stencil._TestTwoSide =
+       ctx->Stencil._Enabled &&
        (ctx->Stencil.Function[0] != ctx->Stencil.Function[face] ||
        ctx->Stencil.FailFunc[0] != ctx->Stencil.FailFunc[face] ||
        ctx->Stencil.ZPassFunc[0] != ctx->Stencil.ZPassFunc[face] ||
@@ -542,7 +563,7 @@ _mesa_init_stencil(GLcontext *ctx)
 {
    ctx->Stencil.Enabled = GL_FALSE;
    ctx->Stencil.TestTwoSide = GL_FALSE;
-   ctx->Stencil.ActiveFace = 0;  /* 0 = GL_FRONT, 1 = GL_BACK */
+   ctx->Stencil.ActiveFace = 0;  /* 0 = GL_FRONT, 2 = GL_BACK */
    ctx->Stencil.Function[0] = GL_ALWAYS;
    ctx->Stencil.Function[1] = GL_ALWAYS;
    ctx->Stencil.Function[2] = GL_ALWAYS;
@@ -565,4 +586,5 @@ _mesa_init_stencil(GLcontext *ctx)
    ctx->Stencil.WriteMask[1] = ~0U;
    ctx->Stencil.WriteMask[2] = ~0U;
    ctx->Stencil.Clear = 0;
+   ctx->Stencil._BackFace = 1;
 }
index 097923182a393623a503e359effec44e2fb64001..c2960fc8208ae6d21f24714154a13998621f9eff 100644 (file)
@@ -35,7 +35,6 @@
 #include "main/enums.h"
 #include "main/macros.h"
 #include "main/texenv.h"
-#include "math/m_xform.h"
 
 
 #define TE_ERROR(errCode, msg, value)                          \
@@ -143,7 +142,11 @@ set_combiner_mode(GLcontext *ctx,
    case GL_MODULATE_ADD_ATI:
    case GL_MODULATE_SIGNED_ADD_ATI:
    case GL_MODULATE_SUBTRACT_ATI:
-      legal =ctx->Extensions.ATI_texture_env_combine3;
+      legal = ctx->Extensions.ATI_texture_env_combine3;
+      break;
+   case GL_BUMP_ENVMAP_ATI:
+      legal = (ctx->Extensions.ATI_envmap_bumpmap &&
+               pname == GL_COMBINE_RGB);
       break;
    default:
       legal = GL_FALSE;
@@ -501,6 +504,26 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
       case GL_ALPHA_SCALE:
          set_combiner_scale(ctx, texUnit, pname, param[0]);
         break;
+      case GL_BUMP_TARGET_ATI:
+         if (!ctx->Extensions.ATI_envmap_bumpmap) {
+           _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
+           return;
+        }
+        if (((GLenum) (GLint) param[0] < GL_TEXTURE0) ||
+        ((GLenum) (GLint) param[0] > GL_TEXTURE31)) {
+           /* spec doesn't say this but it seems logical */
+           _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param=0x%x)", (GLenum) (GLint) param[0]);
+           return;
+        }
+        if (!((1 << ((GLenum) (GLint) param[0] - GL_TEXTURE0)) & ctx->Const.SupportedBumpUnits)) {
+           _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", (GLenum) (GLint) param[0]);
+           return;
+        }
+        else {
+           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+           texUnit->BumpTarget = (GLenum) (GLint) param[0];
+        }
+        break;
       default:
         _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
         return;
@@ -736,6 +759,16 @@ get_texenvi(GLcontext *ctx, const struct gl_texture_unit *texUnit,
          _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
       }
       break;
+   case GL_BUMP_TARGET_ATI:
+      /* spec doesn't say so, but I think this should be queryable */
+      if (ctx->Extensions.ATI_envmap_bumpmap) {
+         return texUnit->BumpTarget;
+      }
+      else {
+         _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+      }
+      break;
+
    default:
       ;
    }
@@ -875,4 +908,142 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
    }
 }
 
+/* why does ATI_envmap_bumpmap require new entrypoints? Should just
+   reuse TexEnv ones... */
+void GLAPIENTRY
+_mesa_TexBumpParameterivATI( GLenum pname, const GLint *param )
+{
+   GLfloat p[4];
+   if (pname == GL_BUMP_ROT_MATRIX_ATI) {
+      /* hope that conversion is correct here */
+      p[0] = INT_TO_FLOAT( param[0] );
+      p[1] = INT_TO_FLOAT( param[1] );
+      p[2] = INT_TO_FLOAT( param[2] );
+      p[3] = INT_TO_FLOAT( param[3] );
+   }
+   else {
+      p[0] = (GLfloat) param[0];
+      p[1] = p[2] = p[3] = 0;  /* init to zero, just to be safe */
+   }
+   _mesa_TexBumpParameterfvATI( pname, p );
+}
+
+void GLAPIENTRY
+_mesa_TexBumpParameterfvATI( GLenum pname, const GLfloat *param )
+{
+   struct gl_texture_unit *texUnit;
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   /* should return error if extension not supported? */
+   texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+   if (pname == GL_BUMP_ROT_MATRIX_ATI) {
+      if (TEST_EQ_4V(param, texUnit->RotMatrix))
+         return;
+      FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+      COPY_4FV(texUnit->RotMatrix, param);
+   }
+   else {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glTexBumpParameter(pname)" );
+      return;
+   }
+   /* Drivers might want to know about this, instead of dedicated function
+      just shove it into TexEnv where it really belongs anyway */
+   if (ctx->Driver.TexEnv) {
+      (*ctx->Driver.TexEnv)( ctx, 0, pname, param );
+   }
+}
+
+void GLAPIENTRY
+_mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param )
+{
+   const struct gl_texture_unit *texUnit;
+   GLint i;
+   GLint temp = 0;
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   /* should return error if extension not supported? */
+   texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+   if (pname == GL_BUMP_ROT_MATRIX_SIZE_ATI) {
+      /* spec leaves open to support larger matrices.
+         Don't think anyone would ever want to use it
+         (and apps almost certainly would not understand it and
+         thus fail to submit matrices correctly) so hardcode this. */
+      *param = 4;
+   }
+   else if (pname == GL_BUMP_ROT_MATRIX_ATI) {
+      /* hope that conversion is correct here */
+      param[0] = FLOAT_TO_INT(texUnit->RotMatrix[0]);
+      param[1] = FLOAT_TO_INT(texUnit->RotMatrix[1]);
+      param[2] = FLOAT_TO_INT(texUnit->RotMatrix[2]);
+      param[3] = FLOAT_TO_INT(texUnit->RotMatrix[3]);
+   }
+   else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
+      for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+         if (ctx->Const.SupportedBumpUnits & (1 << i)) {
+            temp++;
+         }
+      }
+      *param = temp;
+   }
+   else if (pname == GL_BUMP_TEX_UNITS_ATI) {
+      for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+         if (ctx->Const.SupportedBumpUnits & (1 << i)) {
+            *param++ = i + GL_TEXTURE0;
+         }
+      }
+   }
+   else {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexBumpParameter(pname)" );
+      return;
+   }
+}
+
+void GLAPIENTRY
+_mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param )
+{
+   const struct gl_texture_unit *texUnit;
+   GLint i;
+   GLint temp = 0;
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   /* should return error if extension not supported? */
+   texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+   if (pname == GL_BUMP_ROT_MATRIX_SIZE_ATI) {
+      /* spec leaves open to support larger matrices.
+         Don't think anyone would ever want to use it
+         (and apps might not understand it) so hardcode this. */
+      *param = (GLfloat) 4;
+   }
+   else if (pname == GL_BUMP_ROT_MATRIX_ATI) {
+      param[0] = texUnit->RotMatrix[0];
+      param[1] = texUnit->RotMatrix[1];
+      param[2] = texUnit->RotMatrix[2];
+      param[3] = texUnit->RotMatrix[3];
+   }
+   else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
+      for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+         if (ctx->Const.SupportedBumpUnits & (1 << i)) {
+            temp++;
+         }
+      }
+      *param = (GLfloat) temp;
+   }
+   else if (pname == GL_BUMP_TEX_UNITS_ATI) {
+      for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+         if (ctx->Const.SupportedBumpUnits & (1 << i)) {
+            *param++ = (GLfloat) (i + GL_TEXTURE0);
+         }
+      }
+   }
+   else {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexBumpParameter(pname)" );
+      return;
+   }
+}
 
index bdff7fdb82bd761db8e07ef19053712f0d8ed0d5..1e9c5faed7971ac472f942bd34a84a92fea83415 100644 (file)
@@ -48,5 +48,16 @@ _mesa_TexEnvi( GLenum target, GLenum pname, GLint param );
 extern void GLAPIENTRY
 _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param );
 
+extern void GLAPIENTRY
+_mesa_TexBumpParameterivATI( GLenum pname, const GLint *param );
+
+extern void GLAPIENTRY
+_mesa_TexBumpParameterfvATI( GLenum pname, const GLfloat *param );
+
+extern void GLAPIENTRY
+_mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param );
+
+extern void GLAPIENTRY
+_mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param );
 
 #endif /* TEXENV_H */
index af51a206a56c733f74d036328f7aac043e6a6cd8..3fbd119b34797e78a785709932c87525cbbd476f 100644 (file)
@@ -94,11 +94,11 @@ struct state_key {
       GLuint ScaleShiftA:2;
 
       GLuint NumArgsRGB:3;
-      GLuint ModeRGB:4;
+      GLuint ModeRGB:5;
       struct mode_opt OptRGB[MAX_TERMS];
 
       GLuint NumArgsA:3;
-      GLuint ModeA:4;
+      GLuint ModeA:5;
       struct mode_opt OptA[MAX_TERMS];
    } unit[8];
 };
@@ -194,7 +194,8 @@ static GLuint translate_source( GLenum src )
 #define MODE_MODULATE_SUBTRACT_ATI      12  /* r = a0 * a2 - a1 */
 #define MODE_ADD_PRODUCTS               13  /* r = a0 * a1 + a2 * a3 */
 #define MODE_ADD_PRODUCTS_SIGNED        14  /* r = a0 * a1 + a2 * a3 - 0.5 */
-#define MODE_UNKNOWN                    15
+#define MODE_BUMP_ENVMAP_ATI            15  /* special */
+#define MODE_UNKNOWN                    16
 
 /**
  * Translate GL combiner state into a MODE_x value
@@ -223,6 +224,7 @@ static GLuint translate_mode( GLenum envMode, GLenum mode )
    case GL_MODULATE_ADD_ATI: return MODE_MODULATE_ADD_ATI;
    case GL_MODULATE_SIGNED_ADD_ATI: return MODE_MODULATE_SIGNED_ADD_ATI;
    case GL_MODULATE_SUBTRACT_ATI: return MODE_MODULATE_SUBTRACT_ATI;
+   case GL_BUMP_ENVMAP_ATI: return MODE_BUMP_ENVMAP_ATI;
    default:
       assert(0);
       return MODE_UNKNOWN;
@@ -383,7 +385,7 @@ static void make_state_key( GLcontext *ctx,  struct state_key *key )
         translate_mode(texUnit->EnvMode, texUnit->_CurrentCombine->ModeRGB);
       key->unit[i].ModeA =
         translate_mode(texUnit->EnvMode, texUnit->_CurrentCombine->ModeA);
-               
+
       key->unit[i].ScaleShiftRGB = texUnit->_CurrentCombine->ScaleShiftRGB;
       key->unit[i].ScaleShiftA = texUnit->_CurrentCombine->ScaleShiftA;
 
@@ -397,8 +399,18 @@ static void make_state_key( GLcontext *ctx,  struct state_key *key )
          key->unit[i].OptA[j].Source =
            translate_source(texUnit->_CurrentCombine->SourceA[j]);
       }
+
+      if (key->unit[i].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
+         /* requires some special translation */
+         key->unit[i].NumArgsRGB = 2;
+         key->unit[i].ScaleShiftRGB = 0;
+         key->unit[i].OptRGB[0].Operand = OPR_SRC_COLOR;
+         key->unit[i].OptRGB[0].Source = SRC_TEXTURE;
+         key->unit[i].OptRGB[1].Operand = OPR_SRC_COLOR;
+         key->unit[i].OptRGB[1].Source = texUnit->BumpTarget - GL_TEXTURE0 + SRC_TEXTURE0;
+       }
    }
-       
+
    if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
       key->separate_specular = 1;
       inputs_referenced |= FRAG_BIT_COL1;
@@ -464,6 +476,11 @@ struct texenv_fragment_program {
     * else undef.
     */
 
+   struct ureg texcoord_tex[MAX_TEXTURE_COORD_UNITS];
+   /* Reg containing texcoord for a texture unit,
+    * needed for bump mapping, else undef.
+    */
+
    struct ureg src_previous;   /**< Reg containing color from previous 
                                 * stage.  May need to be decl'd.
                                 */
@@ -736,6 +753,7 @@ static struct ureg emit_texld( struct texenv_fragment_program *p,
                               GLuint destmask,
                               GLuint tex_unit,
                               GLuint tex_idx,
+                               GLuint tex_shadow,
                               struct ureg coord )
 {
    struct prog_instruction *inst = emit_op( p, op, 
@@ -747,6 +765,7 @@ static struct ureg emit_texld( struct texenv_fragment_program *p,
    
    inst->TexSrcTarget = tex_idx;
    inst->TexSrcUnit = tex_unit;
+   inst->TexShadow = tex_shadow;
 
    p->program->Base.NumTexInstructions++;
 
@@ -754,6 +773,7 @@ static struct ureg emit_texld( struct texenv_fragment_program *p,
     */
    reserve_temp(p, dest);
 
+#if 0
    /* Is this a texture indirection?
     */
    if ((coord.file == PROGRAM_TEMPORARY &&
@@ -765,6 +785,7 @@ static struct ureg emit_texld( struct texenv_fragment_program *p,
       p->alu_temps = 0;
       assert(0);               /* KW: texture env crossbar */
    }
+#endif
 
    return dest;
 }
@@ -1050,6 +1071,10 @@ static struct ureg emit_combine( struct texenv_fragment_program *p,
          emit_arith( p, OPCODE_SUB, dest, mask, saturate, tmp0, half, undef );
       }
       return dest;
+   case MODE_BUMP_ENVMAP_ATI:
+      /* special - not handled here */
+      assert(0);
+      return src[0];
    default: 
       assert(0);
       return src[0];
@@ -1072,6 +1097,10 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
    if (!key->unit[unit].enabled) {
       return get_source(p, SRC_PREVIOUS, 0);
    }
+   if (key->unit[unit].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
+      /* this isn't really a env stage delivering a color and handled elsewhere */
+      return get_source(p, SRC_PREVIOUS, 0);
+   }
    
    switch (key->unit[unit].ModeRGB) {
    case MODE_DOT3_RGB_EXT:
@@ -1096,7 +1125,7 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
        rgb_shift)
       dest = get_temp( p );
    else
-      dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
+      dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
 
    /* Emit the RGB and A combine ops
     */
@@ -1160,22 +1189,35 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
 static void load_texture( struct texenv_fragment_program *p, GLuint unit )
 {
    if (is_undef(p->src_texture[unit])) {
-      GLuint dim = p->state->unit[unit].source_index;
-      struct ureg texcoord = register_input(p, FRAG_ATTRIB_TEX0+unit);
+      GLuint texTarget = p->state->unit[unit].source_index;
+      struct ureg texcoord;
       struct ureg tmp = get_tex_temp( p );
 
-      if (dim == TEXTURE_UNKNOWN_INDEX)
+      if (is_undef(p->texcoord_tex[unit])) {
+         texcoord = register_input(p, FRAG_ATTRIB_TEX0+unit);
+      }
+      else {
+         /* might want to reuse this reg for tex output actually */
+         texcoord = p->texcoord_tex[unit];
+      }
+
+      if (texTarget == TEXTURE_UNKNOWN_INDEX)
          program_error(p, "TexSrcBit");
                          
       /* TODO: Use D0_MASK_XY where possible.
        */
       if (p->state->unit[unit].enabled) {
-        p->src_texture[unit] = emit_texld( p, OPCODE_TXP,
-                                           tmp, WRITEMASK_XYZW, 
-                                           unit, dim, texcoord );
+         GLboolean shadow = GL_FALSE;
 
-        if (p->state->unit[unit].shadow)
+        if (p->state->unit[unit].shadow) {
            p->program->Base.ShadowSamplers |= 1 << unit;
+            shadow = GL_TRUE;
+         }
+
+        p->src_texture[unit] = emit_texld( p, OPCODE_TXP,
+                                           tmp, WRITEMASK_XYZW, 
+                                           unit, texTarget, shadow,
+                                            texcoord );
 
          p->program->Base.SamplersUsed |= (1 << unit);
          /* This identity mapping should already be in place
@@ -1226,7 +1268,7 @@ load_texunit_sources( struct texenv_fragment_program *p, int unit )
    GLuint i;
 
    for (i = 0; i < key->unit[unit].NumArgsRGB; i++) {
-      load_texenv_source( p, key->unit[unit].OptRGB[i].Source, unit);
+      load_texenv_source( p, key->unit[unit].OptRGB[i].Source, unit );
    }
 
    for (i = 0; i < key->unit[unit].NumArgsA; i++) {
@@ -1236,6 +1278,40 @@ load_texunit_sources( struct texenv_fragment_program *p, int unit )
    return GL_TRUE;
 }
 
+/**
+ * Generate instructions for loading bump map textures.
+ */
+static GLboolean
+load_texunit_bumpmap( struct texenv_fragment_program *p, int unit )
+{
+   struct state_key *key = p->state;
+   GLuint bumpedUnitNr = key->unit[unit].OptRGB[1].Source - SRC_TEXTURE0;
+   struct ureg texcDst, bumpMapRes;
+   struct ureg constdudvcolor = register_const4f(p, 0.0, 0.0, 0.0, 1.0);
+   struct ureg texcSrc = register_input(p, FRAG_ATTRIB_TEX0 + bumpedUnitNr);
+   struct ureg rotMat0 = register_param3( p, STATE_INTERNAL, STATE_ROT_MATRIX_0, unit );
+   struct ureg rotMat1 = register_param3( p, STATE_INTERNAL, STATE_ROT_MATRIX_1, unit );
+
+   load_texenv_source( p, unit + SRC_TEXTURE0, unit );
+
+   bumpMapRes = get_source(p, key->unit[unit].OptRGB[0].Source, unit);
+   texcDst = get_tex_temp( p );
+   p->texcoord_tex[bumpedUnitNr] = texcDst;
+
+   /* apply rot matrix and add coords to be available in next phase */
+   /* dest = (Arg0.xxxx * rotMat0 + Arg1) + (Arg0.yyyy * rotMat1) */
+   /* note only 2 coords are affected the rest are left unchanged (mul by 0) */
+   emit_arith( p, OPCODE_MAD, texcDst, WRITEMASK_XYZW, 0,
+               swizzle1(bumpMapRes, SWIZZLE_X), rotMat0, texcSrc );
+   emit_arith( p, OPCODE_MAD, texcDst, WRITEMASK_XYZW, 0,
+               swizzle1(bumpMapRes, SWIZZLE_Y), rotMat1, texcDst );
+
+   /* move 0,0,0,1 into bumpmap src if someone (crossbar) is foolish
+      enough to access this later, should optimize away */
+   emit_arith( p, OPCODE_MOV, bumpMapRes, WRITEMASK_XYZW, 0, constdudvcolor, undef, undef );
+
+   return GL_TRUE;
+}
 
 /**
  * Generate a new fragment program which implements the context's
@@ -1260,7 +1336,7 @@ create_new_program(GLcontext *ctx, struct state_key *key,
     */
    p.program->Base.Instructions = instBuffer;
    p.program->Base.Target = GL_FRAGMENT_PROGRAM_ARB;
-   p.program->Base.NumTexIndirections = 1;     /* correct? */
+   p.program->Base.NumTexIndirections = 1;
    p.program->Base.NumTexInstructions = 0;
    p.program->Base.NumAluInstructions = 0;
    p.program->Base.String = NULL;
@@ -1271,10 +1347,12 @@ create_new_program(GLcontext *ctx, struct state_key *key,
    p.program->Base.Parameters = _mesa_new_parameter_list();
 
    p.program->Base.InputsRead = 0;
-   p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLR;
+   p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR;
 
-   for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++)
+   for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
       p.src_texture[unit] = undef;
+      p.texcoord_tex[unit] = undef;
+   }
 
    p.src_previous = undef;
    p.half = undef;
@@ -1285,6 +1363,16 @@ create_new_program(GLcontext *ctx, struct state_key *key,
    release_temps(ctx, &p);
 
    if (key->enabled_units) {
+       GLboolean needbumpstage = GL_FALSE;
+      /* Zeroth pass - bump map textures first */
+      for (unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++)
+        if (key->unit[unit].enabled && key->unit[unit].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
+           needbumpstage = GL_TRUE;
+           load_texunit_bumpmap( &p, unit );
+        }
+      if (needbumpstage)
+        p.program->Base.NumTexIndirections++;
+
       /* First pass - to support texture_env_crossbar, first identify
        * all referenced texture sources and emit texld instructions
        * for each:
@@ -1306,7 +1394,7 @@ create_new_program(GLcontext *ctx, struct state_key *key,
    }
 
    cf = get_source( &p, SRC_PREVIOUS, 0 );
-   out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLR );
+   out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR );
 
    if (key->separate_specular) {
       /* Emit specular add.
index 16d05cc7d0702e55697e15da1966ea5ce8d4b819..c372b49398a31dde7c88d079d8efb5b8a310ec05 100644 (file)
@@ -696,6 +696,33 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = {
    store_texel_intensity_f16           /* StoreTexel */
 };
 
+const struct gl_texture_format _mesa_texformat_dudv8 = {
+   MESA_FORMAT_DUDV8,                  /* MesaFormat */
+   GL_DUDV_ATI,                                /* BaseFormat */
+   /* FIXME: spec doesn't say since that parameter didn't exist then,
+      but this should be something like SIGNED_NORMALIZED */
+   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
+   /* maybe should add dudvBits field, but spec seems to be
+      lacking the ability to query with GetTexLevelParameter anyway */
+   0,                                  /* RedBits */
+   0,                                  /* GreenBits */
+   0,                                  /* BlueBits */
+   0,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   0,                                  /* StencilBits */
+   2,                                  /* TexelBytes */
+   _mesa_texstore_dudv8,               /* StoreTexImageFunc */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_dudv8,               /* FetchTexel1Df */
+   fetch_texel_2d_dudv8,               /* FetchTexel2Df */
+   fetch_texel_3d_dudv8,               /* FetchTexel3Df */
+   NULL                                        /* StoreTexel */
+};
 
 /*@}*/
 
@@ -1634,6 +1661,16 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       }
    }
 
+   if (ctx->Extensions.ATI_envmap_bumpmap) {
+      switch (internalFormat) {
+         case GL_DUDV_ATI:
+         case GL_DU8DV8_ATI:
+            return &_mesa_texformat_dudv8;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
 #if FEATURE_EXT_texture_sRGB
    if (ctx->Extensions.EXT_texture_sRGB) {
       switch (internalFormat) {
@@ -1778,6 +1815,11 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
       *comps = 1;
       return;
 
+   case MESA_FORMAT_DUDV8:
+      *datatype = GL_BYTE;
+      *comps = 2;
+      return;
+
 #if FEATURE_EXT_texture_sRGB
    case MESA_FORMAT_SRGB8:
       *datatype = GL_UNSIGNED_BYTE;
index 31364c36b1a902ba546545a01473108ffb1a68b5..7fa70ad4fee3f8680f03f8a2c225fd0d6e950634 100644 (file)
@@ -161,7 +161,14 @@ enum _format {
    MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
    MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
    MESA_FORMAT_INTENSITY_FLOAT32,
-   MESA_FORMAT_INTENSITY_FLOAT16
+   MESA_FORMAT_INTENSITY_FLOAT16,
+   /*@}*/
+
+   /**
+    * \name Signed fixed point texture formats.
+    */
+   /*@{*/
+   MESA_FORMAT_DUDV8
    /*@}*/
 };
 
@@ -209,6 +216,11 @@ extern const struct gl_texture_format _mesa_texformat_intensity_float32;
 extern const struct gl_texture_format _mesa_texformat_intensity_float16;
 /*@}*/
 
+/** Signed fixed point texture formats */
+/*@{*/
+extern const struct gl_texture_format _mesa_texformat_dudv8;
+/*@}*/
+
 /** \name Assorted hardware-friendly formats */
 /*@{*/
 extern const struct gl_texture_format _mesa_texformat_rgba8888;
index 275340cabd383383ea37892a7d696be0713eb0d9..0f6a172ef00591a489b547cdeb10a2b1c3cc5e8a 100644 (file)
@@ -719,9 +719,9 @@ static void store_texel_rgb888(struct gl_texture_image *texImage,
 {
    const GLubyte *rgba = (const GLubyte *) texel;
    GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   dst[0] = rgba[RCOMP];
+   dst[0] = rgba[BCOMP];
    dst[1] = rgba[GCOMP];
-   dst[2] = rgba[BCOMP];
+   dst[2] = rgba[RCOMP];
 }
 #endif
 
@@ -745,9 +745,9 @@ static void store_texel_bgr888(struct gl_texture_image *texImage,
 {
    const GLubyte *rgba = (const GLubyte *) texel;
    GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   dst[0] = rgba[BCOMP];
+   dst[0] = rgba[RCOMP];
    dst[1] = rgba[GCOMP];
-   dst[2] = rgba[RCOMP];
+   dst[2] = rgba[BCOMP];
 }
 #endif
 
@@ -1269,7 +1269,7 @@ static void FETCH(sl8)(const struct gl_texture_image *texImage,
    texel[RCOMP] = 
    texel[GCOMP] = 
    texel[BCOMP] = nonlinear_to_linear(src[0]);
-   texel[ACOMP] = CHAN_MAX;
+   texel[ACOMP] = 1.0F;
 }
 
 #if DIM == 3
@@ -1304,10 +1304,22 @@ static void store_texel_sla8(struct gl_texture_image *texImage,
 }
 #endif
 
+#endif /* FEATURE_EXT_texture_sRGB */
 
 
-#endif /* FEATURE_EXT_texture_sRGB */
+/* MESA_FORMAT_DUDV8 ********************************************************/
 
+/* this format by definition produces 0,0,0,1 as rgba values,
+   however we'll return the dudv values as rg and fix up elsewhere */
+static void FETCH(dudv8)(const struct gl_texture_image *texImage,
+                         GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2);
+   texel[RCOMP] = BYTE_TO_FLOAT(src[0]);
+   texel[GCOMP] = BYTE_TO_FLOAT(src[1]);
+   texel[BCOMP] = 0;
+   texel[ACOMP] = 0;
+}
 
 
 /* MESA_FORMAT_YCBCR *********************************************************/
index 244c7aaafc4a6bb39dd813a779f62d663f70dd08..e3feb024c31bc93df26aee84253fd16bd53f5283 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.1
+ * Version:  7.5
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 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"),
 #include "main/enums.h"
 #include "main/macros.h"
 #include "main/texgen.h"
-#include "math/m_xform.h"
+#include "math/m_matrix.h"
 
 
+/**
+ * Return texgen state for given coordinate
+ */
+static struct gl_texgen *
+get_texgen(struct gl_texture_unit *texUnit, GLenum coord)
+{
+   switch (coord) {
+   case GL_S:
+      return &texUnit->GenS;
+   case GL_T:
+      return &texUnit->GenT;
+   case GL_R:
+      return &texUnit->GenR;
+   case GL_Q:
+      return &texUnit->GenQ;
+   default:
+      return NULL;
+   }
+}
+
 
 void GLAPIENTRY
 _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
 {
-   GET_CURRENT_CONTEXT(ctx);
    struct gl_texture_unit *texUnit;
+   struct gl_texgen *texgen;
+   GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
@@ -59,210 +81,79 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
 
    texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
 
-   switch (coord) {
-      case GL_S:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-           GLenum mode = (GLenum) (GLint) *params;
-           GLbitfield bits;
-           switch (mode) {
-           case GL_OBJECT_LINEAR:
-              bits = TEXGEN_OBJ_LINEAR;
-              break;
-           case GL_EYE_LINEAR:
-              bits = TEXGEN_EYE_LINEAR;
-              break;
-           case GL_REFLECTION_MAP_NV:
-              bits = TEXGEN_REFLECTION_MAP_NV;
-              break;
-           case GL_NORMAL_MAP_NV:
-              bits = TEXGEN_NORMAL_MAP_NV;
-              break;
-           case GL_SPHERE_MAP:
-              bits = TEXGEN_SPHERE_MAP;
-              break;
-           default:
-              _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
-              return;
-           }
-           if (texUnit->GenModeS == mode)
-              return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-           texUnit->GenModeS = mode;
-           texUnit->_GenBitS = bits;
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-           if (TEST_EQ_4V(texUnit->ObjectPlaneS, params))
-               return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-            COPY_4FV(texUnit->ObjectPlaneS, params);
-        }
-        else if (pname==GL_EYE_PLANE) {
-           GLfloat tmp[4];
-            /* Transform plane equation by the inverse modelview matrix */
-            if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
-               _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
-            }
-            _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
-           if (TEST_EQ_4V(texUnit->EyePlaneS, tmp))
-              return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-           COPY_4FV(texUnit->EyePlaneS, tmp);
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
-           return;
-        }
-        break;
-      case GL_T:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-           GLenum mode = (GLenum) (GLint) *params;
-           GLbitfield bitt;
-           switch (mode) {
-               case GL_OBJECT_LINEAR:
-                  bitt = TEXGEN_OBJ_LINEAR;
-                  break;
-               case GL_EYE_LINEAR:
-                  bitt = TEXGEN_EYE_LINEAR;
-                  break;
-               case GL_REFLECTION_MAP_NV:
-                  bitt = TEXGEN_REFLECTION_MAP_NV;
-                  break;
-               case GL_NORMAL_MAP_NV:
-                  bitt = TEXGEN_NORMAL_MAP_NV;
-                  break;
-               case GL_SPHERE_MAP:
-                  bitt = TEXGEN_SPHERE_MAP;
-                  break;
-               default:
-                  _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
-                  return;
-           }
-           if (texUnit->GenModeT == mode)
-              return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-           texUnit->GenModeT = mode;
-           texUnit->_GenBitT = bitt;
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-           if (TEST_EQ_4V(texUnit->ObjectPlaneT, params))
-               return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-            COPY_4FV(texUnit->ObjectPlaneT, params);
-        }
-        else if (pname==GL_EYE_PLANE) {
-           GLfloat tmp[4];
-            /* Transform plane equation by the inverse modelview matrix */
-           if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
-               _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
-            }
-            _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
-           if (TEST_EQ_4V(texUnit->EyePlaneT, tmp))
-               return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-           COPY_4FV(texUnit->EyePlaneT, tmp);
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
-           return;
-        }
-        break;
-      case GL_R:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-           GLenum mode = (GLenum) (GLint) *params;
-           GLbitfield bitr;
-           switch (mode) {
-           case GL_OBJECT_LINEAR:
-              bitr = TEXGEN_OBJ_LINEAR;
-              break;
-           case GL_REFLECTION_MAP_NV:
-              bitr = TEXGEN_REFLECTION_MAP_NV;
-              break;
-           case GL_NORMAL_MAP_NV:
-              bitr = TEXGEN_NORMAL_MAP_NV;
-              break;
-           case GL_EYE_LINEAR:
-              bitr = TEXGEN_EYE_LINEAR;
-              break;
-           default:
-              _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
-              return;
-           }
-           if (texUnit->GenModeR == mode)
-              return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-           texUnit->GenModeR = mode;
-           texUnit->_GenBitR = bitr;
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-           if (TEST_EQ_4V(texUnit->ObjectPlaneR, params))
-               return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-           COPY_4FV(texUnit->ObjectPlaneR, params);
-        }
-        else if (pname==GL_EYE_PLANE) {
-           GLfloat tmp[4];
-            /* Transform plane equation by the inverse modelview matrix */
-            if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
-               _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
-            }
-            _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
-           if (TEST_EQ_4V(texUnit->EyePlaneR, tmp))
-              return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-           COPY_4FV(texUnit->EyePlaneR, tmp);
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
-           return;
-        }
-        break;
-      case GL_Q:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-           GLenum mode = (GLenum) (GLint) *params;
-           GLbitfield bitq;
-           switch (mode) {
-           case GL_OBJECT_LINEAR:
-              bitq = TEXGEN_OBJ_LINEAR;
-              break;
-           case GL_EYE_LINEAR:
-              bitq = TEXGEN_EYE_LINEAR;
-              break;
-           default:
-              _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
-              return;
-           }
-           if (texUnit->GenModeQ == mode)
-              return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-           texUnit->GenModeQ = mode;
-           texUnit->_GenBitQ = bitq;
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-           if (TEST_EQ_4V(texUnit->ObjectPlaneQ, params))
-               return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-            COPY_4FV(texUnit->ObjectPlaneQ, params);
-        }
-        else if (pname==GL_EYE_PLANE) {
-           GLfloat tmp[4];
-            /* Transform plane equation by the inverse modelview matrix */
-            if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
-               _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
-            }
-            _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
-           if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp))
-              return;
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-           COPY_4FV(texUnit->EyePlaneQ, tmp);
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
-           return;
-        }
-        break;
-      default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" );
-        return;
+   texgen = get_texgen(texUnit, coord);
+   if (!texgen) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)");
+      return;
+   }
+
+   switch (pname) {
+   case GL_TEXTURE_GEN_MODE:
+      {
+         GLenum mode = (GLenum) (GLint) params[0];
+         GLbitfield bit = 0x0;
+         if (texgen->Mode == mode)
+            return;
+         switch (mode) {
+         case GL_OBJECT_LINEAR:
+            bit = TEXGEN_OBJ_LINEAR;
+            break;
+         case GL_EYE_LINEAR:
+            bit = TEXGEN_EYE_LINEAR;
+            break;
+         case GL_SPHERE_MAP:
+            if (coord == GL_S || coord == GL_T)
+               bit = TEXGEN_SPHERE_MAP;
+            break;
+         case GL_REFLECTION_MAP_NV:
+            if (coord != GL_Q)
+               bit = TEXGEN_REFLECTION_MAP_NV;
+            break;
+         case GL_NORMAL_MAP_NV:
+            if (coord != GL_Q)
+               bit = TEXGEN_NORMAL_MAP_NV;
+            break;
+         default:
+            ; /* nop */
+         }
+         if (!bit) {
+            _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+            return;
+         }
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+         texgen->Mode = mode;
+         texgen->_ModeBit = bit;
+      }
+      break;
+
+   case GL_OBJECT_PLANE:
+      {
+         if (TEST_EQ_4V(texgen->ObjectPlane, params))
+            return;
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+         COPY_4FV(texgen->ObjectPlane, params);
+      }
+      break;
+
+   case GL_EYE_PLANE:
+      {
+         GLfloat tmp[4];
+         /* Transform plane equation by the inverse modelview matrix */
+         if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
+            _math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
+         }
+         _mesa_transform_vector(tmp, params,
+                                ctx->ModelviewMatrixStack.Top->inv);
+         if (TEST_EQ_4V(texgen->EyePlane, tmp))
+            return;
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+         COPY_4FV(texgen->EyePlane, tmp);
+      }
+      break;
+
+   default:
+      _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
+      return;
    }
 
    if (ctx->Driver.TexGen)
@@ -330,7 +221,8 @@ _mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
 void GLAPIENTRY
 _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
 {
-   const struct gl_texture_unit *texUnit;
+   struct gl_texture_unit *texUnit;
+   struct gl_texgen *texgen;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
@@ -341,70 +233,24 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
 
    texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
 
-   switch (coord) {
-      case GL_S:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS);
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            COPY_4V( params, texUnit->ObjectPlaneS );
-        }
-        else if (pname==GL_EYE_PLANE) {
-            COPY_4V( params, texUnit->EyePlaneS );
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
-           return;
-        }
-        break;
-      case GL_T:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = ENUM_TO_DOUBLE(texUnit->GenModeT);
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            COPY_4V( params, texUnit->ObjectPlaneT );
-        }
-        else if (pname==GL_EYE_PLANE) {
-            COPY_4V( params, texUnit->EyePlaneT );
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
-           return;
-        }
-        break;
-      case GL_R:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = ENUM_TO_DOUBLE(texUnit->GenModeR);
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            COPY_4V( params, texUnit->ObjectPlaneR );
-        }
-        else if (pname==GL_EYE_PLANE) {
-            COPY_4V( params, texUnit->EyePlaneR );
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
-           return;
-        }
-        break;
-      case GL_Q:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = ENUM_TO_DOUBLE(texUnit->GenModeQ);
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            COPY_4V( params, texUnit->ObjectPlaneQ );
-        }
-        else if (pname==GL_EYE_PLANE) {
-            COPY_4V( params, texUnit->EyePlaneQ );
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
-           return;
-        }
-        break;
-      default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)" );
-        return;
+   texgen = get_texgen(texUnit, coord);
+   if (!texgen) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)");
+      return;
+   }
+
+   switch (pname) {
+   case GL_TEXTURE_GEN_MODE:
+      params[0] = ENUM_TO_DOUBLE(texgen->Mode);
+      break;
+   case GL_OBJECT_PLANE:
+      COPY_4V(params, texgen->ObjectPlane);
+      break;
+   case GL_EYE_PLANE:
+      COPY_4V(params, texgen->EyePlane);
+      break;
+   default:
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
    }
 }
 
@@ -413,7 +259,8 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
 void GLAPIENTRY
 _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
 {
-   const struct gl_texture_unit *texUnit;
+   struct gl_texture_unit *texUnit;
+   struct gl_texgen *texgen;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
@@ -424,70 +271,24 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
 
    texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
 
-   switch (coord) {
-      case GL_S:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = ENUM_TO_FLOAT(texUnit->GenModeS);
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            COPY_4V( params, texUnit->ObjectPlaneS );
-        }
-        else if (pname==GL_EYE_PLANE) {
-            COPY_4V( params, texUnit->EyePlaneS );
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
-           return;
-        }
-        break;
-      case GL_T:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = ENUM_TO_FLOAT(texUnit->GenModeT);
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            COPY_4V( params, texUnit->ObjectPlaneT );
-        }
-        else if (pname==GL_EYE_PLANE) {
-            COPY_4V( params, texUnit->EyePlaneT );
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
-           return;
-        }
-        break;
-      case GL_R:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = ENUM_TO_FLOAT(texUnit->GenModeR);
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            COPY_4V( params, texUnit->ObjectPlaneR );
-        }
-        else if (pname==GL_EYE_PLANE) {
-            COPY_4V( params, texUnit->EyePlaneR );
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
-           return;
-        }
-        break;
-      case GL_Q:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = ENUM_TO_FLOAT(texUnit->GenModeQ);
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            COPY_4V( params, texUnit->ObjectPlaneQ );
-        }
-        else if (pname==GL_EYE_PLANE) {
-            COPY_4V( params, texUnit->EyePlaneQ );
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
-           return;
-        }
-        break;
-      default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)" );
-        return;
+   texgen = get_texgen(texUnit, coord);
+   if (!texgen) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)");
+      return;
+   }
+
+   switch (pname) {
+   case GL_TEXTURE_GEN_MODE:
+      params[0] = ENUM_TO_FLOAT(texgen->Mode);
+      break;
+   case GL_OBJECT_PLANE:
+      COPY_4V(params, texgen->ObjectPlane);
+      break;
+   case GL_EYE_PLANE:
+      COPY_4V(params, texgen->EyePlane);
+      break;
+   default:
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
    }
 }
 
@@ -496,7 +297,8 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
 void GLAPIENTRY
 _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
 {
-   const struct gl_texture_unit *texUnit;
+   struct gl_texture_unit *texUnit;
+   struct gl_texgen *texgen;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
@@ -507,94 +309,30 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
 
    texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
 
-   switch (coord) {
-      case GL_S:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = texUnit->GenModeS;
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            params[0] = (GLint) texUnit->ObjectPlaneS[0];
-            params[1] = (GLint) texUnit->ObjectPlaneS[1];
-            params[2] = (GLint) texUnit->ObjectPlaneS[2];
-            params[3] = (GLint) texUnit->ObjectPlaneS[3];
-        }
-        else if (pname==GL_EYE_PLANE) {
-            params[0] = (GLint) texUnit->EyePlaneS[0];
-            params[1] = (GLint) texUnit->EyePlaneS[1];
-            params[2] = (GLint) texUnit->EyePlaneS[2];
-            params[3] = (GLint) texUnit->EyePlaneS[3];
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
-           return;
-        }
-        break;
-      case GL_T:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = texUnit->GenModeT;
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            params[0] = (GLint) texUnit->ObjectPlaneT[0];
-            params[1] = (GLint) texUnit->ObjectPlaneT[1];
-            params[2] = (GLint) texUnit->ObjectPlaneT[2];
-            params[3] = (GLint) texUnit->ObjectPlaneT[3];
-        }
-        else if (pname==GL_EYE_PLANE) {
-            params[0] = (GLint) texUnit->EyePlaneT[0];
-            params[1] = (GLint) texUnit->EyePlaneT[1];
-            params[2] = (GLint) texUnit->EyePlaneT[2];
-            params[3] = (GLint) texUnit->EyePlaneT[3];
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
-           return;
-        }
-        break;
-      case GL_R:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = texUnit->GenModeR;
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            params[0] = (GLint) texUnit->ObjectPlaneR[0];
-            params[1] = (GLint) texUnit->ObjectPlaneR[1];
-            params[2] = (GLint) texUnit->ObjectPlaneR[2];
-            params[3] = (GLint) texUnit->ObjectPlaneR[3];
-        }
-        else if (pname==GL_EYE_PLANE) {
-            params[0] = (GLint) texUnit->EyePlaneR[0];
-            params[1] = (GLint) texUnit->EyePlaneR[1];
-            params[2] = (GLint) texUnit->EyePlaneR[2];
-            params[3] = (GLint) texUnit->EyePlaneR[3];
-        }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
-           return;
-        }
-        break;
-      case GL_Q:
-         if (pname==GL_TEXTURE_GEN_MODE) {
-            params[0] = texUnit->GenModeQ;
-        }
-        else if (pname==GL_OBJECT_PLANE) {
-            params[0] = (GLint) texUnit->ObjectPlaneQ[0];
-            params[1] = (GLint) texUnit->ObjectPlaneQ[1];
-            params[2] = (GLint) texUnit->ObjectPlaneQ[2];
-            params[3] = (GLint) texUnit->ObjectPlaneQ[3];
-        }
-        else if (pname==GL_EYE_PLANE) {
-            params[0] = (GLint) texUnit->EyePlaneQ[0];
-            params[1] = (GLint) texUnit->EyePlaneQ[1];
-            params[2] = (GLint) texUnit->EyePlaneQ[2];
-            params[3] = (GLint) texUnit->EyePlaneQ[3];
-         }
-        else {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
-           return;
-        }
-        break;
-      default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)" );
-        return;
+   texgen = get_texgen(texUnit, coord);
+   if (!texgen) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)");
+      return;
+   }
+
+   switch (pname) {
+   case GL_TEXTURE_GEN_MODE:
+      params[0] = texgen->Mode;
+      break;
+   case GL_OBJECT_PLANE:
+      params[0] = (GLint) texgen->ObjectPlane[0];
+      params[1] = (GLint) texgen->ObjectPlane[1];
+      params[2] = (GLint) texgen->ObjectPlane[2];
+      params[3] = (GLint) texgen->ObjectPlane[3];
+      break;
+   case GL_EYE_PLANE:
+      params[0] = (GLint) texgen->EyePlane[0];
+      params[1] = (GLint) texgen->EyePlane[1];
+      params[2] = (GLint) texgen->EyePlane[2];
+      params[3] = (GLint) texgen->EyePlane[3];
+      break;
+   default:
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
    }
 }
 
index 8fd69c4f6ac0cf79207c52aee6a5f81f258a9035..4f297738df14757c2e12f03f64ac7bdcbc235c72 100644 (file)
@@ -339,6 +339,17 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
       }
    }
 
+   if (ctx->Extensions.ATI_envmap_bumpmap) {
+      switch (internalFormat) {
+         case GL_DUDV_ATI:
+         case GL_DU8DV8_ATI:
+            return GL_DUDV_ATI;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+
    if (ctx->Extensions.EXT_packed_depth_stencil) {
       switch (internalFormat) {
          case GL_DEPTH_STENCIL_EXT:
@@ -568,6 +579,20 @@ is_depthstencil_format(GLenum format)
    }
 }
 
+/**
+ * Test if the given image format is a dudv format.
+ */
+static GLboolean
+is_dudv_format(GLenum format)
+{
+   switch (format) {
+      case GL_DUDV_ATI:
+      case GL_DU8DV8_ATI:
+         return GL_TRUE;
+      default:
+         return GL_FALSE;
+   }
+}
 
 
 /**
@@ -687,7 +712,7 @@ _mesa_new_texture_image( GLcontext *ctx )
  * Free texture image data.
  * This function is a fallback called via ctx->Driver.FreeTexImageData().
  *
- * \param teximage texture image.
+ * \param texImage texture image.
  *
  * Free the texture image data if it's not marked as client data.
  */
@@ -709,7 +734,7 @@ _mesa_free_texture_image_data(GLcontext *ctx,
 /**
  * Free texture image.
  *
- * \param teximage texture image.
+ * \param texImage texture image.
  *
  * Free the texture image structure and the associated image data.
  */
@@ -766,15 +791,15 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
 {
    switch (target) {
       case GL_TEXTURE_1D:
-         return texUnit->Current1D;
+         return texUnit->CurrentTex[TEXTURE_1D_INDEX];
       case GL_PROXY_TEXTURE_1D:
          return ctx->Texture.ProxyTex[TEXTURE_1D_INDEX];
       case GL_TEXTURE_2D:
-         return texUnit->Current2D;
+         return texUnit->CurrentTex[TEXTURE_2D_INDEX];
       case GL_PROXY_TEXTURE_2D:
          return ctx->Texture.ProxyTex[TEXTURE_2D_INDEX];
       case GL_TEXTURE_3D:
-         return texUnit->Current3D;
+         return texUnit->CurrentTex[TEXTURE_3D_INDEX];
       case GL_PROXY_TEXTURE_3D:
          return ctx->Texture.ProxyTex[TEXTURE_3D_INDEX];
       case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
@@ -785,25 +810,25 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
       case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
       case GL_TEXTURE_CUBE_MAP_ARB:
          return ctx->Extensions.ARB_texture_cube_map
-                ? texUnit->CurrentCubeMap : NULL;
+                ? texUnit->CurrentTex[TEXTURE_CUBE_INDEX] : NULL;
       case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
          return ctx->Extensions.ARB_texture_cube_map
                 ? ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX] : NULL;
       case GL_TEXTURE_RECTANGLE_NV:
          return ctx->Extensions.NV_texture_rectangle
-                ? texUnit->CurrentRect : NULL;
+                ? texUnit->CurrentTex[TEXTURE_RECT_INDEX] : NULL;
       case GL_PROXY_TEXTURE_RECTANGLE_NV:
          return ctx->Extensions.NV_texture_rectangle
                 ? ctx->Texture.ProxyTex[TEXTURE_RECT_INDEX] : NULL;
       case GL_TEXTURE_1D_ARRAY_EXT:
          return ctx->Extensions.MESA_texture_array
-                ? texUnit->Current1DArray : NULL;
+                ? texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX] : NULL;
       case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
          return ctx->Extensions.MESA_texture_array
                 ? ctx->Texture.ProxyTex[TEXTURE_1D_ARRAY_INDEX] : NULL;
       case GL_TEXTURE_2D_ARRAY_EXT:
          return ctx->Extensions.MESA_texture_array
-                ? texUnit->Current2DArray : NULL;
+                ? texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX] : NULL;
       case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
          return ctx->Extensions.MESA_texture_array
                 ? ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL;
@@ -819,7 +844,7 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
  * of the given texture unit.
  *
  * \param ctx GL context.
- * \param texUnit texture unit.
+ * \param texObj texture unit.
  * \param target texture target.
  * \param level image level.
  *
@@ -1527,7 +1552,8 @@ texture_error_check( GLcontext *ctx, GLenum target,
        */
       if (!isProxy) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexImage%dD(format or type)", dimensions);
+                     "glTexImage%dD(incompatible format 0x%x, type 0x%x)",
+                     dimensions, format, type);
       }
       return GL_TRUE;
    }
@@ -1539,10 +1565,12 @@ texture_error_check( GLcontext *ctx, GLenum target,
        (is_index_format(internalFormat) && !indexFormat) ||
        (is_depth_format(internalFormat) != is_depth_format(format)) ||
        (is_ycbcr_format(internalFormat) != is_ycbcr_format(format)) ||
-       (is_depthstencil_format(internalFormat) != is_depthstencil_format(format))) {
+       (is_depthstencil_format(internalFormat) != is_depthstencil_format(format)) ||
+       (is_dudv_format(internalFormat) != is_dudv_format(format))) {
       if (!isProxy)
          _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexImage(internalFormat/format)");
+                     "glTexImage%dD(incompatible internalFormat 0x%x, format 0x%x)",
+                     dimensions, internalFormat, format);
       return GL_TRUE;
    }
 
@@ -1716,7 +1744,8 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions,
 
    if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
       _mesa_error(ctx, GL_INVALID_ENUM,
-                  "glTexSubImage%dD(format or type)", dimensions);
+                  "glTexSubImage%dD(incompatible format 0x%x, type 0x%x)",
+                  dimensions, format, type);
       return GL_TRUE;
    }
 
@@ -1823,7 +1852,6 @@ subtexture_error_check2( GLcontext *ctx, GLuint dimensions,
  * \param internalFormat internal format given by the user.
  * \param width image width given by the user.
  * \param height image height given by the user.
- * \param depth image depth given by the user.
  * \param border texture border.
  * 
  * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
@@ -2273,6 +2301,12 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
       return;
    }
 
+   if (!ctx->Extensions.ATI_envmap_bumpmap
+       && is_dudv_format(format)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
+      return;
+   }
+
    _mesa_lock_texture(ctx, texObj);
    {
       texImage = _mesa_select_tex_image(ctx, texObj, target, level);
@@ -2313,6 +2347,11 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
         _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
         goto out;
       }
+      else if (is_dudv_format(format)
+              && !is_dudv_format(texImage->TexFormat->BaseFormat)) {
+        _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+        goto out;
+      }
 
       if (ctx->Pack.BufferObj->Name) {
         /* packing texture image into a PBO */
@@ -2400,6 +2439,49 @@ update_fbo_texture(GLcontext *ctx, struct gl_texture_object *texObj,
 }
 
 
+/** Debug helper: override the user-requested internal format */
+static GLenum
+override_internal_format(GLenum internalFormat, GLint width, GLint height)
+{
+#if 0
+   if (internalFormat == GL_RGBA16F_ARB ||
+       internalFormat == GL_RGBA32F_ARB) {
+      printf("Convert rgba float tex to int %d x %d\n", width, height);
+      return GL_RGBA;
+   }
+   else if (internalFormat == GL_RGB16F_ARB ||
+            internalFormat == GL_RGB32F_ARB) {
+      printf("Convert rgb float tex to int %d x %d\n", width, height);
+      return GL_RGB;
+   }
+   else if (internalFormat == GL_LUMINANCE_ALPHA16F_ARB ||
+            internalFormat == GL_LUMINANCE_ALPHA32F_ARB) {
+      printf("Convert luminance float tex to int %d x %d\n", width, height);
+      return GL_LUMINANCE_ALPHA;
+   }
+   else if (internalFormat == GL_LUMINANCE16F_ARB ||
+            internalFormat == GL_LUMINANCE32F_ARB) {
+      printf("Convert luminance float tex to int %d x %d\n", width, height);
+      return GL_LUMINANCE;
+   }
+   else if (internalFormat == GL_ALPHA16F_ARB ||
+            internalFormat == GL_ALPHA32F_ARB) {
+      printf("Convert luminance float tex to int %d x %d\n", width, height);
+      return GL_ALPHA;
+   }
+   /*
+   else if (internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) {
+      internalFormat = GL_RGBA;
+   }
+   */
+   else {
+      return internalFormat;
+   }
+#else
+   return internalFormat;
+#endif
+}
+
 
 /*
  * Called from the API.  Note that width includes the border.
@@ -2413,6 +2495,8 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
+   internalFormat = override_internal_format(internalFormat, width, 1);
+
 #if FEATURE_convolve
    if (_mesa_is_color_format(internalFormat)) {
       _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
@@ -2510,6 +2594,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
+   internalFormat = override_internal_format(internalFormat, width, height);
+
 #if FEATURE_convolve
    if (_mesa_is_color_format(internalFormat)) {
       _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
@@ -2624,6 +2710,8 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
+   internalFormat = override_internal_format(internalFormat, width, height);
+
    if (target == GL_TEXTURE_3D ||
        (ctx->Extensions.MESA_texture_array &&
         target == GL_TEXTURE_2D_ARRAY_EXT)) {
index b4e30c8bb72b540fa687a4515c2abb9cd227ccf0..b63f747fe8d3936cd2b5e40e246ac77e524d3fcb 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 
-#include "glheader.h"
+#include "mfeatures.h"
 #if FEATURE_colortable
 #include "colortab.h"
 #endif
@@ -180,7 +180,7 @@ finish_texture_init(GLcontext *ctx, GLenum target,
  * Called via ctx->Driver.DeleteTexture() if not overriden by a driver.
  *
  * \param shared the shared GL state to which the object belongs.
- * \param texOjb the texture object to delete.
+ * \param texObj the texture object to delete.
  */
 void
 _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
@@ -759,37 +759,17 @@ unbind_texobj_from_fbo(GLcontext *ctx, struct gl_texture_object *texObj)
 static void
 unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj)
 {
-   GLuint u;
+   GLuint u, tex;
 
    for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) {
       struct gl_texture_unit *unit = &ctx->Texture.Unit[u];
-      if (texObj == unit->Current1D) {
-         _mesa_reference_texobj(&unit->Current1D, ctx->Shared->Default1D);
-         ASSERT(unit->Current1D);
-      }
-      else if (texObj == unit->Current2D) {
-         _mesa_reference_texobj(&unit->Current2D, ctx->Shared->Default2D);
-         ASSERT(unit->Current2D);
-      }
-      else if (texObj == unit->Current3D) {
-         _mesa_reference_texobj(&unit->Current3D, ctx->Shared->Default3D);
-         ASSERT(unit->Current3D);
-      }
-      else if (texObj == unit->CurrentCubeMap) {
-         _mesa_reference_texobj(&unit->CurrentCubeMap, ctx->Shared->DefaultCubeMap);
-         ASSERT(unit->CurrentCubeMap);
-      }
-      else if (texObj == unit->CurrentRect) {
-         _mesa_reference_texobj(&unit->CurrentRect, ctx->Shared->DefaultRect);
-         ASSERT(unit->CurrentRect);
-      }
-      else if (texObj == unit->Current1DArray) {
-         _mesa_reference_texobj(&unit->Current1DArray, ctx->Shared->Default1DArray);
-         ASSERT(unit->Current1DArray);
-      }
-      else if (texObj == unit->Current2DArray) {
-         _mesa_reference_texobj(&unit->Current2DArray, ctx->Shared->Default2DArray);
-         ASSERT(unit->Current2DArray);
+      for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
+         if (texObj == unit->CurrentTex[tex]) {
+            _mesa_reference_texobj(&unit->CurrentTex[tex],
+                                   ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]);
+            ASSERT(unit->CurrentTex[tex]);
+            break;
+         }
       }
    }
 }
@@ -859,6 +839,35 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
 }
 
 
+/**
+ * Convert a GL texture target enum such as GL_TEXTURE_2D or GL_TEXTURE_3D
+ * into the corresponding Mesa texture target index.
+ * Return -1 if target is invalid.
+ */
+static GLint
+target_enum_to_index(GLenum target)
+{
+   switch (target) {
+   case GL_TEXTURE_1D:
+      return TEXTURE_1D_INDEX;
+   case GL_TEXTURE_2D:
+      return TEXTURE_2D_INDEX;
+   case GL_TEXTURE_3D:
+      return TEXTURE_3D_INDEX;
+   case GL_TEXTURE_CUBE_MAP_ARB:
+      return TEXTURE_CUBE_INDEX;
+   case GL_TEXTURE_RECTANGLE_NV:
+      return TEXTURE_RECT_INDEX;
+   case GL_TEXTURE_1D_ARRAY_EXT:
+      return TEXTURE_1D_ARRAY_INDEX;
+   case GL_TEXTURE_2D_ARRAY_EXT:
+      return TEXTURE_2D_ARRAY_INDEX;
+   default:
+      return -1;
+   }
+}
+
+
 /**
  * Bind a named texture to a texturing target.
  * 
@@ -881,38 +890,20 @@ _mesa_BindTexture( GLenum target, GLuint texName )
    const GLuint unit = ctx->Texture.CurrentUnit;
    struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
    struct gl_texture_object *newTexObj = NULL, *defaultTexObj = NULL;
+   GLint targetIndex;
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
       _mesa_debug(ctx, "glBindTexture %s %d\n",
                   _mesa_lookup_enum_by_nr(target), (GLint) texName);
 
-   switch (target) {
-   case GL_TEXTURE_1D:
-      defaultTexObj = ctx->Shared->Default1D;
-      break;
-   case GL_TEXTURE_2D:
-      defaultTexObj = ctx->Shared->Default2D;
-      break;
-   case GL_TEXTURE_3D:
-      defaultTexObj = ctx->Shared->Default3D;
-      break;
-   case GL_TEXTURE_CUBE_MAP_ARB:
-      defaultTexObj = ctx->Shared->DefaultCubeMap;
-      break;
-   case GL_TEXTURE_RECTANGLE_NV:
-      defaultTexObj = ctx->Shared->DefaultRect;
-      break;
-   case GL_TEXTURE_1D_ARRAY_EXT:
-      defaultTexObj = ctx->Shared->Default1DArray;
-      break;
-   case GL_TEXTURE_2D_ARRAY_EXT:
-      defaultTexObj = ctx->Shared->Default2DArray;
-      break;
-   default:
+   targetIndex = target_enum_to_index(target);
+   if (targetIndex < 0) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)");
       return;
    }
+   assert(targetIndex < NUM_TEXTURE_TARGETS);
+   defaultTexObj = ctx->Shared->DefaultTex[targetIndex];
 
    /*
     * Get pointer to new texture object (newTexObj)
@@ -960,40 +951,8 @@ _mesa_BindTexture( GLenum target, GLuint texName )
     * texture object will be decremented.  It'll be deleted if the
     * count hits zero.
     */
-   switch (target) {
-      case GL_TEXTURE_1D:
-         _mesa_reference_texobj(&texUnit->Current1D, newTexObj);
-         ASSERT(texUnit->Current1D);
-         break;
-      case GL_TEXTURE_2D:
-         _mesa_reference_texobj(&texUnit->Current2D, newTexObj);
-         ASSERT(texUnit->Current2D);
-         break;
-      case GL_TEXTURE_3D:
-         _mesa_reference_texobj(&texUnit->Current3D, newTexObj);
-         ASSERT(texUnit->Current3D);
-         break;
-      case GL_TEXTURE_CUBE_MAP_ARB:
-         _mesa_reference_texobj(&texUnit->CurrentCubeMap, newTexObj);
-         ASSERT(texUnit->CurrentCubeMap);
-         break;
-      case GL_TEXTURE_RECTANGLE_NV:
-         _mesa_reference_texobj(&texUnit->CurrentRect, newTexObj);
-         ASSERT(texUnit->CurrentRect);
-         break;
-      case GL_TEXTURE_1D_ARRAY_EXT:
-         _mesa_reference_texobj(&texUnit->Current1DArray, newTexObj);
-         ASSERT(texUnit->Current1DArray);
-         break;
-      case GL_TEXTURE_2D_ARRAY_EXT:
-         _mesa_reference_texobj(&texUnit->Current2DArray, newTexObj);
-         ASSERT(texUnit->Current2DArray);
-         break;
-      default:
-         /* Bad target should be caught above */
-         _mesa_problem(ctx, "bad target in BindTexture");
-         return;
-   }
+   _mesa_reference_texobj(&texUnit->CurrentTex[targetIndex], newTexObj);
+   ASSERT(texUnit->CurrentTex[targetIndex]);
 
    /* Pass BindTexture call to device driver */
    if (ctx->Driver.BindTexture)
index 865aae86276a7a7954b8ef07713c1d23d034a7f4..50f867e1c1cbb7c40e3033c19b65a06fc8a1941c 100644 (file)
@@ -92,29 +92,29 @@ get_texobj(GLcontext *ctx, GLenum target)
 
    switch (target) {
    case GL_TEXTURE_1D:
-      return texUnit->Current1D;
+      return texUnit->CurrentTex[TEXTURE_1D_INDEX];
    case GL_TEXTURE_2D:
-      return texUnit->Current2D;
+      return texUnit->CurrentTex[TEXTURE_2D_INDEX];
    case GL_TEXTURE_3D:
-      return texUnit->Current3D;
+      return texUnit->CurrentTex[TEXTURE_3D_INDEX];
    case GL_TEXTURE_CUBE_MAP:
       if (ctx->Extensions.ARB_texture_cube_map) {
-         return texUnit->CurrentCubeMap;
+         return texUnit->CurrentTex[TEXTURE_CUBE_INDEX];
       }
       break;
    case GL_TEXTURE_RECTANGLE_NV:
       if (ctx->Extensions.NV_texture_rectangle) {
-         return texUnit->CurrentRect;
+         return texUnit->CurrentTex[TEXTURE_RECT_INDEX];
       }
       break;
    case GL_TEXTURE_1D_ARRAY_EXT:
       if (ctx->Extensions.MESA_texture_array) {
-         return texUnit->Current1DArray;
+         return texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX];
       }
       break;
    case GL_TEXTURE_2D_ARRAY_EXT:
       if (ctx->Extensions.MESA_texture_array) {
-         return texUnit->Current2DArray;
+         return texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX];
       }
       break;
    default:
index 7761af758980659dc3921133fa1e4dc1900a331d..73f8a5339ecbd1ab09daec9573365d0be259ba20 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.1
+ * Version:  7.5
  *
  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
@@ -29,6 +29,7 @@
  */
 
 #include "glheader.h"
+#include "mfeatures.h"
 #include "colormac.h"
 #if FEATURE_colortable
 #include "colortab.h"
@@ -42,7 +43,6 @@
 #include "texstate.h"
 #include "texenvprogram.h"
 #include "mtypes.h"
-#include "math/m_xform.h"
 
 
 
@@ -69,7 +69,7 @@ static const struct gl_tex_env_combine_state default_combine_state = {
 void
 _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst )
 {
-   GLuint i;
+   GLuint u, tex;
 
    ASSERT(src);
    ASSERT(dst);
@@ -81,57 +81,32 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst )
    dst->Texture.SharedPalette = src->Texture.SharedPalette;
 
    /* per-unit state */
-   for (i = 0; i < src->Const.MaxTextureImageUnits; i++) {
-      dst->Texture.Unit[i].Enabled = src->Texture.Unit[i].Enabled;
-      dst->Texture.Unit[i].EnvMode = src->Texture.Unit[i].EnvMode;
-      COPY_4V(dst->Texture.Unit[i].EnvColor, src->Texture.Unit[i].EnvColor);
-      dst->Texture.Unit[i].TexGenEnabled = src->Texture.Unit[i].TexGenEnabled;
-      dst->Texture.Unit[i].GenModeS = src->Texture.Unit[i].GenModeS;
-      dst->Texture.Unit[i].GenModeT = src->Texture.Unit[i].GenModeT;
-      dst->Texture.Unit[i].GenModeR = src->Texture.Unit[i].GenModeR;
-      dst->Texture.Unit[i].GenModeQ = src->Texture.Unit[i].GenModeQ;
-      dst->Texture.Unit[i]._GenBitS = src->Texture.Unit[i]._GenBitS;
-      dst->Texture.Unit[i]._GenBitT = src->Texture.Unit[i]._GenBitT;
-      dst->Texture.Unit[i]._GenBitR = src->Texture.Unit[i]._GenBitR;
-      dst->Texture.Unit[i]._GenBitQ = src->Texture.Unit[i]._GenBitQ;
-      dst->Texture.Unit[i]._GenFlags = src->Texture.Unit[i]._GenFlags;
-      COPY_4V(dst->Texture.Unit[i].ObjectPlaneS, src->Texture.Unit[i].ObjectPlaneS);
-      COPY_4V(dst->Texture.Unit[i].ObjectPlaneT, src->Texture.Unit[i].ObjectPlaneT);
-      COPY_4V(dst->Texture.Unit[i].ObjectPlaneR, src->Texture.Unit[i].ObjectPlaneR);
-      COPY_4V(dst->Texture.Unit[i].ObjectPlaneQ, src->Texture.Unit[i].ObjectPlaneQ);
-      COPY_4V(dst->Texture.Unit[i].EyePlaneS, src->Texture.Unit[i].EyePlaneS);
-      COPY_4V(dst->Texture.Unit[i].EyePlaneT, src->Texture.Unit[i].EyePlaneT);
-      COPY_4V(dst->Texture.Unit[i].EyePlaneR, src->Texture.Unit[i].EyePlaneR);
-      COPY_4V(dst->Texture.Unit[i].EyePlaneQ, src->Texture.Unit[i].EyePlaneQ);
-      dst->Texture.Unit[i].LodBias = src->Texture.Unit[i].LodBias;
+   for (u = 0; u < src->Const.MaxTextureImageUnits; u++) {
+      dst->Texture.Unit[u].Enabled = src->Texture.Unit[u].Enabled;
+      dst->Texture.Unit[u].EnvMode = src->Texture.Unit[u].EnvMode;
+      COPY_4V(dst->Texture.Unit[u].EnvColor, src->Texture.Unit[u].EnvColor);
+      dst->Texture.Unit[u].TexGenEnabled = src->Texture.Unit[u].TexGenEnabled;
+      dst->Texture.Unit[u].GenS = src->Texture.Unit[u].GenS;
+      dst->Texture.Unit[u].GenT = src->Texture.Unit[u].GenT;
+      dst->Texture.Unit[u].GenR = src->Texture.Unit[u].GenR;
+      dst->Texture.Unit[u].GenQ = src->Texture.Unit[u].GenQ;
+      dst->Texture.Unit[u].LodBias = src->Texture.Unit[u].LodBias;
 
       /* GL_EXT_texture_env_combine */
-      dst->Texture.Unit[i].Combine.ModeRGB = src->Texture.Unit[i].Combine.ModeRGB;
-      dst->Texture.Unit[i].Combine.ModeA = src->Texture.Unit[i].Combine.ModeA;
-      COPY_3V(dst->Texture.Unit[i].Combine.SourceRGB, src->Texture.Unit[i].Combine.SourceRGB);
-      COPY_3V(dst->Texture.Unit[i].Combine.SourceA, src->Texture.Unit[i].Combine.SourceA);
-      COPY_3V(dst->Texture.Unit[i].Combine.OperandRGB, src->Texture.Unit[i].Combine.OperandRGB);
-      COPY_3V(dst->Texture.Unit[i].Combine.OperandA, src->Texture.Unit[i].Combine.OperandA);
-      dst->Texture.Unit[i].Combine.ScaleShiftRGB = src->Texture.Unit[i].Combine.ScaleShiftRGB;
-      dst->Texture.Unit[i].Combine.ScaleShiftA = src->Texture.Unit[i].Combine.ScaleShiftA;
+      dst->Texture.Unit[u].Combine = src->Texture.Unit[u].Combine;
+
+      /* GL_ATI_envmap_bumpmap - need this? */
+      dst->Texture.Unit[u].BumpTarget = src->Texture.Unit[u].BumpTarget;
+      COPY_4V(dst->Texture.Unit[u].RotMatrix, src->Texture.Unit[u].RotMatrix);
+
 
       /* copy texture object bindings, not contents of texture objects */
       _mesa_lock_context_textures(dst);
 
-      _mesa_reference_texobj(&dst->Texture.Unit[i].Current1D,
-                             src->Texture.Unit[i].Current1D);
-      _mesa_reference_texobj(&dst->Texture.Unit[i].Current2D,
-                             src->Texture.Unit[i].Current2D);
-      _mesa_reference_texobj(&dst->Texture.Unit[i].Current3D,
-                             src->Texture.Unit[i].Current3D);
-      _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentCubeMap,
-                             src->Texture.Unit[i].CurrentCubeMap);
-      _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentRect,
-                             src->Texture.Unit[i].CurrentRect);
-      _mesa_reference_texobj(&dst->Texture.Unit[i].Current1DArray,
-                             src->Texture.Unit[i].Current1DArray);
-      _mesa_reference_texobj(&dst->Texture.Unit[i].Current2DArray,
-                             src->Texture.Unit[i].Current2DArray);
+      for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
+         _mesa_reference_texobj(&dst->Texture.Unit[u].CurrentTex[tex],
+                                src->Texture.Unit[u].CurrentTex[tex]);
+      }
 
       _mesa_unlock_context_textures(dst);
    }
@@ -204,11 +179,14 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
    case GL_LUMINANCE:
    case GL_RGB:
    case GL_YCBCR_MESA:
+   case GL_DUDV_ATI:
       state->SourceA[0] = GL_PREVIOUS;
       break;
       
    default:
-      _mesa_problem(NULL, "Invalid texBaseFormat in calculate_derived_texenv");
+      _mesa_problem(NULL,
+                    "Invalid texBaseFormat 0x%x in calculate_derived_texenv",
+                    texBaseFormat);
       return;
    }
 
@@ -241,6 +219,7 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
         break;
       case GL_RGB:
       case GL_YCBCR_MESA:
+      case GL_DUDV_ATI:
         mode_rgb = GL_REPLACE;
         break;
       case GL_RGBA:
@@ -267,6 +246,7 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
       case GL_LUMINANCE_ALPHA:
       case GL_RGBA:
       case GL_YCBCR_MESA:
+      case GL_DUDV_ATI:
         state->SourceRGB[2] = GL_TEXTURE;
         state->SourceA[2]   = GL_TEXTURE;
         state->SourceRGB[0] = GL_CONSTANT;
@@ -282,7 +262,8 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
 
    default:
       _mesa_problem(NULL,
-                    "Invalid texture env mode in calculate_derived_texenv");
+                    "Invalid texture env mode 0x%x in calculate_derived_texenv",
+                    mode);
       return;
    }
    
@@ -364,73 +345,20 @@ _mesa_ClientActiveTextureARB(GLenum texture)
 static void
 update_texture_matrices( GLcontext *ctx )
 {
-   GLuint i;
+   GLuint u;
 
-   ctx->Texture._TexMatEnabled = 0;
+   ctx->Texture._TexMatEnabled = 0x0;
 
-   for (i=0; i < ctx->Const.MaxTextureCoordUnits; i++) {
-      if (_math_matrix_is_dirty(ctx->TextureMatrixStack[i].Top)) {
-        _math_matrix_analyse( ctx->TextureMatrixStack[i].Top );
+   for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
+      if (_math_matrix_is_dirty(ctx->TextureMatrixStack[u].Top)) {
+        _math_matrix_analyse( ctx->TextureMatrixStack[u].Top );
 
-        if (ctx->Texture.Unit[i]._ReallyEnabled &&
-            ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY)
-           ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i);
+        if (ctx->Texture.Unit[u]._ReallyEnabled &&
+            ctx->TextureMatrixStack[u].Top->type != MATRIX_IDENTITY)
+           ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u);
 
         if (ctx->Driver.TextureMatrix)
-           ctx->Driver.TextureMatrix( ctx, i, ctx->TextureMatrixStack[i].Top);
-      }
-   }
-}
-
-
-/**
- * Update texture object's _Function field.  We need to do this
- * whenever any of the texture object's shadow-related fields change
- * or when we start/stop using a fragment program.
- *
- * This function could be expanded someday to update additional per-object
- * fields that depend on assorted state changes.
- */
-static void
-update_texture_compare_function(GLcontext *ctx,
-                                struct gl_texture_object *tObj)
-{
-   /* XXX temporarily disable this test since it breaks the GLSL
-    * shadow2D(), etc. functions.
-    */
-   if (0 /*ctx->FragmentProgram._Current*/) {
-      /* Texel/coordinate comparison is ignored for programs.
-       * See GL_ARB_fragment_program/shader spec for details.
-       */
-      tObj->_Function = GL_NONE;
-   }
-   else if (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) {
-      /* GL_ARB_shadow */
-      tObj->_Function = tObj->CompareFunc;
-   }
-   else {
-      tObj->_Function = GL_NONE;  /* pass depth through as grayscale */
-   }
-}
-
-
-/**
- * Helper function for determining which texture object (1D, 2D, cube, etc)
- * should actually be used.
- */
-static void
-texture_override(GLcontext *ctx,
-                 struct gl_texture_unit *texUnit, GLbitfield enableBits,
-                 struct gl_texture_object *texObj, GLuint textureBit)
-{
-   if (!texUnit->_ReallyEnabled && (enableBits & textureBit)) {
-      if (!texObj->_Complete) {
-         _mesa_test_texobj_completeness(ctx, texObj);
-      }
-      if (texObj->_Complete) {
-         texUnit->_ReallyEnabled = textureBit;
-         texUnit->_Current = texObj;
-         update_texture_compare_function(ctx, texObj);
+           ctx->Driver.TextureMatrix( ctx, u, ctx->TextureMatrixStack[u].Top);
       }
    }
 }
@@ -442,6 +370,8 @@ texture_override(GLcontext *ctx,
 static void
 update_tex_combine(GLcontext *ctx, struct gl_texture_unit *texUnit)
 {
+   struct gl_tex_env_combine_state *combine;
+
    /* Set the texUnit->_CurrentCombine field to point to the user's combiner
     * state, or the combiner state which is derived from traditional texenv
     * mode.
@@ -464,17 +394,19 @@ update_tex_combine(GLcontext *ctx, struct gl_texture_unit *texUnit)
       texUnit->_CurrentCombine = & texUnit->_EnvMode;
    }
 
+   combine = texUnit->_CurrentCombine;
+
    /* Determine number of source RGB terms in the combiner function */
-   switch (texUnit->_CurrentCombine->ModeRGB) {
+   switch (combine->ModeRGB) {
    case GL_REPLACE:
-      texUnit->_CurrentCombine->_NumArgsRGB = 1;
+      combine->_NumArgsRGB = 1;
       break;
    case GL_ADD:
    case GL_ADD_SIGNED:
       if (texUnit->EnvMode == GL_COMBINE4_NV)
-         texUnit->_CurrentCombine->_NumArgsRGB = 4;
+         combine->_NumArgsRGB = 4;
       else
-         texUnit->_CurrentCombine->_NumArgsRGB = 2;
+         combine->_NumArgsRGB = 2;
       break;
    case GL_MODULATE:
    case GL_SUBTRACT:
@@ -482,44 +414,48 @@ update_tex_combine(GLcontext *ctx, struct gl_texture_unit *texUnit)
    case GL_DOT3_RGBA:
    case GL_DOT3_RGB_EXT:
    case GL_DOT3_RGBA_EXT:
-      texUnit->_CurrentCombine->_NumArgsRGB = 2;
+      combine->_NumArgsRGB = 2;
       break;
    case GL_INTERPOLATE:
    case GL_MODULATE_ADD_ATI:
    case GL_MODULATE_SIGNED_ADD_ATI:
    case GL_MODULATE_SUBTRACT_ATI:
-      texUnit->_CurrentCombine->_NumArgsRGB = 3;
+      combine->_NumArgsRGB = 3;
+      break;
+   case GL_BUMP_ENVMAP_ATI:
+      /* no real arguments for this case */
+      combine->_NumArgsRGB = 0;
       break;
    default:
-      texUnit->_CurrentCombine->_NumArgsRGB = 0;
+      combine->_NumArgsRGB = 0;
       _mesa_problem(ctx, "invalid RGB combine mode in update_texture_state");
       return;
    }
 
    /* Determine number of source Alpha terms in the combiner function */
-   switch (texUnit->_CurrentCombine->ModeA) {
+   switch (combine->ModeA) {
    case GL_REPLACE:
-      texUnit->_CurrentCombine->_NumArgsA = 1;
+      combine->_NumArgsA = 1;
       break;
    case GL_ADD:
    case GL_ADD_SIGNED:
       if (texUnit->EnvMode == GL_COMBINE4_NV)
-         texUnit->_CurrentCombine->_NumArgsA = 4;
+         combine->_NumArgsA = 4;
       else
-         texUnit->_CurrentCombine->_NumArgsA = 2;
+         combine->_NumArgsA = 2;
       break;
    case GL_MODULATE:
    case GL_SUBTRACT:
-      texUnit->_CurrentCombine->_NumArgsA = 2;
+      combine->_NumArgsA = 2;
       break;
    case GL_INTERPOLATE:
    case GL_MODULATE_ADD_ATI:
    case GL_MODULATE_SIGNED_ADD_ATI:
    case GL_MODULATE_SUBTRACT_ATI:
-      texUnit->_CurrentCombine->_NumArgsA = 3;
+      combine->_NumArgsA = 3;
       break;
    default:
-      texUnit->_CurrentCombine->_NumArgsA = 0;
+      combine->_NumArgsA = 0;
       _mesa_problem(ctx, "invalid Alpha combine mode in update_texture_state");
       break;
    }
@@ -540,6 +476,7 @@ update_texture_state( GLcontext *ctx )
    GLuint unit;
    struct gl_fragment_program *fprog = NULL;
    struct gl_vertex_program *vprog = NULL;
+   GLbitfield enabledFragUnits = 0x0;
 
    if (ctx->Shader.CurrentProgram &&
        ctx->Shader.CurrentProgram->LinkStatus) {
@@ -561,71 +498,70 @@ update_texture_state( GLcontext *ctx )
    /* TODO: only set this if there are actual changes */
    ctx->NewState |= _NEW_TEXTURE;
 
-   ctx->Texture._EnabledUnits = 0;
-   ctx->Texture._GenFlags = 0;
-   ctx->Texture._TexMatEnabled = 0;
-   ctx->Texture._TexGenEnabled = 0;
+   ctx->Texture._EnabledUnits = 0x0;
+   ctx->Texture._GenFlags = 0x0;
+   ctx->Texture._TexMatEnabled = 0x0;
+   ctx->Texture._TexGenEnabled = 0x0;
 
    /*
     * Update texture unit state.
     */
    for (unit = 0; unit < ctx->Const.MaxTextureImageUnits; unit++) {
       struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-      GLbitfield enableBits;
-
-      texUnit->_Current = NULL;
-      texUnit->_ReallyEnabled = 0;
-      texUnit->_GenFlags = 0;
+      GLbitfield enabledVertTargets = 0x0;
+      GLbitfield enabledFragTargets = 0x0;
+      GLbitfield enabledTargets = 0x0;
+      GLuint texIndex;
 
       /* Get the bitmask of texture target enables.
        * enableBits will be a mask of the TEXTURE_*_BIT flags indicating
        * which texture targets are enabled (fixed function) or referenced
        * by a fragment shader/program.  When multiple flags are set, we'll
-       * settle on the one with highest priority (see texture_override below).
+       * settle on the one with highest priority (see below).
        */
-      enableBits = 0x0;
       if (vprog) {
-         enableBits |= vprog->Base.TexturesUsed[unit];
+         enabledVertTargets |= vprog->Base.TexturesUsed[unit];
       }
+
       if (fprog) {
-         enableBits |= fprog->Base.TexturesUsed[unit];
+         enabledFragTargets |= fprog->Base.TexturesUsed[unit];
       }
       else {
          /* fixed-function fragment program */
-         enableBits |= texUnit->Enabled;
+         enabledFragTargets |= texUnit->Enabled;
       }
 
-      if (enableBits == 0x0)
+      enabledTargets = enabledVertTargets | enabledFragTargets;
+
+      texUnit->_ReallyEnabled = 0x0;
+
+      if (enabledTargets == 0x0) {
+         /* neither vertex nor fragment processing uses this unit */
          continue;
+      }
 
-      ASSERT(texUnit->Current1D);
-      ASSERT(texUnit->Current2D);
-      ASSERT(texUnit->Current3D);
-      ASSERT(texUnit->CurrentCubeMap);
-      ASSERT(texUnit->CurrentRect);
-      ASSERT(texUnit->Current1DArray);
-      ASSERT(texUnit->Current2DArray);
-
-      /* Look for the highest-priority texture target that's enabled and
-       * complete.  That's the one we'll use for texturing.  If we're using
-       * a fragment program we're guaranteed that bitcount(enabledBits) <= 1.
+      /* Look for the highest priority texture target that's enabled (or used
+       * by the vert/frag shaders) and "complete".  That's the one we'll use
+       * for texturing.  If we're using vert/frag program we're guaranteed
+       * that bitcount(enabledBits) <= 1.
+       * Note that the TEXTURE_x_INDEX values are in high to low priority.
        */
-      texture_override(ctx, texUnit, enableBits,
-                       texUnit->Current2DArray, TEXTURE_2D_ARRAY_BIT);
-      texture_override(ctx, texUnit, enableBits,
-                       texUnit->Current1DArray, TEXTURE_1D_ARRAY_BIT);
-      texture_override(ctx, texUnit, enableBits,
-                       texUnit->CurrentCubeMap, TEXTURE_CUBE_BIT);
-      texture_override(ctx, texUnit, enableBits,
-                       texUnit->Current3D, TEXTURE_3D_BIT);
-      texture_override(ctx, texUnit, enableBits,
-                       texUnit->CurrentRect, TEXTURE_RECT_BIT);
-      texture_override(ctx, texUnit, enableBits,
-                       texUnit->Current2D, TEXTURE_2D_BIT);
-      texture_override(ctx, texUnit, enableBits,
-                       texUnit->Current1D, TEXTURE_1D_BIT);
+      for (texIndex = 0; texIndex < NUM_TEXTURE_TARGETS; texIndex++) {
+         if (enabledTargets & (1 << texIndex)) {
+            struct gl_texture_object *texObj = texUnit->CurrentTex[texIndex];
+            if (!texObj->_Complete) {
+               _mesa_test_texobj_completeness(ctx, texObj);
+            }
+            if (texObj->_Complete) {
+               texUnit->_ReallyEnabled = 1 << texIndex;
+               _mesa_reference_texobj(&texUnit->_Current, texObj);
+               break;
+            }
+         }
+      }
 
       if (!texUnit->_ReallyEnabled) {
+         _mesa_reference_texobj(&texUnit->_Current, NULL);
          continue;
       }
 
@@ -633,6 +569,9 @@ update_texture_state( GLcontext *ctx )
 
       ctx->Texture._EnabledUnits |= (1 << unit);
 
+      if (enabledFragTargets)
+         enabledFragUnits |= (1 << unit);
+
       update_tex_combine(ctx, texUnit);
    }
 
@@ -644,28 +583,30 @@ update_texture_state( GLcontext *ctx )
          = (fprog->Base.InputsRead >> FRAG_ATTRIB_TEX0) & coordMask;
    }
    else {
-      ctx->Texture._EnabledCoordUnits = ctx->Texture._EnabledUnits;
+      ctx->Texture._EnabledCoordUnits = enabledFragUnits;
    }
 
    /* Setup texgen for those texture coordinate sets that are in use */
    for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) {
       struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
 
+      texUnit->_GenFlags = 0x0;
+
       if (!(ctx->Texture._EnabledCoordUnits & (1 << unit)))
         continue;
 
       if (texUnit->TexGenEnabled) {
         if (texUnit->TexGenEnabled & S_BIT) {
-           texUnit->_GenFlags |= texUnit->_GenBitS;
+           texUnit->_GenFlags |= texUnit->GenS._ModeBit;
         }
         if (texUnit->TexGenEnabled & T_BIT) {
-           texUnit->_GenFlags |= texUnit->_GenBitT;
-        }
-        if (texUnit->TexGenEnabled & Q_BIT) {
-           texUnit->_GenFlags |= texUnit->_GenBitQ;
+           texUnit->_GenFlags |= texUnit->GenT._ModeBit;
         }
         if (texUnit->TexGenEnabled & R_BIT) {
-           texUnit->_GenFlags |= texUnit->_GenBitR;
+           texUnit->_GenFlags |= texUnit->GenR._ModeBit;
+        }
+        if (texUnit->TexGenEnabled & Q_BIT) {
+           texUnit->_GenFlags |= texUnit->GenQ._ModeBit;
         }
 
         ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit);
@@ -748,6 +689,7 @@ static void
 init_texture_unit( GLcontext *ctx, GLuint unit )
 {
    struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+   GLuint tex;
 
    texUnit->EnvMode = GL_MODULATE;
    ASSIGN_4V( texUnit->EnvColor, 0.0, 0.0, 0.0, 0.0 );
@@ -755,35 +697,43 @@ init_texture_unit( GLcontext *ctx, GLuint unit )
    texUnit->Combine = default_combine_state;
    texUnit->_EnvMode = default_combine_state;
    texUnit->_CurrentCombine = & texUnit->_EnvMode;
-
-   texUnit->TexGenEnabled = 0;
-   texUnit->GenModeS = GL_EYE_LINEAR;
-   texUnit->GenModeT = GL_EYE_LINEAR;
-   texUnit->GenModeR = GL_EYE_LINEAR;
-   texUnit->GenModeQ = GL_EYE_LINEAR;
-   texUnit->_GenBitS = TEXGEN_EYE_LINEAR;
-   texUnit->_GenBitT = TEXGEN_EYE_LINEAR;
-   texUnit->_GenBitR = TEXGEN_EYE_LINEAR;
-   texUnit->_GenBitQ = TEXGEN_EYE_LINEAR;
+   texUnit->BumpTarget = GL_TEXTURE0;
+
+   texUnit->TexGenEnabled = 0x0;
+   texUnit->GenS.Mode = GL_EYE_LINEAR;
+   texUnit->GenT.Mode = GL_EYE_LINEAR;
+   texUnit->GenR.Mode = GL_EYE_LINEAR;
+   texUnit->GenQ.Mode = GL_EYE_LINEAR;
+   texUnit->GenS._ModeBit = TEXGEN_EYE_LINEAR;
+   texUnit->GenT._ModeBit = TEXGEN_EYE_LINEAR;
+   texUnit->GenR._ModeBit = TEXGEN_EYE_LINEAR;
+   texUnit->GenQ._ModeBit = TEXGEN_EYE_LINEAR;
 
    /* Yes, these plane coefficients are correct! */
-   ASSIGN_4V( texUnit->ObjectPlaneS, 1.0, 0.0, 0.0, 0.0 );
-   ASSIGN_4V( texUnit->ObjectPlaneT, 0.0, 1.0, 0.0, 0.0 );
-   ASSIGN_4V( texUnit->ObjectPlaneR, 0.0, 0.0, 0.0, 0.0 );
-   ASSIGN_4V( texUnit->ObjectPlaneQ, 0.0, 0.0, 0.0, 0.0 );
-   ASSIGN_4V( texUnit->EyePlaneS, 1.0, 0.0, 0.0, 0.0 );
-   ASSIGN_4V( texUnit->EyePlaneT, 0.0, 1.0, 0.0, 0.0 );
-   ASSIGN_4V( texUnit->EyePlaneR, 0.0, 0.0, 0.0, 0.0 );
-   ASSIGN_4V( texUnit->EyePlaneQ, 0.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenS.ObjectPlane, 1.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenT.ObjectPlane, 0.0, 1.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenR.ObjectPlane, 0.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenQ.ObjectPlane, 0.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenS.EyePlane, 1.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenT.EyePlane, 0.0, 1.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenR.EyePlane, 0.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenQ.EyePlane, 0.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenS.ObjectPlane, 1.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenT.ObjectPlane, 0.0, 1.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenR.ObjectPlane, 0.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenQ.ObjectPlane, 0.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenS.EyePlane, 1.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenT.EyePlane, 0.0, 1.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenR.EyePlane, 0.0, 0.0, 0.0, 0.0 );
+   ASSIGN_4V( texUnit->GenQ.EyePlane, 0.0, 0.0, 0.0, 0.0 );
+   /* no mention of this in spec, but maybe id matrix expected? */
+   ASSIGN_4V( texUnit->RotMatrix, 1.0, 0.0, 0.0, 1.0 );
 
    /* initialize current texture object ptrs to the shared default objects */
-   _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->Default1D);
-   _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->Default2D);
-   _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->Default3D);
-   _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultCubeMap);
-   _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultRect);
-   _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->Default1DArray);
-   _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->Default2DArray);
+   for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
+      _mesa_reference_texobj(&texUnit->CurrentTex[tex],
+                             ctx->Shared->DefaultTex[tex]);
+   }
 }
 
 
@@ -793,26 +743,24 @@ init_texture_unit( GLcontext *ctx, GLuint unit )
 GLboolean
 _mesa_init_texture(GLcontext *ctx)
 {
-   GLuint i;
-
-   assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS);
-   assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS);
+   GLuint u;
 
    /* Texture group */
    ctx->Texture.CurrentUnit = 0;      /* multitexture */
-   ctx->Texture._EnabledUnits = 0;
+   ctx->Texture._EnabledUnits = 0x0;
    ctx->Texture.SharedPalette = GL_FALSE;
 #if FEATURE_colortable
    _mesa_init_colortable(&ctx->Texture.Palette);
 #endif
 
-   for (i = 0; i < MAX_TEXTURE_UNITS; i++)
-      init_texture_unit( ctx, i );
+   for (u = 0; u < MAX_TEXTURE_UNITS; u++)
+      init_texture_unit(ctx, u);
 
    /* After we're done initializing the context's texture state the default
     * texture objects' refcounts should be at least MAX_TEXTURE_UNITS + 1.
     */
-   assert(ctx->Shared->Default1D->RefCount >= MAX_TEXTURE_UNITS + 1);
+   assert(ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]->RefCount
+          >= MAX_TEXTURE_UNITS + 1);
 
    /* Allocate proxy textures */
    if (!alloc_proxy_textures( ctx ))
@@ -832,14 +780,9 @@ _mesa_free_texture_data(GLcontext *ctx)
 
    /* unreference current textures */
    for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) {
-      struct gl_texture_unit *unit = ctx->Texture.Unit + u;
-      _mesa_reference_texobj(&unit->Current1D, NULL);
-      _mesa_reference_texobj(&unit->Current2D, NULL);
-      _mesa_reference_texobj(&unit->Current3D, NULL);
-      _mesa_reference_texobj(&unit->CurrentCubeMap, NULL);
-      _mesa_reference_texobj(&unit->CurrentRect, NULL);
-      _mesa_reference_texobj(&unit->Current1DArray, NULL);
-      _mesa_reference_texobj(&unit->Current2DArray, NULL);
+      for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
+         _mesa_reference_texobj(&ctx->Texture.Unit[u].CurrentTex[tgt], NULL);
+      }
    }
 
    /* Free proxy texture objects */
@@ -847,11 +790,8 @@ _mesa_free_texture_data(GLcontext *ctx)
       ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
 
 #if FEATURE_colortable
-   {
-      GLuint i;
-      for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
-         _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable );
-   }
+   for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++)
+      _mesa_free_colortable_data(&ctx->Texture.Unit[u].ColorTable);
 #endif
 }
 
@@ -864,17 +804,13 @@ _mesa_free_texture_data(GLcontext *ctx)
 void
 _mesa_update_default_objects_texture(GLcontext *ctx)
 {
-   GLuint i;
-
-   for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
-      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
-
-      _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->Default1D);
-      _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->Default2D);
-      _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->Default3D);
-      _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultCubeMap);
-      _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultRect);
-      _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->Default1DArray);
-      _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->Default2DArray);
+   GLuint u, tex;
+
+   for (u = 0; u < MAX_TEXTURE_UNITS; u++) {
+      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u];
+      for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
+         _mesa_reference_texobj(&texUnit->CurrentTex[tex],
+                                ctx->Shared->DefaultTex[tex]);
+      }
    }
 }
index 6360ca15f8137ed7f3e121f7a4043fb0a4916f01..cc3c6958c7df16da10e115406ebd58d6b0e8c324 100644 (file)
@@ -2471,6 +2471,95 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS)
    return GL_TRUE;
 }
 
+GLboolean
+_mesa_texstore_dudv8(TEXSTORE_PARAMS)
+{
+   const GLboolean littleEndian = _mesa_little_endian();
+
+   ASSERT(dstFormat == &_mesa_texformat_dudv8);
+   ASSERT(dstFormat->TexelBytes == 2);
+   ASSERT(ctx->Extensions.ATI_envmap_bumpmap);
+   ASSERT((srcFormat == GL_DU8DV8_ATI) ||
+         (srcFormat == GL_DUDV_ATI));
+   ASSERT(baseInternalFormat == GL_DUDV_ATI);
+
+   if (!srcPacking->SwapBytes && srcType == GL_BYTE &&
+       littleEndian) {
+      /* simple memcpy path */
+      memcpy_texture(ctx, dims,
+                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+                     dstRowStride,
+                     dstImageOffsets,
+                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+                     srcAddr, srcPacking);
+   }
+   else if (srcType == GL_BYTE) {
+
+      GLubyte dstmap[4];
+
+      /* dstmap - how to swizzle from RGBA to dst format:
+       */
+      if (littleEndian) {
+        dstmap[0] = 0;
+        dstmap[1] = 3;
+      }
+      else {
+        dstmap[0] = 3;
+        dstmap[1] = 0;
+      }
+      dstmap[2] = ZERO;                /* ? */
+      dstmap[3] = ONE;         /* ? */
+      
+      _mesa_swizzle_ubyte_image(ctx, dims,
+                               GL_LUMINANCE_ALPHA, /* hack */
+                               GL_UNSIGNED_BYTE, /* hack */
+                               GL_LUMINANCE_ALPHA, /* hack */
+                               dstmap, 2,
+                               dstAddr, dstXoffset, dstYoffset, dstZoffset,
+                               dstRowStride, dstImageOffsets,
+                               srcWidth, srcHeight, srcDepth, srcAddr,
+                               srcPacking);      
+   }   
+   else {
+      /* general path - note this is defined for 2d textures only */
+      const GLint components = _mesa_components_in_format(baseInternalFormat);
+      const GLint srcStride = _mesa_image_row_stride(srcPacking,
+                                                 srcWidth, srcFormat, srcType);
+      GLbyte *tempImage, *dst, *src;
+      GLint row;
+
+      tempImage = (GLbyte *) _mesa_malloc(srcWidth * srcHeight * srcDepth
+                                          * components * sizeof(GLbyte));
+      if (!tempImage)
+         return GL_FALSE;
+
+      src = (GLbyte *) _mesa_image_address(dims, srcPacking, srcAddr,
+                                           srcWidth, srcHeight,
+                                           srcFormat, srcType,
+                                           0, 0, 0);
+
+      dst = tempImage;
+      for (row = 0; row < srcHeight; row++) {
+         _mesa_unpack_dudv_span_byte(ctx, srcWidth, baseInternalFormat,
+                                     dst, srcFormat, srcType, src,
+                                     srcPacking, 0);
+         dst += srcWidth * components;
+         src += srcStride;
+      }
+      src = tempImage;
+      dst = (GLbyte *) dstAddr
+            + dstYoffset * dstRowStride
+            + dstXoffset * dstFormat->TexelBytes;
+      for (row = 0; row < srcHeight; row++) {
+         memcpy(dst, src, srcWidth * dstFormat->TexelBytes);
+         dst += dstRowStride;
+         src += srcWidth * dstFormat->TexelBytes;
+      }
+      _mesa_free((void *) tempImage);
+   }
+   return GL_TRUE;
+}
 
 
 /**
@@ -3882,7 +3971,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
                GLint col;
                GLbitfield transferOps = 0x0;
 
-               if (type == GL_FLOAT && 
+               if (type == GL_FLOAT && texImage->TexFormat->BaseFormat != GL_DUDV_ATI &&
                    ((ctx->Color.ClampReadColor == GL_TRUE) ||
                     (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB &&
                      texImage->TexFormat->DataType != GL_FLOAT)))
index b03386b2acc4c107849f3d694a2ca6f641a390cb..c9e639be4e066ae8c91b104f04c9a1c87474d258 100644 (file)
@@ -78,7 +78,7 @@ extern GLboolean _mesa_texstore_sargb8(TEXSTORE_PARAMS);
 extern GLboolean _mesa_texstore_sl8(TEXSTORE_PARAMS);
 extern GLboolean _mesa_texstore_sla8(TEXSTORE_PARAMS);
 #endif
-
+extern GLboolean _mesa_texstore_dudv8(TEXSTORE_PARAMS);
 
 extern GLchan *
 _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
index 9287e8515cc2d3e79d7020a510c3904966619cf8..f5bf6e2c855e72ffd8be0f34265b943e7fb2c56a 100644 (file)
@@ -1,10 +1,6 @@
 /*
  * Mesa 3-D graphics library
-<<<<<<< HEAD:src/mesa/main/version.h
  * Version:  7.5
-=======
- * Version:  7.4
->>>>>>> origin/gallium-0.2:src/mesa/main/version.h
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  *
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
new file mode 100644 (file)
index 0000000..ead856d
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 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, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file viewport.c
+ * glViewport and glDepthRange functions.
+ */
+
+
+#include "context.h"
+#include "macros.h"
+#include "viewport.h"
+
+
+/**
+ * Set the viewport.
+ * \sa Called via glViewport() or display list execution.
+ *
+ * Flushes the vertices and calls _mesa_set_viewport() with the given
+ * parameters.
+ */
+void GLAPIENTRY
+_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+   _mesa_set_viewport(ctx, x, y, width, height);
+}
+
+
+/**
+ * Set new viewport parameters and update derived state (the _WindowMap
+ * matrix).  Usually called from _mesa_Viewport().
+ * 
+ * \param ctx GL context.
+ * \param x, y coordinates of the lower left corner of the viewport rectangle.
+ * \param width width of the viewport rectangle.
+ * \param height height of the viewport rectangle.
+ */
+void
+_mesa_set_viewport(GLcontext *ctx, GLint x, GLint y,
+                    GLsizei width, GLsizei height)
+{
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height);
+
+   if (width < 0 || height < 0) {
+      _mesa_error(ctx,  GL_INVALID_VALUE,
+                   "glViewport(%d, %d, %d, %d)", x, y, width, height);
+      return;
+   }
+
+   /* clamp width and height to the implementation dependent range */
+   width  = CLAMP(width,  1, (GLsizei) ctx->Const.MaxViewportWidth);
+   height = CLAMP(height, 1, (GLsizei) ctx->Const.MaxViewportHeight);
+
+   ctx->Viewport.X = x;
+   ctx->Viewport.Width = width;
+   ctx->Viewport.Y = y;
+   ctx->Viewport.Height = height;
+   ctx->NewState |= _NEW_VIEWPORT;
+
+#if 1
+   /* XXX remove this someday.  Currently the DRI drivers rely on
+    * the WindowMap matrix being up to date in the driver's Viewport
+    * and DepthRange functions.
+    */
+   _math_matrix_viewport(&ctx->Viewport._WindowMap,
+                         ctx->Viewport.X, ctx->Viewport.Y,
+                         ctx->Viewport.Width, ctx->Viewport.Height,
+                         ctx->Viewport.Near, ctx->Viewport.Far,
+                         ctx->DrawBuffer->_DepthMaxF);
+#endif
+
+   if (ctx->Driver.Viewport) {
+      /* Many drivers will use this call to check for window size changes
+       * and reallocate the z/stencil/accum/etc buffers if needed.
+       */
+      ctx->Driver.Viewport(ctx, x, y, width, height);
+   }
+}
+
+
+/**
+ * Called by glDepthRange
+ *
+ * \param nearval  specifies the Z buffer value which should correspond to
+ *                 the near clip plane
+ * \param farval  specifies the Z buffer value which should correspond to
+ *                the far clip plane
+ */
+void GLAPIENTRY
+_mesa_DepthRange(GLclampd nearval, GLclampd farval)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (MESA_VERBOSE&VERBOSE_API)
+      _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval);
+
+   ctx->Viewport.Near = (GLfloat) CLAMP(nearval, 0.0, 1.0);
+   ctx->Viewport.Far = (GLfloat) CLAMP(farval, 0.0, 1.0);
+   ctx->NewState |= _NEW_VIEWPORT;
+
+#if 1
+   /* XXX remove this someday.  Currently the DRI drivers rely on
+    * the WindowMap matrix being up to date in the driver's Viewport
+    * and DepthRange functions.
+    */
+   _math_matrix_viewport(&ctx->Viewport._WindowMap,
+                         ctx->Viewport.X, ctx->Viewport.Y,
+                         ctx->Viewport.Width, ctx->Viewport.Height,
+                         ctx->Viewport.Near, ctx->Viewport.Far,
+                         ctx->DrawBuffer->_DepthMaxF);
+#endif
+
+   if (ctx->Driver.DepthRange) {
+      ctx->Driver.DepthRange(ctx, nearval, farval);
+   }
+}
+
+
+
+/** 
+ * Initialize the context viewport attribute group.
+ * \param ctx  the GL context.
+ */
+void _mesa_init_viewport(GLcontext *ctx)
+{
+   GLfloat depthMax = 65535.0F; /* sorf of arbitrary */
+
+   /* Viewport group */
+   ctx->Viewport.X = 0;
+   ctx->Viewport.Y = 0;
+   ctx->Viewport.Width = 0;
+   ctx->Viewport.Height = 0;
+   ctx->Viewport.Near = 0.0;
+   ctx->Viewport.Far = 1.0;
+   _math_matrix_ctr(&ctx->Viewport._WindowMap);
+
+   _math_matrix_viewport(&ctx->Viewport._WindowMap, 0, 0, 0, 0,
+                         0.0F, 1.0F, depthMax);
+}
+
+
+/** 
+ * Free the context viewport attribute group data.
+ * \param ctx  the GL context.
+ */
+void _mesa_free_viewport_data(GLcontext *ctx)
+{
+   _math_matrix_dtr(&ctx->Viewport._WindowMap);
+}
+
diff --git a/src/mesa/main/viewport.h b/src/mesa/main/viewport.h
new file mode 100644 (file)
index 0000000..f08fef2
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 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, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef VIEWPORT_H
+#define VIEWPORT_H
+
+
+extern void GLAPIENTRY
+_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height);
+
+
+extern void 
+_mesa_set_viewport(GLcontext *ctx, GLint x, GLint y,
+                   GLsizei width, GLsizei height);
+
+
+extern void GLAPIENTRY
+_mesa_DepthRange(GLclampd nearval, GLclampd farval);
+
+
+extern void 
+_mesa_init_viewport(GLcontext *ctx);
+
+
+extern void 
+_mesa_free_viewport_data(GLcontext *ctx);
+
+
+#endif
index 0204979003e16fdae97ff821027e50195e879070..1f807dc3dc3a0903e3964b905a721eee0a077590 100644 (file)
    ASSERT( tnl->Current );                                             \
    ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES );               \
    ASSERT( tmp_offset >= 0 );                                          \
-                                                                       \
-   /* Save the swapped function's dispatch entry so it can be */       \
-   /* restored later. */                                               \
+                                                                        \
+   if (tnl->SwapCount == 0)                                             \
+      ctx->Driver.BeginVertices( ctx );                                 \
+                                                                        \
+   /* Save the swapped function's dispatch entry so it can be */        \
+   /* restored later. */                                                \
    tnl->Swapped[tnl->SwapCount].location = & (((_glapi_proc *)ctx->Exec)[tmp_offset]); \
    tnl->Swapped[tnl->SwapCount].function = (_glapi_proc)TAG(FUNC);     \
    tnl->SwapCount++;                                                   \
index 7abe6f2565a097dea159b9f8f6991aeefdd86252..2e67db8e55d61ae584bcce3332731af112f96a49 100644 (file)
@@ -231,8 +231,8 @@ extern char *mesa_profile;
 #define  BEGIN_RACE(x)                                                        \
 x = LONG_MAX;                                                                 \
 for (cycle_i = 0; cycle_i <10; cycle_i++) {                                   \
-   register long cycle_tmp1 asm("l0");                                       \
-   register long cycle_tmp2 asm("l1");                                       \
+   register long cycle_tmp1 __asm__("l0");                                   \
+   register long cycle_tmp2 __asm__("l1");                                   \
    /* rd %tick, %l0 */                                                       \
    __asm__ __volatile__ (".word 0xa1410000" : "=r" (cycle_tmp1));  /*  save timestamp   */
 
index 84b4cae4adbfd7462825d4ef023495afb1077be9..58cae88b08b503c1c7425e581be0c1dfa0516ae1 100644 (file)
@@ -1620,3 +1620,24 @@ _math_transposefd( GLfloat to[16], const GLdouble from[16] )
 
 /*@}*/
 
+
+/**
+ * Transform a 4-element row vector (1x4 matrix) by a 4x4 matrix.  This
+ * function is used for transforming clipping plane equations and spotlight
+ * directions.
+ * Mathematically,  u = v * m.
+ * Input:  v - input vector
+ *         m - transformation matrix
+ * Output:  u - transformed vector
+ */
+void
+_mesa_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16] )
+{
+   const GLfloat v0 = v[0], v1 = v[1], v2 = v[2], v3 = v[3];
+#define M(row,col)  m[row + col*4]
+   u[0] = v0 * M(0,0) + v1 * M(1,0) + v2 * M(2,0) + v3 * M(3,0);
+   u[1] = v0 * M(0,1) + v1 * M(1,1) + v2 * M(2,1) + v3 * M(3,1);
+   u[2] = v0 * M(0,2) + v1 * M(1,2) + v2 * M(2,2) + v3 * M(3,2);
+   u[3] = v0 * M(0,3) + v1 * M(1,3) + v2 * M(2,3) + v3 * M(3,3);
+#undef M
+}
index a8d9000e89be05b93918b21111dbef001f69c0df..3bc5de6cd4dde8b5ed33698ed343a1834a1a45b8 100644 (file)
@@ -200,6 +200,9 @@ do {                                                                \
 } while (0)
 
 
+extern void
+_mesa_transform_vector(GLfloat u[4], const GLfloat v[4], const GLfloat m[16]);
+
 
 /*@}*/
 
index fdc8abd4340a50941bab43946773ce6a503597c8..369f2c6e9571bed8193b2948d3010336e3444a1a 100644 (file)
@@ -40,7 +40,6 @@
 #include "m_matrix.h"
 #include "m_translate.h"
 #include "m_xform.h"
-#include "mathmod.h"
 
 
 #ifdef DEBUG_MATH
@@ -97,99 +96,6 @@ transform_func *_mesa_transform_tab[5];
 #undef ARGS
 
 
-
-
-GLvector4f *_mesa_project_points( GLvector4f *proj_vec,
-                                 const GLvector4f *clip_vec )
-{
-   const GLuint stride = clip_vec->stride;
-   const GLfloat *from = (GLfloat *)clip_vec->start;
-   const GLuint count = clip_vec->count;
-   GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start;
-   GLuint i;
-
-   for (i = 0 ; i < count ; i++, STRIDE_F(from, stride))
-   {
-        GLfloat oow = 1.0F / from[3];
-        vProj[i][3] = oow;
-        vProj[i][0] = from[0] * oow;
-        vProj[i][1] = from[1] * oow;
-        vProj[i][2] = from[2] * oow;
-   }
-
-   proj_vec->flags |= VEC_SIZE_4;
-   proj_vec->size = 3;
-   proj_vec->count = clip_vec->count;
-   return proj_vec;
-}
-
-
-
-
-
-
-/*
- * Transform a 4-element row vector (1x4 matrix) by a 4x4 matrix.  This
- * function is used for transforming clipping plane equations and spotlight
- * directions.
- * Mathematically,  u = v * m.
- * Input:  v - input vector
- *         m - transformation matrix
- * Output:  u - transformed vector
- */
-void _mesa_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16] )
-{
-   GLfloat v0=v[0], v1=v[1], v2=v[2], v3=v[3];
-#define M(row,col)  m[row + col*4]
-   u[0] = v0 * M(0,0) + v1 * M(1,0) + v2 * M(2,0) + v3 * M(3,0);
-   u[1] = v0 * M(0,1) + v1 * M(1,1) + v2 * M(2,1) + v3 * M(3,1);
-   u[2] = v0 * M(0,2) + v1 * M(1,2) + v2 * M(2,2) + v3 * M(3,2);
-   u[3] = v0 * M(0,3) + v1 * M(1,3) + v2 * M(2,3) + v3 * M(3,3);
-#undef M
-}
-
-
-/* Useful for one-off point transformations, as in clipping.
- * Note that because the matrix isn't analysed we do too many
- * multiplies, and that the result is always 4-clean.
- */
-void _mesa_transform_point_sz( GLfloat Q[4], const GLfloat M[16],
-                           const GLfloat P[4], GLuint sz )
-{
-   if (Q == P)
-      return;
-
-   if (sz == 4)
-   {
-      Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] *  P[2] + M[12] * P[3];
-      Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] *  P[2] + M[13] * P[3];
-      Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3];
-      Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3];
-   }
-   else if (sz == 3)
-   {
-      Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] *  P[2] + M[12];
-      Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] *  P[2] + M[13];
-      Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14];
-      Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15];
-   }
-   else if (sz == 2)
-   {
-      Q[0] = M[0] * P[0] + M[4] * P[1] +                M[12];
-      Q[1] = M[1] * P[0] + M[5] * P[1] +                M[13];
-      Q[2] = M[2] * P[0] + M[6] * P[1] +                M[14];
-      Q[3] = M[3] * P[0] + M[7] * P[1] +                M[15];
-   }
-   else if (sz == 1)
-   {
-      Q[0] = M[0] * P[0] +                              M[12];
-      Q[1] = M[1] * P[0] +                              M[13];
-      Q[2] = M[2] * P[0] +                              M[14];
-      Q[3] = M[3] * P[0] +                              M[15];
-   }
-}
-
-
 /*
  * This is called only once.  It initializes several tables with pointers
  * to optimized transformation functions.  This is where we can test for
index 24e8ddbd57cfbb6bab37175d79fe0ebdeaa6318e..7ef76e0b926becf9077d347ba9789e62eada8b07 100644 (file)
 #endif
 
 
-extern void
-_mesa_transform_vector(GLfloat u[4], CONST GLfloat v[4], CONST GLfloat m[16]);
-
-
 extern void
 _math_init_transformation(void);
 
@@ -148,18 +144,6 @@ typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec,
                                          CONST GLvector4f *from_vec );
 
 
-extern GLvector4f *_mesa_project_points( GLvector4f *to,
-                                        CONST GLvector4f *from );
-
-extern void _mesa_transform_bounds3( GLubyte *orMask, GLubyte *andMask,
-                                    CONST GLfloat m[16],
-                                    CONST GLfloat src[][3] );
-
-extern void _mesa_transform_bounds2( GLubyte *orMask, GLubyte *andMask,
-                                    CONST GLfloat m[16],
-                                    CONST GLfloat src[][3] );
-
-
 extern dotprod_func  _mesa_dotprod_tab[5];
 extern vec_copy_func _mesa_copy_tab[0x10];
 extern vec_copy_func _mesa_copy_clean_tab[5];
@@ -173,9 +157,6 @@ extern normal_func   _mesa_normal_tab[0xf];
 extern transform_func *_mesa_transform_tab[5];
 
 
-extern void _mesa_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16],
-                                     CONST GLfloat P[4], GLuint sz );
-
 
 #define TransformRaw( to, mat, from ) \
    ( _mesa_transform_tab[(from)->size][(mat)->type]( to, (mat)->m, from ), \
diff --git a/src/mesa/math/mathmod.h b/src/mesa/math/mathmod.h
deleted file mode 100644 (file)
index fb0862b..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version:  3.5
- *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \mainpage Mesa Math Module
- *
- * This module contains math-related utility functions for transforming
- * vertices, translating arrays of numbers from one data type to another,
- * evaluating curved surfaces, etc.
- */
-
-
-#ifndef _MESA_MATH_H_
-#define _MESA_MATH_H_
-
-#endif
index 2e0fc3694a4f709377ff9968227553868d2553f3..a4d0fc3efc85e6a7123671a450744c01c1577651 100644 (file)
@@ -969,6 +969,7 @@ parse_output_color_num (GLcontext * ctx, const GLubyte ** inst,
    GLint i = parse_integer (inst, Program);
 
    if ((i < 0) || (i >= (int)ctx->Const.MaxDrawBuffers)) {
+      *color = 0;
       program_error(ctx, Program->Position, "Invalid draw buffer index");
       return 1;
    }
@@ -1688,7 +1689,7 @@ parse_result_binding(GLcontext *ctx, const GLubyte **inst,
              */
             parse_output_color_num(ctx, inst, Program, &out_color);
             ASSERT(out_color < MAX_DRAW_BUFFERS);
-            *outputReg = FRAG_RESULT_COLR;
+            *outputReg = FRAG_RESULT_COLOR;
          }
          else {
             /* for vtx programs, this is VERTEX_RESULT_POSITION */
@@ -1699,7 +1700,7 @@ parse_result_binding(GLcontext *ctx, const GLubyte **inst,
       case FRAGMENT_RESULT_DEPTH:
          if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
             /* for frag programs, this is FRAGMENT_RESULT_DEPTH */
-            *outputReg = FRAG_RESULT_DEPR;
+            *outputReg = FRAG_RESULT_DEPTH;
          }
          else {
             /* for vtx programs, this is VERTEX_RESULT_COLOR */
@@ -2246,7 +2247,7 @@ parse_declaration (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc
 static GLuint
 parse_masked_dst_reg (GLcontext * ctx, const GLubyte ** inst,
                       struct var_cache **vc_head, struct arb_program *Program,
-                      enum register_file *File, GLuint *Index, GLint *WriteMask)
+                      gl_register_file *File, GLuint *Index, GLint *WriteMask)
 {
    GLuint tmp, result;
    struct var_cache *dst;
@@ -2478,7 +2479,7 @@ static GLuint
 parse_src_reg (GLcontext * ctx, const GLubyte ** inst,
                struct var_cache **vc_head,
                struct arb_program *Program,
-               enum register_file * File, GLint * Index,
+               gl_register_file * File, GLint * Index,
                GLboolean *IsRelOffset )
 {
    struct var_cache *src;
@@ -2527,7 +2528,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst,
                   return 1;
                }
 
-               *File = (enum register_file) src->param_binding_type;
+               *File = (gl_register_file) src->param_binding_type;
 
                switch (*(*inst)++) {
                   case ARRAY_INDEX_ABSOLUTE:
@@ -2573,7 +2574,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst,
                if (parse_param_use (ctx, inst, vc_head, Program, &src))
                   return 1;
 
-               *File = (enum register_file) src->param_binding_type;
+               *File = (gl_register_file) src->param_binding_type;
                *Index = src->param_binding_begin;
                break;
          }
@@ -2598,7 +2599,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst,
 
                /* XXX: We have to handle offsets someplace in here!  -- or are those above? */
             case vt_param:
-               *File = (enum register_file) src->param_binding_type;
+               *File = (gl_register_file) src->param_binding_type;
                *Index = src->param_binding_begin;
                break;
 
@@ -2623,7 +2624,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst,
    }
 
    if (*File == PROGRAM_STATE_VAR) {
-      enum register_file file;
+      gl_register_file file;
 
       /* If we're referencing the Program->Parameters[] array, check if the
        * parameter is really a constant/literal.  If so, set File to CONSTANT.
@@ -2652,7 +2653,7 @@ parse_vector_src_reg(GLcontext *ctx, const GLubyte **inst,
                      struct arb_program *program,
                      struct prog_src_register *reg)
 {
-   enum register_file file;
+   gl_register_file file;
    GLint index;
    GLubyte negateMask;
    GLubyte swizzle[4];
@@ -2686,7 +2687,7 @@ parse_scalar_src_reg(GLcontext *ctx, const GLubyte **inst,
                      struct arb_program *program,
                      struct prog_src_register *reg)
 {
-   enum register_file file;
+   gl_register_file file;
    GLint index;
    GLubyte negateMask;
    GLubyte swizzle[4];
@@ -2722,7 +2723,7 @@ parse_dst_reg(GLcontext * ctx, const GLubyte ** inst,
 {
    GLint mask;
    GLuint idx;
-   enum register_file file;
+   gl_register_file file;
 
    if (parse_masked_dst_reg (ctx, inst, vc_head, program, &file, &idx, &mask))
       return 1;
@@ -2752,9 +2753,6 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst,
 
    _mesa_init_instructions(fp, 1);
 
-   /* Record the position in the program string for debugging */
-   fp->StringPos = Program->Position;
-
    /* OP_ALU_INST or OP_TEX_INST */
    instClass = *(*inst)++;
 
@@ -3016,7 +3014,7 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst,
         {
            GLubyte swizzle[4];
            GLubyte negateMask;
-            enum register_file file;
+            gl_register_file file;
            GLint index;
 
            if (parse_src_reg(ctx, inst, vc_head, Program, &file, &index, &rel))
@@ -3104,6 +3102,9 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst,
                break;
          }
 
+         if (shadow_tex)
+            fp->TexShadow = 1;
+
          /* Don't test the first time a particular sampler is seen.  Each time
           * after that, make sure the shadow state is the same.
           */
@@ -3191,8 +3192,6 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst,
    code = *(*inst)++;
 
    _mesa_init_instructions(vp, 1);
-   /* Record the position in the program string for debugging */
-   vp->StringPos = Program->Position;
 
    switch (type) {
          /* XXX: */
@@ -3356,7 +3355,7 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst,
            GLubyte swizzle[4]; 
            GLubyte negateMask;
            GLboolean relAddr;
-            enum register_file file;
+            gl_register_file file;
            GLint index;
 
            if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg))
@@ -3554,10 +3553,6 @@ parse_instructions(GLcontext * ctx, const GLubyte * inst,
       const GLuint numInst = Program->Base.NumInstructions;
       _mesa_init_instructions(Program->Base.Instructions + numInst, 1);
       Program->Base.Instructions[numInst].Opcode = OPCODE_END;
-      /* YYY Wrong Position in program, whatever, at least not random -> crash
-        Program->Position = parse_position (&inst);
-      */
-      Program->Base.Instructions[numInst].StringPos = Program->Position;
    }
    Program->Base.NumInstructions++;
 
index 7831e0faf98f46d95f4c94678a7d204cbaac8482..329c0ea0b03fdfb6d6399bf2e0cf4b5ec5c5c0bd 100644 (file)
@@ -597,8 +597,7 @@ _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index,
 
    FLUSH_VERTICES(ctx, _NEW_PROGRAM);
 
-   if (!ctx->_CurrentProgram)
-      ASSERT_OUTSIDE_BEGIN_END(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    if (target == GL_FRAGMENT_PROGRAM_ARB
        && ctx->Extensions.ARB_fragment_program) {
@@ -818,8 +817,7 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
    struct gl_program *prog;
    GET_CURRENT_CONTEXT(ctx);
 
-   if (!ctx->_CurrentProgram)
-      ASSERT_OUTSIDE_BEGIN_END(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    if (target == GL_VERTEX_PROGRAM_ARB
        && ctx->Extensions.ARB_vertex_program) {
@@ -1000,8 +998,7 @@ _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string)
    char *dst = (char *) string;
    GET_CURRENT_CONTEXT(ctx);
 
-   if (!ctx->_CurrentProgram)
-      ASSERT_OUTSIDE_BEGIN_END(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    if (target == GL_VERTEX_PROGRAM_ARB) {
       prog = &(ctx->VertexProgram.Current->Base);
index 20e47813729a91caf0e526542c265a36031b5ee7..b935cb562a6bef2c901f5dc776e919a912dd7b9a 100644 (file)
@@ -384,18 +384,12 @@ static const char *InputRegisters[MAX_NV_FRAGMENT_PROGRAM_INPUTS + 1] = {
    "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL
 };
 
+
 static const char *OutputRegisters[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS + 1] = {
-   "COLR", "COLH",
-   /* These are only allows for register combiners */
-   /*
-   "TEX0", "TEX1", "TEX2", "TEX3",
-   */
-   "DEPR", NULL
+   "DEPR", "COLR", "DATA0", NULL
 };
 
 
-
-
 /**********************************************************************/
 
 /**
@@ -828,7 +822,6 @@ static GLboolean
 Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
 {
    GLubyte token[100];
-   GLint j;
 
    /* Match "o[" */
    if (!Parse_String(parseState, "o["))
@@ -839,19 +832,19 @@ Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
       RETURN_ERROR;
 
    /* try to match an output register name */
-   for (j = 0; OutputRegisters[j]; j++) {
-      if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) {
-         static GLuint bothColors = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_COLH);
-         *outputRegNum = j;
-         parseState->outputsWritten |= (1 << j);
-         if ((parseState->outputsWritten & bothColors) == bothColors) {
-            RETURN_ERROR1("Illegal to write to both o[COLR] and o[COLH]");
-         }
-         break;
-      }
+   if (_mesa_strcmp((char *) token, "COLR") == 0 ||
+       _mesa_strcmp((char *) token, "COLH") == 0) {
+      /* note that we don't distinguish between COLR and COLH */
+      *outputRegNum = FRAG_RESULT_COLOR;
+      parseState->outputsWritten |= (1 << FRAG_RESULT_COLOR);
    }
-   if (!OutputRegisters[j])
+   else if (_mesa_strcmp((char *) token, "DEPR") == 0) {
+      *outputRegNum = FRAG_RESULT_DEPTH;
+      parseState->outputsWritten |= (1 << FRAG_RESULT_DEPTH);
+   }
+   else {
       RETURN_ERROR1("Invalid output register name");
+   }
 
    /* Match ']' */
    if (!Parse_String(parseState, "]"))
@@ -1318,8 +1311,6 @@ Parse_InstructionSequence(struct parse_state *parseState,
       }
       else if (Parse_String(parseState, "END")) {
          inst->Opcode = OPCODE_END;
-         inst->StringPos = parseState->curLine - parseState->start;
-         assert(inst->StringPos >= 0);
          parseState->numInst++;
          if (Parse_Token(parseState, token)) {
             RETURN_ERROR1("Code after END opcode.");
@@ -1346,8 +1337,6 @@ Parse_InstructionSequence(struct parse_state *parseState,
          inst->SaturateMode = (instMatch.suffixes & (_S))
             ? SATURATE_ZERO_ONE : SATURATE_OFF;
          inst->CondUpdate = (instMatch.suffixes & (_C)) ? GL_TRUE : GL_FALSE;
-         inst->StringPos = parseState->curLine - parseState->start;
-         assert(inst->StringPos >= 0);
 
          /*
           * parse the input and output operands
@@ -1826,10 +1815,3 @@ _mesa_nv_fragment_input_register_name(GLuint i)
    return InputRegisters[i];
 }
 
-
-const char *
-_mesa_nv_fragment_output_register_name(GLuint i)
-{
-   ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_OUTPUTS);
-   return OutputRegisters[i];
-}
index de45cf543dbf33e905cb948bbaf76038d3cac0fd..ac97921080c5b187729f7a335d6d19073913c533 100644 (file)
@@ -44,9 +44,4 @@ _mesa_print_nv_fragment_program(const struct gl_fragment_program *program);
 extern const char *
 _mesa_nv_fragment_input_register_name(GLuint i);
 
-
-extern const char *
-_mesa_nv_fragment_output_register_name(GLuint i);
-
-
 #endif
index 16116c4339ea67a0974c48412338377d824d1066..50358cf10761afbcd2704160bf6e470e180756e8 100644 (file)
@@ -246,8 +246,7 @@ _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params)
    struct gl_program *prog;
    GET_CURRENT_CONTEXT(ctx);
 
-   if (!ctx->_CurrentProgram)
-      ASSERT_OUTSIDE_BEGIN_END(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    prog = _mesa_lookup_program(ctx, id);
    if (!prog) {
@@ -283,8 +282,7 @@ _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program)
    struct gl_program *prog;
    GET_CURRENT_CONTEXT(ctx);
 
-   if (!ctx->_CurrentProgram)
-      ASSERT_OUTSIDE_BEGIN_END(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    if (pname != GL_PROGRAM_STRING_NV) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringNV(pname)");
@@ -773,8 +771,7 @@ _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name,
 
    GET_CURRENT_CONTEXT(ctx);
 
-   if (!ctx->_CurrentProgram)
-      ASSERT_OUTSIDE_BEGIN_END(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    prog = _mesa_lookup_program(ctx, id);
    if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) {
index 08538c0ee4fbec8907de60dff6063d3868f60cf4..268b577aec9c22b50e9ec34061148463324294ef 100644 (file)
@@ -799,7 +799,6 @@ Parse_UnaryOpInstruction(struct parse_state *parseState,
       RETURN_ERROR1("ABS illegal for vertex program 1.0");
 
    inst->Opcode = opcode;
-   inst->StringPos = parseState->curLine - parseState->start;
 
    /* dest reg */
    if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
@@ -832,7 +831,6 @@ Parse_BiOpInstruction(struct parse_state *parseState,
       RETURN_ERROR1("SUB illegal for vertex program 1.0");
 
    inst->Opcode = opcode;
-   inst->StringPos = parseState->curLine - parseState->start;
 
    /* dest reg */
    if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
@@ -880,7 +878,6 @@ Parse_TriOpInstruction(struct parse_state *parseState,
                        enum prog_opcode opcode)
 {
    inst->Opcode = opcode;
-   inst->StringPos = parseState->curLine - parseState->start;
 
    /* dest reg */
    if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
@@ -951,7 +948,6 @@ Parse_ScalarInstruction(struct parse_state *parseState,
       RETURN_ERROR1("RCC illegal for vertex program 1.0");
 
    inst->Opcode = opcode;
-   inst->StringPos = parseState->curLine - parseState->start;
 
    /* dest reg */
    if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
@@ -977,7 +973,6 @@ static GLboolean
 Parse_AddressInstruction(struct parse_state *parseState, struct prog_instruction *inst)
 {
    inst->Opcode = OPCODE_ARL;
-   inst->StringPos = parseState->curLine - parseState->start;
 
    /* Make ARB_vp backends happy */
    inst->DstReg.File = PROGRAM_ADDRESS;
@@ -1010,7 +1005,6 @@ Parse_EndInstruction(struct parse_state *parseState, struct prog_instruction *in
    GLubyte token[100];
 
    inst->Opcode = OPCODE_END;
-   inst->StringPos = parseState->curLine - parseState->start;
 
    /* this should fail! */
    if (Parse_Token(parseState, token))
@@ -1044,7 +1038,6 @@ Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction *
    GLint idx;
 
    inst->Opcode = OPCODE_PRINT;
-   inst->StringPos = parseState->curLine - parseState->start;
 
    /* The first argument is a literal string 'just like this' */
    if (!Parse_String(parseState, "'"))
diff --git a/src/mesa/shader/prog_debug.c b/src/mesa/shader/prog_debug.c
deleted file mode 100644 (file)
index 7bcb2ef..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5.3
- *
- * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/macros.h"
-#include "nvfragparse.h"
-#include "nvvertparse.h"
-#include "program.h"
-#include "prog_debug.h"
-#include "prog_parameter.h"
-#include "prog_instruction.h"
-
-
-
-/**
- * Functions for the experimental GL_MESA_program_debug extension.
- */
-
-
-/* XXX temporary */
-GLAPI void GLAPIENTRY
-glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback,
-                      GLvoid *data)
-{
-   _mesa_ProgramCallbackMESA(target, callback, data);
-}
-
-
-void
-_mesa_ProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback,
-                          GLvoid *data)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   switch (target) {
-      case GL_FRAGMENT_PROGRAM_ARB:
-         if (!ctx->Extensions.ARB_fragment_program) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)");
-            return;
-         }
-         ctx->FragmentProgram.Callback = callback;
-         ctx->FragmentProgram.CallbackData = data;
-         break;
-      case GL_FRAGMENT_PROGRAM_NV:
-         if (!ctx->Extensions.NV_fragment_program) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)");
-            return;
-         }
-         ctx->FragmentProgram.Callback = callback;
-         ctx->FragmentProgram.CallbackData = data;
-         break;
-      case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
-         if (!ctx->Extensions.ARB_vertex_program &&
-             !ctx->Extensions.NV_vertex_program) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)");
-            return;
-         }
-         ctx->VertexProgram.Callback = callback;
-         ctx->VertexProgram.CallbackData = data;
-         break;
-      default:
-         _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)");
-         return;
-   }
-}
-
-
-/* XXX temporary */
-GLAPI void GLAPIENTRY
-glGetProgramRegisterfvMESA(GLenum target,
-                           GLsizei len, const GLubyte *registerName,
-                           GLfloat *v)
-{
-   _mesa_GetProgramRegisterfvMESA(target, len, registerName, v);
-}
-
-
-void
-_mesa_GetProgramRegisterfvMESA(GLenum target,
-                               GLsizei len, const GLubyte *registerName,
-                               GLfloat *v)
-{
-   char reg[1000];
-   GET_CURRENT_CONTEXT(ctx);
-
-   /* We _should_ be inside glBegin/glEnd */
-#if 0
-   if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA");
-      return;
-   }
-#endif
-
-   /* make null-terminated copy of registerName */
-   len = MIN2((unsigned int) len, sizeof(reg) - 1);
-   _mesa_memcpy(reg, registerName, len);
-   reg[len] = 0;
-
-   switch (target) {
-      case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
-         if (!ctx->Extensions.ARB_vertex_program &&
-             !ctx->Extensions.NV_vertex_program) {
-            _mesa_error(ctx, GL_INVALID_ENUM,
-                        "glGetProgramRegisterfvMESA(target)");
-            return;
-         }
-         if (!ctx->VertexProgram._Enabled) {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glGetProgramRegisterfvMESA");
-            return;
-         }
-         /* GL_NV_vertex_program */
-         if (reg[0] == 'R') {
-            /* Temp register */
-            GLint i = _mesa_atoi(reg + 1);
-            if (i >= (GLint)ctx->Const.VertexProgram.MaxTemps) {
-               _mesa_error(ctx, GL_INVALID_VALUE,
-                           "glGetProgramRegisterfvMESA(registerName)");
-               return;
-            }
-            ctx->Driver.GetProgramRegister(ctx, PROGRAM_TEMPORARY, i, v);
-         }
-         else if (reg[0] == 'v' && reg[1] == '[') {
-            /* Vertex Input attribute */
-            GLuint i;
-            for (i = 0; i < ctx->Const.VertexProgram.MaxAttribs; i++) {
-               const char *name = _mesa_nv_vertex_input_register_name(i);
-               char number[10];
-               _mesa_sprintf(number, "%d", i);
-               if (_mesa_strncmp(reg + 2, name, 4) == 0 ||
-                   _mesa_strncmp(reg + 2, number, _mesa_strlen(number)) == 0) {
-                  ctx->Driver.GetProgramRegister(ctx, PROGRAM_INPUT, i, v);
-                  return;
-               }
-            }
-            _mesa_error(ctx, GL_INVALID_VALUE,
-                        "glGetProgramRegisterfvMESA(registerName)");
-            return;
-         }
-         else if (reg[0] == 'o' && reg[1] == '[') {
-            /* Vertex output attribute */
-         }
-         /* GL_ARB_vertex_program */
-         else if (_mesa_strncmp(reg, "vertex.", 7) == 0) {
-
-         }
-         else {
-            _mesa_error(ctx, GL_INVALID_VALUE,
-                        "glGetProgramRegisterfvMESA(registerName)");
-            return;
-         }
-         break;
-      case GL_FRAGMENT_PROGRAM_ARB:
-         if (!ctx->Extensions.ARB_fragment_program) {
-            _mesa_error(ctx, GL_INVALID_ENUM,
-                        "glGetProgramRegisterfvMESA(target)");
-            return;
-         }
-         if (!ctx->FragmentProgram._Enabled) {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glGetProgramRegisterfvMESA");
-            return;
-         }
-         /* XXX to do */
-         break;
-      case GL_FRAGMENT_PROGRAM_NV:
-         if (!ctx->Extensions.NV_fragment_program) {
-            _mesa_error(ctx, GL_INVALID_ENUM,
-                        "glGetProgramRegisterfvMESA(target)");
-            return;
-         }
-         if (!ctx->FragmentProgram._Enabled) {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glGetProgramRegisterfvMESA");
-            return;
-         }
-         if (reg[0] == 'R') {
-            /* Temp register */
-            GLint i = _mesa_atoi(reg + 1);
-            if (i >= (GLint)ctx->Const.FragmentProgram.MaxTemps) {
-               _mesa_error(ctx, GL_INVALID_VALUE,
-                           "glGetProgramRegisterfvMESA(registerName)");
-               return;
-            }
-            ctx->Driver.GetProgramRegister(ctx, PROGRAM_TEMPORARY,
-                                                   i, v);
-         }
-         else if (reg[0] == 'f' && reg[1] == '[') {
-            /* Fragment input attribute */
-            GLuint i;
-            for (i = 0; i < ctx->Const.FragmentProgram.MaxAttribs; i++) {
-               const char *name = _mesa_nv_fragment_input_register_name(i);
-               if (_mesa_strncmp(reg + 2, name, 4) == 0) {
-                  ctx->Driver.GetProgramRegister(ctx, PROGRAM_INPUT, i, v);
-                  return;
-               }
-            }
-            _mesa_error(ctx, GL_INVALID_VALUE,
-                        "glGetProgramRegisterfvMESA(registerName)");
-            return;
-         }
-         else if (_mesa_strcmp(reg, "o[COLR]") == 0) {
-            /* Fragment output color */
-            ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
-                                           FRAG_RESULT_COLR, v);
-         }
-         else if (_mesa_strcmp(reg, "o[COLH]") == 0) {
-            /* Fragment output color */
-            ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
-                                           FRAG_RESULT_COLH, v);
-         }
-         else if (_mesa_strcmp(reg, "o[DEPR]") == 0) {
-            /* Fragment output depth */
-            ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
-                                           FRAG_RESULT_DEPR, v);
-         }
-         else {
-            /* try user-defined identifiers */
-            const GLfloat *value = _mesa_lookup_parameter_value(
-                       ctx->FragmentProgram.Current->Base.Parameters, -1, reg);
-            if (value) {
-               COPY_4V(v, value);
-            }
-            else {
-               _mesa_error(ctx, GL_INVALID_VALUE,
-                           "glGetProgramRegisterfvMESA(registerName)");
-               return;
-            }
-         }
-         break;
-      default:
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                     "glGetProgramRegisterfvMESA(target)");
-         return;
-   }
-}
diff --git a/src/mesa/shader/prog_debug.h b/src/mesa/shader/prog_debug.h
deleted file mode 100644 (file)
index fc400e1..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5.3
- *
- * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef PROG_DEBUG_H
-#define PROG_DEBUG_H 1
-
-
-/*
- * GL_MESA_program_debug
- */
-
-extern void
-_mesa_ProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback,
-                          GLvoid *data);
-
-extern void
-_mesa_GetProgramRegisterfvMESA(GLenum target, GLsizei len,
-                               const GLubyte *registerName, GLfloat *v);
-
-
-
-#endif /* PROG_DEBUG_H */
index a93733c085288fd3f89d255d976b87e2c2a8f1ea..a60cda674bad25bf02611977ca4eb0d19bf0a7ff 100644 (file)
@@ -186,30 +186,6 @@ get_dst_register_pointer(const struct prog_dst_register *dest,
 
 
 
-#if FEATURE_MESA_program_debug
-static struct gl_program_machine *CurrentMachine = NULL;
-
-/**
- * For GL_MESA_program_debug.
- * Return current value (4*GLfloat) of a program register.
- * Called via ctx->Driver.GetProgramRegister().
- */
-void
-_mesa_get_program_register(GLcontext *ctx, enum register_file file,
-                           GLuint index, GLfloat val[4])
-{
-   if (CurrentMachine) {
-      struct prog_src_register srcReg;
-      const GLfloat *src;
-      srcReg.File = file;
-      srcReg.Index = index;
-      src = get_src_register_pointer(&srcReg, CurrentMachine);
-      COPY_4V(val, src);
-   }
-}
-#endif /* FEATURE_MESA_program_debug */
-
-
 /**
  * Fetch a 4-element float vector from the given source register.
  * Apply swizzling and negating as needed.
@@ -633,10 +609,6 @@ _mesa_execute_program(GLcontext * ctx,
       printf("execute program %u --------------------\n", program->Id);
    }
 
-#if FEATURE_MESA_program_debug
-   CurrentMachine = machine;
-#endif
-
    if (program->Target == GL_VERTEX_PROGRAM_ARB) {
       machine->EnvParams = ctx->VertexProgram.Parameters;
    }
@@ -647,15 +619,6 @@ _mesa_execute_program(GLcontext * ctx,
    for (pc = 0; pc < numInst; pc++) {
       const struct prog_instruction *inst = program->Instructions + pc;
 
-#if FEATURE_MESA_program_debug
-      if (ctx->FragmentProgram.CallbackEnabled &&
-          ctx->FragmentProgram.Callback) {
-         ctx->FragmentProgram.CurrentPosition = inst->StringPos;
-         ctx->FragmentProgram.Callback(program->Target,
-                                       ctx->FragmentProgram.CallbackData);
-      }
-#endif
-
       if (DEBUG_PROG) {
          _mesa_print_instruction(inst);
       }
@@ -1780,9 +1743,5 @@ _mesa_execute_program(GLcontext * ctx,
 
    } /* for pc */
 
-#if FEATURE_MESA_program_debug
-   CurrentMachine = NULL;
-#endif
-
    return GL_TRUE;
 }
index 8ceb7b092e88f89e34224286becdb7d5d306d38a..adefc5439dea2bf273518c061eb0f793400e8da1 100644 (file)
@@ -73,7 +73,7 @@ struct gl_program_machine
 
 
 extern void
-_mesa_get_program_register(GLcontext *ctx, enum register_file file,
+_mesa_get_program_register(GLcontext *ctx, gl_register_file file,
                            GLuint index, GLfloat val[4]);
 
 extern GLboolean
index 4a6d0d670aca655d873985df9e50138365642369..6a21152c60be458c7680c9615c038c2ca199eb19 100644 (file)
@@ -254,6 +254,7 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
 GLuint
 _mesa_num_inst_src_regs(gl_inst_opcode opcode)
 {
+   ASSERT(opcode < MAX_OPCODE);
    ASSERT(opcode == InstInfo[opcode].Opcode);
    ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode);
    return InstInfo[opcode].NumSrcRegs;
@@ -266,6 +267,7 @@ _mesa_num_inst_src_regs(gl_inst_opcode opcode)
 GLuint
 _mesa_num_inst_dst_regs(gl_inst_opcode opcode)
 {
+   ASSERT(opcode < MAX_OPCODE);
    ASSERT(opcode == InstInfo[opcode].Opcode);
    ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode);
    return InstInfo[opcode].NumDstRegs;
index c649b3db5ee603e5bdc01cc9636508fd587764af..4adce11f957ab86191fc36b2fd55391ec86346b4 100644 (file)
@@ -38,6 +38,9 @@
 #define PROG_INSTRUCTION_H
 
 
+#include "main/mfeatures.h"
+
+
 /**
  * Swizzle indexes.
  * Do not change!
@@ -239,13 +242,22 @@ typedef enum prog_opcode {
 } gl_inst_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
+
+
 /**
  * Instruction source register.
  */
 struct prog_src_register
 {
    GLuint File:4;      /**< One of the PROGRAM_* register file values. */
-   GLint Index:9;      /**< May be negative for relative addressing. */
+   GLint Index:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit.
+                                     * May be negative for relative addressing.
+                                     */
    GLuint Swizzle:12;
    GLuint RelAddr:1;
 
@@ -289,7 +301,7 @@ struct prog_src_register
 struct prog_dst_register
 {
    GLuint File:4;      /**< One of the PROGRAM_* register file values */
-   GLuint Index:8;
+   GLuint Index:INST_INDEX_BITS;  /**< Unsigned, never negative */
    GLuint WriteMask:4;
    GLuint RelAddr:1;
 
@@ -322,8 +334,7 @@ struct prog_dst_register
     */
    GLuint CondSrc:1;
    /*@}*/
-
-   GLuint pad:30;
+   GLuint pad:28;
 };
 
 
@@ -333,14 +344,6 @@ struct prog_dst_register
 struct prog_instruction
 {
    gl_inst_opcode Opcode;
-#if FEATURE_MESA_program_debug
-   GLshort StringPos;
-#endif
-   /**
-    * Arbitrary data.  Used for the PRINT, CAL, and BRA instructions.
-    */
-   void *Data;
-
    struct prog_src_register SrcReg[3];
    struct prog_dst_register DstReg;
 
@@ -380,7 +383,7 @@ struct prog_instruction
    GLuint SaturateMode:2;
    
    /**
-    * Per-instruction selectable precision.
+    * Per-instruction selectable precision: FLOAT32, FLOAT16, FIXED12.
     *
     * \since
     * NV_fragment_program, NV_fragment_program_option.
@@ -388,45 +391,36 @@ struct prog_instruction
    GLuint Precision:3;
 
    /**
-    * \name Texture source controls.
-    * 
-    * The texture source controls are only used with the \c TEX, \c TXD,
-    * \c TXL, and \c TXP instructions.
-    *
-    * \since
-    * ARB_fragment_program, NV_fragment_program, NV_vertex_program3.
+    * \name Extra fields for TEX, TXB, TXD, TXL, TXP instructions.
     */
    /*@{*/
-   /**
-    * Source texture unit.  OpenGL supports a maximum of 32 texture
-    * units.
-    */
+   /** Source texture unit. */
    GLuint TexSrcUnit:5;
    
-   /**
-    * Source texture target, one of TEXTURE_{1D,2D,3D,CUBE,RECT}_INDEX.
-    */
+   /** Source texture target, one of TEXTURE_{1D,2D,3D,CUBE,RECT}_INDEX */
    GLuint TexSrcTarget:3;
+
+   /** True if tex instruction should do shadow comparison */
+   GLuint TexShadow:1;
    /*@}*/
 
    /**
     * For BRA and CAL instructions, the location to jump to.
     * For BGNLOOP, points to ENDLOOP (and vice-versa).
     * For BRK, points to BGNLOOP (which points to ENDLOOP).
-    * For IF, points to else or endif.
-    * For ELSE, points to endif.
+    * For IF, points to ELSE or ENDIF.
+    * For ELSE, points to ENDIF.
     */
    GLint BranchTarget;
 
-#if 01 /* XXX just use this for i965 driver for now! */
-   /**
-    * For TEX instructions in shaders, the sampler to use for the
-    * texture lookup.
-    */
-   GLint Sampler;
-#endif
-
+   /** for debugging purposes */
    const char *Comment;
+
+   /** Arbitrary data.  Used for OPCODE_PRINT and some drivers */
+   void *Data;
+
+   /** for driver use (try to remove someday) */
+   GLint Aux;
 };
 
 
diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c
new file mode 100644 (file)
index 0000000..ec06da1
--- /dev/null
@@ -0,0 +1,427 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 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, 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
+ * VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "program.h"
+#include "prog_instruction.h"
+#include "prog_optimize.h"
+#include "prog_print.h"
+
+
+static GLboolean dbg = GL_FALSE;
+
+
+/**
+ * In 'prog' remove instruction[i] if removeFlags[i] == TRUE.
+ * \return number of instructions removed
+ */
+static GLuint
+remove_instructions(struct gl_program *prog, const GLboolean *removeFlags)
+{
+   GLint i, removeEnd = 0, removeCount = 0;
+   GLuint totalRemoved = 0;
+
+   /* go backward */
+   for (i = prog->NumInstructions - 1; i >= 0; i--) {
+      if (removeFlags[i]) {
+         totalRemoved++;
+         if (removeCount == 0) {
+            /* begin a run of instructions to remove */
+            removeEnd = i;
+            removeCount = 1;
+         }
+         else {
+            /* extend the run of instructions to remove */
+            removeCount++;
+         }
+      }
+      else {
+         /* don't remove this instruction, but check if the preceeding
+          * instructions are to be removed.
+          */
+         if (removeCount > 0) {
+            GLint removeStart = removeEnd - removeCount + 1;
+            _mesa_delete_instructions(prog, removeStart, removeCount);
+            removeStart = removeCount = 0; /* reset removal info */
+         }
+      }
+   }
+   return totalRemoved;
+}
+
+
+/**
+ * Consolidate temporary registers to use low numbers.  For example, if the
+ * shader only uses temps 4, 5, 8, replace them with 0, 1, 2.
+ */
+static void
+_mesa_consolidate_registers(struct gl_program *prog)
+{
+   GLboolean tempUsed[MAX_PROGRAM_TEMPS];
+   GLuint tempMap[MAX_PROGRAM_TEMPS];
+   GLuint tempMax = 0, i;
+
+   if (dbg) {
+      _mesa_printf("Optimize: Begin register consolidation\n");
+   }
+
+   memset(tempUsed, 0, sizeof(tempUsed));
+
+   /* set tempUsed[i] if temporary [i] is referenced */
+   for (i = 0; i < prog->NumInstructions; i++) {
+      const struct prog_instruction *inst = prog->Instructions + i;
+      const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
+      GLuint j;
+      for (j = 0; j < numSrc; j++) {
+         if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) {
+            const GLuint index = inst->SrcReg[j].Index;
+            ASSERT(index < MAX_PROGRAM_TEMPS);
+            tempUsed[index] = GL_TRUE;
+            tempMax = MAX2(tempMax, index);
+            break;
+         }
+      }
+      if (inst->DstReg.File == PROGRAM_TEMPORARY) {
+         const GLuint index = inst->DstReg.Index;
+         ASSERT(index < MAX_PROGRAM_TEMPS);
+         tempUsed[index] = GL_TRUE;
+         tempMax = MAX2(tempMax, index);
+      }
+   }
+
+   /* allocate a new index for each temp that's used */
+   {
+      GLuint freeTemp = 0;
+      for (i = 0; i <= tempMax; i++) {
+         if (tempUsed[i]) {
+            tempMap[i] = freeTemp++;
+            /*_mesa_printf("replace %u with %u\n", i, tempMap[i]);*/
+         }
+      }
+      if (freeTemp == tempMax + 1) {
+         /* no consolidation possible */
+         return;
+      }         
+      if (dbg) {
+         _mesa_printf("Replace regs 0..%u with 0..%u\n", tempMax, freeTemp-1);
+      }
+   }
+
+   /* now replace occurances of old temp indexes with new indexes */
+   for (i = 0; i < prog->NumInstructions; i++) {
+      struct prog_instruction *inst = prog->Instructions + i;
+      const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
+      GLuint j;
+      for (j = 0; j < numSrc; j++) {
+         if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) {
+            GLuint index = inst->SrcReg[j].Index;
+            assert(index <= tempMax);
+            assert(tempUsed[index]);
+            inst->SrcReg[j].Index = tempMap[index];
+         }
+      }
+      if (inst->DstReg.File == PROGRAM_TEMPORARY) {
+         const GLuint index = inst->DstReg.Index;
+         assert(tempUsed[index]);
+         assert(index <= tempMax);
+         inst->DstReg.Index = tempMap[index];
+      }
+   }
+   if (dbg) {
+      _mesa_printf("Optimize: End register consolidation\n");
+   }
+}
+
+
+/**
+ * Remove dead instructions from the given program.
+ * This is very primitive for now.  Basically look for temp registers
+ * that are written to but never read.  Remove any instructions that
+ * write to such registers.  Be careful with condition code setters.
+ */
+static void
+_mesa_remove_dead_code(struct gl_program *prog)
+{
+   GLboolean tempWritten[MAX_PROGRAM_TEMPS], tempRead[MAX_PROGRAM_TEMPS];
+   GLboolean *removeInst; /* per-instruction removal flag */
+   GLuint i, rem;
+
+   memset(tempWritten, 0, sizeof(tempWritten));
+   memset(tempRead, 0, sizeof(tempRead));
+
+   if (dbg) {
+      _mesa_printf("Optimize: Begin dead code removal\n");
+      /*_mesa_print_program(prog);*/
+   }
+
+   removeInst = (GLboolean *)
+      _mesa_calloc(prog->NumInstructions * sizeof(GLboolean));
+
+   /* Determine which temps are read and written */
+   for (i = 0; i < prog->NumInstructions; i++) {
+      const struct prog_instruction *inst = prog->Instructions + i;
+      const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
+      GLuint j;
+
+      /* check src regs */
+      for (j = 0; j < numSrc; j++) {
+         if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) {
+            const GLuint index = inst->SrcReg[j].Index;
+            ASSERT(index < MAX_PROGRAM_TEMPS);
+
+            if (inst->SrcReg[j].RelAddr) {
+               if (dbg)
+                  _mesa_printf("abort remove dead code (indirect temp)\n");
+               return;
+            }
+
+            tempRead[index] = GL_TRUE;
+         }
+      }
+
+      /* check dst reg */
+      if (inst->DstReg.File == PROGRAM_TEMPORARY) {
+         const GLuint index = inst->DstReg.Index;
+         ASSERT(index < MAX_PROGRAM_TEMPS);
+
+         if (inst->DstReg.RelAddr) {
+            if (dbg)
+               _mesa_printf("abort remove dead code (indirect temp)\n");
+            return;
+         }
+
+         tempWritten[index] = GL_TRUE;
+         if (inst->CondUpdate) {
+            /* If we're writing to this register and setting condition
+             * codes we cannot remove the instruction.  Prevent removal
+             * by setting the 'read' flag.
+             */
+            tempRead[index] = GL_TRUE;
+         }
+      }
+   }
+
+   if (dbg) {
+      for (i = 0; i < MAX_PROGRAM_TEMPS; i++) {
+         if (tempWritten[i] && !tempRead[i])
+            _mesa_printf("Remove writes to tmp %u\n", i);
+      }
+   }
+
+   /* find instructions that write to dead registers, flag for removal */
+   for (i = 0; i < prog->NumInstructions; i++) {
+      const struct prog_instruction *inst = prog->Instructions + i;
+      if (inst->DstReg.File == PROGRAM_TEMPORARY) {
+         GLint index = inst->DstReg.Index;
+         removeInst[i] = (tempWritten[index] && !tempRead[index]);
+         if (dbg && removeInst[i]) {
+            _mesa_printf("Remove inst %u: ", i);
+            _mesa_print_instruction(inst);
+         }
+      }
+   }
+
+   /* now remove the instructions which aren't needed */
+   rem = remove_instructions(prog, removeInst);
+
+   _mesa_free(removeInst);
+
+   if (dbg) {
+      _mesa_printf("Optimize: End dead code removal.  %u instructions removed\n", rem);
+      /*_mesa_print_program(prog);*/
+   }
+}
+
+
+enum temp_use
+{
+   READ,
+   WRITE,
+   FLOW,
+   END
+};
+
+/**
+ * Scan forward in program from 'start' for the next occurance of TEMP[index].
+ * Return READ, WRITE, FLOW or END to indicate the next usage or an indicator
+ * that we can't look further.
+ */
+static enum temp_use
+find_next_temp_use(const struct gl_program *prog, GLuint start, GLuint index)
+{
+   GLuint i;
+
+   for (i = start; i < prog->NumInstructions; i++) {
+      const struct prog_instruction *inst = prog->Instructions + i;
+      switch (inst->Opcode) {
+      case OPCODE_BGNLOOP:
+      case OPCODE_ENDLOOP:
+      case OPCODE_BGNSUB:
+      case OPCODE_ENDSUB:
+         return FLOW;
+      default:
+         {
+            const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
+            GLuint j;
+            for (j = 0; j < numSrc; j++) {
+               if (inst->SrcReg[j].File == PROGRAM_TEMPORARY &&
+                   inst->SrcReg[j].Index == index)
+                  return READ;
+            }
+            if (inst->DstReg.File == PROGRAM_TEMPORARY &&
+                inst->DstReg.Index == index)
+               return WRITE;
+         }
+      }
+   }
+
+   return END;
+}
+
+
+/**
+ * Try to remove extraneous MOV instructions from the given program.
+ */
+static void
+_mesa_remove_extra_moves(struct gl_program *prog)
+{
+   GLboolean *removeInst; /* per-instruction removal flag */
+   GLuint i, rem, loopNesting = 0, subroutineNesting = 0;
+
+   if (dbg) {
+      _mesa_printf("Optimize: Begin remove extra moves\n");
+      _mesa_print_program(prog);
+   }
+
+   removeInst = (GLboolean *)
+      _mesa_calloc(prog->NumInstructions * sizeof(GLboolean));
+
+   /*
+    * Look for sequences such as this:
+    *    FOO tmpX, arg0, arg1;
+    *    MOV tmpY, tmpX;
+    * and convert into:
+    *    FOO tmpY, arg0, arg1;
+    */
+
+   for (i = 0; i < prog->NumInstructions; i++) {
+      const struct prog_instruction *inst = prog->Instructions + i;
+
+      switch (inst->Opcode) {
+      case OPCODE_BGNLOOP:
+         loopNesting++;
+         break;
+      case OPCODE_ENDLOOP:
+         loopNesting--;
+         break;
+      case OPCODE_BGNSUB:
+         subroutineNesting++;
+         break;
+      case OPCODE_ENDSUB:
+         subroutineNesting--;
+         break;
+      case OPCODE_MOV:
+         if (i > 0 &&
+             loopNesting == 0 &&
+             subroutineNesting == 0 &&
+             inst->SrcReg[0].File == PROGRAM_TEMPORARY &&
+             inst->SrcReg[0].Swizzle == SWIZZLE_XYZW) {
+            /* see if this MOV can be removed */
+            const GLuint tempIndex = inst->SrcReg[0].Index;
+            struct prog_instruction *prevInst;
+            GLuint prevI;
+
+            /* get pointer to previous instruction */
+            prevI = i - 1;
+            while (removeInst[prevI] && prevI > 0)
+               prevI--;
+            prevInst = prog->Instructions + prevI;
+
+            if (prevInst->DstReg.File == PROGRAM_TEMPORARY &&
+                prevInst->DstReg.Index == tempIndex &&
+                prevInst->DstReg.WriteMask == WRITEMASK_XYZW) {
+
+               enum temp_use next_use =
+                  find_next_temp_use(prog, i + 1, tempIndex);
+
+               if (next_use == WRITE || next_use == END) {
+                  /* OK, we can safely remove this MOV instruction.
+                   * Transform:
+                   *   prevI: FOO tempIndex, x, y;
+                   *       i: MOV z, tempIndex;
+                   * Into:
+                   *   prevI: FOO z, x, y;
+                   */
+
+                  /* patch up prev inst */
+                  prevInst->DstReg.File = inst->DstReg.File;
+                  prevInst->DstReg.Index = inst->DstReg.Index;
+
+                  /* flag this instruction for removal */
+                  removeInst[i] = GL_TRUE;
+
+                  if (dbg) {
+                     _mesa_printf("Remove MOV at %u\n", i);
+                     _mesa_printf("new prev inst %u: ", prevI);
+                     _mesa_print_instruction(prevInst);
+                  }
+               }
+            }
+         }
+         break;
+      default:
+         ; /* nothing */
+      }
+   }
+
+   /* now remove the instructions which aren't needed */
+   rem = remove_instructions(prog, removeInst);
+
+   if (dbg) {
+      _mesa_printf("Optimize: End remove extra moves.  %u instructions removed\n", rem);
+      /*_mesa_print_program(prog);*/
+   }
+}
+
+
+/**
+ * Apply optimizations to the given program to eliminate unnecessary
+ * instructions, temp regs, etc.
+ */
+void
+_mesa_optimize_program(GLcontext *ctx, struct gl_program *program)
+{
+   if (1)
+      _mesa_remove_dead_code(program);
+
+   if (0) /* not test much yet */
+      _mesa_remove_extra_moves(program);
+
+   if (1)
+      _mesa_consolidate_registers(program);
+}
diff --git a/src/mesa/shader/prog_optimize.h b/src/mesa/shader/prog_optimize.h
new file mode 100644 (file)
index 0000000..d102cfd
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 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, 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
+ * VMWARE 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 PROG_OPT_H
+#define PROG_OPT_H
+
+struct gl_program;
+
+extern void
+_mesa_optimize_program(GLcontext *ctx, struct gl_program *program);
+
+#endif
index 8ae961241f6d1f0267ff52919730f928194e0cce..66edae9001dbcbc1fe0d90eea341a6758e828e46 100644 (file)
@@ -78,7 +78,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList)
  */
 GLint
 _mesa_add_parameter(struct gl_program_parameter_list *paramList,
-                    enum register_file type, const char *name,
+                    gl_register_file type, const char *name,
                     GLuint size, GLenum datatype, const GLfloat *values,
                     const gl_state_index state[STATE_LENGTH],
                     GLbitfield flags)
@@ -517,7 +517,7 @@ _mesa_lookup_parameter_index(const struct gl_program_parameter_list *paramList,
  * swizzling to find a match.
  * \param list  the parameter list to search
  * \param v  the float vector to search for
- * \param size  number of element in v
+ * \param vSize  number of element in v
  * \param posOut  returns the position of the constant, if found
  * \param swizzleOut  returns a swizzle mask describing location of the
  *                    vector elements if found.
@@ -681,7 +681,7 @@ _mesa_combine_parameter_lists(const struct gl_program_parameter_list *listA,
  */
 GLuint
 _mesa_longest_parameter_name(const struct gl_program_parameter_list *list,
-                             enum register_file type)
+                             gl_register_file type)
 {
    GLuint i, maxLen = 0;
    if (!list)
@@ -702,7 +702,7 @@ _mesa_longest_parameter_name(const struct gl_program_parameter_list *list,
  */
 GLuint
 _mesa_num_parameters_of_type(const struct gl_program_parameter_list *list,
-                             enum register_file type)
+                             gl_register_file type)
 {
    GLuint i, count = 0;
    if (list) {
index 200f2c00458093c619e4267a61148232ec7bedde..01f5a0e179fa789a230a2e97a0d53549a9e22d69 100644 (file)
@@ -54,7 +54,7 @@
 struct gl_program_parameter
 {
    const char *Name;        /**< Null-terminated string */
-   enum register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */
+   gl_register_file Type;   /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */
    GLenum DataType;         /**< GL_FLOAT, GL_FLOAT_VEC2, etc */
    GLuint Size;             /**< Number of components (1..4) */
    GLboolean Used;          /**< Helper flag for GLSL uniform tracking */
@@ -102,7 +102,7 @@ _mesa_num_parameters(const struct gl_program_parameter_list *list)
 
 extern GLint
 _mesa_add_parameter(struct gl_program_parameter_list *paramList,
-                    enum register_file type, const char *name,
+                    gl_register_file type, const char *name,
                     GLuint size, GLenum datatype, const GLfloat *values,
                     const gl_state_index state[STATE_LENGTH],
                     GLbitfield flags);
@@ -161,11 +161,11 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list,
 
 extern GLuint
 _mesa_longest_parameter_name(const struct gl_program_parameter_list *list,
-                             enum register_file type);
+                             gl_register_file type);
 
 extern GLuint
 _mesa_num_parameters_of_type(const struct gl_program_parameter_list *list,
-                             enum register_file type);
+                             gl_register_file type);
 
 
 #endif /* PROG_PARAMETER_H */
index ce48767a871e1b0c23fa79e66188b8df15050ef0..b832ddb4774de9bef0db1d3be133edf39564d4f7 100644 (file)
@@ -43,7 +43,7 @@
  * Return string name for given program/register file.
  */
 static const char *
-file_string(enum register_file f, gl_prog_print_mode mode)
+file_string(gl_register_file f, gl_prog_print_mode mode)
 {
    switch (f) {
    case PROGRAM_TEMPORARY:
@@ -86,6 +86,9 @@ file_string(enum register_file f, gl_prog_print_mode mode)
 static const char *
 arb_input_attrib_string(GLint index, GLenum progType)
 {
+   /*
+    * These strings should match the VERT_ATTRIB_x and FRAG_ATTRIB_x tokens.
+    */
    const char *vertAttribs[] = {
       "vertex.position",
       "vertex.weight",
@@ -160,6 +163,9 @@ arb_input_attrib_string(GLint index, GLenum progType)
 static const char *
 arb_output_attrib_string(GLint index, GLenum progType)
 {
+   /*
+    * These strings should match the VERT_RESULT_x and FRAG_RESULT_x tokens.
+    */
    const char *vertResults[] = {
       "result.position",
       "result.color.primary",
@@ -184,7 +190,12 @@ arb_output_attrib_string(GLint index, GLenum progType)
    };
    const char *fragResults[] = {
       "result.color",
-      "result.depth"
+      "result.color(half)",
+      "result.depth",
+      "result.color[0]",
+      "result.color[1]",
+      "result.color[2]",
+      "result.color[3]"
    };
 
    if (progType == GL_VERTEX_PROGRAM_ARB) {
@@ -202,25 +213,23 @@ arb_output_attrib_string(GLint index, GLenum progType)
  * Return string representation of the given register.
  * Note that some types of registers (like PROGRAM_UNIFORM) aren't defined
  * by the ARB/NV program languages so we've taken some liberties here.
- * \param file  the register file (PROGRAM_INPUT, PROGRAM_TEMPORARY, etc)
+ * \param f  the register file (PROGRAM_INPUT, PROGRAM_TEMPORARY, etc)
  * \param index  number of the register in the register file
  * \param mode  the output format/mode/style
  * \param prog  pointer to containing program
  */
 static const char *
-reg_string(enum register_file f, GLint index, gl_prog_print_mode mode,
+reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode,
            GLboolean relAddr, const struct gl_program *prog)
 {
    static char str[100];
+   const char *addr = relAddr ? "ADDR+" : "";
 
    str[0] = 0;
 
    switch (mode) {
    case PROG_PRINT_DEBUG:
-      if (relAddr)
-         _mesa_sprintf(str, "%s[ADDR+%d]", file_string(f, mode), index);
-      else
-         _mesa_sprintf(str, "%s[%d]", file_string(f, mode), index);
+      _mesa_sprintf(str, "%s[%s%d]", file_string(f, mode), addr, index);
       break;
 
    case PROG_PRINT_ARB:
@@ -235,19 +244,19 @@ reg_string(enum register_file f, GLint index, gl_prog_print_mode mode,
          _mesa_sprintf(str, "temp%d", index);
          break;
       case PROGRAM_ENV_PARAM:
-         _mesa_sprintf(str, "program.env[%d]", index);
+         _mesa_sprintf(str, "program.env[%s%d]", addr, index);
          break;
       case PROGRAM_LOCAL_PARAM:
-         _mesa_sprintf(str, "program.local[%d]", index);
+         _mesa_sprintf(str, "program.local[%s%d]", addr, index);
          break;
       case PROGRAM_VARYING: /* extension */
-         _mesa_sprintf(str, "varying[%d]", index);
+         _mesa_sprintf(str, "varying[%s%d]", addr, index);
          break;
       case PROGRAM_CONSTANT: /* extension */
-         _mesa_sprintf(str, "constant[%d]", index);
+         _mesa_sprintf(str, "constant[%s%d]", addr, index);
          break;
       case PROGRAM_UNIFORM: /* extension */
-         _mesa_sprintf(str, "uniform[%d]", index);
+         _mesa_sprintf(str, "uniform[%s%d]", addr, index);
          break;
       case PROGRAM_STATE_VAR:
          {
@@ -284,16 +293,16 @@ reg_string(enum register_file f, GLint index, gl_prog_print_mode mode,
          _mesa_sprintf(str, "c[%d]", index);
          break;
       case PROGRAM_VARYING: /* extension */
-         _mesa_sprintf(str, "varying[%d]", index);
+         _mesa_sprintf(str, "varying[%s%d]", addr, index);
          break;
       case PROGRAM_UNIFORM: /* extension */
-         _mesa_sprintf(str, "uniform[%d]", index);
+         _mesa_sprintf(str, "uniform[%s%d]", addr, index);
          break;
       case PROGRAM_CONSTANT: /* extension */
-         _mesa_sprintf(str, "constant[%d]", index);
+         _mesa_sprintf(str, "constant[%s%d]", addr, index);
          break;
       case PROGRAM_STATE_VAR: /* extension */
-         _mesa_sprintf(str, "state[%d]", index);
+         _mesa_sprintf(str, "state[%s%d]", addr, index);
          break;
       default:
          _mesa_problem(NULL, "bad file in reg_string()");
@@ -423,7 +432,7 @@ fprint_dst_reg(FILE * f,
                const struct gl_program *prog)
 {
    _mesa_fprintf(f, "%s%s",
-                 reg_string((enum register_file) dstReg->File,
+                 reg_string((gl_register_file) dstReg->File,
                             dstReg->Index, mode, dstReg->RelAddr, prog),
                  _mesa_writemask_string(dstReg->WriteMask));
 
@@ -436,7 +445,7 @@ fprint_dst_reg(FILE * f,
 
 #if 0
    _mesa_fprintf(f, "%s[%d]%s",
-                file_string((enum register_file) dstReg->File, mode),
+                file_string((gl_register_file) dstReg->File, mode),
                 dstReg->Index,
                 _mesa_writemask_string(dstReg->WriteMask));
 #endif
@@ -449,14 +458,18 @@ fprint_src_reg(FILE *f,
                gl_prog_print_mode mode,
                const struct gl_program *prog)
 {
-   _mesa_fprintf(f, "%s%s",
-                 reg_string((enum register_file) srcReg->File,
+   const char *abs = srcReg->Abs ? "|" : "";
+
+   _mesa_fprintf(f, "%s%s%s%s",
+                 abs,
+                 reg_string((gl_register_file) srcReg->File,
                             srcReg->Index, mode, srcReg->RelAddr, prog),
                  _mesa_swizzle_string(srcReg->Swizzle,
-                                      srcReg->NegateBase, GL_FALSE));
+                                      srcReg->NegateBase, GL_FALSE),
+                 abs);
 #if 0
    _mesa_fprintf(f, "%s[%d]%s",
-                 file_string((enum register_file) srcReg->File, mode),
+                 file_string((gl_register_file) srcReg->File, mode),
                  srcReg->Index,
                  _mesa_swizzle_string(srcReg->Swizzle,
                                       srcReg->NegateBase, GL_FALSE));
@@ -549,7 +562,7 @@ _mesa_fprint_instruction_opt(FILE *f,
       if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) {
          _mesa_fprintf(f, ", ");
          _mesa_fprintf(f, "%s[%d]%s",
-                      file_string((enum register_file) inst->SrcReg[0].File,
+                      file_string((gl_register_file) inst->SrcReg[0].File,
                                   mode),
                       inst->SrcReg[0].Index,
                       _mesa_swizzle_string(inst->SrcReg[0].Swizzle,
@@ -566,7 +579,7 @@ _mesa_fprint_instruction_opt(FILE *f,
       _mesa_fprintf(f, " ");
       fprint_dst_reg(f, &inst->DstReg, mode, prog);
       _mesa_fprintf(f, ", %s[%d], %s",
-                   file_string((enum register_file) inst->SrcReg[0].File,
+                   file_string((gl_register_file) inst->SrcReg[0].File,
                                mode),
                    inst->SrcReg[0].Index,
                    _mesa_swizzle_string(inst->SrcReg[0].Swizzle,
@@ -594,6 +607,8 @@ _mesa_fprint_instruction_opt(FILE *f,
       default:
          ;
       }
+      if (inst->TexShadow)
+         _mesa_fprintf(f, " SHADOW");
       fprint_comment(f, inst);
       break;
 
@@ -713,11 +728,16 @@ _mesa_fprint_instruction_opt(FILE *f,
       break;
    /* XXX may need other special-case instructions */
    default:
-      /* typical alu instruction */
-      fprint_alu_instruction(f, inst,
-                             _mesa_opcode_string(inst->Opcode),
-                             _mesa_num_inst_src_regs(inst->Opcode),
-                             mode, prog);
+      if (inst->Opcode < MAX_OPCODE) {
+         /* typical alu instruction */
+         fprint_alu_instruction(f, inst,
+                                _mesa_opcode_string(inst->Opcode),
+                                _mesa_num_inst_src_regs(inst->Opcode),
+                                mode, prog);
+      }
+      else {
+         _mesa_fprintf(f, "Other opcode %d\n", inst->Opcode);
+      }
       break;
    }
    return indent;
@@ -898,7 +918,7 @@ _mesa_write_shader_to_file(const struct gl_shader *shader)
    else
       type = "vert";
 
-   _mesa_snprintf(filename, strlen(filename), "shader_%u.%s", shader->Name, type);
+   _mesa_snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type);
    f = fopen(filename, "w");
    if (!f) {
       fprintf(stderr, "Unable to open %s for writing\n", filename);
index e1db30b78f4cccefd5812926939f49a8dccc6a85..f51d9e265129b7b230100bd588896aa27e1e406d 100644 (file)
@@ -206,28 +206,28 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
          /* state[2] is the texgen attribute */
          switch (state[2]) {
          case STATE_TEXGEN_EYE_S:
-            COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneS);
+            COPY_4V(value, ctx->Texture.Unit[unit].GenS.EyePlane);
             return;
          case STATE_TEXGEN_EYE_T:
-            COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneT);
+            COPY_4V(value, ctx->Texture.Unit[unit].GenT.EyePlane);
             return;
          case STATE_TEXGEN_EYE_R:
-            COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneR);
+            COPY_4V(value, ctx->Texture.Unit[unit].GenR.EyePlane);
             return;
          case STATE_TEXGEN_EYE_Q:
-            COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneQ);
+            COPY_4V(value, ctx->Texture.Unit[unit].GenQ.EyePlane);
             return;
          case STATE_TEXGEN_OBJECT_S:
-            COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneS);
+            COPY_4V(value, ctx->Texture.Unit[unit].GenS.ObjectPlane);
             return;
          case STATE_TEXGEN_OBJECT_T:
-            COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneT);
+            COPY_4V(value, ctx->Texture.Unit[unit].GenT.ObjectPlane);
             return;
          case STATE_TEXGEN_OBJECT_R:
-            COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneR);
+            COPY_4V(value, ctx->Texture.Unit[unit].GenR.ObjectPlane);
             return;
          case STATE_TEXGEN_OBJECT_Q:
-            COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneQ);
+            COPY_4V(value, ctx->Texture.Unit[unit].GenQ.ObjectPlane);
             return;
          default:
             _mesa_problem(ctx, "Invalid texgen state in fetch_state");
@@ -506,6 +506,26 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
             }
          }
          return;
+      case STATE_ROT_MATRIX_0:
+         {
+            const int unit = (int) state[2];
+            GLfloat *rotMat22 = ctx->Texture.Unit[unit].RotMatrix;
+            value[0] = rotMat22[0]; 
+            value[1] = rotMat22[2];
+            value[2] = 0.0;
+            value[3] = 0.0;
+         }
+         break;
+      case STATE_ROT_MATRIX_1:
+         {
+            const int unit = (int) state[2];
+            GLfloat *rotMat22 = ctx->Texture.Unit[unit].RotMatrix;
+            value[0] = rotMat22[1];
+            value[1] = rotMat22[3];
+            value[2] = 0.0;
+            value[3] = 0.0;
+         }
+         break;
 
          /* XXX: make sure new tokens added here are also handled in the 
           * _mesa_program_state_flags() switch, below.
@@ -591,6 +611,8 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
 
       case STATE_TEXRECT_SCALE:
       case STATE_SHADOW_AMBIENT:
+      case STATE_ROT_MATRIX_0:
+      case STATE_ROT_MATRIX_1:
         return _NEW_TEXTURE;
       case STATE_FOG_PARAMS_OPTIMIZED:
         return _NEW_FOG;
@@ -806,6 +828,12 @@ append_token(char *dst, gl_state_index k)
    case STATE_SHADOW_AMBIENT:
       append(dst, "CompareFailValue");
       break;
+   case STATE_ROT_MATRIX_0:
+      append(dst, "rotMatrixRow0");
+      break;
+   case STATE_ROT_MATRIX_1:
+      append(dst, "rotMatrixRow1");
+      break;
    default:
       /* probably STATE_INTERNAL_DRIVER+i (driver private state) */
       append(dst, "driverState");
index d5358a1d042c1cc6643a75638ae3e23b8c89d696..d563080db1c69d8588cac8e39748fa871f9ffc70 100644 (file)
@@ -117,6 +117,8 @@ typedef enum gl_state_index_ {
    STATE_PCM_SCALE,             /**< Post color matrix RGBA scale */
    STATE_PCM_BIAS,              /**< Post color matrix RGBA bias */
    STATE_SHADOW_AMBIENT,        /**< ARB_shadow_ambient fail value; token[2] is texture unit index */
+   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) */
 } gl_state_index;
 
index 7a3b827352a8d1ce8a248c5bfce66135d9302a68..2e5632710e475b480aa88e5661eb55b6469b0209 100644 (file)
@@ -53,6 +53,15 @@ _mesa_init_program(GLcontext *ctx)
 {
    GLuint i;
 
+   /*
+    * If this assertion fails, we need to increase the field
+    * size for register indexes.
+    */
+   ASSERT(ctx->Const.VertexProgram.MaxUniformComponents / 4
+          <= (1 << INST_INDEX_BITS));
+   ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents / 4
+          <= (1 << INST_INDEX_BITS));
+
    ctx->Program.ErrorPos = -1;
    ctx->Program.ErrorString = _mesa_strdup("");
 
@@ -729,7 +738,7 @@ _mesa_combine_programs(GLcontext *ctx,
       /* Connect color outputs of fprogA to color inputs of fprogB, via a
        * new temporary register.
        */
-      if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) &&
+      if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) &&
           (progB_inputsRead & FRAG_BIT_COL0)) {
          GLint tempReg = _mesa_find_free_register(newProg, PROGRAM_TEMPORARY);
          if (tempReg < 0) {
@@ -739,7 +748,7 @@ _mesa_combine_programs(GLcontext *ctx,
          }
          /* replace writes to result.color[0] with tempReg */
          replace_registers(newInst, lenA,
-                           PROGRAM_OUTPUT, FRAG_RESULT_COLR,
+                           PROGRAM_OUTPUT, FRAG_RESULT_COLOR,
                            PROGRAM_TEMPORARY, tempReg);
          /* replace reads from the input color with tempReg */
          replace_registers(newInst + lenA, lenB,
@@ -749,7 +758,7 @@ _mesa_combine_programs(GLcontext *ctx,
 
       /* compute combined program's InputsRead */
       inputsB = progB_inputsRead;
-      if (progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) {
+      if (progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) {
          inputsB &= ~(1 << FRAG_ATTRIB_COL0);
       }
       newProg->InputsRead = progA->InputsRead | inputsB;
index 56f1eb832e9e259009ab42c16c7a8f685de11c25..e283f8933b21df76f3f8f6042fa660d75df7098b 100644 (file)
@@ -171,7 +171,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
       if (inst->Opcode == OPCODE_END)
          break;
       if (inst->DstReg.File == PROGRAM_OUTPUT &&
-          inst->DstReg.Index == FRAG_RESULT_COLR) {
+          inst->DstReg.Index == FRAG_RESULT_COLOR) {
          /* change the instruction to write to colorTemp w/ clamping */
          inst->DstReg.File = PROGRAM_TEMPORARY;
          inst->DstReg.Index = colorTemp;
@@ -249,7 +249,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
    /* LRP result.color.xyz, fogFactorTemp.xxxx, colorTemp, fogColorRef; */
    inst->Opcode = OPCODE_LRP;
    inst->DstReg.File = PROGRAM_OUTPUT;
-   inst->DstReg.Index = FRAG_RESULT_COLR;
+   inst->DstReg.Index = FRAG_RESULT_COLOR;
    inst->DstReg.WriteMask = WRITEMASK_XYZ;
    inst->SrcReg[0].File = PROGRAM_TEMPORARY;
    inst->SrcReg[0].Index = fogFactorTemp;
@@ -264,7 +264,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
    /* MOV result.color.w, colorTemp.x;  # copy alpha */
    inst->Opcode = OPCODE_MOV;
    inst->DstReg.File = PROGRAM_OUTPUT;
-   inst->DstReg.Index = FRAG_RESULT_COLR;
+   inst->DstReg.Index = FRAG_RESULT_COLOR;
    inst->DstReg.WriteMask = WRITEMASK_W;
    inst->SrcReg[0].File = PROGRAM_TEMPORARY;
    inst->SrcReg[0].Index = colorTemp;
@@ -375,7 +375,7 @@ _mesa_count_texture_instructions(struct gl_program *prog)
  * So, rewrite the program to use a temporary register in this case.
  */
 void
-_mesa_remove_output_reads(struct gl_program *prog, enum register_file type)
+_mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
 {
    GLuint i;
    GLint outputMap[VERT_RESULT_MAX];
index 11572e64f5a26f8889aa063e956d6afe1a96dfac..96acaf9566c9e39ce49680fc3c03b00bd6a7bf47 100644 (file)
@@ -40,6 +40,6 @@ extern void
 _mesa_count_texture_instructions(struct gl_program *prog);
 
 extern void
-_mesa_remove_output_reads(struct gl_program *prog, enum register_file type);
+_mesa_remove_output_reads(struct gl_program *prog, gl_register_file type);
 
 #endif /* PROGRAMOPT_H */
index 013e912e5d6a52bd150ba97aff8a06542cd9c557..61289db2d2e6278a497b219624d271a416ca09f7 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.2
+ * Version:  7.5
  *
  * Copyright (C) 2004-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 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"),
@@ -406,9 +407,15 @@ _mesa_init_shader_state(GLcontext * ctx)
     * are generated by the GLSL compiler.
     */
    ctx->Shader.EmitHighLevelInstructions = GL_TRUE;
-   ctx->Shader.EmitCondCodes = GL_FALSE;/*GL_TRUE;*/ /* XXX probably want GL_FALSE... */
+   ctx->Shader.EmitCondCodes = GL_FALSE;
    ctx->Shader.EmitComments = GL_FALSE;
    ctx->Shader.Flags = get_shader_flags();
+
+   /* Default pragma settings */
+   ctx->Shader.DefaultPragmas.IgnoreOptimize = GL_FALSE;
+   ctx->Shader.DefaultPragmas.IgnoreDebug = GL_FALSE;
+   ctx->Shader.DefaultPragmas.Optimize = GL_TRUE;
+   ctx->Shader.DefaultPragmas.Debug = GL_FALSE;
 }
 
 
@@ -827,6 +834,27 @@ is_integer_type(GLenum type)
 }
 
 
+static GLboolean
+is_sampler_type(GLenum type)
+{
+   switch (type) {
+   case GL_SAMPLER_1D:
+   case GL_SAMPLER_2D:
+   case GL_SAMPLER_3D:
+   case GL_SAMPLER_CUBE:
+   case GL_SAMPLER_1D_SHADOW:
+   case GL_SAMPLER_2D_SHADOW:
+   case GL_SAMPLER_2D_RECT_ARB:
+   case GL_SAMPLER_2D_RECT_SHADOW_ARB:
+   case GL_SAMPLER_1D_ARRAY_EXT:
+   case GL_SAMPLER_2D_ARRAY_EXT:
+      return GL_TRUE;
+   default:
+      return GL_FALSE;
+   }
+}
+
+
 static void
 _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
                         GLsizei maxLength, GLsizei *length, GLint *size,
@@ -1422,6 +1450,9 @@ _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj)
    if (!sh)
       return;
 
+   /* set default pragma state for shader */
+   sh->Pragmas = ctx->Shader.DefaultPragmas;
+
    /* this call will set the sh->CompileStatus field to indicate if
     * compilation was successful.
     */
@@ -1469,9 +1500,21 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
          return;
       }
       if (!shProg->LinkStatus) {
-         _mesa_error(ctx, GL_INVALID_OPERATION, "glUseProgram");
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glUseProgram(program %u not linked)", program);
          return;
       }
+
+      /* debug code */
+      if (0) {
+         GLuint i;
+         _mesa_printf("Use Shader %u\n", shProg->Name);
+         for (i = 0; i < shProg->NumShaders; i++) {
+            _mesa_printf(" shader %u, type 0x%x\n",
+                         shProg->Shaders[i]->Name,
+                         shProg->Shaders[i]->Type);
+         }
+      }
    }
    else {
       shProg = NULL;
@@ -1515,27 +1558,6 @@ _mesa_update_shader_textures_used(struct gl_program *prog)
 }
 
 
-static GLboolean
-is_sampler_type(GLenum type)
-{
-   switch (type) {
-   case GL_SAMPLER_1D:
-   case GL_SAMPLER_2D:
-   case GL_SAMPLER_3D:
-   case GL_SAMPLER_CUBE:
-   case GL_SAMPLER_1D_SHADOW:
-   case GL_SAMPLER_2D_SHADOW:
-   case GL_SAMPLER_2D_RECT_ARB:
-   case GL_SAMPLER_2D_RECT_SHADOW_ARB:
-   case GL_SAMPLER_1D_ARRAY_EXT:
-   case GL_SAMPLER_2D_ARRAY_EXT:
-      return GL_TRUE;
-   default:
-      return GL_FALSE;
-   }
-}
-
-
 /**
  * Check if the type given by userType is allowed to set a uniform of the
  * target type.  Generally, equivalence is required, but setting Boolean
@@ -1574,10 +1596,10 @@ compatible_types(GLenum userType, GLenum targetType)
  * \param program  the program whose uniform to update
  * \param index  the index of the program parameter for the uniform
  * \param offset  additional parameter slot offset (for arrays)
- * \param type  the datatype of the uniform
+ * \param type  the incoming datatype of 'values'
  * \param count  the number of uniforms to set
- * \param elems  number of elements per uniform
- * \param values  the new values
+ * \param elems  number of elements per uniform (1, 2, 3 or 4)
+ * \param values  the new values, of datatype 'type'
  */
 static void
 set_program_uniform(GLcontext *ctx, struct gl_program *program,
@@ -1587,8 +1609,12 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
 {
    struct gl_program_parameter *param =
       &program->Parameters->Parameters[index];
+   const GLboolean isUniformBool = is_boolean_type(param->DataType);
+   const GLboolean areIntValues = is_integer_type(type);
 
    assert(offset >= 0);
+   assert(elems >= 1);
+   assert(elems <= 4);
 
    if (!compatible_types(type, param->DataType)) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(type mismatch)");
@@ -1656,16 +1682,20 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
          }
       }
 
+      /* loop over number of array elements */
       for (k = 0; k < count; k++) {
          GLfloat *uniformVal;
 
-         if (offset + k > slots) {
+         if (offset + k >= slots) {
             /* Extra array data is ignored */
             break;
          }
 
+         /* uniformVal (the destination) is always float[4] */
          uniformVal = program->Parameters->ParameterValues[index + offset + k];
-         if (is_integer_type(type)) {
+
+         if (areIntValues) {
+            /* convert user's ints to floats */
             const GLint *iValues = ((const GLint *) values) + k * elems;
             for (i = 0; i < elems; i++) {
                uniformVal[i] = (GLfloat) iValues[i];
@@ -1679,7 +1709,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
          }
 
          /* if the uniform is bool-valued, convert to 1.0 or 0.0 */
-         if (is_boolean_type(param->DataType)) {
+         if (isUniformBool) {
             for (i = 0; i < elems; i++) {
                uniformVal[i] = uniformVal[i] ? 1.0f : 0.0f;
             }
index 230c57cea8d003014010b0a8acae3efb5dad4d0e..9764fc25b0916705e1837f2ea8a44376e51aef04 100644 (file)
@@ -1659,76 +1659,76 @@ bvec4 not (const bvec4 v)
 
 vec4 texture1D(const sampler1D sampler, const float coord)
 {
-   __asm vec4_tex1d __retVal, sampler, coord;
+   __asm vec4_tex_1d __retVal, sampler, coord;
 }
 
 vec4 texture1DProj(const sampler1D sampler, const vec2 coord)
 {
    // need to swizzle .y into .w
-   __asm vec4_texp1d __retVal, sampler, coord.xyyy;
+   __asm vec4_tex_1d_proj __retVal, sampler, coord.xyyy;
 }
 
 vec4 texture1DProj(const sampler1D sampler, const vec4 coord)
 {
-   __asm vec4_texp1d __retVal, sampler, coord;
+   __asm vec4_tex_1d_proj __retVal, sampler, coord;
 }
 
 
 vec4 texture2D(const sampler2D sampler, const vec2 coord)
 {
-   __asm vec4_tex2d __retVal, sampler, coord;
+   __asm vec4_tex_2d __retVal, sampler, coord;
 }
 
 vec4 texture2DProj(const sampler2D sampler, const vec3 coord)
 {
    // need to swizzle 'z' into 'w'.
-   __asm vec4_texp2d __retVal, sampler, coord.xyzz;
+   __asm vec4_tex_2d_proj __retVal, sampler, coord.xyzz;
 }
 
 vec4 texture2DProj(const sampler2D sampler, const vec4 coord)
 {
-   __asm vec4_texp2d __retVal, sampler, coord;
+   __asm vec4_tex_2d_proj __retVal, sampler, coord;
 }
 
 
 vec4 texture3D(const sampler3D sampler, const vec3 coord)
 {
-   __asm vec4_tex3d __retVal, sampler, coord;
+   __asm vec4_tex_3d __retVal, sampler, coord;
 }
 
 vec4 texture3DProj(const sampler3D sampler, const vec4 coord)
 {
-   __asm vec4_texp3d __retVal, sampler, coord;
+   __asm vec4_tex_3d_proj __retVal, sampler, coord;
 }
 
 
 vec4 textureCube(const samplerCube sampler, const vec3 coord)
 {
-   __asm vec4_texcube __retVal, sampler, coord;
+   __asm vec4_tex_cube __retVal, sampler, coord;
 }
 
 
 
 vec4 shadow1D(const sampler1DShadow sampler, const vec3 coord)
 {
-   __asm vec4_tex1d __retVal, sampler, coord;
+   __asm vec4_tex_1d_shadow __retVal, sampler, coord;
 }
 
 vec4 shadow1DProj(const sampler1DShadow sampler, const vec4 coord)
 {
    // .s and .p will be divided by .q
-   __asm vec4_texp1d __retVal, sampler, coord;
+   __asm vec4_tex_1d_proj_shadow __retVal, sampler, coord;
 }
 
 vec4 shadow2D(const sampler2DShadow sampler, const vec3 coord)
 {
-   __asm vec4_tex2d __retVal, sampler, coord;
+   __asm vec4_tex_2d_shadow __retVal, sampler, coord;
 }
 
 vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord)
 {
    // .s, .t and .p will be divided by .q
-   __asm vec4_texp2d __retVal, sampler, coord;
+   __asm vec4_tex_2d_proj_shadow __retVal, sampler, coord;
 }
 
 
@@ -1741,22 +1741,22 @@ vec4 texture2DRect(const sampler2DRect sampler, const vec2 coord)
 vec4 texture2DRectProj(const sampler2DRect sampler, const vec3 coord)
 {
    // need to swizzle .y into .w
-   __asm vec4_texp_rect __retVal, sampler, coord.xyzz;
+   __asm vec4_tex_rect_proj __retVal, sampler, coord.xyzz;
 }
 
 vec4 texture2DRectProj(const sampler2DRect sampler, const vec4 coord)
 {
-   __asm vec4_texp_rect __retVal, sampler, ccoord;
+   __asm vec4_tex_rect_proj __retVal, sampler, ccoord;
 }
 
 vec4 shadow2DRect(const sampler2DRectShadow sampler, const vec3 coord)
 {
-   __asm vec4_tex_rect __retVal, sampler, coord;
+   __asm vec4_tex_rect_shadow __retVal, sampler, coord;
 }
 
 vec4 shadow2DRectProj(const sampler2DRectShadow sampler, const vec4 coord)
 {
-   __asm vec4_texp_rect __retVal, sampler, coord;
+   __asm vec4_tex_rect_proj_shadow __retVal, sampler, coord;
 }
 
 
index 759bf247d809ef1be296b0d543bcd3d7644de4b9..78a7b83ec1858f274fe5fb2d91c6edc2b764df5f 100644 (file)
 120,121,122,0,0,18,118,0,0,17,48,0,48,0,0,0,0,0,1,90,95,0,0,4,0,0,110,111,116,0,1,1,0,0,4,0,118,0,
 0,0,1,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,17,48,0,48,0,
 0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,0,1,1,0,0,16,0,115,97,109,112,108,101,
-114,0,0,1,1,0,0,9,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,49,100,0,18,95,95,
+114,0,0,1,1,0,0,9,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,49,100,0,18,95,95,
 114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,
 0,0,12,0,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,1,0,0,16,0,115,97,109,112,108,101,
-114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,112,49,100,0,18,95,
-95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,120,121,
-121,121,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,1,0,0,16,0,
-115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,
-120,112,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,
-111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,0,1,1,0,0,17,0,115,97,109,
-112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,50,100,
-0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,
-0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,1,0,0,17,0,115,97,109,
-112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,112,50,
+114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,49,100,95,112,
+114,111,106,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,
+114,100,0,59,120,121,121,121,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,80,114,
+111,106,0,1,1,0,0,16,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,4,
+118,101,99,52,95,116,101,120,95,49,100,95,112,114,111,106,0,18,95,95,114,101,116,86,97,108,0,0,18,
+115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,
+117,114,101,50,68,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,
+0,0,1,4,118,101,99,52,95,116,101,120,95,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,
+112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,
+50,68,80,114,111,106,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,
+0,0,0,1,4,118,101,99,52,95,116,101,120,95,50,100,95,112,114,111,106,0,18,95,95,114,101,116,86,97,
+108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,120,121,122,122,0,0,0,0,1,90,
+95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,1,0,0,17,0,115,97,109,112,108,
+101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,50,100,95,
+112,114,111,106,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,
+111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,51,68,0,1,1,0,0,18,0,115,97,109,
+112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,51,
 100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,
-59,120,121,122,122,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,
-1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,
-95,116,101,120,112,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,
-18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,51,68,0,1,1,0,0,18,0,
-115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,
-120,51,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,
-114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,51,68,80,114,111,106,0,1,1,0,0,18,0,
-115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,
-120,112,51,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,
-111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,67,117,98,101,0,1,1,0,0,19,0,
-115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,
-120,99,117,98,101,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,
-111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,49,68,0,1,1,0,0,20,0,115,97,109,112,
-108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,49,100,0,18,
-95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,
-90,95,0,0,12,0,0,115,104,97,100,111,119,49,68,80,114,111,106,0,1,1,0,0,20,0,115,97,109,112,108,101,
-114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,112,49,100,0,18,95,
-95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,
-95,0,0,12,0,0,115,104,97,100,111,119,50,68,0,1,1,0,0,21,0,115,97,109,112,108,101,114,0,0,1,1,0,0,
-11,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,50,100,0,18,95,95,114,101,116,86,97,
-108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,115,104,
-97,100,111,119,50,68,80,114,111,106,0,1,1,0,0,21,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,
-111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,112,50,100,0,18,95,95,114,101,116,86,97,108,
-0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,
-116,117,114,101,50,68,82,101,99,116,0,1,1,0,0,22,0,115,97,109,112,108,101,114,0,0,1,1,0,0,10,0,99,
-111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,114,101,99,116,0,18,95,95,114,101,116,86,
-97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,
-101,120,116,117,114,101,50,68,82,101,99,116,80,114,111,106,0,1,1,0,0,22,0,115,97,109,112,108,101,
-114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,112,95,114,101,99,
-116,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,
-59,120,121,122,122,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,82,101,99,116,80,
-114,111,106,0,1,1,0,0,22,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,
-4,118,101,99,52,95,116,101,120,112,95,114,101,99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,115,
-97,109,112,108,101,114,0,0,18,99,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,
-119,50,68,82,101,99,116,0,1,1,0,0,23,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,
-100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,114,101,99,116,0,18,95,95,114,101,116,86,97,108,0,0,
-18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,
-111,119,50,68,82,101,99,116,80,114,111,106,0,1,1,0,0,23,0,115,97,109,112,108,101,114,0,0,1,1,0,0,
-12,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,112,95,114,101,99,116,0,18,95,95,
+0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,51,68,80,114,111,106,0,1,1,0,0,18,0,115,97,
+109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,
+51,100,95,112,114,111,106,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,
+18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,67,117,98,101,0,1,1,0,
+0,19,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,
+116,101,120,95,99,117,98,101,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,
+0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,49,68,0,1,1,0,0,20,0,115,
+97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,
+95,49,100,95,115,104,97,100,111,119,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,
+114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,49,68,80,114,111,
+106,0,1,1,0,0,20,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,4,118,
+101,99,52,95,116,101,120,95,49,100,95,112,114,111,106,95,115,104,97,100,111,119,0,18,95,95,114,101,
+116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,
+0,115,104,97,100,111,119,50,68,0,1,1,0,0,21,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,
+111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,50,100,95,115,104,97,100,111,119,0,18,95,95,
 114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,
-0,0,9,0,0,110,111,105,115,101,49,0,1,1,0,0,9,0,120,0,0,0,1,4,102,108,111,97,116,95,110,111,105,115,
-101,49,0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,0,0,1,90,95,0,0,9,0,0,110,111,105,115,101,
-49,0,1,1,0,0,10,0,120,0,0,0,1,4,102,108,111,97,116,95,110,111,105,115,101,50,0,18,95,95,114,101,
-116,86,97,108,0,0,18,120,0,0,0,0,1,90,95,0,0,9,0,0,110,111,105,115,101,49,0,1,1,0,0,11,0,120,0,0,0,
-1,4,102,108,111,97,116,95,110,111,105,115,101,51,0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,0,
-0,1,90,95,0,0,9,0,0,110,111,105,115,101,49,0,1,1,0,0,12,0,120,0,0,0,1,4,102,108,111,97,116,95,110,
-111,105,115,101,52,0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,0,0,1,90,95,0,0,10,0,0,110,111,
-105,115,101,50,0,1,1,0,0,9,0,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,
+0,0,12,0,0,115,104,97,100,111,119,50,68,80,114,111,106,0,1,1,0,0,21,0,115,97,109,112,108,101,114,0,
+0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,50,100,95,112,114,111,
+106,95,115,104,97,100,111,119,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,
+0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,82,101,99,116,
+0,1,1,0,0,22,0,115,97,109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,0,1,4,118,101,99,
+52,95,116,101,120,95,114,101,99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,
+114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,82,101,
+99,116,80,114,111,106,0,1,1,0,0,22,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,
+100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,114,101,99,116,95,112,114,111,106,0,18,95,95,114,101,
+116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,120,121,122,122,0,0,
+0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,82,101,99,116,80,114,111,106,0,1,1,0,0,22,
+0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,
+101,120,95,114,101,99,116,95,112,114,111,106,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,
+112,108,101,114,0,0,18,99,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,50,
+68,82,101,99,116,0,1,1,0,0,23,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,
+0,1,4,118,101,99,52,95,116,101,120,95,114,101,99,116,95,115,104,97,100,111,119,0,18,95,95,114,101,
+116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,
+0,115,104,97,100,111,119,50,68,82,101,99,116,80,114,111,106,0,1,1,0,0,23,0,115,97,109,112,108,101,
+114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,114,101,99,116,
+95,112,114,111,106,95,115,104,97,100,111,119,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,
+112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,90,95,0,0,9,0,0,110,111,105,115,101,49,0,1,1,0,
+0,9,0,120,0,0,0,1,4,102,108,111,97,116,95,110,111,105,115,101,49,0,18,95,95,114,101,116,86,97,108,
+0,0,18,120,0,0,0,0,1,90,95,0,0,9,0,0,110,111,105,115,101,49,0,1,1,0,0,10,0,120,0,0,0,1,4,102,108,
+111,97,116,95,110,111,105,115,101,50,0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,0,0,1,90,95,0,
+0,9,0,0,110,111,105,115,101,49,0,1,1,0,0,11,0,120,0,0,0,1,4,102,108,111,97,116,95,110,111,105,115,
+101,51,0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,0,0,1,90,95,0,0,9,0,0,110,111,105,115,101,
+49,0,1,1,0,0,12,0,120,0,0,0,1,4,102,108,111,97,116,95,110,111,105,115,101,52,0,18,95,95,114,101,
+116,86,97,108,0,0,18,120,0,0,0,0,1,90,95,0,0,10,0,0,110,111,105,115,101,50,0,1,1,0,0,9,0,120,0,0,0,
+1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,
+95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,17,49,57,0,51,52,0,0,
+46,0,0,20,0,0,1,90,95,0,0,10,0,0,110,111,105,115,101,50,0,1,1,0,0,10,0,120,0,0,0,1,9,18,95,95,114,
+101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,
+116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,50,0,0,17,49,57,0,51,
+52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,20,0,0,1,90,95,0,0,10,0,0,110,111,105,115,101,50,0,1,1,0,0,
+11,0,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,
+0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,
+118,101,99,51,0,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,20,0,0,1,
+90,95,0,0,10,0,0,110,111,105,115,101,50,0,1,1,0,0,12,0,120,0,0,0,1,9,18,95,95,114,101,116,86,97,
+108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,
+59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,52,0,0,17,49,57,0,51,52,0,0,0,17,55,
+0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,20,0,0,1,90,95,0,0,11,0,0,110,111,
+105,115,101,51,0,1,1,0,0,9,0,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,
 105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,
-115,101,49,0,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,20,0,0,1,90,95,0,0,10,0,0,110,111,105,115,101,
-50,0,1,1,0,0,10,0,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,
-49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,
-18,120,0,58,118,101,99,50,0,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,20,0,0,1,90,95,0,
-0,10,0,0,110,111,105,115,101,50,0,1,1,0,0,11,0,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,
-120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,
-58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,51,0,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,
-0,0,17,51,0,50,51,0,0,0,0,46,0,0,20,0,0,1,90,95,0,0,10,0,0,110,111,105,115,101,50,0,1,1,0,0,12,0,
-120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,
-20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,
-99,52,0,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,
-0,0,20,0,0,1,90,95,0,0,11,0,0,110,111,105,115,101,51,0,1,1,0,0,9,0,120,0,0,0,1,9,18,95,95,114,101,
-116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,
-97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,20,0,9,18,95,
-95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,0,18,120,0,17,53,0,52,55,0,0,46,0,
-0,20,0,0,1,90,95,0,0,11,0,0,110,111,105,115,101,51,0,1,1,0,0,10,0,120,0,0,0,1,9,18,95,95,114,101,
-116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,
-97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,50,0,0,17,49,57,0,51,52,0,0,
-0,17,55,0,54,54,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,
-101,49,0,0,18,120,0,58,118,101,99,50,0,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,20,0,
-0,1,90,95,0,0,11,0,0,110,111,105,115,101,51,0,1,1,0,0,11,0,120,0,0,0,1,9,18,95,95,114,101,116,86,
-97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,
-0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,51,0,0,17,49,57,0,51,52,0,0,0,17,
-55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,
-110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,51,0,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,
-0,17,49,49,0,48,52,0,0,0,0,46,0,0,20,0,0,1,90,95,0,0,11,0,0,110,111,105,115,101,51,0,1,1,0,0,12,0,
-120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,
-20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,
-99,52,0,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,
-0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,
-101,99,52,0,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,
-0,0,0,46,0,0,20,0,0,1,90,95,0,0,12,0,0,110,111,105,115,101,52,0,1,1,0,0,9,0,120,0,0,0,1,9,18,95,95,
+115,101,49,0,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,
+0,58,110,111,105,115,101,49,0,0,18,120,0,17,53,0,52,55,0,0,46,0,0,20,0,0,1,90,95,0,0,11,0,0,110,
+111,105,115,101,51,0,1,1,0,0,10,0,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,
+111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,
+105,115,101,49,0,0,18,120,0,58,118,101,99,50,0,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,
+0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,
+101,99,50,0,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,20,0,0,1,90,95,0,0,11,0,0,110,
+111,105,115,101,51,0,1,1,0,0,11,0,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,
+111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,
+105,115,101,49,0,0,18,120,0,58,118,101,99,51,0,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,
+0,50,51,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,
+0,0,18,120,0,58,118,101,99,51,0,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,
+0,0,46,0,0,20,0,0,1,90,95,0,0,11,0,0,110,111,105,115,101,51,0,1,1,0,0,12,0,120,0,0,0,1,9,18,95,95,
 114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,
-101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,20,
-0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,0,18,120,0,17,53,0,52,55,
-0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,0,18,120,0,
-17,50,51,0,53,52,0,0,46,0,0,20,0,0,1,90,95,0,0,12,0,0,110,111,105,115,101,52,0,1,1,0,0,10,0,120,0,
-0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,
-9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,
-50,0,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,
-59,122,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,50,0,0,17,53,0,52,55,0,0,0,17,49,55,
-0,56,53,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,
-0,0,18,120,0,58,118,101,99,50,0,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,0,46,0,0,20,0,0,1,
-90,95,0,0,12,0,0,110,111,105,115,101,52,0,1,1,0,0,11,0,120,0,0,0,1,9,18,95,95,114,101,116,86,97,
+101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,52,0,0,17,49,57,
+0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,20,0,9,18,95,95,
+114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,52,0,0,17,53,
+0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,20,0,0,
+1,90,95,0,0,12,0,0,110,111,105,115,101,52,0,1,1,0,0,9,0,120,0,0,0,1,9,18,95,95,114,101,116,86,97,
 108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,
-59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,51,0,0,17,49,57,0,51,52,0,0,0,17,55,
-0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,
-111,105,115,101,49,0,0,18,120,0,58,118,101,99,51,0,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,
-49,49,0,48,52,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,
-101,49,0,0,18,120,0,58,118,101,99,51,0,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,
-57,49,0,0,0,0,46,0,0,20,0,0,1,90,95,0,0,12,0,0,110,111,105,115,101,52,0,1,1,0,0,12,0,120,0,0,0,1,9,
-18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,
-95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,52,0,0,17,
-49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,20,0,9,18,
-95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,52,0,0,
-17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,
-20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,
-99,52,0,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,17,51,55,0,52,56,0,
-0,0,0,46,0,0,20,0,0,0
+59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,20,0,9,18,95,95,114,
+101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,0,18,120,0,17,53,0,52,55,0,0,46,0,0,20,0,
+9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,0,18,120,0,17,50,51,0,53,
+52,0,0,46,0,0,20,0,0,1,90,95,0,0,12,0,0,110,111,105,115,101,52,0,1,1,0,0,10,0,120,0,0,0,1,9,18,95,
+95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,
+101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,50,0,0,17,49,57,
+0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,
+111,105,115,101,49,0,0,18,120,0,58,118,101,99,50,0,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,
+46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,0,18,120,0,58,
+118,101,99,50,0,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,0,46,0,0,20,0,0,1,90,95,0,0,12,0,0,
+110,111,105,115,101,52,0,1,1,0,0,11,0,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,
+110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,
+111,105,115,101,49,0,0,18,120,0,58,118,101,99,51,0,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,
+51,0,50,51,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,
+49,0,0,18,120,0,58,118,101,99,51,0,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,
+0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,0,18,120,
+0,58,118,101,99,51,0,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,0,46,0,
+0,20,0,0,1,90,95,0,0,12,0,0,110,111,105,115,101,52,0,1,1,0,0,12,0,120,0,0,0,1,9,18,95,95,114,101,
+116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,
+97,108,0,59,121,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,52,0,0,17,49,57,0,51,52,0,0,
+0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,
+86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,52,0,0,17,53,0,52,55,0,0,
+0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,20,0,9,18,95,95,
+114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,0,18,120,0,58,118,101,99,52,0,0,17,50,
+51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,17,51,55,0,52,56,0,0,0,0,46,0,0,20,
+0,0,0
index 416c6ff313d5c52ec7faa23cc17ea2f303c3858b..2e063e64161ac5b52ed79d25db13d8d6d0b79618 100644 (file)
@@ -46,7 +46,7 @@ vec4 texture1D(const sampler1D sampler, const float coord, const float bias)
    vec4 coord4;
    coord4.x = coord;
    coord4.w = bias;
-   __asm vec4_texb1d __retVal, sampler, coord4;
+   __asm vec4_tex_1d_bias __retVal, sampler, coord4;
 }
 
 vec4 texture1DProj(const sampler1D sampler, const vec2 coord, const float bias)
@@ -55,7 +55,7 @@ vec4 texture1DProj(const sampler1D sampler, const vec2 coord, const float bias)
    vec4 pcoord;
    pcoord.x = coord.x / coord.y;
    pcoord.w = bias;
-   __asm vec4_texb1d __retVal, sampler, pcoord;
+   __asm vec4_tex_1d_bias __retVal, sampler, pcoord;
 }
 
 vec4 texture1DProj(const sampler1D sampler, const vec4 coord, const float bias)
@@ -64,7 +64,7 @@ vec4 texture1DProj(const sampler1D sampler, const vec4 coord, const float bias)
    vec4 pcoord;
    pcoord.x = coord.x / coord.z;
    pcoord.w = bias;
-   __asm vec4_texb1d __retVal, sampler, pcoord;
+   __asm vec4_tex_1d_bias __retVal, sampler, pcoord;
 }
 
 
@@ -75,7 +75,7 @@ vec4 texture2D(const sampler2D sampler, const vec2 coord, const float bias)
    vec4 coord4;
    coord4.xy = coord.xy;
    coord4.w = bias;
-   __asm vec4_texb2d __retVal, sampler, coord4;
+   __asm vec4_tex_2d_bias __retVal, sampler, coord4;
 }
 
 vec4 texture2DProj(const sampler2D sampler, const vec3 coord, const float bias)
@@ -84,7 +84,7 @@ vec4 texture2DProj(const sampler2D sampler, const vec3 coord, const float bias)
    vec4 pcoord;
    pcoord.xy = coord.xy / coord.z;
    pcoord.w = bias;
-   __asm vec4_texb2d __retVal, sampler, pcoord;
+   __asm vec4_tex_2d_bias __retVal, sampler, pcoord;
 }
 
 vec4 texture2DProj(const sampler2D sampler, const vec4 coord, const float bias)
@@ -93,7 +93,7 @@ vec4 texture2DProj(const sampler2D sampler, const vec4 coord, const float bias)
    vec4 pcoord;
    pcoord.xy = coord.xy / coord.w;
    pcoord.w = bias;
-   __asm vec4_texb2d __retVal, sampler, pcoord;
+   __asm vec4_tex_2d_bias __retVal, sampler, pcoord;
 }
 
 
@@ -104,7 +104,7 @@ vec4 texture3D(const sampler3D sampler, const vec3 coord, const float bias)
    vec4 coord4;
    coord4.xyz = coord.xyz;
    coord4.w = bias;
-   __asm vec4_texb3d __retVal, sampler, coord4;
+   __asm vec4_tex_3d_bias __retVal, sampler, coord4;
 }
 
 vec4 texture3DProj(const sampler3D sampler, const vec4 coord, const float bias)
@@ -113,7 +113,7 @@ vec4 texture3DProj(const sampler3D sampler, const vec4 coord, const float bias)
    vec4 pcoord;
    pcoord.xyz = coord.xyz / coord.w;
    pcoord.w = bias;
-   __asm vec4_texb3d __retVal, sampler, pcoord;
+   __asm vec4_tex_3d_bias __retVal, sampler, pcoord;
 }
 
 
@@ -124,21 +124,17 @@ vec4 textureCube(const samplerCube sampler, const vec3 coord, const float bias)
    vec4 coord4;
    coord4.xyz = coord;
    coord4.w = bias;
-   __asm vec4_texcube __retVal, sampler, coord4;
+   __asm vec4_tex_cube __retVal, sampler, coord4;
 }
 
 
 
-
-// For shadow textures, we use the regular tex instructions since they should
-// do the depth comparison step.
-
 vec4 shadow1D(const sampler1DShadow sampler, const vec3 coord, const float bias)
 {
    vec4 coord4;
    coord4.xyz = coord;
    coord4.w = bias;
-   __asm vec4_texb1d __retVal, sampler, coord4;
+   __asm vec4_tex_1d_bias_shadow __retVal, sampler, coord4;
 }
 
 vec4 shadow1DProj(const sampler1DShadow sampler, const vec4 coord, const float bias)
@@ -147,7 +143,7 @@ vec4 shadow1DProj(const sampler1DShadow sampler, const vec4 coord, const float b
    pcoord.x = coord.x / coord.w;
    pcoord.z = coord.z;
    pcoord.w = bias;
-   __asm vec4_texb1d __retVal, sampler, pcoord;
+   __asm vec4_tex_1d_bias_shadow __retVal, sampler, pcoord;
 }
 
 vec4 shadow2D(const sampler2DShadow sampler, const vec3 coord, const float bias)
@@ -155,7 +151,7 @@ vec4 shadow2D(const sampler2DShadow sampler, const vec3 coord, const float bias)
    vec4 coord4;
    coord4.xyz = coord;
    coord4.w = bias;
-   __asm vec4_texb2d __retVal, sampler, coord4;
+   __asm vec4_tex_2d_bias_shadow __retVal, sampler, coord4;
 }
 
 vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord, const float bias)
@@ -164,7 +160,7 @@ vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord, const float b
    pcoord.xy = coord.xy / coord.w;
    pcoord.z = coord.z;
    pcoord.w = bias;
-   __asm vec4_texb2d __retVal, sampler, pcoord;
+   __asm vec4_tex_2d_bias_shadow __retVal, sampler, pcoord;
 }
 
 
index 738a0f92956a5c115afe215f5aee3c29622a115b..c5a1cce2a4908435784e18e428d41a8a3e548041 100644 (file)
 108,101,114,0,0,1,1,0,0,9,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,
 12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,0,18,99,111,111,114,100,0,
 20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,
-98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,
-100,52,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,1,0,0,16,0,
-115,97,109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,
-1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,
-111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,121,0,49,20,0,9,18,112,99,111,111,114,100,0,
-59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,
-86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,
-0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,1,0,0,16,0,115,97,109,112,108,101,114,0,0,1,
-1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,
-111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,
-99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,
-0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,
-108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,
-50,68,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,1,1,0,0,9,
-0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,
-52,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,
-18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,
-0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,116,101,
-120,116,117,114,101,50,68,80,114,111,106,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,
-0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,
-100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,99,
-111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,
-4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,
-108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,
-50,68,80,114,111,106,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,
-0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,
-99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,
-119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,
-116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,
+95,49,100,95,98,105,97,115,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,
+18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,80,114,111,
+106,0,1,1,0,0,16,0,115,97,109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,1,1,0,0,9,0,
+98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,
+100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,121,0,49,20,0,9,18,112,
+99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,95,49,100,95,
+98,105,97,115,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,
+111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,1,0,0,
+16,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,
+0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,
+18,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,
+100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,95,49,100,95,98,105,97,115,0,
+18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,
+0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,0,1,1,0,0,17,0,115,97,109,112,108,101,114,
+0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,99,
+111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,0,18,99,111,111,114,100,0,59,120,
+121,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,
+101,120,95,50,100,95,98,105,97,115,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,
+114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,80,
+114,111,106,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,
+0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,
+111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,122,0,
+49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,
+120,95,50,100,95,98,105,97,115,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,
+0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,80,114,
+111,106,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,
+9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,
+114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,119,0,49,20,
+0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,95,
+50,100,95,98,105,97,115,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,
 112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,51,68,0,1,1,0,0,18,0,
 115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,
 1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,
 18,99,111,111,114,100,0,59,120,121,122,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,
-115,0,20,0,4,118,101,99,52,95,116,101,120,98,51,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,
-109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,
-114,101,51,68,80,114,111,106,0,1,1,0,0,18,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,
-114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,
-18,112,99,111,111,114,100,0,59,120,121,122,0,18,99,111,111,114,100,0,59,120,121,122,0,18,99,111,
-111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,
-118,101,99,52,95,116,101,120,98,51,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,
-101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,67,
-117,98,101,0,1,1,0,0,19,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,
-0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,
-100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,
-105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,99,117,98,101,0,18,95,95,114,101,116,86,97,108,0,
-0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,
-100,111,119,49,68,0,1,1,0,0,20,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,
-0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,
-111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,
-0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,
-108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,
-104,97,100,111,119,49,68,80,114,111,106,0,1,1,0,0,20,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,
-99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,
-100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,99,111,111,
-114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,122,0,18,99,111,111,114,100,0,59,122,0,
-20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,
-98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,
-114,100,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,50,68,0,1,1,0,0,21,0,115,97,109,112,108,
-101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,
-0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,
-100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,
-101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,
-111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,50,68,80,114,111,106,0,1,1,0,0,21,
-0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,
-0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,
-18,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,
-114,100,0,59,122,0,18,99,111,111,114,100,0,59,122,0,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,
-98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,
-18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,9,0,0,100,70,100,
-120,0,1,1,0,0,9,0,112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,
-120,0,0,18,112,0,59,120,120,120,120,0,0,0,0,1,90,95,0,0,10,0,0,100,70,100,120,0,1,1,0,0,10,0,112,0,
-0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,112,0,59,
-120,121,121,121,0,0,0,0,1,90,95,0,0,11,0,0,100,70,100,120,0,1,1,0,0,11,0,112,0,0,0,1,4,118,101,99,
-52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,112,0,59,120,121,122,
-122,0,0,0,0,1,90,95,0,0,12,0,0,100,70,100,120,0,1,1,0,0,12,0,112,0,0,0,1,4,118,101,99,52,95,100,
-100,120,0,18,95,95,114,101,116,86,97,108,0,0,18,112,0,0,0,0,1,90,95,0,0,9,0,0,100,70,100,121,0,1,1,
-0,0,9,0,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,
-18,112,0,59,120,120,120,120,0,0,0,0,1,90,95,0,0,10,0,0,100,70,100,121,0,1,1,0,0,10,0,112,0,0,0,1,4,
-118,101,99,52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,112,0,59,120,121,
-121,121,0,0,0,0,1,90,95,0,0,11,0,0,100,70,100,121,0,1,1,0,0,11,0,112,0,0,0,1,4,118,101,99,52,95,
-100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,112,0,59,120,121,122,122,0,0,
-0,0,1,90,95,0,0,12,0,0,100,70,100,121,0,1,1,0,0,12,0,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,
-18,95,95,114,101,116,86,97,108,0,0,18,112,0,0,0,0,1,90,95,0,0,9,0,0,102,119,105,100,116,104,0,1,1,
-0,0,9,0,112,0,0,0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,0,58,97,98,115,0,0,58,
-100,70,100,121,0,0,18,112,0,0,0,0,0,46,0,0,1,90,95,0,0,10,0,0,102,119,105,100,116,104,0,1,1,0,0,10,
-0,112,0,0,0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,0,58,97,98,115,0,0,58,100,70,
-100,121,0,0,18,112,0,0,0,0,0,46,0,0,1,90,95,0,0,11,0,0,102,119,105,100,116,104,0,1,1,0,0,11,0,112,
-0,0,0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,0,58,97,98,115,0,0,58,100,70,100,
-121,0,0,18,112,0,0,0,0,0,46,0,0,1,90,95,0,0,12,0,0,102,119,105,100,116,104,0,1,1,0,0,12,0,112,0,0,
-0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,0,58,97,98,115,0,0,58,100,70,100,121,0,
-0,18,112,0,0,0,0,0,46,0,0,0
+115,0,20,0,4,118,101,99,52,95,116,101,120,95,51,100,95,98,105,97,115,0,18,95,95,114,101,116,86,97,
+108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,116,
+101,120,116,117,114,101,51,68,80,114,111,106,0,1,1,0,0,18,0,115,97,109,112,108,101,114,0,0,1,1,0,0,
+12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,
+114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,122,0,18,99,111,111,114,100,0,59,120,121,
+122,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,
+115,0,20,0,4,118,101,99,52,95,116,101,120,95,51,100,95,98,105,97,115,0,18,95,95,114,101,116,86,97,
+108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,
+101,120,116,117,114,101,67,117,98,101,0,1,1,0,0,19,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,
+99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,
+52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,111,
+111,114,100,52,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,95,99,117,98,101,
+0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,
+0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,49,68,0,1,1,0,0,20,0,115,97,109,112,108,101,114,0,
+0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,99,
+111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,20,
+0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,95,
+49,100,95,98,105,97,115,95,115,104,97,100,111,119,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,
+109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,
+49,68,80,114,111,106,0,1,1,0,0,20,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,
+0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,
+99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,119,0,49,
+20,0,9,18,112,99,111,111,114,100,0,59,122,0,18,99,111,111,114,100,0,59,122,0,20,0,9,18,112,99,111,
+111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118,101,99,52,95,116,101,120,95,49,100,95,98,105,
+97,115,95,115,104,97,100,111,119,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,
+114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,50,68,0,1,1,0,
+0,21,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,
+115,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,
+121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,98,105,97,115,0,20,
+0,4,118,101,99,52,95,116,101,120,95,50,100,95,98,105,97,115,95,115,104,97,100,111,119,0,18,95,95,
+114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,
+95,0,0,12,0,0,115,104,97,100,111,119,50,68,80,114,111,106,0,1,1,0,0,21,0,115,97,109,112,108,101,
+114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,98,105,97,115,0,0,0,1,3,2,90,95,0,0,12,0,1,
+112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,
+120,121,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,122,0,18,99,
+111,111,114,100,0,59,122,0,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,
+118,101,99,52,95,116,101,120,95,50,100,95,98,105,97,115,95,115,104,97,100,111,119,0,18,95,95,114,
+101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,
+0,0,9,0,0,100,70,100,120,0,1,1,0,0,9,0,112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114,
+101,116,86,97,108,0,59,120,0,0,18,112,0,59,120,120,120,120,0,0,0,0,1,90,95,0,0,10,0,0,100,70,100,
+120,0,1,1,0,0,10,0,112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,
+59,120,121,0,0,18,112,0,59,120,121,121,121,0,0,0,0,1,90,95,0,0,11,0,0,100,70,100,120,0,1,1,0,0,11,
+0,112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,
+18,112,0,59,120,121,122,122,0,0,0,0,1,90,95,0,0,12,0,0,100,70,100,120,0,1,1,0,0,12,0,112,0,0,0,1,4,
+118,101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,0,18,112,0,0,0,0,1,90,95,0,0,9,0,0,
+100,70,100,121,0,1,1,0,0,9,0,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,95,95,114,101,116,86,
+97,108,0,59,120,0,0,18,112,0,59,120,120,120,120,0,0,0,0,1,90,95,0,0,10,0,0,100,70,100,121,0,1,1,0,
+0,10,0,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,
+0,18,112,0,59,120,121,121,121,0,0,0,0,1,90,95,0,0,11,0,0,100,70,100,121,0,1,1,0,0,11,0,112,0,0,0,1,
+4,118,101,99,52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,112,0,59,
+120,121,122,122,0,0,0,0,1,90,95,0,0,12,0,0,100,70,100,121,0,1,1,0,0,12,0,112,0,0,0,1,4,118,101,99,
+52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,0,18,112,0,0,0,0,1,90,95,0,0,9,0,0,102,119,
+105,100,116,104,0,1,1,0,0,9,0,112,0,0,0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,
+0,58,97,98,115,0,0,58,100,70,100,121,0,0,18,112,0,0,0,0,0,46,0,0,1,90,95,0,0,10,0,0,102,119,105,
+100,116,104,0,1,1,0,0,10,0,112,0,0,0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,0,
+58,97,98,115,0,0,58,100,70,100,121,0,0,18,112,0,0,0,0,0,46,0,0,1,90,95,0,0,11,0,0,102,119,105,100,
+116,104,0,1,1,0,0,11,0,112,0,0,0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,0,58,97,
+98,115,0,0,58,100,70,100,121,0,0,18,112,0,0,0,0,0,46,0,0,1,90,95,0,0,12,0,0,102,119,105,100,116,
+104,0,1,1,0,0,12,0,112,0,0,0,1,8,58,97,98,115,0,0,58,100,70,100,120,0,0,18,112,0,0,0,0,0,58,97,98,
+115,0,0,58,100,70,100,121,0,0,18,112,0,0,0,0,0,46,0,0,0
index 17e86d9a0edd2c9409fd6d95723e9472e06e3bc3..9ad5f35425b0fde999e46f4f4a7cd701ee9a7ab6 100644 (file)
@@ -78,7 +78,7 @@ vec4 texture1DLod(const sampler1D sampler, const float coord, const float lod)
    vec4 coord4;
    coord4.x = coord;
    coord4.w = lod;
-   __asm vec4_texb1d __retVal, sampler, coord4;
+   __asm vec4_tex_1d_bias __retVal, sampler, coord4;
 }
 
 vec4 texture1DProjLod(const sampler1D sampler, const vec2 coord, const float lod)
@@ -86,7 +86,7 @@ vec4 texture1DProjLod(const sampler1D sampler, const vec2 coord, const float lod
    vec4 pcoord;
    pcoord.x = coord.x / coord.y;
    pcoord.w = lod;
-   __asm vec4_texb1d __retVal, sampler, pcoord;
+   __asm vec4_tex_1d_bias __retVal, sampler, pcoord;
 }
 
 vec4 texture1DProjLod(const sampler1D sampler, const vec4 coord, const float lod)
@@ -94,7 +94,7 @@ vec4 texture1DProjLod(const sampler1D sampler, const vec4 coord, const float lod
    vec4 pcoord;
    pcoord.x = coord.x / coord.z;
    pcoord.w = lod;
-   __asm vec4_texb1d __retVal, sampler, pcoord;
+   __asm vec4_tex_1d_bias __retVal, sampler, pcoord;
 }
 
 
@@ -104,7 +104,7 @@ vec4 texture2DLod(const sampler2D sampler, const vec2 coord, const float lod)
    vec4 coord4;
    coord4.xy = coord.xy;
    coord4.w = lod;
-   __asm vec4_texb2d __retVal, sampler, coord4;
+   __asm vec4_tex_2d_bias __retVal, sampler, coord4;
 }
 
 vec4 texture2DProjLod(const sampler2D sampler, const vec3 coord, const float lod)
@@ -112,7 +112,7 @@ vec4 texture2DProjLod(const sampler2D sampler, const vec3 coord, const float lod
    vec4 pcoord;
    pcoord.xy = coord.xy / coord.z;
    pcoord.w = lod;
-   __asm vec4_texb2d __retVal, sampler, pcoord;
+   __asm vec4_tex_2d_bias __retVal, sampler, pcoord;
 }
 
 vec4 texture2DProjLod(const sampler2D sampler, const vec4 coord, const float lod)
@@ -120,7 +120,7 @@ vec4 texture2DProjLod(const sampler2D sampler, const vec4 coord, const float lod
    vec4 pcoord;
    pcoord.xy = coord.xy / coord.z;
    pcoord.w = lod;
-   __asm vec4_texb2d __retVal, sampler, pcoord;
+   __asm vec4_tex_2d_bias __retVal, sampler, pcoord;
 }
 
 
@@ -129,16 +129,16 @@ vec4 texture3DLod(const sampler3D sampler, const vec3 coord, const float lod)
    vec4 coord4;
    coord4.xyz = coord.xyz;
    coord4.w = lod;
-   __asm vec4_texb3d __retVal, sampler, coord4;
+   __asm vec4_tex_3d_bias __retVal, sampler, coord4;
 }
 
 vec4 texture3DProjLod(const sampler3D sampler, const vec4 coord, const float lod)
 {
-   // do projection here (there's no vec4_texbp3d instruction)
+   // do projection here (there's no vec4_tex_3d_bias_proj instruction)
    vec4 pcoord;
    pcoord.xyz = coord.xyz / coord.w;
    pcoord.w = lod;
-   __asm vec4_texb3d __retVal, sampler, pcoord;
+   __asm vec4_tex_3d_bias __retVal, sampler, pcoord;
 }
 
 
@@ -147,7 +147,7 @@ vec4 textureCubeLod(const samplerCube sampler, const vec3 coord, const float lod
    vec4 coord4;
    coord4.xyz = coord;
    coord4.w = lod;
-   __asm vec4_texcube __retVal, sampler, coord4;
+   __asm vec4_tex_cube __retVal, sampler, coord4;
 }
 
 
@@ -156,7 +156,7 @@ vec4 shadow1DLod(const sampler1DShadow sampler, const vec3 coord, const float lo
    vec4 coord4;
    coord4.xyz = coord;
    coord4.w = lod;
-   __asm vec4_texb1d __retVal, sampler, coord4;
+   __asm vec4_tex_1d_bias_shadow __retVal, sampler, coord4;
 }
 
 vec4 shadow1DProjLod(const sampler1DShadow sampler, const vec4 coord,
@@ -166,7 +166,7 @@ vec4 shadow1DProjLod(const sampler1DShadow sampler, const vec4 coord,
    pcoord.x = coord.x / coord.w;
    pcoord.z = coord.z;
    pcoord.w = lod;
-   __asm vec4_texb1d __retVal, sampler, pcoord;
+   __asm vec4_tex_1d_bias_shadow __retVal, sampler, pcoord;
 }
 
 
@@ -175,7 +175,7 @@ vec4 shadow2DLod(const sampler2DShadow sampler, const vec3 coord, const float lo
    vec4 coord4;
    coord4.xyz = coord;
    coord4.w = lod;
-   __asm vec4_texb2d __retVal, sampler, coord4;
+   __asm vec4_tex_2d_bias_shadow __retVal, sampler, coord4;
 }
 
 vec4 shadow2DProjLod(const sampler2DShadow sampler, const vec4 coord,
@@ -185,6 +185,6 @@ vec4 shadow2DProjLod(const sampler2DShadow sampler, const vec4 coord,
    pcoord.xy = coord.xy / coord.w;
    pcoord.z = coord.z;
    pcoord.w = lod;
-   __asm vec4_texb2d __retVal, sampler, pcoord;
+   __asm vec4_tex_2d_bias_shadow __retVal, sampler, pcoord;
 }
 
index 2cb91bf268fd152bb8288fa7e3938490afb92bc0..e5a252b0196ce33686f8fd15ca98c361029acbf3 100644 (file)
 0,116,101,120,116,117,114,101,49,68,76,111,100,0,1,1,0,0,16,0,115,97,109,112,108,101,114,0,0,1,1,0,
 0,9,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,
 100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,
-114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,
-114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,
-95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,80,114,111,106,76,111,100,0,1,1,0,0,16,0,115,97,
-109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,
-95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,111,
-114,100,0,59,120,0,18,99,111,111,114,100,0,59,121,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,
-18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,
-0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,
-120,116,117,114,101,49,68,80,114,111,106,76,111,100,0,1,1,0,0,16,0,115,97,109,112,108,101,114,0,0,
-1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,
-111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,
-99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,108,111,100,0,20,0,
-4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,
-108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,
-50,68,76,111,100,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,
-1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,
-114,100,52,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,20,0,9,18,99,111,111,114,100,52,0,
-59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,
-97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,
-116,101,120,116,117,114,101,50,68,80,114,111,106,76,111,100,0,1,1,0,0,17,0,115,97,109,112,108,101,
-114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,
-112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,
-120,121,0,18,99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,108,
-111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,
-115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,
-116,117,114,101,50,68,80,114,111,106,76,111,100,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,
-0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,
-111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,
-18,99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,108,111,100,0,
-20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,
-112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,
-101,51,68,76,111,100,0,1,1,0,0,18,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,
-0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,
-111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,59,120,121,122,0,20,0,9,18,99,111,111,
-114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,51,100,0,18,95,95,
-114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,
-95,0,0,12,0,0,116,101,120,116,117,114,101,51,68,80,114,111,106,76,111,100,0,1,1,0,0,18,0,115,97,
+114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,95,49,100,95,98,105,97,
+115,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,
+52,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,80,114,111,106,76,111,100,0,1,1,0,
+0,16,0,115,97,109,112,108,101,114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,
+0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,
+18,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,121,0,49,20,0,9,18,112,99,111,111,114,
+100,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,95,49,100,95,98,105,97,115,0,
+18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,
+0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,49,68,80,114,111,106,76,111,100,0,1,1,0,0,16,0,
+115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,
+3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,
+111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,
+119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,95,49,100,95,98,105,97,115,0,18,95,95,
+114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,
+95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,76,111,100,0,1,1,0,0,17,0,115,97,109,112,108,101,
+114,0,0,1,1,0,0,10,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,
+99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,0,18,99,111,111,114,100,0,59,
+120,121,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,
+101,120,95,50,100,95,98,105,97,115,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,
+114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,80,
+114,111,106,76,111,100,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,
+100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,
+99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,
+122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,
+101,120,95,50,100,95,98,105,97,115,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,
+114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,50,68,80,
+114,111,106,76,111,100,0,1,1,0,0,17,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,
+100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,
+99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,
+122,0,49,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,
+101,120,95,50,100,95,98,105,97,115,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,
+114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,51,68,76,
+111,100,0,1,1,0,0,18,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,
+9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,
+52,0,59,120,121,122,0,18,99,111,111,114,100,0,59,120,121,122,0,20,0,9,18,99,111,111,114,100,52,0,
+59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,95,51,100,95,98,105,97,115,0,18,95,
+95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,
+90,95,0,0,12,0,0,116,101,120,116,117,114,101,51,68,80,114,111,106,76,111,100,0,1,1,0,0,18,0,115,97,
 109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,
 95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,122,0,18,99,
 111,111,114,100,0,59,120,121,122,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,
-114,100,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,51,100,0,18,95,95,114,
-101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,
-0,0,12,0,0,116,101,120,116,117,114,101,67,117,98,101,76,111,100,0,1,1,0,0,19,0,115,97,109,112,108,
-101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,
-1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,
-0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,
-99,117,98,101,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,
-114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,49,68,76,111,100,0,1,1,0,0,20,0,115,
+114,100,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,95,51,100,95,98,105,97,115,
+0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,
+0,0,0,1,90,95,0,0,12,0,0,116,101,120,116,117,114,101,67,117,98,101,76,111,100,0,1,1,0,0,19,0,115,
 97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,
 90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,
 111,111,114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,
-95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,
-99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,49,68,80,114,111,106,76,
-111,100,0,1,1,0,0,20,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,
-9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,
-100,0,59,120,0,18,99,111,111,114,100,0,59,120,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,
-99,111,111,114,100,0,59,122,0,18,99,111,111,114,100,0,59,122,0,20,0,9,18,112,99,111,111,114,100,0,
-59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,49,100,0,18,95,95,114,101,116,86,
-97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,0,0,12,0,0,
-115,104,97,100,111,119,50,68,76,111,100,0,1,1,0,0,21,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,
-99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,
-0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,
-114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,
-114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,
-95,0,0,12,0,0,115,104,97,100,111,119,50,68,80,114,111,106,76,111,100,0,1,1,0,0,21,0,115,97,109,112,
-108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,
-12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,
-100,0,59,120,121,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,122,0,
-18,99,111,111,114,100,0,59,122,0,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,108,111,100,0,20,0,
-4,118,101,99,52,95,116,101,120,98,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,
+95,116,101,120,95,99,117,98,101,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,
+0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,49,68,76,111,100,0,
+1,1,0,0,20,0,115,97,109,112,108,101,114,0,0,1,1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,
+111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,
+120,121,122,0,18,99,111,111,114,100,0,20,0,9,18,99,111,111,114,100,52,0,59,119,0,18,108,111,100,0,
+20,0,4,118,101,99,52,95,116,101,120,95,49,100,95,98,105,97,115,95,115,104,97,100,111,119,0,18,95,
+95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,
+90,95,0,0,12,0,0,115,104,97,100,111,119,49,68,80,114,111,106,76,111,100,0,1,1,0,0,20,0,115,97,109,
+112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,
+0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,0,18,99,111,111,114,
+100,0,59,120,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,122,0,18,
+99,111,111,114,100,0,59,122,0,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,108,111,100,0,20,0,4,
+118,101,99,52,95,116,101,120,95,49,100,95,98,105,97,115,95,115,104,97,100,111,119,0,18,95,95,114,
+101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,90,95,
+0,0,12,0,0,115,104,97,100,111,119,50,68,76,111,100,0,1,1,0,0,21,0,115,97,109,112,108,101,114,0,0,1,
+1,0,0,11,0,99,111,111,114,100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,99,111,111,
+114,100,52,0,0,0,9,18,99,111,111,114,100,52,0,59,120,121,122,0,18,99,111,111,114,100,0,20,0,9,18,
+99,111,111,114,100,52,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,95,50,100,95,
+98,105,97,115,95,115,104,97,100,111,119,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,
+101,114,0,0,18,99,111,111,114,100,52,0,0,0,0,1,90,95,0,0,12,0,0,115,104,97,100,111,119,50,68,80,
+114,111,106,76,111,100,0,1,1,0,0,21,0,115,97,109,112,108,101,114,0,0,1,1,0,0,12,0,99,111,111,114,
+100,0,0,1,1,0,0,9,0,108,111,100,0,0,0,1,3,2,90,95,0,0,12,0,1,112,99,111,111,114,100,0,0,0,9,18,112,
+99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,
+119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,122,0,18,99,111,111,114,100,0,59,122,0,20,0,9,18,
+112,99,111,111,114,100,0,59,119,0,18,108,111,100,0,20,0,4,118,101,99,52,95,116,101,120,95,50,100,
+95,98,105,97,115,95,115,104,97,100,111,119,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,
 108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,0
index c0f4c79e1368b5bc0ee121682aa2f42fce9a11c2..9858a0f7fdc010015c24bb507d8c17c439ba259c 100644 (file)
@@ -494,7 +494,7 @@ emit_statevars(const char *name, int array_len,
    }
    else if (type->type == SLANG_SPEC_STRUCT) {
       const slang_variable_scope *fields = type->_struct->fields;
-      GLuint i, pos;
+      GLuint i, pos = 0;
       for (i = 0; i < fields->num_variables; i++) {
          const slang_variable *var = fields->variables[i];
          GLint p = emit_statevars(var->a_name, 0, &var->type.specifier,
index 11340d26e21da41abc87752db4ad9ecdc8edb2a8..8263aae3343e9b5f3a4ed0878d70aadaf3dc6ecf 100644 (file)
@@ -296,46 +296,6 @@ _slang_array_size(GLint elemSize, GLint arrayLen)
 }
 
 
-
-/**
- * Establish the binding between a slang_ir_node and a slang_variable.
- * Then, allocate/attach a slang_ir_storage object to the IR node if needed.
- * The IR node must be a IR_VAR or IR_VAR_DECL node.
- * \param n  the IR node
- * \param var  the variable to associate with the IR node
- */
-static void
-_slang_attach_storage(slang_ir_node *n, slang_variable *var)
-{
-   assert(n);
-   assert(var);
-   assert(n->Opcode == IR_VAR || n->Opcode == IR_VAR_DECL);
-   assert(!n->Var || n->Var == var);
-
-   n->Var = var;
-
-   if (!n->Store) {
-      /* need to setup storage */
-      if (n->Var && n->Var->store) {
-         /* node storage info = var storage info */
-         n->Store = n->Var->store;
-      }
-      else {
-         /* alloc new storage info */
-         n->Store = _slang_new_ir_storage(PROGRAM_UNDEFINED, -7, -5);
-#if 0
-         printf("%s var=%s Store=%p Size=%d\n", __FUNCTION__,
-                (char*) var->a_name,
-                (void*) n->Store, n->Store->Size);
-#endif
-         if (n->Var)
-            n->Var->store = n->Store;
-         assert(n->Var->store);
-      }
-   }
-}
-
-
 /**
  * Return the TEXTURE_*_INDEX value that corresponds to a sampler type,
  * or -1 if the type is not a sampler.
@@ -450,8 +410,8 @@ _slang_output_index(const char *name, GLenum target)
       { NULL, 0 }
    };
    static const struct output_info fragOutputs[] = {
-      { "gl_FragColor", FRAG_RESULT_COLR },
-      { "gl_FragDepth", FRAG_RESULT_DEPR },
+      { "gl_FragColor", FRAG_RESULT_COLOR },
+      { "gl_FragDepth", FRAG_RESULT_DEPTH },
       { "gl_FragData", FRAG_RESULT_DATA0 },
       { NULL, 0 }
    };
@@ -516,18 +476,28 @@ static slang_asm_info AsmInfo[] = {
    /* float binary op */
    { "float_power", IR_POW, 1, 2 },
    /* texture / sampler */
-   { "vec4_tex1d", IR_TEX, 1, 2 },
-   { "vec4_texb1d", IR_TEXB, 1, 2 },  /* 1d w/ bias */
-   { "vec4_texp1d", IR_TEXP, 1, 2 },  /* 1d w/ projection */
-   { "vec4_tex2d", IR_TEX, 1, 2 },
-   { "vec4_texb2d", IR_TEXB, 1, 2 },  /* 2d w/ bias */
-   { "vec4_texp2d", IR_TEXP, 1, 2 },  /* 2d w/ projection */
-   { "vec4_tex3d", IR_TEX, 1, 2 },
-   { "vec4_texb3d", IR_TEXB, 1, 2 },  /* 3d w/ bias */
-   { "vec4_texp3d", IR_TEXP, 1, 2 },  /* 3d w/ projection */
-   { "vec4_texcube", IR_TEX, 1, 2 },  /* cubemap */
-   { "vec4_tex_rect", IR_TEX, 1, 2 }, /* rectangle */
-   { "vec4_texp_rect", IR_TEX, 1, 2 },/* rectangle w/ projection */
+   { "vec4_tex_1d", IR_TEX, 1, 2 },
+   { "vec4_tex_1d_bias", IR_TEXB, 1, 2 },  /* 1d w/ bias */
+   { "vec4_tex_1d_proj", IR_TEXP, 1, 2 },  /* 1d w/ projection */
+   { "vec4_tex_2d", IR_TEX, 1, 2 },
+   { "vec4_tex_2d_bias", IR_TEXB, 1, 2 },  /* 2d w/ bias */
+   { "vec4_tex_2d_proj", IR_TEXP, 1, 2 },  /* 2d w/ projection */
+   { "vec4_tex_3d", IR_TEX, 1, 2 },
+   { "vec4_tex_3d_bias", IR_TEXB, 1, 2 },  /* 3d w/ bias */
+   { "vec4_tex_3d_proj", IR_TEXP, 1, 2 },  /* 3d w/ projection */
+   { "vec4_tex_cube", IR_TEX, 1, 2 },      /* cubemap */
+   { "vec4_tex_rect", IR_TEX, 1, 2 },      /* rectangle */
+   { "vec4_tex_rect_bias", IR_TEX, 1, 2 }, /* rectangle w/ projection */
+
+   /* texture / sampler but with shadow comparison */
+   { "vec4_tex_1d_shadow", IR_TEX_SH, 1, 2 },
+   { "vec4_tex_1d_bias_shadow", IR_TEXB_SH, 1, 2 },
+   { "vec4_tex_1d_proj_shadow", IR_TEXP_SH, 1, 2 },
+   { "vec4_tex_2d_shadow", IR_TEX_SH, 1, 2 },
+   { "vec4_tex_2d_bias_shadow", IR_TEXB_SH, 1, 2 },
+   { "vec4_tex_2d_proj_shadow", IR_TEXP_SH, 1, 2 },
+   { "vec4_tex_rect_shadow", IR_TEX_SH, 1, 2 },
+   { "vec4_tex_rect_proj_shadow", IR_TEXP_SH, 1, 2 },
 
    /* unary op */
    { "ivec4_to_vec4", IR_I_TO_F, 1, 1 }, /* int[4] to float[4] */
@@ -735,7 +705,14 @@ new_var(slang_assemble_ctx *A, slang_variable *var)
 {
    slang_ir_node *n = new_node0(IR_VAR);
    if (n) {
-      _slang_attach_storage(n, var);
+      ASSERT(var);
+      ASSERT(var->store);
+      ASSERT(!n->Store);
+      ASSERT(!n->Var);
+
+      /* Set IR node's Var and Store pointers */
+      n->Var = var;
+      n->Store = var->store;
    }
    return n;
 }
@@ -1462,6 +1439,12 @@ _slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun,
    /*_slang_label_delete(A->curFuncEndLabel);*/
    A->curFuncEndLabel = prevFuncEndLabel;
 
+   if (A->pragmas->Debug) {
+      char s[1000];
+      snprintf(s, sizeof(s), "Call/inline %s()", (char *) fun->header.a_name);
+      n->Comment = _slang_strdup(s);
+   }
+
    return n;
 }
 
@@ -2598,6 +2581,20 @@ _slang_can_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper)
 }
 
 
+static void
+_unroll_loop_inc(slang_assemble_ctx * A)
+{
+   A->UnrollLoop++;
+}
+
+
+static void
+_unroll_loop_dec(slang_assemble_ctx * A)
+{
+   A->UnrollLoop--;
+}
+
+
 /**
  * Unroll a for-loop.
  * First we determine the number of iterations to unroll.
@@ -2614,6 +2611,9 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper)
    slang_ir_node *n, *root = NULL;
    slang_atom varId;
 
+   /* Set flag so code generator knows we're unrolling loops */
+   _unroll_loop_inc( A );
+
    if (oper->children[0].type == SLANG_OPER_BLOCK_NO_NEW_SCOPE) {
       /* for (int i=0; ... */
       slang_variable *var;
@@ -2636,11 +2636,15 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper)
 
       /* make a copy of the loop body */
       body = slang_operation_new(1);
-      if (!body)
+      if (!body) {
+         _unroll_loop_dec( A );
          return NULL;
+      }
 
-      if (!slang_operation_copy(body, &oper->children[3]))
+      if (!slang_operation_copy(body, &oper->children[3])) {
+         _unroll_loop_dec( A );
          return NULL;
+      }
 
       /* in body, replace instances of 'varId' with literal 'iter' */
       {
@@ -2651,6 +2655,7 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper)
          if (!oldVar) {
             /* undeclared loop variable */
             slang_operation_delete(body);
+            _unroll_loop_dec( A );
             return NULL;
          }
 
@@ -2665,11 +2670,18 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper)
 
       /* do IR codegen for body */
       n = _slang_gen_operation(A, body);
+      if (!n) {
+         _unroll_loop_dec( A );
+         return NULL;
+      }
+
       root = new_seq(root, n);
 
       slang_operation_delete(body);
    }
 
+   _unroll_loop_dec( A );
+
    return root;
 }
 
@@ -2806,18 +2818,24 @@ _slang_gen_if(slang_assemble_ctx * A, const slang_operation *oper)
    if (is_operation_type(&oper->children[1], SLANG_OPER_BREAK)
        && !haveElseClause) {
       /* Special case: generate a conditional break */
+      if (!A->CurLoop && A->UnrollLoop) /* trying to unroll */
+         return NULL;
       ifBody = new_break_if_true(A->CurLoop, cond);
       return ifBody;
    }
    else if (is_operation_type(&oper->children[1], SLANG_OPER_CONTINUE)
             && !haveElseClause) {
-      /* Special case: generate a conditional break */
+      /* Special case: generate a conditional continue */
+      if (!A->CurLoop && A->UnrollLoop) /* trying to unroll */
+         return NULL;
       ifBody = new_cont_if_true(A->CurLoop, cond);
       return ifBody;
    }
    else {
       /* general case */
       ifBody = _slang_gen_operation(A, &oper->children[1]);
+      if (!ifBody)
+         return NULL;
       if (haveElseClause)
          elseBody = _slang_gen_operation(A, &oper->children[2]);
       else
@@ -2988,7 +3006,7 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var,
    slang_ir_node *varDecl, *n;
    slang_ir_storage *store;
    GLint arrayLen, size, totalSize;  /* if array then totalSize > size */
-   enum register_file file;
+   gl_register_file file;
 
    /*assert(!var->declared);*/
    var->declared = GL_TRUE;
@@ -3004,7 +3022,7 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var,
       file = PROGRAM_TEMPORARY;
    }
 
-   totalSize = size = _slang_sizeof_type_specifier(&var->type.specifier);
+   size = _slang_sizeof_type_specifier(&var->type.specifier);
    if (size <= 0) {
       slang_info_log_error(A->log, "invalid declaration for '%s'", varName);
       return NULL;
@@ -3018,22 +3036,23 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var,
    if (!varDecl)
       return NULL;
 
-   _slang_attach_storage(varDecl, var); /* undefined storage at first */
-   assert(var->store);
-   assert(varDecl->Store == var->store);
-   assert(varDecl->Store);
-   assert(varDecl->Store->Index < 0);
-   store = var->store;
+   /* Allocate slang_ir_storage for this variable if needed.
+    * Note that we may not actually allocate a constant or temporary register
+    * until later.
+    */
+   if (!var->store) {
+      GLint index = -7;  /* TBD / unknown */
+      var->store = _slang_new_ir_storage(file, index, totalSize);
+      if (!var->store)
+         return NULL; /* out of memory */
+   }
 
-   assert(store == varDecl->Store);
+   /* set the IR node's Var and Store pointers */
+   varDecl->Var = var;
+   varDecl->Store = var->store;
 
 
-   /* Fill in storage fields which we now know.  store->Index/Swizzle may be
-    * set for some cases below.  Otherwise, store->Index/Swizzle will be set
-    * during code emit.
-    */
-   store->File = file;
-   store->Size = totalSize;
+   store = var->store;
 
    /* if there's an initializer, generate IR for the expression */
    if (initializer) {
@@ -3662,7 +3681,7 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
       if (lhs && rhs) {
          /* convert lhs swizzle into writemask */
          const GLuint swizzle = root_swizzle(lhs->Store);
-         GLuint writemask, newSwizzle;
+         GLuint writemask, newSwizzle = 0x0;
          if (!swizzle_to_writemask(A, swizzle, &writemask, &newSwizzle)) {
             /* Non-simple writemask, need to swizzle right hand side in
              * order to put components into the right place.
@@ -4029,13 +4048,15 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
       return _slang_gen_while(A, oper);
    case SLANG_OPER_BREAK:
       if (!A->CurLoop) {
-         slang_info_log_error(A->log, "'break' not in loop");
+         if (!A->UnrollLoop)
+            slang_info_log_error(A->log, "'break' not in loop");
          return NULL;
       }
       return new_break(A->CurLoop);
    case SLANG_OPER_CONTINUE:
       if (!A->CurLoop) {
-         slang_info_log_error(A->log, "'continue' not in loop");
+         if (!A->UnrollLoop)
+            slang_info_log_error(A->log, "'continue' not in loop");
          return NULL;
       }
       return _slang_gen_continue(A, oper);
@@ -4333,13 +4354,25 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
       if (prog) {
          /* user-defined uniform */
          if (datatype == GL_NONE) {
-            if (var->type.specifier.type == SLANG_SPEC_STRUCT) {
+           if ((var->type.specifier.type == SLANG_SPEC_ARRAY &&
+                var->type.specifier._array->type == SLANG_SPEC_STRUCT) ||
+                (var->type.specifier.type == SLANG_SPEC_STRUCT)) {
                /* temporary work-around */
                GLenum datatype = GL_FLOAT;
                GLint uniformLoc = _mesa_add_uniform(prog->Parameters, varName,
                                                     totalSize, datatype, NULL);
                store = _slang_new_ir_storage_swz(PROGRAM_UNIFORM, uniformLoc,
                                                  totalSize, swizzle);
+        
+              if (arrayLen > 0) {
+                 GLint a = arrayLen - 1;
+                 GLint i;
+                 for (i = 0; i < a; i++) {
+                     GLfloat value = (GLfloat)(i + uniformLoc + 1);
+                     (void) _mesa_add_parameter(prog->Parameters, PROGRAM_UNIFORM,
+                                 varName, 1, datatype, &value, NULL, 0x0);
+                  }
+              }
 
                /* XXX what we need to do is unroll the struct into its
                 * basic types, creating a uniform variable for each.
index f2daa034e4fb36501d01a24230f9a73183b8b84e..e812c1f7ea595bd0d601d74f4a9c3824d46462da 100644 (file)
@@ -42,6 +42,7 @@ typedef struct slang_assemble_ctx_
    struct slang_label_ *curFuncEndLabel;
    struct slang_ir_node_ *CurLoop;
    struct slang_function_ *CurFunction;
+   GLuint UnrollLoop;
 } slang_assemble_ctx;
 
 
index cfed977905a99f31f6f7f9995369130e6e057981..fb7128841c4441f8c1b973aaeaf6b516c96d1386 100644 (file)
@@ -32,6 +32,7 @@
 #include "main/context.h"
 #include "shader/program.h"
 #include "shader/programopt.h"
+#include "shader/prog_optimize.h"
 #include "shader/prog_print.h"
 #include "shader/prog_parameter.h"
 #include "shader/grammar/grammar_mesa.h"
@@ -1450,7 +1451,7 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
       case OP_CALL:
          {
             GLboolean array_constructor = GL_FALSE;
-            GLint array_constructor_size;
+            GLint array_constructor_size = 0;
 
             op->type = SLANG_OPER_CALL;
             op->a_id = parse_identifier(C);
@@ -2055,6 +2056,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
    /* emit code for global var decl */
    if (C->global_scope) {
       slang_assemble_ctx A;
+      memset(&A, 0, sizeof(slang_assemble_ctx));
       A.atoms = C->atoms;
       A.space.funcs = O->funs;
       A.space.structs = O->structs;
@@ -2072,7 +2074,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
    if (C->global_scope) {
       if (var->initializer != NULL) {
          slang_assemble_ctx A;
-
+         memset(&A, 0, sizeof(slang_assemble_ctx));
          A.atoms = C->atoms;
          A.space.funcs = O->funs;
          A.space.structs = O->structs;
@@ -2414,7 +2416,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
    if (mainFunc) {
       /* assemble (generate code) for main() */
       slang_assemble_ctx A;
-
+      memset(&A, 0, sizeof(slang_assemble_ctx));
       A.atoms = C->atoms;
       A.space.funcs = o.funs;
       A.space.structs = o.structs;
@@ -2796,6 +2798,12 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
 
    shader->CompileStatus = success;
 
+   if (success) {
+      if (shader->Pragmas.Optimize) {
+         _mesa_optimize_program(ctx, shader->Program);
+      }
+   }
+
    if (ctx->Shader.Flags & GLSL_LOG) {
       _mesa_write_shader_to_file(shader);
    }
index 2dd122c9a54ad514567fc42df0eee73515a5fa39..1b1edb44609673ee3e355acf2ba441427f50aaf6 100644 (file)
@@ -164,7 +164,7 @@ _slang_var_swizzle(GLint size, GLint comp)
 {
    switch (size) {
    case 1:
-      return MAKE_SWIZZLE4(comp, comp, comp, comp);
+      return MAKE_SWIZZLE4(comp, SWIZZLE_NIL, SWIZZLE_NIL, SWIZZLE_NIL);
    case 2:
       return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_NIL, SWIZZLE_NIL);
    case 3:
@@ -446,12 +446,12 @@ new_instruction(slang_emit_info *emitInfo, gl_inst_opcode opcode)
 
 static struct prog_instruction *
 emit_arl_load(slang_emit_info *emitInfo,
-              enum register_file file, GLint index, GLuint swizzle)
+              gl_register_file file, GLint index, GLuint swizzle)
 {
    struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ARL);
    inst->SrcReg[0].File = file;
    inst->SrcReg[0].Index = index;
-   inst->SrcReg[0].Swizzle = swizzle;
+   inst->SrcReg[0].Swizzle = fix_swizzle(swizzle);
    inst->DstReg.File = PROGRAM_ADDRESS;
    inst->DstReg.Index = 0;
    inst->DstReg.WriteMask = WRITEMASK_X;
@@ -873,6 +873,7 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
 
    if (n->Children[0]->Store->Size != n->Children[1]->Store->Size) {
       slang_info_log_error(emitInfo->log, "invalid operands to == or !=");
+      n->Store = NULL;
       return NULL;
    }
 
@@ -902,6 +903,7 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
       slang_ir_storage tempStore;
 
       if (!alloc_local_temp(emitInfo, &tempStore, 4)) {
+         n->Store = NULL;
          return NULL;
          /* out of temps */
       }
@@ -1259,16 +1261,33 @@ emit_tex(slang_emit_info *emitInfo, slang_ir_node *n)
 {
    struct prog_instruction *inst;
    gl_inst_opcode opcode;
+   GLboolean shadow = GL_FALSE;
 
-   if (n->Opcode == IR_TEX) {
+   switch (n->Opcode) {
+   case IR_TEX:
       opcode = OPCODE_TEX;
-   }
-   else if (n->Opcode == IR_TEXB) {
+      break;
+   case IR_TEX_SH:
+      opcode = OPCODE_TEX;
+      shadow = GL_TRUE;
+      break;
+   case IR_TEXB:
       opcode = OPCODE_TXB;
-   }
-   else {
-      assert(n->Opcode == IR_TEXP);
+      break;
+   case IR_TEXB_SH:
+      opcode = OPCODE_TXB;
+      shadow = GL_TRUE;
+      break;
+   case IR_TEXP:
       opcode = OPCODE_TXP;
+      break;
+   case IR_TEXP_SH:
+      opcode = OPCODE_TXP;
+      shadow = GL_TRUE;
+      break;
+   default:
+      _mesa_problem(NULL, "Bad IR TEX code");
+      return NULL;
    }
 
    if (n->Children[0]->Opcode == IR_ELEMENT) {
@@ -1300,6 +1319,8 @@ emit_tex(slang_emit_info *emitInfo, slang_ir_node *n)
                            NULL,
                            NULL);
 
+   inst->TexShadow = shadow;
+
    /* Store->Index is the uniform/sampler index */
    assert(n->Children[0]->Store->Index >= 0);
    inst->TexSrcUnit = n->Children[0]->Store->Index;
@@ -1358,6 +1379,7 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n)
 
 #if PEEPHOLE_OPTIMIZATIONS
    if (inst &&
+       (n->Children[1]->Opcode != IR_SWIZZLE) &&
        _slang_is_temp(emitInfo->vt, n->Children[1]->Store) &&
        (inst->DstReg.File == n->Children[1]->Store->File) &&
        (inst->DstReg.Index == n->Children[1]->Store->Index) &&
@@ -1374,13 +1396,9 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n)
        * becomes:
        *   MUL a, x, y;
        */
-      if (n->Children[1]->Opcode != IR_SWIZZLE)
-         _slang_free_temp(emitInfo->vt, n->Children[1]->Store);
-      *n->Children[1]->Store = *n->Children[0]->Store;
 
       /* fixup the previous instruction (which stored the RHS result) */
       assert(n->Children[0]->Store->Index >= 0);
-
       storage_to_dst_reg(&inst->DstReg, n->Children[0]->Store);
       return inst;
    }
@@ -1813,6 +1831,25 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n)
 }
 
 
+/**
+ * Return the size of a swizzle mask given that some swizzle components
+ * may be NIL/undefined.  For example:
+ *  swizzle_size(".zzxx") = 4
+ *  swizzle_size(".xy??") = 2
+ *  swizzle_size(".w???") = 1
+ */
+static GLuint
+swizzle_size(GLuint swizzle)
+{
+   GLuint i;
+   for (i = 0; i < 4; i++) {
+      if (GET_SWZ(swizzle, i) == SWIZZLE_NIL)
+         return i;
+   }
+   return 4;
+}
+
+
 static struct prog_instruction *
 emit_swizzle(slang_emit_info *emitInfo, slang_ir_node *n)
 {
@@ -1820,14 +1857,25 @@ emit_swizzle(slang_emit_info *emitInfo, slang_ir_node *n)
 
    inst = emit(emitInfo, n->Children[0]);
 
-#if 0
-   assert(n->Store->Parent);
-   /* Apply this node's swizzle to parent's storage */
-   GLuint swizzle = n->Store->Swizzle;
-   _slang_copy_ir_storage(n->Store, n->Store->Parent);
-   n->Store->Swizzle = _slang_swizzle_swizzle(n->Store->Swizzle, swizzle);
+   if (!n->Store->Parent) {
+      /* this covers a case such as "(b ? p : q).x" */
+      n->Store->Parent = n->Children[0]->Store;
+      assert(n->Store->Parent);
+   }
+
+   {
+      const GLuint swizzle = n->Store->Swizzle;
+      /* new storage is parent storage with updated Swizzle + Size fields */
+      _slang_copy_ir_storage(n->Store, n->Store->Parent);
+      /* Apply this node's swizzle to parent's storage */
+      n->Store->Swizzle = _slang_swizzle_swizzle(n->Store->Swizzle, swizzle);
+      /* Update size */
+      n->Store->Size = swizzle_size(n->Store->Swizzle);
+   }
+
    assert(!n->Store->Parent);
-#endif
+   assert(n->Store->Index >= 0);
+
    return inst;
 }
 
@@ -2146,6 +2194,12 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
       return NULL;
    }
 
+   if (n->Comment) {
+      inst = new_instruction(emitInfo, OPCODE_NOP);
+      inst->Comment = _mesa_strdup(n->Comment);
+      inst = NULL;
+   }
+
    switch (n->Opcode) {
    case IR_SEQ:
       /* sequence of two sub-trees */
@@ -2239,6 +2293,9 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
    case IR_TEX:
    case IR_TEXB:
    case IR_TEXP:
+   case IR_TEX_SH:
+   case IR_TEXB_SH:
+   case IR_TEXP_SH:
       return emit_tex(emitInfo, n);
    case IR_NEG:
       return emit_negation(emitInfo, n);
@@ -2428,7 +2485,9 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt,
       maxUniforms = ctx->Const.VertexProgram.MaxUniformComponents / 4;
    }
    if (prog->Parameters->NumParameters > maxUniforms) {
-      slang_info_log_error(log, "Constant/uniform register limit exceeded");
+      slang_info_log_error(log, "Constant/uniform register limit exceeded "
+                           "(max=%u vec4)", maxUniforms);
+
       return GL_FALSE;
    }
 
index e4c6e0ea51670154be12b490f0496ba94c2d5915..1c7f7474e715cf7d773371e3776021f0d5e80b77 100644 (file)
@@ -94,6 +94,9 @@ static const slang_ir_info IrInfo[] = {
    { IR_TEX, "IR_TEX", OPCODE_TEX, 4, 1 },
    { IR_TEXB, "IR_TEXB", OPCODE_TXB, 4, 1 },
    { IR_TEXP, "IR_TEXP", OPCODE_TXP, 4, 1 },
+   { IR_TEX_SH, "IR_TEX_SH", OPCODE_TEX, 4, 1 },
+   { IR_TEXB_SH, "IR_TEXB_SH", OPCODE_TXB, 4, 1 },
+   { IR_TEXP_SH, "IR_TEXP_SH", OPCODE_TXP, 4, 1 },
    { IR_FLOAT, "IR_FLOAT", OPCODE_NOP, 0, 0 }, /* float literal */
    { IR_FIELD, "IR_FIELD", OPCODE_NOP, 0, 0 },
    { IR_ELEMENT, "IR_ELEMENT", OPCODE_NOP, 0, 0 },
@@ -118,7 +121,7 @@ _slang_ir_info(slang_ir_opcode opcode)
 
 void
 _slang_init_ir_storage(slang_ir_storage *st,
-                       enum register_file file, GLint index, GLint size,
+                       gl_register_file file, GLint index, GLint size,
                        GLuint swizzle)
 {
    st->File = file;
@@ -134,7 +137,7 @@ _slang_init_ir_storage(slang_ir_storage *st,
  * Return a new slang_ir_storage object.
  */
 slang_ir_storage *
-_slang_new_ir_storage(enum register_file file, GLint index, GLint size)
+_slang_new_ir_storage(gl_register_file file, GLint index, GLint size)
 {
    slang_ir_storage *st;
    st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage));
@@ -154,7 +157,7 @@ _slang_new_ir_storage(enum register_file file, GLint index, GLint size)
  * Return a new slang_ir_storage object.
  */
 slang_ir_storage *
-_slang_new_ir_storage_swz(enum register_file file, GLint index, GLint size,
+_slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size,
                           GLuint swizzle)
 {
    slang_ir_storage *st;
@@ -193,10 +196,10 @@ _slang_new_ir_storage_relative(GLint index, GLint size,
 
 
 slang_ir_storage *
-_slang_new_ir_storage_indirect(enum register_file file,
+_slang_new_ir_storage_indirect(gl_register_file file,
                                GLint index,
                                GLint size,
-                               enum register_file indirectFile,
+                               gl_register_file indirectFile,
                                GLint indirectIndex,
                                GLuint indirectSwizzle)
 {
index 644269d491c711731d8d0fe2b73c6030743dd2af..e796693ed58a67fcd2769c3b3b1c49a466cb24db 100644 (file)
@@ -131,6 +131,10 @@ typedef enum
    IR_TEXB,    /* texture lookup with LOD bias */
    IR_TEXP,    /* texture lookup with projection */
 
+   IR_TEX_SH,     /* texture lookup, shadow compare */
+   IR_TEXB_SH,    /* texture lookup with LOD bias, shadow compare */
+   IR_TEXP_SH,    /* texture lookup with projection, shadow compare */
+
    IR_FLOAT,
    IR_I_TO_F,  /* int[4] to float[4] conversion */
    IR_F_TO_I,  /* float[4] to int[4] conversion */
@@ -167,7 +171,7 @@ typedef enum
  */
 struct slang_ir_storage_
 {
-   enum register_file File;  /**< PROGRAM_TEMPORARY, PROGRAM_INPUT, etc */
+   gl_register_file File;  /**< PROGRAM_TEMPORARY, PROGRAM_INPUT, etc */
    GLint Index;    /**< -1 means unallocated */
    GLint Size;     /**< number of floats or ints */
    GLuint Swizzle; /**< Swizzle AND writemask info */
@@ -176,7 +180,7 @@ struct slang_ir_storage_
    GLboolean RelAddr; /* we'll remove this eventually */
 
    GLboolean IsIndirect;
-   enum register_file IndirectFile;
+   gl_register_file IndirectFile;
    GLint IndirectIndex;
    GLuint IndirectSwizzle;
    GLuint TexTarget;  /**< If File==PROGRAM_SAMPLER, one of TEXTURE_x_INDEX */
@@ -208,6 +212,7 @@ typedef struct slang_ir_node_
    struct slang_ir_node_ *List;  /**< For various linked lists */
    struct slang_ir_node_ *Parent;  /**< Pointer to logical parent (ie. loop) */
    slang_label *Label;  /**< Used for branches */
+   const char *Comment; /**< If Opcode == IR_COMMENT */
 } slang_ir_node;
 
 
@@ -231,15 +236,15 @@ _slang_ir_info(slang_ir_opcode opcode);
 
 extern void
 _slang_init_ir_storage(slang_ir_storage *st,
-                       enum register_file file, GLint index, GLint size,
+                       gl_register_file file, GLint index, GLint size,
                        GLuint swizzle);
 
 extern slang_ir_storage *
-_slang_new_ir_storage(enum register_file file, GLint index, GLint size);
+_slang_new_ir_storage(gl_register_file file, GLint index, GLint size);
 
 
 extern slang_ir_storage *
-_slang_new_ir_storage_swz(enum register_file file, GLint index, GLint size,
+_slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size,
                           GLuint swizzle);
 
 extern slang_ir_storage *
@@ -248,10 +253,10 @@ _slang_new_ir_storage_relative(GLint index, GLint size,
 
 
 extern slang_ir_storage *
-_slang_new_ir_storage_indirect(enum register_file file,
+_slang_new_ir_storage_indirect(gl_register_file file,
                                GLint index,
                                GLint size,
-                               enum register_file indirectFile,
+                               gl_register_file indirectFile,
                                GLint indirectIndex,
                                GLuint indirectSwizzle);
 
index 99f2cbdcc0576184cee37a2e588d70c2a74afa17..f98434892b64acc1ddce23caf27990104c1da2c5 100644 (file)
@@ -295,6 +295,9 @@ link_uniform_vars(GLcontext *ctx,
             inst->TexSrcUnit = newSampNum;
             prog->SamplerTargets[newSampNum] = inst->TexSrcTarget;
             prog->SamplersUsed |= (1 << newSampNum);
+            if (inst->TexShadow) {
+               prog->ShadowSamplers |= (1 << newSampNum);
+            }
          }
       }
    }
@@ -495,8 +498,33 @@ _slang_update_inputs_outputs(struct gl_program *prog)
             maxAddrReg = MAX2(maxAddrReg, (GLuint) (inst->SrcReg[j].Index + 1));
          }
       }
+
       if (inst->DstReg.File == PROGRAM_OUTPUT) {
          prog->OutputsWritten |= 1 << inst->DstReg.Index;
+         if (inst->DstReg.RelAddr) {
+            /* If the output attribute is indexed with relative addressing
+             * we know that it must be a varying or texcoord such as
+             * gl_TexCoord[i] = v;  In this case, mark all the texcoords
+             * or varying outputs as being written.  It's not an error if
+             * a vertex shader writes varying vars that aren't used by the
+             * fragment shader.  But it is an error for a fragment shader
+             * to use varyings that are not written by the vertex shader.
+             */
+            if (prog->Target == GL_VERTEX_PROGRAM_ARB) {
+               if (inst->DstReg.Index == VERT_RESULT_TEX0) {
+                  /* mark all texcoord outputs as written */
+                  const GLbitfield mask =
+                     ((1 << MAX_TEXTURE_COORD_UNITS) - 1) << VERT_RESULT_TEX0;
+                  prog->OutputsWritten |= mask;
+               }
+               else if (inst->DstReg.Index == VERT_RESULT_VAR0) {
+                  /* mark all generic varying outputs as written */
+                  const GLbitfield mask =
+                     ((1 << MAX_VARYING) - 1) << VERT_RESULT_VAR0;
+                  prog->OutputsWritten |= mask;
+               }
+            }
+         }
       }
       else if (inst->DstReg.File == PROGRAM_ADDRESS) {
          maxAddrReg = MAX2(maxAddrReg, inst->DstReg.Index + 1);
@@ -658,7 +686,7 @@ _slang_link(GLcontext *ctx,
    /* check that gl_FragColor and gl_FragData are not both written to */
    if (shProg->FragmentProgram) {
       GLbitfield outputsWritten = shProg->FragmentProgram->Base.OutputsWritten;
-      if ((outputsWritten & ((1 << FRAG_RESULT_COLR))) &&
+      if ((outputsWritten & ((1 << FRAG_RESULT_COLOR))) &&
           (outputsWritten >= (1 << FRAG_RESULT_DATA0))) {
          link_error(shProg, "Fragment program cannot write both gl_FragColor"
                     " and gl_FragData[].\n");
index 89aaa3a6213d642eee0a1ec34894a1c51269fd1f..ff913ad8838ddaa756eb4cb31bf360c8b143184c 100644 (file)
@@ -530,14 +530,6 @@ pp_ext_set(pp_ext *self, const char *name, GLboolean enable)
 }
 
 
-static void
-pp_pragmas_init(struct gl_sl_pragmas *pragmas)
-{
-   pragmas->Optimize = GL_TRUE;
-   pragmas->Debug = GL_FALSE;
-}
-
-
 /**
  * Called in response to #pragma.  For example, "#pragma debug(on)" would
  * call this function as pp_pragma("debug", "on").
@@ -553,10 +545,12 @@ pp_pragma(struct gl_sl_pragmas *pragmas, const char *pragma, const char *param)
       if (!param)
          return GL_FALSE; /* missing required param */
       if (_mesa_strcmp(param, "on") == 0) {
-         pragmas->Optimize = GL_TRUE;
+         if (!pragmas->IgnoreOptimize)
+            pragmas->Optimize = GL_TRUE;
       }
       else if (_mesa_strcmp(param, "off") == 0) {
-         pragmas->Optimize = GL_FALSE;
+         if (!pragmas->IgnoreOptimize)
+            pragmas->Optimize = GL_FALSE;
       }
       else {
          return GL_FALSE; /* invalid param */
@@ -566,10 +560,12 @@ pp_pragma(struct gl_sl_pragmas *pragmas, const char *pragma, const char *param)
       if (!param)
          return GL_FALSE; /* missing required param */
       if (_mesa_strcmp(param, "on") == 0) {
-         pragmas->Debug = GL_TRUE;
+         if (!pragmas->IgnoreDebug)
+            pragmas->Debug = GL_TRUE;
       }
       else if (_mesa_strcmp(param, "off") == 0) {
-         pragmas->Debug = GL_FALSE;
+         if (!pragmas->IgnoreDebug)
+            pragmas->Debug = GL_FALSE;
       }
       else {
          return GL_FALSE; /* invalid param */
@@ -945,7 +941,6 @@ preprocess_source (slang_string *output, const char *source,
    }
 
    pp_state_init (&state, elog, extensions);
-   pp_pragmas_init (pragmas);
 
    /* add the predefined symbols to the symbol table */
    for (i = 0; predefined[i]; i++) {
@@ -1296,6 +1291,8 @@ error:
  * \param output  the post-process results
  * \param input  the input text
  * \param elog  log to record warnings, errors
+ * \param extensions  out extension settings
+ * \param pragmas  in/out #pragma settings
  * \return GL_TRUE for success, GL_FALSE for error
  */
 GLboolean
index 1bd81506e0108349eaaa557cb1999ae38b54b2aa..6913d9f40fd351903a0114504f8339e53b7e1466 100644 (file)
@@ -17,6 +17,7 @@ MAIN_SOURCES = \
        main/colortab.c \
        main/context.c \
        main/convolve.c \
+       main/cpuinfo.c \
        main/debug.c \
        main/depth.c \
        main/depthstencil.c \
@@ -57,6 +58,7 @@ MAIN_SOURCES = \
        main/renderbuffer.c \
        main/scissor.c \
        main/shaders.c \
+       main/shared.c \
        main/state.c \
        main/stencil.c \
        main/texcompress.c \
@@ -73,6 +75,7 @@ MAIN_SOURCES = \
        main/texstate.c \
        main/texstore.c \
        main/varray.c \
+       main/viewport.c \
        main/vtxfmt.c
 
 GLAPI_SOURCES = \
@@ -91,7 +94,6 @@ MATH_SOURCES = \
        math/m_vector.c
 
 MATH_XFORM_SOURCES = \
-       $(MATH_SOURCES) \
        math/m_xform.c
 
 SWRAST_SOURCES = \
@@ -103,7 +105,7 @@ SWRAST_SOURCES = \
        swrast/s_bitmap.c \
        swrast/s_blend.c \
        swrast/s_blit.c \
-       swrast/s_buffers.c \
+       swrast/s_clear.c \
        swrast/s_copypix.c \
        swrast/s_context.c \
        swrast/s_depth.c \
@@ -165,11 +167,6 @@ VBO_SOURCES = \
        vbo/vbo_save_draw.c \
        vbo/vbo_save_loopback.c 
 
-VF_SOURCES = \
-       vf/vf.c \
-       vf/vf_generic.c \
-       vf/vf_sse.c
-
 STATETRACKER_SOURCES = \
        state_tracker/st_atom.c \
        state_tracker/st_atom_blend.c \
@@ -201,6 +198,7 @@ STATETRACKER_SOURCES = \
        state_tracker/st_cb_readpixels.c \
        state_tracker/st_cb_strings.c \
        state_tracker/st_cb_texture.c \
+       state_tracker/st_cb_viewport.c \
        state_tracker/st_api.c \
        state_tracker/st_context.c \
        state_tracker/st_debug.c \
@@ -224,10 +222,10 @@ SHADER_SOURCES = \
        shader/nvvertparse.c \
        shader/program.c \
        shader/prog_cache.c \
-       shader/prog_debug.c \
        shader/prog_execute.c \
        shader/prog_instruction.c \
        shader/prog_noise.c \
+       shader/prog_optimize.c \
        shader/prog_parameter.c \
        shader/prog_print.c \
        shader/prog_statevars.c \
@@ -259,7 +257,7 @@ SLANG_SOURCES =     \
 
 ASM_C_SOURCES =        \
        x86/common_x86.c \
-       x86/x86.c \
+       x86/x86_xform.c \
        x86/3dnow.c \
        x86/sse.c \
        x86/rtasm/x86sse.c \
@@ -307,11 +305,10 @@ COMMON_DRIVER_SOURCES =                   \
        drivers/common/driverfuncs.c
 
 
-
-### All the core C sources
-
+# Sources for building non-Gallium drivers
 MESA_SOURCES = \
        $(MAIN_SOURCES)         \
+       $(MATH_SOURCES)         \
        $(MATH_XFORM_SOURCES)   \
        $(VBO_SOURCES)          \
        $(TNL_SOURCES)          \
@@ -322,19 +319,23 @@ MESA_SOURCES = \
        $(ASM_C_SOURCES)        \
        $(SLANG_SOURCES)
 
-ALL_SOURCES = \
-       $(MESA_SOURCES)         \
-       $(GLAPI_SOURCES)        \
-       $(MESA_ASM_SOURCES)
-
+# Sources for building Gallium drivers
 MESA_GALLIUM_SOURCES = \
        $(MAIN_SOURCES)         \
        $(MATH_SOURCES)         \
        $(VBO_SOURCES)          \
        $(STATETRACKER_SOURCES) \
        $(SHADER_SOURCES)       \
+       x86/common_x86.c        \
        $(SLANG_SOURCES)
 
+# All the core C sources, for dependency checking
+ALL_SOURCES = \
+       $(MESA_SOURCES)         \
+       $(GLAPI_SOURCES)        \
+       $(MESA_ASM_SOURCES)     \
+       $(STATETRACKER_SOURCES)
+
 
 ### Object files
 
index 58c228ed15175c50678be3e00b8345fcdaf563cb..208843c606905ce3b8685c9062170e8e595256ce 100644 (file)
 #define VEC_SIZE_3     7
 #define VEC_SIZE_4     15
 
-#if defined(SVR4) || defined(__SVR4) || defined(__svr4__)
-        /* Solaris requires this for 64-bit. */
         .register %g2, #scratch
         .register %g3, #scratch
-        .register %g7, #scratch
-#endif
 
        .text
        .align          64
@@ -78,7 +74,7 @@ _mesa_sparc_cliptest_points4:
        add             %g1, 0x4, %g1
 
        ld              [%i0 + V4F_STRIDE], %l1
-       ld              [%i0 + V4F_COUNT], %g7
+       ld              [%i0 + V4F_COUNT], %l3
        LDPTR           [%i0 + V4F_START], %i0
        LDPTR           [%i1 + V4F_START], %i5
        ldub            [%i3], %g2
@@ -91,12 +87,12 @@ _mesa_sparc_cliptest_points4:
        st              %g3, [%i1 + V4F_FLAGS]
        mov             3, %g3
        st              %g3, [%i1 + V4F_SIZE]
-       st              %g7, [%i1 + V4F_COUNT]
+       st              %l3, [%i1 + V4F_COUNT]
        clr             %l2
        clr             %l0
 
        /* l0:  i
-        * g7:  count
+        * l3:  count
         * l1:  stride
         * l2:  c
         * g2:  (tmpAndMask << 8) | tmpOrMask
@@ -153,12 +149,12 @@ _mesa_sparc_cliptest_points4:
 3:     add             %i5, 0x10, %i5          ! IEU1
        add             %l0, 1, %l0             ! IEU0  Group
        add             %i2, 1, %i2             ! IEU0  Group
-       cmp             %l0, %g7                ! IEU1  Group
+       cmp             %l0, %l3                ! IEU1  Group
        bne             1b                      ! CTI
         add            %i0, %l1, %i0           ! IEU0  Group
        stb             %g2, [%i3]              ! LSU
        srl             %g2, 8, %g3             ! IEU0  Group
-       cmp             %l2, %g7                ! IEU1  Group
+       cmp             %l2, %l3                ! IEU1  Group
        bl,a            1f                      ! CTI
         clr            %g3                     ! IEU0
 1:     stb             %g3, [%i4]              ! LSU   Group
@@ -174,25 +170,18 @@ _mesa_sparc_cliptest_points4_np:
        add             %g1, 0x4, %g1
 
        ld              [%i0 + V4F_STRIDE], %l1
-       ld              [%i0 + V4F_COUNT], %g7
+       ld              [%i0 + V4F_COUNT], %l3
        LDPTR           [%i0 + V4F_START], %i0
-       LDPTR           [%i1 + V4F_START], %i5
        ldub            [%i3], %g2
        ldub            [%i4], %g3
        sll             %g3, 8, %g3
        or              %g2, %g3, %g2
 
-       ld              [%i1 + V4F_FLAGS], %g3
-       or              %g3, VEC_SIZE_4, %g3
-       st              %g3, [%i1 + V4F_FLAGS]
-       mov             3, %g3
-       st              %g3, [%i1 + V4F_SIZE]
-       st              %g7, [%i1 + V4F_COUNT]
        clr             %l2
        clr             %l0
 
        /* l0:  i
-        * g7:  count
+        * l3:  count
         * l1:  stride
         * l2:  c
         * g2:  (tmpAndMask << 8) | tmpOrMask
@@ -230,12 +219,12 @@ _mesa_sparc_cliptest_points4_np:
        and             %g2, %g4, %g2           ! IEU0  Group
 2:     add             %l0, 1, %l0             ! IEU0  Group
        add             %i2, 1, %i2             ! IEU0  Group
-       cmp             %l0, %g7                ! IEU1  Group
+       cmp             %l0, %l3                ! IEU1  Group
        bne             1b                      ! CTI
         add            %i0, %l1, %i0           ! IEU0  Group
        stb             %g2, [%i3]              ! LSU
        srl             %g2, 8, %g3             ! IEU0  Group
-       cmp             %l2, %g7                ! IEU1  Group
+       cmp             %l2, %l3                ! IEU1  Group
        bl,a            1f                      ! CTI
         clr            %g3                     ! IEU0
 1:     stb             %g3, [%i4]              ! LSU   Group
index 7d215939b402827dcd26ade224180c85ce8631a0..493e094cde5ce9818ac80534d2e365411b23665e 100644 (file)
  * SOFTWARE.
  */
 
-#include "glapioffsets.h"
+#include "glapi/glapioffsets.h"
 
 #ifdef __arch64__
-#  define GL_STUB(fn,off)                              \
-fn:                                    \
-       sethi   %hi(0xDEADBEEF), %g4 ;                  \
-       sethi   %hi(0xDEADBEEF), %g1 ;                  \
-       or      %g4, %lo(0xDEADBEEF), %g4 ;             \
-       or      %g1, %lo(0xDEADBEEF), %g1 ;             \
-       sllx    %g4, 32, %g4 ;                          \
-       ldx     [%g1 + %g4], %g1 ;                      \
-       sethi   %hi(8 * off), %g4 ;                     \
-       or      %g4, %lo(8 * off), %g4 ;                \
-       ldx     [%g1 + %g4], %g5 ;                      \
-       jmpl    %g5, %g0 ;                              \
-       nop
+#define GL_OFF(N)      ((N) * 8)
+#define GL_LL          ldx
+#define GL_TIE_LD(SYM) %tie_ldx(SYM)
+#define GL_STACK_SIZE  128
 #else
-#  define GL_STUB(fn,off)                              \
-fn:                                    \
-       sethi   %hi(0xDEADBEEF), %g1 ;                  \
-       ld      [%g1 + %lo(0xDEADBEEF)], %g1 ;          \
-       ld      [%g1 + (4 * off)], %g5 ;                \
-       jmpl    %g5, %g0 ;                              \
-       nop
+#define GL_OFF(N)      ((N) * 4)
+#define GL_LL          ld
+#define GL_TIE_LD(SYM) %tie_ld(SYM)
+#define GL_STACK_SIZE  64
 #endif
 
-#define GL_STUB_ALIAS(fn,alias) fn = alias
+#define GLOBL_FN(x) .globl x ; .type x, @function
+#define HIDDEN(x) .hidden x
 
-.text
-.align 32
-               .globl __glapi_sparc_icache_flush ; .type __glapi_sparc_icache_flush,#function
+       .register %g2, #scratch
+       .register %g3, #scratch
+
+       .text
+
+       GLOBL_FN(__glapi_sparc_icache_flush)
+       HIDDEN(__glapi_sparc_icache_flush)
+       .type   __glapi_sparc_icache_flush, @function
 __glapi_sparc_icache_flush: /* %o0 = insn_addr */
        flush   %o0
        retl
-       nop
+        nop
+
+       .align  32
+
+       .type   __glapi_sparc_get_pc, @function
+__glapi_sparc_get_pc:
+       retl
+        add    %o7, %g2, %g2
+       .size   __glapi_sparc_get_pc, .-__glapi_sparc_get_pc
+
+#ifdef GLX_USE_TLS
+
+       GLOBL_FN(__glapi_sparc_get_dispatch)
+       HIDDEN(__glapi_sparc_get_dispatch)
+__glapi_sparc_get_dispatch:
+       mov     %o7, %g1
+       sethi   %hi(_GLOBAL_OFFSET_TABLE_-4), %g2
+       call    __glapi_sparc_get_pc
+       add     %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2
+       mov     %g1, %o7
+       sethi   %tie_hi22(_glapi_tls_Dispatch), %g1
+       add     %g1, %tie_lo10(_glapi_tls_Dispatch), %g1
+       GL_LL   [%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)
+       retl
+        mov    %g2, %o0
+
+       .data
+       .align  32
+
+       /* --> sethi %hi(_glapi_tls_Dispatch), %g1 */
+       /* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */
+       GLOBL_FN(__glapi_sparc_tls_stub)
+       HIDDEN(__glapi_sparc_tls_stub)
+__glapi_sparc_tls_stub: /* Call offset in %g3 */
+       mov     %o7, %g1
+       sethi   %hi(_GLOBAL_OFFSET_TABLE_-4), %g2
+       call    __glapi_sparc_get_pc
+       add     %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2
+       mov     %g1, %o7
+       srl     %g3, 10, %g3
+       sethi   %tie_hi22(_glapi_tls_Dispatch), %g1
+       add     %g1, %tie_lo10(_glapi_tls_Dispatch), %g1
+       GL_LL   [%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)
+       GL_LL   [%g7+%g2], %g1
+       GL_LL   [%g1 + %g3], %g1
+       jmp     %g1
+        nop
+       .size   __glapi_sparc_tls_stub, .-__glapi_sparc_tls_stub
+
+#define GL_STUB(fn, off)                               \
+       GLOBL_FN(fn);                                   \
+fn:    ba      __glapi_sparc_tls_stub;                 \
+        sethi  GL_OFF(off), %g3;                       \
+       .size   fn,.-fn;
+
+#elif defined(PTHREADS)
+
+       /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */
+       /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */
+       /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */
+       /* 64-bit 0x0c --> sllx %g1, 32, %g1 */
+       /* 64-bit 0x10 --> add %g1, %g2, %g1 */
+       /* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */
 
-.data
-.align 64
+       /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */
+       /* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */
 
-               .globl glNewList ; .type glNewList,#function
-               .globl glEndList ; .type glEndList,#function
-               .globl glCallList ; .type glCallList,#function
-               .globl glCallLists ; .type glCallLists,#function
-               .globl glDeleteLists ; .type glDeleteLists,#function
-               .globl glGenLists ; .type glGenLists,#function
-               .globl glListBase ; .type glListBase,#function
-               .globl glBegin ; .type glBegin,#function
-               .globl glBitmap ; .type glBitmap,#function
-               .globl glColor3b ; .type glColor3b,#function
-               .globl glColor3bv ; .type glColor3bv,#function
-               .globl glColor3d ; .type glColor3d,#function
-               .globl glColor3dv ; .type glColor3dv,#function
-               .globl glColor3f ; .type glColor3f,#function
-               .globl glColor3fv ; .type glColor3fv,#function
-               .globl glColor3i ; .type glColor3i,#function
-               .globl glColor3iv ; .type glColor3iv,#function
-               .globl glColor3s ; .type glColor3s,#function
-               .globl glColor3sv ; .type glColor3sv,#function
-               .globl glColor3ub ; .type glColor3ub,#function
-               .globl glColor3ubv ; .type glColor3ubv,#function
-               .globl glColor3ui ; .type glColor3ui,#function
-               .globl glColor3uiv ; .type glColor3uiv,#function
-               .globl glColor3us ; .type glColor3us,#function
-               .globl glColor3usv ; .type glColor3usv,#function
-               .globl glColor4b ; .type glColor4b,#function
-               .globl glColor4bv ; .type glColor4bv,#function
-               .globl glColor4d ; .type glColor4d,#function
-               .globl glColor4dv ; .type glColor4dv,#function
-               .globl glColor4f ; .type glColor4f,#function
-               .globl glColor4fv ; .type glColor4fv,#function
-               .globl glColor4i ; .type glColor4i,#function
-               .globl glColor4iv ; .type glColor4iv,#function
-               .globl glColor4s ; .type glColor4s,#function
-               .globl glColor4sv ; .type glColor4sv,#function
-               .globl glColor4ub ; .type glColor4ub,#function
-               .globl glColor4ubv ; .type glColor4ubv,#function
-               .globl glColor4ui ; .type glColor4ui,#function
-               .globl glColor4uiv ; .type glColor4uiv,#function
-               .globl glColor4us ; .type glColor4us,#function
-               .globl glColor4usv ; .type glColor4usv,#function
-               .globl glEdgeFlag ; .type glEdgeFlag,#function
-               .globl glEdgeFlagv ; .type glEdgeFlagv,#function
-               .globl glEnd ; .type glEnd,#function
-               .globl glIndexd ; .type glIndexd,#function
-               .globl glIndexdv ; .type glIndexdv,#function
-               .globl glIndexf ; .type glIndexf,#function
-               .globl glIndexfv ; .type glIndexfv,#function
-               .globl glIndexi ; .type glIndexi,#function
-               .globl glIndexiv ; .type glIndexiv,#function
-               .globl glIndexs ; .type glIndexs,#function
-               .globl glIndexsv ; .type glIndexsv,#function
-               .globl glNormal3b ; .type glNormal3b,#function
-               .globl glNormal3bv ; .type glNormal3bv,#function
-               .globl glNormal3d ; .type glNormal3d,#function
-               .globl glNormal3dv ; .type glNormal3dv,#function
-               .globl glNormal3f ; .type glNormal3f,#function
-               .globl glNormal3fv ; .type glNormal3fv,#function
-               .globl glNormal3i ; .type glNormal3i,#function
-               .globl glNormal3iv ; .type glNormal3iv,#function
-               .globl glNormal3s ; .type glNormal3s,#function
-               .globl glNormal3sv ; .type glNormal3sv,#function
-               .globl glRasterPos2d ; .type glRasterPos2d,#function
-               .globl glRasterPos2dv ; .type glRasterPos2dv,#function
-               .globl glRasterPos2f ; .type glRasterPos2f,#function
-               .globl glRasterPos2fv ; .type glRasterPos2fv,#function
-               .globl glRasterPos2i ; .type glRasterPos2i,#function
-               .globl glRasterPos2iv ; .type glRasterPos2iv,#function
-               .globl glRasterPos2s ; .type glRasterPos2s,#function
-               .globl glRasterPos2sv ; .type glRasterPos2sv,#function
-               .globl glRasterPos3d ; .type glRasterPos3d,#function
-               .globl glRasterPos3dv ; .type glRasterPos3dv,#function
-               .globl glRasterPos3f ; .type glRasterPos3f,#function
-               .globl glRasterPos3fv ; .type glRasterPos3fv,#function
-               .globl glRasterPos3i ; .type glRasterPos3i,#function
-               .globl glRasterPos3iv ; .type glRasterPos3iv,#function
-               .globl glRasterPos3s ; .type glRasterPos3s,#function
-               .globl glRasterPos3sv ; .type glRasterPos3sv,#function
-               .globl glRasterPos4d ; .type glRasterPos4d,#function
-               .globl glRasterPos4dv ; .type glRasterPos4dv,#function
-               .globl glRasterPos4f ; .type glRasterPos4f,#function
-               .globl glRasterPos4fv ; .type glRasterPos4fv,#function
-               .globl glRasterPos4i ; .type glRasterPos4i,#function
-               .globl glRasterPos4iv ; .type glRasterPos4iv,#function
-               .globl glRasterPos4s ; .type glRasterPos4s,#function
-               .globl glRasterPos4sv ; .type glRasterPos4sv,#function
-               .globl glRectd ; .type glRectd,#function
-               .globl glRectdv ; .type glRectdv,#function
-               .globl glRectf ; .type glRectf,#function
-               .globl glRectfv ; .type glRectfv,#function
-               .globl glRecti ; .type glRecti,#function
-               .globl glRectiv ; .type glRectiv,#function
-               .globl glRects ; .type glRects,#function
-               .globl glRectsv ; .type glRectsv,#function
-               .globl glTexCoord1d ; .type glTexCoord1d,#function
-               .globl glTexCoord1dv ; .type glTexCoord1dv,#function
-               .globl glTexCoord1f ; .type glTexCoord1f,#function
-               .globl glTexCoord1fv ; .type glTexCoord1fv,#function
-               .globl glTexCoord1i ; .type glTexCoord1i,#function
-               .globl glTexCoord1iv ; .type glTexCoord1iv,#function
-               .globl glTexCoord1s ; .type glTexCoord1s,#function
-               .globl glTexCoord1sv ; .type glTexCoord1sv,#function
-               .globl glTexCoord2d ; .type glTexCoord2d,#function
-               .globl glTexCoord2dv ; .type glTexCoord2dv,#function
-               .globl glTexCoord2f ; .type glTexCoord2f,#function
-               .globl glTexCoord2fv ; .type glTexCoord2fv,#function
-               .globl glTexCoord2i ; .type glTexCoord2i,#function
-               .globl glTexCoord2iv ; .type glTexCoord2iv,#function
-               .globl glTexCoord2s ; .type glTexCoord2s,#function
-               .globl glTexCoord2sv ; .type glTexCoord2sv,#function
-               .globl glTexCoord3d ; .type glTexCoord3d,#function
-               .globl glTexCoord3dv ; .type glTexCoord3dv,#function
-               .globl glTexCoord3f ; .type glTexCoord3f,#function
-               .globl glTexCoord3fv ; .type glTexCoord3fv,#function
-               .globl glTexCoord3i ; .type glTexCoord3i,#function
-               .globl glTexCoord3iv ; .type glTexCoord3iv,#function
-               .globl glTexCoord3s ; .type glTexCoord3s,#function
-               .globl glTexCoord3sv ; .type glTexCoord3sv,#function
-               .globl glTexCoord4d ; .type glTexCoord4d,#function
-               .globl glTexCoord4dv ; .type glTexCoord4dv,#function
-               .globl glTexCoord4f ; .type glTexCoord4f,#function
-               .globl glTexCoord4fv ; .type glTexCoord4fv,#function
-               .globl glTexCoord4i ; .type glTexCoord4i,#function
-               .globl glTexCoord4iv ; .type glTexCoord4iv,#function
-               .globl glTexCoord4s ; .type glTexCoord4s,#function
-               .globl glTexCoord4sv ; .type glTexCoord4sv,#function
-               .globl glVertex2d ; .type glVertex2d,#function
-               .globl glVertex2dv ; .type glVertex2dv,#function
-               .globl glVertex2f ; .type glVertex2f,#function
-               .globl glVertex2fv ; .type glVertex2fv,#function
-               .globl glVertex2i ; .type glVertex2i,#function
-               .globl glVertex2iv ; .type glVertex2iv,#function
-               .globl glVertex2s ; .type glVertex2s,#function
-               .globl glVertex2sv ; .type glVertex2sv,#function
-               .globl glVertex3d ; .type glVertex3d,#function
-               .globl glVertex3dv ; .type glVertex3dv,#function
-               .globl glVertex3f ; .type glVertex3f,#function
-               .globl glVertex3fv ; .type glVertex3fv,#function
-               .globl glVertex3i ; .type glVertex3i,#function
-               .globl glVertex3iv ; .type glVertex3iv,#function
-               .globl glVertex3s ; .type glVertex3s,#function
-               .globl glVertex3sv ; .type glVertex3sv,#function
-               .globl glVertex4d ; .type glVertex4d,#function
-               .globl glVertex4dv ; .type glVertex4dv,#function
-               .globl glVertex4f ; .type glVertex4f,#function
-               .globl glVertex4fv ; .type glVertex4fv,#function
-               .globl glVertex4i ; .type glVertex4i,#function
-               .globl glVertex4iv ; .type glVertex4iv,#function
-               .globl glVertex4s ; .type glVertex4s,#function
-               .globl glVertex4sv ; .type glVertex4sv,#function
-               .globl glClipPlane ; .type glClipPlane,#function
-               .globl glColorMaterial ; .type glColorMaterial,#function
-               .globl glCullFace ; .type glCullFace,#function
-               .globl glFogf ; .type glFogf,#function
-               .globl glFogfv ; .type glFogfv,#function
-               .globl glFogi ; .type glFogi,#function
-               .globl glFogiv ; .type glFogiv,#function
-               .globl glFrontFace ; .type glFrontFace,#function
-               .globl glHint ; .type glHint,#function
-               .globl glLightf ; .type glLightf,#function
-               .globl glLightfv ; .type glLightfv,#function
-               .globl glLighti ; .type glLighti,#function
-               .globl glLightiv ; .type glLightiv,#function
-               .globl glLightModelf ; .type glLightModelf,#function
-               .globl glLightModelfv ; .type glLightModelfv,#function
-               .globl glLightModeli ; .type glLightModeli,#function
-               .globl glLightModeliv ; .type glLightModeliv,#function
-               .globl glLineStipple ; .type glLineStipple,#function
-               .globl glLineWidth ; .type glLineWidth,#function
-               .globl glMaterialf ; .type glMaterialf,#function
-               .globl glMaterialfv ; .type glMaterialfv,#function
-               .globl glMateriali ; .type glMateriali,#function
-               .globl glMaterialiv ; .type glMaterialiv,#function
-               .globl glPointSize ; .type glPointSize,#function
-               .globl glPolygonMode ; .type glPolygonMode,#function
-               .globl glPolygonStipple ; .type glPolygonStipple,#function
-               .globl glScissor ; .type glScissor,#function
-               .globl glShadeModel ; .type glShadeModel,#function
-               .globl glTexParameterf ; .type glTexParameterf,#function
-               .globl glTexParameterfv ; .type glTexParameterfv,#function
-               .globl glTexParameteri ; .type glTexParameteri,#function
-               .globl glTexParameteriv ; .type glTexParameteriv,#function
-               .globl glTexImage1D ; .type glTexImage1D,#function
-               .globl glTexImage2D ; .type glTexImage2D,#function
-               .globl glTexEnvf ; .type glTexEnvf,#function
-               .globl glTexEnvfv ; .type glTexEnvfv,#function
-               .globl glTexEnvi ; .type glTexEnvi,#function
-               .globl glTexEnviv ; .type glTexEnviv,#function
-               .globl glTexGend ; .type glTexGend,#function
-               .globl glTexGendv ; .type glTexGendv,#function
-               .globl glTexGenf ; .type glTexGenf,#function
-               .globl glTexGenfv ; .type glTexGenfv,#function
-               .globl glTexGeni ; .type glTexGeni,#function
-               .globl glTexGeniv ; .type glTexGeniv,#function
-               .globl glFeedbackBuffer ; .type glFeedbackBuffer,#function
-               .globl glSelectBuffer ; .type glSelectBuffer,#function
-               .globl glRenderMode ; .type glRenderMode,#function
-               .globl glInitNames ; .type glInitNames,#function
-               .globl glLoadName ; .type glLoadName,#function
-               .globl glPassThrough ; .type glPassThrough,#function
-               .globl glPopName ; .type glPopName,#function
-               .globl glPushName ; .type glPushName,#function
-               .globl glDrawBuffer ; .type glDrawBuffer,#function
-               .globl glClear ; .type glClear,#function
-               .globl glClearAccum ; .type glClearAccum,#function
-               .globl glClearIndex ; .type glClearIndex,#function
-               .globl glClearColor ; .type glClearColor,#function
-               .globl glClearStencil ; .type glClearStencil,#function
-               .globl glClearDepth ; .type glClearDepth,#function
-               .globl glStencilMask ; .type glStencilMask,#function
-               .globl glColorMask ; .type glColorMask,#function
-               .globl glDepthMask ; .type glDepthMask,#function
-               .globl glIndexMask ; .type glIndexMask,#function
-               .globl glAccum ; .type glAccum,#function
-               .globl glDisable ; .type glDisable,#function
-               .globl glEnable ; .type glEnable,#function
-               .globl glFinish ; .type glFinish,#function
-               .globl glFlush ; .type glFlush,#function
-               .globl glPopAttrib ; .type glPopAttrib,#function
-               .globl glPushAttrib ; .type glPushAttrib,#function
-               .globl glMap1d ; .type glMap1d,#function
-               .globl glMap1f ; .type glMap1f,#function
-               .globl glMap2d ; .type glMap2d,#function
-               .globl glMap2f ; .type glMap2f,#function
-               .globl glMapGrid1d ; .type glMapGrid1d,#function
-               .globl glMapGrid1f ; .type glMapGrid1f,#function
-               .globl glMapGrid2d ; .type glMapGrid2d,#function
-               .globl glMapGrid2f ; .type glMapGrid2f,#function
-               .globl glEvalCoord1d ; .type glEvalCoord1d,#function
-               .globl glEvalCoord1dv ; .type glEvalCoord1dv,#function
-               .globl glEvalCoord1f ; .type glEvalCoord1f,#function
-               .globl glEvalCoord1fv ; .type glEvalCoord1fv,#function
-               .globl glEvalCoord2d ; .type glEvalCoord2d,#function
-               .globl glEvalCoord2dv ; .type glEvalCoord2dv,#function
-               .globl glEvalCoord2f ; .type glEvalCoord2f,#function
-               .globl glEvalCoord2fv ; .type glEvalCoord2fv,#function
-               .globl glEvalMesh1 ; .type glEvalMesh1,#function
-               .globl glEvalPoint1 ; .type glEvalPoint1,#function
-               .globl glEvalMesh2 ; .type glEvalMesh2,#function
-               .globl glEvalPoint2 ; .type glEvalPoint2,#function
-               .globl glAlphaFunc ; .type glAlphaFunc,#function
-               .globl glBlendFunc ; .type glBlendFunc,#function
-               .globl glLogicOp ; .type glLogicOp,#function
-               .globl glStencilFunc ; .type glStencilFunc,#function
-               .globl glStencilOp ; .type glStencilOp,#function
-               .globl glDepthFunc ; .type glDepthFunc,#function
-               .globl glPixelZoom ; .type glPixelZoom,#function
-               .globl glPixelTransferf ; .type glPixelTransferf,#function
-               .globl glPixelTransferi ; .type glPixelTransferi,#function
-               .globl glPixelStoref ; .type glPixelStoref,#function
-               .globl glPixelStorei ; .type glPixelStorei,#function
-               .globl glPixelMapfv ; .type glPixelMapfv,#function
-               .globl glPixelMapuiv ; .type glPixelMapuiv,#function
-               .globl glPixelMapusv ; .type glPixelMapusv,#function
-               .globl glReadBuffer ; .type glReadBuffer,#function
-               .globl glCopyPixels ; .type glCopyPixels,#function
-               .globl glReadPixels ; .type glReadPixels,#function
-               .globl glDrawPixels ; .type glDrawPixels,#function
-               .globl glGetBooleanv ; .type glGetBooleanv,#function
-               .globl glGetClipPlane ; .type glGetClipPlane,#function
-               .globl glGetDoublev ; .type glGetDoublev,#function
-               .globl glGetError ; .type glGetError,#function
-               .globl glGetFloatv ; .type glGetFloatv,#function
-               .globl glGetIntegerv ; .type glGetIntegerv,#function
-               .globl glGetLightfv ; .type glGetLightfv,#function
-               .globl glGetLightiv ; .type glGetLightiv,#function
-               .globl glGetMapdv ; .type glGetMapdv,#function
-               .globl glGetMapfv ; .type glGetMapfv,#function
-               .globl glGetMapiv ; .type glGetMapiv,#function
-               .globl glGetMaterialfv ; .type glGetMaterialfv,#function
-               .globl glGetMaterialiv ; .type glGetMaterialiv,#function
-               .globl glGetPixelMapfv ; .type glGetPixelMapfv,#function
-               .globl glGetPixelMapuiv ; .type glGetPixelMapuiv,#function
-               .globl glGetPixelMapusv ; .type glGetPixelMapusv,#function
-               .globl glGetPolygonStipple ; .type glGetPolygonStipple,#function
-               .globl glGetString ; .type glGetString,#function
-               .globl glGetTexEnvfv ; .type glGetTexEnvfv,#function
-               .globl glGetTexEnviv ; .type glGetTexEnviv,#function
-               .globl glGetTexGendv ; .type glGetTexGendv,#function
-               .globl glGetTexGenfv ; .type glGetTexGenfv,#function
-               .globl glGetTexGeniv ; .type glGetTexGeniv,#function
-               .globl glGetTexImage ; .type glGetTexImage,#function
-               .globl glGetTexParameterfv ; .type glGetTexParameterfv,#function
-               .globl glGetTexParameteriv ; .type glGetTexParameteriv,#function
-               .globl glGetTexLevelParameterfv ; .type glGetTexLevelParameterfv,#function
-               .globl glGetTexLevelParameteriv ; .type glGetTexLevelParameteriv,#function
-               .globl glIsEnabled ; .type glIsEnabled,#function
-               .globl glIsList ; .type glIsList,#function
-               .globl glDepthRange ; .type glDepthRange,#function
-               .globl glFrustum ; .type glFrustum,#function
-               .globl glLoadIdentity ; .type glLoadIdentity,#function
-               .globl glLoadMatrixf ; .type glLoadMatrixf,#function
-               .globl glLoadMatrixd ; .type glLoadMatrixd,#function
-               .globl glMatrixMode ; .type glMatrixMode,#function
-               .globl glMultMatrixf ; .type glMultMatrixf,#function
-               .globl glMultMatrixd ; .type glMultMatrixd,#function
-               .globl glOrtho ; .type glOrtho,#function
-               .globl glPopMatrix ; .type glPopMatrix,#function
-               .globl glPushMatrix ; .type glPushMatrix,#function
-               .globl glRotated ; .type glRotated,#function
-               .globl glRotatef ; .type glRotatef,#function
-               .globl glScaled ; .type glScaled,#function
-               .globl glScalef ; .type glScalef,#function
-               .globl glTranslated ; .type glTranslated,#function
-               .globl glTranslatef ; .type glTranslatef,#function
-               .globl glViewport ; .type glViewport,#function
-               .globl glArrayElement ; .type glArrayElement,#function
-               .globl glBindTexture ; .type glBindTexture,#function
-               .globl glColorPointer ; .type glColorPointer,#function
-               .globl glDisableClientState ; .type glDisableClientState,#function
-               .globl glDrawArrays ; .type glDrawArrays,#function
-               .globl glDrawElements ; .type glDrawElements,#function
-               .globl glEdgeFlagPointer ; .type glEdgeFlagPointer,#function
-               .globl glEnableClientState ; .type glEnableClientState,#function
-               .globl glIndexPointer ; .type glIndexPointer,#function
-               .globl glIndexub ; .type glIndexub,#function
-               .globl glIndexubv ; .type glIndexubv,#function
-               .globl glInterleavedArrays ; .type glInterleavedArrays,#function
-               .globl glNormalPointer ; .type glNormalPointer,#function
-               .globl glPolygonOffset ; .type glPolygonOffset,#function
-               .globl glTexCoordPointer ; .type glTexCoordPointer,#function
-               .globl glVertexPointer ; .type glVertexPointer,#function
-               .globl glAreTexturesResident ; .type glAreTexturesResident,#function
-               .globl glCopyTexImage1D ; .type glCopyTexImage1D,#function
-               .globl glCopyTexImage2D ; .type glCopyTexImage2D,#function
-               .globl glCopyTexSubImage1D ; .type glCopyTexSubImage1D,#function
-               .globl glCopyTexSubImage2D ; .type glCopyTexSubImage2D,#function
-               .globl glDeleteTextures ; .type glDeleteTextures,#function
-               .globl glGenTextures ; .type glGenTextures,#function
-               .globl glGetPointerv ; .type glGetPointerv,#function
-               .globl glIsTexture ; .type glIsTexture,#function
-               .globl glPrioritizeTextures ; .type glPrioritizeTextures,#function
-               .globl glTexSubImage1D ; .type glTexSubImage1D,#function
-               .globl glTexSubImage2D ; .type glTexSubImage2D,#function
-               .globl glPopClientAttrib ; .type glPopClientAttrib,#function
-               .globl glPushClientAttrib ; .type glPushClientAttrib,#function
-               .globl glBlendColor ; .type glBlendColor,#function
-               .globl glBlendEquation ; .type glBlendEquation,#function
-               .globl glDrawRangeElements ; .type glDrawRangeElements,#function
-               .globl glColorTable ; .type glColorTable,#function
-               .globl glColorTableParameterfv ; .type glColorTableParameterfv,#function
-               .globl glColorTableParameteriv ; .type glColorTableParameteriv,#function
-               .globl glCopyColorTable ; .type glCopyColorTable,#function
-               .globl glGetColorTable ; .type glGetColorTable,#function
-               .globl glGetColorTableParameterfv ; .type glGetColorTableParameterfv,#function
-               .globl glGetColorTableParameteriv ; .type glGetColorTableParameteriv,#function
-               .globl glColorSubTable ; .type glColorSubTable,#function
-               .globl glCopyColorSubTable ; .type glCopyColorSubTable,#function
-               .globl glConvolutionFilter1D ; .type glConvolutionFilter1D,#function
-               .globl glConvolutionFilter2D ; .type glConvolutionFilter2D,#function
-               .globl glConvolutionParameterf ; .type glConvolutionParameterf,#function
-               .globl glConvolutionParameterfv ; .type glConvolutionParameterfv,#function
-               .globl glConvolutionParameteri ; .type glConvolutionParameteri,#function
-               .globl glConvolutionParameteriv ; .type glConvolutionParameteriv,#function
-               .globl glCopyConvolutionFilter1D ; .type glCopyConvolutionFilter1D,#function
-               .globl glCopyConvolutionFilter2D ; .type glCopyConvolutionFilter2D,#function
-               .globl glGetConvolutionFilter ; .type glGetConvolutionFilter,#function
-               .globl glGetConvolutionParameterfv ; .type glGetConvolutionParameterfv,#function
-               .globl glGetConvolutionParameteriv ; .type glGetConvolutionParameteriv,#function
-               .globl glGetSeparableFilter ; .type glGetSeparableFilter,#function
-               .globl glSeparableFilter2D ; .type glSeparableFilter2D,#function
-               .globl glGetHistogram ; .type glGetHistogram,#function
-               .globl glGetHistogramParameterfv ; .type glGetHistogramParameterfv,#function
-               .globl glGetHistogramParameteriv ; .type glGetHistogramParameteriv,#function
-               .globl glGetMinmax ; .type glGetMinmax,#function
-               .globl glGetMinmaxParameterfv ; .type glGetMinmaxParameterfv,#function
-               .globl glGetMinmaxParameteriv ; .type glGetMinmaxParameteriv,#function
-               .globl glHistogram ; .type glHistogram,#function
-               .globl glMinmax ; .type glMinmax,#function
-               .globl glResetHistogram ; .type glResetHistogram,#function
-               .globl glResetMinmax ; .type glResetMinmax,#function
-               .globl glTexImage3D ; .type glTexImage3D,#function
-               .globl glTexSubImage3D ; .type glTexSubImage3D,#function
-               .globl glCopyTexSubImage3D ; .type glCopyTexSubImage3D,#function
-               .globl glActiveTextureARB ; .type glActiveTextureARB,#function
-               .globl glClientActiveTextureARB ; .type glClientActiveTextureARB,#function
-               .globl glMultiTexCoord1dARB ; .type glMultiTexCoord1dARB,#function
-               .globl glMultiTexCoord1dvARB ; .type glMultiTexCoord1dvARB,#function
-               .globl glMultiTexCoord1fARB ; .type glMultiTexCoord1fARB,#function
-               .globl glMultiTexCoord1fvARB ; .type glMultiTexCoord1fvARB,#function
-               .globl glMultiTexCoord1iARB ; .type glMultiTexCoord1iARB,#function
-               .globl glMultiTexCoord1ivARB ; .type glMultiTexCoord1ivARB,#function
-               .globl glMultiTexCoord1sARB ; .type glMultiTexCoord1sARB,#function
-               .globl glMultiTexCoord1svARB ; .type glMultiTexCoord1svARB,#function
-               .globl glMultiTexCoord2dARB ; .type glMultiTexCoord2dARB,#function
-               .globl glMultiTexCoord2dvARB ; .type glMultiTexCoord2dvARB,#function
-               .globl glMultiTexCoord2fARB ; .type glMultiTexCoord2fARB,#function
-               .globl glMultiTexCoord2fvARB ; .type glMultiTexCoord2fvARB,#function
-               .globl glMultiTexCoord2iARB ; .type glMultiTexCoord2iARB,#function
-               .globl glMultiTexCoord2ivARB ; .type glMultiTexCoord2ivARB,#function
-               .globl glMultiTexCoord2sARB ; .type glMultiTexCoord2sARB,#function
-               .globl glMultiTexCoord2svARB ; .type glMultiTexCoord2svARB,#function
-               .globl glMultiTexCoord3dARB ; .type glMultiTexCoord3dARB,#function
-               .globl glMultiTexCoord3dvARB ; .type glMultiTexCoord3dvARB,#function
-               .globl glMultiTexCoord3fARB ; .type glMultiTexCoord3fARB,#function
-               .globl glMultiTexCoord3fvARB ; .type glMultiTexCoord3fvARB,#function
-               .globl glMultiTexCoord3iARB ; .type glMultiTexCoord3iARB,#function
-               .globl glMultiTexCoord3ivARB ; .type glMultiTexCoord3ivARB,#function
-               .globl glMultiTexCoord3sARB ; .type glMultiTexCoord3sARB,#function
-               .globl glMultiTexCoord3svARB ; .type glMultiTexCoord3svARB,#function
-               .globl glMultiTexCoord4dARB ; .type glMultiTexCoord4dARB,#function
-               .globl glMultiTexCoord4dvARB ; .type glMultiTexCoord4dvARB,#function
-               .globl glMultiTexCoord4fARB ; .type glMultiTexCoord4fARB,#function
-               .globl glMultiTexCoord4fvARB ; .type glMultiTexCoord4fvARB,#function
-               .globl glMultiTexCoord4iARB ; .type glMultiTexCoord4iARB,#function
-               .globl glMultiTexCoord4ivARB ; .type glMultiTexCoord4ivARB,#function
-               .globl glMultiTexCoord4sARB ; .type glMultiTexCoord4sARB,#function
-               .globl glMultiTexCoord4svARB ; .type glMultiTexCoord4svARB,#function
-               .globl glAttachShader ; .type glAttachShader,#function
-               .globl glCreateProgram ; .type glCreateProgram,#function
-               .globl glCreateShader ; .type glCreateShader,#function
-               .globl glDeleteProgram ; .type glDeleteProgram,#function
-               .globl glDeleteShader ; .type glDeleteShader,#function
-               .globl glDetachShader ; .type glDetachShader,#function
-               .globl glGetAttachedShaders ; .type glGetAttachedShaders,#function
-               .globl glGetProgramInfoLog ; .type glGetProgramInfoLog,#function
-               .globl glGetProgramiv ; .type glGetProgramiv,#function
-               .globl glGetShaderInfoLog ; .type glGetShaderInfoLog,#function
-               .globl glGetShaderiv ; .type glGetShaderiv,#function
-               .globl glIsProgram ; .type glIsProgram,#function
-               .globl glIsShader ; .type glIsShader,#function
-               .globl glStencilFuncSeparate ; .type glStencilFuncSeparate,#function
-               .globl glStencilMaskSeparate ; .type glStencilMaskSeparate,#function
-               .globl glStencilOpSeparate ; .type glStencilOpSeparate,#function
-               .globl glUniformMatrix2x3fv ; .type glUniformMatrix2x3fv,#function
-               .globl glUniformMatrix2x4fv ; .type glUniformMatrix2x4fv,#function
-               .globl glUniformMatrix3x2fv ; .type glUniformMatrix3x2fv,#function
-               .globl glUniformMatrix3x4fv ; .type glUniformMatrix3x4fv,#function
-               .globl glUniformMatrix4x2fv ; .type glUniformMatrix4x2fv,#function
-               .globl glUniformMatrix4x3fv ; .type glUniformMatrix4x3fv,#function
-               .globl glLoadTransposeMatrixdARB ; .type glLoadTransposeMatrixdARB,#function
-               .globl glLoadTransposeMatrixfARB ; .type glLoadTransposeMatrixfARB,#function
-               .globl glMultTransposeMatrixdARB ; .type glMultTransposeMatrixdARB,#function
-               .globl glMultTransposeMatrixfARB ; .type glMultTransposeMatrixfARB,#function
-               .globl glSampleCoverageARB ; .type glSampleCoverageARB,#function
-               .globl glCompressedTexImage1DARB ; .type glCompressedTexImage1DARB,#function
-               .globl glCompressedTexImage2DARB ; .type glCompressedTexImage2DARB,#function
-               .globl glCompressedTexImage3DARB ; .type glCompressedTexImage3DARB,#function
-               .globl glCompressedTexSubImage1DARB ; .type glCompressedTexSubImage1DARB,#function
-               .globl glCompressedTexSubImage2DARB ; .type glCompressedTexSubImage2DARB,#function
-               .globl glCompressedTexSubImage3DARB ; .type glCompressedTexSubImage3DARB,#function
-               .globl glGetCompressedTexImageARB ; .type glGetCompressedTexImageARB,#function
-               .globl glDisableVertexAttribArrayARB ; .type glDisableVertexAttribArrayARB,#function
-               .globl glEnableVertexAttribArrayARB ; .type glEnableVertexAttribArrayARB,#function
-               .globl glGetProgramEnvParameterdvARB ; .type glGetProgramEnvParameterdvARB,#function
-               .globl glGetProgramEnvParameterfvARB ; .type glGetProgramEnvParameterfvARB,#function
-               .globl glGetProgramLocalParameterdvARB ; .type glGetProgramLocalParameterdvARB,#function
-               .globl glGetProgramLocalParameterfvARB ; .type glGetProgramLocalParameterfvARB,#function
-               .globl glGetProgramStringARB ; .type glGetProgramStringARB,#function
-               .globl glGetProgramivARB ; .type glGetProgramivARB,#function
-               .globl glGetVertexAttribdvARB ; .type glGetVertexAttribdvARB,#function
-               .globl glGetVertexAttribfvARB ; .type glGetVertexAttribfvARB,#function
-               .globl glGetVertexAttribivARB ; .type glGetVertexAttribivARB,#function
-               .globl glProgramEnvParameter4dARB ; .type glProgramEnvParameter4dARB,#function
-               .globl glProgramEnvParameter4dvARB ; .type glProgramEnvParameter4dvARB,#function
-               .globl glProgramEnvParameter4fARB ; .type glProgramEnvParameter4fARB,#function
-               .globl glProgramEnvParameter4fvARB ; .type glProgramEnvParameter4fvARB,#function
-               .globl glProgramLocalParameter4dARB ; .type glProgramLocalParameter4dARB,#function
-               .globl glProgramLocalParameter4dvARB ; .type glProgramLocalParameter4dvARB,#function
-               .globl glProgramLocalParameter4fARB ; .type glProgramLocalParameter4fARB,#function
-               .globl glProgramLocalParameter4fvARB ; .type glProgramLocalParameter4fvARB,#function
-               .globl glProgramStringARB ; .type glProgramStringARB,#function
-               .globl glVertexAttrib1dARB ; .type glVertexAttrib1dARB,#function
-               .globl glVertexAttrib1dvARB ; .type glVertexAttrib1dvARB,#function
-               .globl glVertexAttrib1fARB ; .type glVertexAttrib1fARB,#function
-               .globl glVertexAttrib1fvARB ; .type glVertexAttrib1fvARB,#function
-               .globl glVertexAttrib1sARB ; .type glVertexAttrib1sARB,#function
-               .globl glVertexAttrib1svARB ; .type glVertexAttrib1svARB,#function
-               .globl glVertexAttrib2dARB ; .type glVertexAttrib2dARB,#function
-               .globl glVertexAttrib2dvARB ; .type glVertexAttrib2dvARB,#function
-               .globl glVertexAttrib2fARB ; .type glVertexAttrib2fARB,#function
-               .globl glVertexAttrib2fvARB ; .type glVertexAttrib2fvARB,#function
-               .globl glVertexAttrib2sARB ; .type glVertexAttrib2sARB,#function
-               .globl glVertexAttrib2svARB ; .type glVertexAttrib2svARB,#function
-               .globl glVertexAttrib3dARB ; .type glVertexAttrib3dARB,#function
-               .globl glVertexAttrib3dvARB ; .type glVertexAttrib3dvARB,#function
-               .globl glVertexAttrib3fARB ; .type glVertexAttrib3fARB,#function
-               .globl glVertexAttrib3fvARB ; .type glVertexAttrib3fvARB,#function
-               .globl glVertexAttrib3sARB ; .type glVertexAttrib3sARB,#function
-               .globl glVertexAttrib3svARB ; .type glVertexAttrib3svARB,#function
-               .globl glVertexAttrib4NbvARB ; .type glVertexAttrib4NbvARB,#function
-               .globl glVertexAttrib4NivARB ; .type glVertexAttrib4NivARB,#function
-               .globl glVertexAttrib4NsvARB ; .type glVertexAttrib4NsvARB,#function
-               .globl glVertexAttrib4NubARB ; .type glVertexAttrib4NubARB,#function
-               .globl glVertexAttrib4NubvARB ; .type glVertexAttrib4NubvARB,#function
-               .globl glVertexAttrib4NuivARB ; .type glVertexAttrib4NuivARB,#function
-               .globl glVertexAttrib4NusvARB ; .type glVertexAttrib4NusvARB,#function
-               .globl glVertexAttrib4bvARB ; .type glVertexAttrib4bvARB,#function
-               .globl glVertexAttrib4dARB ; .type glVertexAttrib4dARB,#function
-               .globl glVertexAttrib4dvARB ; .type glVertexAttrib4dvARB,#function
-               .globl glVertexAttrib4fARB ; .type glVertexAttrib4fARB,#function
-               .globl glVertexAttrib4fvARB ; .type glVertexAttrib4fvARB,#function
-               .globl glVertexAttrib4ivARB ; .type glVertexAttrib4ivARB,#function
-               .globl glVertexAttrib4sARB ; .type glVertexAttrib4sARB,#function
-               .globl glVertexAttrib4svARB ; .type glVertexAttrib4svARB,#function
-               .globl glVertexAttrib4ubvARB ; .type glVertexAttrib4ubvARB,#function
-               .globl glVertexAttrib4uivARB ; .type glVertexAttrib4uivARB,#function
-               .globl glVertexAttrib4usvARB ; .type glVertexAttrib4usvARB,#function
-               .globl glVertexAttribPointerARB ; .type glVertexAttribPointerARB,#function
-               .globl glBindBufferARB ; .type glBindBufferARB,#function
-               .globl glBufferDataARB ; .type glBufferDataARB,#function
-               .globl glBufferSubDataARB ; .type glBufferSubDataARB,#function
-               .globl glDeleteBuffersARB ; .type glDeleteBuffersARB,#function
-               .globl glGenBuffersARB ; .type glGenBuffersARB,#function
-               .globl glGetBufferParameterivARB ; .type glGetBufferParameterivARB,#function
-               .globl glGetBufferPointervARB ; .type glGetBufferPointervARB,#function
-               .globl glGetBufferSubDataARB ; .type glGetBufferSubDataARB,#function
-               .globl glIsBufferARB ; .type glIsBufferARB,#function
-               .globl glMapBufferARB ; .type glMapBufferARB,#function
-               .globl glUnmapBufferARB ; .type glUnmapBufferARB,#function
-               .globl glBeginQueryARB ; .type glBeginQueryARB,#function
-               .globl glDeleteQueriesARB ; .type glDeleteQueriesARB,#function
-               .globl glEndQueryARB ; .type glEndQueryARB,#function
-               .globl glGenQueriesARB ; .type glGenQueriesARB,#function
-               .globl glGetQueryObjectivARB ; .type glGetQueryObjectivARB,#function
-               .globl glGetQueryObjectuivARB ; .type glGetQueryObjectuivARB,#function
-               .globl glGetQueryivARB ; .type glGetQueryivARB,#function
-               .globl glIsQueryARB ; .type glIsQueryARB,#function
-               .globl glAttachObjectARB ; .type glAttachObjectARB,#function
-               .globl glCompileShaderARB ; .type glCompileShaderARB,#function
-               .globl glCreateProgramObjectARB ; .type glCreateProgramObjectARB,#function
-               .globl glCreateShaderObjectARB ; .type glCreateShaderObjectARB,#function
-               .globl glDeleteObjectARB ; .type glDeleteObjectARB,#function
-               .globl glDetachObjectARB ; .type glDetachObjectARB,#function
-               .globl glGetActiveUniformARB ; .type glGetActiveUniformARB,#function
-               .globl glGetAttachedObjectsARB ; .type glGetAttachedObjectsARB,#function
-               .globl glGetHandleARB ; .type glGetHandleARB,#function
-               .globl glGetInfoLogARB ; .type glGetInfoLogARB,#function
-               .globl glGetObjectParameterfvARB ; .type glGetObjectParameterfvARB,#function
-               .globl glGetObjectParameterivARB ; .type glGetObjectParameterivARB,#function
-               .globl glGetShaderSourceARB ; .type glGetShaderSourceARB,#function
-               .globl glGetUniformLocationARB ; .type glGetUniformLocationARB,#function
-               .globl glGetUniformfvARB ; .type glGetUniformfvARB,#function
-               .globl glGetUniformivARB ; .type glGetUniformivARB,#function
-               .globl glLinkProgramARB ; .type glLinkProgramARB,#function
-               .globl glShaderSourceARB ; .type glShaderSourceARB,#function
-               .globl glUniform1fARB ; .type glUniform1fARB,#function
-               .globl glUniform1fvARB ; .type glUniform1fvARB,#function
-               .globl glUniform1iARB ; .type glUniform1iARB,#function
-               .globl glUniform1ivARB ; .type glUniform1ivARB,#function
-               .globl glUniform2fARB ; .type glUniform2fARB,#function
-               .globl glUniform2fvARB ; .type glUniform2fvARB,#function
-               .globl glUniform2iARB ; .type glUniform2iARB,#function
-               .globl glUniform2ivARB ; .type glUniform2ivARB,#function
-               .globl glUniform3fARB ; .type glUniform3fARB,#function
-               .globl glUniform3fvARB ; .type glUniform3fvARB,#function
-               .globl glUniform3iARB ; .type glUniform3iARB,#function
-               .globl glUniform3ivARB ; .type glUniform3ivARB,#function
-               .globl glUniform4fARB ; .type glUniform4fARB,#function
-               .globl glUniform4fvARB ; .type glUniform4fvARB,#function
-               .globl glUniform4iARB ; .type glUniform4iARB,#function
-               .globl glUniform4ivARB ; .type glUniform4ivARB,#function
-               .globl glUniformMatrix2fvARB ; .type glUniformMatrix2fvARB,#function
-               .globl glUniformMatrix3fvARB ; .type glUniformMatrix3fvARB,#function
-               .globl glUniformMatrix4fvARB ; .type glUniformMatrix4fvARB,#function
-               .globl glUseProgramObjectARB ; .type glUseProgramObjectARB,#function
-               .globl glValidateProgramARB ; .type glValidateProgramARB,#function
-               .globl glBindAttribLocationARB ; .type glBindAttribLocationARB,#function
-               .globl glGetActiveAttribARB ; .type glGetActiveAttribARB,#function
-               .globl glGetAttribLocationARB ; .type glGetAttribLocationARB,#function
-               .globl glDrawBuffersARB ; .type glDrawBuffersARB,#function
-               .globl glRenderbufferStorageMultisample ; .type glRenderbufferStorageMultisample,#function
-               .globl glPolygonOffsetEXT ; .type glPolygonOffsetEXT,#function
-               .globl gl_dispatch_stub_563 ; .type gl_dispatch_stub_563,#function
-               .globl gl_dispatch_stub_564 ; .type gl_dispatch_stub_564,#function
-               .globl gl_dispatch_stub_565 ; .type gl_dispatch_stub_565,#function
-               .globl gl_dispatch_stub_566 ; .type gl_dispatch_stub_566,#function
-               .globl gl_dispatch_stub_567 ; .type gl_dispatch_stub_567,#function
-               .globl gl_dispatch_stub_568 ; .type gl_dispatch_stub_568,#function
-               .globl gl_dispatch_stub_569 ; .type gl_dispatch_stub_569,#function
-               .globl gl_dispatch_stub_570 ; .type gl_dispatch_stub_570,#function
-               .globl glColorPointerEXT ; .type glColorPointerEXT,#function
-               .globl glEdgeFlagPointerEXT ; .type glEdgeFlagPointerEXT,#function
-               .globl glIndexPointerEXT ; .type glIndexPointerEXT,#function
-               .globl glNormalPointerEXT ; .type glNormalPointerEXT,#function
-               .globl glTexCoordPointerEXT ; .type glTexCoordPointerEXT,#function
-               .globl glVertexPointerEXT ; .type glVertexPointerEXT,#function
-               .globl glPointParameterfEXT ; .type glPointParameterfEXT,#function
-               .globl glPointParameterfvEXT ; .type glPointParameterfvEXT,#function
-               .globl glLockArraysEXT ; .type glLockArraysEXT,#function
-               .globl glUnlockArraysEXT ; .type glUnlockArraysEXT,#function
-               .globl gl_dispatch_stub_581 ; .type gl_dispatch_stub_581,#function
-               .globl gl_dispatch_stub_582 ; .type gl_dispatch_stub_582,#function
-               .globl glSecondaryColor3bEXT ; .type glSecondaryColor3bEXT,#function
-               .globl glSecondaryColor3bvEXT ; .type glSecondaryColor3bvEXT,#function
-               .globl glSecondaryColor3dEXT ; .type glSecondaryColor3dEXT,#function
-               .globl glSecondaryColor3dvEXT ; .type glSecondaryColor3dvEXT,#function
-               .globl glSecondaryColor3fEXT ; .type glSecondaryColor3fEXT,#function
-               .globl glSecondaryColor3fvEXT ; .type glSecondaryColor3fvEXT,#function
-               .globl glSecondaryColor3iEXT ; .type glSecondaryColor3iEXT,#function
-               .globl glSecondaryColor3ivEXT ; .type glSecondaryColor3ivEXT,#function
-               .globl glSecondaryColor3sEXT ; .type glSecondaryColor3sEXT,#function
-               .globl glSecondaryColor3svEXT ; .type glSecondaryColor3svEXT,#function
-               .globl glSecondaryColor3ubEXT ; .type glSecondaryColor3ubEXT,#function
-               .globl glSecondaryColor3ubvEXT ; .type glSecondaryColor3ubvEXT,#function
-               .globl glSecondaryColor3uiEXT ; .type glSecondaryColor3uiEXT,#function
-               .globl glSecondaryColor3uivEXT ; .type glSecondaryColor3uivEXT,#function
-               .globl glSecondaryColor3usEXT ; .type glSecondaryColor3usEXT,#function
-               .globl glSecondaryColor3usvEXT ; .type glSecondaryColor3usvEXT,#function
-               .globl glSecondaryColorPointerEXT ; .type glSecondaryColorPointerEXT,#function
-               .globl glMultiDrawArraysEXT ; .type glMultiDrawArraysEXT,#function
-               .globl glMultiDrawElementsEXT ; .type glMultiDrawElementsEXT,#function
-               .globl glFogCoordPointerEXT ; .type glFogCoordPointerEXT,#function
-               .globl glFogCoorddEXT ; .type glFogCoorddEXT,#function
-               .globl glFogCoorddvEXT ; .type glFogCoorddvEXT,#function
-               .globl glFogCoordfEXT ; .type glFogCoordfEXT,#function
-               .globl glFogCoordfvEXT ; .type glFogCoordfvEXT,#function
-               .globl gl_dispatch_stub_607 ; .type gl_dispatch_stub_607,#function
-               .globl glBlendFuncSeparateEXT ; .type glBlendFuncSeparateEXT,#function
-               .globl glFlushVertexArrayRangeNV ; .type glFlushVertexArrayRangeNV,#function
-               .globl glVertexArrayRangeNV ; .type glVertexArrayRangeNV,#function
-               .globl glCombinerInputNV ; .type glCombinerInputNV,#function
-               .globl glCombinerOutputNV ; .type glCombinerOutputNV,#function
-               .globl glCombinerParameterfNV ; .type glCombinerParameterfNV,#function
-               .globl glCombinerParameterfvNV ; .type glCombinerParameterfvNV,#function
-               .globl glCombinerParameteriNV ; .type glCombinerParameteriNV,#function
-               .globl glCombinerParameterivNV ; .type glCombinerParameterivNV,#function
-               .globl glFinalCombinerInputNV ; .type glFinalCombinerInputNV,#function
-               .globl glGetCombinerInputParameterfvNV ; .type glGetCombinerInputParameterfvNV,#function
-               .globl glGetCombinerInputParameterivNV ; .type glGetCombinerInputParameterivNV,#function
-               .globl glGetCombinerOutputParameterfvNV ; .type glGetCombinerOutputParameterfvNV,#function
-               .globl glGetCombinerOutputParameterivNV ; .type glGetCombinerOutputParameterivNV,#function
-               .globl glGetFinalCombinerInputParameterfvNV ; .type glGetFinalCombinerInputParameterfvNV,#function
-               .globl glGetFinalCombinerInputParameterivNV ; .type glGetFinalCombinerInputParameterivNV,#function
-               .globl glResizeBuffersMESA ; .type glResizeBuffersMESA,#function
-               .globl glWindowPos2dMESA ; .type glWindowPos2dMESA,#function
-               .globl glWindowPos2dvMESA ; .type glWindowPos2dvMESA,#function
-               .globl glWindowPos2fMESA ; .type glWindowPos2fMESA,#function
-               .globl glWindowPos2fvMESA ; .type glWindowPos2fvMESA,#function
-               .globl glWindowPos2iMESA ; .type glWindowPos2iMESA,#function
-               .globl glWindowPos2ivMESA ; .type glWindowPos2ivMESA,#function
-               .globl glWindowPos2sMESA ; .type glWindowPos2sMESA,#function
-               .globl glWindowPos2svMESA ; .type glWindowPos2svMESA,#function
-               .globl glWindowPos3dMESA ; .type glWindowPos3dMESA,#function
-               .globl glWindowPos3dvMESA ; .type glWindowPos3dvMESA,#function
-               .globl glWindowPos3fMESA ; .type glWindowPos3fMESA,#function
-               .globl glWindowPos3fvMESA ; .type glWindowPos3fvMESA,#function
-               .globl glWindowPos3iMESA ; .type glWindowPos3iMESA,#function
-               .globl glWindowPos3ivMESA ; .type glWindowPos3ivMESA,#function
-               .globl glWindowPos3sMESA ; .type glWindowPos3sMESA,#function
-               .globl glWindowPos3svMESA ; .type glWindowPos3svMESA,#function
-               .globl glWindowPos4dMESA ; .type glWindowPos4dMESA,#function
-               .globl glWindowPos4dvMESA ; .type glWindowPos4dvMESA,#function
-               .globl glWindowPos4fMESA ; .type glWindowPos4fMESA,#function
-               .globl glWindowPos4fvMESA ; .type glWindowPos4fvMESA,#function
-               .globl glWindowPos4iMESA ; .type glWindowPos4iMESA,#function
-               .globl glWindowPos4ivMESA ; .type glWindowPos4ivMESA,#function
-               .globl glWindowPos4sMESA ; .type glWindowPos4sMESA,#function
-               .globl glWindowPos4svMESA ; .type glWindowPos4svMESA,#function
-               .globl gl_dispatch_stub_649 ; .type gl_dispatch_stub_649,#function
-               .globl gl_dispatch_stub_650 ; .type gl_dispatch_stub_650,#function
-               .globl gl_dispatch_stub_651 ; .type gl_dispatch_stub_651,#function
-               .globl gl_dispatch_stub_652 ; .type gl_dispatch_stub_652,#function
-               .globl gl_dispatch_stub_653 ; .type gl_dispatch_stub_653,#function
-               .globl gl_dispatch_stub_654 ; .type gl_dispatch_stub_654,#function
-               .globl gl_dispatch_stub_655 ; .type gl_dispatch_stub_655,#function
-               .globl gl_dispatch_stub_656 ; .type gl_dispatch_stub_656,#function
-               .globl gl_dispatch_stub_657 ; .type gl_dispatch_stub_657,#function
-               .globl glAreProgramsResidentNV ; .type glAreProgramsResidentNV,#function
-               .globl glBindProgramNV ; .type glBindProgramNV,#function
-               .globl glDeleteProgramsNV ; .type glDeleteProgramsNV,#function
-               .globl glExecuteProgramNV ; .type glExecuteProgramNV,#function
-               .globl glGenProgramsNV ; .type glGenProgramsNV,#function
-               .globl glGetProgramParameterdvNV ; .type glGetProgramParameterdvNV,#function
-               .globl glGetProgramParameterfvNV ; .type glGetProgramParameterfvNV,#function
-               .globl glGetProgramStringNV ; .type glGetProgramStringNV,#function
-               .globl glGetProgramivNV ; .type glGetProgramivNV,#function
-               .globl glGetTrackMatrixivNV ; .type glGetTrackMatrixivNV,#function
-               .globl glGetVertexAttribPointervNV ; .type glGetVertexAttribPointervNV,#function
-               .globl glGetVertexAttribdvNV ; .type glGetVertexAttribdvNV,#function
-               .globl glGetVertexAttribfvNV ; .type glGetVertexAttribfvNV,#function
-               .globl glGetVertexAttribivNV ; .type glGetVertexAttribivNV,#function
-               .globl glIsProgramNV ; .type glIsProgramNV,#function
-               .globl glLoadProgramNV ; .type glLoadProgramNV,#function
-               .globl glProgramParameters4dvNV ; .type glProgramParameters4dvNV,#function
-               .globl glProgramParameters4fvNV ; .type glProgramParameters4fvNV,#function
-               .globl glRequestResidentProgramsNV ; .type glRequestResidentProgramsNV,#function
-               .globl glTrackMatrixNV ; .type glTrackMatrixNV,#function
-               .globl glVertexAttrib1dNV ; .type glVertexAttrib1dNV,#function
-               .globl glVertexAttrib1dvNV ; .type glVertexAttrib1dvNV,#function
-               .globl glVertexAttrib1fNV ; .type glVertexAttrib1fNV,#function
-               .globl glVertexAttrib1fvNV ; .type glVertexAttrib1fvNV,#function
-               .globl glVertexAttrib1sNV ; .type glVertexAttrib1sNV,#function
-               .globl glVertexAttrib1svNV ; .type glVertexAttrib1svNV,#function
-               .globl glVertexAttrib2dNV ; .type glVertexAttrib2dNV,#function
-               .globl glVertexAttrib2dvNV ; .type glVertexAttrib2dvNV,#function
-               .globl glVertexAttrib2fNV ; .type glVertexAttrib2fNV,#function
-               .globl glVertexAttrib2fvNV ; .type glVertexAttrib2fvNV,#function
-               .globl glVertexAttrib2sNV ; .type glVertexAttrib2sNV,#function
-               .globl glVertexAttrib2svNV ; .type glVertexAttrib2svNV,#function
-               .globl glVertexAttrib3dNV ; .type glVertexAttrib3dNV,#function
-               .globl glVertexAttrib3dvNV ; .type glVertexAttrib3dvNV,#function
-               .globl glVertexAttrib3fNV ; .type glVertexAttrib3fNV,#function
-               .globl glVertexAttrib3fvNV ; .type glVertexAttrib3fvNV,#function
-               .globl glVertexAttrib3sNV ; .type glVertexAttrib3sNV,#function
-               .globl glVertexAttrib3svNV ; .type glVertexAttrib3svNV,#function
-               .globl glVertexAttrib4dNV ; .type glVertexAttrib4dNV,#function
-               .globl glVertexAttrib4dvNV ; .type glVertexAttrib4dvNV,#function
-               .globl glVertexAttrib4fNV ; .type glVertexAttrib4fNV,#function
-               .globl glVertexAttrib4fvNV ; .type glVertexAttrib4fvNV,#function
-               .globl glVertexAttrib4sNV ; .type glVertexAttrib4sNV,#function
-               .globl glVertexAttrib4svNV ; .type glVertexAttrib4svNV,#function
-               .globl glVertexAttrib4ubNV ; .type glVertexAttrib4ubNV,#function
-               .globl glVertexAttrib4ubvNV ; .type glVertexAttrib4ubvNV,#function
-               .globl glVertexAttribPointerNV ; .type glVertexAttribPointerNV,#function
-               .globl glVertexAttribs1dvNV ; .type glVertexAttribs1dvNV,#function
-               .globl glVertexAttribs1fvNV ; .type glVertexAttribs1fvNV,#function
-               .globl glVertexAttribs1svNV ; .type glVertexAttribs1svNV,#function
-               .globl glVertexAttribs2dvNV ; .type glVertexAttribs2dvNV,#function
-               .globl glVertexAttribs2fvNV ; .type glVertexAttribs2fvNV,#function
-               .globl glVertexAttribs2svNV ; .type glVertexAttribs2svNV,#function
-               .globl glVertexAttribs3dvNV ; .type glVertexAttribs3dvNV,#function
-               .globl glVertexAttribs3fvNV ; .type glVertexAttribs3fvNV,#function
-               .globl glVertexAttribs3svNV ; .type glVertexAttribs3svNV,#function
-               .globl glVertexAttribs4dvNV ; .type glVertexAttribs4dvNV,#function
-               .globl glVertexAttribs4fvNV ; .type glVertexAttribs4fvNV,#function
-               .globl glVertexAttribs4svNV ; .type glVertexAttribs4svNV,#function
-               .globl glVertexAttribs4ubvNV ; .type glVertexAttribs4ubvNV,#function
-               .globl glAlphaFragmentOp1ATI ; .type glAlphaFragmentOp1ATI,#function
-               .globl glAlphaFragmentOp2ATI ; .type glAlphaFragmentOp2ATI,#function
-               .globl glAlphaFragmentOp3ATI ; .type glAlphaFragmentOp3ATI,#function
-               .globl glBeginFragmentShaderATI ; .type glBeginFragmentShaderATI,#function
-               .globl glBindFragmentShaderATI ; .type glBindFragmentShaderATI,#function
-               .globl glColorFragmentOp1ATI ; .type glColorFragmentOp1ATI,#function
-               .globl glColorFragmentOp2ATI ; .type glColorFragmentOp2ATI,#function
-               .globl glColorFragmentOp3ATI ; .type glColorFragmentOp3ATI,#function
-               .globl glDeleteFragmentShaderATI ; .type glDeleteFragmentShaderATI,#function
-               .globl glEndFragmentShaderATI ; .type glEndFragmentShaderATI,#function
-               .globl glGenFragmentShadersATI ; .type glGenFragmentShadersATI,#function
-               .globl glPassTexCoordATI ; .type glPassTexCoordATI,#function
-               .globl glSampleMapATI ; .type glSampleMapATI,#function
-               .globl glSetFragmentShaderConstantATI ; .type glSetFragmentShaderConstantATI,#function
-               .globl glPointParameteriNV ; .type glPointParameteriNV,#function
-               .globl glPointParameterivNV ; .type glPointParameterivNV,#function
-               .globl gl_dispatch_stub_734 ; .type gl_dispatch_stub_734,#function
-               .globl gl_dispatch_stub_735 ; .type gl_dispatch_stub_735,#function
-               .globl gl_dispatch_stub_736 ; .type gl_dispatch_stub_736,#function
-               .globl gl_dispatch_stub_737 ; .type gl_dispatch_stub_737,#function
-               .globl gl_dispatch_stub_738 ; .type gl_dispatch_stub_738,#function
-               .globl glGetProgramNamedParameterdvNV ; .type glGetProgramNamedParameterdvNV,#function
-               .globl glGetProgramNamedParameterfvNV ; .type glGetProgramNamedParameterfvNV,#function
-               .globl glProgramNamedParameter4dNV ; .type glProgramNamedParameter4dNV,#function
-               .globl glProgramNamedParameter4dvNV ; .type glProgramNamedParameter4dvNV,#function
-               .globl glProgramNamedParameter4fNV ; .type glProgramNamedParameter4fNV,#function
-               .globl glProgramNamedParameter4fvNV ; .type glProgramNamedParameter4fvNV,#function
-               .globl gl_dispatch_stub_745 ; .type gl_dispatch_stub_745,#function
-               .globl gl_dispatch_stub_746 ; .type gl_dispatch_stub_746,#function
-               .globl glBindFramebufferEXT ; .type glBindFramebufferEXT,#function
-               .globl glBindRenderbufferEXT ; .type glBindRenderbufferEXT,#function
-               .globl glCheckFramebufferStatusEXT ; .type glCheckFramebufferStatusEXT,#function
-               .globl glDeleteFramebuffersEXT ; .type glDeleteFramebuffersEXT,#function
-               .globl glDeleteRenderbuffersEXT ; .type glDeleteRenderbuffersEXT,#function
-               .globl glFramebufferRenderbufferEXT ; .type glFramebufferRenderbufferEXT,#function
-               .globl glFramebufferTexture1DEXT ; .type glFramebufferTexture1DEXT,#function
-               .globl glFramebufferTexture2DEXT ; .type glFramebufferTexture2DEXT,#function
-               .globl glFramebufferTexture3DEXT ; .type glFramebufferTexture3DEXT,#function
-               .globl glGenFramebuffersEXT ; .type glGenFramebuffersEXT,#function
-               .globl glGenRenderbuffersEXT ; .type glGenRenderbuffersEXT,#function
-               .globl glGenerateMipmapEXT ; .type glGenerateMipmapEXT,#function
-               .globl glGetFramebufferAttachmentParameterivEXT ; .type glGetFramebufferAttachmentParameterivEXT,#function
-               .globl glGetRenderbufferParameterivEXT ; .type glGetRenderbufferParameterivEXT,#function
-               .globl glIsFramebufferEXT ; .type glIsFramebufferEXT,#function
-               .globl glIsRenderbufferEXT ; .type glIsRenderbufferEXT,#function
-               .globl glRenderbufferStorageEXT ; .type glRenderbufferStorageEXT,#function
-               .globl gl_dispatch_stub_764 ; .type gl_dispatch_stub_764,#function
-               .globl glFramebufferTextureLayerEXT ; .type glFramebufferTextureLayerEXT,#function
-               .globl gl_dispatch_stub_766 ; .type gl_dispatch_stub_766,#function
-               .globl gl_dispatch_stub_767 ; .type gl_dispatch_stub_767,#function
-               .globl gl_dispatch_stub_768 ; .type gl_dispatch_stub_768,#function
-               .globl gl_dispatch_stub_769 ; .type gl_dispatch_stub_769,#function
-               .globl gl_dispatch_stub_770 ; .type gl_dispatch_stub_770,#function
-               .globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function
-_mesa_sparc_glapi_begin:
+       .data
+       .align  32
+
+       GLOBL_FN(__glapi_sparc_pthread_stub)
+       HIDDEN(__glapi_sparc_pthread_stub)
+__glapi_sparc_pthread_stub: /* Call offset in %g3 */
+       mov     %o7, %g1
+       sethi   %hi(_GLOBAL_OFFSET_TABLE_-4), %g2
+       call    __glapi_sparc_get_pc
+        add    %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2
+       mov     %g1, %o7
+       sethi   %hi(_glapi_Dispatch), %g1
+       or      %g1, %lo(_glapi_Dispatch), %g1
+       srl     %g3, 10, %g3
+       GL_LL   [%g2+%g1], %g2
+       GL_LL   [%g2], %g1
+       cmp     %g1, 0
+       be      2f
+        nop
+1:     GL_LL   [%g1 + %g3], %g1
+       jmp     %g1
+        nop
+2:     save    %sp, GL_STACK_SIZE, %sp
+       mov     %g3, %l0
+       call    _glapi_get_dispatch
+        nop
+       mov     %o0, %g1
+       mov     %l0, %g3
+       ba      1b
+        restore %g0, %g0, %g0
+       .size   __glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub
+
+#define GL_STUB(fn, off)                       \
+       GLOBL_FN(fn);                           \
+fn:    ba      __glapi_sparc_pthread_stub;     \
+        sethi  GL_OFF(off), %g3;               \
+       .size   fn,.-fn;
+
+#else /* Non-threaded version. */
+
+       .type   __glapi_sparc_nothread_stub, @function
+__glapi_sparc_nothread_stub: /* Call offset in %g3 */
+       mov     %o7, %g1
+       sethi   %hi(_GLOBAL_OFFSET_TABLE_-4), %g2
+       call    __glapi_sparc_get_pc
+        add    %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2
+       mov     %g1, %o7
+       srl     %g3, 10, %g3
+       sethi   %hi(_glapi_Dispatch), %g1
+       or      %g1, %lo(_glapi_Dispatch), %g1
+       GL_LL   [%g2+%g1], %g2
+       GL_LL   [%g2], %g1
+       GL_LL   [%g1 + %g3], %g1
+       jmp     %g1
+        nop
+       .size   __glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub
+
+#define GL_STUB(fn, off)                       \
+       GLOBL_FN(fn);                           \
+fn:    ba      __glapi_sparc_nothread_stub;    \
+        sethi  GL_OFF(off), %g3;               \
+       .size   fn,.-fn;
+
+#endif
+
+#define GL_STUB_ALIAS(fn, alias)               \
+       .globl  fn;                             \
+       .set    fn, alias
+
+       .text
+       .align  32
+
+       .globl  gl_dispatch_functions_start
+       HIDDEN(gl_dispatch_functions_start)
+gl_dispatch_functions_start:
 
        GL_STUB(glNewList, _gloffset_NewList)
        GL_STUB(glEndList, _gloffset_EndList)
@@ -1402,14 +760,22 @@ _mesa_sparc_glapi_begin:
        GL_STUB(glDrawBuffersARB, _gloffset_DrawBuffersARB)
        GL_STUB(glRenderbufferStorageMultisample, _gloffset_RenderbufferStorageMultisample)
        GL_STUB(glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT)
-       GL_STUB(gl_dispatch_stub_563, _gloffset__dispatch_stub_563)
-       GL_STUB(gl_dispatch_stub_564, _gloffset__dispatch_stub_564)
-       GL_STUB(gl_dispatch_stub_565, _gloffset__dispatch_stub_565)
-       GL_STUB(gl_dispatch_stub_566, _gloffset__dispatch_stub_566)
-       GL_STUB(gl_dispatch_stub_567, _gloffset__dispatch_stub_567)
-       GL_STUB(gl_dispatch_stub_568, _gloffset__dispatch_stub_568)
-       GL_STUB(gl_dispatch_stub_569, _gloffset__dispatch_stub_569)
-       GL_STUB(gl_dispatch_stub_570, _gloffset__dispatch_stub_570)
+       GL_STUB(gl_dispatch_stub_563, _gloffset_GetPixelTexGenParameterfvSGIS)
+       HIDDEN(gl_dispatch_stub_563)
+       GL_STUB(gl_dispatch_stub_564, _gloffset_GetPixelTexGenParameterivSGIS)
+       HIDDEN(gl_dispatch_stub_564)
+       GL_STUB(gl_dispatch_stub_565, _gloffset_PixelTexGenParameterfSGIS)
+       HIDDEN(gl_dispatch_stub_565)
+       GL_STUB(gl_dispatch_stub_566, _gloffset_PixelTexGenParameterfvSGIS)
+       HIDDEN(gl_dispatch_stub_566)
+       GL_STUB(gl_dispatch_stub_567, _gloffset_PixelTexGenParameteriSGIS)
+       HIDDEN(gl_dispatch_stub_567)
+       GL_STUB(gl_dispatch_stub_568, _gloffset_PixelTexGenParameterivSGIS)
+       HIDDEN(gl_dispatch_stub_568)
+       GL_STUB(gl_dispatch_stub_569, _gloffset_SampleMaskSGIS)
+       HIDDEN(gl_dispatch_stub_569)
+       GL_STUB(gl_dispatch_stub_570, _gloffset_SamplePatternSGIS)
+       HIDDEN(gl_dispatch_stub_570)
        GL_STUB(glColorPointerEXT, _gloffset_ColorPointerEXT)
        GL_STUB(glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT)
        GL_STUB(glIndexPointerEXT, _gloffset_IndexPointerEXT)
@@ -1420,8 +786,10 @@ _mesa_sparc_glapi_begin:
        GL_STUB(glPointParameterfvEXT, _gloffset_PointParameterfvEXT)
        GL_STUB(glLockArraysEXT, _gloffset_LockArraysEXT)
        GL_STUB(glUnlockArraysEXT, _gloffset_UnlockArraysEXT)
-       GL_STUB(gl_dispatch_stub_581, _gloffset__dispatch_stub_581)
-       GL_STUB(gl_dispatch_stub_582, _gloffset__dispatch_stub_582)
+       GL_STUB(gl_dispatch_stub_581, _gloffset_CullParameterdvEXT)
+       HIDDEN(gl_dispatch_stub_581)
+       GL_STUB(gl_dispatch_stub_582, _gloffset_CullParameterfvEXT)
+       HIDDEN(gl_dispatch_stub_582)
        GL_STUB(glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT)
        GL_STUB(glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT)
        GL_STUB(glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT)
@@ -1446,7 +814,8 @@ _mesa_sparc_glapi_begin:
        GL_STUB(glFogCoorddvEXT, _gloffset_FogCoorddvEXT)
        GL_STUB(glFogCoordfEXT, _gloffset_FogCoordfEXT)
        GL_STUB(glFogCoordfvEXT, _gloffset_FogCoordfvEXT)
-       GL_STUB(gl_dispatch_stub_607, _gloffset__dispatch_stub_607)
+       GL_STUB(gl_dispatch_stub_607, _gloffset_PixelTexGenSGIX)
+       HIDDEN(gl_dispatch_stub_607)
        GL_STUB(glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT)
        GL_STUB(glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV)
        GL_STUB(glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV)
@@ -1488,15 +857,24 @@ _mesa_sparc_glapi_begin:
        GL_STUB(glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA)
        GL_STUB(glWindowPos4sMESA, _gloffset_WindowPos4sMESA)
        GL_STUB(glWindowPos4svMESA, _gloffset_WindowPos4svMESA)
-       GL_STUB(gl_dispatch_stub_649, _gloffset__dispatch_stub_649)
-       GL_STUB(gl_dispatch_stub_650, _gloffset__dispatch_stub_650)
-       GL_STUB(gl_dispatch_stub_651, _gloffset__dispatch_stub_651)
-       GL_STUB(gl_dispatch_stub_652, _gloffset__dispatch_stub_652)
-       GL_STUB(gl_dispatch_stub_653, _gloffset__dispatch_stub_653)
-       GL_STUB(gl_dispatch_stub_654, _gloffset__dispatch_stub_654)
-       GL_STUB(gl_dispatch_stub_655, _gloffset__dispatch_stub_655)
-       GL_STUB(gl_dispatch_stub_656, _gloffset__dispatch_stub_656)
-       GL_STUB(gl_dispatch_stub_657, _gloffset__dispatch_stub_657)
+       GL_STUB(gl_dispatch_stub_649, _gloffset_MultiModeDrawArraysIBM)
+       HIDDEN(gl_dispatch_stub_649)
+       GL_STUB(gl_dispatch_stub_650, _gloffset_MultiModeDrawElementsIBM)
+       HIDDEN(gl_dispatch_stub_650)
+       GL_STUB(gl_dispatch_stub_651, _gloffset_DeleteFencesNV)
+       HIDDEN(gl_dispatch_stub_651)
+       GL_STUB(gl_dispatch_stub_652, _gloffset_FinishFenceNV)
+       HIDDEN(gl_dispatch_stub_652)
+       GL_STUB(gl_dispatch_stub_653, _gloffset_GenFencesNV)
+       HIDDEN(gl_dispatch_stub_653)
+       GL_STUB(gl_dispatch_stub_654, _gloffset_GetFenceivNV)
+       HIDDEN(gl_dispatch_stub_654)
+       GL_STUB(gl_dispatch_stub_655, _gloffset_IsFenceNV)
+       HIDDEN(gl_dispatch_stub_655)
+       GL_STUB(gl_dispatch_stub_656, _gloffset_SetFenceNV)
+       HIDDEN(gl_dispatch_stub_656)
+       GL_STUB(gl_dispatch_stub_657, _gloffset_TestFenceNV)
+       HIDDEN(gl_dispatch_stub_657)
        GL_STUB(glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV)
        GL_STUB(glBindProgramNV, _gloffset_BindProgramNV)
        GL_STUB(glDeleteProgramsNV, _gloffset_DeleteProgramsNV)
@@ -1557,6 +935,10 @@ _mesa_sparc_glapi_begin:
        GL_STUB(glVertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV)
        GL_STUB(glVertexAttribs4svNV, _gloffset_VertexAttribs4svNV)
        GL_STUB(glVertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV)
+       GL_STUB(glGetTexBumpParameterfvATI, _gloffset_GetTexBumpParameterfvATI)
+       GL_STUB(glGetTexBumpParameterivATI, _gloffset_GetTexBumpParameterivATI)
+       GL_STUB(glTexBumpParameterfvATI, _gloffset_TexBumpParameterfvATI)
+       GL_STUB(glTexBumpParameterivATI, _gloffset_TexBumpParameterivATI)
        GL_STUB(glAlphaFragmentOp1ATI, _gloffset_AlphaFragmentOp1ATI)
        GL_STUB(glAlphaFragmentOp2ATI, _gloffset_AlphaFragmentOp2ATI)
        GL_STUB(glAlphaFragmentOp3ATI, _gloffset_AlphaFragmentOp3ATI)
@@ -1573,19 +955,26 @@ _mesa_sparc_glapi_begin:
        GL_STUB(glSetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI)
        GL_STUB(glPointParameteriNV, _gloffset_PointParameteriNV)
        GL_STUB(glPointParameterivNV, _gloffset_PointParameterivNV)
-       GL_STUB(gl_dispatch_stub_734, _gloffset__dispatch_stub_734)
-       GL_STUB(gl_dispatch_stub_735, _gloffset__dispatch_stub_735)
-       GL_STUB(gl_dispatch_stub_736, _gloffset__dispatch_stub_736)
-       GL_STUB(gl_dispatch_stub_737, _gloffset__dispatch_stub_737)
-       GL_STUB(gl_dispatch_stub_738, _gloffset__dispatch_stub_738)
+       GL_STUB(gl_dispatch_stub_738, _gloffset_ActiveStencilFaceEXT)
+       HIDDEN(gl_dispatch_stub_738)
+       GL_STUB(gl_dispatch_stub_739, _gloffset_BindVertexArrayAPPLE)
+       HIDDEN(gl_dispatch_stub_739)
+       GL_STUB(gl_dispatch_stub_740, _gloffset_DeleteVertexArraysAPPLE)
+       HIDDEN(gl_dispatch_stub_740)
+       GL_STUB(gl_dispatch_stub_741, _gloffset_GenVertexArraysAPPLE)
+       HIDDEN(gl_dispatch_stub_741)
+       GL_STUB(gl_dispatch_stub_742, _gloffset_IsVertexArrayAPPLE)
+       HIDDEN(gl_dispatch_stub_742)
        GL_STUB(glGetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV)
        GL_STUB(glGetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV)
        GL_STUB(glProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV)
        GL_STUB(glProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV)
        GL_STUB(glProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV)
        GL_STUB(glProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV)
-       GL_STUB(gl_dispatch_stub_745, _gloffset__dispatch_stub_745)
-       GL_STUB(gl_dispatch_stub_746, _gloffset__dispatch_stub_746)
+       GL_STUB(gl_dispatch_stub_749, _gloffset_DepthBoundsEXT)
+       HIDDEN(gl_dispatch_stub_749)
+       GL_STUB(gl_dispatch_stub_750, _gloffset_BlendEquationSeparateEXT)
+       HIDDEN(gl_dispatch_stub_750)
        GL_STUB(glBindFramebufferEXT, _gloffset_BindFramebufferEXT)
        GL_STUB(glBindRenderbufferEXT, _gloffset_BindRenderbufferEXT)
        GL_STUB(glCheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT)
@@ -1603,287 +992,353 @@ _mesa_sparc_glapi_begin:
        GL_STUB(glIsFramebufferEXT, _gloffset_IsFramebufferEXT)
        GL_STUB(glIsRenderbufferEXT, _gloffset_IsRenderbufferEXT)
        GL_STUB(glRenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT)
-       GL_STUB(gl_dispatch_stub_764, _gloffset__dispatch_stub_764)
+       GL_STUB(gl_dispatch_stub_768, _gloffset_BlitFramebufferEXT)
+       HIDDEN(gl_dispatch_stub_768)
        GL_STUB(glFramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT)
-       GL_STUB(gl_dispatch_stub_766, _gloffset__dispatch_stub_766)
-       GL_STUB(gl_dispatch_stub_767, _gloffset__dispatch_stub_767)
-       GL_STUB(gl_dispatch_stub_768, _gloffset__dispatch_stub_768)
-       GL_STUB(gl_dispatch_stub_769, _gloffset__dispatch_stub_769)
-       GL_STUB(gl_dispatch_stub_770, _gloffset__dispatch_stub_770)
-
-               .globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function
-_mesa_sparc_glapi_end:
-
-       .globl glArrayElementEXT ; .type glArrayElementEXT,#function ; glArrayElementEXT = glArrayElement
-       .globl glBindTextureEXT ; .type glBindTextureEXT,#function ; glBindTextureEXT = glBindTexture
-       .globl glDrawArraysEXT ; .type glDrawArraysEXT,#function ; glDrawArraysEXT = glDrawArrays
+       GL_STUB(gl_dispatch_stub_770, _gloffset_StencilFuncSeparateATI)
+       HIDDEN(gl_dispatch_stub_770)
+       GL_STUB(gl_dispatch_stub_771, _gloffset_ProgramEnvParameters4fvEXT)
+       HIDDEN(gl_dispatch_stub_771)
+       GL_STUB(gl_dispatch_stub_772, _gloffset_ProgramLocalParameters4fvEXT)
+       HIDDEN(gl_dispatch_stub_772)
+       GL_STUB(gl_dispatch_stub_773, _gloffset_GetQueryObjecti64vEXT)
+       HIDDEN(gl_dispatch_stub_773)
+       GL_STUB(gl_dispatch_stub_774, _gloffset_GetQueryObjectui64vEXT)
+       HIDDEN(gl_dispatch_stub_774)
+       GL_STUB_ALIAS(glArrayElementEXT, glArrayElement)
+       GL_STUB_ALIAS(glBindTextureEXT, glBindTexture)
+       GL_STUB_ALIAS(glDrawArraysEXT, glDrawArrays)
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glAreTexturesResidentEXT, glAreTexturesResident)
+#endif
+       GL_STUB_ALIAS(glCopyTexImage1DEXT, glCopyTexImage1D)
+       GL_STUB_ALIAS(glCopyTexImage2DEXT, glCopyTexImage2D)
+       GL_STUB_ALIAS(glCopyTexSubImage1DEXT, glCopyTexSubImage1D)
+       GL_STUB_ALIAS(glCopyTexSubImage2DEXT, glCopyTexSubImage2D)
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glDeleteTexturesEXT, glDeleteTextures)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glGenTexturesEXT, glGenTextures)
+#endif
+       GL_STUB_ALIAS(glGetPointervEXT, glGetPointerv)
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glIsTextureEXT, glIsTexture)
+#endif
+       GL_STUB_ALIAS(glPrioritizeTexturesEXT, glPrioritizeTextures)
+       GL_STUB_ALIAS(glTexSubImage1DEXT, glTexSubImage1D)
+       GL_STUB_ALIAS(glTexSubImage2DEXT, glTexSubImage2D)
+       GL_STUB_ALIAS(glBlendColorEXT, glBlendColor)
+       GL_STUB_ALIAS(glBlendEquationEXT, glBlendEquation)
+       GL_STUB_ALIAS(glDrawRangeElementsEXT, glDrawRangeElements)
+       GL_STUB_ALIAS(glColorTableSGI, glColorTable)
+       GL_STUB_ALIAS(glColorTableEXT, glColorTable)
+       GL_STUB_ALIAS(glColorTableParameterfvSGI, glColorTableParameterfv)
+       GL_STUB_ALIAS(glColorTableParameterivSGI, glColorTableParameteriv)
+       GL_STUB_ALIAS(glCopyColorTableSGI, glCopyColorTable)
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glGetColorTableSGI, glGetColorTable)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glGetColorTableEXT, glGetColorTable)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glGetColorTableParameterfvSGI, glGetColorTableParameterfv)
+#endif
 #ifndef GLX_INDIRECT_RENDERING
-       .globl glAreTexturesResidentEXT ; .type glAreTexturesResidentEXT,#function ; glAreTexturesResidentEXT = glAreTexturesResident
+       GL_STUB_ALIAS(glGetColorTableParameterfvEXT, glGetColorTableParameterfv)
 #endif
-       .globl glCopyTexImage1DEXT ; .type glCopyTexImage1DEXT,#function ; glCopyTexImage1DEXT = glCopyTexImage1D
-       .globl glCopyTexImage2DEXT ; .type glCopyTexImage2DEXT,#function ; glCopyTexImage2DEXT = glCopyTexImage2D
-       .globl glCopyTexSubImage1DEXT ; .type glCopyTexSubImage1DEXT,#function ; glCopyTexSubImage1DEXT = glCopyTexSubImage1D
-       .globl glCopyTexSubImage2DEXT ; .type glCopyTexSubImage2DEXT,#function ; glCopyTexSubImage2DEXT = glCopyTexSubImage2D
 #ifndef GLX_INDIRECT_RENDERING
-       .globl glDeleteTexturesEXT ; .type glDeleteTexturesEXT,#function ; glDeleteTexturesEXT = glDeleteTextures
+       GL_STUB_ALIAS(glGetColorTableParameterivSGI, glGetColorTableParameteriv)
 #endif
 #ifndef GLX_INDIRECT_RENDERING
-       .globl glGenTexturesEXT ; .type glGenTexturesEXT,#function ; glGenTexturesEXT = glGenTextures
+       GL_STUB_ALIAS(glGetColorTableParameterivEXT, glGetColorTableParameteriv)
 #endif
-       .globl glGetPointervEXT ; .type glGetPointervEXT,#function ; glGetPointervEXT = glGetPointerv
+       GL_STUB_ALIAS(glColorSubTableEXT, glColorSubTable)
+       GL_STUB_ALIAS(glCopyColorSubTableEXT, glCopyColorSubTable)
+       GL_STUB_ALIAS(glConvolutionFilter1DEXT, glConvolutionFilter1D)
+       GL_STUB_ALIAS(glConvolutionFilter2DEXT, glConvolutionFilter2D)
+       GL_STUB_ALIAS(glConvolutionParameterfEXT, glConvolutionParameterf)
+       GL_STUB_ALIAS(glConvolutionParameterfvEXT, glConvolutionParameterfv)
+       GL_STUB_ALIAS(glConvolutionParameteriEXT, glConvolutionParameteri)
+       GL_STUB_ALIAS(glConvolutionParameterivEXT, glConvolutionParameteriv)
+       GL_STUB_ALIAS(glCopyConvolutionFilter1DEXT, glCopyConvolutionFilter1D)
+       GL_STUB_ALIAS(glCopyConvolutionFilter2DEXT, glCopyConvolutionFilter2D)
 #ifndef GLX_INDIRECT_RENDERING
-       .globl glIsTextureEXT ; .type glIsTextureEXT,#function ; glIsTextureEXT = glIsTexture
+       GL_STUB_ALIAS(glGetConvolutionFilterEXT, glGetConvolutionFilter)
 #endif
-       .globl glPrioritizeTexturesEXT ; .type glPrioritizeTexturesEXT,#function ; glPrioritizeTexturesEXT = glPrioritizeTextures
-       .globl glTexSubImage1DEXT ; .type glTexSubImage1DEXT,#function ; glTexSubImage1DEXT = glTexSubImage1D
-       .globl glTexSubImage2DEXT ; .type glTexSubImage2DEXT,#function ; glTexSubImage2DEXT = glTexSubImage2D
-       .globl glBlendColorEXT ; .type glBlendColorEXT,#function ; glBlendColorEXT = glBlendColor
-       .globl glBlendEquationEXT ; .type glBlendEquationEXT,#function ; glBlendEquationEXT = glBlendEquation
-       .globl glDrawRangeElementsEXT ; .type glDrawRangeElementsEXT,#function ; glDrawRangeElementsEXT = glDrawRangeElements
-       .globl glColorTableEXT ; .type glColorTableEXT,#function ; glColorTableEXT = glColorTable
 #ifndef GLX_INDIRECT_RENDERING
-       .globl glGetColorTableEXT ; .type glGetColorTableEXT,#function ; glGetColorTableEXT = glGetColorTable
+       GL_STUB_ALIAS(glGetConvolutionParameterfvEXT, glGetConvolutionParameterfv)
 #endif
 #ifndef GLX_INDIRECT_RENDERING
-       .globl glGetColorTableParameterfvEXT ; .type glGetColorTableParameterfvEXT,#function ; glGetColorTableParameterfvEXT = glGetColorTableParameterfv
+       GL_STUB_ALIAS(glGetConvolutionParameterivEXT, glGetConvolutionParameteriv)
 #endif
 #ifndef GLX_INDIRECT_RENDERING
-       .globl glGetColorTableParameterivEXT ; .type glGetColorTableParameterivEXT,#function ; glGetColorTableParameterivEXT = glGetColorTableParameteriv
+       GL_STUB_ALIAS(glGetSeparableFilterEXT, glGetSeparableFilter)
 #endif
-       .globl glTexImage3DEXT ; .type glTexImage3DEXT,#function ; glTexImage3DEXT = glTexImage3D
-       .globl glTexSubImage3DEXT ; .type glTexSubImage3DEXT,#function ; glTexSubImage3DEXT = glTexSubImage3D
-       .globl glCopyTexSubImage3DEXT ; .type glCopyTexSubImage3DEXT,#function ; glCopyTexSubImage3DEXT = glCopyTexSubImage3D
-       .globl glActiveTexture ; .type glActiveTexture,#function ; glActiveTexture = glActiveTextureARB
-       .globl glClientActiveTexture ; .type glClientActiveTexture,#function ; glClientActiveTexture = glClientActiveTextureARB
-       .globl glMultiTexCoord1d ; .type glMultiTexCoord1d,#function ; glMultiTexCoord1d = glMultiTexCoord1dARB
-       .globl glMultiTexCoord1dv ; .type glMultiTexCoord1dv,#function ; glMultiTexCoord1dv = glMultiTexCoord1dvARB
-       .globl glMultiTexCoord1f ; .type glMultiTexCoord1f,#function ; glMultiTexCoord1f = glMultiTexCoord1fARB
-       .globl glMultiTexCoord1fv ; .type glMultiTexCoord1fv,#function ; glMultiTexCoord1fv = glMultiTexCoord1fvARB
-       .globl glMultiTexCoord1i ; .type glMultiTexCoord1i,#function ; glMultiTexCoord1i = glMultiTexCoord1iARB
-       .globl glMultiTexCoord1iv ; .type glMultiTexCoord1iv,#function ; glMultiTexCoord1iv = glMultiTexCoord1ivARB
-       .globl glMultiTexCoord1s ; .type glMultiTexCoord1s,#function ; glMultiTexCoord1s = glMultiTexCoord1sARB
-       .globl glMultiTexCoord1sv ; .type glMultiTexCoord1sv,#function ; glMultiTexCoord1sv = glMultiTexCoord1svARB
-       .globl glMultiTexCoord2d ; .type glMultiTexCoord2d,#function ; glMultiTexCoord2d = glMultiTexCoord2dARB
-       .globl glMultiTexCoord2dv ; .type glMultiTexCoord2dv,#function ; glMultiTexCoord2dv = glMultiTexCoord2dvARB
-       .globl glMultiTexCoord2f ; .type glMultiTexCoord2f,#function ; glMultiTexCoord2f = glMultiTexCoord2fARB
-       .globl glMultiTexCoord2fv ; .type glMultiTexCoord2fv,#function ; glMultiTexCoord2fv = glMultiTexCoord2fvARB
-       .globl glMultiTexCoord2i ; .type glMultiTexCoord2i,#function ; glMultiTexCoord2i = glMultiTexCoord2iARB
-       .globl glMultiTexCoord2iv ; .type glMultiTexCoord2iv,#function ; glMultiTexCoord2iv = glMultiTexCoord2ivARB
-       .globl glMultiTexCoord2s ; .type glMultiTexCoord2s,#function ; glMultiTexCoord2s = glMultiTexCoord2sARB
-       .globl glMultiTexCoord2sv ; .type glMultiTexCoord2sv,#function ; glMultiTexCoord2sv = glMultiTexCoord2svARB
-       .globl glMultiTexCoord3d ; .type glMultiTexCoord3d,#function ; glMultiTexCoord3d = glMultiTexCoord3dARB
-       .globl glMultiTexCoord3dv ; .type glMultiTexCoord3dv,#function ; glMultiTexCoord3dv = glMultiTexCoord3dvARB
-       .globl glMultiTexCoord3f ; .type glMultiTexCoord3f,#function ; glMultiTexCoord3f = glMultiTexCoord3fARB
-       .globl glMultiTexCoord3fv ; .type glMultiTexCoord3fv,#function ; glMultiTexCoord3fv = glMultiTexCoord3fvARB
-       .globl glMultiTexCoord3i ; .type glMultiTexCoord3i,#function ; glMultiTexCoord3i = glMultiTexCoord3iARB
-       .globl glMultiTexCoord3iv ; .type glMultiTexCoord3iv,#function ; glMultiTexCoord3iv = glMultiTexCoord3ivARB
-       .globl glMultiTexCoord3s ; .type glMultiTexCoord3s,#function ; glMultiTexCoord3s = glMultiTexCoord3sARB
-       .globl glMultiTexCoord3sv ; .type glMultiTexCoord3sv,#function ; glMultiTexCoord3sv = glMultiTexCoord3svARB
-       .globl glMultiTexCoord4d ; .type glMultiTexCoord4d,#function ; glMultiTexCoord4d = glMultiTexCoord4dARB
-       .globl glMultiTexCoord4dv ; .type glMultiTexCoord4dv,#function ; glMultiTexCoord4dv = glMultiTexCoord4dvARB
-       .globl glMultiTexCoord4f ; .type glMultiTexCoord4f,#function ; glMultiTexCoord4f = glMultiTexCoord4fARB
-       .globl glMultiTexCoord4fv ; .type glMultiTexCoord4fv,#function ; glMultiTexCoord4fv = glMultiTexCoord4fvARB
-       .globl glMultiTexCoord4i ; .type glMultiTexCoord4i,#function ; glMultiTexCoord4i = glMultiTexCoord4iARB
-       .globl glMultiTexCoord4iv ; .type glMultiTexCoord4iv,#function ; glMultiTexCoord4iv = glMultiTexCoord4ivARB
-       .globl glMultiTexCoord4s ; .type glMultiTexCoord4s,#function ; glMultiTexCoord4s = glMultiTexCoord4sARB
-       .globl glMultiTexCoord4sv ; .type glMultiTexCoord4sv,#function ; glMultiTexCoord4sv = glMultiTexCoord4svARB
-       .globl glLoadTransposeMatrixd ; .type glLoadTransposeMatrixd,#function ; glLoadTransposeMatrixd = glLoadTransposeMatrixdARB
-       .globl glLoadTransposeMatrixf ; .type glLoadTransposeMatrixf,#function ; glLoadTransposeMatrixf = glLoadTransposeMatrixfARB
-       .globl glMultTransposeMatrixd ; .type glMultTransposeMatrixd,#function ; glMultTransposeMatrixd = glMultTransposeMatrixdARB
-       .globl glMultTransposeMatrixf ; .type glMultTransposeMatrixf,#function ; glMultTransposeMatrixf = glMultTransposeMatrixfARB
-       .globl glSampleCoverage ; .type glSampleCoverage,#function ; glSampleCoverage = glSampleCoverageARB
-       .globl glCompressedTexImage1D ; .type glCompressedTexImage1D,#function ; glCompressedTexImage1D = glCompressedTexImage1DARB
-       .globl glCompressedTexImage2D ; .type glCompressedTexImage2D,#function ; glCompressedTexImage2D = glCompressedTexImage2DARB
-       .globl glCompressedTexImage3D ; .type glCompressedTexImage3D,#function ; glCompressedTexImage3D = glCompressedTexImage3DARB
-       .globl glCompressedTexSubImage1D ; .type glCompressedTexSubImage1D,#function ; glCompressedTexSubImage1D = glCompressedTexSubImage1DARB
-       .globl glCompressedTexSubImage2D ; .type glCompressedTexSubImage2D,#function ; glCompressedTexSubImage2D = glCompressedTexSubImage2DARB
-       .globl glCompressedTexSubImage3D ; .type glCompressedTexSubImage3D,#function ; glCompressedTexSubImage3D = glCompressedTexSubImage3DARB
-       .globl glGetCompressedTexImage ; .type glGetCompressedTexImage,#function ; glGetCompressedTexImage = glGetCompressedTexImageARB
-       .globl glDisableVertexAttribArray ; .type glDisableVertexAttribArray,#function ; glDisableVertexAttribArray = glDisableVertexAttribArrayARB
-       .globl glEnableVertexAttribArray ; .type glEnableVertexAttribArray,#function ; glEnableVertexAttribArray = glEnableVertexAttribArrayARB
-       .globl glGetVertexAttribdv ; .type glGetVertexAttribdv,#function ; glGetVertexAttribdv = glGetVertexAttribdvARB
-       .globl glGetVertexAttribfv ; .type glGetVertexAttribfv,#function ; glGetVertexAttribfv = glGetVertexAttribfvARB
-       .globl glGetVertexAttribiv ; .type glGetVertexAttribiv,#function ; glGetVertexAttribiv = glGetVertexAttribivARB
-       .globl glProgramParameter4dNV ; .type glProgramParameter4dNV,#function ; glProgramParameter4dNV = glProgramEnvParameter4dARB
-       .globl glProgramParameter4dvNV ; .type glProgramParameter4dvNV,#function ; glProgramParameter4dvNV = glProgramEnvParameter4dvARB
-       .globl glProgramParameter4fNV ; .type glProgramParameter4fNV,#function ; glProgramParameter4fNV = glProgramEnvParameter4fARB
-       .globl glProgramParameter4fvNV ; .type glProgramParameter4fvNV,#function ; glProgramParameter4fvNV = glProgramEnvParameter4fvARB
-       .globl glVertexAttrib1d ; .type glVertexAttrib1d,#function ; glVertexAttrib1d = glVertexAttrib1dARB
-       .globl glVertexAttrib1dv ; .type glVertexAttrib1dv,#function ; glVertexAttrib1dv = glVertexAttrib1dvARB
-       .globl glVertexAttrib1f ; .type glVertexAttrib1f,#function ; glVertexAttrib1f = glVertexAttrib1fARB
-       .globl glVertexAttrib1fv ; .type glVertexAttrib1fv,#function ; glVertexAttrib1fv = glVertexAttrib1fvARB
-       .globl glVertexAttrib1s ; .type glVertexAttrib1s,#function ; glVertexAttrib1s = glVertexAttrib1sARB
-       .globl glVertexAttrib1sv ; .type glVertexAttrib1sv,#function ; glVertexAttrib1sv = glVertexAttrib1svARB
-       .globl glVertexAttrib2d ; .type glVertexAttrib2d,#function ; glVertexAttrib2d = glVertexAttrib2dARB
-       .globl glVertexAttrib2dv ; .type glVertexAttrib2dv,#function ; glVertexAttrib2dv = glVertexAttrib2dvARB
-       .globl glVertexAttrib2f ; .type glVertexAttrib2f,#function ; glVertexAttrib2f = glVertexAttrib2fARB
-       .globl glVertexAttrib2fv ; .type glVertexAttrib2fv,#function ; glVertexAttrib2fv = glVertexAttrib2fvARB
-       .globl glVertexAttrib2s ; .type glVertexAttrib2s,#function ; glVertexAttrib2s = glVertexAttrib2sARB
-       .globl glVertexAttrib2sv ; .type glVertexAttrib2sv,#function ; glVertexAttrib2sv = glVertexAttrib2svARB
-       .globl glVertexAttrib3d ; .type glVertexAttrib3d,#function ; glVertexAttrib3d = glVertexAttrib3dARB
-       .globl glVertexAttrib3dv ; .type glVertexAttrib3dv,#function ; glVertexAttrib3dv = glVertexAttrib3dvARB
-       .globl glVertexAttrib3f ; .type glVertexAttrib3f,#function ; glVertexAttrib3f = glVertexAttrib3fARB
-       .globl glVertexAttrib3fv ; .type glVertexAttrib3fv,#function ; glVertexAttrib3fv = glVertexAttrib3fvARB
-       .globl glVertexAttrib3s ; .type glVertexAttrib3s,#function ; glVertexAttrib3s = glVertexAttrib3sARB
-       .globl glVertexAttrib3sv ; .type glVertexAttrib3sv,#function ; glVertexAttrib3sv = glVertexAttrib3svARB
-       .globl glVertexAttrib4Nbv ; .type glVertexAttrib4Nbv,#function ; glVertexAttrib4Nbv = glVertexAttrib4NbvARB
-       .globl glVertexAttrib4Niv ; .type glVertexAttrib4Niv,#function ; glVertexAttrib4Niv = glVertexAttrib4NivARB
-       .globl glVertexAttrib4Nsv ; .type glVertexAttrib4Nsv,#function ; glVertexAttrib4Nsv = glVertexAttrib4NsvARB
-       .globl glVertexAttrib4Nub ; .type glVertexAttrib4Nub,#function ; glVertexAttrib4Nub = glVertexAttrib4NubARB
-       .globl glVertexAttrib4Nubv ; .type glVertexAttrib4Nubv,#function ; glVertexAttrib4Nubv = glVertexAttrib4NubvARB
-       .globl glVertexAttrib4Nuiv ; .type glVertexAttrib4Nuiv,#function ; glVertexAttrib4Nuiv = glVertexAttrib4NuivARB
-       .globl glVertexAttrib4Nusv ; .type glVertexAttrib4Nusv,#function ; glVertexAttrib4Nusv = glVertexAttrib4NusvARB
-       .globl glVertexAttrib4bv ; .type glVertexAttrib4bv,#function ; glVertexAttrib4bv = glVertexAttrib4bvARB
-       .globl glVertexAttrib4d ; .type glVertexAttrib4d,#function ; glVertexAttrib4d = glVertexAttrib4dARB
-       .globl glVertexAttrib4dv ; .type glVertexAttrib4dv,#function ; glVertexAttrib4dv = glVertexAttrib4dvARB
-       .globl glVertexAttrib4f ; .type glVertexAttrib4f,#function ; glVertexAttrib4f = glVertexAttrib4fARB
-       .globl glVertexAttrib4fv ; .type glVertexAttrib4fv,#function ; glVertexAttrib4fv = glVertexAttrib4fvARB
-       .globl glVertexAttrib4iv ; .type glVertexAttrib4iv,#function ; glVertexAttrib4iv = glVertexAttrib4ivARB
-       .globl glVertexAttrib4s ; .type glVertexAttrib4s,#function ; glVertexAttrib4s = glVertexAttrib4sARB
-       .globl glVertexAttrib4sv ; .type glVertexAttrib4sv,#function ; glVertexAttrib4sv = glVertexAttrib4svARB
-       .globl glVertexAttrib4ubv ; .type glVertexAttrib4ubv,#function ; glVertexAttrib4ubv = glVertexAttrib4ubvARB
-       .globl glVertexAttrib4uiv ; .type glVertexAttrib4uiv,#function ; glVertexAttrib4uiv = glVertexAttrib4uivARB
-       .globl glVertexAttrib4usv ; .type glVertexAttrib4usv,#function ; glVertexAttrib4usv = glVertexAttrib4usvARB
-       .globl glVertexAttribPointer ; .type glVertexAttribPointer,#function ; glVertexAttribPointer = glVertexAttribPointerARB
-       .globl glBindBuffer ; .type glBindBuffer,#function ; glBindBuffer = glBindBufferARB
-       .globl glBufferData ; .type glBufferData,#function ; glBufferData = glBufferDataARB
-       .globl glBufferSubData ; .type glBufferSubData,#function ; glBufferSubData = glBufferSubDataARB
-       .globl glDeleteBuffers ; .type glDeleteBuffers,#function ; glDeleteBuffers = glDeleteBuffersARB
-       .globl glGenBuffers ; .type glGenBuffers,#function ; glGenBuffers = glGenBuffersARB
-       .globl glGetBufferParameteriv ; .type glGetBufferParameteriv,#function ; glGetBufferParameteriv = glGetBufferParameterivARB
-       .globl glGetBufferPointerv ; .type glGetBufferPointerv,#function ; glGetBufferPointerv = glGetBufferPointervARB
-       .globl glGetBufferSubData ; .type glGetBufferSubData,#function ; glGetBufferSubData = glGetBufferSubDataARB
-       .globl glIsBuffer ; .type glIsBuffer,#function ; glIsBuffer = glIsBufferARB
-       .globl glMapBuffer ; .type glMapBuffer,#function ; glMapBuffer = glMapBufferARB
-       .globl glUnmapBuffer ; .type glUnmapBuffer,#function ; glUnmapBuffer = glUnmapBufferARB
-       .globl glBeginQuery ; .type glBeginQuery,#function ; glBeginQuery = glBeginQueryARB
-       .globl glDeleteQueries ; .type glDeleteQueries,#function ; glDeleteQueries = glDeleteQueriesARB
-       .globl glEndQuery ; .type glEndQuery,#function ; glEndQuery = glEndQueryARB
-       .globl glGenQueries ; .type glGenQueries,#function ; glGenQueries = glGenQueriesARB
-       .globl glGetQueryObjectiv ; .type glGetQueryObjectiv,#function ; glGetQueryObjectiv = glGetQueryObjectivARB
-       .globl glGetQueryObjectuiv ; .type glGetQueryObjectuiv,#function ; glGetQueryObjectuiv = glGetQueryObjectuivARB
-       .globl glGetQueryiv ; .type glGetQueryiv,#function ; glGetQueryiv = glGetQueryivARB
-       .globl glIsQuery ; .type glIsQuery,#function ; glIsQuery = glIsQueryARB
-       .globl glCompileShader ; .type glCompileShader,#function ; glCompileShader = glCompileShaderARB
-       .globl glGetActiveUniform ; .type glGetActiveUniform,#function ; glGetActiveUniform = glGetActiveUniformARB
-       .globl glGetShaderSource ; .type glGetShaderSource,#function ; glGetShaderSource = glGetShaderSourceARB
-       .globl glGetUniformLocation ; .type glGetUniformLocation,#function ; glGetUniformLocation = glGetUniformLocationARB
-       .globl glGetUniformfv ; .type glGetUniformfv,#function ; glGetUniformfv = glGetUniformfvARB
-       .globl glGetUniformiv ; .type glGetUniformiv,#function ; glGetUniformiv = glGetUniformivARB
-       .globl glLinkProgram ; .type glLinkProgram,#function ; glLinkProgram = glLinkProgramARB
-       .globl glShaderSource ; .type glShaderSource,#function ; glShaderSource = glShaderSourceARB
-       .globl glUniform1f ; .type glUniform1f,#function ; glUniform1f = glUniform1fARB
-       .globl glUniform1fv ; .type glUniform1fv,#function ; glUniform1fv = glUniform1fvARB
-       .globl glUniform1i ; .type glUniform1i,#function ; glUniform1i = glUniform1iARB
-       .globl glUniform1iv ; .type glUniform1iv,#function ; glUniform1iv = glUniform1ivARB
-       .globl glUniform2f ; .type glUniform2f,#function ; glUniform2f = glUniform2fARB
-       .globl glUniform2fv ; .type glUniform2fv,#function ; glUniform2fv = glUniform2fvARB
-       .globl glUniform2i ; .type glUniform2i,#function ; glUniform2i = glUniform2iARB
-       .globl glUniform2iv ; .type glUniform2iv,#function ; glUniform2iv = glUniform2ivARB
-       .globl glUniform3f ; .type glUniform3f,#function ; glUniform3f = glUniform3fARB
-       .globl glUniform3fv ; .type glUniform3fv,#function ; glUniform3fv = glUniform3fvARB
-       .globl glUniform3i ; .type glUniform3i,#function ; glUniform3i = glUniform3iARB
-       .globl glUniform3iv ; .type glUniform3iv,#function ; glUniform3iv = glUniform3ivARB
-       .globl glUniform4f ; .type glUniform4f,#function ; glUniform4f = glUniform4fARB
-       .globl glUniform4fv ; .type glUniform4fv,#function ; glUniform4fv = glUniform4fvARB
-       .globl glUniform4i ; .type glUniform4i,#function ; glUniform4i = glUniform4iARB
-       .globl glUniform4iv ; .type glUniform4iv,#function ; glUniform4iv = glUniform4ivARB
-       .globl glUniformMatrix2fv ; .type glUniformMatrix2fv,#function ; glUniformMatrix2fv = glUniformMatrix2fvARB
-       .globl glUniformMatrix3fv ; .type glUniformMatrix3fv,#function ; glUniformMatrix3fv = glUniformMatrix3fvARB
-       .globl glUniformMatrix4fv ; .type glUniformMatrix4fv,#function ; glUniformMatrix4fv = glUniformMatrix4fvARB
-       .globl glUseProgram ; .type glUseProgram,#function ; glUseProgram = glUseProgramObjectARB
-       .globl glValidateProgram ; .type glValidateProgram,#function ; glValidateProgram = glValidateProgramARB
-       .globl glBindAttribLocation ; .type glBindAttribLocation,#function ; glBindAttribLocation = glBindAttribLocationARB
-       .globl glGetActiveAttrib ; .type glGetActiveAttrib,#function ; glGetActiveAttrib = glGetActiveAttribARB
-       .globl glGetAttribLocation ; .type glGetAttribLocation,#function ; glGetAttribLocation = glGetAttribLocationARB
-       .globl glDrawBuffers ; .type glDrawBuffers,#function ; glDrawBuffers = glDrawBuffersARB
-       .globl glDrawBuffersATI ; .type glDrawBuffersATI,#function ; glDrawBuffersATI = glDrawBuffersARB
-       .globl glPointParameterf ; .type glPointParameterf,#function ; glPointParameterf = glPointParameterfEXT
-       .globl glPointParameterfARB ; .type glPointParameterfARB,#function ; glPointParameterfARB = glPointParameterfEXT
-       .globl glPointParameterfv ; .type glPointParameterfv,#function ; glPointParameterfv = glPointParameterfvEXT
-       .globl glPointParameterfvARB ; .type glPointParameterfvARB,#function ; glPointParameterfvARB = glPointParameterfvEXT
-       .globl glSecondaryColor3b ; .type glSecondaryColor3b,#function ; glSecondaryColor3b = glSecondaryColor3bEXT
-       .globl glSecondaryColor3bv ; .type glSecondaryColor3bv,#function ; glSecondaryColor3bv = glSecondaryColor3bvEXT
-       .globl glSecondaryColor3d ; .type glSecondaryColor3d,#function ; glSecondaryColor3d = glSecondaryColor3dEXT
-       .globl glSecondaryColor3dv ; .type glSecondaryColor3dv,#function ; glSecondaryColor3dv = glSecondaryColor3dvEXT
-       .globl glSecondaryColor3f ; .type glSecondaryColor3f,#function ; glSecondaryColor3f = glSecondaryColor3fEXT
-       .globl glSecondaryColor3fv ; .type glSecondaryColor3fv,#function ; glSecondaryColor3fv = glSecondaryColor3fvEXT
-       .globl glSecondaryColor3i ; .type glSecondaryColor3i,#function ; glSecondaryColor3i = glSecondaryColor3iEXT
-       .globl glSecondaryColor3iv ; .type glSecondaryColor3iv,#function ; glSecondaryColor3iv = glSecondaryColor3ivEXT
-       .globl glSecondaryColor3s ; .type glSecondaryColor3s,#function ; glSecondaryColor3s = glSecondaryColor3sEXT
-       .globl glSecondaryColor3sv ; .type glSecondaryColor3sv,#function ; glSecondaryColor3sv = glSecondaryColor3svEXT
-       .globl glSecondaryColor3ub ; .type glSecondaryColor3ub,#function ; glSecondaryColor3ub = glSecondaryColor3ubEXT
-       .globl glSecondaryColor3ubv ; .type glSecondaryColor3ubv,#function ; glSecondaryColor3ubv = glSecondaryColor3ubvEXT
-       .globl glSecondaryColor3ui ; .type glSecondaryColor3ui,#function ; glSecondaryColor3ui = glSecondaryColor3uiEXT
-       .globl glSecondaryColor3uiv ; .type glSecondaryColor3uiv,#function ; glSecondaryColor3uiv = glSecondaryColor3uivEXT
-       .globl glSecondaryColor3us ; .type glSecondaryColor3us,#function ; glSecondaryColor3us = glSecondaryColor3usEXT
-       .globl glSecondaryColor3usv ; .type glSecondaryColor3usv,#function ; glSecondaryColor3usv = glSecondaryColor3usvEXT
-       .globl glSecondaryColorPointer ; .type glSecondaryColorPointer,#function ; glSecondaryColorPointer = glSecondaryColorPointerEXT
-       .globl glMultiDrawArrays ; .type glMultiDrawArrays,#function ; glMultiDrawArrays = glMultiDrawArraysEXT
-       .globl glMultiDrawElements ; .type glMultiDrawElements,#function ; glMultiDrawElements = glMultiDrawElementsEXT
-       .globl glFogCoordPointer ; .type glFogCoordPointer,#function ; glFogCoordPointer = glFogCoordPointerEXT
-       .globl glFogCoordd ; .type glFogCoordd,#function ; glFogCoordd = glFogCoorddEXT
-       .globl glFogCoorddv ; .type glFogCoorddv,#function ; glFogCoorddv = glFogCoorddvEXT
-       .globl glFogCoordf ; .type glFogCoordf,#function ; glFogCoordf = glFogCoordfEXT
-       .globl glFogCoordfv ; .type glFogCoordfv,#function ; glFogCoordfv = glFogCoordfvEXT
-       .globl glBlendFuncSeparate ; .type glBlendFuncSeparate,#function ; glBlendFuncSeparate = glBlendFuncSeparateEXT
-       .globl glWindowPos2d ; .type glWindowPos2d,#function ; glWindowPos2d = glWindowPos2dMESA
-       .globl glWindowPos2dARB ; .type glWindowPos2dARB,#function ; glWindowPos2dARB = glWindowPos2dMESA
-       .globl glWindowPos2dv ; .type glWindowPos2dv,#function ; glWindowPos2dv = glWindowPos2dvMESA
-       .globl glWindowPos2dvARB ; .type glWindowPos2dvARB,#function ; glWindowPos2dvARB = glWindowPos2dvMESA
-       .globl glWindowPos2f ; .type glWindowPos2f,#function ; glWindowPos2f = glWindowPos2fMESA
-       .globl glWindowPos2fARB ; .type glWindowPos2fARB,#function ; glWindowPos2fARB = glWindowPos2fMESA
-       .globl glWindowPos2fv ; .type glWindowPos2fv,#function ; glWindowPos2fv = glWindowPos2fvMESA
-       .globl glWindowPos2fvARB ; .type glWindowPos2fvARB,#function ; glWindowPos2fvARB = glWindowPos2fvMESA
-       .globl glWindowPos2i ; .type glWindowPos2i,#function ; glWindowPos2i = glWindowPos2iMESA
-       .globl glWindowPos2iARB ; .type glWindowPos2iARB,#function ; glWindowPos2iARB = glWindowPos2iMESA
-       .globl glWindowPos2iv ; .type glWindowPos2iv,#function ; glWindowPos2iv = glWindowPos2ivMESA
-       .globl glWindowPos2ivARB ; .type glWindowPos2ivARB,#function ; glWindowPos2ivARB = glWindowPos2ivMESA
-       .globl glWindowPos2s ; .type glWindowPos2s,#function ; glWindowPos2s = glWindowPos2sMESA
-       .globl glWindowPos2sARB ; .type glWindowPos2sARB,#function ; glWindowPos2sARB = glWindowPos2sMESA
-       .globl glWindowPos2sv ; .type glWindowPos2sv,#function ; glWindowPos2sv = glWindowPos2svMESA
-       .globl glWindowPos2svARB ; .type glWindowPos2svARB,#function ; glWindowPos2svARB = glWindowPos2svMESA
-       .globl glWindowPos3d ; .type glWindowPos3d,#function ; glWindowPos3d = glWindowPos3dMESA
-       .globl glWindowPos3dARB ; .type glWindowPos3dARB,#function ; glWindowPos3dARB = glWindowPos3dMESA
-       .globl glWindowPos3dv ; .type glWindowPos3dv,#function ; glWindowPos3dv = glWindowPos3dvMESA
-       .globl glWindowPos3dvARB ; .type glWindowPos3dvARB,#function ; glWindowPos3dvARB = glWindowPos3dvMESA
-       .globl glWindowPos3f ; .type glWindowPos3f,#function ; glWindowPos3f = glWindowPos3fMESA
-       .globl glWindowPos3fARB ; .type glWindowPos3fARB,#function ; glWindowPos3fARB = glWindowPos3fMESA
-       .globl glWindowPos3fv ; .type glWindowPos3fv,#function ; glWindowPos3fv = glWindowPos3fvMESA
-       .globl glWindowPos3fvARB ; .type glWindowPos3fvARB,#function ; glWindowPos3fvARB = glWindowPos3fvMESA
-       .globl glWindowPos3i ; .type glWindowPos3i,#function ; glWindowPos3i = glWindowPos3iMESA
-       .globl glWindowPos3iARB ; .type glWindowPos3iARB,#function ; glWindowPos3iARB = glWindowPos3iMESA
-       .globl glWindowPos3iv ; .type glWindowPos3iv,#function ; glWindowPos3iv = glWindowPos3ivMESA
-       .globl glWindowPos3ivARB ; .type glWindowPos3ivARB,#function ; glWindowPos3ivARB = glWindowPos3ivMESA
-       .globl glWindowPos3s ; .type glWindowPos3s,#function ; glWindowPos3s = glWindowPos3sMESA
-       .globl glWindowPos3sARB ; .type glWindowPos3sARB,#function ; glWindowPos3sARB = glWindowPos3sMESA
-       .globl glWindowPos3sv ; .type glWindowPos3sv,#function ; glWindowPos3sv = glWindowPos3svMESA
-       .globl glWindowPos3svARB ; .type glWindowPos3svARB,#function ; glWindowPos3svARB = glWindowPos3svMESA
-       .globl glBindProgramARB ; .type glBindProgramARB,#function ; glBindProgramARB = glBindProgramNV
-       .globl glDeleteProgramsARB ; .type glDeleteProgramsARB,#function ; glDeleteProgramsARB = glDeleteProgramsNV
-       .globl glGenProgramsARB ; .type glGenProgramsARB,#function ; glGenProgramsARB = glGenProgramsNV
-       .globl glGetVertexAttribPointerv ; .type glGetVertexAttribPointerv,#function ; glGetVertexAttribPointerv = glGetVertexAttribPointervNV
-       .globl glGetVertexAttribPointervARB ; .type glGetVertexAttribPointervARB,#function ; glGetVertexAttribPointervARB = glGetVertexAttribPointervNV
-       .globl glIsProgramARB ; .type glIsProgramARB,#function ; glIsProgramARB = glIsProgramNV
-       .globl glPointParameteri ; .type glPointParameteri,#function ; glPointParameteri = glPointParameteriNV
-       .globl glPointParameteriv ; .type glPointParameteriv,#function ; glPointParameteriv = glPointParameterivNV
-       .globl glBlendEquationSeparate ; .type glBlendEquationSeparate,#function ; glBlendEquationSeparate = glBlendEquationSeparateEXT
-       .globl glBindFramebuffer ; .type glBindFramebuffer,#function ; glBindFramebuffer = glBindFramebufferEXT
-       .globl glBindRenderbuffer ; .type glBindRenderbuffer,#function ; glBindRenderbuffer = glBindRenderbufferEXT
-       .globl glCheckFramebufferStatus ; .type glCheckFramebufferStatus,#function ; glCheckFramebufferStatus = glCheckFramebufferStatusEXT
-       .globl glDeleteFramebuffers ; .type glDeleteFramebuffers,#function ; glDeleteFramebuffers = glDeleteFramebuffersEXT
-       .globl glDeleteRenderbuffers ; .type glDeleteRenderbuffers,#function ; glDeleteRenderbuffers = glDeleteRenderbuffersEXT
-       .globl glFramebufferRenderbuffer ; .type glFramebufferRenderbuffer,#function ; glFramebufferRenderbuffer = glFramebufferRenderbufferEXT
-       .globl glFramebufferTexture1D ; .type glFramebufferTexture1D,#function ; glFramebufferTexture1D = glFramebufferTexture1DEXT
-       .globl glFramebufferTexture2D ; .type glFramebufferTexture2D,#function ; glFramebufferTexture2D = glFramebufferTexture2DEXT
-       .globl glFramebufferTexture3D ; .type glFramebufferTexture3D,#function ; glFramebufferTexture3D = glFramebufferTexture3DEXT
-       .globl glGenFramebuffers ; .type glGenFramebuffers,#function ; glGenFramebuffers = glGenFramebuffersEXT
-       .globl glGenRenderbuffers ; .type glGenRenderbuffers,#function ; glGenRenderbuffers = glGenRenderbuffersEXT
-       .globl glGenerateMipmap ; .type glGenerateMipmap,#function ; glGenerateMipmap = glGenerateMipmapEXT
-       .globl glGetFramebufferAttachmentParameteriv ; .type glGetFramebufferAttachmentParameteriv,#function ; glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT
-       .globl glGetRenderbufferParameteriv ; .type glGetRenderbufferParameteriv,#function ; glGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT
-       .globl glIsFramebuffer ; .type glIsFramebuffer,#function ; glIsFramebuffer = glIsFramebufferEXT
-       .globl glIsRenderbuffer ; .type glIsRenderbuffer,#function ; glIsRenderbuffer = glIsRenderbufferEXT
-       .globl glRenderbufferStorage ; .type glRenderbufferStorage,#function ; glRenderbufferStorage = glRenderbufferStorageEXT
-       .globl glBlitFramebuffer ; .type glBlitFramebuffer,#function ; glBlitFramebuffer = glBlitFramebufferEXT
-       .globl glFramebufferTextureLayer ; .type glFramebufferTextureLayer,#function ; glFramebufferTextureLayer = glFramebufferTextureLayerEXT
+       GL_STUB_ALIAS(glSeparableFilter2DEXT, glSeparableFilter2D)
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glGetHistogramEXT, glGetHistogram)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glGetHistogramParameterfvEXT, glGetHistogramParameterfv)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glGetHistogramParameterivEXT, glGetHistogramParameteriv)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glGetMinmaxEXT, glGetMinmax)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glGetMinmaxParameterfvEXT, glGetMinmaxParameterfv)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+       GL_STUB_ALIAS(glGetMinmaxParameterivEXT, glGetMinmaxParameteriv)
+#endif
+       GL_STUB_ALIAS(glHistogramEXT, glHistogram)
+       GL_STUB_ALIAS(glMinmaxEXT, glMinmax)
+       GL_STUB_ALIAS(glResetHistogramEXT, glResetHistogram)
+       GL_STUB_ALIAS(glResetMinmaxEXT, glResetMinmax)
+       GL_STUB_ALIAS(glTexImage3DEXT, glTexImage3D)
+       GL_STUB_ALIAS(glTexSubImage3DEXT, glTexSubImage3D)
+       GL_STUB_ALIAS(glCopyTexSubImage3DEXT, glCopyTexSubImage3D)
+       GL_STUB_ALIAS(glActiveTexture, glActiveTextureARB)
+       GL_STUB_ALIAS(glClientActiveTexture, glClientActiveTextureARB)
+       GL_STUB_ALIAS(glMultiTexCoord1d, glMultiTexCoord1dARB)
+       GL_STUB_ALIAS(glMultiTexCoord1dv, glMultiTexCoord1dvARB)
+       GL_STUB_ALIAS(glMultiTexCoord1f, glMultiTexCoord1fARB)
+       GL_STUB_ALIAS(glMultiTexCoord1fv, glMultiTexCoord1fvARB)
+       GL_STUB_ALIAS(glMultiTexCoord1i, glMultiTexCoord1iARB)
+       GL_STUB_ALIAS(glMultiTexCoord1iv, glMultiTexCoord1ivARB)
+       GL_STUB_ALIAS(glMultiTexCoord1s, glMultiTexCoord1sARB)
+       GL_STUB_ALIAS(glMultiTexCoord1sv, glMultiTexCoord1svARB)
+       GL_STUB_ALIAS(glMultiTexCoord2d, glMultiTexCoord2dARB)
+       GL_STUB_ALIAS(glMultiTexCoord2dv, glMultiTexCoord2dvARB)
+       GL_STUB_ALIAS(glMultiTexCoord2f, glMultiTexCoord2fARB)
+       GL_STUB_ALIAS(glMultiTexCoord2fv, glMultiTexCoord2fvARB)
+       GL_STUB_ALIAS(glMultiTexCoord2i, glMultiTexCoord2iARB)
+       GL_STUB_ALIAS(glMultiTexCoord2iv, glMultiTexCoord2ivARB)
+       GL_STUB_ALIAS(glMultiTexCoord2s, glMultiTexCoord2sARB)
+       GL_STUB_ALIAS(glMultiTexCoord2sv, glMultiTexCoord2svARB)
+       GL_STUB_ALIAS(glMultiTexCoord3d, glMultiTexCoord3dARB)
+       GL_STUB_ALIAS(glMultiTexCoord3dv, glMultiTexCoord3dvARB)
+       GL_STUB_ALIAS(glMultiTexCoord3f, glMultiTexCoord3fARB)
+       GL_STUB_ALIAS(glMultiTexCoord3fv, glMultiTexCoord3fvARB)
+       GL_STUB_ALIAS(glMultiTexCoord3i, glMultiTexCoord3iARB)
+       GL_STUB_ALIAS(glMultiTexCoord3iv, glMultiTexCoord3ivARB)
+       GL_STUB_ALIAS(glMultiTexCoord3s, glMultiTexCoord3sARB)
+       GL_STUB_ALIAS(glMultiTexCoord3sv, glMultiTexCoord3svARB)
+       GL_STUB_ALIAS(glMultiTexCoord4d, glMultiTexCoord4dARB)
+       GL_STUB_ALIAS(glMultiTexCoord4dv, glMultiTexCoord4dvARB)
+       GL_STUB_ALIAS(glMultiTexCoord4f, glMultiTexCoord4fARB)
+       GL_STUB_ALIAS(glMultiTexCoord4fv, glMultiTexCoord4fvARB)
+       GL_STUB_ALIAS(glMultiTexCoord4i, glMultiTexCoord4iARB)
+       GL_STUB_ALIAS(glMultiTexCoord4iv, glMultiTexCoord4ivARB)
+       GL_STUB_ALIAS(glMultiTexCoord4s, glMultiTexCoord4sARB)
+       GL_STUB_ALIAS(glMultiTexCoord4sv, glMultiTexCoord4svARB)
+       GL_STUB_ALIAS(glStencilOpSeparateATI, glStencilOpSeparate)
+       GL_STUB_ALIAS(glLoadTransposeMatrixd, glLoadTransposeMatrixdARB)
+       GL_STUB_ALIAS(glLoadTransposeMatrixf, glLoadTransposeMatrixfARB)
+       GL_STUB_ALIAS(glMultTransposeMatrixd, glMultTransposeMatrixdARB)
+       GL_STUB_ALIAS(glMultTransposeMatrixf, glMultTransposeMatrixfARB)
+       GL_STUB_ALIAS(glSampleCoverage, glSampleCoverageARB)
+       GL_STUB_ALIAS(glCompressedTexImage1D, glCompressedTexImage1DARB)
+       GL_STUB_ALIAS(glCompressedTexImage2D, glCompressedTexImage2DARB)
+       GL_STUB_ALIAS(glCompressedTexImage3D, glCompressedTexImage3DARB)
+       GL_STUB_ALIAS(glCompressedTexSubImage1D, glCompressedTexSubImage1DARB)
+       GL_STUB_ALIAS(glCompressedTexSubImage2D, glCompressedTexSubImage2DARB)
+       GL_STUB_ALIAS(glCompressedTexSubImage3D, glCompressedTexSubImage3DARB)
+       GL_STUB_ALIAS(glGetCompressedTexImage, glGetCompressedTexImageARB)
+       GL_STUB_ALIAS(glDisableVertexAttribArray, glDisableVertexAttribArrayARB)
+       GL_STUB_ALIAS(glEnableVertexAttribArray, glEnableVertexAttribArrayARB)
+       GL_STUB_ALIAS(glGetVertexAttribdv, glGetVertexAttribdvARB)
+       GL_STUB_ALIAS(glGetVertexAttribfv, glGetVertexAttribfvARB)
+       GL_STUB_ALIAS(glGetVertexAttribiv, glGetVertexAttribivARB)
+       GL_STUB_ALIAS(glProgramParameter4dNV, glProgramEnvParameter4dARB)
+       GL_STUB_ALIAS(glProgramParameter4dvNV, glProgramEnvParameter4dvARB)
+       GL_STUB_ALIAS(glProgramParameter4fNV, glProgramEnvParameter4fARB)
+       GL_STUB_ALIAS(glProgramParameter4fvNV, glProgramEnvParameter4fvARB)
+       GL_STUB_ALIAS(glVertexAttrib1d, glVertexAttrib1dARB)
+       GL_STUB_ALIAS(glVertexAttrib1dv, glVertexAttrib1dvARB)
+       GL_STUB_ALIAS(glVertexAttrib1f, glVertexAttrib1fARB)
+       GL_STUB_ALIAS(glVertexAttrib1fv, glVertexAttrib1fvARB)
+       GL_STUB_ALIAS(glVertexAttrib1s, glVertexAttrib1sARB)
+       GL_STUB_ALIAS(glVertexAttrib1sv, glVertexAttrib1svARB)
+       GL_STUB_ALIAS(glVertexAttrib2d, glVertexAttrib2dARB)
+       GL_STUB_ALIAS(glVertexAttrib2dv, glVertexAttrib2dvARB)
+       GL_STUB_ALIAS(glVertexAttrib2f, glVertexAttrib2fARB)
+       GL_STUB_ALIAS(glVertexAttrib2fv, glVertexAttrib2fvARB)
+       GL_STUB_ALIAS(glVertexAttrib2s, glVertexAttrib2sARB)
+       GL_STUB_ALIAS(glVertexAttrib2sv, glVertexAttrib2svARB)
+       GL_STUB_ALIAS(glVertexAttrib3d, glVertexAttrib3dARB)
+       GL_STUB_ALIAS(glVertexAttrib3dv, glVertexAttrib3dvARB)
+       GL_STUB_ALIAS(glVertexAttrib3f, glVertexAttrib3fARB)
+       GL_STUB_ALIAS(glVertexAttrib3fv, glVertexAttrib3fvARB)
+       GL_STUB_ALIAS(glVertexAttrib3s, glVertexAttrib3sARB)
+       GL_STUB_ALIAS(glVertexAttrib3sv, glVertexAttrib3svARB)
+       GL_STUB_ALIAS(glVertexAttrib4Nbv, glVertexAttrib4NbvARB)
+       GL_STUB_ALIAS(glVertexAttrib4Niv, glVertexAttrib4NivARB)
+       GL_STUB_ALIAS(glVertexAttrib4Nsv, glVertexAttrib4NsvARB)
+       GL_STUB_ALIAS(glVertexAttrib4Nub, glVertexAttrib4NubARB)
+       GL_STUB_ALIAS(glVertexAttrib4Nubv, glVertexAttrib4NubvARB)
+       GL_STUB_ALIAS(glVertexAttrib4Nuiv, glVertexAttrib4NuivARB)
+       GL_STUB_ALIAS(glVertexAttrib4Nusv, glVertexAttrib4NusvARB)
+       GL_STUB_ALIAS(glVertexAttrib4bv, glVertexAttrib4bvARB)
+       GL_STUB_ALIAS(glVertexAttrib4d, glVertexAttrib4dARB)
+       GL_STUB_ALIAS(glVertexAttrib4dv, glVertexAttrib4dvARB)
+       GL_STUB_ALIAS(glVertexAttrib4f, glVertexAttrib4fARB)
+       GL_STUB_ALIAS(glVertexAttrib4fv, glVertexAttrib4fvARB)
+       GL_STUB_ALIAS(glVertexAttrib4iv, glVertexAttrib4ivARB)
+       GL_STUB_ALIAS(glVertexAttrib4s, glVertexAttrib4sARB)
+       GL_STUB_ALIAS(glVertexAttrib4sv, glVertexAttrib4svARB)
+       GL_STUB_ALIAS(glVertexAttrib4ubv, glVertexAttrib4ubvARB)
+       GL_STUB_ALIAS(glVertexAttrib4uiv, glVertexAttrib4uivARB)
+       GL_STUB_ALIAS(glVertexAttrib4usv, glVertexAttrib4usvARB)
+       GL_STUB_ALIAS(glVertexAttribPointer, glVertexAttribPointerARB)
+       GL_STUB_ALIAS(glBindBuffer, glBindBufferARB)
+       GL_STUB_ALIAS(glBufferData, glBufferDataARB)
+       GL_STUB_ALIAS(glBufferSubData, glBufferSubDataARB)
+       GL_STUB_ALIAS(glDeleteBuffers, glDeleteBuffersARB)
+       GL_STUB_ALIAS(glGenBuffers, glGenBuffersARB)
+       GL_STUB_ALIAS(glGetBufferParameteriv, glGetBufferParameterivARB)
+       GL_STUB_ALIAS(glGetBufferPointerv, glGetBufferPointervARB)
+       GL_STUB_ALIAS(glGetBufferSubData, glGetBufferSubDataARB)
+       GL_STUB_ALIAS(glIsBuffer, glIsBufferARB)
+       GL_STUB_ALIAS(glMapBuffer, glMapBufferARB)
+       GL_STUB_ALIAS(glUnmapBuffer, glUnmapBufferARB)
+       GL_STUB_ALIAS(glBeginQuery, glBeginQueryARB)
+       GL_STUB_ALIAS(glDeleteQueries, glDeleteQueriesARB)
+       GL_STUB_ALIAS(glEndQuery, glEndQueryARB)
+       GL_STUB_ALIAS(glGenQueries, glGenQueriesARB)
+       GL_STUB_ALIAS(glGetQueryObjectiv, glGetQueryObjectivARB)
+       GL_STUB_ALIAS(glGetQueryObjectuiv, glGetQueryObjectuivARB)
+       GL_STUB_ALIAS(glGetQueryiv, glGetQueryivARB)
+       GL_STUB_ALIAS(glIsQuery, glIsQueryARB)
+       GL_STUB_ALIAS(glCompileShader, glCompileShaderARB)
+       GL_STUB_ALIAS(glGetActiveUniform, glGetActiveUniformARB)
+       GL_STUB_ALIAS(glGetShaderSource, glGetShaderSourceARB)
+       GL_STUB_ALIAS(glGetUniformLocation, glGetUniformLocationARB)
+       GL_STUB_ALIAS(glGetUniformfv, glGetUniformfvARB)
+       GL_STUB_ALIAS(glGetUniformiv, glGetUniformivARB)
+       GL_STUB_ALIAS(glLinkProgram, glLinkProgramARB)
+       GL_STUB_ALIAS(glShaderSource, glShaderSourceARB)
+       GL_STUB_ALIAS(glUniform1f, glUniform1fARB)
+       GL_STUB_ALIAS(glUniform1fv, glUniform1fvARB)
+       GL_STUB_ALIAS(glUniform1i, glUniform1iARB)
+       GL_STUB_ALIAS(glUniform1iv, glUniform1ivARB)
+       GL_STUB_ALIAS(glUniform2f, glUniform2fARB)
+       GL_STUB_ALIAS(glUniform2fv, glUniform2fvARB)
+       GL_STUB_ALIAS(glUniform2i, glUniform2iARB)
+       GL_STUB_ALIAS(glUniform2iv, glUniform2ivARB)
+       GL_STUB_ALIAS(glUniform3f, glUniform3fARB)
+       GL_STUB_ALIAS(glUniform3fv, glUniform3fvARB)
+       GL_STUB_ALIAS(glUniform3i, glUniform3iARB)
+       GL_STUB_ALIAS(glUniform3iv, glUniform3ivARB)
+       GL_STUB_ALIAS(glUniform4f, glUniform4fARB)
+       GL_STUB_ALIAS(glUniform4fv, glUniform4fvARB)
+       GL_STUB_ALIAS(glUniform4i, glUniform4iARB)
+       GL_STUB_ALIAS(glUniform4iv, glUniform4ivARB)
+       GL_STUB_ALIAS(glUniformMatrix2fv, glUniformMatrix2fvARB)
+       GL_STUB_ALIAS(glUniformMatrix3fv, glUniformMatrix3fvARB)
+       GL_STUB_ALIAS(glUniformMatrix4fv, glUniformMatrix4fvARB)
+       GL_STUB_ALIAS(glUseProgram, glUseProgramObjectARB)
+       GL_STUB_ALIAS(glValidateProgram, glValidateProgramARB)
+       GL_STUB_ALIAS(glBindAttribLocation, glBindAttribLocationARB)
+       GL_STUB_ALIAS(glGetActiveAttrib, glGetActiveAttribARB)
+       GL_STUB_ALIAS(glGetAttribLocation, glGetAttribLocationARB)
+       GL_STUB_ALIAS(glDrawBuffers, glDrawBuffersARB)
+       GL_STUB_ALIAS(glDrawBuffersATI, glDrawBuffersARB)
+       GL_STUB_ALIAS(glPointParameterf, glPointParameterfEXT)
+       GL_STUB_ALIAS(glPointParameterfARB, glPointParameterfEXT)
+       GL_STUB_ALIAS(glPointParameterfSGIS, glPointParameterfEXT)
+       GL_STUB_ALIAS(glPointParameterfv, glPointParameterfvEXT)
+       GL_STUB_ALIAS(glPointParameterfvARB, glPointParameterfvEXT)
+       GL_STUB_ALIAS(glPointParameterfvSGIS, glPointParameterfvEXT)
+       GL_STUB_ALIAS(glSecondaryColor3b, glSecondaryColor3bEXT)
+       GL_STUB_ALIAS(glSecondaryColor3bv, glSecondaryColor3bvEXT)
+       GL_STUB_ALIAS(glSecondaryColor3d, glSecondaryColor3dEXT)
+       GL_STUB_ALIAS(glSecondaryColor3dv, glSecondaryColor3dvEXT)
+       GL_STUB_ALIAS(glSecondaryColor3f, glSecondaryColor3fEXT)
+       GL_STUB_ALIAS(glSecondaryColor3fv, glSecondaryColor3fvEXT)
+       GL_STUB_ALIAS(glSecondaryColor3i, glSecondaryColor3iEXT)
+       GL_STUB_ALIAS(glSecondaryColor3iv, glSecondaryColor3ivEXT)
+       GL_STUB_ALIAS(glSecondaryColor3s, glSecondaryColor3sEXT)
+       GL_STUB_ALIAS(glSecondaryColor3sv, glSecondaryColor3svEXT)
+       GL_STUB_ALIAS(glSecondaryColor3ub, glSecondaryColor3ubEXT)
+       GL_STUB_ALIAS(glSecondaryColor3ubv, glSecondaryColor3ubvEXT)
+       GL_STUB_ALIAS(glSecondaryColor3ui, glSecondaryColor3uiEXT)
+       GL_STUB_ALIAS(glSecondaryColor3uiv, glSecondaryColor3uivEXT)
+       GL_STUB_ALIAS(glSecondaryColor3us, glSecondaryColor3usEXT)
+       GL_STUB_ALIAS(glSecondaryColor3usv, glSecondaryColor3usvEXT)
+       GL_STUB_ALIAS(glSecondaryColorPointer, glSecondaryColorPointerEXT)
+       GL_STUB_ALIAS(glMultiDrawArrays, glMultiDrawArraysEXT)
+       GL_STUB_ALIAS(glMultiDrawElements, glMultiDrawElementsEXT)
+       GL_STUB_ALIAS(glFogCoordPointer, glFogCoordPointerEXT)
+       GL_STUB_ALIAS(glFogCoordd, glFogCoorddEXT)
+       GL_STUB_ALIAS(glFogCoorddv, glFogCoorddvEXT)
+       GL_STUB_ALIAS(glFogCoordf, glFogCoordfEXT)
+       GL_STUB_ALIAS(glFogCoordfv, glFogCoordfvEXT)
+       GL_STUB_ALIAS(glBlendFuncSeparate, glBlendFuncSeparateEXT)
+       GL_STUB_ALIAS(glBlendFuncSeparateINGR, glBlendFuncSeparateEXT)
+       GL_STUB_ALIAS(glWindowPos2d, glWindowPos2dMESA)
+       GL_STUB_ALIAS(glWindowPos2dARB, glWindowPos2dMESA)
+       GL_STUB_ALIAS(glWindowPos2dv, glWindowPos2dvMESA)
+       GL_STUB_ALIAS(glWindowPos2dvARB, glWindowPos2dvMESA)
+       GL_STUB_ALIAS(glWindowPos2f, glWindowPos2fMESA)
+       GL_STUB_ALIAS(glWindowPos2fARB, glWindowPos2fMESA)
+       GL_STUB_ALIAS(glWindowPos2fv, glWindowPos2fvMESA)
+       GL_STUB_ALIAS(glWindowPos2fvARB, glWindowPos2fvMESA)
+       GL_STUB_ALIAS(glWindowPos2i, glWindowPos2iMESA)
+       GL_STUB_ALIAS(glWindowPos2iARB, glWindowPos2iMESA)
+       GL_STUB_ALIAS(glWindowPos2iv, glWindowPos2ivMESA)
+       GL_STUB_ALIAS(glWindowPos2ivARB, glWindowPos2ivMESA)
+       GL_STUB_ALIAS(glWindowPos2s, glWindowPos2sMESA)
+       GL_STUB_ALIAS(glWindowPos2sARB, glWindowPos2sMESA)
+       GL_STUB_ALIAS(glWindowPos2sv, glWindowPos2svMESA)
+       GL_STUB_ALIAS(glWindowPos2svARB, glWindowPos2svMESA)
+       GL_STUB_ALIAS(glWindowPos3d, glWindowPos3dMESA)
+       GL_STUB_ALIAS(glWindowPos3dARB, glWindowPos3dMESA)
+       GL_STUB_ALIAS(glWindowPos3dv, glWindowPos3dvMESA)
+       GL_STUB_ALIAS(glWindowPos3dvARB, glWindowPos3dvMESA)
+       GL_STUB_ALIAS(glWindowPos3f, glWindowPos3fMESA)
+       GL_STUB_ALIAS(glWindowPos3fARB, glWindowPos3fMESA)
+       GL_STUB_ALIAS(glWindowPos3fv, glWindowPos3fvMESA)
+       GL_STUB_ALIAS(glWindowPos3fvARB, glWindowPos3fvMESA)
+       GL_STUB_ALIAS(glWindowPos3i, glWindowPos3iMESA)
+       GL_STUB_ALIAS(glWindowPos3iARB, glWindowPos3iMESA)
+       GL_STUB_ALIAS(glWindowPos3iv, glWindowPos3ivMESA)
+       GL_STUB_ALIAS(glWindowPos3ivARB, glWindowPos3ivMESA)
+       GL_STUB_ALIAS(glWindowPos3s, glWindowPos3sMESA)
+       GL_STUB_ALIAS(glWindowPos3sARB, glWindowPos3sMESA)
+       GL_STUB_ALIAS(glWindowPos3sv, glWindowPos3svMESA)
+       GL_STUB_ALIAS(glWindowPos3svARB, glWindowPos3svMESA)
+       GL_STUB_ALIAS(glBindProgramARB, glBindProgramNV)
+       GL_STUB_ALIAS(glDeleteProgramsARB, glDeleteProgramsNV)
+       GL_STUB_ALIAS(glGenProgramsARB, glGenProgramsNV)
+       GL_STUB_ALIAS(glGetVertexAttribPointerv, glGetVertexAttribPointervNV)
+       GL_STUB_ALIAS(glGetVertexAttribPointervARB, glGetVertexAttribPointervNV)
+       GL_STUB_ALIAS(glIsProgramARB, glIsProgramNV)
+       GL_STUB_ALIAS(glPointParameteri, glPointParameteriNV)
+       GL_STUB_ALIAS(glPointParameteriv, glPointParameterivNV)
+       GL_STUB_ALIAS(glBindFramebuffer, glBindFramebufferEXT)
+       GL_STUB_ALIAS(glBindRenderbuffer, glBindRenderbufferEXT)
+       GL_STUB_ALIAS(glCheckFramebufferStatus, glCheckFramebufferStatusEXT)
+       GL_STUB_ALIAS(glDeleteFramebuffers, glDeleteFramebuffersEXT)
+       GL_STUB_ALIAS(glDeleteRenderbuffers, glDeleteRenderbuffersEXT)
+       GL_STUB_ALIAS(glFramebufferRenderbuffer, glFramebufferRenderbufferEXT)
+       GL_STUB_ALIAS(glFramebufferTexture1D, glFramebufferTexture1DEXT)
+       GL_STUB_ALIAS(glFramebufferTexture2D, glFramebufferTexture2DEXT)
+       GL_STUB_ALIAS(glFramebufferTexture3D, glFramebufferTexture3DEXT)
+       GL_STUB_ALIAS(glGenFramebuffers, glGenFramebuffersEXT)
+       GL_STUB_ALIAS(glGenRenderbuffers, glGenRenderbuffersEXT)
+       GL_STUB_ALIAS(glGenerateMipmap, glGenerateMipmapEXT)
+       GL_STUB_ALIAS(glGetFramebufferAttachmentParameteriv, glGetFramebufferAttachmentParameterivEXT)
+       GL_STUB_ALIAS(glGetRenderbufferParameteriv, glGetRenderbufferParameterivEXT)
+       GL_STUB_ALIAS(glIsFramebuffer, glIsFramebufferEXT)
+       GL_STUB_ALIAS(glIsRenderbuffer, glIsRenderbufferEXT)
+       GL_STUB_ALIAS(glRenderbufferStorage, glRenderbufferStorageEXT)
+       GL_STUB_ALIAS(glFramebufferTextureLayer, glFramebufferTextureLayerEXT)
+
+       .globl  gl_dispatch_functions_end
+       HIDDEN(gl_dispatch_functions_end)
+gl_dispatch_functions_end:
index 44950a10a5d84c6132d5e09527816aa790b84c75..117d36fa223300ecd0ab924841430541ed42c46d 100644 (file)
@@ -1,11 +1,8 @@
 
 #include "sparc_matrix.h"
 
-#if defined(SVR4) || defined(__SVR4) || defined(__svr4__)
-       /* Solaris requires this for 64-bit. */
        .register %g2, #scratch
        .register %g3, #scratch
-#endif
 
        .text
 
@@ -98,7 +95,7 @@ _mesa_sparc_transform_normalize_normals:
 
        cmp     %o4, %g1                        ! continue if (i < count)
        bl      1b
-        add    %g3, 0x0c, %g3                  ! advance out vector pointer
+        add    %g3, 0x10, %g3                  ! advance out vector pointer
 
        ba      7f
         nop
@@ -154,7 +151,7 @@ _mesa_sparc_transform_normalize_normals:
 
        cmp     %o4, %g1                        ! continue if (i < count)
        bl      5b
-        add    %g3, 0x0c, %g3                  ! advance out vector pointer
+        add    %g3, 0x10, %g3                  ! advance out vector pointer
 
 7:     retl
         nop
@@ -225,7 +222,7 @@ _mesa_sparc_transform_normalize_normals_no_rot:
 
        cmp     %o4, %g1                        ! continue if (i < count)
        bl      1b
-        add    %g3, 0x0c, %g3                  ! advance out vector pointer
+        add    %g3, 0x10, %g3                  ! advance out vector pointer
 
        ba      7f
         nop
@@ -263,7 +260,7 @@ _mesa_sparc_transform_normalize_normals_no_rot:
 
        cmp     %o4, %g1                        ! continue if (i < count)
        bl      5b
-        add    %g3, 0x0c, %g3                  ! advance out vector pointer
+        add    %g3, 0x10, %g3                  ! advance out vector pointer
 
 7:     retl
         nop
@@ -314,7 +311,7 @@ _mesa_sparc_transform_rescale_normals_no_rot:
 
        cmp     %o4, %g1                        ! continue if (i < count)
        bl      1b
-        add    %g3, 0x0c, %g3                  ! advance out vector pointer
+        add    %g3, 0x10, %g3                  ! advance out vector pointer
 
 7:     retl
         nop
@@ -379,7 +376,7 @@ _mesa_sparc_transform_rescale_normals:
 
        cmp     %o4, %g1                        ! continue if (i < count)
        bl      1b
-        add    %g3, 0x0c, %g3                  ! advance out vector pointer
+        add    %g3, 0x10, %g3                  ! advance out vector pointer
 
 7:     retl
         nop
@@ -421,7 +418,7 @@ _mesa_sparc_transform_normals_no_rot:
 
        cmp     %o4, %g1                        ! continue if (i < count)
        bl      1b
-        add    %g3, 0x0c, %g3                  ! advance out vector pointer
+        add    %g3, 0x10, %g3                  ! advance out vector pointer
 
 7:     retl
         nop
@@ -471,7 +468,7 @@ _mesa_sparc_transform_normals:
 
        cmp     %o4, %g1                        ! continue if (i < count)
        bl      1b
-        add    %g3, 0x0c, %g3                  ! advance out vector pointer
+        add    %g3, 0x10, %g3                  ! advance out vector pointer
 
 7:     retl
         nop
@@ -529,7 +526,7 @@ _mesa_sparc_normalize_normals:
 
        cmp     %o4, %g1                        ! continue if (i < count)
        bl      1b
-        add    %g3, 0x0c, %g3                  ! advance out vector pointer
+        add    %g3, 0x10, %g3                  ! advance out vector pointer
 
        ba      7f
         nop
@@ -557,7 +554,7 @@ _mesa_sparc_normalize_normals:
 
        cmp     %o4, %g1                        ! continue if (i < count)
        bl      5b
-        add    %g3, 0x0c, %g3                  ! advance out vector pointer
+        add    %g3, 0x10, %g3                  ! advance out vector pointer
 
 7:     retl
         nop
@@ -602,7 +599,7 @@ _mesa_sparc_rescale_normals:
 
        cmp     %o4, %g1                        ! continue if (i < count)
        bl      1b
-        add    %g3, 0x0c, %g3                  ! advance out vector pointer
+        add    %g3, 0x10, %g3                  ! advance out vector pointer
 
 7:     retl
         nop
index 84e8ac6723a6181bfb54b8b3a5785c5ab547a7cc..d2286a2c8372c9cc1203714a295004770dbce21f 100644 (file)
@@ -113,8 +113,6 @@ void _mesa_init_all_sparc_transform_asm(void)
    _mesa_clip_tab[4] = _mesa_sparc_cliptest_points4;
    _mesa_clip_np_tab[4] = _mesa_sparc_cliptest_points4_np;
 
-#if 0
-   /* disable these too.  See bug 673938 */
    _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] =
           _mesa_sparc_transform_normalize_normals;
    _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] =
@@ -131,7 +129,6 @@ void _mesa_init_all_sparc_transform_asm(void)
           _mesa_sparc_normalize_normals;
    _mesa_normal_tab[NORM_RESCALE] =
           _mesa_sparc_rescale_normals;
-#endif
 
 #ifdef DEBUG_MATH
    _math_test_all_transform_functions("sparc");
@@ -140,38 +137,4 @@ void _mesa_init_all_sparc_transform_asm(void)
 #endif
 }
 
-extern unsigned int _mesa_sparc_glapi_begin;
-extern unsigned int _mesa_sparc_glapi_end;
-extern void __glapi_sparc_icache_flush(unsigned int *);
-
 #endif /* USE_SPARC_ASM */
-
-
-void _mesa_init_sparc_glapi_relocs(void)
-{
-#ifdef USE_SPARC_ASM
-       unsigned int *insn_ptr, *end_ptr;
-       unsigned long disp_addr;
-
-       insn_ptr = &_mesa_sparc_glapi_begin;
-       end_ptr = &_mesa_sparc_glapi_end;
-       disp_addr = (unsigned long) &_glapi_Dispatch;
-
-       while (insn_ptr < end_ptr) {
-#ifdef __arch64__
-               insn_ptr[0] |= (disp_addr >> (32 + 10));
-               insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10);
-               __glapi_sparc_icache_flush(&insn_ptr[0]);
-               insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1));
-               insn_ptr[3] |= (disp_addr & ((1 << 10) - 1));
-               __glapi_sparc_icache_flush(&insn_ptr[2]);
-               insn_ptr += 11;
-#else
-               insn_ptr[0] |= (disp_addr >> 10);
-               insn_ptr[1] |= (disp_addr & ((1 << 10) - 1));
-               __glapi_sparc_icache_flush(&insn_ptr[0]);
-               insn_ptr += 5;
-#endif
-       }
-#endif /* USE_SPARC_ASM */
-}
index a98e4d0e40072ec8e66afa14fa067c2a1b509b21..b9ea33685697450834f9170c704c92bf8bf2449f 100644 (file)
@@ -32,6 +32,5 @@
 #define SPARC_H
 
 extern void _mesa_init_all_sparc_transform_asm(void);
-extern void _mesa_init_sparc_glapi_relocs(void);
 
 #endif /* !(SPARC_H) */
index fc8587f459836db1a98a7e598af47040ddc2fc7d..f79092291b0a244f1bacaae8fa222988a01746da 100644 (file)
@@ -69,7 +69,7 @@ void st_init_atoms( struct st_context *st )
 {
    GLuint i;
 
-   st->atoms = malloc(sizeof(atoms));
+   st->atoms = _mesa_malloc(sizeof(atoms));
    st->nr_atoms = sizeof(atoms)/sizeof(*atoms);
    memcpy(st->atoms, atoms, sizeof(atoms));
 
@@ -92,7 +92,7 @@ void st_init_atoms( struct st_context *st )
 void st_destroy_atoms( struct st_context *st )
 {
    if (st->atoms) {
-      free(st->atoms);
+      _mesa_free(st->atoms);
       st->atoms = NULL;
    }
 }
index 514b10cd022af4c0e7e84e96296f7b05287dd315..fd81ac36d2c2c3219d02e91ee82cd61b1d9f4dde 100644 (file)
@@ -73,7 +73,7 @@ void st_upload_constants( struct st_context *st,
       /* We always need to get a new buffer, to keep the drivers simple and
        * avoid gratuitous rendering synchronization.
        */
-      pipe_buffer_reference(pipe->screen, &cbuf->buffer, NULL );
+      pipe_buffer_reference(&cbuf->buffer, NULL );
       cbuf->buffer = pipe_buffer_create(pipe->screen, 16, PIPE_BUFFER_USAGE_CONSTANT,
                                        paramBytes );
 
@@ -85,12 +85,10 @@ void st_upload_constants( struct st_context *st,
       }
 
       /* load Mesa constants into the constant buffer */
-      if (cbuf->buffer) {
-         void *map = pipe_buffer_map(pipe->screen, cbuf->buffer,
-                                     PIPE_BUFFER_USAGE_CPU_WRITE);
-         memcpy(map, params->ParameterValues, paramBytes);
-         pipe_buffer_unmap(pipe->screen, cbuf->buffer);
-      }
+      if (cbuf->buffer)
+         pipe_buffer_write(pipe->screen, cbuf->buffer, 
+                           0, paramBytes, 
+                           params->ParameterValues);
 
       st->pipe->set_constant_buffer(st->pipe, id, 0, cbuf);
    }
index 2d617bd95dcae756cf82b2ed883af3fb8680ed69..0aa128f94793af443677c4342720367b344ea70d 100644 (file)
@@ -94,36 +94,40 @@ static void
 update_depth_stencil_alpha(struct st_context *st)
 {
    struct pipe_depth_stencil_alpha_state *dsa = &st->state.depth_stencil;
+   GLcontext *ctx = st->ctx;
 
    memset(dsa, 0, sizeof(*dsa));
 
-   dsa->depth.enabled = st->ctx->Depth.Test;
-   dsa->depth.writemask = st->ctx->Depth.Mask;
-   dsa->depth.func = st_compare_func_to_pipe(st->ctx->Depth.Func);
+   if (ctx->Depth.Test && ctx->DrawBuffer->Visual.depthBits > 0) {
+      dsa->depth.enabled = 1;
+      dsa->depth.writemask = ctx->Depth.Mask;
+      dsa->depth.func = st_compare_func_to_pipe(ctx->Depth.Func);
+   }
 
-   if (st->ctx->Query.CurrentOcclusionObject &&
-       st->ctx->Query.CurrentOcclusionObject->Active)
+   if (ctx->Query.CurrentOcclusionObject &&
+       ctx->Query.CurrentOcclusionObject->Active)
       dsa->depth.occlusion_count = 1;
 
-   if (st->ctx->Stencil.Enabled && st->ctx->Visual.stencilBits > 0) {
+   if (ctx->Stencil.Enabled && ctx->DrawBuffer->Visual.stencilBits > 0) {
       dsa->stencil[0].enabled = 1;
-      dsa->stencil[0].func = st_compare_func_to_pipe(st->ctx->Stencil.Function[0]);
-      dsa->stencil[0].fail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.FailFunc[0]);
-      dsa->stencil[0].zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[0]);
-      dsa->stencil[0].zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[0]);
-      dsa->stencil[0].ref_value = st->ctx->Stencil.Ref[0] & 0xff;
-      dsa->stencil[0].valuemask = st->ctx->Stencil.ValueMask[0] & 0xff;
-      dsa->stencil[0].writemask = st->ctx->Stencil.WriteMask[0] & 0xff;
-
-      if (st->ctx->Stencil._TestTwoSide) {
+      dsa->stencil[0].func = st_compare_func_to_pipe(ctx->Stencil.Function[0]);
+      dsa->stencil[0].fail_op = gl_stencil_op_to_pipe(ctx->Stencil.FailFunc[0]);
+      dsa->stencil[0].zfail_op = gl_stencil_op_to_pipe(ctx->Stencil.ZFailFunc[0]);
+      dsa->stencil[0].zpass_op = gl_stencil_op_to_pipe(ctx->Stencil.ZPassFunc[0]);
+      dsa->stencil[0].ref_value = ctx->Stencil.Ref[0] & 0xff;
+      dsa->stencil[0].valuemask = ctx->Stencil.ValueMask[0] & 0xff;
+      dsa->stencil[0].writemask = ctx->Stencil.WriteMask[0] & 0xff;
+
+      if (ctx->Stencil._TestTwoSide) {
+         const GLuint back = ctx->Stencil._BackFace;
          dsa->stencil[1].enabled = 1;
-         dsa->stencil[1].func = st_compare_func_to_pipe(st->ctx->Stencil.Function[1]);
-         dsa->stencil[1].fail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.FailFunc[1]);
-         dsa->stencil[1].zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[1]);
-         dsa->stencil[1].zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[1]);
-         dsa->stencil[1].ref_value = st->ctx->Stencil.Ref[1] & 0xff;
-         dsa->stencil[1].valuemask = st->ctx->Stencil.ValueMask[1] & 0xff;
-         dsa->stencil[1].writemask = st->ctx->Stencil.WriteMask[1] & 0xff;
+         dsa->stencil[1].func = st_compare_func_to_pipe(ctx->Stencil.Function[back]);
+         dsa->stencil[1].fail_op = gl_stencil_op_to_pipe(ctx->Stencil.FailFunc[back]);
+         dsa->stencil[1].zfail_op = gl_stencil_op_to_pipe(ctx->Stencil.ZFailFunc[back]);
+         dsa->stencil[1].zpass_op = gl_stencil_op_to_pipe(ctx->Stencil.ZPassFunc[back]);
+         dsa->stencil[1].ref_value = ctx->Stencil.Ref[back] & 0xff;
+         dsa->stencil[1].valuemask = ctx->Stencil.ValueMask[back] & 0xff;
+         dsa->stencil[1].writemask = ctx->Stencil.WriteMask[back] & 0xff;
       }
       else {
          dsa->stencil[1] = dsa->stencil[0];
@@ -131,10 +135,10 @@ update_depth_stencil_alpha(struct st_context *st)
       }
    }
 
-   if (st->ctx->Color.AlphaEnabled) {
+   if (ctx->Color.AlphaEnabled) {
       dsa->alpha.enabled = 1;
-      dsa->alpha.func = st_compare_func_to_pipe(st->ctx->Color.AlphaFunc);
-      dsa->alpha.ref_value = st->ctx->Color.AlphaRef;
+      dsa->alpha.func = st_compare_func_to_pipe(ctx->Color.AlphaFunc);
+      dsa->alpha.ref_value = ctx->Color.AlphaRef;
    }
 
    cso_set_depth_stencil_alpha(st->cso_context, dsa);
index 625efdd66b5d94552dd142d2cad262863a48b40a..df0f0931eab38f7a5ab264616927e648731df7e2 100644 (file)
@@ -112,15 +112,17 @@ update_framebuffer_state( struct st_context *st )
    for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
       strb = st_renderbuffer(fb->_ColorDrawBuffers[i]);
 
-      /*printf("--------- framebuffer surface rtt %p\n", strb->rtt);*/
-      if (strb->rtt) {
-         /* rendering to a GL texture, may have to update surface */
-         update_renderbuffer_surface(st, strb);
-      }
+      if (strb) {
+         /*printf("--------- framebuffer surface rtt %p\n", strb->rtt);*/
+         if (strb->rtt) {
+            /* rendering to a GL texture, may have to update surface */
+            update_renderbuffer_surface(st, strb);
+         }
 
-      if (strb->surface) {
-         framebuffer->cbufs[framebuffer->nr_cbufs] = strb->surface;
-         framebuffer->nr_cbufs++;
+         if (strb->surface) {
+            framebuffer->cbufs[framebuffer->nr_cbufs] = strb->surface;
+            framebuffer->nr_cbufs++;
+         }
       }
    }
 
@@ -154,7 +156,6 @@ update_framebuffer_state( struct st_context *st )
          (void) st_get_framebuffer_surface(stfb, ST_SURFACE_BACK_LEFT, &surf_back);
 
          st->pipe->surface_copy(st->pipe,
-                                FALSE,
                                 surf_front, 0, 0,  /* dest */
                                 surf_back, 0, 0,   /* src */
                                 fb->Width, fb->Height);
index a357b716771c53811dfe5c19fe49102a4457830f..8d0029dde5f7643211255091322b3ff7bb7eb791 100644 (file)
@@ -48,7 +48,6 @@
 
 #include "pipe/p_screen.h"
 #include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
 #include "util/u_pack_color.h"
 
 
@@ -140,7 +139,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
 {
    struct pipe_context *pipe = ctx->st->pipe;
    struct pipe_screen *screen = pipe->screen;
-   struct pipe_surface *surface;
+   struct pipe_transfer *transfer;
    const GLuint rSize = ctx->PixelMaps.RtoR.Size;
    const GLuint gSize = ctx->PixelMaps.GtoG.Size;
    const GLuint bSize = ctx->PixelMaps.BtoB.Size;
@@ -149,10 +148,9 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
    uint *dest;
    uint i, j;
 
-   surface = screen->get_tex_surface(screen, pt, 0, 0, 0, 
-                                     PIPE_BUFFER_USAGE_CPU_WRITE);
-   dest = (uint *) screen->surface_map(screen, surface,
-                                       PIPE_BUFFER_USAGE_CPU_WRITE);
+   transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
+                                       0, 0, texSize, texSize);
+   dest = (uint *) screen->transfer_map(screen, transfer);
 
    /* Pack four 1D maps into a 2D texture:
     * R map is placed horizontally, indexed by S, in channel 0
@@ -171,8 +169,8 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
       }
    }
 
-   screen->surface_unmap(screen, surface);
-   pipe_surface_reference(&surface, NULL);
+   screen->transfer_unmap(screen, transfer);
+   screen->tex_transfer_destroy(transfer);
 }
 
 
@@ -213,7 +211,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
    inst[ic].TexSrcTarget = TEXTURE_2D_INDEX;
    ic++;
    fp->Base.InputsRead = (1 << FRAG_ATTRIB_TEX0);
-   fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLR);
+   fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLOR);
    fp->Base.SamplersUsed = 0x1;  /* sampler 0 (bit 0) is used */
 
    if (key->scaleAndBias) {
@@ -401,7 +399,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
    {
       struct prog_instruction *last = &inst[ic - 1];
       last->DstReg.File = PROGRAM_OUTPUT;
-      last->DstReg.Index = FRAG_RESULT_COLR;
+      last->DstReg.Index = FRAG_RESULT_COLOR;
    }
 
    /* END; */
index cbd414e2d3b0f4ab8694aabc2f785bdb8edadb65..fc1ff5be04a59cc6d43b8c0885ea8512cdbddef1 100644 (file)
@@ -165,7 +165,7 @@ find_translated_vp(struct st_context *st,
 
    /* No?  Allocate translated vp object now */
    if (!xvp) {
-      xvp = CALLOC_STRUCT(translated_vertex_program);
+      xvp = ST_CALLOC_STRUCT(translated_vertex_program);
       xvp->frag_inputs = fragInputsRead;
       xvp->master = stvp;
 
@@ -298,7 +298,7 @@ st_free_translated_vertex_programs(struct st_context *st,
 
    while (xvp) {
       next = xvp->next;
-      free(xvp);
+      _mesa_free(xvp);
       xvp = next;
    }
 }
@@ -307,14 +307,9 @@ st_free_translated_vertex_programs(struct st_context *st,
 static void *
 get_passthrough_fs(struct st_context *st)
 {
-   struct pipe_shader_state shader;
-
    if (!st->passthrough_fs) {
       st->passthrough_fs =
-         util_make_fragment_passthrough_shader(st->pipe, &shader);
-#if 0      /* We actually need to keep the tokens around at this time */
-      free((void *) shader.tokens);
-#endif
+         util_make_fragment_passthrough_shader(st->pipe);
    }
 
    return st->passthrough_fs;
index 21f7321f97a3d6b80daaefeb020863a011694be8..4d4f97da7ed37b87717ca854cb5bfc9bf925de47 100644 (file)
@@ -37,7 +37,6 @@
 #include "st_texture.h"
 #include "st_cb_texture.h"
 #include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
 #include "cso_cache/cso_context.h"
 
 
index a4e72b48ed4b5cca52461af345bb247a45c7a18a..3f9a825a153e938d651cf92ae6d5c5abcdcdc7d0 100644 (file)
  * See also: st_renderbuffer_alloc_storage()
  */
 static void
-acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps,
+acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_transfer *acc_pt,
                   uint x, uint y, uint w, uint h, float *p)
 {
-   const enum pipe_format f = acc_ps->format;
-   const struct pipe_format_block b = acc_ps->block;
+   const enum pipe_format f = acc_pt->format;
+   const struct pipe_format_block b = acc_pt->block;
 
-   acc_ps->format = DEFAULT_ACCUM_PIPE_FORMAT;
-   acc_ps->block.size = 8;
-   acc_ps->block.width = 1;
-   acc_ps->block.height = 1;
+   acc_pt->format = DEFAULT_ACCUM_PIPE_FORMAT;
+   acc_pt->block.size = 8;
+   acc_pt->block.width = 1;
+   acc_pt->block.height = 1;
 
-   pipe_get_tile_rgba(acc_ps, x, y, w, h, p);
+   pipe_get_tile_rgba(acc_pt, x, y, w, h, p);
 
-   acc_ps->format = f;
-   acc_ps->block = b;
+   acc_pt->format = f;
+   acc_pt->block = b;
 }
 
 
@@ -87,21 +87,21 @@ acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps,
  * See also: st_renderbuffer_alloc_storage()
  */
 static void
-acc_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps,
+acc_put_tile_rgba(struct pipe_context *pipe, struct pipe_transfer *acc_pt,
                   uint x, uint y, uint w, uint h, const float *p)
 {
-   enum pipe_format f = acc_ps->format;
-   const struct pipe_format_block b = acc_ps->block;
+   enum pipe_format f = acc_pt->format;
+   const struct pipe_format_block b = acc_pt->block;
 
-   acc_ps->format = DEFAULT_ACCUM_PIPE_FORMAT;
-   acc_ps->block.size = 8;
-   acc_ps->block.width = 1;
-   acc_ps->block.height = 1;
+   acc_pt->format = DEFAULT_ACCUM_PIPE_FORMAT;
+   acc_pt->block.size = 8;
+   acc_pt->block.width = 1;
+   acc_pt->block.height = 1;
 
-   pipe_put_tile_rgba(acc_ps, x, y, w, h, p);
+   pipe_put_tile_rgba(acc_pt, x, y, w, h, p);
 
-   acc_ps->format = f;
-   acc_ps->block = b;
+   acc_pt->format = f;
+   acc_pt->block = b;
 }
 
 
@@ -110,7 +110,7 @@ void
 st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
 {
    struct st_renderbuffer *acc_strb = st_renderbuffer(rb);
-   struct pipe_surface *acc_ps;
+   struct pipe_transfer *acc_pt;
    struct pipe_screen *screen = ctx->st->pipe->screen;
    const GLint xpos = ctx->DrawBuffer->_Xmin;
    const GLint ypos = ctx->DrawBuffer->_Ymin;
@@ -118,12 +118,12 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
    const GLint height = ctx->DrawBuffer->_Ymax - ypos;
    GLubyte *map;
 
-   acc_ps = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0,
-                                    PIPE_BUFFER_USAGE_CPU_WRITE);
-   map = screen->surface_map(screen, acc_ps,
-                             PIPE_BUFFER_USAGE_CPU_WRITE);
+   acc_pt = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
+                                     PIPE_TRANSFER_WRITE, xpos, ypos,
+                                     width, height);
+   map = screen->transfer_map(screen, acc_pt);
 
-   /* note acc_strb->format might not equal acc_ps->format */
+   /* note acc_strb->format might not equal acc_pt->format */
    switch (acc_strb->format) {
    case PIPE_FORMAT_R16G16B16A16_SNORM:
       {
@@ -133,7 +133,7 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
          GLshort a = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]);
          int i, j;
          for (i = 0; i < height; i++) {
-            GLshort *dst = (GLshort *) (map + (ypos + i) * acc_ps->stride + xpos * 8);
+            GLshort *dst = (GLshort *) (map + i * acc_pt->stride + xpos * 8);
             for (j = 0; j < width; j++) {
                dst[0] = r;
                dst[1] = g;
@@ -148,8 +148,8 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
       _mesa_problem(ctx, "unexpected format in st_clear_accum_buffer()");
    }
 
-   screen->surface_unmap(screen, acc_ps);
-   pipe_surface_reference(&acc_ps, NULL);
+   screen->transfer_unmap(screen, acc_pt);
+   screen->tex_transfer_destroy(acc_pt);
 }
 
 
@@ -160,19 +160,21 @@ accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias,
           struct st_renderbuffer *acc_strb)
 {
    struct pipe_screen *screen = ctx->st->pipe->screen;
-   struct pipe_surface *acc_ps = acc_strb->surface;
+   struct pipe_transfer *acc_pt;
    GLubyte *map;
 
-   map = screen->surface_map(screen, acc_ps, 
-                             PIPE_BUFFER_USAGE_CPU_WRITE);
+   acc_pt = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
+                                     PIPE_TRANSFER_READ_WRITE, xpos, ypos,
+                                     width, height);
+   map = screen->transfer_map(screen, acc_pt);
 
-   /* note acc_strb->format might not equal acc_ps->format */
+   /* note acc_strb->format might not equal acc_pt->format */
    switch (acc_strb->format) {
    case PIPE_FORMAT_R16G16B16A16_SNORM:
       {
          int i, j;
          for (i = 0; i < height; i++) {
-            GLshort *acc = (GLshort *) (map + (ypos + i) * acc_ps->stride + xpos * 8);
+            GLshort *acc = (GLshort *) (map + (ypos + i) * acc_pt->stride + xpos * 8);
             for (j = 0; j < width * 4; j++) {
                float val = SHORT_TO_FLOAT(acc[j]) * scale + bias;
                acc[j] = FLOAT_TO_SHORT(val);
@@ -184,7 +186,8 @@ accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias,
       _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
    }
 
-   screen->surface_unmap(screen, acc_ps);
+   screen->transfer_unmap(screen, acc_pt);
+   screen->tex_transfer_destroy(acc_pt);
 }
 
 
@@ -195,33 +198,39 @@ accum_accum(struct pipe_context *pipe, GLfloat value,
             struct st_renderbuffer *color_strb)
 {
    struct pipe_screen *screen = pipe->screen;
-   struct pipe_surface *acc_surf, *color_surf;
+   struct pipe_transfer *acc_trans, *color_trans;
    GLfloat *colorBuf, *accBuf;
    GLint i;
 
-   acc_surf = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0,
-                                      (PIPE_BUFFER_USAGE_CPU_WRITE |
-                                       PIPE_BUFFER_USAGE_CPU_READ));
+   acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
+                                        PIPE_TRANSFER_READ, xpos, ypos,
+                                        width, height);
 
-   color_surf = screen->get_tex_surface(screen, color_strb->texture, 0, 0, 0,
-                                        PIPE_BUFFER_USAGE_CPU_READ);
+   color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0,
+                                          PIPE_TRANSFER_READ, xpos, ypos,
+                                          width, height);
 
-   colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
-   accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+   colorBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+   accBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
 
-   pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, colorBuf);
-   acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf);
+   pipe_get_tile_rgba(color_trans, 0, 0, width, height, colorBuf);
+   acc_get_tile_rgba(pipe, acc_trans, 0, 0, width, height, accBuf);
 
    for (i = 0; i < 4 * width * height; i++) {
       accBuf[i] = accBuf[i] + colorBuf[i] * value;
    }
 
-   acc_put_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf);
+   screen->tex_transfer_destroy(acc_trans);
+   acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
+                                        PIPE_TRANSFER_WRITE, xpos, ypos,
+                                        width, height);
 
-   free(colorBuf);
-   free(accBuf);
-   pipe_surface_reference(&acc_surf, NULL);
-   pipe_surface_reference(&color_surf, NULL);
+   acc_put_tile_rgba(pipe, acc_trans, 0, 0, width, height, accBuf);
+
+   _mesa_free(colorBuf);
+   _mesa_free(accBuf);
+   screen->tex_transfer_destroy(acc_trans);
+   screen->tex_transfer_destroy(color_trans);
 }
 
 
@@ -232,29 +241,31 @@ accum_load(struct pipe_context *pipe, GLfloat value,
            struct st_renderbuffer *color_strb)
 {
    struct pipe_screen *screen = pipe->screen;
-   struct pipe_surface *acc_surf, *color_surf;
+   struct pipe_transfer *acc_trans, *color_trans;
    GLfloat *buf;
    GLint i;
 
-   acc_surf = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0,
-                                      PIPE_BUFFER_USAGE_CPU_WRITE);
+   acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
+                                        PIPE_TRANSFER_WRITE, xpos, ypos,
+                                        width, height);
 
-   color_surf = screen->get_tex_surface(screen, color_strb->texture, 0, 0, 0,
-                                        PIPE_BUFFER_USAGE_CPU_READ);
+   color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0,
+                                        PIPE_TRANSFER_READ, xpos, ypos,
+                                        width, height);
 
-   buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+   buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
 
-   pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, buf);
+   pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
 
    for (i = 0; i < 4 * width * height; i++) {
       buf[i] = buf[i] * value;
    }
 
-   acc_put_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, buf);
+   acc_put_tile_rgba(pipe, acc_trans, 0, 0, width, height, buf);
 
-   free(buf);
-   pipe_surface_reference(&acc_surf, NULL);
-   pipe_surface_reference(&color_surf, NULL);
+   _mesa_free(buf);
+   screen->tex_transfer_destroy(acc_trans);
+   screen->tex_transfer_destroy(color_trans);
 }
 
 
@@ -267,24 +278,25 @@ accum_return(GLcontext *ctx, GLfloat value,
    struct pipe_context *pipe = ctx->st->pipe;
    struct pipe_screen *screen = pipe->screen;
    const GLubyte *colormask = ctx->Color.ColorMask;
-   struct pipe_surface *acc_surf, *color_surf;
+   struct pipe_transfer *acc_trans, *color_trans;
    GLfloat *abuf, *cbuf = NULL;
    GLint i, ch;
 
-   abuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+   abuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
 
-   acc_surf = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0,
-                                      PIPE_BUFFER_USAGE_CPU_READ);
+   acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
+                                        PIPE_TRANSFER_READ, xpos, ypos,
+                                        width, height);
 
-   color_surf = screen->get_tex_surface(screen, color_strb->texture, 0, 0, 0,
-                                        (PIPE_BUFFER_USAGE_CPU_READ |
-                                         PIPE_BUFFER_USAGE_CPU_WRITE));
+   color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0,
+                                          PIPE_TRANSFER_READ_WRITE, xpos, ypos,
+                                          width, height);
 
-   acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, abuf);
+   acc_get_tile_rgba(pipe, acc_trans, 0, 0, width, height, abuf);
 
    if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) {
-      cbuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
-      pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, cbuf);
+      cbuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+      pipe_get_tile_rgba(color_trans, 0, 0, width, height, cbuf);
    }
 
    for (i = 0; i < width * height; i++) {
@@ -299,13 +311,13 @@ accum_return(GLcontext *ctx, GLfloat value,
       }
    }
 
-   pipe_put_tile_rgba(color_surf, xpos, ypos, width, height, abuf);
+   pipe_put_tile_rgba(color_trans, 0, 0, width, height, abuf);
 
-   free(abuf);
+   _mesa_free(abuf);
    if (cbuf)
-      free(cbuf);
-   pipe_surface_reference(&acc_surf, NULL);
-   pipe_surface_reference(&color_surf, NULL);
+      _mesa_free(cbuf);
+   screen->tex_transfer_destroy(acc_trans);
+   screen->tex_transfer_destroy(color_trans);
 }
 
 
index f14e562400b7a8f27fd881518edbbd3493bf933c..2d547dd0722da1b73a6e4a3d00cf7a2d22b302bc 100644 (file)
@@ -93,7 +93,7 @@ struct bitmap_cache
    GLfloat color[4];
 
    struct pipe_texture *texture;
-   struct pipe_surface *surf;
+   struct pipe_transfer *trans;
 
    GLboolean empty;
 
@@ -142,6 +142,10 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex)
    /* KIL if -tmp0 < 0 # texel=0 -> keep / texel=0 -> discard */
    p->Instructions[ic].Opcode = OPCODE_KIL;
    p->Instructions[ic].SrcReg[0].File = PROGRAM_TEMPORARY;
+
+   if (ctx->st->bitmap.tex_format == PIPE_FORMAT_L8_UNORM)
+      p->Instructions[ic].SrcReg[0].Swizzle = SWIZZLE_XXXX;
+
    p->Instructions[ic].SrcReg[0].Index = 0;
    p->Instructions[ic].SrcReg[0].NegateBase = NEGATE_XYZW;
    ic++;
@@ -157,7 +161,11 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex)
 
    stfp = (struct st_fragment_program *) p;
    stfp->Base.UsesKill = GL_TRUE;
-   st_translate_fragment_program(ctx->st, stfp, NULL);
+
+   /* No need to send this incomplete program down to hardware:
+    *
+    * st_translate_fragment_program(ctx->st, stfp, NULL);
+    */
 
    return stfp;
 }
@@ -308,7 +316,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
 {
    struct pipe_context *pipe = ctx->st->pipe;
    struct pipe_screen *screen = pipe->screen;
-   struct pipe_surface *surface;
+   struct pipe_transfer *transfer;
    ubyte *dest;
    struct pipe_texture *pt;
 
@@ -329,22 +337,21 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
       return NULL;
    }
 
-   surface = screen->get_tex_surface(screen, pt, 0, 0, 0,
-                                     PIPE_BUFFER_USAGE_CPU_WRITE);
+   transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
+                                       0, 0, width, height);
 
-   /* map texture surface */
-   dest = screen->surface_map(screen, surface, PIPE_BUFFER_USAGE_CPU_WRITE);
+   dest = screen->transfer_map(screen, transfer);
 
-   /* Put image into texture surface */
-   memset(dest, 0xff, height * surface->stride);
+   /* Put image into texture transfer */
+   memset(dest, 0xff, height * transfer->stride);
    unpack_bitmap(ctx->st, 0, 0, width, height, unpack, bitmap,
-                 dest, surface->stride);
+                 dest, transfer->stride);
 
    _mesa_unmap_bitmap_pbo(ctx, unpack);
 
-   /* Release surface */
-   screen->surface_unmap(screen, surface);
-   pipe_surface_reference(&surface, NULL);
+   /* Release transfer */
+   screen->transfer_unmap(screen, transfer);
+   screen->tex_transfer_destroy(transfer);
 
    return pt;
 }
@@ -372,7 +379,7 @@ setup_bitmap_vertex_data(struct st_context *st,
    GLuint i;
 
    if (st->bitmap.vbuf_slot >= max_slots) {
-      pipe_buffer_reference(pipe->screen, &st->bitmap.vbuf, NULL);
+      pipe_buffer_reference(&st->bitmap.vbuf, NULL);
       st->bitmap.vbuf_slot = 0;
    }
 
@@ -418,17 +425,11 @@ setup_bitmap_vertex_data(struct st_context *st,
    }
 
    /* put vertex data into vbuf */
-   {
-      char *buf = pipe_buffer_map(pipe->screen, 
-                                  st->bitmap.vbuf, 
-                                  PIPE_BUFFER_USAGE_CPU_WRITE);
-
-      memcpy(buf + st->bitmap.vbuf_slot * sizeof st->bitmap.vertices, 
-             st->bitmap.vertices, 
-             sizeof st->bitmap.vertices);
-
-      pipe_buffer_unmap(pipe->screen, st->bitmap.vbuf);
-   }
+   pipe_buffer_write(pipe->screen, 
+                     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;
 }
@@ -569,8 +570,8 @@ reset_cache(struct st_context *st)
    cache->ymin = 1000000;
    cache->ymax = -1000000;
 
-   if (cache->surf)
-      screen->tex_surface_release(screen, &cache->surf);
+   if (cache->trans)
+      screen->tex_transfer_destroy(cache->trans);
 
    assert(!cache->texture);
 
@@ -581,16 +582,17 @@ reset_cache(struct st_context *st)
                                       1, 0,
                                       PIPE_TEXTURE_USAGE_SAMPLER);
 
-   /* Map the texture surface.
+   /* Map the texture transfer.
     * Subsequent glBitmap calls will write into the texture image.
     */
-   cache->surf = screen->get_tex_surface(screen, cache->texture, 0, 0, 0,
-                                         PIPE_BUFFER_USAGE_CPU_WRITE);
-   cache->buffer = screen->surface_map(screen, cache->surf,
-                                       PIPE_BUFFER_USAGE_CPU_WRITE);
+   cache->trans = screen->get_tex_transfer(screen, cache->texture, 0, 0, 0,
+                                           PIPE_TRANSFER_WRITE, 0, 0,
+                                           BITMAP_CACHE_WIDTH,
+                                           BITMAP_CACHE_HEIGHT);
+   cache->buffer = screen->transfer_map(screen, cache->trans);
 
    /* init image to all 0xff */
-   memset(cache->buffer, 0xff, BITMAP_CACHE_WIDTH * BITMAP_CACHE_HEIGHT);
+   memset(cache->buffer, 0xff, cache->trans->stride * BITMAP_CACHE_HEIGHT);
 }
 
 
@@ -615,13 +617,14 @@ st_flush_bitmap_cache(struct st_context *st)
                 cache->xpos, cache->ypos);
 */
 
-         /* The texture surface has been mapped until now.
-          * So unmap and release the texture surface before drawing.
+         /* The texture transfer has been mapped until now.
+          * So unmap and release the texture transfer before drawing.
           */
-         screen->surface_unmap(screen, cache->surf);
+         screen->transfer_unmap(screen, cache->trans);
          cache->buffer = NULL;
 
-         screen->tex_surface_release(screen, &cache->surf);
+         screen->tex_transfer_destroy(cache->trans);
+         cache->trans = NULL;
 
          draw_bitmap_quad(st->ctx,
                           cache->xpos,
@@ -649,7 +652,7 @@ st_flush_bitmap( struct st_context *st )
    /* Release vertex buffer to avoid synchronous rendering if we were
     * to map it in the next frame.
     */
-   pipe_buffer_reference(st->pipe->screen, &st->bitmap.vbuf, NULL);
+   pipe_buffer_reference(&st->bitmap.vbuf, NULL);
    st->bitmap.vbuf_slot = 0;
 }
 
@@ -737,8 +740,7 @@ st_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
       const uint semantic_indexes[] = { 0, 0, 0 };
       st->bitmap.vs = util_make_vertex_passthrough_shader(st->pipe, 3,
                                                           semantic_names,
-                                                          semantic_indexes,
-                                                          &st->bitmap.vert_shader);
+                                                          semantic_indexes);
    }
 
    if (UseBitmapCache && accum_bitmap(st, x, y, width, height, unpack, bitmap))
@@ -785,20 +787,27 @@ st_init_bitmap(struct st_context *st)
    /* init baseline rasterizer state once */
    memset(&st->bitmap.rasterizer, 0, sizeof(st->bitmap.rasterizer));
    st->bitmap.rasterizer.gl_rasterization_rules = 1;
-   st->bitmap.rasterizer.bypass_vs = 1;
 
    /* find a usable texture format */
    if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D, 
                                    PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
       st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM;
    }
+   else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, PIPE_TEXTURE_2D, 
+                                        PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
+      st->bitmap.tex_format = PIPE_FORMAT_A8_UNORM;
+   }
+   else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D, 
+                                        PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
+      st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM;
+   }
    else {
       /* XXX support more formats */
       assert(0);
    }
 
    /* alloc bitmap cache object */
-   st->bitmap.cache = CALLOC_STRUCT(bitmap_cache);
+   st->bitmap.cache = ST_CALLOC_STRUCT(bitmap_cache);
 
    reset_cache(st);
 }
@@ -812,8 +821,8 @@ st_destroy_bitmap(struct st_context *st)
    struct pipe_screen *screen = pipe->screen;
    struct bitmap_cache *cache = st->bitmap.cache;
 
-   screen->surface_unmap(screen, cache->surf);
-   screen->tex_surface_release(screen, &cache->surf);
+   screen->transfer_unmap(screen, cache->trans);
+   screen->tex_transfer_destroy(cache->trans);
 
    if (st->bitmap.vs) {
       cso_delete_vertex_shader(st->cso_context, st->bitmap.vs);
@@ -821,13 +830,13 @@ st_destroy_bitmap(struct st_context *st)
    }
 
    if (st->bitmap.vbuf) {
-      pipe_buffer_reference(pipe->screen, &st->bitmap.vbuf, NULL);
+      pipe_buffer_reference(&st->bitmap.vbuf, NULL);
       st->bitmap.vbuf = NULL;
    }
 
    if (st->bitmap.cache) {
-      pipe_texture_release(&st->bitmap.cache->texture);
-      FREE(st->bitmap.cache);
+      pipe_texture_reference(&st->bitmap.cache->texture, NULL);
+      _mesa_free(st->bitmap.cache);
       st->bitmap.cache = NULL;
    }
 }
index 07fa2afce055e86f0fb84578fe028366e9857332..3651e4ae7dcb611b445bedebbda3b0f5e4b38cd2 100644 (file)
@@ -55,7 +55,7 @@
 static struct gl_buffer_object *
 st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target)
 {
-   struct st_buffer_object *st_obj = CALLOC_STRUCT(st_buffer_object);
+   struct st_buffer_object *st_obj = ST_CALLOC_STRUCT(st_buffer_object);
 
    if (!st_obj)
       return NULL;
@@ -74,13 +74,12 @@ st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target)
 static void
 st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj)
 {
-   struct pipe_context *pipe = st_context(ctx)->pipe;
    struct st_buffer_object *st_obj = st_buffer_object(obj);
 
    if (st_obj->buffer) 
-      pipe_buffer_reference(pipe->screen, &st_obj->buffer, NULL);
+      pipe_buffer_reference(&st_obj->buffer, NULL);
 
-   free(st_obj);
+   _mesa_free(st_obj);
 }
 
 
@@ -100,14 +99,11 @@ st_bufferobj_subdata(GLcontext *ctx,
 {
    struct pipe_context *pipe = st_context(ctx)->pipe;
    struct st_buffer_object *st_obj = st_buffer_object(obj);
-   char *map;
 
    if (offset >= st_obj->size || size > (st_obj->size - offset))
       return;
 
-   map = pipe_buffer_map(pipe->screen, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
-   memcpy(map + offset, data, size);
-   pipe_buffer_unmap(pipe->screen, st_obj->buffer);
+   pipe_buffer_write(pipe->screen, st_obj->buffer, offset, size, data);
 }
 
 
@@ -123,14 +119,11 @@ st_bufferobj_get_subdata(GLcontext *ctx,
 {
    struct pipe_context *pipe = st_context(ctx)->pipe;
    struct st_buffer_object *st_obj = st_buffer_object(obj);
-   char *map;
 
    if (offset >= st_obj->size || size > (st_obj->size - offset))
       return;
 
-   map = pipe_buffer_map(pipe->screen, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
-   memcpy(data, map + offset, size);
-   pipe_buffer_unmap(pipe->screen, st_obj->buffer);
+   pipe_buffer_read(pipe->screen, st_obj->buffer, offset, size, data);
 }
 
 
@@ -171,7 +164,7 @@ st_bufferobj_data(GLcontext *ctx,
       buffer_usage = 0;
    }
 
-   pipe_buffer_reference( pipe->screen, &st_obj->buffer, NULL );
+   pipe_buffer_reference( &st_obj->buffer, NULL );
 
    st_obj->buffer = pipe_buffer_create( pipe->screen, 32, buffer_usage, size );
 
@@ -208,12 +201,77 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
    }
 
    obj->Pointer = pipe_buffer_map(pipe->screen, st_obj->buffer, flags);
+   if(obj->Pointer) {
+      obj->Offset = 0;
+      obj->Length = obj->Size;
+   }
    return obj->Pointer;
 }
 
 
+
 /**
- * Called via glMapBufferARB().
+ * Called via glMapBufferRange().
+ */
+static void *
+st_bufferobj_map_range(GLcontext *ctx, GLenum target, 
+                       GLintptr offset, GLsizeiptr length, GLbitfield access,
+                       struct gl_buffer_object *obj)
+{
+   struct pipe_context *pipe = st_context(ctx)->pipe;
+   struct st_buffer_object *st_obj = st_buffer_object(obj);
+   GLuint flags = 0;
+   char *map;
+
+   if (access & GL_MAP_WRITE_BIT)
+      flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
+
+   if (access & GL_MAP_READ_BIT)
+      flags |= PIPE_BUFFER_USAGE_CPU_READ;
+
+   /* ... other flags ...
+    */
+
+   if (access & MESA_MAP_NOWAIT_BIT)
+      flags |= PIPE_BUFFER_USAGE_DONTBLOCK;
+
+   assert(offset >= 0);
+   assert(length >= 0);
+   assert(offset < obj->Size);
+   assert(offset + length <= obj->Size);
+
+   map = obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags);
+   if(obj->Pointer) {
+      obj->Offset = 0;
+      obj->Length = obj->Size;
+      map += offset;
+   }
+   
+   return map;
+}
+
+
+static void
+st_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target, 
+                                GLintptr offset, GLsizeiptr length,
+                                struct gl_buffer_object *obj)
+{
+   struct pipe_context *pipe = st_context(ctx)->pipe;
+   struct st_buffer_object *st_obj = st_buffer_object(obj);
+
+   /* Subrange is relative to mapped range */
+   assert(offset >= 0);
+   assert(length >= 0);
+   assert(offset < obj->Length);
+   assert(offset + length <= obj->Length);
+   
+   pipe_buffer_flush_mapped_range(pipe->screen, st_obj->buffer, 
+                                  obj->Offset + offset, length);
+}
+
+
+/**
+ * Called via glUnmapBufferARB().
  */
 static GLboolean
 st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
@@ -223,6 +281,8 @@ st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
 
    pipe_buffer_unmap(pipe->screen, st_obj->buffer);
    obj->Pointer = NULL;
+   obj->Offset = 0;
+   obj->Length = 0;
    return GL_TRUE;
 }
 
@@ -236,5 +296,7 @@ st_init_bufferobject_functions(struct dd_function_table *functions)
    functions->BufferSubData = st_bufferobj_subdata;
    functions->GetBufferSubData = st_bufferobj_get_subdata;
    functions->MapBuffer = st_bufferobj_map;
+   functions->MapBufferRange = st_bufferobj_map_range;
+   functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range;
    functions->UnmapBuffer = st_bufferobj_unmap;
 }
index 668c3f9ebf4aa6a85da09bcbc00333ffcd38a20d..dd9ba2881f94a5a69f9d3ab1ae7dfed2990c985f 100644 (file)
@@ -60,24 +60,15 @@ st_init_clear(struct st_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;
-   st->clear.raster.bypass_clipping = 1;
-
-   /* viewport state: identity since we're drawing in window coords */
-   st->clear.viewport.scale[0] = 1.0;
-   st->clear.viewport.scale[1] = 1.0;
-   st->clear.viewport.scale[2] = 1.0;
-   st->clear.viewport.scale[3] = 1.0;
-   st->clear.viewport.translate[0] = 0.0;
-   st->clear.viewport.translate[1] = 0.0;
-   st->clear.viewport.translate[2] = 0.0;
-   st->clear.viewport.translate[3] = 0.0;
+
+   /* rasterizer state: bypass vertex shader, clipping and viewport */
+   st->clear.raster.bypass_vs_clip_and_viewport = 1;
 
    /* fragment shader state: color pass-through program */
    st->clear.fs =
-      util_make_fragment_passthrough_shader(pipe, &st->clear.frag_shader);
+      util_make_fragment_passthrough_shader(pipe);
 
    /* vertex shader state: color/position pass-through */
    {
@@ -86,8 +77,7 @@ st_init_clear(struct st_context *st)
       const uint semantic_indexes[] = { 0, 0 };
       st->clear.vs = util_make_vertex_passthrough_shader(pipe, 2,
                                                          semantic_names,
-                                                         semantic_indexes,
-                                                         &st->clear.vert_shader);
+                                                         semantic_indexes);
    }
 }
 
@@ -95,18 +85,6 @@ st_init_clear(struct st_context *st)
 void
 st_destroy_clear(struct st_context *st)
 {
-   struct pipe_context *pipe = st->pipe;
-
-   if (st->clear.vert_shader.tokens) {
-      FREE((void *) st->clear.vert_shader.tokens);
-      st->clear.vert_shader.tokens = NULL;
-   }
-
-   if (st->clear.frag_shader.tokens) {
-      FREE((void *) st->clear.frag_shader.tokens);
-      st->clear.frag_shader.tokens = NULL;
-   }
-
    if (st->clear.fs) {
       cso_delete_fragment_shader(st->cso_context, st->clear.fs);
       st->clear.fs = NULL;
@@ -116,7 +94,7 @@ st_destroy_clear(struct st_context *st)
       st->clear.vs = NULL;
    }
    if (st->clear.vbuf) {
-      pipe_buffer_reference(pipe->screen, &st->clear.vbuf, NULL);
+      pipe_buffer_reference(&st->clear.vbuf, NULL);
       st->clear.vbuf = NULL;
    }
 }
@@ -138,8 +116,9 @@ is_depth_stencil_format(enum pipe_format pipeFormat)
 
 /**
  * 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 (which will flip Y if needed).
+ * Coords are window coords with y=0=bottom.  These will be passed
+ * through unmodified to the rasterizer as we have set
+ * rasterizer->bypass_vs_clip_and_viewport.
  */
 static void
 draw_quad(GLcontext *ctx,
@@ -150,10 +129,9 @@ draw_quad(GLcontext *ctx,
    struct pipe_context *pipe = st->pipe;
    const GLuint max_slots = 1024 / sizeof(st->clear.vertices);
    GLuint i;
-   void *buf;
 
    if (st->clear.vbuf_slot >= max_slots) {
-      pipe_buffer_reference(pipe->screen, &st->clear.vbuf, NULL);
+      pipe_buffer_reference(&st->clear.vbuf, NULL);
       st->clear.vbuf_slot = 0;
    }
 
@@ -186,13 +164,10 @@ draw_quad(GLcontext *ctx,
    }
 
    /* put vertex data into vbuf */
-   buf = pipe_buffer_map(pipe->screen, st->clear.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
-
-   memcpy((char *)buf + st->clear.vbuf_slot * sizeof(st->clear.vertices), 
-          st->clear.vertices, 
-          sizeof(st->clear.vertices));
-
-   pipe_buffer_unmap(pipe->screen, st->clear.vbuf);
+   pipe_buffer_write(pipe->screen, st->clear.vbuf, 
+                     st->clear.vbuf_slot * sizeof(st->clear.vertices),
+                     sizeof(st->clear.vertices),
+                     st->clear.vertices);
 
    /* draw */
    util_draw_vertex_buffer(pipe, 
@@ -243,7 +218,6 @@ clear_with_quad(GLcontext *ctx,
    cso_save_blend(st->cso_context);
    cso_save_depth_stencil_alpha(st->cso_context);
    cso_save_rasterizer(st->cso_context);
-   cso_save_viewport(st->cso_context);
    cso_save_fragment_shader(st->cso_context);
    cso_save_vertex_shader(st->cso_context);
 
@@ -295,7 +269,6 @@ clear_with_quad(GLcontext *ctx,
    }
 
    cso_set_rasterizer(st->cso_context, &st->clear.raster);
-   cso_set_viewport(st->cso_context, &st->clear.viewport);
 
    cso_set_fragment_shader_handle(st->cso_context, st->clear.fs);
    cso_set_vertex_shader_handle(st->cso_context, st->clear.vs);
@@ -307,7 +280,6 @@ clear_with_quad(GLcontext *ctx,
    cso_restore_blend(st->cso_context);
    cso_restore_depth_stencil_alpha(st->cso_context);
    cso_restore_rasterizer(st->cso_context);
-   cso_restore_viewport(st->cso_context);
    cso_restore_fragment_shader(st->cso_context);
    cso_restore_vertex_shader(st->cso_context);
 }
@@ -528,7 +500,7 @@ void st_flush_clear( struct st_context *st )
    /* Release vertex buffer to avoid synchronous rendering if we were
     * to map it in the next frame.
     */
-   pipe_buffer_reference(st->pipe->screen, &st->clear.vbuf, NULL);
+   pipe_buffer_reference(&st->clear.vbuf, NULL);
    st->clear.vbuf_slot = 0;
 }
  
index 32bf21411da9d50fa89be7a7008346e484f9fa92..821ea67ce463ad0a21886d660830eda2b8b2c1fa 100644 (file)
@@ -75,7 +75,7 @@ is_passthrough_program(const struct gl_fragment_program *prog)
       if (inst[0].Opcode == OPCODE_MOV &&
           inst[1].Opcode == OPCODE_END &&
           inst[0].DstReg.File == PROGRAM_OUTPUT &&
-          inst[0].DstReg.Index == FRAG_RESULT_COLR &&
+          inst[0].DstReg.Index == FRAG_RESULT_COLOR &&
           inst[0].DstReg.WriteMask == WRITEMASK_XYZW &&
           inst[0].SrcReg[0].File == PROGRAM_INPUT &&
           inst[0].SrcReg[0].Index == FRAG_ATTRIB_COL0 &&
@@ -158,7 +158,7 @@ combined_drawpix_fragment_program(GLcontext *ctx)
 
 /**
  * Create fragment shader that does a TEX() instruction to get a Z
- * value, then writes to FRAG_RESULT_DEPR.
+ * value, then writes to FRAG_RESULT_DEPTH.
  * Pass fragment color through as-is.
  */
 static struct st_fragment_program *
@@ -191,7 +191,7 @@ make_fragment_shader_z(struct st_context *st)
    /* TEX result.depth, fragment.texcoord[0], texture[0], 2D; */
    p->Instructions[ic].Opcode = OPCODE_TEX;
    p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
-   p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPR;
+   p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH;
    p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z;
    p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
    p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
@@ -202,7 +202,7 @@ make_fragment_shader_z(struct st_context *st)
    /* MOV result.color, fragment.color */
    p->Instructions[ic].Opcode = OPCODE_MOV;
    p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
-   p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLR;
+   p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR;
    p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
    p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0;
    ic++;
@@ -213,7 +213,7 @@ make_fragment_shader_z(struct st_context *st)
    assert(ic == p->NumInstructions);
 
    p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0;
-   p->OutputsWritten = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_DEPR);
+   p->OutputsWritten = (1 << FRAG_RESULT_COLOR) | (1 << FRAG_RESULT_DEPTH);
    p->SamplersUsed = 0x1;  /* sampler 0 (bit 0) is used */
 
    st->drawpix.z_shader = (struct st_fragment_program *) p;
@@ -358,7 +358,7 @@ make_texture(struct st_context *st,
    }
 
    {
-      struct pipe_surface *surface;
+      struct pipe_transfer *transfer;
       static const GLuint dstImageOffsets = 0;
       GLboolean success;
       GLubyte *dest;
@@ -367,14 +367,14 @@ make_texture(struct st_context *st,
       /* we'll do pixel transfer in a fragment shader */
       ctx->_ImageTransferState = 0x0;
 
-      surface = screen->get_tex_surface(screen, pt, 0, 0, 0,
-                                        PIPE_BUFFER_USAGE_CPU_WRITE);
+      transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0,
+                                          PIPE_TRANSFER_WRITE, 0, 0,
+                                          width, height);
 
-      /* map texture surface */
-      dest = screen->surface_map(screen, surface,
-                                 PIPE_BUFFER_USAGE_CPU_WRITE);
+      /* map texture transfer */
+      dest = screen->transfer_map(screen, transfer);
 
-      /* Put image into texture surface.
+      /* Put image into texture transfer.
        * Note that the image is actually going to be upside down in
        * the texture.  We deal with that with texcoords.
        */
@@ -383,7 +383,7 @@ make_texture(struct st_context *st,
                                     mformat,          /* gl_texture_format */
                                     dest,             /* dest */
                                     0, 0, 0,          /* dstX/Y/Zoffset */
-                                    surface->stride,  /* dstRowStride, bytes */
+                                    transfer->stride, /* dstRowStride, bytes */
                                     &dstImageOffsets, /* dstImageOffsets */
                                     width, height, 1, /* size */
                                     format, type,     /* src format/type */
@@ -391,8 +391,8 @@ make_texture(struct st_context *st,
                                     unpack);
 
       /* unmap */
-      screen->surface_unmap(screen, surface);
-      pipe_surface_reference(&surface, NULL);
+      screen->transfer_unmap(screen, transfer);
+      screen->tex_transfer_destroy(transfer);
 
       assert(success);
 
@@ -485,20 +485,17 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
 
    {
       struct pipe_buffer *buf;
-      ubyte *map;
 
       /* allocate/load buffer object with vertex data */
       buf = pipe_buffer_create(pipe->screen, 32, PIPE_BUFFER_USAGE_VERTEX,
                                sizeof(verts));
-      map = pipe_buffer_map(pipe->screen, buf, PIPE_BUFFER_USAGE_CPU_WRITE);
-      memcpy(map, verts, sizeof(verts));
-      pipe_buffer_unmap(pipe->screen, buf);
+      pipe_buffer_write(pipe->screen, buf, 0, sizeof(verts), verts);
 
       util_draw_vertex_buffer(pipe, buf, 0,
                               PIPE_PRIM_QUADS,
                               4,  /* verts */
                               3); /* attribs/vert */
-      pipe_buffer_reference(pipe->screen, &buf, NULL);
+      pipe_buffer_reference(&buf, NULL);
    }
 }
 
@@ -605,10 +602,9 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
    x1 = x + width * ctx->Pixel.ZoomX;
    y0 = (GLfloat) y;
    y1 = y + height * ctx->Pixel.ZoomY;
-   //if(!color)
+
    draw_quad(ctx, x0, y0, z, x1, y1, color, invertTex);
-   //else
-   //printf("skip draw quad\n");
+
    /* restore state */
    cso_restore_rasterizer(cso);
    cso_restore_viewport(cso);
@@ -619,117 +615,6 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
 }
 
 
-/**
- * Check if a GL format/type combination is a match to the given pipe format.
- * XXX probably move this to a re-usable place.
- */
-static GLboolean
-compatible_formats(GLenum format, GLenum type, enum pipe_format pipeFormat)
-{
-   static const GLuint one = 1;
-   GLubyte littleEndian = *((GLubyte *) &one);
-
-   if (pipeFormat == PIPE_FORMAT_R8G8B8A8_UNORM &&
-       format == GL_RGBA &&
-       type == GL_UNSIGNED_BYTE &&
-       !littleEndian) {
-      return GL_TRUE;
-   }
-   else if (pipeFormat == PIPE_FORMAT_R8G8B8A8_UNORM &&
-            format == GL_ABGR_EXT &&
-            type == GL_UNSIGNED_BYTE &&
-            littleEndian) {
-      return GL_TRUE;
-   }
-   else if (pipeFormat == PIPE_FORMAT_A8R8G8B8_UNORM &&
-            format == GL_BGRA &&
-            type == GL_UNSIGNED_BYTE &&
-            littleEndian) {
-      return GL_TRUE;
-   }
-   else if (pipeFormat == PIPE_FORMAT_R5G6B5_UNORM &&
-            format == GL_RGB &&
-            type == GL_UNSIGNED_SHORT_5_6_5) {
-      /* endian don't care */
-      return GL_TRUE;
-   }
-   else if (pipeFormat == PIPE_FORMAT_R5G6B5_UNORM &&
-            format == GL_BGR &&
-            type == GL_UNSIGNED_SHORT_5_6_5_REV) {
-      /* endian don't care */
-      return GL_TRUE;
-   }
-   else if (pipeFormat == PIPE_FORMAT_S8_UNORM &&
-            format == GL_STENCIL_INDEX &&
-            type == GL_UNSIGNED_BYTE) {
-      return GL_TRUE;
-   }
-   else if (pipeFormat == PIPE_FORMAT_Z32_UNORM &&
-            format == GL_DEPTH_COMPONENT &&
-            type == GL_UNSIGNED_INT) {
-      return GL_TRUE;
-   }
-   /* XXX add more cases */
-   else {
-      return GL_FALSE;
-   }
-}
-
-
-/**
- * Check if any per-fragment ops are enabled.
- * XXX probably move this to a re-usable place.
- */
-static GLboolean
-any_fragment_ops(const struct st_context *st)
-{
-   if (st->state.depth_stencil.alpha.enabled ||
-       st->state.depth_stencil.depth.enabled ||
-       st->state.blend.blend_enable ||
-       st->state.blend.logicop_enable)
-      /* XXX more checks */
-      return GL_TRUE;
-   else
-      return GL_FALSE;
-}
-
-
-/**
- * Check if any pixel transfer ops are enabled.
- * XXX probably move this to a re-usable place.
- */
-static GLboolean
-any_pixel_transfer_ops(const struct st_context *st)
-{
-   if (st->ctx->Pixel.RedScale != 1.0 ||
-       st->ctx->Pixel.RedBias != 0.0 ||
-       st->ctx->Pixel.GreenScale != 1.0 ||
-       st->ctx->Pixel.GreenBias != 0.0 ||
-       st->ctx->Pixel.BlueScale != 1.0 ||
-       st->ctx->Pixel.BlueBias != 0.0 ||
-       st->ctx->Pixel.AlphaScale != 1.0 ||
-       st->ctx->Pixel.AlphaBias != 0.0 ||
-       st->ctx->Pixel.MapColorFlag)
-      /* XXX more checks */
-      return GL_TRUE;
-   else
-      return GL_FALSE;
-}
-
-
-/**
- * Draw image with a blit, or other non-textured quad method.
- */
-static void
-draw_blit(struct st_context *st,
-          GLsizei width, GLsizei height,
-          GLenum format, GLenum type, const GLvoid *pixels)
-{
-
-
-}
-
-
 static void
 draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
                     GLsizei width, GLsizei height, GLenum type,
@@ -740,7 +625,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
    struct pipe_context *pipe = st->pipe;
    struct pipe_screen *screen = pipe->screen;
    struct st_renderbuffer *strb;
-   struct pipe_surface *ps;
+   struct pipe_transfer *pt;
    const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0;
    GLint skipPixels;
    ubyte *stmap;
@@ -749,21 +634,20 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
 
    strb = st_renderbuffer(ctx->DrawBuffer->
                           Attachment[BUFFER_STENCIL].Renderbuffer);
-   ps = screen->get_tex_surface(screen, strb->texture, 0, 0, 0,
-                                PIPE_BUFFER_USAGE_CPU_WRITE);
+   pt = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
+                                 PIPE_TRANSFER_WRITE, x, y,
+                                 width, height);
 
-   /* map the stencil buffer */
-   stmap = screen->surface_map(screen, ps, 
-                               PIPE_BUFFER_USAGE_CPU_WRITE);
+   stmap = screen->transfer_map(screen, pt);
 
    /* if width > MAX_WIDTH, have to process image in chunks */
    skipPixels = 0;
    while (skipPixels < width) {
-      const GLint spanX = x + skipPixels;
+      const GLint spanX = skipPixels;
       const GLint spanWidth = MIN2(width - skipPixels, MAX_WIDTH);
       GLint row;
       for (row = 0; row < height; row++) {
-         GLint spanY = y + row;
+         GLint spanY = row;
          GLubyte values[MAX_WIDTH];
          GLenum destType = GL_UNSIGNED_BYTE;
          const GLvoid *source = _mesa_image_address2d(unpack, pixels,
@@ -775,25 +659,25 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
                                    ctx->_ImageTransferState);
          if (zoom) {
             /*
-            _swrast_write_zoomed_stencil_span(ctx, x, y, spanWidth,
+            _swrast_write_zoomed_stencil_span(ctx, 0, 0, spanWidth,
                                               spanX, spanY, values);
             */
          }
          else {
             if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
-               spanY = ctx->DrawBuffer->Height - spanY - 1;
+               spanY = height - spanY - 1;
             }
 
-            switch (ps->format) {
+            switch (pt->format) {
             case PIPE_FORMAT_S8_UNORM:
                {
-                  ubyte *dest = stmap + spanY * ps->stride + spanX;
+                  ubyte *dest = stmap + spanY * pt->stride + spanX;
                   memcpy(dest, values, spanWidth);
                }
                break;
             case PIPE_FORMAT_S8Z24_UNORM:
                {
-                  uint *dest = (uint *) (stmap + spanY * ps->stride + spanX*4);
+                  uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4);
                   GLint k;
                   for (k = 0; k < spanWidth; k++) {
                      uint p = dest[k];
@@ -811,8 +695,8 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
    }
 
    /* unmap the stencil buffer */
-   screen->surface_unmap(screen, ps);
-   pipe_surface_reference(&ps, NULL);
+   screen->transfer_unmap(screen, pt);
+   screen->tex_transfer_destroy(pt);
 }
 
 
@@ -861,10 +745,8 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
 
    bufferFormat = ps->format;
 
-   if (1/*any_fragment_ops(st) ||
-       any_pixel_transfer_ops(st) ||
-       !compatible_formats(format, type, ps->format)*/) {
-      /* textured quad */
+   /* draw with textured quad */
+   {
       struct pipe_texture *pt
          = make_texture(ctx->st, width, height, format, type, unpack, pixels);
       if (pt) {
@@ -874,10 +756,6 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
          pipe_texture_reference(&pt, NULL);
       }
    }
-   else {
-      /* blit */
-      draw_blit(st, width, height, format, type, pixels);
-   }
 
    _mesa_set_vp_override( ctx, FALSE );
 }
@@ -891,12 +769,12 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
 {
    struct st_renderbuffer *rbDraw = st_renderbuffer(ctx->DrawBuffer->_StencilBuffer);
    struct pipe_screen *screen = ctx->st->pipe->screen;
-   struct pipe_surface *psDraw;
+   struct pipe_transfer *ptDraw;
    ubyte *drawMap;
    ubyte *buffer;
    int i;
 
-   buffer = malloc(width * height * sizeof(ubyte));
+   buffer = _mesa_malloc(width * height * sizeof(ubyte));
    if (!buffer) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels(stencil)");
       return;
@@ -906,14 +784,15 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
    st_read_stencil_pixels(ctx, srcx, srcy, width, height, GL_UNSIGNED_BYTE,
                           &ctx->DefaultPacking, buffer);
 
-   psDraw = screen->get_tex_surface(screen, rbDraw->texture, 0, 0, 0,
-                                    PIPE_BUFFER_USAGE_CPU_WRITE);
+   ptDraw = screen->get_tex_transfer(screen, rbDraw->texture, 0, 0, 0,
+                                     PIPE_TRANSFER_WRITE, dstx, dsty,
+                                     width, height);
 
-   assert(psDraw->block.width == 1);
-   assert(psDraw->block.height == 1);
+   assert(ptDraw->block.width == 1);
+   assert(ptDraw->block.height == 1);
    
    /* map the stencil buffer */
-   drawMap = screen->surface_map(screen, psDraw, PIPE_BUFFER_USAGE_CPU_WRITE);
+   drawMap = screen->transfer_map(screen, ptDraw);
 
    /* draw */
    /* XXX PixelZoom not handled yet */
@@ -922,16 +801,16 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
       const ubyte *src;
       int y;
 
-      y = dsty + i;
+      y = i;
 
       if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
-         y = ctx->DrawBuffer->Height - y - 1;
+         y = height - y - 1;
       }
 
-      dst = drawMap + y * psDraw->stride + dstx * psDraw->block.size;
+      dst = drawMap + y * ptDraw->stride;
       src = buffer + i * width;
 
-      switch (psDraw->format) {
+      switch (ptDraw->format) {
       case PIPE_FORMAT_S8Z24_UNORM:
          {
             uint *dst4 = (uint *) dst;
@@ -950,11 +829,11 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
       }
    }
 
-   free(buffer);
+   _mesa_free(buffer);
 
    /* unmap the stencil buffer */
-   screen->surface_unmap(screen, psDraw);
-   pipe_surface_reference(&psDraw, NULL);
+   screen->transfer_unmap(screen, ptDraw);
+   screen->tex_transfer_destroy(ptDraw);
 }
 
 
@@ -969,7 +848,6 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
    struct st_renderbuffer *rbRead;
    struct st_vertex_program *stvp;
    struct st_fragment_program *stfp;
-   struct pipe_surface *psTex;
    struct pipe_texture *pt;
    GLfloat *color;
    enum pipe_format srcFormat, texFormat;
@@ -1035,45 +913,47 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
       struct pipe_surface *psRead = screen->get_tex_surface(screen,
                                        rbRead->texture, 0, 0, 0,
                                        PIPE_BUFFER_USAGE_GPU_READ);
-      psTex = screen->get_tex_surface(screen, pt, 0, 0, 0, 
+      struct pipe_surface *psTex = screen->get_tex_surface(screen, pt, 0, 0, 0, 
                                       PIPE_BUFFER_USAGE_GPU_WRITE );
       pipe->surface_copy(pipe,
-                         FALSE,
                         psTex, /* dest */
                         0, 0, /* destx/y */
                         psRead,
                         srcx, srcy, width, height);
-      pipe_surface_reference(&psRead, NULL);
+      pipe_surface_reference(&psRead, NULL); 
+      pipe_surface_reference(&psTex, NULL);
    }
    else {
       /* CPU-based fallback/conversion */
-      struct pipe_surface *psRead = screen->get_tex_surface(screen,
-                                       rbRead->texture, 0, 0, 0,
-                                       PIPE_BUFFER_USAGE_CPU_READ);
+      struct pipe_transfer *ptRead =
+         screen->get_tex_transfer(screen, rbRead->texture, 0, 0, 0,
+                                  PIPE_TRANSFER_READ, srcx, srcy, width,
+                                  height);
 
-      psTex = screen->get_tex_surface(screen, pt, 0, 0, 0, 
-                                      PIPE_BUFFER_USAGE_CPU_WRITE );
+      struct pipe_transfer *ptTex =
+         screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
+                                  0, 0, width, height);
 
       if (type == GL_COLOR) {
          /* alternate path using get/put_tile() */
-         GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+         GLfloat *buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
 
-         pipe_get_tile_rgba(psRead, srcx, srcy, width, height, buf);
-         pipe_put_tile_rgba(psTex, 0, 0, width, height, buf);
+         pipe_get_tile_rgba(ptRead, 0, 0, width, height, buf);
+         pipe_put_tile_rgba(ptTex, 0, 0, width, height, buf);
 
-         free(buf);
+         _mesa_free(buf);
       }
       else {
          /* GL_DEPTH */
-         GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
-         pipe_get_tile_z(psRead, srcx, srcy, width, height, buf);
-         pipe_put_tile_z(psTex, 0, 0, width, height, buf);
-         free(buf);
+         GLuint *buf = (GLuint *) _mesa_malloc(width * height * sizeof(GLuint));
+         pipe_get_tile_z(ptRead, 0, 0, width, height, buf);
+         pipe_put_tile_z(ptTex, 0, 0, width, height, buf);
+         _mesa_free(buf);
       }
-      pipe_surface_reference(&psRead, NULL);
-   }
 
-   pipe_surface_reference(&psTex, NULL);
+      screen->tex_transfer_destroy(ptRead);
+      screen->tex_transfer_destroy(ptTex);
+   }
 
    /* draw textured quad */
    draw_textured_quad(ctx, dstx, dsty, ctx->Current.RasterPos[2],
@@ -1100,5 +980,3 @@ st_destroy_drawpix(struct st_context *st)
    st_reference_vertprog(st, &st->drawpix.vert_shaders[0], NULL);
    st_reference_vertprog(st, &st->drawpix.vert_shaders[1], NULL);
 }
-
-
index 9af648b8d0fda6a04fc81576fe0b5ad4e08d182b..f74d0d46d01d3dc5ca92d4705e385071a6cf3b21 100644 (file)
@@ -41,7 +41,6 @@
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
 #include "pipe/p_screen.h"
 #include "st_context.h"
 #include "st_cb_fbo.h"
@@ -172,12 +171,8 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
 
    assert(strb->surface->texture);
    assert(strb->surface->format);
-   assert(strb->surface->block.size);
-   assert(strb->surface->block.width);
-   assert(strb->surface->block.height);
    assert(strb->surface->width == width);
    assert(strb->surface->height == height);
-   assert(strb->surface->stride);
 
 
    return strb->surface != NULL;
@@ -194,7 +189,7 @@ st_renderbuffer_delete(struct gl_renderbuffer *rb)
    ASSERT(strb);
    pipe_surface_reference(&strb->surface, NULL);
    pipe_texture_reference(&strb->texture, NULL);
-   free(strb);
+   _mesa_free(strb);
 }
 
 
@@ -232,7 +227,7 @@ st_new_framebuffer(GLcontext *ctx, GLuint name)
 static struct gl_renderbuffer *
 st_new_renderbuffer(GLcontext *ctx, GLuint name)
 {
-   struct st_renderbuffer *strb = CALLOC_STRUCT(st_renderbuffer);
+   struct st_renderbuffer *strb = ST_CALLOC_STRUCT(st_renderbuffer);
    if (strb) {
       _mesa_init_renderbuffer(&strb->Base, name);
       strb->Base.Delete = st_renderbuffer_delete;
@@ -254,7 +249,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples)
 {
    struct st_renderbuffer *strb;
 
-   strb = CALLOC_STRUCT(st_renderbuffer);
+   strb = ST_CALLOC_STRUCT(st_renderbuffer);
    if (!strb) {
       _mesa_error(NULL, GL_OUT_OF_MEMORY, "creating renderbuffer");
       return NULL;
@@ -361,8 +356,6 @@ st_render_texture(GLcontext *ctx,
    if (!pt) 
       return;
 
-   assert(!att->Renderbuffer);
-
    /* create new renderbuffer which wraps the texture image */
    rb = st_new_renderbuffer(ctx, 0);
    if (!rb) {
@@ -419,7 +412,6 @@ static void
 st_finish_render_texture(GLcontext *ctx,
                          struct gl_renderbuffer_attachment *att)
 {
-   struct pipe_screen *screen = ctx->st->pipe->screen;
    struct st_renderbuffer *strb = st_renderbuffer(att->Renderbuffer);
 
    if (!strb)
@@ -428,7 +420,7 @@ st_finish_render_texture(GLcontext *ctx,
    st_flush( ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL );
 
    if (strb->surface)
-      screen->tex_surface_release( screen, &strb->surface );
+      pipe_surface_reference( &strb->surface, NULL );
 
    strb->rtt = NULL;
 
@@ -443,6 +435,25 @@ st_finish_render_texture(GLcontext *ctx,
 }
 
 
+/**
+ * Check that the framebuffer configuration is valid in terms of what
+ * the driver can support.
+ *
+ * For Gallium we only supports combined Z+stencil, not separate buffers.
+ */
+static void
+st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
+{
+   const struct gl_renderbuffer *depthRb =
+      fb->Attachment[BUFFER_DEPTH].Renderbuffer;
+   const struct gl_renderbuffer *stencilRb =
+      fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+
+   if (stencilRb && depthRb && stencilRb != depthRb) {
+      fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+   }
+}
+
 
 void st_init_fbo_functions(struct dd_function_table *functions)
 {
@@ -452,6 +463,7 @@ void st_init_fbo_functions(struct dd_function_table *functions)
    functions->FramebufferRenderbuffer = st_framebuffer_renderbuffer;
    functions->RenderTexture = st_render_texture;
    functions->FinishRenderTexture = st_finish_render_texture;
+   functions->ValidateFramebuffer = st_validate_framebuffer;
    /* no longer needed by core Mesa, drivers handle resizes...
    functions->ResizeBuffers = st_resize_buffers;
    */
index c7e8aa7cc565a9c8f99c0cc466ed75627db11639..93f71452192037414ec0491a683541dd2cb603ef 100644 (file)
@@ -122,8 +122,8 @@ feedback_tri( struct draw_stage *stage, struct prim_header *prim )
 {
    struct feedback_stage *fs = feedback_stage(stage);
    struct draw_context *draw = stage->draw;
-   FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_POLYGON_TOKEN);
-   FEEDBACK_TOKEN(fs->ctx, (GLfloat) 3); /* three vertices */
+   _mesa_feedback_token(fs->ctx, (GLfloat) GL_POLYGON_TOKEN);
+   _mesa_feedback_token(fs->ctx, (GLfloat) 3); /* three vertices */
    feedback_vertex(fs->ctx, draw, prim->v[0]);
    feedback_vertex(fs->ctx, draw, prim->v[1]);
    feedback_vertex(fs->ctx, draw, prim->v[2]);
@@ -136,11 +136,11 @@ feedback_line( struct draw_stage *stage, struct prim_header *prim )
    struct feedback_stage *fs = feedback_stage(stage);
    struct draw_context *draw = stage->draw;
    if (fs->reset_stipple_counter) {
-      FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN);
+      _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN);
       fs->reset_stipple_counter = GL_FALSE;
    }
    else {
-      FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_LINE_TOKEN);
+      _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_TOKEN);
    }
    feedback_vertex(fs->ctx, draw, prim->v[0]);
    feedback_vertex(fs->ctx, draw, prim->v[1]);
@@ -152,7 +152,7 @@ feedback_point( struct draw_stage *stage, struct prim_header *prim )
 {
    struct feedback_stage *fs = feedback_stage(stage);
    struct draw_context *draw = stage->draw;
-   FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_POINT_TOKEN);
+   _mesa_feedback_token(fs->ctx, (GLfloat) GL_POINT_TOKEN);
    feedback_vertex(fs->ctx, draw, prim->v[0]);
 }
 
@@ -184,7 +184,7 @@ feedback_destroy( struct draw_stage *stage )
 static struct draw_stage *
 draw_glfeedback_stage(GLcontext *ctx, struct draw_context *draw)
 {
-   struct feedback_stage *fs = CALLOC_STRUCT(feedback_stage);
+   struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage);
 
    fs->stage.draw = draw;
    fs->stage.next = NULL;
@@ -257,7 +257,7 @@ select_destroy( struct draw_stage *stage )
 static struct draw_stage *
 draw_glselect_stage(GLcontext *ctx, struct draw_context *draw)
 {
-   struct feedback_stage *fs = CALLOC_STRUCT(feedback_stage);
+   struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage);
 
    fs->stage.draw = draw;
    fs->stage.next = NULL;
index f8621ab125fbd37df70a1bb10ac28ba3073d0bef..7d7d3823c99f8ccd551e0894fd6136eea091a904 100644 (file)
@@ -63,16 +63,19 @@ display_front_buffer(struct st_context *st)
    GLframebuffer *fb = st->ctx->DrawBuffer;
    struct st_renderbuffer *strb
       = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
-   struct pipe_surface *front_surf = strb->surface;
 
-   /* Hook for copying "fake" frontbuffer if necessary:
-    */
-   st->pipe->screen->flush_frontbuffer( st->pipe->screen, front_surf,
-                                        st->pipe->priv );
-
-   /*
-   st->frontbuffer_status = FRONT_STATUS_UNDEFINED;
-   */
+   if (strb) {
+      struct pipe_surface *front_surf = strb->surface;
+      
+      /* Hook for copying "fake" frontbuffer if necessary:
+       */
+      st->pipe->screen->flush_frontbuffer( st->pipe->screen, front_surf,
+                                           st->pipe->priv );
+
+      /*
+        st->frontbuffer_status = FRONT_STATUS_UNDEFINED;
+      */
+   }
 }
 
 
@@ -117,13 +120,16 @@ static void st_glFlush(GLcontext *ctx)
 {
    struct st_context *st = ctx->st;
 
+   /* Don't call st_finish() here.  It is not the state tracker's
+    * responsibilty to inject sleeps in the hope of avoiding buffer
+    * synchronization issues.  Calling finish() here will just hide
+    * problems that need to be fixed elsewhere.
+    */
+   st_flush(st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
+
    if (is_front_buffer_dirty(st)) {
-      st_finish(st);
       display_front_buffer(st);
    }
-   else {
-      st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL);
-   }
 }
 
 
index ea0fa20012ef3bfff334238df0b4af2120e0df06..4398ab28392cbb190631ef7aa156fa042527b075 100644 (file)
@@ -99,7 +99,7 @@ static struct gl_program *st_new_program( GLcontext *ctx,
 {
    switch (target) {
    case GL_VERTEX_PROGRAM_ARB: {
-      struct st_vertex_program *prog = CALLOC_STRUCT(st_vertex_program);
+      struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program);
 
       prog->serialNo = SerialNo++;
 
@@ -111,7 +111,7 @@ static struct gl_program *st_new_program( GLcontext *ctx,
 
    case GL_FRAGMENT_PROGRAM_ARB:
    case GL_FRAGMENT_PROGRAM_NV: {
-      struct st_fragment_program *prog = CALLOC_STRUCT(st_fragment_program);
+      struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program);
 
       prog->serialNo = SerialNo++;
 
@@ -152,7 +152,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog)
          }
 
          if (stvp->state.tokens) {
-            FREE((void *) stvp->state.tokens);
+            _mesa_free((void *) stvp->state.tokens);
             stvp->state.tokens = NULL;
          }
       }
@@ -167,7 +167,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog)
          }
          
          if (stfp->state.tokens) {
-            FREE((void *) stfp->state.tokens);
+            _mesa_free((void *) stfp->state.tokens);
             stfp->state.tokens = NULL;
          }
 
@@ -214,7 +214,7 @@ static void st_program_string_notify( GLcontext *ctx,
       }
 
       if (stfp->state.tokens) {
-         FREE((void *) stfp->state.tokens);
+         _mesa_free((void *) stfp->state.tokens);
          stfp->state.tokens = NULL;
       }
 
@@ -242,7 +242,7 @@ static void st_program_string_notify( GLcontext *ctx,
       }
 
       if (stvp->state.tokens) {
-         FREE((void *) stvp->state.tokens);
+         _mesa_free((void *) stvp->state.tokens);
          stvp->state.tokens = NULL;
       }
 
index 21c2c7dd9ffec1bf434b86f56745e54531890c37..dcf4c38eb615d22f6f66bfcbecc253041edb9f34 100644 (file)
@@ -64,7 +64,7 @@ st_query_object(struct gl_query_object *q)
 static struct gl_query_object *
 st_NewQueryObject(GLcontext *ctx, GLuint id)
 {
-   struct st_query_object *stq = CALLOC_STRUCT(st_query_object);
+   struct st_query_object *stq = ST_CALLOC_STRUCT(st_query_object);
    if (stq) {
       stq->base.Id = id;
       stq->base.Ready = GL_TRUE;
@@ -87,7 +87,7 @@ st_DeleteQuery(GLcontext *ctx, struct gl_query_object *q)
       stq->pq = NULL;
    }
 
-   FREE(stq);
+   _mesa_free(stq);
 }
 
 
index 8867ca5652efa755df009cef13faa8174876f0f4..7dd235273998705eac5e3c00402cf3e34829ba1b 100644 (file)
@@ -102,7 +102,7 @@ rastpos_line( struct draw_stage *stage, struct prim_header *prim )
 static void
 rastpos_destroy(struct draw_stage *stage)
 {
-   free(stage);
+   _mesa_free(stage);
 }
 
 
@@ -180,7 +180,7 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim)
 static struct rastpos_stage *
 new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw)
 {
-   struct rastpos_stage *rs = CALLOC_STRUCT(rastpos_stage);
+   struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage);
    GLuint i;
 
    rs->stage.draw = draw;
index 646eaff190381dfe755b96cc469a2ae07a4d49a4..2a4beccd90e3c7c40b9fe91f665df993879d4e4b 100644 (file)
@@ -63,44 +63,48 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
    struct gl_framebuffer *fb = ctx->ReadBuffer;
    struct pipe_screen *screen = ctx->st->pipe->screen;
    struct st_renderbuffer *strb = st_renderbuffer(fb->_StencilBuffer);
-   struct pipe_surface *ps;
+   struct pipe_transfer *pt;
    ubyte *stmap;
    GLint j;
 
-   /* Create a CPU-READ surface/view into the renderbuffer's texture */
-   ps = screen->get_tex_surface(screen, strb->texture,  0, 0, 0,
-                                PIPE_BUFFER_USAGE_CPU_READ);
+   if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
+      y = ctx->DrawBuffer->Height - y - 1;
+   }
+
+   /* Create a read transfer from the renderbuffer's texture */
+   pt = screen->get_tex_transfer(screen, strb->texture,  0, 0, 0,
+                                 PIPE_TRANSFER_READ, x, y, width, height);
 
    /* map the stencil buffer */
-   stmap = screen->surface_map(screen, ps, PIPE_BUFFER_USAGE_CPU_READ);
+   stmap = screen->transfer_map(screen, pt);
 
    /* width should never be > MAX_WIDTH since we did clipping earlier */
    ASSERT(width <= MAX_WIDTH);
 
    /* process image row by row */
-   for (j = 0; j < height; j++, y++) {
+   for (j = 0; j < height; j++) {
       GLvoid *dest;
       GLstencil values[MAX_WIDTH];
       GLint srcY;
 
       if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
-         srcY = ctx->DrawBuffer->Height - y - 1;
+         srcY = height - j - 1;
       }
       else {
-         srcY = y;
+         srcY = j;
       }
 
       /* get stencil values */
-      switch (ps->format) {
+      switch (pt->format) {
       case PIPE_FORMAT_S8_UNORM:
          {
-            const ubyte *src = stmap + srcY * ps->stride + x;
+            const ubyte *src = stmap + srcY * pt->stride;
             memcpy(values, src, width);
          }
          break;
       case PIPE_FORMAT_S8Z24_UNORM:
          {
-            const uint *src = (uint *) (stmap + srcY * ps->stride + x*4);
+            const uint *src = (uint *) (stmap + srcY * pt->stride);
             GLint k;
             for (k = 0; k < width; k++) {
                values[k] = src[k] >> 24;
@@ -109,7 +113,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
          break;
       case PIPE_FORMAT_Z24S8_UNORM:
          {
-            const uint *src = (uint *) (stmap + srcY * ps->stride + x*4);
+            const uint *src = (uint *) (stmap + srcY * pt->stride);
             GLint k;
             for (k = 0; k < width; k++) {
                values[k] = src[k] & 0xff;
@@ -129,8 +133,8 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
 
 
    /* unmap the stencil buffer */
-   screen->surface_unmap(screen, ps);
-   pipe_surface_reference(&ps, NULL);
+   screen->transfer_unmap(screen, pt);
+   screen->tex_transfer_destroy(pt);
 }
 
 
@@ -203,28 +207,33 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
    {
       struct pipe_context *pipe = ctx->st->pipe;
       struct pipe_screen *screen = pipe->screen;
-      struct pipe_surface *surf;
+      struct pipe_transfer *trans;
       const GLubyte *map;
       GLubyte *dst;
       GLint row, col, dy, dstStride;
 
-      surf = screen->get_tex_surface(screen, strb->texture,  0, 0, 0,
-                                     PIPE_BUFFER_USAGE_CPU_READ);
-      if (!surf) {
+      if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
+         y = strb->texture->height[0] - y - height;
+      }
+
+      trans = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
+                                       PIPE_TRANSFER_READ, x, y, width, height);
+      if (!trans) {
          return GL_FALSE;
       }
 
-      map = screen->surface_map(screen, surf, PIPE_BUFFER_USAGE_CPU_READ);
+      map = screen->transfer_map(screen, trans);
       if (!map) {
-         pipe_surface_reference(&surf, NULL);
+         screen->tex_transfer_destroy(trans);
          return GL_FALSE;
       }
 
       if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-         y = surf->height - y - 1;
+         y = height - 1;
          dy = -1;
       }
       else {
+         y = 0;
          dy = 1;
       }
 
@@ -235,7 +244,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
       switch (combo) {
       case A8R8G8B8_UNORM_TO_RGBA_UBYTE:
          for (row = 0; row < height; row++) {
-            const GLubyte *src = map + y * surf->stride + x * 4;
+            const GLubyte *src = map + y * trans->stride;
             for (col = 0; col < width; col++) {
                GLuint pixel = ((GLuint *) src)[col];
                dst[col*4+0] = (pixel >> 16) & 0xff;
@@ -249,7 +258,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
          break;
       case A8R8G8B8_UNORM_TO_RGB_UBYTE:
          for (row = 0; row < height; row++) {
-            const GLubyte *src = map + y * surf->stride + x * 4;
+            const GLubyte *src = map + y * trans->stride;
             for (col = 0; col < width; col++) {
                GLuint pixel = ((GLuint *) src)[col];
                dst[col*3+0] = (pixel >> 16) & 0xff;
@@ -262,7 +271,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
          break;
       case A8R8G8B8_UNORM_TO_BGRA_UINT:
          for (row = 0; row < height; row++) {
-            const GLubyte *src = map + y * surf->stride + x * 4;
+            const GLubyte *src = map + y * trans->stride;
             memcpy(dst, src, 4 * width);
             dst += dstStride;
             y += dy;
@@ -272,8 +281,8 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
          ; /* nothing */
       }
 
-      screen->surface_unmap(screen, surf);
-      pipe_surface_reference(&surf, NULL);
+      screen->transfer_unmap(screen, trans);
+      screen->tex_transfer_destroy(trans);
    }
 
    return GL_TRUE;
@@ -281,7 +290,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
 
 
 /**
- * Do glReadPixels by getting rows from the framebuffer surface with
+ * Do glReadPixels by getting rows from the framebuffer transfer with
  * get_tile().  Convert to requested format/type with Mesa image routines.
  * Image transfer ops are done in software too.
  */
@@ -300,7 +309,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
    GLfloat *df;
    struct st_renderbuffer *strb;
    struct gl_pixelstore_attrib clippedPacking = *pack;
-   struct pipe_surface *surf;
+   struct pipe_transfer *trans;
 
    assert(ctx->ReadBuffer->Width > 0);
 
@@ -309,7 +318,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
 
    /* 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 surface is totally outside the window bounds */
+      /* The ReadPixels transfer is totally outside the window bounds */
       return;
    }
 
@@ -355,21 +364,26 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
       dfStride = 0;
    }
 
+   if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
+      y = strb->Base.Height - y - height;
+   }
+
+   /* Create a read transfer from the renderbuffer's texture */
+   trans = screen->get_tex_transfer(screen, strb->texture,  0, 0, 0,
+                                    PIPE_TRANSFER_READ, x, y, width, height);
+
    /* determine bottom-to-top vs. top-to-bottom order */
    if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-      y = strb->Base.Height - 1 - y;
+      y = height - 1;
       yStep = -1;
    }
    else {
+      y = 0;
       yStep = 1;
    }
 
-   /* Create a CPU-READ surface/view into the renderbuffer's texture */
-   surf = screen->get_tex_surface(screen, strb->texture,  0, 0, 0,
-                                  PIPE_BUFFER_USAGE_CPU_READ);
-
    /*
-    * Copy pixels from pipe_surface to user memory
+    * Copy pixels from pipe_transfer to user memory
     */
    {
       /* dest of first pixel in client memory */
@@ -379,14 +393,14 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
       const GLint dstStride = _mesa_image_row_stride(&clippedPacking, width,
                                                      format, type);
 
-      if (surf->format == PIPE_FORMAT_S8Z24_UNORM ||
-          surf->format == PIPE_FORMAT_X8Z24_UNORM) {
+      if (trans->format == PIPE_FORMAT_S8Z24_UNORM ||
+          trans->format == PIPE_FORMAT_X8Z24_UNORM) {
          if (format == GL_DEPTH_COMPONENT) {
             for (i = 0; i < height; i++) {
                GLuint ztemp[MAX_WIDTH];
                GLfloat zfloat[MAX_WIDTH];
                const double scale = 1.0 / ((1 << 24) - 1);
-               pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0);
+               pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0);
                y += yStep;
                for (j = 0; j < width; j++) {
                   zfloat[j] = (float) (scale * (ztemp[j] & 0xffffff));
@@ -400,18 +414,18 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
             /* untested, but simple: */
             assert(format == GL_DEPTH_STENCIL_EXT);
             for (i = 0; i < height; i++) {
-               pipe_get_tile_raw(surf, x, y, width, 1, dst, 0);
+               pipe_get_tile_raw(trans, 0, y, width, 1, dst, 0);
                y += yStep;
                dst += dstStride;
             }
          }
       }
-      else if (surf->format == PIPE_FORMAT_Z16_UNORM) {
+      else if (trans->format == PIPE_FORMAT_Z16_UNORM) {
          for (i = 0; i < height; i++) {
             GLushort ztemp[MAX_WIDTH];
             GLfloat zfloat[MAX_WIDTH];
             const double scale = 1.0 / 0xffff;
-            pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0);
+            pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0);
             y += yStep;
             for (j = 0; j < width; j++) {
                zfloat[j] = (float) (scale * ztemp[j]);
@@ -421,12 +435,12 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
             dst += dstStride;
          }
       }
-      else if (surf->format == PIPE_FORMAT_Z32_UNORM) {
+      else if (trans->format == PIPE_FORMAT_Z32_UNORM) {
          for (i = 0; i < height; i++) {
             GLuint ztemp[MAX_WIDTH];
             GLfloat zfloat[MAX_WIDTH];
             const double scale = 1.0 / 0xffffffff;
-            pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0);
+            pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0);
             y += yStep;
             for (j = 0; j < width; j++) {
                zfloat[j] = (float) (scale * ztemp[j]);
@@ -440,7 +454,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
          /* RGBA format */
          /* Do a row at a time to flip image data vertically */
          for (i = 0; i < height; i++) {
-            pipe_get_tile_rgba(surf, x, y, width, 1, df);
+            pipe_get_tile_rgba(trans, 0, y, width, 1, df);
             y += yStep;
             df += dfStride;
             if (!dfStride) {
@@ -452,7 +466,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
       }
    }
 
-   pipe_surface_reference(&surf, NULL);
+   screen->tex_transfer_destroy(trans);
 
    _mesa_unmap_readpix_pbo(ctx, &clippedPacking);
 }
index 9279a768c82b4c9031c6428fd5a2d0e7f09e56e8..edfa8854d89bdb527dafe2a7162b25758d3cb9fe 100644 (file)
  * 
  **************************************************************************/
 
-#include "main/imports.h"
+#include "main/mfeatures.h"
 #if FEATURE_convolve
 #include "main/convolve.h"
 #endif
 #include "main/enums.h"
 #include "main/image.h"
+#include "main/imports.h"
 #include "main/macros.h"
 #include "main/mipmap.h"
 #include "main/pixel.h"
@@ -114,7 +115,7 @@ st_NewTextureImage(GLcontext * ctx)
 {
    DBG("%s\n", __FUNCTION__);
    (void) ctx;
-   return (struct gl_texture_image *) CALLOC_STRUCT(st_texture_image);
+   return (struct gl_texture_image *) ST_CALLOC_STRUCT(st_texture_image);
 }
 
 
@@ -122,7 +123,7 @@ st_NewTextureImage(GLcontext * ctx)
 static struct gl_texture_object *
 st_NewTextureObject(GLcontext * ctx, GLuint name, GLenum target)
 {
-   struct st_texture_object *obj = CALLOC_STRUCT(st_texture_object);
+   struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object);
 
    DBG("%s\n", __FUNCTION__);
    _mesa_initialize_texture_object(&obj->base, name, target);
@@ -204,7 +205,7 @@ __memcpy(void *to, const void *from, size_t n)
 static void *
 do_memcpy(void *dest, const void *src, size_t n)
 {
-   if ((((unsigned) src) & 63) || (((unsigned) dest) & 63)) {
+   if ((((unsigned long) src) & 63) || (((unsigned long) dest) & 63)) {
       return __memcpy(dest, src, n);
    }
    else
@@ -464,18 +465,18 @@ st_TexImage(GLcontext * ctx,
     * bmBufferData with NULL data to free the old block and avoid
     * waiting on any outstanding fences.
     */
-   if (stObj->pt &&
-       (stObj->teximage_realloc ||
-        (/*stObj->pt->first_level == level &&*/
-         stObj->pt->last_level == level &&
-         stObj->pt->target != PIPE_TEXTURE_CUBE &&
-         !st_texture_match_image(stObj->pt, &stImage->base,
-                                 stImage->face, stImage->level)))) {
-
-      DBG("release it\n");
-      pipe_texture_reference(&stObj->pt, NULL);
-      assert(!stObj->pt);
-      stObj->teximage_realloc = FALSE;
+   if (stObj->pt) {
+      if (stObj->teximage_realloc ||
+          level > stObj->pt->last_level ||
+          (stObj->pt->last_level == level &&
+           stObj->pt->target != PIPE_TEXTURE_CUBE &&
+           !st_texture_match_image(stObj->pt, &stImage->base,
+                                   stImage->face, stImage->level))) {
+         DBG("release it\n");
+         pipe_texture_reference(&stObj->pt, NULL);
+         assert(!stObj->pt);
+         stObj->teximage_realloc = FALSE;
+      }
    }
 
    if (!stObj->pt) {
@@ -524,9 +525,10 @@ st_TexImage(GLcontext * ctx,
 
    if (stImage->pt) {
       texImage->Data = st_texture_image_map(ctx->st, stImage, 0,
-                                            PIPE_BUFFER_USAGE_CPU_WRITE);
-      if (stImage->surface)
-         dstRowStride = stImage->surface->stride;
+                                            PIPE_TRANSFER_WRITE, 0, 0,
+                                            stImage->base.Width,
+                                            stImage->base.Height);
+      dstRowStride = stImage->transfer->stride;
    }
    else {
       /* Allocate regular memory and store the image there temporarily.   */
@@ -581,7 +583,9 @@ st_TexImage(GLcontext * ctx,
         if (stImage->pt && i < depth) {
            st_texture_image_unmap(ctx->st, stImage);
            texImage->Data = st_texture_image_map(ctx->st, stImage, i,
-                                                  PIPE_BUFFER_USAGE_CPU_WRITE);
+                                                  PIPE_TRANSFER_WRITE, 0, 0,
+                                                  stImage->base.Width,
+                                                  stImage->base.Height);
            src += srcImageStride;
         }
       }
@@ -688,8 +692,10 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
        * kernel.  Need to explicitly map and unmap it.
        */
       texImage->Data = st_texture_image_map(ctx->st, stImage, 0,
-                                            PIPE_BUFFER_USAGE_CPU_READ);
-      texImage->RowStride = stImage->surface->stride / stImage->pt->block.size;
+                                            PIPE_TRANSFER_READ, 0, 0,
+                                            stImage->base.Width,
+                                            stImage->base.Height);
+      texImage->RowStride = stImage->transfer->stride / stImage->pt->block.size;
    }
    else {
       /* Otherwise, the image should actually be stored in
@@ -720,7 +726,9 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
       if (stImage->pt && i < depth) {
         st_texture_image_unmap(ctx->st, stImage);
         texImage->Data = st_texture_image_map(ctx->st, stImage, i,
-                                               PIPE_BUFFER_USAGE_CPU_READ);
+                                               PIPE_TRANSFER_READ, 0, 0,
+                                               stImage->base.Width,
+                                               stImage->base.Height);
         dest += dstImageStride;
       }
    }
@@ -792,9 +800,10 @@ st_TexSubimage(GLcontext * ctx,
     */
    if (stImage->pt) {
       texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset, 
-                                            PIPE_BUFFER_USAGE_CPU_WRITE);
-      if (stImage->surface)
-         dstRowStride = stImage->surface->stride;
+                                            PIPE_TRANSFER_WRITE,
+                                            xoffset, yoffset,
+                                            width, height);
+      dstRowStride = stImage->transfer->stride;
    }
 
    if (!texImage->Data) {
@@ -808,7 +817,7 @@ st_TexSubimage(GLcontext * ctx,
       if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat,
                                           texImage->TexFormat,
                                           texImage->Data,
-                                          xoffset, yoffset, 0,
+                                          0, 0, 0,
                                           dstRowStride,
                                           texImage->ImageOffsets,
                                           width, height, 1,
@@ -820,7 +829,9 @@ st_TexSubimage(GLcontext * ctx,
          /* map next slice of 3D texture */
         st_texture_image_unmap(ctx->st, stImage);
         texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset + i,
-                                               PIPE_BUFFER_USAGE_CPU_WRITE);
+                                               PIPE_TRANSFER_WRITE,
+                                               xoffset, yoffset,
+                                               width, height);
         src += srcImageStride;
       }
    }
@@ -898,26 +909,8 @@ st_TexSubImage1D(GLcontext * ctx,
 
 
 /**
- * Return 0 for GL_TEXTURE_CUBE_MAP_POSITIVE_X,
- *        1 for GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
- *        etc.
- * XXX duplicated from main/teximage.c
- */
-static uint
-texture_face(GLenum target)
-{
-   if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
-       target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)
-      return (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
-   else
-      return 0;
-}
-
-
-
-/**
- * Do a CopyTexSubImage operation by mapping the source surface and
- * dest surface and using get_tile()/put_tile() to access the pixels/texels.
+ * Do a CopyTexSubImage operation using a read transfer from the source, a write
+ * transfer to the destination and get_tile()/put_tile() to access the pixels/texels.
  *
  * Note: srcY=0=TOP of renderbuffer
  */
@@ -934,20 +927,24 @@ fallback_copy_texsubimage(GLcontext *ctx,
 {
    struct pipe_context *pipe = ctx->st->pipe;
    struct pipe_screen *screen = pipe->screen;
-   const uint face = texture_face(target);
-   struct pipe_texture *pt = stImage->pt;
-   struct pipe_surface *src_surf, *dest_surf;
+   struct pipe_transfer *src_trans;
+   GLvoid *texDest;
 
-   /* We'd use strb->surface, here but it's created for GPU read/write only */
-   src_surf = pipe->screen->get_tex_surface( pipe->screen,
-                                             strb->texture,
-                                             0, 0, 0,
-                                             PIPE_BUFFER_USAGE_CPU_READ);
+   assert(width <= MAX_WIDTH);
 
-   dest_surf = screen->get_tex_surface(screen, pt, face, level, destZ,
-                                       PIPE_BUFFER_USAGE_CPU_WRITE);
+   if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
+      srcY = strb->Base.Height - srcY - height;
+   }
 
-   assert(width <= MAX_WIDTH);
+   src_trans = screen->get_tex_transfer( screen,
+                                         strb->texture,
+                                         0, 0, 0,
+                                         PIPE_TRANSFER_READ,
+                                         srcX, srcY,
+                                         width, height);
+
+   texDest = st_texture_image_map(ctx->st, stImage, 0, PIPE_TRANSFER_WRITE,
+                                  destX, destY, width, height);
 
    if (baseFormat == GL_DEPTH_COMPONENT) {
       const GLboolean scaleOrBias = (ctx->Pixel.DepthScale != 1.0F ||
@@ -956,39 +953,36 @@ fallback_copy_texsubimage(GLcontext *ctx,
 
       /* determine bottom-to-top vs. top-to-bottom order for src buffer */
       if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-         srcY = strb->Base.Height - 1 - srcY;
+         srcY = height - 1;
          yStep = -1;
       }
       else {
+         srcY = 0;
          yStep = 1;
       }
 
       /* To avoid a large temp memory allocation, do copy row by row */
-      for (row = 0; row < height; row++, srcY += yStep, destY++) {
+      for (row = 0; row < height; row++, srcY += yStep) {
          uint data[MAX_WIDTH];
-         pipe_get_tile_z(src_surf, srcX, srcY, width, 1, data);
+         pipe_get_tile_z(src_trans, 0, srcY, width, 1, data);
          if (scaleOrBias) {
             _mesa_scale_and_bias_depth_uint(ctx, width, data);
          }
-         pipe_put_tile_z(dest_surf, destX, destY, width, 1, data);
+         pipe_put_tile_z(stImage->transfer, 0, row, width, 1, data);
       }
    }
    else {
       /* RGBA format */
       GLfloat *tempSrc =
          (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
-      GLvoid *texDest =
-         st_texture_image_map(ctx->st, stImage, 0,PIPE_BUFFER_USAGE_CPU_WRITE);
 
       if (tempSrc && texDest) {
          const GLint dims = 2;
          struct gl_texture_image *texImage = &stImage->base;
-         GLint dstRowStride = stImage->surface->stride;
+         GLint dstRowStride = stImage->transfer->stride;
          struct gl_pixelstore_attrib unpack = ctx->DefaultPacking;
 
          if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-            /* need to invert src */
-            srcY = strb->Base.Height - srcY - height;
             unpack.Invert = GL_TRUE;
          }
 
@@ -996,7 +990,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
          /* XXX this usually involves a lot of int/float conversion.
           * try to avoid that someday.
           */
-         pipe_get_tile_rgba(src_surf, srcX, srcY, width, height, tempSrc);
+         pipe_get_tile_rgba(src_trans, 0, 0, width, height, tempSrc);
 
          /* Store into texture memory.
           * Note that this does some special things such as pixel transfer
@@ -1008,7 +1002,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
                                          texImage->_BaseFormat, 
                                          texImage->TexFormat, 
                                          texDest,
-                                         destX, destY, destZ,
+                                         0, 0, 0,
                                          dstRowStride,
                                          texImage->ImageOffsets,
                                          width, height, 1,
@@ -1021,12 +1015,10 @@ fallback_copy_texsubimage(GLcontext *ctx,
 
       if (tempSrc)
          _mesa_free(tempSrc);
-      if (texDest)
-         st_texture_image_unmap(ctx->st, stImage);
    }
 
-   screen->tex_surface_release(screen, &dest_surf);
-   screen->tex_surface_release(screen, &src_surf);
+   st_texture_image_unmap(ctx->st, stImage);
+   screen->tex_transfer_destroy(src_trans);
 }
 
 
@@ -1095,21 +1087,19 @@ st_copy_texsubimage(GLcontext *ctx,
    if (matching_base_formats && ctx->_ImageTransferState == 0x0) {
       /* try potential hardware path */
       struct pipe_surface *dest_surface = NULL;
+      boolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
 
-      if (src_format == dest_format) {
+      if (src_format == dest_format && !do_flip) {
          /* use surface_copy() / blit */
-         boolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
+
 
          dest_surface = screen->get_tex_surface(screen, stImage->pt,
                                                 stImage->face, stImage->level,
                                                 destZ,
                                                 PIPE_BUFFER_USAGE_GPU_WRITE);
-         if (do_flip)
-            srcY = strb->surface->height - srcY - height;
 
          /* for surface_copy(), y=0=top, always */
          pipe->surface_copy(pipe,
-                            do_flip,
                             /* dest */
                             dest_surface,
                             destX, destY,
@@ -1129,7 +1119,6 @@ st_copy_texsubimage(GLcontext *ctx,
                                            PIPE_TEXTURE_USAGE_RENDER_TARGET,
                                            0)) {
          /* draw textured quad to do the copy */
-         boolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
          int srcY0, srcY1;
 
          dest_surface = screen->get_tex_surface(screen, stImage->pt,
@@ -1419,7 +1408,7 @@ st_finalize_texture(GLcontext *ctx,
           stObj->pt->depth[0] != firstImage->base.Depth2 ||
           stObj->pt->block.size/stObj->pt->block.width != cpp || /* Nominal bytes per pixel */
           stObj->pt->compressed != firstImage->base.IsCompressed) {
-         pipe_texture_release(&stObj->pt);
+         pipe_texture_reference(&stObj->pt, NULL);
          ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER;
       }
    }
diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c
new file mode 100644 (file)
index 0000000..75b0a21
--- /dev/null
@@ -0,0 +1,53 @@
+/**************************************************************************
+ * 
+ * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#include "main/glheader.h"
+#include "st_context.h"
+#include "st_public.h"
+#include "st_cb_viewport.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_inlines.h"
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+#include "pipe/internal/p_winsys_screen.h"
+
+
+static void st_viewport(GLcontext * ctx, GLint x, GLint y,
+                        GLsizei width, GLsizei height)
+{
+   struct st_context *st = ctx->st;
+
+   if (st->pipe->winsys && st->pipe->winsys->update_buffer)
+      st->pipe->winsys->update_buffer( st->pipe->winsys,
+                                       st->pipe->priv );
+}
+
+void st_init_viewport_functions(struct dd_function_table *functions)
+{
+   functions->Viewport = st_viewport;
+}
diff --git a/src/mesa/state_tracker/st_cb_viewport.h b/src/mesa/state_tracker/st_cb_viewport.h
new file mode 100644 (file)
index 0000000..44948e5
--- /dev/null
@@ -0,0 +1,29 @@
+/**************************************************************************
+ * 
+ * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+extern void
+st_init_viewport_functions(struct dd_function_table *functions);
index e584a6ceeacda420cf0628b176f3755e6a772c4b..b27274725fc9e66153788eb9e339252e4ffcb94d 100644 (file)
@@ -31,6 +31,7 @@
 #include "main/matrix.h"
 #include "main/buffers.h"
 #include "main/scissor.h"
+#include "main/viewport.h"
 #include "vbo/vbo.h"
 #include "shader/shader_api.h"
 #include "glapi/glapi.h"
 #include "st_cb_texture.h"
 #include "st_cb_flush.h"
 #include "st_cb_strings.h"
+#include "st_cb_viewport.h"
 #include "st_atom.h"
 #include "st_draw.h"
 #include "st_extensions.h"
 #include "st_gen_mipmap.h"
 #include "st_program.h"
 #include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
 #include "draw/draw_context.h"
 #include "cso_cache/cso_cache.h"
 #include "cso_cache/cso_context.h"
@@ -105,7 +106,7 @@ static struct st_context *
 st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
 {
    uint i;
-   struct st_context *st = CALLOC_STRUCT( st_context );
+   struct st_context *st = ST_CALLOC_STRUCT( st_context );
    
    ctx->st = st;
 
@@ -208,7 +209,7 @@ static void st_destroy_context_priv( struct st_context *st )
 
    for (i = 0; i < Elements(st->state.constants); i++) {
       if (st->state.constants[i].buffer) {
-         pipe_buffer_reference(st->pipe->screen, &st->state.constants[i].buffer, NULL);
+         pipe_buffer_reference(&st->state.constants[i].buffer, NULL);
       }
    }
 
@@ -217,7 +218,7 @@ static void st_destroy_context_priv( struct st_context *st )
       st->default_texture = NULL;
    }
 
-   free( st );
+   _mesa_free( st );
 }
 
  
@@ -245,7 +246,7 @@ void st_destroy_context( struct st_context *st )
 
    pipe->destroy( pipe );
 
-   free(ctx);
+   _mesa_free(ctx);
 }
 
 
@@ -253,6 +254,11 @@ void st_make_current(struct st_context *st,
                      struct st_framebuffer *draw,
                      struct st_framebuffer *read)
 {
+   /* Call this periodically to detect when the user has begun using
+    * GL rendering from multiple threads.
+    */
+   _glapi_check_multithread();
+
    if (st) {
       GLboolean firstTime = st->ctx->FirstTimeCurrent;
       _mesa_make_current(st->ctx, &draw->Base, &read->Base);
@@ -320,6 +326,7 @@ void st_init_driver_functions(struct dd_function_table *functions)
    st_init_texture_functions(functions);
    st_init_flush_functions(functions);
    st_init_string_functions(functions);
+   st_init_viewport_functions(functions);
 
    functions->UpdateState = st_invalidate_state;
 }
index 695ac4a96f48e01966b871fb8d0b0b37e1a6df6a..d7518ab689765461306d1f85ab02fb9cff27f77a 100644 (file)
@@ -149,7 +149,6 @@ struct st_context
    struct {
       struct pipe_rasterizer_state rasterizer;
       struct pipe_sampler_state sampler;
-      struct pipe_shader_state vert_shader;
       enum pipe_format tex_format;
       void *vs;
       float vertices[4][3][4];  /**< vertex pos + color + texcoord */
@@ -166,8 +165,6 @@ struct st_context
 
    /** for glClear */
    struct {
-      struct pipe_shader_state vert_shader;
-      struct pipe_shader_state frag_shader;
       struct pipe_rasterizer_state raster;
       struct pipe_viewport_state viewport;
       void *vs;
@@ -242,6 +239,10 @@ st_fb_orientation(const struct gl_framebuffer *fb)
 }
 
 
+/** clear-alloc a struct-sized object, with casting */
+#define ST_CALLOC_STRUCT(T)   (struct T *) _mesa_calloc(sizeof(struct T))
+
+
 extern int
 st_get_msaa(void);
 
index ae71d586c2fabac8e684c697b87686098005e27b..225541a30ba2deccbde328e258bf281e33716f8b 100644 (file)
@@ -223,7 +223,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
       if (!stobj)
          return NULL;
 
-      vec = (unsigned *) calloc(sizeof(unsigned), (count + 31) / 32);
+      vec = (unsigned *) _mesa_calloc(sizeof(unsigned) * ((count + 31) / 32));
       if (!vec)
          return NULL;
 
@@ -378,8 +378,8 @@ setup_interleaved_attribs(GLcontext *ctx,
          }
          else {
             vbuffer->buffer = NULL;
-            pipe_buffer_reference(pipe->screen, &vbuffer->buffer, stobj->buffer);
-            vbuffer->buffer_offset = (unsigned) low;
+            pipe_buffer_reference(&vbuffer->buffer, stobj->buffer);
+            vbuffer->buffer_offset = pointer_to_offset(low);
          }
          vbuffer->stride = stride; /* in bytes */
          vbuffer->max_index = max_index;
@@ -433,8 +433,8 @@ setup_non_interleaved_attribs(GLcontext *ctx,
          /*printf("stobj %u = %p\n", attr, (void*) stobj);*/
 
          vbuffer[attr].buffer = NULL;
-         pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, stobj->buffer);
-         vbuffer[attr].buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
+         pipe_buffer_reference(&vbuffer[attr].buffer, stobj->buffer);
+         vbuffer[attr].buffer_offset = pointer_to_offset(arrays[mesaAttr]->Ptr);
          velements[attr].src_offset = 0;
       }
       else {
@@ -545,6 +545,8 @@ st_draw_vbo(GLcontext *ctx,
    if (MESA_VERBOSE & VERBOSE_GLSL) {
       check_uniforms(ctx);
    }
+#else
+   (void) check_uniforms;
 #endif
 
    /*
@@ -617,8 +619,8 @@ st_draw_vbo(GLcontext *ctx,
       if (bufobj && bufobj->Name) {
          /* elements/indexes are in a real VBO */
          struct st_buffer_object *stobj = st_buffer_object(bufobj);
-         pipe_buffer_reference(pipe->screen, &indexBuf, stobj->buffer);
-         indexOffset = (unsigned) ib->ptr / indexSize;
+         pipe_buffer_reference(&indexBuf, stobj->buffer);
+         indexOffset = pointer_to_offset(ib->ptr) / indexSize;
       }
       else {
          /* element/indicies are in user space memory */
@@ -657,7 +659,7 @@ st_draw_vbo(GLcontext *ctx,
          }
       }
 
-      pipe_buffer_reference(pipe->screen, &indexBuf, NULL);
+      pipe_buffer_reference(&indexBuf, NULL);
    }
    else {
       /* non-indexed */
@@ -673,7 +675,7 @@ st_draw_vbo(GLcontext *ctx,
 
    /* unreference buffers (frees wrapped user-space buffer objects) */
    for (attr = 0; attr < num_vbuffers; attr++) {
-      pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, NULL);
+      pipe_buffer_reference(&vbuffer[attr].buffer, NULL);
       assert(!vbuffer[attr].buffer);
    }
 
index 659c3ac834f194386daae2cf92a4230847cf7ce0..da04fce8e24bfb832b851129a40b344c1999aa19 100644 (file)
@@ -64,4 +64,19 @@ st_feedback_draw_vbo(GLcontext *ctx,
 extern GLuint
 st_pipe_vertex_format(GLenum type, GLuint size, GLboolean normalized);
 
+
+/**
+ * When drawing with VBOs, the addresses specified with
+ * glVertex/Color/TexCoordPointer() are really offsets into the VBO, not real
+ * addresses.  At some point we need to convert those pointers to offsets.
+ * This function is basically a cast wrapper to avoid warnings when building
+ * in 64-bit mode.
+ */
+static INLINE unsigned
+pointer_to_offset(const void *ptr)
+{
+   return (unsigned) (((unsigned long) ptr) & 0xffffffffUL);
+}
+
+
 #endif
index 5c9c4506c225615976aaec637ce402d02c07cc72..e533afd051e578b23bdce0254d8699c005b005a3 100644 (file)
@@ -152,8 +152,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
          assert(stobj->buffer);
 
          vbuffers[attr].buffer = NULL;
-         pipe_buffer_reference(pipe->screen, &vbuffers[attr].buffer, stobj->buffer);
-         vbuffers[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
+         pipe_buffer_reference(&vbuffers[attr].buffer, stobj->buffer);
+         vbuffers[attr].buffer_offset = pointer_to_offset(arrays[0]->Ptr);
          velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
       }
       else {
@@ -248,7 +248,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
    for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
       if (draw->pt.vertex_buffer[i].buffer) {
          pipe_buffer_unmap(pipe->screen, draw->pt.vertex_buffer[i].buffer);
-         pipe_buffer_reference(pipe->screen, &draw->pt.vertex_buffer[i].buffer, NULL);
+         pipe_buffer_reference(&draw->pt.vertex_buffer[i].buffer, NULL);
          draw_set_mapped_vertex_buffer(draw, i, NULL);
       }
    }
index cd34529d385f6a9728e632ad804ecb13cb89fef7..8f6be507742fcb386bb57b4af4ccb3852e6834c1 100644 (file)
@@ -208,6 +208,7 @@ void st_init_extensions(struct st_context *st)
 
    if (screen->get_param(screen, PIPE_CAP_TWO_SIDED_STENCIL)) {
       ctx->Extensions.ATI_separate_stencil = GL_TRUE;
+      ctx->Extensions.EXT_stencil_two_side = GL_TRUE;
    }
 
    if (screen->get_param(screen, PIPE_CAP_ANISOTROPIC_FILTER)) {
index 0d9c7b97e3de8ceaa74b70b46e06c42b1993b12c..06fec20eeec62c467a23d5f34a9d9d6dde394fef 100644 (file)
 #include "main/matrix.h"
 #include "main/renderbuffer.h"
 #include "main/scissor.h"
+#include "main/viewport.h"
 #include "st_context.h"
 #include "st_cb_fbo.h"
 #include "st_public.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
 
 
 struct st_framebuffer *
@@ -49,7 +49,7 @@ st_create_framebuffer( const __GLcontextModes *visual,
                        uint width, uint height,
                        void *private)
 {
-   struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer);
+   struct st_framebuffer *stfb = ST_CALLOC_STRUCT(st_framebuffer);
    if (stfb) {
       int samples = st_get_msaa();
 
@@ -155,7 +155,7 @@ void st_resize_framebuffer( struct st_framebuffer *stfb,
 
 void st_unreference_framebuffer( struct st_framebuffer *stfb )
 {
-   _mesa_unreference_framebuffer((struct gl_framebuffer **) &stfb);
+   _mesa_reference_framebuffer((struct gl_framebuffer **) &stfb, NULL);
 }
 
 
index 6a3455aaba213ec7d4a921bbd91ea97eb152d066..9cc2176d5e47ef04b6003e936952eba1d64f5229 100644 (file)
@@ -119,36 +119,36 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
 
    for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
       const uint srcLevel = dstLevel - 1;
-      struct pipe_surface *srcSurf, *dstSurf;
+      struct pipe_transfer *srcTrans, *dstTrans;
       const ubyte *srcData;
       ubyte *dstData;
 
-      srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice,
-                                        PIPE_BUFFER_USAGE_CPU_READ);
-      dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice,
-                                        PIPE_BUFFER_USAGE_CPU_WRITE);
+      srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
+                                          PIPE_TRANSFER_READ, 0, 0,
+                                          pt->width[srcLevel],
+                                          pt->height[srcLevel]);
+      dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
+                                          PIPE_TRANSFER_WRITE, 0, 0,
+                                          pt->width[dstLevel],
+                                          pt->height[dstLevel]);
 
-      srcData = (ubyte *) pipe_surface_map(srcSurf,
-                                           PIPE_BUFFER_USAGE_CPU_READ)
-              + srcSurf->offset;
-      dstData = (ubyte *) pipe_surface_map(dstSurf,
-                                           PIPE_BUFFER_USAGE_CPU_WRITE)
-              + dstSurf->offset;
+      srcData = (ubyte *) screen->transfer_map(screen, srcTrans);
+      dstData = (ubyte *) screen->transfer_map(screen, dstTrans);
 
       _mesa_generate_mipmap_level(target, datatype, comps,
                    0 /*border*/,
                    pt->width[srcLevel], pt->height[srcLevel], pt->depth[srcLevel],
                    srcData,
-                   srcSurf->stride, /* stride in bytes */
+                   srcTrans->stride, /* stride in bytes */
                    pt->width[dstLevel], pt->height[dstLevel], pt->depth[dstLevel],
                    dstData,
-                   dstSurf->stride); /* stride in bytes */
+                   dstTrans->stride); /* stride in bytes */
 
-      pipe_surface_unmap(srcSurf);
-      pipe_surface_unmap(dstSurf);
+      screen->transfer_unmap(screen, srcTrans);
+      screen->transfer_unmap(screen, dstTrans);
 
-      pipe_surface_reference(&srcSurf, NULL);
-      pipe_surface_reference(&dstSurf, NULL);
+      screen->tex_transfer_destroy(srcTrans);
+      screen->tex_transfer_destroy(dstTrans);
    }
 }
 
index 8b9b18f94df6cb52cf652d3119f8469d5a11a6e6..cbf3f334c08c4bc74c3a942f94289dc4eca505a3 100644 (file)
 #include "shader/prog_instruction.h"
 #include "shader/prog_parameter.h"
 #include "shader/prog_print.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
 
 /*
  * Map mesa register file to TGSI register file.
  */
 static GLuint
 map_register_file(
-   enum register_file file,
+   gl_register_file file,
    GLuint index,
    const GLuint immediateMapping[],
    GLboolean indirectAccess )
@@ -132,19 +132,35 @@ map_register_file_index(
  */
 static GLuint
 map_texture_target(
-   GLuint textarget )
+    GLuint textarget,
+    GLboolean shadow )
 {
+#if 1
+   /* XXX remove this line after we've checked that the rest of gallium
+    * can handle the TGSI_TEXTURE_SHADOWx tokens.
+    */
+   shadow = GL_FALSE;
+#endif
    switch( textarget ) {
    case TEXTURE_1D_INDEX:
-      return TGSI_TEXTURE_1D;
+      if (shadow)
+         return TGSI_TEXTURE_SHADOW1D;
+      else
+         return TGSI_TEXTURE_1D;
    case TEXTURE_2D_INDEX:
-      return TGSI_TEXTURE_2D;
+      if (shadow)
+         return TGSI_TEXTURE_SHADOW2D;
+      else
+         return TGSI_TEXTURE_2D;
    case TEXTURE_3D_INDEX:
       return TGSI_TEXTURE_3D;
    case TEXTURE_CUBE_INDEX:
       return TGSI_TEXTURE_CUBE;
    case TEXTURE_RECT_INDEX:
-      return TGSI_TEXTURE_RECT;
+      if (shadow)
+         return TGSI_TEXTURE_SHADOWRECT;
+      else
+         return TGSI_TEXTURE_RECT;
    default:
       assert( 0 );
    }
@@ -475,15 +491,6 @@ compile_instruction(
       break;
    case OPCODE_RSQ:
       fullinst->Instruction.Opcode = TGSI_OPCODE_RSQ;
-
-      /* KW: Don't do this here.  If particular hardware needs to do
-       * this, can do so in the driver..
-       */
-#if 0
-       tgsi_util_set_full_src_register_sign_mode(
-          &fullinst->FullSrcRegisters[0],
-          TGSI_UTIL_SIGN_CLEAR ); 
-#endif
       break;
    case OPCODE_SCS:
       fullinst->Instruction.Opcode = TGSI_OPCODE_SCS;
@@ -523,7 +530,8 @@ compile_instruction(
       /* ordinary texture lookup */
       fullinst->Instruction.Opcode = TGSI_OPCODE_TEX;
       fullinst->Instruction.NumSrcRegs = 2;
-      fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );
+      fullinst->InstructionExtTexture.Texture =
+         map_texture_target( inst->TexSrcTarget, inst->TexShadow );
       fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER;
       fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;
       break;
@@ -531,7 +539,8 @@ compile_instruction(
       /* texture lookup with LOD bias */
       fullinst->Instruction.Opcode = TGSI_OPCODE_TXB;
       fullinst->Instruction.NumSrcRegs = 2;
-      fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );
+      fullinst->InstructionExtTexture.Texture =
+         map_texture_target( inst->TexSrcTarget, inst->TexShadow );
       fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER;
       fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;
       break;
@@ -539,7 +548,8 @@ compile_instruction(
       /* texture lookup with explicit partial derivatives */
       fullinst->Instruction.Opcode = TGSI_OPCODE_TXD;
       fullinst->Instruction.NumSrcRegs = 4;
-      fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );
+      fullinst->InstructionExtTexture.Texture =
+         map_texture_target( inst->TexSrcTarget, inst->TexShadow );
       /* src[0] = coord, src[1] = d[strq]/dx, src[2] = d[strq]/dy */
       fullinst->FullSrcRegisters[3].SrcRegister.File = TGSI_FILE_SAMPLER;
       fullinst->FullSrcRegisters[3].SrcRegister.Index = inst->TexSrcUnit;
@@ -548,7 +558,8 @@ compile_instruction(
       /* texture lookup with explicit LOD */
       fullinst->Instruction.Opcode = TGSI_OPCODE_TXL;
       fullinst->Instruction.NumSrcRegs = 2;
-      fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );
+      fullinst->InstructionExtTexture.Texture =
+         map_texture_target( inst->TexSrcTarget, inst->TexShadow );
       fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER;
       fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;
       break;
@@ -557,7 +568,8 @@ compile_instruction(
       /* convert to TEX w/ special flag for division */
       fullinst->Instruction.Opcode = TGSI_OPCODE_TXP;
       fullinst->Instruction.NumSrcRegs = 2;
-      fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );
+      fullinst->InstructionExtTexture.Texture =
+         map_texture_target( inst->TexSrcTarget, inst->TexShadow );
       fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER;
       fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;
       break;
index 442eeed1470a34515640c575e97ccfaa0633f053..f825204915cbc6c5e82270d7049f8f744dd0c036 100644 (file)
@@ -61,9 +61,9 @@
 static INLINE void *
 mem_dup(const void *src, uint size)
 {
-   void *dup = MALLOC(size);
+   void *dup = _mesa_malloc(size);
    if (dup)
-      memcpy(dup, src, size);
+      _mesa_memcpy(dup, src, size);
    return dup;
 }
 
@@ -307,7 +307,7 @@ st_translate_vertex_program(struct st_context *st,
 
    /* free old shader state, if any */
    if (stvp->state.tokens) {
-      FREE((void *) stvp->state.tokens);
+      _mesa_free((void *) stvp->state.tokens);
       stvp->state.tokens = NULL;
    }
    if (stvp->driver_shader) {
@@ -466,23 +466,23 @@ st_translate_fragment_program(struct st_context *st,
       GLbitfield outputsWritten = stfp->Base.Base.OutputsWritten;
 
       /* if z is written, emit that first */
-      if (outputsWritten & (1 << FRAG_RESULT_DEPR)) {
+      if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) {
          fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION;
          fs_output_semantic_index[fs_num_outputs] = 0;
-         outputMapping[FRAG_RESULT_DEPR] = fs_num_outputs;
+         outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs;
          fs_num_outputs++;
-         outputsWritten &= ~(1 << FRAG_RESULT_DEPR);
+         outputsWritten &= ~(1 << FRAG_RESULT_DEPTH);
       }
 
       /* handle remaning outputs (color) */
       for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
          if (outputsWritten & (1 << attr)) {
             switch (attr) {
-            case FRAG_RESULT_DEPR:
+            case FRAG_RESULT_DEPTH:
                /* handled above */
                assert(0);
                break;
-            case FRAG_RESULT_COLR:
+            case FRAG_RESULT_COLOR:
                fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR;
                fs_output_semantic_index[fs_num_outputs] = numColors;
                outputMapping[attr] = fs_num_outputs;
index 63cfe5fc1633a3e563f9180ce45bf237233476d5..6f274d6d69b021a54f45b1c5ae5edb5677ff7115 100644 (file)
@@ -40,7 +40,6 @@
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_inlines.h"
-#include "pipe/p_inlines.h"
 #include "util/u_rect.h"
 
 
@@ -108,17 +107,14 @@ st_texture_create(struct st_context *st,
 
    newtex = screen->texture_create(screen, &pt);
 
-   assert(!newtex || newtex->refcount == 1);
+   assert(!newtex || p_atomic_read(&newtex->reference.count) == 1);
 
    return newtex;
 }
 
 
 /**
- * Check if a texture image be pulled into a unified mipmap texture.
- * This mirrors the completeness test in a lot of ways.
- *
- * Not sure whether I want to pass gl_texture_image here.
+ * Check if a texture image can be pulled into a unified mipmap texture.
  */
 GLboolean
 st_texture_match_image(const struct pipe_texture *pt,
@@ -130,13 +126,14 @@ st_texture_match_image(const struct pipe_texture *pt,
    if (image->Border) 
       return GL_FALSE;
 
+   /* Check if this image's format matches the established texture's format.
+    */
    if (st_mesa_format_to_pipe_format(image->TexFormat->MesaFormat) != pt->format ||
        image->IsCompressed != pt->compressed)
       return GL_FALSE;
 
-   /* Test image dimensions against the base level image adjusted for
-    * minification.  This will also catch images not present in the
-    * texture, changed targets, etc.
+   /* Test if this image's size matches what's expected in the
+    * established texture.
     */
    if (image->Width != pt->width[level] ||
        image->Height != pt->height[level] ||
@@ -191,19 +188,19 @@ st_texture_image_offset(const struct pipe_texture * pt,
  */
 GLubyte *
 st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
-                    GLuint zoffset,
-                     GLuint flags )
+                    GLuint zoffset, enum pipe_transfer_usage usage,
+                     GLuint x, GLuint y, GLuint w, GLuint h)
 {
    struct pipe_screen *screen = st->pipe->screen;
    struct pipe_texture *pt = stImage->pt;
    DBG("%s \n", __FUNCTION__);
 
-   stImage->surface = screen->get_tex_surface(screen, pt, stImage->face,
-                                              stImage->level, zoffset, 
-                                              flags);
+   stImage->transfer = screen->get_tex_transfer(screen, pt, stImage->face,
+                                                stImage->level, zoffset, 
+                                                usage, x, y, w, h);
 
-   if (stImage->surface)
-      return screen->surface_map(screen, stImage->surface, flags);
+   if (stImage->transfer)
+      return screen->transfer_map(screen, stImage->transfer);
    else
       return NULL;
 }
@@ -217,9 +214,9 @@ st_texture_image_unmap(struct st_context *st,
 
    DBG("%s\n", __FUNCTION__);
 
-   screen->surface_unmap(screen, stImage->surface);
+   screen->transfer_unmap(screen, stImage->transfer);
 
-   pipe_surface_reference(&stImage->surface, NULL);
+   screen->tex_transfer_destroy(stImage->transfer);
 }
 
 
@@ -234,13 +231,13 @@ st_texture_image_unmap(struct st_context *st,
  */
 static void
 st_surface_data(struct pipe_context *pipe,
-               struct pipe_surface *dst,
+               struct pipe_transfer *dst,
                unsigned dstx, unsigned dsty,
                const void *src, unsigned src_stride,
                unsigned srcx, unsigned srcy, unsigned width, unsigned height)
 {
    struct pipe_screen *screen = pipe->screen;
-   void *map = screen->surface_map(screen, dst, PIPE_BUFFER_USAGE_CPU_WRITE);
+   void *map = screen->transfer_map(screen, dst);
 
    pipe_copy_rect(map,
                   &dst->block,
@@ -250,7 +247,7 @@ st_surface_data(struct pipe_context *pipe,
                   src, src_stride, 
                   srcx, srcy);
 
-   screen->surface_unmap(screen, dst);
+   screen->transfer_unmap(screen, dst);
 }
 
 
@@ -268,21 +265,23 @@ st_texture_image_data(struct pipe_context *pipe,
    GLuint depth = dst->depth[level];
    GLuint i;
    const GLubyte *srcUB = src;
-   struct pipe_surface *dst_surface;
+   struct pipe_transfer *dst_transfer;
 
    DBG("%s\n", __FUNCTION__);
    for (i = 0; i < depth; i++) {
-      dst_surface = screen->get_tex_surface(screen, dst, face, level, i,
-                                            PIPE_BUFFER_USAGE_CPU_WRITE);
+      dst_transfer = screen->get_tex_transfer(screen, dst, face, level, i,
+                                              PIPE_TRANSFER_WRITE, 0, 0,
+                                              dst->width[level],
+                                              dst->height[level]);
 
-      st_surface_data(pipe, dst_surface,
+      st_surface_data(pipe, dst_transfer,
                      0, 0,                             /* dstx, dsty */
                      srcUB,
                      src_row_stride,
                      0, 0,                             /* source x, y */
                      dst->width[level], dst->height[level]);       /* width, height */
 
-      screen->tex_surface_release(screen, &dst_surface);
+      screen->tex_transfer_destroy(dst_transfer);
 
       srcUB += src_image_stride;
    }
@@ -341,15 +340,14 @@ st_texture_image_copy(struct pipe_context *pipe,
                                             PIPE_BUFFER_USAGE_GPU_READ);
 
       pipe->surface_copy(pipe,
-                         FALSE,
                         dst_surface,
                         0, 0, /* destX, Y */
                         src_surface,
                         0, 0, /* srcX, Y */
                         width, height);
 
-      screen->tex_surface_release(screen, &src_surface);
-      screen->tex_surface_release(screen, &dst_surface);
+      pipe_surface_reference(&src_surface, NULL);
+      pipe_surface_reference(&dst_surface, NULL);
    }
 }
 
@@ -427,7 +425,7 @@ st_bind_teximage(struct st_framebuffer *stfb, uint surfIndex,
    }
 
    if (target == ST_TEXTURE_2D) {
-      texObj = texUnit->Current2D;
+      texObj = texUnit->CurrentTex[TEXTURE_2D_INDEX];
       texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, level);
       stImage = st_texture_image(texImage);
    }
index 31f66ad52cf5abe4d6f726e4b22b44c3a57a5ffe..840b7e27cc080539ee6ddcdbb394593ab86ccfb2 100644 (file)
@@ -50,7 +50,7 @@ struct st_texture_image
     */
    struct pipe_texture *pt;
 
-   struct pipe_surface *surface;
+   struct pipe_transfer *transfer;
 };
 
 
@@ -132,7 +132,9 @@ extern GLubyte *
 st_texture_image_map(struct st_context *st,
                      struct st_texture_image *stImage,
                     GLuint zoffset,
-                     GLuint flags);
+                     enum pipe_transfer_usage usage,
+                     unsigned x, unsigned y,
+                     unsigned w, unsigned h);
 
 extern void
 st_texture_image_unmap(struct st_context *st,
index 21cbd3cf37f90c80a42ca922641b910e165ae5ca..458fe18163eb2042480bb16cb4228999c53ba28d 100644 (file)
@@ -591,8 +591,6 @@ _swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span)
    /* incoming colors should be floats */
    ASSERT(span->array->ChanType == GL_FLOAT);
 
-   ctx->_CurrentProgram = GL_FRAGMENT_SHADER_ATI;
-
    for (i = 0; i < span->end; i++) {
       if (span->array->mask[i]) {
         init_machine(ctx, &machine, shader, span, i);
@@ -608,6 +606,4 @@ _swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span)
         }
       }
    }
-
-   ctx->_CurrentProgram = 0;
 }
diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c
deleted file mode 100644 (file)
index af475ad..0000000
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.1
- *
- * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/** XXX This file should be named s_clear.c */
-
-#include "main/glheader.h"
-#include "main/colormac.h"
-#include "main/macros.h"
-#include "main/imports.h"
-#include "main/mtypes.h"
-
-#include "s_accum.h"
-#include "s_context.h"
-#include "s_depth.h"
-#include "s_masking.h"
-#include "s_stencil.h"
-
-
-/**
- * Clear the color buffer when glColorMask is in effect.
- */
-static void
-clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
-{
-   const GLint x = ctx->DrawBuffer->_Xmin;
-   const GLint y = ctx->DrawBuffer->_Ymin;
-   const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
-   const GLint width  = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
-   SWspan span;
-   GLint i;
-
-   ASSERT(ctx->Visual.rgbMode);
-   ASSERT(rb->PutRow);
-
-   /* Initialize color span with clear color */
-   /* XXX optimize for clearcolor == black/zero (bzero) */
-   INIT_SPAN(span, GL_BITMAP);
-   span.end = width;
-   span.arrayMask = SPAN_RGBA;
-   span.array->ChanType = rb->DataType;
-   if (span.array->ChanType == GL_UNSIGNED_BYTE) {
-      GLubyte clearColor[4];
-      UNCLAMPED_FLOAT_TO_UBYTE(clearColor[RCOMP], ctx->Color.ClearColor[0]);
-      UNCLAMPED_FLOAT_TO_UBYTE(clearColor[GCOMP], ctx->Color.ClearColor[1]);
-      UNCLAMPED_FLOAT_TO_UBYTE(clearColor[BCOMP], ctx->Color.ClearColor[2]);
-      UNCLAMPED_FLOAT_TO_UBYTE(clearColor[ACOMP], ctx->Color.ClearColor[3]);
-      for (i = 0; i < width; i++) {
-         COPY_4UBV(span.array->rgba[i], clearColor);
-      }
-   }
-   else if (span.array->ChanType == GL_UNSIGNED_SHORT) {
-      GLushort clearColor[4];
-      UNCLAMPED_FLOAT_TO_USHORT(clearColor[RCOMP], ctx->Color.ClearColor[0]);
-      UNCLAMPED_FLOAT_TO_USHORT(clearColor[GCOMP], ctx->Color.ClearColor[1]);
-      UNCLAMPED_FLOAT_TO_USHORT(clearColor[BCOMP], ctx->Color.ClearColor[2]);
-      UNCLAMPED_FLOAT_TO_USHORT(clearColor[ACOMP], ctx->Color.ClearColor[3]);
-      for (i = 0; i < width; i++) {
-         COPY_4V(span.array->rgba[i], clearColor);
-      }
-   }
-   else {
-      ASSERT(span.array->ChanType == GL_FLOAT);
-      for (i = 0; i < width; i++) {
-         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][0], ctx->Color.ClearColor[0]);
-         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][1], ctx->Color.ClearColor[1]);
-         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][2], ctx->Color.ClearColor[2]);
-         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][3], ctx->Color.ClearColor[3]);
-      }
-   }
-
-   /* Note that masking will change the color values, but only the
-    * channels for which the write mask is GL_FALSE.  The channels
-    * which which are write-enabled won't get modified.
-    */
-   for (i = 0; i < height; i++) {
-      span.x = x;
-      span.y = y + i;
-      _swrast_mask_rgba_span(ctx, rb, &span);
-      /* write masked row */
-      rb->PutRow(ctx, rb, width, x, y + i, span.array->rgba, NULL);
-   }
-}
-
-
-/**
- * Clear color index buffer with masking.
- */
-static void
-clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
-{
-   const GLint x = ctx->DrawBuffer->_Xmin;
-   const GLint y = ctx->DrawBuffer->_Ymin;
-   const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
-   const GLint width  = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
-   SWspan span;
-   GLint i;
-
-   ASSERT(!ctx->Visual.rgbMode);
-   ASSERT(rb->PutRow);
-   ASSERT(rb->DataType == GL_UNSIGNED_INT);
-
-   /* Initialize index span with clear index */
-   INIT_SPAN(span, GL_BITMAP);
-   span.end = width;
-   span.arrayMask = SPAN_INDEX;
-   for (i = 0; i < width;i++) {
-      span.array->index[i] = ctx->Color.ClearIndex;
-   }
-
-   /* Note that masking will change the color indexes, but only the
-    * bits for which the write mask is GL_FALSE.  The bits
-    * which are write-enabled won't get modified.
-    */
-   for (i = 0; i < height;i++) {
-      span.x = x;
-      span.y = y + i;
-      _swrast_mask_ci_span(ctx, rb, &span);
-      /* write masked row */
-      rb->PutRow(ctx, rb, width, x, y + i, span.array->index, NULL);
-   }
-}
-
-
-/**
- * Clear an rgba color buffer without channel masking.
- */
-static void
-clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
-{
-   const GLint x = ctx->DrawBuffer->_Xmin;
-   const GLint y = ctx->DrawBuffer->_Ymin;
-   const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
-   const GLint width  = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
-   GLubyte clear8[4];
-   GLushort clear16[4];
-   GLvoid *clearVal;
-   GLint i;
-
-   ASSERT(ctx->Visual.rgbMode);
-
-   ASSERT(ctx->Color.ColorMask[0] &&
-          ctx->Color.ColorMask[1] &&
-          ctx->Color.ColorMask[2] &&
-          ctx->Color.ColorMask[3]);             
-
-   ASSERT(rb->PutMonoRow);
-
-   switch (rb->DataType) {
-      case GL_UNSIGNED_BYTE:
-         UNCLAMPED_FLOAT_TO_UBYTE(clear8[0], ctx->Color.ClearColor[0]);
-         UNCLAMPED_FLOAT_TO_UBYTE(clear8[1], ctx->Color.ClearColor[1]);
-         UNCLAMPED_FLOAT_TO_UBYTE(clear8[2], ctx->Color.ClearColor[2]);
-         UNCLAMPED_FLOAT_TO_UBYTE(clear8[3], ctx->Color.ClearColor[3]);
-         clearVal = clear8;
-         break;
-      case GL_UNSIGNED_SHORT:
-         UNCLAMPED_FLOAT_TO_USHORT(clear16[0], ctx->Color.ClearColor[0]);
-         UNCLAMPED_FLOAT_TO_USHORT(clear16[1], ctx->Color.ClearColor[1]);
-         UNCLAMPED_FLOAT_TO_USHORT(clear16[2], ctx->Color.ClearColor[2]);
-         UNCLAMPED_FLOAT_TO_USHORT(clear16[3], ctx->Color.ClearColor[3]);
-         clearVal = clear16;
-         break;
-      case GL_FLOAT:
-         clearVal = ctx->Color.ClearColor;
-         break;
-      default:
-         _mesa_problem(ctx, "Bad rb DataType in clear_color_buffer");
-         return;
-   }
-
-   for (i = 0; i < height; i++) {
-      rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
-   }
-}
-
-
-/**
- * Clear color index buffer without masking.
- */
-static void
-clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
-{
-   const GLint x = ctx->DrawBuffer->_Xmin;
-   const GLint y = ctx->DrawBuffer->_Ymin;
-   const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
-   const GLint width  = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
-   GLubyte clear8;
-   GLushort clear16;
-   GLuint clear32;
-   GLvoid *clearVal;
-   GLint i;
-
-   ASSERT(!ctx->Visual.rgbMode);
-
-   ASSERT((ctx->Color.IndexMask & ((1 << rb->IndexBits) - 1))
-          == (GLuint) ((1 << rb->IndexBits) - 1));
-
-   ASSERT(rb->PutMonoRow);
-
-   /* setup clear value */
-   switch (rb->DataType) {
-      case GL_UNSIGNED_BYTE:
-         clear8 = (GLubyte) ctx->Color.ClearIndex;
-         clearVal = &clear8;
-         break;
-      case GL_UNSIGNED_SHORT:
-         clear16 = (GLushort) ctx->Color.ClearIndex;
-         clearVal = &clear16;
-         break;
-      case GL_UNSIGNED_INT:
-         clear32 = ctx->Color.ClearIndex;
-         clearVal = &clear32;
-         break;
-      default:
-         _mesa_problem(ctx, "Bad rb DataType in clear_color_buffer");
-         return;
-   }
-
-   for (i = 0; i < height; i++)
-      rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
-}
-
-
-/**
- * Clear the front/back/left/right/aux color buffers.
- * This function is usually only called if the device driver can't
- * clear its own color buffers for some reason (such as with masking).
- */
-static void
-clear_color_buffers(GLcontext *ctx)
-{
-   GLboolean masking;
-   GLuint buf;
-
-   if (ctx->Visual.rgbMode) {
-      if (ctx->Color.ColorMask[0] && 
-          ctx->Color.ColorMask[1] && 
-          ctx->Color.ColorMask[2] && 
-          ctx->Color.ColorMask[3]) {
-         masking = GL_FALSE;
-      }
-      else {
-         masking = GL_TRUE;
-      }
-   }
-   else {
-      struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
-      const GLuint indexBits = (1 << rb->IndexBits) - 1;
-      if ((ctx->Color.IndexMask & indexBits) == indexBits) {
-         masking = GL_FALSE;
-      }
-      else {
-         masking = GL_TRUE;
-      }
-   }
-
-   for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) {
-      struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[buf];
-      if (ctx->Visual.rgbMode) {
-         if (masking) {
-            clear_rgba_buffer_with_masking(ctx, rb);
-         }
-         else {
-            clear_rgba_buffer(ctx, rb);
-         }
-      }
-      else {
-         if (masking) {
-            clear_ci_buffer_with_masking(ctx, rb);
-         }
-         else {
-            clear_ci_buffer(ctx, rb);
-         }
-      }
-   }
-}
-
-
-/**
- * Called via the device driver's ctx->Driver.Clear() function if the
- * device driver can't clear one or more of the buffers itself.
- * \param buffers  bitfield of BUFFER_BIT_* values indicating which
- *                 renderbuffers are to be cleared.
- * \param all  if GL_TRUE, clear whole buffer, else clear specified region.
- */
-void
-_swrast_Clear(GLcontext *ctx, GLbitfield buffers)
-{
-#ifdef DEBUG_FOO
-   {
-      const GLbitfield legalBits =
-         BUFFER_BIT_FRONT_LEFT |
-        BUFFER_BIT_FRONT_RIGHT |
-        BUFFER_BIT_BACK_LEFT |
-        BUFFER_BIT_BACK_RIGHT |
-        BUFFER_BIT_DEPTH |
-        BUFFER_BIT_STENCIL |
-        BUFFER_BIT_ACCUM |
-         BUFFER_BIT_AUX0 |
-         BUFFER_BIT_AUX1 |
-         BUFFER_BIT_AUX2 |
-         BUFFER_BIT_AUX3;
-      assert((buffers & (~legalBits)) == 0);
-   }
-#endif
-
-   swrast_render_start(ctx);
-
-   /* do software clearing here */
-   if (buffers) {
-      if ((buffers & BUFFER_BITS_COLOR)
-          && (ctx->DrawBuffer->_NumColorDrawBuffers > 0)) {
-         clear_color_buffers(ctx);
-      }
-      if (buffers & BUFFER_BIT_DEPTH) {
-         _swrast_clear_depth_buffer(ctx, ctx->DrawBuffer->_DepthBuffer);
-      }
-      if (buffers & BUFFER_BIT_ACCUM) {
-         _swrast_clear_accum_buffer(ctx,
-                       ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer);
-      }
-      if (buffers & BUFFER_BIT_STENCIL) {
-         _swrast_clear_stencil_buffer(ctx, ctx->DrawBuffer->_StencilBuffer);
-      }
-   }
-
-   swrast_render_finish(ctx);
-}
diff --git a/src/mesa/swrast/s_clear.c b/src/mesa/swrast/s_clear.c
new file mode 100644 (file)
index 0000000..35080fd
--- /dev/null
@@ -0,0 +1,344 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.1
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
+
+#include "s_accum.h"
+#include "s_context.h"
+#include "s_depth.h"
+#include "s_masking.h"
+#include "s_stencil.h"
+
+
+/**
+ * Clear the color buffer when glColorMask is in effect.
+ */
+static void
+clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
+{
+   const GLint x = ctx->DrawBuffer->_Xmin;
+   const GLint y = ctx->DrawBuffer->_Ymin;
+   const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
+   const GLint width  = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+   SWspan span;
+   GLint i;
+
+   ASSERT(ctx->Visual.rgbMode);
+   ASSERT(rb->PutRow);
+
+   /* Initialize color span with clear color */
+   /* XXX optimize for clearcolor == black/zero (bzero) */
+   INIT_SPAN(span, GL_BITMAP);
+   span.end = width;
+   span.arrayMask = SPAN_RGBA;
+   span.array->ChanType = rb->DataType;
+   if (span.array->ChanType == GL_UNSIGNED_BYTE) {
+      GLubyte clearColor[4];
+      UNCLAMPED_FLOAT_TO_UBYTE(clearColor[RCOMP], ctx->Color.ClearColor[0]);
+      UNCLAMPED_FLOAT_TO_UBYTE(clearColor[GCOMP], ctx->Color.ClearColor[1]);
+      UNCLAMPED_FLOAT_TO_UBYTE(clearColor[BCOMP], ctx->Color.ClearColor[2]);
+      UNCLAMPED_FLOAT_TO_UBYTE(clearColor[ACOMP], ctx->Color.ClearColor[3]);
+      for (i = 0; i < width; i++) {
+         COPY_4UBV(span.array->rgba[i], clearColor);
+      }
+   }
+   else if (span.array->ChanType == GL_UNSIGNED_SHORT) {
+      GLushort clearColor[4];
+      UNCLAMPED_FLOAT_TO_USHORT(clearColor[RCOMP], ctx->Color.ClearColor[0]);
+      UNCLAMPED_FLOAT_TO_USHORT(clearColor[GCOMP], ctx->Color.ClearColor[1]);
+      UNCLAMPED_FLOAT_TO_USHORT(clearColor[BCOMP], ctx->Color.ClearColor[2]);
+      UNCLAMPED_FLOAT_TO_USHORT(clearColor[ACOMP], ctx->Color.ClearColor[3]);
+      for (i = 0; i < width; i++) {
+         COPY_4V(span.array->rgba[i], clearColor);
+      }
+   }
+   else {
+      ASSERT(span.array->ChanType == GL_FLOAT);
+      for (i = 0; i < width; i++) {
+         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][0], ctx->Color.ClearColor[0]);
+         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][1], ctx->Color.ClearColor[1]);
+         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][2], ctx->Color.ClearColor[2]);
+         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][3], ctx->Color.ClearColor[3]);
+      }
+   }
+
+   /* Note that masking will change the color values, but only the
+    * channels for which the write mask is GL_FALSE.  The channels
+    * which which are write-enabled won't get modified.
+    */
+   for (i = 0; i < height; i++) {
+      span.x = x;
+      span.y = y + i;
+      _swrast_mask_rgba_span(ctx, rb, &span);
+      /* write masked row */
+      rb->PutRow(ctx, rb, width, x, y + i, span.array->rgba, NULL);
+   }
+}
+
+
+/**
+ * Clear color index buffer with masking.
+ */
+static void
+clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
+{
+   const GLint x = ctx->DrawBuffer->_Xmin;
+   const GLint y = ctx->DrawBuffer->_Ymin;
+   const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
+   const GLint width  = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+   SWspan span;
+   GLint i;
+
+   ASSERT(!ctx->Visual.rgbMode);
+   ASSERT(rb->PutRow);
+   ASSERT(rb->DataType == GL_UNSIGNED_INT);
+
+   /* Initialize index span with clear index */
+   INIT_SPAN(span, GL_BITMAP);
+   span.end = width;
+   span.arrayMask = SPAN_INDEX;
+   for (i = 0; i < width;i++) {
+      span.array->index[i] = ctx->Color.ClearIndex;
+   }
+
+   /* Note that masking will change the color indexes, but only the
+    * bits for which the write mask is GL_FALSE.  The bits
+    * which are write-enabled won't get modified.
+    */
+   for (i = 0; i < height;i++) {
+      span.x = x;
+      span.y = y + i;
+      _swrast_mask_ci_span(ctx, rb, &span);
+      /* write masked row */
+      rb->PutRow(ctx, rb, width, x, y + i, span.array->index, NULL);
+   }
+}
+
+
+/**
+ * Clear an rgba color buffer without channel masking.
+ */
+static void
+clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
+{
+   const GLint x = ctx->DrawBuffer->_Xmin;
+   const GLint y = ctx->DrawBuffer->_Ymin;
+   const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
+   const GLint width  = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+   GLubyte clear8[4];
+   GLushort clear16[4];
+   GLvoid *clearVal;
+   GLint i;
+
+   ASSERT(ctx->Visual.rgbMode);
+
+   ASSERT(ctx->Color.ColorMask[0] &&
+          ctx->Color.ColorMask[1] &&
+          ctx->Color.ColorMask[2] &&
+          ctx->Color.ColorMask[3]);             
+
+   ASSERT(rb->PutMonoRow);
+
+   switch (rb->DataType) {
+      case GL_UNSIGNED_BYTE:
+         UNCLAMPED_FLOAT_TO_UBYTE(clear8[0], ctx->Color.ClearColor[0]);
+         UNCLAMPED_FLOAT_TO_UBYTE(clear8[1], ctx->Color.ClearColor[1]);
+         UNCLAMPED_FLOAT_TO_UBYTE(clear8[2], ctx->Color.ClearColor[2]);
+         UNCLAMPED_FLOAT_TO_UBYTE(clear8[3], ctx->Color.ClearColor[3]);
+         clearVal = clear8;
+         break;
+      case GL_UNSIGNED_SHORT:
+         UNCLAMPED_FLOAT_TO_USHORT(clear16[0], ctx->Color.ClearColor[0]);
+         UNCLAMPED_FLOAT_TO_USHORT(clear16[1], ctx->Color.ClearColor[1]);
+         UNCLAMPED_FLOAT_TO_USHORT(clear16[2], ctx->Color.ClearColor[2]);
+         UNCLAMPED_FLOAT_TO_USHORT(clear16[3], ctx->Color.ClearColor[3]);
+         clearVal = clear16;
+         break;
+      case GL_FLOAT:
+         clearVal = ctx->Color.ClearColor;
+         break;
+      default:
+         _mesa_problem(ctx, "Bad rb DataType in clear_color_buffer");
+         return;
+   }
+
+   for (i = 0; i < height; i++) {
+      rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
+   }
+}
+
+
+/**
+ * Clear color index buffer without masking.
+ */
+static void
+clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
+{
+   const GLint x = ctx->DrawBuffer->_Xmin;
+   const GLint y = ctx->DrawBuffer->_Ymin;
+   const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
+   const GLint width  = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+   GLubyte clear8;
+   GLushort clear16;
+   GLuint clear32;
+   GLvoid *clearVal;
+   GLint i;
+
+   ASSERT(!ctx->Visual.rgbMode);
+
+   ASSERT((ctx->Color.IndexMask & ((1 << rb->IndexBits) - 1))
+          == (GLuint) ((1 << rb->IndexBits) - 1));
+
+   ASSERT(rb->PutMonoRow);
+
+   /* setup clear value */
+   switch (rb->DataType) {
+      case GL_UNSIGNED_BYTE:
+         clear8 = (GLubyte) ctx->Color.ClearIndex;
+         clearVal = &clear8;
+         break;
+      case GL_UNSIGNED_SHORT:
+         clear16 = (GLushort) ctx->Color.ClearIndex;
+         clearVal = &clear16;
+         break;
+      case GL_UNSIGNED_INT:
+         clear32 = ctx->Color.ClearIndex;
+         clearVal = &clear32;
+         break;
+      default:
+         _mesa_problem(ctx, "Bad rb DataType in clear_color_buffer");
+         return;
+   }
+
+   for (i = 0; i < height; i++)
+      rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
+}
+
+
+/**
+ * Clear the front/back/left/right/aux color buffers.
+ * This function is usually only called if the device driver can't
+ * clear its own color buffers for some reason (such as with masking).
+ */
+static void
+clear_color_buffers(GLcontext *ctx)
+{
+   GLboolean masking;
+   GLuint buf;
+
+   if (ctx->Visual.rgbMode) {
+      if (ctx->Color.ColorMask[0] && 
+          ctx->Color.ColorMask[1] && 
+          ctx->Color.ColorMask[2] && 
+          ctx->Color.ColorMask[3]) {
+         masking = GL_FALSE;
+      }
+      else {
+         masking = GL_TRUE;
+      }
+   }
+   else {
+      struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
+      const GLuint indexBits = (1 << rb->IndexBits) - 1;
+      if ((ctx->Color.IndexMask & indexBits) == indexBits) {
+         masking = GL_FALSE;
+      }
+      else {
+         masking = GL_TRUE;
+      }
+   }
+
+   for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) {
+      struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[buf];
+      if (ctx->Visual.rgbMode) {
+         if (masking) {
+            clear_rgba_buffer_with_masking(ctx, rb);
+         }
+         else {
+            clear_rgba_buffer(ctx, rb);
+         }
+      }
+      else {
+         if (masking) {
+            clear_ci_buffer_with_masking(ctx, rb);
+         }
+         else {
+            clear_ci_buffer(ctx, rb);
+         }
+      }
+   }
+}
+
+
+/**
+ * Called via the device driver's ctx->Driver.Clear() function if the
+ * device driver can't clear one or more of the buffers itself.
+ * \param buffers  bitfield of BUFFER_BIT_* values indicating which
+ *                 renderbuffers are to be cleared.
+ * \param all  if GL_TRUE, clear whole buffer, else clear specified region.
+ */
+void
+_swrast_Clear(GLcontext *ctx, GLbitfield buffers)
+{
+#ifdef DEBUG_FOO
+   {
+      const GLbitfield legalBits =
+         BUFFER_BIT_FRONT_LEFT |
+        BUFFER_BIT_FRONT_RIGHT |
+        BUFFER_BIT_BACK_LEFT |
+        BUFFER_BIT_BACK_RIGHT |
+        BUFFER_BIT_DEPTH |
+        BUFFER_BIT_STENCIL |
+        BUFFER_BIT_ACCUM |
+         BUFFER_BIT_AUX0;
+      assert((buffers & (~legalBits)) == 0);
+   }
+#endif
+
+   swrast_render_start(ctx);
+
+   /* do software clearing here */
+   if (buffers) {
+      if ((buffers & BUFFER_BITS_COLOR)
+          && (ctx->DrawBuffer->_NumColorDrawBuffers > 0)) {
+         clear_color_buffers(ctx);
+      }
+      if (buffers & BUFFER_BIT_DEPTH) {
+         _swrast_clear_depth_buffer(ctx, ctx->DrawBuffer->_DepthBuffer);
+      }
+      if (buffers & BUFFER_BIT_ACCUM) {
+         _swrast_clear_accum_buffer(ctx,
+                       ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer);
+      }
+      if (buffers & BUFFER_BIT_STENCIL) {
+         _swrast_clear_stencil_buffer(ctx, ctx->DrawBuffer->_StencilBuffer);
+      }
+   }
+
+   swrast_render_finish(ctx);
+}
index 297940adbd635f0966feda1af9059778a627ee25..4dbccbb2d5920632d2120db8c1ade165994a493c 100644 (file)
@@ -61,7 +61,7 @@ _swrast_update_rasterflags( GLcontext *ctx )
    if (ctx->Depth.Test)                   rasterMask |= DEPTH_BIT;
    if (swrast->_FogEnabled)               rasterMask |= FOG_BIT;
    if (ctx->Scissor.Enabled)              rasterMask |= CLIP_BIT;
-   if (ctx->Stencil.Enabled)              rasterMask |= STENCIL_BIT;
+   if (ctx->Stencil._Enabled)             rasterMask |= STENCIL_BIT;
    if (ctx->Visual.rgbMode) {
       const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
       if (colorMask != 0xffffffff)        rasterMask |= MASKING_BIT;
@@ -206,7 +206,7 @@ _swrast_update_deferred_texture(GLcontext *ctx)
    else {
       const struct gl_fragment_program *fprog
          = ctx->FragmentProgram._Current;
-      if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR))) {
+      if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH))) {
          /* Z comes from fragment program/shader */
          swrast->_DeferredTexture = GL_FALSE;
       }
index cdd6fa5048d6df2b3968323e20ef29c26b21f6e9..6e8d080704dd4609f31a40e536a14f23c4b522d6 100644 (file)
@@ -288,6 +288,34 @@ swrast_render_finish(GLcontext *ctx)
 
 
 
+/*
+ * Fixed point arithmetic macros
+ */
+#ifndef FIXED_FRAC_BITS
+#define FIXED_FRAC_BITS 11
+#endif
+
+#define FIXED_SHIFT     FIXED_FRAC_BITS
+#define FIXED_ONE       (1 << FIXED_SHIFT)
+#define FIXED_HALF      (1 << (FIXED_SHIFT-1))
+#define FIXED_FRAC_MASK (FIXED_ONE - 1)
+#define FIXED_INT_MASK  (~FIXED_FRAC_MASK)
+#define FIXED_EPSILON   1
+#define FIXED_SCALE     ((float) FIXED_ONE)
+#define FIXED_DBL_SCALE ((double) FIXED_ONE)
+#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
+#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
+#define IntToFixed(I)   ((I) << FIXED_SHIFT)
+#define FixedToInt(X)   ((X) >> FIXED_SHIFT)
+#define FixedToUns(X)   (((unsigned int)(X)) >> FIXED_SHIFT)
+#define FixedCeil(X)    (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
+#define FixedFloor(X)   ((X) & FIXED_INT_MASK)
+#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
+#define PosFloatToFixed(X)      FloatToFixed(X)
+#define SignedFloatToFixed(X)   FloatToFixed(X)
+
+
+
 /*
  * XXX these macros are just bandages for now in order to make
  * CHAN_BITS==32 compile cleanly.
index 700f76d4bc461152046a37024af0dfdc624f3251..a9ef8e685f1efe05d94ed08cf6b8223cf9b3842a 100644 (file)
@@ -829,6 +829,15 @@ _swrast_DrawPixels( GLcontext *ctx,
                    const GLvoid *pixels )
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLboolean save_vp_override = ctx->VertexProgram._Overriden;
+
+   /* We are creating fragments directly, without going through vertex programs.
+    *
+    * This override flag tells the fragment processing code that its input comes
+    * from a non-standard source, and it may therefore not rely on optimizations
+    * that assume e.g. constant color if there is no color vertex array.
+    */
+   _mesa_set_vp_override(ctx, GL_TRUE);
 
    swrast_render_start(ctx);
 
@@ -841,6 +850,7 @@ _swrast_DrawPixels( GLcontext *ctx,
     pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels);
     if (!pixels) {
        swrast_render_finish(ctx);
+       _mesa_set_vp_override(ctx, save_vp_override);
        return;
     }
 
@@ -880,6 +890,7 @@ _swrast_DrawPixels( GLcontext *ctx,
    }
 
    swrast_render_finish(ctx);
+   _mesa_set_vp_override(ctx, save_vp_override);
 
    _mesa_unmap_drawpix_pbo(ctx, unpack);
 }
index aa79531277ced51fd90ce03de7c30b81c794215f..7bb914b6589667c7c2307fb1a0445876fb339f5c 100644 (file)
@@ -59,8 +59,8 @@ _swrast_feedback_triangle(GLcontext *ctx, const SWvertex *v0,
                           const SWvertex *v1, const SWvertex *v2)
 {
    if (_swrast_culltriangle(ctx, v0, v1, v2)) {
-      FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN);
-      FEEDBACK_TOKEN(ctx, (GLfloat) 3); /* three vertices */
+      _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN);
+      _mesa_feedback_token(ctx, (GLfloat) 3); /* three vertices */
 
       if (ctx->Light.ShadeModel == GL_SMOOTH) {
          feedback_vertex(ctx, v0, v0);
@@ -86,7 +86,7 @@ _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0,
    if (swrast->StippleCounter == 0)
       token = GL_LINE_RESET_TOKEN;
 
-   FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) token);
+   _mesa_feedback_token(ctx, (GLfloat) (GLint) token);
 
    if (ctx->Light.ShadeModel == GL_SMOOTH) {
       feedback_vertex(ctx, v0, v0);
@@ -104,7 +104,7 @@ _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0,
 void
 _swrast_feedback_point(GLcontext *ctx, const SWvertex *v)
 {
-   FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POINT_TOKEN);
+   _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN);
    feedback_vertex(ctx, v, v);
 }
 
index c6601f5593d691840ee6bc955bf3d5b860cee9d9..ae1dea16a07bd18562fe0e9a3c897f6e263946ed 100644 (file)
@@ -202,9 +202,9 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
          if (_mesa_execute_program(ctx, &program->Base, machine)) {
 
             /* Store result color */
-            if (outputsWritten & (1 << FRAG_RESULT_COLR)) {
+            if (outputsWritten & (1 << FRAG_RESULT_COLOR)) {
                COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i],
-                       machine->Outputs[FRAG_RESULT_COLR]);
+                       machine->Outputs[FRAG_RESULT_COLOR]);
             }
             else {
                /* Multiple drawbuffers / render targets
@@ -221,8 +221,8 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
             }
 
             /* Store result depth/z */
-            if (outputsWritten & (1 << FRAG_RESULT_DEPR)) {
-               const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPR][2];
+            if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) {
+               const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPTH][2];
                if (depth <= 0.0)
                   span->array->z[i] = 0;
                else if (depth >= 1.0)
@@ -255,20 +255,16 @@ _swrast_exec_fragment_program( GLcontext *ctx, SWspan *span )
       ASSERT(span->array->ChanType == GL_FLOAT);
    }
 
-   ctx->_CurrentProgram = GL_FRAGMENT_PROGRAM_ARB; /* or NV, doesn't matter */
-
    run_program(ctx, span, 0, span->end);
 
-   if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLR)) {
+   if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)) {
       span->interpMask &= ~SPAN_RGBA;
       span->arrayMask |= SPAN_RGBA;
    }
 
-   if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) {
+   if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) {
       span->interpMask &= ~SPAN_Z;
       span->arrayMask |= SPAN_Z;
    }
-
-   ctx->_CurrentProgram = 0;
 }
 
index ab7b82b19d952e4a17c2c75c17e5714620c3fc07..15a783b236bbb6d1dde4b44dcc3be72c21211abb 100644 (file)
@@ -442,11 +442,10 @@ _swrast_span_interpolate_z( const GLcontext *ctx, SWspan *span )
  * Compute mipmap LOD from partial derivatives.
  * This the ideal solution, as given in the OpenGL spec.
  */
-#if 0
-static GLfloat
-compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
-               GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH,
-               GLfloat s, GLfloat t, GLfloat q, GLfloat invQ)
+GLfloat
+_swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
+                       GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH,
+                       GLfloat s, GLfloat t, GLfloat q, GLfloat invQ)
 {
    GLfloat dudx = texW * ((s + dsdx) / (q + dqdx) - s * invQ);
    GLfloat dvdx = texH * ((t + dtdx) / (q + dqdx) - t * invQ);
@@ -458,13 +457,13 @@ compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
    GLfloat lambda = LOG2(rho);
    return lambda;
 }
-#endif
 
 
 /**
  * Compute mipmap LOD from partial derivatives.
  * This is a faster approximation than above function.
  */
+#if 0
 GLfloat
 _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
                      GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH,
@@ -485,6 +484,7 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
    lambda = LOG2(rho);
    return lambda;
 }
+#endif
 
 
 /**
@@ -846,11 +846,11 @@ _swrast_write_index_span( GLcontext *ctx, SWspan *span)
    }
 
    /* Stencil and Z testing */
-   if (ctx->Depth.Test || ctx->Stencil.Enabled) {
+   if (ctx->Stencil._Enabled || ctx->Depth.Test) {
       if (!(span->arrayMask & SPAN_Z))
          _swrast_span_interpolate_z(ctx, span);
 
-      if (ctx->Stencil.Enabled) {
+      if (ctx->Stencil._Enabled) {
          if (!_swrast_stencil_and_ztest_span(ctx, span)) {
             span->arrayMask = origArrayMask;
             return;
@@ -1211,7 +1211,7 @@ shade_texture_span(GLcontext *ctx, SWspan *span)
          _swrast_exec_fragment_shader(ctx, span);
       }
    }
-   else if (ctx->Texture._EnabledUnits) {
+   else if (ctx->Texture._EnabledCoordUnits) {
       /* conventional texturing */
 
 #if CHAN_BITS == 32
@@ -1250,7 +1250,7 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
    void * const origRgba = span->array->rgba;
    const GLboolean shader = (ctx->FragmentProgram._Current
                              || ctx->ATIFragmentShader._Enabled);
-   const GLboolean shaderOrTexture = shader || ctx->Texture._EnabledUnits;
+   const GLboolean shaderOrTexture = shader || ctx->Texture._EnabledCoordUnits;
    struct gl_framebuffer *fb = ctx->DrawBuffer;
 
    /*
@@ -1317,11 +1317,11 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
    }
 
    /* Stencil and Z testing */
-   if (ctx->Stencil.Enabled || ctx->Depth.Test) {
+   if (ctx->Stencil._Enabled || ctx->Depth.Test) {
       if (!(span->arrayMask & SPAN_Z))
          _swrast_span_interpolate_z(ctx, span);
 
-      if (ctx->Stencil.Enabled && fb->Visual.stencilBits > 0) {
+      if (ctx->Stencil._Enabled) {
          /* Combined Z/stencil tests */
          if (!_swrast_stencil_and_ztest_span(ctx, span)) {
             /* all fragments failed test */
index 38b5633887f4fde7d3f8e4f130d4852f7344692b..aa28311672d3d2f49822ce2367a1c45821e6c5af 100644 (file)
@@ -591,6 +591,25 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n,
             }
         }
          break;
+      case GL_BUMP_ENVMAP_ATI:
+         {
+            /* this produces a fixed rgba color, and the coord calc is done elsewhere */
+            for (i = 0; i < n; i++) {
+            /* rgba result is 0,0,0,1 */
+#if CHAN_TYPE == GL_FLOAT
+               rgba[i][RCOMP] = 0.0;
+               rgba[i][GCOMP] = 0.0;
+               rgba[i][BCOMP] = 0.0;
+               rgba[i][ACOMP] = 1.0;
+#else
+               rgba[i][RCOMP] = 0;
+               rgba[i][GCOMP] = 0;
+               rgba[i][BCOMP] = 0;
+               rgba[i][ACOMP] = CHAN_MAX;
+#endif
+            }
+        }
+         return; /* no alpha processing */
       default:
          _mesa_problem(ctx, "invalid combine mode");
    }
@@ -1218,12 +1237,86 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span )
    if (swrast->_AnyTextureCombine)
       MEMCPY(primary_rgba, span->array->rgba, 4 * span->end * sizeof(GLchan));
 
+   /* First must sample all bump maps */
+   for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
+      if (ctx->Texture.Unit[unit]._ReallyEnabled &&
+         ctx->Texture.Unit[unit]._CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) {
+         const GLfloat (*texcoords)[4]
+            = (const GLfloat (*)[4])
+            span->array->attribs[FRAG_ATTRIB_TEX0 + unit];
+         GLfloat (*targetcoords)[4]
+            = (GLfloat (*)[4])
+            span->array->attribs[FRAG_ATTRIB_TEX0 +
+               ctx->Texture.Unit[unit].BumpTarget - GL_TEXTURE0];
+
+         const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+         const struct gl_texture_object *curObj = texUnit->_Current;
+         GLfloat *lambda = span->array->lambda[unit];
+         GLchan (*texels)[4] = (GLchan (*)[4])
+            (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan)));
+         GLuint i;
+         GLfloat rotMatrix00 = ctx->Texture.Unit[unit].RotMatrix[0];
+         GLfloat rotMatrix01 = ctx->Texture.Unit[unit].RotMatrix[1];
+         GLfloat rotMatrix10 = ctx->Texture.Unit[unit].RotMatrix[2];
+         GLfloat rotMatrix11 = ctx->Texture.Unit[unit].RotMatrix[3];
+
+         /* adjust texture lod (lambda) */
+         if (span->arrayMask & SPAN_LAMBDA) {
+            if (texUnit->LodBias + curObj->LodBias != 0.0F) {
+               /* apply LOD bias, but don't clamp yet */
+               const GLfloat bias = CLAMP(texUnit->LodBias + curObj->LodBias,
+                                          -ctx->Const.MaxTextureLodBias,
+                                          ctx->Const.MaxTextureLodBias);
+               GLuint i;
+               for (i = 0; i < span->end; i++) {
+                  lambda[i] += bias;
+               }
+            }
+
+            if (curObj->MinLod != -1000.0 || curObj->MaxLod != 1000.0) {
+               /* apply LOD clamping to lambda */
+               const GLfloat min = curObj->MinLod;
+               const GLfloat max = curObj->MaxLod;
+               GLuint i;
+               for (i = 0; i < span->end; i++) {
+                  GLfloat l = lambda[i];
+                  lambda[i] = CLAMP(l, min, max);
+               }
+            }
+         }
+
+         /* Sample the texture (span->end = number of fragments) */
+         swrast->TextureSample[unit]( ctx, texUnit->_Current, span->end,
+                                      texcoords, lambda, texels );
+
+         /* manipulate the span values of the bump target
+            not sure this can work correctly even ignoring
+            the problem that channel is unsigned */
+         for (i = 0; i < span->end; i++) {
+#if CHAN_TYPE == GL_FLOAT
+            targetcoords[i][0] += (texels[i][0] * rotMatrix00 + texels[i][1] *
+                                  rotMatrix01) / targetcoords[i][3];
+            targetcoords[i][1] += (texels[i][0] * rotMatrix10 + texels[i][1] *
+                                  rotMatrix11) / targetcoords[i][3];
+#else
+            targetcoords[i][0] += (CHAN_TO_FLOAT(texels[i][1]) * rotMatrix00 +
+                                  CHAN_TO_FLOAT(texels[i][1]) * rotMatrix01) /
+                                  targetcoords[i][3];
+            targetcoords[i][1] += (CHAN_TO_FLOAT(texels[i][0]) * rotMatrix10 + 
+                                  CHAN_TO_FLOAT(texels[i][1]) * rotMatrix11) /
+                                  targetcoords[i][3];
+#endif
+         }
+      }
+   }
+
    /*
     * Must do all texture sampling before combining in order to
     * accomodate GL_ARB_texture_env_crossbar.
     */
    for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
-      if (ctx->Texture.Unit[unit]._ReallyEnabled) {
+      if (ctx->Texture.Unit[unit]._ReallyEnabled &&
+         ctx->Texture.Unit[unit]._CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) {
          const GLfloat (*texcoords)[4]
             = (const GLfloat (*)[4])
             span->array->attribs[FRAG_ATTRIB_TEX0 + unit];
index 8d72018cf4f7a9cae5556c7599955469bc73f9f6..19317c393a977f82282bfadb6828b37ed501599c 100644 (file)
@@ -2830,7 +2830,9 @@ sample_depth_texture( GLcontext *ctx,
 
    /* XXXX if tObj->MinFilter != tObj->MagFilter, we're ignoring lambda */
 
-   function = tObj->_Function;
+   function = (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) ?
+      tObj->CompareFunc : GL_NONE;
+
    if (tObj->MagFilter == GL_NEAREST) {
       GLuint i;
       for (i = 0; i < n; i++) {
index 0598052f50c2a543a0df78450d2a288881b513ed..9260e35066fc57409bcd4b5cd133c01891ab5671 100644 (file)
@@ -132,7 +132,8 @@ _swrast_culltriangle( GLcontext *ctx,
 
 #define SETUP_CODE                                                     \
    struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \
-   struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D;     \
+   struct gl_texture_object *obj =                                     \
+      ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];               \
    const GLint b = obj->BaseLevel;                                     \
    const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width;           \
    const GLfloat theight = (GLfloat) obj->Image[0][b]->Height;         \
@@ -183,7 +184,8 @@ _swrast_culltriangle( GLcontext *ctx,
 
 #define SETUP_CODE                                                     \
    struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \
-   struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D;     \
+   struct gl_texture_object *obj =                                     \
+      ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];               \
    const GLint b = obj->BaseLevel;                                     \
    const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width;           \
    const GLfloat theight = (GLfloat) obj->Image[0][b]->Height;         \
@@ -264,7 +266,7 @@ affine_span(GLcontext *ctx, SWspan *span,
             struct affine_info *info)
 {
    GLchan sample[4];  /* the filtered texture sample */
-   const GLuint texEnableSave = ctx->Texture._EnabledUnits;
+   const GLuint texEnableSave = ctx->Texture._EnabledCoordUnits;
 
    /* Instead of defining a function for each mode, a test is done
     * between the outer and inner loops. This is to reduce code size
@@ -395,7 +397,7 @@ affine_span(GLcontext *ctx, SWspan *span,
    GLchan *dest = span->array->rgba[0];
 
    /* Disable tex units so they're not re-applied in swrast_write_rgba_span */
-   ctx->Texture._EnabledUnits = 0x0;
+   ctx->Texture._EnabledCoordUnits = 0x0;
 
    span->intTex[0] -= FIXED_HALF;
    span->intTex[1] -= FIXED_HALF;
@@ -502,7 +504,7 @@ affine_span(GLcontext *ctx, SWspan *span,
    _swrast_write_rgba_span(ctx, span);
 
    /* re-enable texture units */
-   ctx->Texture._EnabledUnits = texEnableSave;
+   ctx->Texture._EnabledCoordUnits = texEnableSave;
 
 #undef SPAN_NEAREST
 #undef SPAN_LINEAR
@@ -524,7 +526,8 @@ affine_span(GLcontext *ctx, SWspan *span,
 #define SETUP_CODE                                                     \
    struct affine_info info;                                            \
    struct gl_texture_unit *unit = ctx->Texture.Unit+0;                 \
-   struct gl_texture_object *obj = unit->Current2D;                    \
+   struct gl_texture_object *obj =                                     \
+      ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];               \
    const GLint b = obj->BaseLevel;                                     \
    const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width;           \
    const GLfloat theight = (GLfloat) obj->Image[0][b]->Height;         \
@@ -661,8 +664,8 @@ fast_persp_span(GLcontext *ctx, SWspan *span,
    GLfloat tex_coord[3], tex_step[3];
    GLchan *dest = span->array->rgba[0];
 
-   const GLuint savedTexEnable = ctx->Texture._EnabledUnits;
-   ctx->Texture._EnabledUnits = 0;
+   const GLuint texEnableSave = ctx->Texture._EnabledCoordUnits;
+   ctx->Texture._EnabledCoordUnits = 0;
 
    tex_coord[0] = span->attrStart[FRAG_ATTRIB_TEX0][0]  * (info->smask + 1);
    tex_step[0] = span->attrStepX[FRAG_ATTRIB_TEX0][0] * (info->smask + 1);
@@ -775,7 +778,7 @@ fast_persp_span(GLcontext *ctx, SWspan *span,
 #undef SPAN_LINEAR
 
    /* restore state */
-   ctx->Texture._EnabledUnits = savedTexEnable;
+   ctx->Texture._EnabledCoordUnits = texEnableSave;
 }
 
 
@@ -794,7 +797,8 @@ fast_persp_span(GLcontext *ctx, SWspan *span,
 #define SETUP_CODE                                                     \
    struct persp_info info;                                             \
    const struct gl_texture_unit *unit = ctx->Texture.Unit+0;           \
-   const struct gl_texture_object *obj = unit->Current2D;              \
+   struct gl_texture_object *obj =                                     \
+      ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];               \
    const GLint b = obj->BaseLevel;                                     \
    info.texture = (const GLchan *) obj->Image[0][b]->Data;             \
    info.twidth_log2 = obj->Image[0][b]->WidthLog2;                     \
@@ -1018,7 +1022,7 @@ _swrast_choose_triangle( GLcontext *ctx )
           ctx->Depth.Test &&
           ctx->Depth.Mask == GL_FALSE &&
           ctx->Depth.Func == GL_LESS &&
-          !ctx->Stencil.Enabled) {
+          !ctx->Stencil._Enabled) {
          if ((rgbmode &&
               ctx->Color.ColorMask[0] == 0 &&
               ctx->Color.ColorMask[1] == 0 &&
@@ -1050,7 +1054,8 @@ _swrast_choose_triangle( GLcontext *ctx )
          const struct gl_texture_image *texImg;
          GLenum minFilter, magFilter, envMode;
          GLint format;
-         texObj2D = ctx->Texture.Unit[0].Current2D;
+         texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];
+
          texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL;
          format = texImg ? texImg->TexFormat->MesaFormat : -1;
          minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0;
index 047f7991e645ce4a96bb60bc314530d33dff279a..c319ca62f9cfc080c708edccbb9b9ce40bd5256d 100644 (file)
@@ -75,6 +75,12 @@ typedef struct {
 } SWvertex;
 
 
+/**
+ * Fixed point data type.
+ */
+typedef int GLfixed;
+
+
 #define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0
 
 
@@ -260,12 +266,6 @@ extern void
 _swrast_eject_texture_images(GLcontext *ctx);
 
 
-#if FEATURE_MESA_program_debug
-extern void
-_swrast_get_program_register(GLcontext *, enum register_file file,
-                             GLuint index, GLfloat val[4]);
-#endif /* FEATURE_MESA_program_debug */
-
 
 /**
  * The driver interface for the software rasterizer.
index 54e24c4c44e8d8ee35acd377dc3cc97ecd74e693..e15b1348d805b22330c9f8d4b1b1320eda203f96 100644 (file)
@@ -45,46 +45,32 @@ static tnl_triangle_func tri_tab[SS_MAX_TRIFUNC];
 static tnl_quad_func     quad_tab[SS_MAX_TRIFUNC];
 
 
-static void _swsetup_render_line_tri( GLcontext *ctx,
-                                     GLuint e0, GLuint e1, GLuint e2,
-                                      GLuint facing )
+/*
+ * Render a triangle respecting edge flags.
+ */
+typedef void (* swsetup_edge_render_prim_tri)(GLcontext *ctx,
+                                              const GLubyte *ef,
+                                              GLuint e0,
+                                              GLuint e1,
+                                              GLuint e2,
+                                              const SWvertex *v0,
+                                              const SWvertex *v1,
+                                              const SWvertex *v2);
+
+/*
+ * Render a triangle using lines and respecting edge flags.
+ */
+static void
+_swsetup_edge_render_line_tri(GLcontext *ctx,
+                              const GLubyte *ef,
+                              GLuint e0,
+                              GLuint e1,
+                              GLuint e2,
+                              const SWvertex *v0,
+                              const SWvertex *v1,
+                              const SWvertex *v2)
 {
    SScontext *swsetup = SWSETUP_CONTEXT(ctx);
-   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-   GLubyte *ef = VB->EdgeFlag;
-   SWvertex *verts = swsetup->verts;
-   SWvertex *v0 = &verts[e0];
-   SWvertex *v1 = &verts[e1];
-   SWvertex *v2 = &verts[e2];
-   GLchan c[2][4];
-   GLfloat s[2][4];
-   GLfloat i[2];
-
-   /* cull testing */
-   if (ctx->Polygon.CullFlag) {
-      if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT)
-         return;
-      if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK)
-         return;
-   }
-
-   _swrast_SetFacing(ctx, facing);
-
-   if (ctx->Light.ShadeModel == GL_FLAT) {
-      COPY_CHAN4(c[0], v0->color);
-      COPY_CHAN4(c[1], v1->color);
-      COPY_4V(s[0], v0->attrib[FRAG_ATTRIB_COL1]);
-      COPY_4V(s[1], v1->attrib[FRAG_ATTRIB_COL1]);
-      i[0] = v0->attrib[FRAG_ATTRIB_CI][0];
-      i[1] = v1->attrib[FRAG_ATTRIB_CI][0];
-
-      COPY_CHAN4(v0->color, v2->color);
-      COPY_CHAN4(v1->color, v2->color);
-      COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]);
-      COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]);
-      v0->attrib[FRAG_ATTRIB_CI][0] = v2->attrib[FRAG_ATTRIB_CI][0];
-      v1->attrib[FRAG_ATTRIB_CI][0] = v2->attrib[FRAG_ATTRIB_CI][0];
-   }
 
    if (swsetup->render_prim == GL_POLYGON) {
       if (ef[e2]) _swrast_Line( ctx, v2, v0 );
@@ -95,20 +81,37 @@ static void _swsetup_render_line_tri( GLcontext *ctx,
       if (ef[e1]) _swrast_Line( ctx, v1, v2 );
       if (ef[e2]) _swrast_Line( ctx, v2, v0 );
    }
+}
 
-   if (ctx->Light.ShadeModel == GL_FLAT) {
-      COPY_CHAN4(v0->color, c[0]);
-      COPY_CHAN4(v1->color, c[1]);
-      COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], s[0]);
-      COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], s[1]);
-      v0->attrib[FRAG_ATTRIB_CI][0] = i[0];
-      v1->attrib[FRAG_ATTRIB_CI][0] = i[1];
-   }
+/*
+ * Render a triangle using points and respecting edge flags.
+ */
+static void
+_swsetup_edge_render_point_tri(GLcontext *ctx,
+                               const GLubyte *ef,
+                               GLuint e0,
+                               GLuint e1,
+                               GLuint e2,
+                               const SWvertex *v0,
+                               const SWvertex *v1,
+                               const SWvertex *v2)
+{
+   if (ef[e0]) _swrast_Point( ctx, v0 );
+   if (ef[e1]) _swrast_Point( ctx, v1 );
+   if (ef[e2]) _swrast_Point( ctx, v2 );
+
+   _swrast_flush(ctx);
 }
 
-static void _swsetup_render_point_tri( GLcontext *ctx,
-                                      GLuint e0, GLuint e1, GLuint e2,
-                                       GLuint facing )
+/*
+ * Render a triangle respecting cull and shade model.
+ */
+static void _swsetup_render_tri(GLcontext *ctx,
+                                GLuint e0,
+                                GLuint e1,
+                                GLuint e2,
+                                GLuint facing,
+                                swsetup_edge_render_prim_tri render)
 {
    SScontext *swsetup = SWSETUP_CONTEXT(ctx);
    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
@@ -117,9 +120,6 @@ static void _swsetup_render_point_tri( GLcontext *ctx,
    SWvertex *v0 = &verts[e0];
    SWvertex *v1 = &verts[e1];
    SWvertex *v2 = &verts[e2];
-   GLchan c[2][4];
-   GLfloat s[2][4];
-   GLfloat i[2];
 
    /* cull testing */
    if (ctx->Polygon.CullFlag) {
@@ -132,6 +132,10 @@ static void _swsetup_render_point_tri( GLcontext *ctx,
    _swrast_SetFacing(ctx, facing);
 
    if (ctx->Light.ShadeModel == GL_FLAT) {
+      GLchan c[2][4];
+      GLfloat s[2][4];
+      GLfloat i[2];
+
       /* save colors/indexes for v0, v1 vertices */
       COPY_CHAN4(c[0], v0->color);
       COPY_CHAN4(c[1], v1->color);
@@ -147,14 +151,9 @@ static void _swsetup_render_point_tri( GLcontext *ctx,
       COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]);
       v0->attrib[FRAG_ATTRIB_CI][0] = v2->attrib[FRAG_ATTRIB_CI][0];
       v1->attrib[FRAG_ATTRIB_CI][0] = v2->attrib[FRAG_ATTRIB_CI][0];
-   }
 
-   if (ef[e0]) _swrast_Point( ctx, v0 );
-   if (ef[e1]) _swrast_Point( ctx, v1 );
-   if (ef[e2]) _swrast_Point( ctx, v2 );
+      render(ctx, ef, e0, e1, e2, v0, v1, v2);
 
-   if (ctx->Light.ShadeModel == GL_FLAT) {
-      /* restore v0, v1 colores/indexes */
       COPY_CHAN4(v0->color, c[0]);
       COPY_CHAN4(v1->color, c[1]);
       COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], s[0]);
@@ -162,7 +161,9 @@ static void _swsetup_render_point_tri( GLcontext *ctx,
       v0->attrib[FRAG_ATTRIB_CI][0] = i[0];
       v1->attrib[FRAG_ATTRIB_CI][0] = i[1];
    }
-   _swrast_flush(ctx);
+   else {
+      render(ctx, ef, e0, e1, e2, v0, v1, v2);
+   }
 }
 
 #define SS_COLOR(a,b) UNCLAMPED_FLOAT_TO_RGBA_CHAN(a,b)
index 97d2f4a16b19d60604de2bc4d5b7294c301d4692..724b5e94fa55faebd63a083fe0624abc35ea1630 100644 (file)
@@ -171,14 +171,14 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
         v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1;
         v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2;
       }
-      _swsetup_render_point_tri( ctx, e0, e1, e2, facing );
+      _swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_point_tri);
    } else if (mode == GL_LINE) {
       if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) {
         v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0;
         v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1;
         v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2;
       }
-      _swsetup_render_line_tri( ctx, e0, e1, e2, facing );
+      _swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_line_tri);
    } else {
       if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) {
         v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0;
index f0d31fdac3558196229a5380715c6eaf7beb6f32..f69b12204611b9ee1be18eb3b56406acf2bf3eb1 100644 (file)
@@ -149,13 +149,10 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
       /* fixed-function fog */
       RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
    }
-   else if (ctx->FragmentProgram._Current) {
-      struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
-      if (fp) {
-         if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) {
-            /* fragment program needs fog coord */
-            RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
-         }
+   else if (fp) {
+      if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) {
+         /* fragment program needs fog coord */
+         RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
       }
    }
 
index 0a6ce046146e9e33cf0368a481d89836cfc70635..c19eb3df3cbc799678ffa5df476a8c2a626ef5c7 100644 (file)
@@ -50,6 +50,7 @@
 #define _T_CONTEXT_H
 
 #include "main/glheader.h"
+#include "main/bitset.h"
 #include "main/mtypes.h"
 
 #include "math/m_matrix.h"
index 14d79eab541955b55a8d4d6a120ea90fcce919b8..04fb1d8f8c2b5dc788540af3768dbd398cee22e4 100644 (file)
@@ -301,12 +301,12 @@ compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
       mInv = 0.0F;
 
    if (texUnit->TexGenEnabled & S_BIT) {
-      switch (texUnit->GenModeS) {
+      switch (texUnit->GenS.Mode) {
          case GL_OBJECT_LINEAR:
-            texcoord[0] = DOT4(vObj, texUnit->ObjectPlaneS);
+            texcoord[0] = DOT4(vObj, texUnit->GenS.ObjectPlane);
             break;
          case GL_EYE_LINEAR:
-            texcoord[0] = DOT4(vEye, texUnit->EyePlaneS);
+            texcoord[0] = DOT4(vEye, texUnit->GenS.EyePlane);
             break;
          case GL_SPHERE_MAP:
             texcoord[0] = rx * mInv + 0.5F;
@@ -324,12 +324,12 @@ compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
    }
 
    if (texUnit->TexGenEnabled & T_BIT) {
-      switch (texUnit->GenModeT) {
+      switch (texUnit->GenT.Mode) {
          case GL_OBJECT_LINEAR:
-            texcoord[1] = DOT4(vObj, texUnit->ObjectPlaneT);
+            texcoord[1] = DOT4(vObj, texUnit->GenT.ObjectPlane);
             break;
          case GL_EYE_LINEAR:
-            texcoord[1] = DOT4(vEye, texUnit->EyePlaneT);
+            texcoord[1] = DOT4(vEye, texUnit->GenT.EyePlane);
             break;
          case GL_SPHERE_MAP:
             texcoord[1] = ry * mInv + 0.5F;
@@ -347,12 +347,12 @@ compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
    }
 
    if (texUnit->TexGenEnabled & R_BIT) {
-      switch (texUnit->GenModeR) {
+      switch (texUnit->GenR.Mode) {
          case GL_OBJECT_LINEAR:
-            texcoord[2] = DOT4(vObj, texUnit->ObjectPlaneR);
+            texcoord[2] = DOT4(vObj, texUnit->GenR.ObjectPlane);
             break;
          case GL_EYE_LINEAR:
-            texcoord[2] = DOT4(vEye, texUnit->EyePlaneR);
+            texcoord[2] = DOT4(vEye, texUnit->GenR.EyePlane);
             break;
          case GL_REFLECTION_MAP:
             texcoord[2] = rz;
@@ -367,12 +367,12 @@ compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
    }
 
    if (texUnit->TexGenEnabled & Q_BIT) {
-      switch (texUnit->GenModeQ) {
+      switch (texUnit->GenQ.Mode) {
          case GL_OBJECT_LINEAR:
-            texcoord[3] = DOT4(vObj, texUnit->ObjectPlaneQ);
+            texcoord[3] = DOT4(vObj, texUnit->GenQ.ObjectPlane);
             break;
          case GL_EYE_LINEAR:
-            texcoord[3] = DOT4(vEye, texUnit->EyePlaneQ);
+            texcoord[3] = DOT4(vEye, texUnit->GenQ.EyePlane);
             break;
          default:
             _mesa_problem(ctx, "Bad Q texgen in compute_texgen()");
index 01d055c1dd8803682aa121f55da46955fd05f9e3..a52505b4b86f4d877c78e9e261fac2209b8205aa 100644 (file)
@@ -25,7 +25,9 @@
  *    Brian Paul
  */
 
+#include "main/glheader.h"
 #include "main/mtypes.h"
+#include "main/dd.h"
 #include "main/imports.h"
 #include "t_context.h"
 #include "t_pipeline.h"
index 14d3876e54713c4cac4f118366025dc9f2756781..7c1819b223cc7d6d9f100d1d507df8aff67fe153 100644 (file)
@@ -367,16 +367,16 @@ static void texgen( GLcontext *ctx,
 
    if (texUnit->TexGenEnabled & S_BIT) {
       GLuint i;
-      switch (texUnit->GenModeS) {
+      switch (texUnit->GenS.Mode) {
       case GL_OBJECT_LINEAR:
         _mesa_dotprod_tab[obj->size]( (GLfloat *)out->data,
                                       sizeof(out->data[0]), obj,
-                                      texUnit->ObjectPlaneS );
+                                      texUnit->GenS.ObjectPlane );
         break;
       case GL_EYE_LINEAR:
         _mesa_dotprod_tab[eye->size]( (GLfloat *)out->data,
                                       sizeof(out->data[0]), eye,
-                                      texUnit->EyePlaneS );
+                                      texUnit->GenS.EyePlane );
         break;
       case GL_SPHERE_MAP:
          for (i = 0; i < count; i++)
@@ -400,16 +400,16 @@ static void texgen( GLcontext *ctx,
 
    if (texUnit->TexGenEnabled & T_BIT) {
       GLuint i;
-      switch (texUnit->GenModeT) {
+      switch (texUnit->GenT.Mode) {
       case GL_OBJECT_LINEAR:
         _mesa_dotprod_tab[obj->size]( &(out->data[0][1]),
                                       sizeof(out->data[0]), obj,
-                                      texUnit->ObjectPlaneT );
+                                      texUnit->GenT.ObjectPlane );
         break;
       case GL_EYE_LINEAR:
         _mesa_dotprod_tab[eye->size]( &(out->data[0][1]),
                                       sizeof(out->data[0]), eye,
-                                      texUnit->EyePlaneT );
+                                      texUnit->GenT.EyePlane );
         break;
       case GL_SPHERE_MAP:
          for (i = 0; i < count; i++)
@@ -433,16 +433,16 @@ static void texgen( GLcontext *ctx,
 
    if (texUnit->TexGenEnabled & R_BIT) {
       GLuint i;
-      switch (texUnit->GenModeR) {
+      switch (texUnit->GenR.Mode) {
       case GL_OBJECT_LINEAR:
         _mesa_dotprod_tab[obj->size]( &(out->data[0][2]),
                                       sizeof(out->data[0]), obj,
-                                      texUnit->ObjectPlaneR );
+                                      texUnit->GenR.ObjectPlane );
         break;
       case GL_EYE_LINEAR:
         _mesa_dotprod_tab[eye->size]( &(out->data[0][2]),
                                       sizeof(out->data[0]), eye,
-                                      texUnit->EyePlaneR );
+                                      texUnit->GenR.EyePlane );
         break;
       case GL_REFLECTION_MAP_NV:
         for (i=0;i<count;i++)
@@ -461,16 +461,16 @@ static void texgen( GLcontext *ctx,
    }
 
    if (texUnit->TexGenEnabled & Q_BIT) {
-      switch (texUnit->GenModeQ) {
+      switch (texUnit->GenQ.Mode) {
       case GL_OBJECT_LINEAR:
         _mesa_dotprod_tab[obj->size]( &(out->data[0][3]),
                                       sizeof(out->data[0]), obj,
-                                      texUnit->ObjectPlaneQ );
+                                      texUnit->GenQ.ObjectPlane );
         break;
       case GL_EYE_LINEAR:
         _mesa_dotprod_tab[eye->size]( &(out->data[0][3]),
                                       sizeof(out->data[0]), eye,
-                                      texUnit->EyePlaneQ );
+                                      texUnit->GenQ.EyePlane );
         break;
       default:
         _mesa_problem(ctx, "Bad Q texgen");
index 10b78f820ea8bedfa230150679728c42e0b51eab..fe4209ae577f0491e4c6984749154d14abd6ef95 100644 (file)
@@ -535,27 +535,30 @@ void _tnl_init_vertices( GLcontext *ctx,
 
 void _tnl_free_vertices( GLcontext *ctx )
 {
-   struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
-   struct tnl_clipspace_fastpath *fp, *tmp;
+   TNLcontext *tnl = TNL_CONTEXT(ctx);
+   if (tnl) {
+      struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
+      struct tnl_clipspace_fastpath *fp, *tmp;
 
-   if (vtx->vertex_buf) {
-      ALIGN_FREE(vtx->vertex_buf);
-      vtx->vertex_buf = NULL;
-   }
-   
-   for (fp = vtx->fastpath ; fp ; fp = tmp) {
-      tmp = fp->next;
-      FREE(fp->attr);
-
-      /* KW: At the moment, fp->func is constrained to be allocated by
-       * _mesa_exec_alloc(), as the hardwired fastpaths in
-       * t_vertex_generic.c are handled specially.  It would be nice
-       * to unify them, but this probably won't change until this
-       * module gets another overhaul.
-       */
-      _mesa_exec_free((void *) fp->func);
-      FREE(fp);
+      if (vtx->vertex_buf) {
+         ALIGN_FREE(vtx->vertex_buf);
+         vtx->vertex_buf = NULL;
+      }
+
+      for (fp = vtx->fastpath ; fp ; fp = tmp) {
+         tmp = fp->next;
+         FREE(fp->attr);
+
+         /* KW: At the moment, fp->func is constrained to be allocated by
+          * _mesa_exec_alloc(), as the hardwired fastpaths in
+          * t_vertex_generic.c are handled specially.  It would be nice
+          * to unify them, but this probably won't change until this
+          * module gets another overhaul.
+          */
+         _mesa_exec_free((void *) fp->func);
+         FREE(fp);
+      }
+
+      vtx->fastpath = NULL;
    }
-   
-   vtx->fastpath = NULL;
 }
index 7be4d95af6b6c121a48331109443529b2c833fbc..735937bbe29e81d638e6b4328d39d0fab360076c 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "main/glheader.h"
 #include "main/ffvertex_prog.h"
+#include "main/dd.h"
 #include "t_vp_build.h"
 
 
index 3cedd9011904f99d6a21d2d4545c21034bc91b61..b3937c29a000596a0fcd960c2a4caad5bf704b6d 100644 (file)
@@ -188,6 +188,9 @@ void TAG(translate_vertex)(GLcontext *ctx,
 }
 
 
+/* prototype to silence warning */
+void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v );
+
 
 void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v )
 {
index 635f239acc81e8ac0b4863981fa0a3b67aa89a58..e168a89ea5e28dbd1f07389a90ba1b3bbe8e5d02 100644 (file)
@@ -57,6 +57,7 @@ void vbo_exec_init( GLcontext *ctx )
 
    ctx->Driver.NeedFlush = 0;
    ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
+   ctx->Driver.BeginVertices = vbo_exec_BeginVertices;
    ctx->Driver.FlushVertices = vbo_exec_FlushVertices;
 
    vbo_exec_invalidate_state( ctx, ~0 );
index ddbcbe11814c201027a56751f1aa1c84ec431ba1..100bb8a5decbe1c268200d8d970c3d73976659d3 100644 (file)
@@ -43,7 +43,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /* Wierd implementation stuff:
  */
-#define VBO_VERT_BUFFER_SIZE (1024*16) /* dwords == 64k */
+#define VBO_VERT_BUFFER_SIZE (1024*64) /* bytes */
 #define VBO_MAX_ATTR_CODEGEN 16 
 #define ERROR_ATTRIB 16
 
@@ -78,14 +78,15 @@ struct vbo_exec_context
 
    struct {
       struct gl_buffer_object *bufferobj;
-      GLubyte *buffer_map;
 
-      GLuint vertex_size;
+      GLuint vertex_size;       /* in dwords */
 
       struct _mesa_prim prim[VBO_MAX_PRIM];
       GLuint prim_count;
 
-      GLfloat *vbptr;               /* cursor, points into buffer */
+      GLfloat *buffer_map;
+      GLfloat *buffer_ptr;              /* cursor, points into buffer */
+      GLuint   buffer_used;             /* in bytes */
       GLfloat vertex[VBO_ATTRIB_MAX*4]; /* current vertex */
 
       GLuint vert_count;
@@ -140,6 +141,9 @@ struct vbo_exec_context
 void vbo_exec_init( GLcontext *ctx );
 void vbo_exec_destroy( GLcontext *ctx );
 void vbo_exec_invalidate_state( GLcontext *ctx, GLuint new_state );
+void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap );
+
+void vbo_exec_BeginVertices( GLcontext *ctx );
 void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags );
 
 
@@ -151,7 +155,8 @@ void vbo_exec_array_destroy( struct vbo_exec_context *exec );
 
 void vbo_exec_vtx_init( struct vbo_exec_context *exec );
 void vbo_exec_vtx_destroy( struct vbo_exec_context *exec );
-void vbo_exec_vtx_flush( struct vbo_exec_context *exec );
+void vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap );
+void vbo_exec_vtx_map( struct vbo_exec_context *exec );
 void vbo_exec_vtx_wrap( struct vbo_exec_context *exec );
 
 void vbo_exec_eval_update( struct vbo_exec_context *exec );
index 2743bf6b55cfe5cf524bc6c2adec12f2a86d5ba5..5d35ec9c1114fc3b136e7c280dff1db5ed4dad31 100644 (file)
@@ -62,7 +62,7 @@ static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec )
    if (exec->vtx.prim_count == 0) {
       exec->vtx.copied.nr = 0;
       exec->vtx.vert_count = 0;
-      exec->vtx.vbptr = (GLfloat *)exec->vtx.buffer_map;
+      exec->vtx.buffer_ptr = exec->vtx.buffer_map;
    }
    else {
       GLuint last_begin = exec->vtx.prim[exec->vtx.prim_count-1].begin;
@@ -80,7 +80,7 @@ static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec )
       /* Execute the buffer and save copied vertices.
        */
       if (exec->vtx.vert_count)
-        vbo_exec_vtx_flush( exec );
+        vbo_exec_vtx_flush( exec, GL_FALSE );
       else {
         exec->vtx.prim_count = 0;
         exec->vtx.copied.nr = 0;
@@ -121,9 +121,9 @@ void vbo_exec_vtx_wrap( struct vbo_exec_context *exec )
    assert(exec->vtx.max_vert - exec->vtx.vert_count > exec->vtx.copied.nr);
 
    for (i = 0 ; i < exec->vtx.copied.nr ; i++) {
-      _mesa_memcpy( exec->vtx.vbptr, data, 
+      _mesa_memcpy( exec->vtx.buffer_ptr, data, 
                    exec->vtx.vertex_size * sizeof(GLfloat));
-      exec->vtx.vbptr += exec->vtx.vertex_size;
+      exec->vtx.buffer_ptr += exec->vtx.vertex_size;
       data += exec->vtx.vertex_size;
       exec->vtx.vert_count++;
    }
@@ -183,8 +183,6 @@ static void vbo_exec_copy_to_current( struct vbo_exec_context *exec )
       _mesa_update_color_material(ctx, 
                                  ctx->Current.Attrib[VBO_ATTRIB_COLOR0]);
    }
-
-   ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
 }
 
 
@@ -204,8 +202,6 @@ static void vbo_exec_copy_from_current( struct vbo_exec_context *exec )
         break;
       }
    }
-
-   ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;
 }
 
 
@@ -251,9 +247,10 @@ static void vbo_exec_wrap_upgrade_vertex( struct vbo_exec_context *exec,
    exec->vtx.attrsz[attr] = newsz;
 
    exec->vtx.vertex_size += newsz - oldsz;
-   exec->vtx.max_vert = VBO_VERT_BUFFER_SIZE / exec->vtx.vertex_size;
+   exec->vtx.max_vert = ((VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) / 
+                         (exec->vtx.vertex_size * sizeof(GLfloat)));
    exec->vtx.vert_count = 0;
-   exec->vtx.vbptr = (GLfloat *)exec->vtx.buffer_map;
+   exec->vtx.buffer_ptr = exec->vtx.buffer_map;
    
 
    /* Recalculate all the attrptr[] values
@@ -279,10 +276,10 @@ static void vbo_exec_wrap_upgrade_vertex( struct vbo_exec_context *exec,
    if (exec->vtx.copied.nr)
    {
       GLfloat *data = exec->vtx.copied.buffer;
-      GLfloat *dest = exec->vtx.vbptr;
+      GLfloat *dest = exec->vtx.buffer_ptr;
       GLuint j;
 
-      assert(exec->vtx.vbptr == (GLfloat *)exec->vtx.buffer_map);
+      assert(exec->vtx.buffer_ptr == exec->vtx.buffer_map);
       
       for (i = 0 ; i < exec->vtx.copied.nr ; i++) {
         for (j = 0 ; j < VBO_ATTRIB_MAX ; j++) {
@@ -308,7 +305,7 @@ static void vbo_exec_wrap_upgrade_vertex( struct vbo_exec_context *exec,
         }
       }
 
-      exec->vtx.vbptr = dest;
+      exec->vtx.buffer_ptr = dest;
       exec->vtx.vert_count += exec->vtx.copied.nr;
       exec->vtx.copied.nr = 0;
    }
@@ -345,8 +342,6 @@ static void vbo_exec_fixup_vertex( GLcontext *ctx,
     */
    if (attr == 0) 
       exec->ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
-   else 
-      exec->ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;
 }
 
 
@@ -373,9 +368,9 @@ do {                                                                \
       GLuint i;                                                        \
                                                                \
       for (i = 0; i < exec->vtx.vertex_size; i++)              \
-        exec->vtx.vbptr[i] = exec->vtx.vertex[i];              \
+        exec->vtx.buffer_ptr[i] = exec->vtx.vertex[i];         \
                                                                \
-      exec->vtx.vbptr += exec->vtx.vertex_size;                        \
+      exec->vtx.buffer_ptr += exec->vtx.vertex_size;                   \
       exec->ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;    \
                                                                \
       if (++exec->vtx.vert_count >= exec->vtx.max_vert)                \
@@ -532,7 +527,7 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
        * begin/end pairs.
        */
       if (exec->vtx.vertex_size && !exec->vtx.attrsz[0]) 
-        vbo_exec_FlushVertices( ctx, ~0 );
+        vbo_exec_FlushVertices_internal( ctx, GL_FALSE );
 
       i = exec->vtx.prim_count++;
       exec->vtx.prim[i].mode = mode;
@@ -566,7 +561,7 @@ static void GLAPIENTRY vbo_exec_End( void )
       ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
 
       if (exec->vtx.prim_count == VBO_MAX_PRIM)
-        vbo_exec_vtx_flush( exec );    
+        vbo_exec_vtx_flush( exec, GL_FALSE );
    }
    else 
       _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" );
@@ -672,23 +667,20 @@ void vbo_use_buffer_objects(GLcontext *ctx)
     */
    GLuint bufName = 0xaabbccdd;
    GLenum target = GL_ARRAY_BUFFER_ARB;
-   GLenum access = GL_READ_WRITE_ARB;
    GLenum usage = GL_STREAM_DRAW_ARB;
-   GLsizei size = VBO_VERT_BUFFER_SIZE * sizeof(GLfloat);
+   GLsizei size = VBO_VERT_BUFFER_SIZE;
 
    /* Make sure this func is only used once */
    assert(exec->vtx.bufferobj == ctx->Array.NullBufferObj);
    if (exec->vtx.buffer_map) {
       _mesa_align_free(exec->vtx.buffer_map);
+      exec->vtx.buffer_map = NULL;
+      exec->vtx.buffer_ptr = NULL;
    }
 
    /* Allocate a real buffer object now */
    exec->vtx.bufferobj = ctx->Driver.NewBufferObject(ctx, bufName, target);
    ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj);
-
-   /* and map it */
-   exec->vtx.buffer_map
-      = ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj);
 }
 
 
@@ -708,7 +700,9 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
                                  ctx->Array.NullBufferObj);
 
    ASSERT(!exec->vtx.buffer_map);
-   exec->vtx.buffer_map = ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE * sizeof(GLfloat), 64);
+   exec->vtx.buffer_map = (GLfloat *)ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE, 64);
+   exec->vtx.buffer_ptr = exec->vtx.buffer_map;
+
    vbo_exec_vtxfmt_init( exec );
 
    /* Hook our functions into the dispatch table.
@@ -743,28 +737,58 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
       if (exec->vtx.buffer_map) {
          ALIGN_FREE(exec->vtx.buffer_map);
          exec->vtx.buffer_map = NULL;
+         exec->vtx.buffer_ptr = NULL;
       }
    }
 }
 
-
-void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags )
+void vbo_exec_BeginVertices( GLcontext *ctx )
 {
    struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
+   if (0) _mesa_printf("%s\n", __FUNCTION__);
+   vbo_exec_vtx_map( exec );
 
-   if (exec->ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END)
-      return;
+   assert((exec->ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) == 0);
+   exec->ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;
+}
 
-   if (exec->vtx.vert_count) {
-      vbo_exec_vtx_flush( exec );
+void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap )
+{
+   struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
+
+   if (exec->vtx.vert_count || unmap) {
+      vbo_exec_vtx_flush( exec, unmap );
    }
 
    if (exec->vtx.vertex_size) {
       vbo_exec_copy_to_current( exec );
       reset_attrfv( exec );
    }
+}
+
+
+
+void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags )
+{
+   struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
+
+   if (0) _mesa_printf("%s\n", __FUNCTION__);
+
+   if (exec->ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {
+      if (0) _mesa_printf("%s - inside begin/end\n", __FUNCTION__);
+      return;
+   }
+
+   vbo_exec_FlushVertices_internal( ctx, GL_TRUE );
+
+   /* Need to do this to ensure BeginVertices gets called again:
+    */
+   if (exec->ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) {
+      _mesa_restore_exec_vtxfmt( ctx );
+      exec->ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
+   }
 
-   exec->ctx->Driver.NeedFlush = 0;
+   exec->ctx->Driver.NeedFlush &= ~flags;
 }
 
 
index 8871e10cf60d4135763f5285f6daed75f9184ca7..0d4cbe9a1e58282dee5bd2973e2fb92fc616d0b3 100644 (file)
@@ -31,6 +31,7 @@
 #include "main/api_validate.h"
 #include "main/api_noop.h"
 #include "main/varray.h"
+#include "main/bufferobj.h"
 #include "glapi/dispatch.h"
 
 #include "vbo_context.h"
@@ -94,32 +95,33 @@ static void bind_array_obj( GLcontext *ctx )
 {
    struct vbo_context *vbo = vbo_context(ctx);
    struct vbo_exec_context *exec = &vbo->exec;
+   struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
    GLuint i;
 
    /* TODO: Fix the ArrayObj struct to keep legacy arrays in an array
     * rather than as individual named arrays.  Then this function can
     * go away.
     */
-   exec->array.legacy_array[VERT_ATTRIB_POS] = &ctx->Array.ArrayObj->Vertex;
+   exec->array.legacy_array[VERT_ATTRIB_POS] = &arrayObj->Vertex;
    exec->array.legacy_array[VERT_ATTRIB_WEIGHT] = &vbo->legacy_currval[VERT_ATTRIB_WEIGHT];
-   exec->array.legacy_array[VERT_ATTRIB_NORMAL] = &ctx->Array.ArrayObj->Normal;
-   exec->array.legacy_array[VERT_ATTRIB_COLOR0] = &ctx->Array.ArrayObj->Color;
-   exec->array.legacy_array[VERT_ATTRIB_COLOR1] = &ctx->Array.ArrayObj->SecondaryColor;
-   exec->array.legacy_array[VERT_ATTRIB_FOG] = &ctx->Array.ArrayObj->FogCoord;
-   exec->array.legacy_array[VERT_ATTRIB_COLOR_INDEX] = &ctx->Array.ArrayObj->Index;
-   if (ctx->Array.ArrayObj->PointSize.Enabled) {
+   exec->array.legacy_array[VERT_ATTRIB_NORMAL] = &arrayObj->Normal;
+   exec->array.legacy_array[VERT_ATTRIB_COLOR0] = &arrayObj->Color;
+   exec->array.legacy_array[VERT_ATTRIB_COLOR1] = &arrayObj->SecondaryColor;
+   exec->array.legacy_array[VERT_ATTRIB_FOG] = &arrayObj->FogCoord;
+   exec->array.legacy_array[VERT_ATTRIB_COLOR_INDEX] = &arrayObj->Index;
+   if (arrayObj->PointSize.Enabled) {
       /* this aliases COLOR_INDEX */
-      exec->array.legacy_array[VERT_ATTRIB_POINT_SIZE] = &ctx->Array.ArrayObj->PointSize;
+      exec->array.legacy_array[VERT_ATTRIB_POINT_SIZE] = &arrayObj->PointSize;
    }
-   exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &ctx->Array.ArrayObj->EdgeFlag;
+   exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &arrayObj->EdgeFlag;
 
    for (i = 0; i < 8; i++)
-      exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &ctx->Array.ArrayObj->TexCoord[i];
+      exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &arrayObj->TexCoord[i];
 
    for (i = 0; i < VERT_ATTRIB_MAX; i++)
-      exec->array.generic_array[i] = &ctx->Array.ArrayObj->VertexAttrib[i];
+      exec->array.generic_array[i] = &arrayObj->VertexAttrib[i];
    
-   exec->array.array_obj = ctx->Array.ArrayObj->Name;
+   exec->array.array_obj = arrayObj->Name;
 }
 
 static void recalculate_input_bindings( GLcontext *ctx )
@@ -291,6 +293,47 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
    prim[0].indexed = 0;
 
    vbo->draw_prims( ctx, exec->array.inputs, prim, 1, NULL, start, start + count - 1 );
+
+#if 0
+   {
+      int i;
+
+      _mesa_printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n",
+                   mode, start, count);
+
+      for (i = 0; i < 32; i++) {
+         GLuint bufName = exec->array.inputs[i]->BufferObj->Name;
+         GLint stride = exec->array.inputs[i]->Stride;
+         _mesa_printf("attr %2d: size %d stride %d  enabled %d  "
+                      "ptr %p  Bufobj %u\n",
+                      i,
+                      exec->array.inputs[i]->Size,
+                      stride,
+                      /*exec->array.inputs[i]->Enabled,*/
+                      exec->array.legacy_array[i]->Enabled,
+                      exec->array.inputs[i]->Ptr,
+                      bufName);
+         
+         if (bufName) {
+            struct gl_buffer_object *buf = _mesa_lookup_bufferobj(ctx, bufName);
+            GLubyte *p = ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB,
+                                            GL_READ_ONLY_ARB, buf);
+            int offset = (int) exec->array.inputs[i]->Ptr;
+            float *f = (float *) (p + offset);
+            int *k = (int *) f;
+            int i;
+            int n = (count * stride) / 4;
+            if (n > 32)
+               n = 32;
+            _mesa_printf("  Data at offset %d:\n", offset);
+            for (i = 0; i < n; i++) {
+               _mesa_printf("    float[%d] = 0x%08x %f\n", i, k[i], f[i]);
+            }
+            ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, buf);
+         }
+      }
+   }
+#endif
 }
 
 
index 45133fa4f3201e446e7b39aa64877e31a14212f1..5381cc4d92a8fa58441532641e7d42e20301e4fc 100644 (file)
@@ -70,7 +70,7 @@ static GLuint vbo_copy_vertices( struct vbo_exec_context *exec )
    GLuint ovf, i;
    GLuint sz = exec->vtx.vertex_size;
    GLfloat *dst = exec->vtx.copied.buffer;
-   GLfloat *src = ((GLfloat *)exec->vtx.buffer_map + 
+   GLfloat *src = (exec->vtx.buffer_map + 
                   exec->vtx.prim[exec->vtx.prim_count-1].start * 
                   exec->vtx.vertex_size);
 
@@ -147,7 +147,7 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
    struct vbo_exec_context *exec = &vbo->exec;
    struct gl_client_array *arrays = exec->vtx.arrays;
    GLuint count = exec->vtx.vert_count;
-   GLubyte *data = exec->vtx.buffer_map;
+   GLubyte *data = (GLubyte *)exec->vtx.buffer_map;
    const GLuint *map;
    GLuint attr;
    GLbitfield varying_inputs = 0x0;
@@ -204,7 +204,7 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
 
          if (exec->vtx.bufferobj->Name) {
             /* a real buffer obj: Ptr is an offset, not a pointer*/
-            int offset;
+            GLsizeiptr offset;
             assert(exec->vtx.bufferobj->Pointer);  /* buf should be mapped */
             offset = (GLbyte *) data - (GLbyte *) exec->vtx.bufferobj->Pointer;
             assert(offset >= 0);
@@ -234,10 +234,91 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
 }
 
 
+static void vbo_exec_vtx_unmap( struct vbo_exec_context *exec )
+{
+   GLenum target = GL_ARRAY_BUFFER_ARB;
+
+   if (exec->vtx.bufferobj->Name) {
+      GLcontext *ctx = exec->ctx;
+      
+      if(ctx->Driver.FlushMappedBufferRange) {
+         GLintptr offset = exec->vtx.buffer_used - exec->vtx.bufferobj->Offset;
+         GLsizeiptr length = (exec->vtx.buffer_ptr - exec->vtx.buffer_map) * sizeof(float);
+
+         if(length)
+            ctx->Driver.FlushMappedBufferRange(ctx, target,
+                                               offset, length,
+                                               exec->vtx.bufferobj);
+      }
+
+      exec->vtx.buffer_used += (exec->vtx.buffer_ptr -
+                                exec->vtx.buffer_map) * sizeof(float);
+
+      assert(exec->vtx.buffer_used <= VBO_VERT_BUFFER_SIZE);
+      assert(exec->vtx.buffer_ptr != NULL);
+      
+      ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj);
+      exec->vtx.buffer_map = NULL;
+      exec->vtx.buffer_ptr = NULL;
+      exec->vtx.max_vert = 0;
+   }
+}
+
+void vbo_exec_vtx_map( struct vbo_exec_context *exec )
+{
+   GLcontext *ctx = exec->ctx;
+   GLenum target = GL_ARRAY_BUFFER_ARB;
+   GLenum access = GL_READ_WRITE_ARB;
+   GLenum usage = GL_STREAM_DRAW_ARB;
+   
+   if (exec->vtx.bufferobj->Name == 0)
+      return;
+
+   if (exec->vtx.buffer_map != NULL) {
+      assert(0);
+      exec->vtx.buffer_map = NULL;
+      exec->vtx.buffer_ptr = NULL;
+   }
+
+   if (VBO_VERT_BUFFER_SIZE > exec->vtx.buffer_used + 1024 &&
+       ctx->Driver.MapBufferRange)
+   {
+      exec->vtx.buffer_map = 
+         (GLfloat *)ctx->Driver.MapBufferRange(ctx, 
+                                               target, 
+                                               exec->vtx.buffer_used,
+                                               (VBO_VERT_BUFFER_SIZE - 
+                                                exec->vtx.buffer_used),
+                                               (GL_MAP_WRITE_BIT |
+                                                GL_MAP_INVALIDATE_RANGE_BIT | 
+                                                GL_MAP_UNSYNCHRONIZED_BIT | 
+                                                MESA_MAP_NOWAIT_BIT),
+                                               exec->vtx.bufferobj);
+      exec->vtx.buffer_ptr = exec->vtx.buffer_map;
+   }
+   
+   if (!exec->vtx.buffer_map) {
+      exec->vtx.buffer_used = 0;
+
+      ctx->Driver.BufferData(ctx, target, 
+                             VBO_VERT_BUFFER_SIZE, 
+                             NULL, usage, exec->vtx.bufferobj);
+
+      exec->vtx.buffer_map = 
+         (GLfloat *)ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj);
+      exec->vtx.buffer_ptr = exec->vtx.buffer_map;
+   }
+
+   if (0) _mesa_printf("map %d..\n", exec->vtx.buffer_used);
+}
+
+
+
 /**
  * Execute the buffer and save copied verts.
  */
-void vbo_exec_vtx_flush( struct vbo_exec_context *exec )
+void vbo_exec_vtx_flush( struct vbo_exec_context *exec,
+                         GLboolean unmap )
 {
    if (0)
       vbo_exec_debug_verts( exec );
@@ -250,25 +331,22 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec )
 
       if (exec->vtx.copied.nr != exec->vtx.vert_count) {
         GLcontext *ctx = exec->ctx;
-
-        GLenum target = GL_ARRAY_BUFFER_ARB;
-        GLenum access = GL_READ_WRITE_ARB;
-        GLenum usage = GL_STREAM_DRAW_ARB;
-        GLsizei size = VBO_VERT_BUFFER_SIZE * sizeof(GLfloat);
         
-        /* Before the unmap (why?)
+        /* Before the update_state() as this may raise _NEW_ARRAY
+          * from _mesa_set_varying_vp_inputs().
          */
         vbo_exec_bind_arrays( ctx );
 
          if (ctx->NewState)
             _mesa_update_state( ctx );
 
-         /* if using a real VBO, unmap it before drawing */
          if (exec->vtx.bufferobj->Name) {
-            ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj);
-            exec->vtx.buffer_map = NULL;
+            vbo_exec_vtx_unmap( exec );
          }
 
+         if (0) _mesa_printf("%s %d %d\n", __FUNCTION__, exec->vtx.prim_count,
+                      exec->vtx.vert_count);
+
         vbo_context(ctx)->draw_prims( ctx, 
                                       exec->vtx.inputs, 
                                       exec->vtx.prim, 
@@ -277,16 +355,31 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec )
                                       0,
                                       exec->vtx.vert_count - 1);
 
-        /* If using a real VBO, get new storage */
-         if (exec->vtx.bufferobj->Name) {
-            ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj);
-            exec->vtx.buffer_map = 
-               ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj);
-         }
+        /* If using a real VBO, get new storage -- unless asked not to.
+          */
+         if (exec->vtx.bufferobj->Name && !unmap) {
+            vbo_exec_vtx_map( exec );
+          }
       }
    }
 
+   /* May have to unmap explicitly if we didn't draw:
+    */
+   if (unmap && 
+       exec->vtx.bufferobj->Name &&
+       exec->vtx.buffer_map) {
+      vbo_exec_vtx_unmap( exec );
+   }
+
+
+   if (unmap) 
+      exec->vtx.max_vert = 0;
+   else
+      exec->vtx.max_vert = ((VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) / 
+                            (exec->vtx.vertex_size * sizeof(GLfloat)));
+
+
+   exec->vtx.buffer_ptr = exec->vtx.buffer_map;
    exec->vtx.prim_count = 0;
    exec->vtx.vert_count = 0;
-   exec->vtx.vbptr = (GLfloat *)exec->vtx.buffer_map;
 }
index 7dda54af48b0321a0a7ffd1f18ee81aa1353908e..9558f83883758571988c8678fb419a19c2422d28 100644 (file)
@@ -130,7 +130,7 @@ struct vbo_save_context {
    struct vbo_save_vertex_store *vertex_store;
    struct vbo_save_primitive_store *prim_store;
 
-   GLfloat *vbptr;                /* cursor, points into buffer */
+   GLfloat *buffer_ptr;                   /* cursor, points into buffer */
    GLfloat vertex[VBO_ATTRIB_MAX*4];      /* current values */
    GLfloat *attrptr[VBO_ATTRIB_MAX];
    GLuint vert_count;
index ddfd27657748b20f621cd029a961aa05e448b6c8..52b6f1884ee9abba2e642c38efb3c91f9566ff03 100644 (file)
@@ -241,7 +241,7 @@ static void _save_reset_counters( GLcontext *ctx )
    save->buffer = (save->vertex_store->buffer + 
                   save->vertex_store->used);
 
-   assert(save->buffer == save->vbptr);
+   assert(save->buffer == save->buffer_ptr);
 
    if (save->vertex_size)
       save->max_vert = ((VBO_SAVE_BUFFER_SIZE - save->vertex_store->used) / 
@@ -343,7 +343,7 @@ static void _save_compile_vertex_list( GLcontext *ctx )
       /* Allocate and map new store:
        */
       save->vertex_store = alloc_vertex_store( ctx );
-      save->vbptr = map_vertex_store( ctx, save->vertex_store );
+      save->buffer_ptr = map_vertex_store( ctx, save->vertex_store );
    } 
 
    if (save->prim_store->used > VBO_SAVE_PRIM_SIZE - 6) {
@@ -414,9 +414,9 @@ static void _save_wrap_filled_vertex( GLcontext *ctx )
    assert(save->max_vert - save->vert_count > save->copied.nr);
 
    for (i = 0 ; i < save->copied.nr ; i++) {
-      _mesa_memcpy( save->vbptr, data, save->vertex_size * sizeof(GLfloat));
+      _mesa_memcpy( save->buffer_ptr, data, save->vertex_size * sizeof(GLfloat));
       data += save->vertex_size;
-      save->vbptr += save->vertex_size;
+      save->buffer_ptr += save->vertex_size;
       save->vert_count++;
    }
 }
@@ -550,7 +550,7 @@ static void _save_upgrade_vertex( GLcontext *ctx,
         }
       }
 
-      save->vbptr = dest;
+      save->buffer_ptr = dest;
       save->vert_count += save->copied.nr;
    }
 }
@@ -622,9 +622,9 @@ do {                                                                \
       GLuint i;                                                        \
                                                                \
       for (i = 0; i < save->vertex_size; i++)                  \
-        save->vbptr[i] = save->vertex[i];                      \
+        save->buffer_ptr[i] = save->vertex[i];                 \
                                                                \
-      save->vbptr += save->vertex_size;                                \
+      save->buffer_ptr += save->vertex_size;                           \
                                                                \
       if (++save->vert_count >= save->max_vert)                        \
         _save_wrap_filled_vertex( ctx );                       \
@@ -1035,7 +1035,7 @@ void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode )
    if (!save->vertex_store) 
       save->vertex_store = alloc_vertex_store( ctx );
       
-   save->vbptr = map_vertex_store( ctx, save->vertex_store );
+   save->buffer_ptr = map_vertex_store( ctx, save->vertex_store );
    
    _save_reset_vertex( ctx );
    _save_reset_counters( ctx );  
index 617c5a77baf28b3e09d08d40b7f13f5ab233e7e0..f59e1036d019a0eb0da45a211dfd056ae38701c9 100644 (file)
@@ -115,7 +115,7 @@ static void vbo_bind_vertex_list( GLcontext *ctx,
    struct vbo_context *vbo = vbo_context(ctx);
    struct vbo_save_context *save = &vbo->save;
    struct gl_client_array *arrays = save->arrays;
-   GLuint data = node->buffer_offset;
+   GLuint buffer_offset = node->buffer_offset;
    const GLuint *map;
    GLuint attr;
    GLubyte node_attrsz[VBO_ATTRIB_MAX];  /* copy of node->attrsz[] */
@@ -170,7 +170,7 @@ static void vbo_bind_vertex_list( GLcontext *ctx,
          /* override the default array set above */
          save->inputs[attr] = &arrays[attr];
 
-        arrays[attr].Ptr = (const GLubyte *) data;
+        arrays[attr].Ptr = (const GLubyte *) NULL + buffer_offset;
         arrays[attr].Size = node->attrsz[src];
         arrays[attr].StrideB = node->vertex_size * sizeof(GLfloat);
         arrays[attr].Stride = node->vertex_size * sizeof(GLfloat);
@@ -184,7 +184,7 @@ static void vbo_bind_vertex_list( GLcontext *ctx,
         
         assert(arrays[attr].BufferObj->Name);
 
-        data += node->attrsz[src] * sizeof(GLfloat);
+        buffer_offset += node->attrsz[src] * sizeof(GLfloat);
          varying_inputs |= 1<<attr;
       }
    }
index 1eb4358b1c278a5ead748a8ad08647dae6b22a71..fe05549c1d5797386cd3d7cc053f399c8d20b9ef 100644 (file)
@@ -27044,13 +27044,161 @@ GL_PREFIX(VertexAttribs4ubvNV):
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs4ubvNV), .-GL_PREFIX(VertexAttribs4ubvNV)
 
+       .p2align        4,,15
+       .globl  GL_PREFIX(GetTexBumpParameterfvATI)
+       .type   GL_PREFIX(GetTexBumpParameterfvATI), @function
+GL_PREFIX(GetTexBumpParameterfvATI):
+#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(GetTexBumpParameterfvATI), .-GL_PREFIX(GetTexBumpParameterfvATI)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(GetTexBumpParameterivATI)
+       .type   GL_PREFIX(GetTexBumpParameterivATI), @function
+GL_PREFIX(GetTexBumpParameterivATI):
+#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(GetTexBumpParameterivATI), .-GL_PREFIX(GetTexBumpParameterivATI)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(TexBumpParameterfvATI)
+       .type   GL_PREFIX(TexBumpParameterfvATI), @function
+GL_PREFIX(TexBumpParameterfvATI):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    5760(%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    5760(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    5760(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    5760(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(TexBumpParameterfvATI), .-GL_PREFIX(TexBumpParameterfvATI)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(TexBumpParameterivATI)
+       .type   GL_PREFIX(TexBumpParameterivATI), @function
+GL_PREFIX(TexBumpParameterivATI):
+#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(TexBumpParameterivATI), .-GL_PREFIX(TexBumpParameterivATI)
+
        .p2align        4,,15
        .globl  GL_PREFIX(AlphaFragmentOp1ATI)
        .type   GL_PREFIX(AlphaFragmentOp1ATI), @function
 GL_PREFIX(AlphaFragmentOp1ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5744(%rax), %r11
+       movq    5776(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27068,13 +27216,13 @@ GL_PREFIX(AlphaFragmentOp1ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5744(%rax), %r11
+       movq    5776(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5744(%rax), %r11
+       movq    5776(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27092,7 +27240,7 @@ GL_PREFIX(AlphaFragmentOp1ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5744(%rax), %r11
+       movq    5776(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(AlphaFragmentOp1ATI), .-GL_PREFIX(AlphaFragmentOp1ATI)
@@ -27103,7 +27251,7 @@ GL_PREFIX(AlphaFragmentOp1ATI):
 GL_PREFIX(AlphaFragmentOp2ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5752(%rax), %r11
+       movq    5784(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27121,13 +27269,13 @@ GL_PREFIX(AlphaFragmentOp2ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5752(%rax), %r11
+       movq    5784(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5752(%rax), %r11
+       movq    5784(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27145,7 +27293,7 @@ GL_PREFIX(AlphaFragmentOp2ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5752(%rax), %r11
+       movq    5784(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(AlphaFragmentOp2ATI), .-GL_PREFIX(AlphaFragmentOp2ATI)
@@ -27156,7 +27304,7 @@ GL_PREFIX(AlphaFragmentOp2ATI):
 GL_PREFIX(AlphaFragmentOp3ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5760(%rax), %r11
+       movq    5792(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27174,13 +27322,13 @@ GL_PREFIX(AlphaFragmentOp3ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5760(%rax), %r11
+       movq    5792(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5760(%rax), %r11
+       movq    5792(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27198,7 +27346,7 @@ GL_PREFIX(AlphaFragmentOp3ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5760(%rax), %r11
+       movq    5792(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(AlphaFragmentOp3ATI), .-GL_PREFIX(AlphaFragmentOp3ATI)
@@ -27209,25 +27357,25 @@ GL_PREFIX(AlphaFragmentOp3ATI):
 GL_PREFIX(BeginFragmentShaderATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5768(%rax), %r11
+       movq    5800(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       movq    5768(%rax), %r11
+       movq    5800(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5768(%rax), %r11
+       movq    5800(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       movq    5768(%rax), %r11
+       movq    5800(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(BeginFragmentShaderATI), .-GL_PREFIX(BeginFragmentShaderATI)
@@ -27238,25 +27386,25 @@ GL_PREFIX(BeginFragmentShaderATI):
 GL_PREFIX(BindFragmentShaderATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5776(%rax), %r11
+       movq    5808(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5776(%rax), %r11
+       movq    5808(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5776(%rax), %r11
+       movq    5808(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5776(%rax), %r11
+       movq    5808(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(BindFragmentShaderATI), .-GL_PREFIX(BindFragmentShaderATI)
@@ -27267,7 +27415,7 @@ GL_PREFIX(BindFragmentShaderATI):
 GL_PREFIX(ColorFragmentOp1ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5784(%rax), %r11
+       movq    5816(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27285,13 +27433,13 @@ GL_PREFIX(ColorFragmentOp1ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5784(%rax), %r11
+       movq    5816(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5784(%rax), %r11
+       movq    5816(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27309,7 +27457,7 @@ GL_PREFIX(ColorFragmentOp1ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5784(%rax), %r11
+       movq    5816(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ColorFragmentOp1ATI), .-GL_PREFIX(ColorFragmentOp1ATI)
@@ -27320,7 +27468,7 @@ GL_PREFIX(ColorFragmentOp1ATI):
 GL_PREFIX(ColorFragmentOp2ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5792(%rax), %r11
+       movq    5824(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27338,13 +27486,13 @@ GL_PREFIX(ColorFragmentOp2ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5792(%rax), %r11
+       movq    5824(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5792(%rax), %r11
+       movq    5824(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27362,7 +27510,7 @@ GL_PREFIX(ColorFragmentOp2ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5792(%rax), %r11
+       movq    5824(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ColorFragmentOp2ATI), .-GL_PREFIX(ColorFragmentOp2ATI)
@@ -27373,7 +27521,7 @@ GL_PREFIX(ColorFragmentOp2ATI):
 GL_PREFIX(ColorFragmentOp3ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5800(%rax), %r11
+       movq    5832(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27391,13 +27539,13 @@ GL_PREFIX(ColorFragmentOp3ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5800(%rax), %r11
+       movq    5832(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5800(%rax), %r11
+       movq    5832(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27415,7 +27563,7 @@ GL_PREFIX(ColorFragmentOp3ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5800(%rax), %r11
+       movq    5832(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ColorFragmentOp3ATI), .-GL_PREFIX(ColorFragmentOp3ATI)
@@ -27426,25 +27574,25 @@ GL_PREFIX(ColorFragmentOp3ATI):
 GL_PREFIX(DeleteFragmentShaderATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5808(%rax), %r11
+       movq    5840(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5808(%rax), %r11
+       movq    5840(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5808(%rax), %r11
+       movq    5840(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5808(%rax), %r11
+       movq    5840(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(DeleteFragmentShaderATI), .-GL_PREFIX(DeleteFragmentShaderATI)
@@ -27455,25 +27603,25 @@ GL_PREFIX(DeleteFragmentShaderATI):
 GL_PREFIX(EndFragmentShaderATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5816(%rax), %r11
+       movq    5848(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       movq    5816(%rax), %r11
+       movq    5848(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5816(%rax), %r11
+       movq    5848(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       movq    5816(%rax), %r11
+       movq    5848(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(EndFragmentShaderATI), .-GL_PREFIX(EndFragmentShaderATI)
@@ -27484,25 +27632,25 @@ GL_PREFIX(EndFragmentShaderATI):
 GL_PREFIX(GenFragmentShadersATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5824(%rax), %r11
+       movq    5856(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5824(%rax), %r11
+       movq    5856(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5824(%rax), %r11
+       movq    5856(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5824(%rax), %r11
+       movq    5856(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GenFragmentShadersATI), .-GL_PREFIX(GenFragmentShadersATI)
@@ -27513,7 +27661,7 @@ GL_PREFIX(GenFragmentShadersATI):
 GL_PREFIX(PassTexCoordATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5832(%rax), %r11
+       movq    5864(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27523,13 +27671,13 @@ GL_PREFIX(PassTexCoordATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5832(%rax), %r11
+       movq    5864(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5832(%rax), %r11
+       movq    5864(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27539,7 +27687,7 @@ GL_PREFIX(PassTexCoordATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5832(%rax), %r11
+       movq    5864(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(PassTexCoordATI), .-GL_PREFIX(PassTexCoordATI)
@@ -27550,7 +27698,7 @@ GL_PREFIX(PassTexCoordATI):
 GL_PREFIX(SampleMapATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5840(%rax), %r11
+       movq    5872(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27560,13 +27708,13 @@ GL_PREFIX(SampleMapATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5840(%rax), %r11
+       movq    5872(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5840(%rax), %r11
+       movq    5872(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27576,7 +27724,7 @@ GL_PREFIX(SampleMapATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5840(%rax), %r11
+       movq    5872(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SampleMapATI), .-GL_PREFIX(SampleMapATI)
@@ -27587,7 +27735,7 @@ GL_PREFIX(SampleMapATI):
 GL_PREFIX(SetFragmentShaderConstantATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5848(%rax), %r11
+       movq    5880(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27597,13 +27745,13 @@ GL_PREFIX(SetFragmentShaderConstantATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5848(%rax), %r11
+       movq    5880(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5848(%rax), %r11
+       movq    5880(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27613,7 +27761,7 @@ GL_PREFIX(SetFragmentShaderConstantATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5848(%rax), %r11
+       movq    5880(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SetFragmentShaderConstantATI), .-GL_PREFIX(SetFragmentShaderConstantATI)
@@ -27624,7 +27772,7 @@ GL_PREFIX(SetFragmentShaderConstantATI):
 GL_PREFIX(PointParameteriNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5856(%rax), %r11
+       movq    5888(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27634,13 +27782,13 @@ GL_PREFIX(PointParameteriNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5856(%rax), %r11
+       movq    5888(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5856(%rax), %r11
+       movq    5888(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27650,7 +27798,7 @@ GL_PREFIX(PointParameteriNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5856(%rax), %r11
+       movq    5888(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(PointParameteriNV), .-GL_PREFIX(PointParameteriNV)
@@ -27661,7 +27809,7 @@ GL_PREFIX(PointParameteriNV):
 GL_PREFIX(PointParameterivNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5864(%rax), %r11
+       movq    5896(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27671,13 +27819,13 @@ GL_PREFIX(PointParameterivNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5864(%rax), %r11
+       movq    5896(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5864(%rax), %r11
+       movq    5896(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27687,79 +27835,79 @@ GL_PREFIX(PointParameterivNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5864(%rax), %r11
+       movq    5896(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(PointParameterivNV), .-GL_PREFIX(PointParameterivNV)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_734)
-       .type   GL_PREFIX(_dispatch_stub_734), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_734))
-GL_PREFIX(_dispatch_stub_734):
+       .globl  GL_PREFIX(_dispatch_stub_738)
+       .type   GL_PREFIX(_dispatch_stub_738), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_738))
+GL_PREFIX(_dispatch_stub_738):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5872(%rax), %r11
+       movq    5904(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5872(%rax), %r11
+       movq    5904(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5872(%rax), %r11
+       movq    5904(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5872(%rax), %r11
+       movq    5904(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_734), .-GL_PREFIX(_dispatch_stub_734)
+       .size   GL_PREFIX(_dispatch_stub_738), .-GL_PREFIX(_dispatch_stub_738)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_735)
-       .type   GL_PREFIX(_dispatch_stub_735), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_735))
-GL_PREFIX(_dispatch_stub_735):
+       .globl  GL_PREFIX(_dispatch_stub_739)
+       .type   GL_PREFIX(_dispatch_stub_739), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_739))
+GL_PREFIX(_dispatch_stub_739):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5880(%rax), %r11
+       movq    5912(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5880(%rax), %r11
+       movq    5912(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5880(%rax), %r11
+       movq    5912(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5880(%rax), %r11
+       movq    5912(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_735), .-GL_PREFIX(_dispatch_stub_735)
+       .size   GL_PREFIX(_dispatch_stub_739), .-GL_PREFIX(_dispatch_stub_739)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_736)
-       .type   GL_PREFIX(_dispatch_stub_736), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_736))
-GL_PREFIX(_dispatch_stub_736):
+       .globl  GL_PREFIX(_dispatch_stub_740)
+       .type   GL_PREFIX(_dispatch_stub_740), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_740))
+GL_PREFIX(_dispatch_stub_740):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5888(%rax), %r11
+       movq    5920(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27769,13 +27917,13 @@ GL_PREFIX(_dispatch_stub_736):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5888(%rax), %r11
+       movq    5920(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5888(%rax), %r11
+       movq    5920(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27785,19 +27933,19 @@ GL_PREFIX(_dispatch_stub_736):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5888(%rax), %r11
+       movq    5920(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_736), .-GL_PREFIX(_dispatch_stub_736)
+       .size   GL_PREFIX(_dispatch_stub_740), .-GL_PREFIX(_dispatch_stub_740)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_737)
-       .type   GL_PREFIX(_dispatch_stub_737), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_737))
-GL_PREFIX(_dispatch_stub_737):
+       .globl  GL_PREFIX(_dispatch_stub_741)
+       .type   GL_PREFIX(_dispatch_stub_741), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_741))
+GL_PREFIX(_dispatch_stub_741):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5896(%rax), %r11
+       movq    5928(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27807,13 +27955,13 @@ GL_PREFIX(_dispatch_stub_737):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5896(%rax), %r11
+       movq    5928(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5896(%rax), %r11
+       movq    5928(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27823,40 +27971,40 @@ GL_PREFIX(_dispatch_stub_737):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5896(%rax), %r11
+       movq    5928(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_737), .-GL_PREFIX(_dispatch_stub_737)
+       .size   GL_PREFIX(_dispatch_stub_741), .-GL_PREFIX(_dispatch_stub_741)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_738)
-       .type   GL_PREFIX(_dispatch_stub_738), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_738))
-GL_PREFIX(_dispatch_stub_738):
+       .globl  GL_PREFIX(_dispatch_stub_742)
+       .type   GL_PREFIX(_dispatch_stub_742), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_742))
+GL_PREFIX(_dispatch_stub_742):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5904(%rax), %r11
+       movq    5936(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5904(%rax), %r11
+       movq    5936(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5904(%rax), %r11
+       movq    5936(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5904(%rax), %r11
+       movq    5936(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_738), .-GL_PREFIX(_dispatch_stub_738)
+       .size   GL_PREFIX(_dispatch_stub_742), .-GL_PREFIX(_dispatch_stub_742)
 
        .p2align        4,,15
        .globl  GL_PREFIX(GetProgramNamedParameterdvNV)
@@ -27864,7 +28012,7 @@ GL_PREFIX(_dispatch_stub_738):
 GL_PREFIX(GetProgramNamedParameterdvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5912(%rax), %r11
+       movq    5944(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27878,13 +28026,13 @@ GL_PREFIX(GetProgramNamedParameterdvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5912(%rax), %r11
+       movq    5944(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5912(%rax), %r11
+       movq    5944(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27898,7 +28046,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5912(%rax), %r11
+       movq    5944(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetProgramNamedParameterdvNV), .-GL_PREFIX(GetProgramNamedParameterdvNV)
@@ -27909,7 +28057,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV):
 GL_PREFIX(GetProgramNamedParameterfvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5920(%rax), %r11
+       movq    5952(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27923,13 +28071,13 @@ GL_PREFIX(GetProgramNamedParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5920(%rax), %r11
+       movq    5952(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5920(%rax), %r11
+       movq    5952(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27943,7 +28091,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5920(%rax), %r11
+       movq    5952(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetProgramNamedParameterfvNV), .-GL_PREFIX(GetProgramNamedParameterfvNV)
@@ -27954,7 +28102,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV):
 GL_PREFIX(ProgramNamedParameter4dNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5928(%rax), %r11
+       movq    5960(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $56, %rsp
@@ -27974,13 +28122,13 @@ GL_PREFIX(ProgramNamedParameter4dNV):
        movq    8(%rsp), %rsi
        movq    (%rsp), %rdi
        addq    $56, %rsp
-       movq    5928(%rax), %r11
+       movq    5960(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5928(%rax), %r11
+       movq    5960(%rax), %r11
        jmp     *%r11
 1:
        subq    $56, %rsp
@@ -28000,7 +28148,7 @@ GL_PREFIX(ProgramNamedParameter4dNV):
        movq    8(%rsp), %rsi
        movq    (%rsp), %rdi
        addq    $56, %rsp
-       movq    5928(%rax), %r11
+       movq    5960(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ProgramNamedParameter4dNV), .-GL_PREFIX(ProgramNamedParameter4dNV)
@@ -28011,7 +28159,7 @@ GL_PREFIX(ProgramNamedParameter4dNV):
 GL_PREFIX(ProgramNamedParameter4dvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5936(%rax), %r11
+       movq    5968(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28025,13 +28173,13 @@ GL_PREFIX(ProgramNamedParameter4dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5936(%rax), %r11
+       movq    5968(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5936(%rax), %r11
+       movq    5968(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28045,7 +28193,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5936(%rax), %r11
+       movq    5968(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ProgramNamedParameter4dvNV), .-GL_PREFIX(ProgramNamedParameter4dvNV)
@@ -28056,7 +28204,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV):
 GL_PREFIX(ProgramNamedParameter4fNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5944(%rax), %r11
+       movq    5976(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $56, %rsp
@@ -28076,13 +28224,13 @@ GL_PREFIX(ProgramNamedParameter4fNV):
        movq    8(%rsp), %rsi
        movq    (%rsp), %rdi
        addq    $56, %rsp
-       movq    5944(%rax), %r11
+       movq    5976(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5944(%rax), %r11
+       movq    5976(%rax), %r11
        jmp     *%r11
 1:
        subq    $56, %rsp
@@ -28102,7 +28250,7 @@ GL_PREFIX(ProgramNamedParameter4fNV):
        movq    8(%rsp), %rsi
        movq    (%rsp), %rdi
        addq    $56, %rsp
-       movq    5944(%rax), %r11
+       movq    5976(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ProgramNamedParameter4fNV), .-GL_PREFIX(ProgramNamedParameter4fNV)
@@ -28113,7 +28261,7 @@ GL_PREFIX(ProgramNamedParameter4fNV):
 GL_PREFIX(ProgramNamedParameter4fvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5952(%rax), %r11
+       movq    5984(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28127,13 +28275,13 @@ GL_PREFIX(ProgramNamedParameter4fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5952(%rax), %r11
+       movq    5984(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5952(%rax), %r11
+       movq    5984(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28147,19 +28295,19 @@ GL_PREFIX(ProgramNamedParameter4fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5952(%rax), %r11
+       movq    5984(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ProgramNamedParameter4fvNV), .-GL_PREFIX(ProgramNamedParameter4fvNV)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_745)
-       .type   GL_PREFIX(_dispatch_stub_745), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_745))
-GL_PREFIX(_dispatch_stub_745):
+       .globl  GL_PREFIX(_dispatch_stub_749)
+       .type   GL_PREFIX(_dispatch_stub_749), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_749))
+GL_PREFIX(_dispatch_stub_749):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5960(%rax), %r11
+       movq    5992(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28169,13 +28317,13 @@ GL_PREFIX(_dispatch_stub_745):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5960(%rax), %r11
+       movq    5992(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5960(%rax), %r11
+       movq    5992(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28185,19 +28333,19 @@ GL_PREFIX(_dispatch_stub_745):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5960(%rax), %r11
+       movq    5992(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_745), .-GL_PREFIX(_dispatch_stub_745)
+       .size   GL_PREFIX(_dispatch_stub_749), .-GL_PREFIX(_dispatch_stub_749)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_746)
-       .type   GL_PREFIX(_dispatch_stub_746), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_746))
-GL_PREFIX(_dispatch_stub_746):
+       .globl  GL_PREFIX(_dispatch_stub_750)
+       .type   GL_PREFIX(_dispatch_stub_750), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_750))
+GL_PREFIX(_dispatch_stub_750):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5968(%rax), %r11
+       movq    6000(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28207,13 +28355,13 @@ GL_PREFIX(_dispatch_stub_746):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5968(%rax), %r11
+       movq    6000(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5968(%rax), %r11
+       movq    6000(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28223,10 +28371,10 @@ GL_PREFIX(_dispatch_stub_746):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5968(%rax), %r11
+       movq    6000(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_746), .-GL_PREFIX(_dispatch_stub_746)
+       .size   GL_PREFIX(_dispatch_stub_750), .-GL_PREFIX(_dispatch_stub_750)
 
        .p2align        4,,15
        .globl  GL_PREFIX(BindFramebufferEXT)
@@ -28234,7 +28382,7 @@ GL_PREFIX(_dispatch_stub_746):
 GL_PREFIX(BindFramebufferEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5976(%rax), %r11
+       movq    6008(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28244,13 +28392,13 @@ GL_PREFIX(BindFramebufferEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5976(%rax), %r11
+       movq    6008(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5976(%rax), %r11
+       movq    6008(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28260,7 +28408,7 @@ GL_PREFIX(BindFramebufferEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5976(%rax), %r11
+       movq    6008(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(BindFramebufferEXT), .-GL_PREFIX(BindFramebufferEXT)
@@ -28271,7 +28419,7 @@ GL_PREFIX(BindFramebufferEXT):
 GL_PREFIX(BindRenderbufferEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5984(%rax), %r11
+       movq    6016(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28281,13 +28429,13 @@ GL_PREFIX(BindRenderbufferEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5984(%rax), %r11
+       movq    6016(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5984(%rax), %r11
+       movq    6016(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28297,7 +28445,7 @@ GL_PREFIX(BindRenderbufferEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5984(%rax), %r11
+       movq    6016(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(BindRenderbufferEXT), .-GL_PREFIX(BindRenderbufferEXT)
@@ -28308,25 +28456,25 @@ GL_PREFIX(BindRenderbufferEXT):
 GL_PREFIX(CheckFramebufferStatusEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5992(%rax), %r11
+       movq    6024(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5992(%rax), %r11
+       movq    6024(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5992(%rax), %r11
+       movq    6024(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5992(%rax), %r11
+       movq    6024(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(CheckFramebufferStatusEXT), .-GL_PREFIX(CheckFramebufferStatusEXT)
@@ -28337,7 +28485,7 @@ GL_PREFIX(CheckFramebufferStatusEXT):
 GL_PREFIX(DeleteFramebuffersEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6000(%rax), %r11
+       movq    6032(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28347,13 +28495,13 @@ GL_PREFIX(DeleteFramebuffersEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6000(%rax), %r11
+       movq    6032(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6000(%rax), %r11
+       movq    6032(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28363,7 +28511,7 @@ GL_PREFIX(DeleteFramebuffersEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6000(%rax), %r11
+       movq    6032(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(DeleteFramebuffersEXT), .-GL_PREFIX(DeleteFramebuffersEXT)
@@ -28374,7 +28522,7 @@ GL_PREFIX(DeleteFramebuffersEXT):
 GL_PREFIX(DeleteRenderbuffersEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6008(%rax), %r11
+       movq    6040(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28384,13 +28532,13 @@ GL_PREFIX(DeleteRenderbuffersEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6008(%rax), %r11
+       movq    6040(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6008(%rax), %r11
+       movq    6040(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28400,7 +28548,7 @@ GL_PREFIX(DeleteRenderbuffersEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6008(%rax), %r11
+       movq    6040(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(DeleteRenderbuffersEXT), .-GL_PREFIX(DeleteRenderbuffersEXT)
@@ -28411,7 +28559,7 @@ GL_PREFIX(DeleteRenderbuffersEXT):
 GL_PREFIX(FramebufferRenderbufferEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6016(%rax), %r11
+       movq    6048(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28425,13 +28573,13 @@ GL_PREFIX(FramebufferRenderbufferEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6016(%rax), %r11
+       movq    6048(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6016(%rax), %r11
+       movq    6048(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28445,7 +28593,7 @@ GL_PREFIX(FramebufferRenderbufferEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6016(%rax), %r11
+       movq    6048(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FramebufferRenderbufferEXT), .-GL_PREFIX(FramebufferRenderbufferEXT)
@@ -28456,7 +28604,7 @@ GL_PREFIX(FramebufferRenderbufferEXT):
 GL_PREFIX(FramebufferTexture1DEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6024(%rax), %r11
+       movq    6056(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28470,13 +28618,13 @@ GL_PREFIX(FramebufferTexture1DEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6024(%rax), %r11
+       movq    6056(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6024(%rax), %r11
+       movq    6056(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28490,7 +28638,7 @@ GL_PREFIX(FramebufferTexture1DEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6024(%rax), %r11
+       movq    6056(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FramebufferTexture1DEXT), .-GL_PREFIX(FramebufferTexture1DEXT)
@@ -28501,7 +28649,7 @@ GL_PREFIX(FramebufferTexture1DEXT):
 GL_PREFIX(FramebufferTexture2DEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6032(%rax), %r11
+       movq    6064(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28515,13 +28663,13 @@ GL_PREFIX(FramebufferTexture2DEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6032(%rax), %r11
+       movq    6064(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6032(%rax), %r11
+       movq    6064(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28535,7 +28683,7 @@ GL_PREFIX(FramebufferTexture2DEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6032(%rax), %r11
+       movq    6064(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FramebufferTexture2DEXT), .-GL_PREFIX(FramebufferTexture2DEXT)
@@ -28546,7 +28694,7 @@ GL_PREFIX(FramebufferTexture2DEXT):
 GL_PREFIX(FramebufferTexture3DEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6040(%rax), %r11
+       movq    6072(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28564,13 +28712,13 @@ GL_PREFIX(FramebufferTexture3DEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6040(%rax), %r11
+       movq    6072(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6040(%rax), %r11
+       movq    6072(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28588,7 +28736,7 @@ GL_PREFIX(FramebufferTexture3DEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6040(%rax), %r11
+       movq    6072(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FramebufferTexture3DEXT), .-GL_PREFIX(FramebufferTexture3DEXT)
@@ -28599,7 +28747,7 @@ GL_PREFIX(FramebufferTexture3DEXT):
 GL_PREFIX(GenFramebuffersEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6048(%rax), %r11
+       movq    6080(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28609,13 +28757,13 @@ GL_PREFIX(GenFramebuffersEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6048(%rax), %r11
+       movq    6080(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6048(%rax), %r11
+       movq    6080(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28625,7 +28773,7 @@ GL_PREFIX(GenFramebuffersEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6048(%rax), %r11
+       movq    6080(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GenFramebuffersEXT), .-GL_PREFIX(GenFramebuffersEXT)
@@ -28636,7 +28784,7 @@ GL_PREFIX(GenFramebuffersEXT):
 GL_PREFIX(GenRenderbuffersEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6056(%rax), %r11
+       movq    6088(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28646,13 +28794,13 @@ GL_PREFIX(GenRenderbuffersEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6056(%rax), %r11
+       movq    6088(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6056(%rax), %r11
+       movq    6088(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28662,7 +28810,7 @@ GL_PREFIX(GenRenderbuffersEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6056(%rax), %r11
+       movq    6088(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GenRenderbuffersEXT), .-GL_PREFIX(GenRenderbuffersEXT)
@@ -28673,25 +28821,25 @@ GL_PREFIX(GenRenderbuffersEXT):
 GL_PREFIX(GenerateMipmapEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6064(%rax), %r11
+       movq    6096(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6064(%rax), %r11
+       movq    6096(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6064(%rax), %r11
+       movq    6096(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6064(%rax), %r11
+       movq    6096(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GenerateMipmapEXT), .-GL_PREFIX(GenerateMipmapEXT)
@@ -28702,7 +28850,7 @@ GL_PREFIX(GenerateMipmapEXT):
 GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6072(%rax), %r11
+       movq    6104(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28716,13 +28864,13 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6072(%rax), %r11
+       movq    6104(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6072(%rax), %r11
+       movq    6104(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28736,7 +28884,7 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6072(%rax), %r11
+       movq    6104(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetFramebufferAttachmentParameterivEXT), .-GL_PREFIX(GetFramebufferAttachmentParameterivEXT)
@@ -28747,7 +28895,7 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
 GL_PREFIX(GetRenderbufferParameterivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6080(%rax), %r11
+       movq    6112(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28757,13 +28905,13 @@ GL_PREFIX(GetRenderbufferParameterivEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6080(%rax), %r11
+       movq    6112(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6080(%rax), %r11
+       movq    6112(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28773,7 +28921,7 @@ GL_PREFIX(GetRenderbufferParameterivEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6080(%rax), %r11
+       movq    6112(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetRenderbufferParameterivEXT), .-GL_PREFIX(GetRenderbufferParameterivEXT)
@@ -28784,25 +28932,25 @@ GL_PREFIX(GetRenderbufferParameterivEXT):
 GL_PREFIX(IsFramebufferEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6088(%rax), %r11
+       movq    6120(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6088(%rax), %r11
+       movq    6120(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6088(%rax), %r11
+       movq    6120(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6088(%rax), %r11
+       movq    6120(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(IsFramebufferEXT), .-GL_PREFIX(IsFramebufferEXT)
@@ -28813,25 +28961,25 @@ GL_PREFIX(IsFramebufferEXT):
 GL_PREFIX(IsRenderbufferEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6096(%rax), %r11
+       movq    6128(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6096(%rax), %r11
+       movq    6128(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6096(%rax), %r11
+       movq    6128(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6096(%rax), %r11
+       movq    6128(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(IsRenderbufferEXT), .-GL_PREFIX(IsRenderbufferEXT)
@@ -28842,7 +28990,7 @@ GL_PREFIX(IsRenderbufferEXT):
 GL_PREFIX(RenderbufferStorageEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6104(%rax), %r11
+       movq    6136(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28856,13 +29004,13 @@ GL_PREFIX(RenderbufferStorageEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6104(%rax), %r11
+       movq    6136(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6104(%rax), %r11
+       movq    6136(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28876,19 +29024,19 @@ GL_PREFIX(RenderbufferStorageEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6104(%rax), %r11
+       movq    6136(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(RenderbufferStorageEXT), .-GL_PREFIX(RenderbufferStorageEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_764)
-       .type   GL_PREFIX(_dispatch_stub_764), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_764))
-GL_PREFIX(_dispatch_stub_764):
+       .globl  GL_PREFIX(_dispatch_stub_768)
+       .type   GL_PREFIX(_dispatch_stub_768), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_768))
+GL_PREFIX(_dispatch_stub_768):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6112(%rax), %r11
+       movq    6144(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28906,13 +29054,13 @@ GL_PREFIX(_dispatch_stub_764):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6112(%rax), %r11
+       movq    6144(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6112(%rax), %r11
+       movq    6144(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28930,10 +29078,10 @@ GL_PREFIX(_dispatch_stub_764):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6112(%rax), %r11
+       movq    6144(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_764), .-GL_PREFIX(_dispatch_stub_764)
+       .size   GL_PREFIX(_dispatch_stub_768), .-GL_PREFIX(_dispatch_stub_768)
 
        .p2align        4,,15
        .globl  GL_PREFIX(FramebufferTextureLayerEXT)
@@ -28941,7 +29089,7 @@ GL_PREFIX(_dispatch_stub_764):
 GL_PREFIX(FramebufferTextureLayerEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6120(%rax), %r11
+       movq    6152(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28955,13 +29103,13 @@ GL_PREFIX(FramebufferTextureLayerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6120(%rax), %r11
+       movq    6152(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6120(%rax), %r11
+       movq    6152(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28975,19 +29123,19 @@ GL_PREFIX(FramebufferTextureLayerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6120(%rax), %r11
+       movq    6152(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FramebufferTextureLayerEXT), .-GL_PREFIX(FramebufferTextureLayerEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_766)
-       .type   GL_PREFIX(_dispatch_stub_766), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_766))
-GL_PREFIX(_dispatch_stub_766):
+       .globl  GL_PREFIX(_dispatch_stub_770)
+       .type   GL_PREFIX(_dispatch_stub_770), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_770))
+GL_PREFIX(_dispatch_stub_770):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6128(%rax), %r11
+       movq    6160(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29001,13 +29149,13 @@ GL_PREFIX(_dispatch_stub_766):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6128(%rax), %r11
+       movq    6160(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6128(%rax), %r11
+       movq    6160(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29021,19 +29169,19 @@ GL_PREFIX(_dispatch_stub_766):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6128(%rax), %r11
+       movq    6160(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_766), .-GL_PREFIX(_dispatch_stub_766)
+       .size   GL_PREFIX(_dispatch_stub_770), .-GL_PREFIX(_dispatch_stub_770)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_767)
-       .type   GL_PREFIX(_dispatch_stub_767), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_767))
-GL_PREFIX(_dispatch_stub_767):
+       .globl  GL_PREFIX(_dispatch_stub_771)
+       .type   GL_PREFIX(_dispatch_stub_771), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_771))
+GL_PREFIX(_dispatch_stub_771):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6136(%rax), %r11
+       movq    6168(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29047,13 +29195,13 @@ GL_PREFIX(_dispatch_stub_767):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6136(%rax), %r11
+       movq    6168(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6136(%rax), %r11
+       movq    6168(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29067,19 +29215,19 @@ GL_PREFIX(_dispatch_stub_767):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6136(%rax), %r11
+       movq    6168(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_767), .-GL_PREFIX(_dispatch_stub_767)
+       .size   GL_PREFIX(_dispatch_stub_771), .-GL_PREFIX(_dispatch_stub_771)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_768)
-       .type   GL_PREFIX(_dispatch_stub_768), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_768))
-GL_PREFIX(_dispatch_stub_768):
+       .globl  GL_PREFIX(_dispatch_stub_772)
+       .type   GL_PREFIX(_dispatch_stub_772), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_772))
+GL_PREFIX(_dispatch_stub_772):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6144(%rax), %r11
+       movq    6176(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29093,13 +29241,13 @@ GL_PREFIX(_dispatch_stub_768):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6144(%rax), %r11
+       movq    6176(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6144(%rax), %r11
+       movq    6176(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29113,19 +29261,19 @@ GL_PREFIX(_dispatch_stub_768):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6144(%rax), %r11
+       movq    6176(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_768), .-GL_PREFIX(_dispatch_stub_768)
+       .size   GL_PREFIX(_dispatch_stub_772), .-GL_PREFIX(_dispatch_stub_772)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_769)
-       .type   GL_PREFIX(_dispatch_stub_769), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_769))
-GL_PREFIX(_dispatch_stub_769):
+       .globl  GL_PREFIX(_dispatch_stub_773)
+       .type   GL_PREFIX(_dispatch_stub_773), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_773))
+GL_PREFIX(_dispatch_stub_773):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6152(%rax), %r11
+       movq    6184(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29135,13 +29283,13 @@ GL_PREFIX(_dispatch_stub_769):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6152(%rax), %r11
+       movq    6184(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6152(%rax), %r11
+       movq    6184(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29151,19 +29299,19 @@ GL_PREFIX(_dispatch_stub_769):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6152(%rax), %r11
+       movq    6184(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_769), .-GL_PREFIX(_dispatch_stub_769)
+       .size   GL_PREFIX(_dispatch_stub_773), .-GL_PREFIX(_dispatch_stub_773)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_770)
-       .type   GL_PREFIX(_dispatch_stub_770), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_770))
-GL_PREFIX(_dispatch_stub_770):
+       .globl  GL_PREFIX(_dispatch_stub_774)
+       .type   GL_PREFIX(_dispatch_stub_774), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_774))
+GL_PREFIX(_dispatch_stub_774):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6160(%rax), %r11
+       movq    6192(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29173,13 +29321,13 @@ GL_PREFIX(_dispatch_stub_770):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6160(%rax), %r11
+       movq    6192(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6160(%rax), %r11
+       movq    6192(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29189,10 +29337,10 @@ GL_PREFIX(_dispatch_stub_770):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6160(%rax), %r11
+       movq    6192(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_770), .-GL_PREFIX(_dispatch_stub_770)
+       .size   GL_PREFIX(_dispatch_stub_774), .-GL_PREFIX(_dispatch_stub_774)
 
        .globl GL_PREFIX(ArrayElementEXT) ; .set GL_PREFIX(ArrayElementEXT), GL_PREFIX(ArrayElement)
        .globl GL_PREFIX(BindTextureEXT) ; .set GL_PREFIX(BindTextureEXT), GL_PREFIX(BindTexture)
@@ -29447,7 +29595,7 @@ GL_PREFIX(_dispatch_stub_770):
        .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(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_746)
+       .globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_750)
        .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)
@@ -29465,7 +29613,7 @@ GL_PREFIX(_dispatch_stub_770):
        .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_764)
+       .globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_768)
        .globl GL_PREFIX(FramebufferTextureLayer) ; .set GL_PREFIX(FramebufferTextureLayer), GL_PREFIX(FramebufferTextureLayerEXT)
 
 #if defined(GLX_USE_TLS) && defined(__linux__)
index 96f8da87f050775e4005b8a8ee0d6aa084b2e88f..ac176ef328edeb64c5c4ffc69956e24286863b33 100644 (file)
@@ -35,7 +35,7 @@
 #include "math/m_xform.h"
 #include "tnl/t_context.h"
 #include "x86-64.h"
-#include "../x86/common_x86_macros.h"
+#include "../x86/x86_xform.h"
 
 #ifdef DEBUG
 #include "math/m_debug.h"
index c037a6176187e9a21bab9f161345b53c98823ac0..de2fb1e2aadb349ed14270777dd53469a0d4cc18 100644 (file)
@@ -34,7 +34,7 @@
 #include "tnl/t_context.h"
 
 #include "3dnow.h"
-#include "common_x86_macros.h"
+#include "x86_xform.h"
 
 #ifdef DEBUG_MATH
 #include "math/m_debug.h"
index 5321547935878e4291666ae17df344900c6dd98d..5efdb4f24a6a82064444d66b04d6c71c88296df2 100644 (file)
 #include "common_x86_asm.h"
 
 
-int _mesa_x86_cpu_features = 0;
+/** Bitmask of X86_FEATURE_x bits */
+int _mesa_x86_cpu_features = 0x0;
+
+
 
 /* No reason for this to be public.
  */
@@ -73,9 +76,12 @@ extern GLuint        _ASMAPI _mesa_x86_cpuid_edx(GLuint op);
  * kernels provide full SSE support on all processors that expose SSE via
  * the CPUID mechanism.
  */
+
+/* These are assembly functions: */
 extern void _mesa_test_os_sse_support( void );
 extern void _mesa_test_os_sse_exception_support( void );
 
+
 #if defined(WIN32)
 #ifndef STATUS_FLOAT_MULTIPLE_TRAPS
 # define STATUS_FLOAT_MULTIPLE_TRAPS (0xC00002B5L)
@@ -107,7 +113,11 @@ static LONG WINAPI ExceptionFilter(LPEXCEPTION_POINTERS exp)
 #endif /* WIN32 */
 
 
-static void check_os_sse_support( void )
+/**
+ * Check if SSE is supported.
+ * If not, turn off the X86_FEATURE_XMM flag in _mesa_x86_cpu_features.
+ */
+void _mesa_check_os_sse_support( void )
 {
 #if defined(__FreeBSD__)
    {
@@ -187,10 +197,26 @@ static void check_os_sse_support( void )
 #endif /* USE_SSE_ASM */
 
 
-void _mesa_init_all_x86_transform_asm( void )
+/**
+ * Initialize the _mesa_x86_cpu_features bitfield.
+ * This is a no-op if called more than once.
+ */
+void
+_mesa_get_x86_features(void)
 {
+   static int called = 0;
+
+   if (called)
+      return;
+
+   called = 1;
+
 #ifdef USE_X86_ASM
-   _mesa_x86_cpu_features = 0;
+   _mesa_x86_cpu_features = 0x0;
+
+   if (_mesa_getenv( "MESA_NO_ASM")) {
+      return;
+   }
 
    if (!_mesa_x86_has_cpuid()) {
        _mesa_debug(NULL, "CPUID not detected\n");
@@ -263,52 +289,5 @@ void _mesa_init_all_x86_transform_asm( void )
        }
 
    }
-   
-   if ( _mesa_getenv( "MESA_NO_ASM" ) ) {
-      _mesa_x86_cpu_features = 0;
-   }
-
-   if ( _mesa_x86_cpu_features ) {
-      _mesa_init_x86_transform_asm();
-   }
-
-#ifdef USE_MMX_ASM
-   if ( cpu_has_mmx ) {
-      if ( _mesa_getenv( "MESA_NO_MMX" ) == 0 ) {
-         _mesa_debug(NULL, "MMX cpu detected.\n");
-      } else {
-         _mesa_x86_cpu_features &= ~(X86_FEATURE_MMX);
-      }
-   }
-#endif
-
-#ifdef USE_3DNOW_ASM
-   if ( cpu_has_3dnow ) {
-      if ( _mesa_getenv( "MESA_NO_3DNOW" ) == 0 ) {
-         _mesa_debug(NULL, "3DNow! cpu detected.\n");
-         _mesa_init_3dnow_transform_asm();
-      } else {
-         _mesa_x86_cpu_features &= ~(X86_FEATURE_3DNOW);
-      }
-   }
-#endif
-
-#ifdef USE_SSE_ASM
-   if ( cpu_has_xmm ) {
-      if ( _mesa_getenv( "MESA_NO_SSE" ) == 0 ) {
-         _mesa_debug(NULL, "SSE cpu detected.\n");
-         if ( _mesa_getenv( "MESA_FORCE_SSE" ) == 0 ) {
-            check_os_sse_support();
-         }
-         if ( cpu_has_xmm ) {
-            _mesa_init_sse_transform_asm();
-         }
-      } else {
-         _mesa_debug(NULL, "SSE cpu detected, but switched off by user.\n");
-         _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM);
-      }
-   }
-#endif
-#endif
+#endif /* USE_X86_ASM */
 }
-
index 89312b2437989f82335455e76c823c423d4ce602..0d39e3d2308e86e9401aef1e7251e38c130cb658 100644 (file)
  */
 #include "common_x86_features.h"
 
-#ifdef USE_X86_ASM
-#include "x86.h"
-#ifdef USE_3DNOW_ASM
-#include "3dnow.h"
-#endif
-#ifdef USE_SSE_ASM
-#include "sse.h"
-#endif
-#endif
-
 extern int _mesa_x86_cpu_features;
 
+extern void _mesa_get_x86_features(void);
+
+extern void _mesa_check_os_sse_support(void);
+
 extern void _mesa_init_all_x86_transform_asm( void );
 
 #endif
diff --git a/src/mesa/x86/common_x86_macros.h b/src/mesa/x86/common_x86_macros.h
deleted file mode 100644 (file)
index 462f32b..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version:  3.5
- *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *    Gareth Hughes
- */
-
-#ifndef __COMMON_X86_MACROS_H__
-#define __COMMON_X86_MACROS_H__
-
-
-/* =============================================================
- * Transformation function declarations:
- */
-
-#define XFORM_ARGS     GLvector4f *to_vec,                             \
-                       const GLfloat m[16],                            \
-                       const GLvector4f *from_vec
-
-#define DECLARE_XFORM_GROUP( pfx, sz ) \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS );                \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS );       \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS );      \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS );    \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS );             \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS );      \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS );
-
-#define ASSIGN_XFORM_GROUP( pfx, sz )                                  \
-   _mesa_transform_tab[sz][MATRIX_GENERAL] =                           \
-      _mesa_##pfx##_transform_points##sz##_general;                    \
-   _mesa_transform_tab[sz][MATRIX_IDENTITY] =                          \
-      _mesa_##pfx##_transform_points##sz##_identity;                   \
-   _mesa_transform_tab[sz][MATRIX_3D_NO_ROT] =                         \
-      _mesa_##pfx##_transform_points##sz##_3d_no_rot;                  \
-   _mesa_transform_tab[sz][MATRIX_PERSPECTIVE] =                       \
-      _mesa_##pfx##_transform_points##sz##_perspective;                        \
-   _mesa_transform_tab[sz][MATRIX_2D] =                                        \
-      _mesa_##pfx##_transform_points##sz##_2d;                         \
-   _mesa_transform_tab[sz][MATRIX_2D_NO_ROT] =                         \
-      _mesa_##pfx##_transform_points##sz##_2d_no_rot;                  \
-   _mesa_transform_tab[sz][MATRIX_3D] =                                        \
-      _mesa_##pfx##_transform_points##sz##_3d;
-
-
-/* =============================================================
- * Normal transformation function declarations:
- */
-
-#define NORM_ARGS      const GLmatrix *mat,                            \
-                       GLfloat scale,                                  \
-                       const GLvector4f *in,                           \
-                       const GLfloat *lengths,                         \
-                       GLvector4f *dest
-
-#define DECLARE_NORM_GROUP( pfx ) \
-extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS );                                \
-extern void _ASMAPI _mesa_##pfx##_normalize_normals( NORM_ARGS );                      \
-extern void _ASMAPI _mesa_##pfx##_transform_normals( NORM_ARGS );                      \
-extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS );               \
-extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals( NORM_ARGS );              \
-extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS );       \
-extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals( NORM_ARGS );            \
-extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS );
-
-#define ASSIGN_NORM_GROUP( pfx )                                       \
-   _mesa_normal_tab[NORM_RESCALE] =                                    \
-      _mesa_##pfx##_rescale_normals;                                   \
-   _mesa_normal_tab[NORM_NORMALIZE] =                                  \
-      _mesa_##pfx##_normalize_normals;                                 \
-   _mesa_normal_tab[NORM_TRANSFORM] =                                  \
-      _mesa_##pfx##_transform_normals;                                 \
-   _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] =                           \
-      _mesa_##pfx##_transform_normals_no_rot;                          \
-   _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] =                   \
-      _mesa_##pfx##_transform_rescale_normals;                         \
-   _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] =            \
-      _mesa_##pfx##_transform_rescale_normals_no_rot;                  \
-   _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] =                 \
-      _mesa_##pfx##_transform_normalize_normals;                       \
-   _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] =          \
-      _mesa_##pfx##_transform_normalize_normals_no_rot;
-
-
-#endif
index afb4b11529f99df5f53c415609b233cd1f0ec91b..8c690b4f882e624990fe272e131315e9538887fb 100644 (file)
@@ -61,7 +61,7 @@ do {                                                                  \
    printf( "\n" );                                                     \
 } while (0)
 
-#if defined(__BEOS__) || defined(_LP64)
+#if defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64)
 #define OFFSET( s, t, m )                                              \
    printf( "#define %s\t%ld\n", s, offsetof( t, m ) );
 #else
@@ -69,7 +69,7 @@ do {                                                                  \
    printf( "#define %s\t%d\n", s, offsetof( t, m ) );
 #endif
 
-#if defined(__BEOS__) || defined(_LP64)
+#if defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64)
 #define SIZEOF( s, t )                                                 \
    printf( "#define %s\t%ld\n", s, sizeof(t) );
 #else
index 2e05a74ac6983074e2e806f3791387185b7fba42..7aa344f214e92140e023b741568a352d4b591cbc 100644 (file)
@@ -889,6 +889,10 @@ GLNAME(gl_dispatch_functions_start):
        GL_STUB(VertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV, VertexAttribs4fvNV@12)
        GL_STUB(VertexAttribs4svNV, _gloffset_VertexAttribs4svNV, VertexAttribs4svNV@12)
        GL_STUB(VertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV, VertexAttribs4ubvNV@12)
+       GL_STUB(GetTexBumpParameterfvATI, _gloffset_GetTexBumpParameterfvATI, GetTexBumpParameterfvATI@8)
+       GL_STUB(GetTexBumpParameterivATI, _gloffset_GetTexBumpParameterivATI, GetTexBumpParameterivATI@8)
+       GL_STUB(TexBumpParameterfvATI, _gloffset_TexBumpParameterfvATI, TexBumpParameterfvATI@8)
+       GL_STUB(TexBumpParameterivATI, _gloffset_TexBumpParameterivATI, TexBumpParameterivATI@8)
        GL_STUB(AlphaFragmentOp1ATI, _gloffset_AlphaFragmentOp1ATI, AlphaFragmentOp1ATI@24)
        GL_STUB(AlphaFragmentOp2ATI, _gloffset_AlphaFragmentOp2ATI, AlphaFragmentOp2ATI@36)
        GL_STUB(AlphaFragmentOp3ATI, _gloffset_AlphaFragmentOp3ATI, AlphaFragmentOp3ATI@48)
@@ -905,26 +909,26 @@ GLNAME(gl_dispatch_functions_start):
        GL_STUB(SetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI, SetFragmentShaderConstantATI@8)
        GL_STUB(PointParameteriNV, _gloffset_PointParameteriNV, PointParameteriNV@8)
        GL_STUB(PointParameterivNV, _gloffset_PointParameterivNV, PointParameterivNV@8)
-       GL_STUB(_dispatch_stub_734, _gloffset_ActiveStencilFaceEXT, _dispatch_stub_734@4)
-       HIDDEN(GL_PREFIX(_dispatch_stub_734, _dispatch_stub_734@4))
-       GL_STUB(_dispatch_stub_735, _gloffset_BindVertexArrayAPPLE, _dispatch_stub_735@4)
-       HIDDEN(GL_PREFIX(_dispatch_stub_735, _dispatch_stub_735@4))
-       GL_STUB(_dispatch_stub_736, _gloffset_DeleteVertexArraysAPPLE, _dispatch_stub_736@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_736, _dispatch_stub_736@8))
-       GL_STUB(_dispatch_stub_737, _gloffset_GenVertexArraysAPPLE, _dispatch_stub_737@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_737, _dispatch_stub_737@8))
-       GL_STUB(_dispatch_stub_738, _gloffset_IsVertexArrayAPPLE, _dispatch_stub_738@4)
+       GL_STUB(_dispatch_stub_738, _gloffset_ActiveStencilFaceEXT, _dispatch_stub_738@4)
        HIDDEN(GL_PREFIX(_dispatch_stub_738, _dispatch_stub_738@4))
+       GL_STUB(_dispatch_stub_739, _gloffset_BindVertexArrayAPPLE, _dispatch_stub_739@4)
+       HIDDEN(GL_PREFIX(_dispatch_stub_739, _dispatch_stub_739@4))
+       GL_STUB(_dispatch_stub_740, _gloffset_DeleteVertexArraysAPPLE, _dispatch_stub_740@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_740, _dispatch_stub_740@8))
+       GL_STUB(_dispatch_stub_741, _gloffset_GenVertexArraysAPPLE, _dispatch_stub_741@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_741, _dispatch_stub_741@8))
+       GL_STUB(_dispatch_stub_742, _gloffset_IsVertexArrayAPPLE, _dispatch_stub_742@4)
+       HIDDEN(GL_PREFIX(_dispatch_stub_742, _dispatch_stub_742@4))
        GL_STUB(GetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV, GetProgramNamedParameterdvNV@16)
        GL_STUB(GetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV, GetProgramNamedParameterfvNV@16)
        GL_STUB(ProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV, ProgramNamedParameter4dNV@44)
        GL_STUB(ProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV, ProgramNamedParameter4dvNV@16)
        GL_STUB(ProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV, ProgramNamedParameter4fNV@28)
        GL_STUB(ProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV, ProgramNamedParameter4fvNV@16)
-       GL_STUB(_dispatch_stub_745, _gloffset_DepthBoundsEXT, _dispatch_stub_745@16)
-       HIDDEN(GL_PREFIX(_dispatch_stub_745, _dispatch_stub_745@16))
-       GL_STUB(_dispatch_stub_746, _gloffset_BlendEquationSeparateEXT, _dispatch_stub_746@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_746, _dispatch_stub_746@8))
+       GL_STUB(_dispatch_stub_749, _gloffset_DepthBoundsEXT, _dispatch_stub_749@16)
+       HIDDEN(GL_PREFIX(_dispatch_stub_749, _dispatch_stub_749@16))
+       GL_STUB(_dispatch_stub_750, _gloffset_BlendEquationSeparateEXT, _dispatch_stub_750@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_750, _dispatch_stub_750@8))
        GL_STUB(BindFramebufferEXT, _gloffset_BindFramebufferEXT, BindFramebufferEXT@8)
        GL_STUB(BindRenderbufferEXT, _gloffset_BindRenderbufferEXT, BindRenderbufferEXT@8)
        GL_STUB(CheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4)
@@ -942,19 +946,19 @@ GLNAME(gl_dispatch_functions_start):
        GL_STUB(IsFramebufferEXT, _gloffset_IsFramebufferEXT, IsFramebufferEXT@4)
        GL_STUB(IsRenderbufferEXT, _gloffset_IsRenderbufferEXT, IsRenderbufferEXT@4)
        GL_STUB(RenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT, RenderbufferStorageEXT@16)
-       GL_STUB(_dispatch_stub_764, _gloffset_BlitFramebufferEXT, _dispatch_stub_764@40)
-       HIDDEN(GL_PREFIX(_dispatch_stub_764, _dispatch_stub_764@40))
+       GL_STUB(_dispatch_stub_768, _gloffset_BlitFramebufferEXT, _dispatch_stub_768@40)
+       HIDDEN(GL_PREFIX(_dispatch_stub_768, _dispatch_stub_768@40))
        GL_STUB(FramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20)
-       GL_STUB(_dispatch_stub_766, _gloffset_StencilFuncSeparateATI, _dispatch_stub_766@16)
-       HIDDEN(GL_PREFIX(_dispatch_stub_766, _dispatch_stub_766@16))
-       GL_STUB(_dispatch_stub_767, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_767@16)
-       HIDDEN(GL_PREFIX(_dispatch_stub_767, _dispatch_stub_767@16))
-       GL_STUB(_dispatch_stub_768, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_768@16)
-       HIDDEN(GL_PREFIX(_dispatch_stub_768, _dispatch_stub_768@16))
-       GL_STUB(_dispatch_stub_769, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_769@12)
-       HIDDEN(GL_PREFIX(_dispatch_stub_769, _dispatch_stub_769@12))
-       GL_STUB(_dispatch_stub_770, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_770@12)
-       HIDDEN(GL_PREFIX(_dispatch_stub_770, _dispatch_stub_770@12))
+       GL_STUB(_dispatch_stub_770, _gloffset_StencilFuncSeparateATI, _dispatch_stub_770@16)
+       HIDDEN(GL_PREFIX(_dispatch_stub_770, _dispatch_stub_770@16))
+       GL_STUB(_dispatch_stub_771, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_771@16)
+       HIDDEN(GL_PREFIX(_dispatch_stub_771, _dispatch_stub_771@16))
+       GL_STUB(_dispatch_stub_772, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_772@16)
+       HIDDEN(GL_PREFIX(_dispatch_stub_772, _dispatch_stub_772@16))
+       GL_STUB(_dispatch_stub_773, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_773@12)
+       HIDDEN(GL_PREFIX(_dispatch_stub_773, _dispatch_stub_773@12))
+       GL_STUB(_dispatch_stub_774, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_774@12)
+       HIDDEN(GL_PREFIX(_dispatch_stub_774, _dispatch_stub_774@12))
        GL_STUB_ALIAS(ArrayElementEXT, _gloffset_ArrayElement, ArrayElementEXT@4, ArrayElement, ArrayElement@4)
        GL_STUB_ALIAS(BindTextureEXT, _gloffset_BindTexture, BindTextureEXT@8, BindTexture, BindTexture@8)
        GL_STUB_ALIAS(DrawArraysEXT, _gloffset_DrawArrays, DrawArraysEXT@12, DrawArrays, DrawArrays@12)
index 1c185387c6406fb56d124bfa67c2d0b9e26e1b9f..aef15b53152978d324f2d5f285ae191c5c3e32cf 100644 (file)
@@ -33,7 +33,7 @@
 #include "tnl/t_context.h"
 
 #include "sse.h"
-#include "common_x86_macros.h"
+#include "x86_xform.h"
 
 #ifdef DEBUG_MATH
 #include "math/m_debug.h"
diff --git a/src/mesa/x86/x86.c b/src/mesa/x86/x86.c
deleted file mode 100644 (file)
index ce649f6..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version:  3.5
- *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Intel x86 assembly code by Josh Vanderhoof
- */
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "math/m_xform.h"
-#include "tnl/t_context.h"
-
-#include "x86.h"
-#include "common_x86_macros.h"
-
-#ifdef DEBUG_MATH
-#include "math/m_debug.h"
-#endif
-
-
-#ifdef USE_X86_ASM
-DECLARE_XFORM_GROUP( x86, 2 )
-DECLARE_XFORM_GROUP( x86, 3 )
-DECLARE_XFORM_GROUP( x86, 4 )
-
-
-extern GLvector4f * _ASMAPI
-_mesa_x86_cliptest_points4( GLvector4f *clip_vec,
-                           GLvector4f *proj_vec,
-                           GLubyte clipMask[],
-                           GLubyte *orMask,
-                           GLubyte *andMask );
-
-extern GLvector4f * _ASMAPI
-_mesa_x86_cliptest_points4_np( GLvector4f *clip_vec,
-                              GLvector4f *proj_vec,
-                              GLubyte clipMask[],
-                              GLubyte *orMask,
-                              GLubyte *andMask );
-
-extern void _ASMAPI
-_mesa_v16_x86_cliptest_points4( GLfloat *first_vert,
-                               GLfloat *last_vert,
-                               GLubyte *or_mask,
-                               GLubyte *and_mask,
-                               GLubyte *clip_mask );
-
-extern void _ASMAPI
-_mesa_v16_x86_general_xform( GLfloat *dest,
-                            const GLfloat *m,
-                            const GLfloat *src,
-                            GLuint src_stride,
-                            GLuint count );
-#endif
-
-
-void _mesa_init_x86_transform_asm( void )
-{
-#ifdef USE_X86_ASM
-   ASSIGN_XFORM_GROUP( x86, 2 );
-   ASSIGN_XFORM_GROUP( x86, 3 );
-   ASSIGN_XFORM_GROUP( x86, 4 );
-
-   _mesa_clip_tab[4] = _mesa_x86_cliptest_points4;
-   _mesa_clip_np_tab[4] = _mesa_x86_cliptest_points4_np;
-
-#ifdef DEBUG_MATH
-   _math_test_all_transform_functions( "x86" );
-   _math_test_all_cliptest_functions( "x86" );
-#endif
-#endif
-}
-
diff --git a/src/mesa/x86/x86.h b/src/mesa/x86/x86.h
deleted file mode 100644 (file)
index 97651ec..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version:  3.5
- *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Intel x86 assembly code by Josh Vanderhoof
- */
-
-#ifndef __X86_H__
-#define __X86_H__
-
-extern void _mesa_init_x86_transform_asm( void );
-
-#endif
diff --git a/src/mesa/x86/x86_xform.c b/src/mesa/x86/x86_xform.c
new file mode 100644 (file)
index 0000000..16b2b26
--- /dev/null
@@ -0,0 +1,153 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  3.5
+ *
+ * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Intel x86 assembly code by Josh Vanderhoof
+ */
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "math/m_xform.h"
+#include "tnl/t_context.h"
+
+#include "x86_xform.h"
+#include "common_x86_asm.h"
+
+#ifdef USE_X86_ASM
+#ifdef USE_3DNOW_ASM
+#include "3dnow.h"
+#endif
+#ifdef USE_SSE_ASM
+#include "sse.h"
+#endif
+#endif
+
+#ifdef DEBUG_MATH
+#include "math/m_debug.h"
+#endif
+
+
+#ifdef USE_X86_ASM
+DECLARE_XFORM_GROUP( x86, 2 )
+DECLARE_XFORM_GROUP( x86, 3 )
+DECLARE_XFORM_GROUP( x86, 4 )
+
+
+extern GLvector4f * _ASMAPI
+_mesa_x86_cliptest_points4( GLvector4f *clip_vec,
+                           GLvector4f *proj_vec,
+                           GLubyte clipMask[],
+                           GLubyte *orMask,
+                           GLubyte *andMask );
+
+extern GLvector4f * _ASMAPI
+_mesa_x86_cliptest_points4_np( GLvector4f *clip_vec,
+                              GLvector4f *proj_vec,
+                              GLubyte clipMask[],
+                              GLubyte *orMask,
+                              GLubyte *andMask );
+
+extern void _ASMAPI
+_mesa_v16_x86_cliptest_points4( GLfloat *first_vert,
+                               GLfloat *last_vert,
+                               GLubyte *or_mask,
+                               GLubyte *and_mask,
+                               GLubyte *clip_mask );
+
+extern void _ASMAPI
+_mesa_v16_x86_general_xform( GLfloat *dest,
+                            const GLfloat *m,
+                            const GLfloat *src,
+                            GLuint src_stride,
+                            GLuint count );
+#endif
+
+
+#ifdef USE_X86_ASM
+static void _mesa_init_x86_transform_asm( void )
+{
+   ASSIGN_XFORM_GROUP( x86, 2 );
+   ASSIGN_XFORM_GROUP( x86, 3 );
+   ASSIGN_XFORM_GROUP( x86, 4 );
+
+   _mesa_clip_tab[4] = _mesa_x86_cliptest_points4;
+   _mesa_clip_np_tab[4] = _mesa_x86_cliptest_points4_np;
+
+#ifdef DEBUG_MATH
+   _math_test_all_transform_functions( "x86" );
+   _math_test_all_cliptest_functions( "x86" );
+#endif
+}
+#endif
+
+
+void _mesa_init_all_x86_transform_asm( void )
+{
+   _mesa_get_x86_features();
+
+#ifdef USE_X86_ASM
+   if ( _mesa_x86_cpu_features ) {
+      _mesa_init_x86_transform_asm();
+   }
+
+#ifdef USE_MMX_ASM
+   if ( cpu_has_mmx ) {
+      if ( _mesa_getenv( "MESA_NO_MMX" ) == 0 ) {
+         _mesa_debug(NULL, "MMX cpu detected.\n");
+      } else {
+         _mesa_x86_cpu_features &= ~(X86_FEATURE_MMX);
+      }
+   }
+#endif
+
+#ifdef USE_3DNOW_ASM
+   if ( cpu_has_3dnow ) {
+      if ( _mesa_getenv( "MESA_NO_3DNOW" ) == 0 ) {
+         _mesa_debug(NULL, "3DNow! cpu detected.\n");
+         _mesa_init_3dnow_transform_asm();
+      } else {
+         _mesa_x86_cpu_features &= ~(X86_FEATURE_3DNOW);
+      }
+   }
+#endif
+
+#ifdef USE_SSE_ASM
+   if ( cpu_has_xmm ) {
+      if ( _mesa_getenv( "MESA_NO_SSE" ) == 0 ) {
+         _mesa_debug(NULL, "SSE cpu detected.\n");
+         if ( _mesa_getenv( "MESA_FORCE_SSE" ) == 0 ) {
+            _mesa_check_os_sse_support();
+         }
+         if ( cpu_has_xmm ) {
+            _mesa_init_sse_transform_asm();
+         }
+      } else {
+         _mesa_debug(NULL, "SSE cpu detected, but switched off by user.\n");
+         _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM);
+      }
+   }
+#endif
+#endif
+}
diff --git a/src/mesa/x86/x86_xform.h b/src/mesa/x86/x86_xform.h
new file mode 100644 (file)
index 0000000..e886d9a
--- /dev/null
@@ -0,0 +1,106 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  3.5
+ *
+ * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Gareth Hughes
+ */
+
+#ifndef X86_XFORM_H
+#define X86_XFORM_H
+
+
+/* =============================================================
+ * Transformation function declarations:
+ */
+
+#define XFORM_ARGS     GLvector4f *to_vec,                             \
+                       const GLfloat m[16],                            \
+                       const GLvector4f *from_vec
+
+#define DECLARE_XFORM_GROUP( pfx, sz ) \
+extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS );                \
+extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS );       \
+extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS );      \
+extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS );    \
+extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS );             \
+extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS );      \
+extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS );
+
+#define ASSIGN_XFORM_GROUP( pfx, sz )                                  \
+   _mesa_transform_tab[sz][MATRIX_GENERAL] =                           \
+      _mesa_##pfx##_transform_points##sz##_general;                    \
+   _mesa_transform_tab[sz][MATRIX_IDENTITY] =                          \
+      _mesa_##pfx##_transform_points##sz##_identity;                   \
+   _mesa_transform_tab[sz][MATRIX_3D_NO_ROT] =                         \
+      _mesa_##pfx##_transform_points##sz##_3d_no_rot;                  \
+   _mesa_transform_tab[sz][MATRIX_PERSPECTIVE] =                       \
+      _mesa_##pfx##_transform_points##sz##_perspective;                        \
+   _mesa_transform_tab[sz][MATRIX_2D] =                                        \
+      _mesa_##pfx##_transform_points##sz##_2d;                         \
+   _mesa_transform_tab[sz][MATRIX_2D_NO_ROT] =                         \
+      _mesa_##pfx##_transform_points##sz##_2d_no_rot;                  \
+   _mesa_transform_tab[sz][MATRIX_3D] =                                        \
+      _mesa_##pfx##_transform_points##sz##_3d;
+
+
+/* =============================================================
+ * Normal transformation function declarations:
+ */
+
+#define NORM_ARGS      const GLmatrix *mat,                            \
+                       GLfloat scale,                                  \
+                       const GLvector4f *in,                           \
+                       const GLfloat *lengths,                         \
+                       GLvector4f *dest
+
+#define DECLARE_NORM_GROUP( pfx ) \
+extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS );                                \
+extern void _ASMAPI _mesa_##pfx##_normalize_normals( NORM_ARGS );                      \
+extern void _ASMAPI _mesa_##pfx##_transform_normals( NORM_ARGS );                      \
+extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS );               \
+extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals( NORM_ARGS );              \
+extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS );       \
+extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals( NORM_ARGS );            \
+extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS );
+
+#define ASSIGN_NORM_GROUP( pfx )                                       \
+   _mesa_normal_tab[NORM_RESCALE] =                                    \
+      _mesa_##pfx##_rescale_normals;                                   \
+   _mesa_normal_tab[NORM_NORMALIZE] =                                  \
+      _mesa_##pfx##_normalize_normals;                                 \
+   _mesa_normal_tab[NORM_TRANSFORM] =                                  \
+      _mesa_##pfx##_transform_normals;                                 \
+   _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] =                           \
+      _mesa_##pfx##_transform_normals_no_rot;                          \
+   _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] =                   \
+      _mesa_##pfx##_transform_rescale_normals;                         \
+   _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] =            \
+      _mesa_##pfx##_transform_rescale_normals_no_rot;                  \
+   _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] =                 \
+      _mesa_##pfx##_transform_normalize_normals;                       \
+   _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] =          \
+      _mesa_##pfx##_transform_normalize_normals_no_rot;
+
+
+#endif
diff --git a/windows/VC7/progs/progs.sln b/windows/VC7/progs/progs.sln
new file mode 100644 (file)
index 0000000..4db8338
--- /dev/null
@@ -0,0 +1,29 @@
+Microsoft Visual Studio Solution File, Format Version 8.00\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wglthreads", "wgl\wglthreads.vcproj", "{ADDFBA10-B159-4884-9FAF-5E60A64903AE}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+       EndProjectSection\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sharedtex_mt", "wgl\sharedtex_mt.vcproj", "{ADDFBA10-B159-4884-9FAF-5E60A64903AE}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+       EndProjectSection\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfiguration) = preSolution\r
+               Debug = Debug\r
+               Release = Release\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfiguration) = postSolution\r
+               {ADDFBA10-B159-4884-9FAF-5E60A64903AE}.Debug.ActiveCfg = Debug|Win32\r
+               {ADDFBA10-B159-4884-9FAF-5E60A64903AE}.Debug.Build.0 = Debug|Win32\r
+               {ADDFBA10-B159-4884-9FAF-5E60A64903AE}.Release.ActiveCfg = Release|Win32\r
+               {ADDFBA10-B159-4884-9FAF-5E60A64903AE}.Release.Build.0 = Release|Win32\r
+               {ADDFBA10-B159-4884-9FAF-5E60A64903AE}.Debug.ActiveCfg = Debug|Win32\r
+               {ADDFBA10-B159-4884-9FAF-5E60A64903AE}.Debug.Build.0 = Debug|Win32\r
+               {ADDFBA10-B159-4884-9FAF-5E60A64903AE}.Release.ActiveCfg = Release|Win32\r
+               {ADDFBA10-B159-4884-9FAF-5E60A64903AE}.Release.Build.0 = Release|Win32\r
+       EndGlobalSection\r
+       GlobalSection(ExtensibilityGlobals) = postSolution\r
+       EndGlobalSection\r
+       GlobalSection(ExtensibilityAddIns) = postSolution\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/windows/VC7/progs/wgl/sharedtex_mt.vcproj b/windows/VC7/progs/wgl/sharedtex_mt.vcproj
new file mode 100644 (file)
index 0000000..38edf59
--- /dev/null
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="7.10"\r
+       Name="sharedtex_mt"\r
+       ProjectGUID="{ADDFBA10-B159-4884-9FAF-5E60A64903AE}"\r
+       Keyword="Win32Proj">\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"/>\r
+       </Platforms>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="Debug"\r
+                       IntermediateDirectory="Debug"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="2">\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"\r
+                               MinimalRebuild="TRUE"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="5"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="TRUE"\r
+                               DebugInformationFormat="4"/>\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"/>\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/sharedtex_mt.exe"\r
+                               LinkIncremental="2"\r
+                               GenerateDebugInformation="TRUE"\r
+                               ProgramDatabaseFile="$(OutDir)/sharedtex_mt.pdb"\r
+                               SubSystem="1"\r
+                               TargetMachine="1"/>\r
+                       <Tool\r
+                               Name="VCMIDLTool"/>\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"/>\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"/>\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"/>\r
+                       <Tool\r
+                               Name="VCManagedWrapperGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="Release"\r
+                       IntermediateDirectory="Release"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="2">\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"\r
+                               RuntimeLibrary="4"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="TRUE"\r
+                               DebugInformationFormat="3"/>\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"/>\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/sharedtex_mt.exe"\r
+                               LinkIncremental="1"\r
+                               GenerateDebugInformation="TRUE"\r
+                               SubSystem="1"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               TargetMachine="1"/>\r
+                       <Tool\r
+                               Name="VCMIDLTool"/>\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"/>\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"/>\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"/>\r
+                       <Tool\r
+                               Name="VCManagedWrapperGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="Source Files"\r
+                       Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">\r
+                       <File\r
+                               RelativePath="..\..\..\..\progs\wgl\sharedtex_mt\sharedtex_mt.c">\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Header Files"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">\r
+               </Filter>\r
+               <Filter\r
+                       Name="Resource Files"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
diff --git a/windows/VC7/progs/wgl/wglthreads.vcproj b/windows/VC7/progs/wgl/wglthreads.vcproj
new file mode 100644 (file)
index 0000000..25ea377
--- /dev/null
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="7.10"\r
+       Name="wglthreads"\r
+       ProjectGUID="{ADDFBA10-B159-4884-9FAF-5E60A64903AE}"\r
+       Keyword="Win32Proj">\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"/>\r
+       </Platforms>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="Debug"\r
+                       IntermediateDirectory="Debug"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="2">\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"\r
+                               MinimalRebuild="TRUE"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="5"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="TRUE"\r
+                               DebugInformationFormat="4"/>\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"/>\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/wglthreads.exe"\r
+                               LinkIncremental="2"\r
+                               GenerateDebugInformation="TRUE"\r
+                               ProgramDatabaseFile="$(OutDir)/wglthreads.pdb"\r
+                               SubSystem="1"\r
+                               TargetMachine="1"/>\r
+                       <Tool\r
+                               Name="VCMIDLTool"/>\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"/>\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"/>\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"/>\r
+                       <Tool\r
+                               Name="VCManagedWrapperGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="Release"\r
+                       IntermediateDirectory="Release"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="2">\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"\r
+                               RuntimeLibrary="4"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="TRUE"\r
+                               DebugInformationFormat="3"/>\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"/>\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="$(OutDir)/wglthreads.exe"\r
+                               LinkIncremental="1"\r
+                               GenerateDebugInformation="TRUE"\r
+                               SubSystem="1"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               TargetMachine="1"/>\r
+                       <Tool\r
+                               Name="VCMIDLTool"/>\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"/>\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"/>\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"/>\r
+                       <Tool\r
+                               Name="VCManagedWrapperGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="Source Files"\r
+                       Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">\r
+                       <File\r
+                               RelativePath="..\..\..\..\progs\wgl\wglthreads\wglthreads.c">\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Header Files"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">\r
+               </Filter>\r
+               <Filter\r
+                       Name="Resource Files"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
index 31d5fe54b800344382953374e40d5ecd432762ce..51a837f02198113d528c0012df90bebdac3ac665 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\..\..\..\src\mesa\swrast\s_buffers.c"\r
+                               RelativePath="..\..\..\..\src\mesa\swrast\s_clear.c"\r
                                >\r
                        </File>\r
                        <File\r
                                RelativePath="..\..\..\..\src\mesa\main\shaders.c"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\..\src\mesa\main\shared.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\..\src\mesa\shader\slang\slang_builtin.c"\r
                                >\r
                                RelativePath="..\..\..\..\src\mesa\main\varray.c"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\..\src\mesa\main\viewport.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\..\src\mesa\vbo\vbo_context.c"\r
                                >\r
                                RelativePath="..\..\..\..\src\mesa\main\shaders.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\..\src\mesa\main\shared.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\..\src\mesa\main\simple_list.h"\r
                                >\r
                                RelativePath="..\..\..\..\src\mesa\main\varray.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\..\src\mesa\main\viewport.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\..\src\mesa\vbo\vbo.h"\r
                                >\r