summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2008-02-16 16:30:22 +1100
committerBen Skeggs <[email protected]>2008-02-16 16:30:22 +1100
commit87e3301533aa4d3e6e98db139887ebba3d217f7d (patch)
treead80803f8f90263ea4c9adf9b3e7dd8eae4b05fa
parent49405c43f245d3b3ddd12e891413bf7ead23145c (diff)
parent3320b1874e810583f95b93a89697b2955987b84f (diff)
Merge branch 'upstream-gallium-0.1' into nouveau-gallium-0.1
Conflicts: configs/linux-dri src/mesa/pipe/Makefile
-rw-r--r--configs/beos2
-rw-r--r--configs/darwin2
-rw-r--r--configs/darwin-x86ppc2
-rw-r--r--configs/default2
-rw-r--r--configs/freebsd-dri2
-rw-r--r--configs/linux-cell6
-rw-r--r--configs/linux-directfb2
-rw-r--r--configs/linux-dri6
-rw-r--r--configs/linux-dri-xcb4
-rw-r--r--configs/linux-fbdev2
-rw-r--r--configs/linux-osmesa2
-rw-r--r--configs/linux-osmesa162
-rw-r--r--configs/linux-osmesa16-static2
-rw-r--r--configs/linux-osmesa322
-rw-r--r--configs/linux-solo2
-rw-r--r--progs/trivial/Makefile1
-rw-r--r--progs/trivial/pgon-mode.c136
-rw-r--r--src/gallium/Makefile20
-rw-r--r--src/gallium/Makefile.template (renamed from src/mesa/pipe/Makefile.template)7
-rw-r--r--src/gallium/README.portability (renamed from src/mesa/pipe/README.portability)0
-rw-r--r--src/gallium/SConscript (renamed from src/mesa/pipe/SConscript)0
-rw-r--r--src/gallium/auxiliary/Makefile (renamed from src/mesa/pipe/Makefile)7
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_cache.c (renamed from src/mesa/pipe/cso_cache/cso_cache.c)0
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_cache.h (renamed from src/mesa/pipe/cso_cache/cso_cache.h)0
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_hash.c (renamed from src/mesa/pipe/cso_cache/cso_hash.c)0
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_hash.h (renamed from src/mesa/pipe/cso_cache/cso_hash.h)0
-rw-r--r--src/gallium/auxiliary/draw/Makefile2
-rw-r--r--src/gallium/auxiliary/draw/draw_clip.c (renamed from src/mesa/pipe/draw/draw_clip.c)4
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c (renamed from src/mesa/pipe/draw/draw_context.c)4
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h (renamed from src/mesa/pipe/draw/draw_context.h)0
-rw-r--r--src/gallium/auxiliary/draw/draw_cull.c (renamed from src/mesa/pipe/draw/draw_cull.c)4
-rw-r--r--src/gallium/auxiliary/draw/draw_debug.c (renamed from src/mesa/pipe/draw/draw_debug.c)0
-rw-r--r--src/gallium/auxiliary/draw/draw_flatshade.c (renamed from src/mesa/pipe/draw/draw_flatshade.c)4
-rw-r--r--src/gallium/auxiliary/draw/draw_offset.c (renamed from src/mesa/pipe/draw/draw_offset.c)4
-rw-r--r--src/gallium/auxiliary/draw/draw_prim.c (renamed from src/mesa/pipe/draw/draw_prim.c)0
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h (renamed from src/mesa/pipe/draw/draw_private.h)48
-rw-r--r--src/gallium/auxiliary/draw/draw_stipple.c (renamed from src/mesa/pipe/draw/draw_stipple.c)3
-rw-r--r--src/gallium/auxiliary/draw/draw_twoside.c (renamed from src/mesa/pipe/draw/draw_twoside.c)4
-rw-r--r--src/gallium/auxiliary/draw/draw_unfilled.c (renamed from src/mesa/pipe/draw/draw_unfilled.c)6
-rw-r--r--src/gallium/auxiliary/draw/draw_validate.c (renamed from src/mesa/pipe/draw/draw_validate.c)0
-rw-r--r--src/gallium/auxiliary/draw/draw_vbuf.c (renamed from src/mesa/pipe/draw/draw_vbuf.c)3
-rw-r--r--src/gallium/auxiliary/draw/draw_vbuf.h (renamed from src/mesa/pipe/draw/draw_vbuf.h)0
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex.c (renamed from src/mesa/pipe/draw/draw_vertex.c)4
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex.h (renamed from src/mesa/pipe/draw/draw_vertex.h)7
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex_cache.c (renamed from src/mesa/pipe/draw/draw_vertex_cache.c)0
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex_fetch.c (renamed from src/mesa/pipe/draw/draw_vertex_fetch.c)0
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex_shader.c126
-rw-r--r--src/gallium/auxiliary/draw/draw_vf.c (renamed from src/mesa/pipe/draw/draw_vf.c)2
-rw-r--r--src/gallium/auxiliary/draw/draw_vf.h (renamed from src/mesa/pipe/draw/draw_vf.h)17
-rw-r--r--src/gallium/auxiliary/draw/draw_vf_generic.c (renamed from src/mesa/pipe/draw/draw_vf_generic.c)0
-rw-r--r--src/gallium/auxiliary/draw/draw_vf_sse.c (renamed from src/mesa/pipe/draw/draw_vf_sse.c)0
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.h50
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_exec.c186
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_llvm.c (renamed from src/mesa/pipe/draw/draw_vertex_shader.c)215
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_sse.c251
-rw-r--r--src/gallium/auxiliary/draw/draw_wide_prims.c (renamed from src/mesa/pipe/draw/draw_wide_prims.c)10
-rw-r--r--src/gallium/auxiliary/llvm/Makefile (renamed from src/mesa/pipe/llvm/Makefile)10
-rw-r--r--src/gallium/auxiliary/llvm/gallivm.cpp (renamed from src/mesa/pipe/llvm/gallivm.cpp)11
-rw-r--r--src/gallium/auxiliary/llvm/gallivm.h (renamed from src/mesa/pipe/llvm/gallivm.h)3
-rw-r--r--src/gallium/auxiliary/llvm/gallivm_builtins.cpp (renamed from src/mesa/pipe/llvm/gallivm_builtins.cpp)0
-rw-r--r--src/gallium/auxiliary/llvm/gallivm_cpu.cpp (renamed from src/mesa/pipe/llvm/gallivm_cpu.cpp)18
-rw-r--r--src/gallium/auxiliary/llvm/gallivm_p.h110
-rw-r--r--src/gallium/auxiliary/llvm/instructions.cpp (renamed from src/mesa/pipe/llvm/instructions.cpp)0
-rw-r--r--src/gallium/auxiliary/llvm/instructions.h (renamed from src/mesa/pipe/llvm/instructions.h)0
-rw-r--r--src/gallium/auxiliary/llvm/instructionssoa.cpp121
-rw-r--r--src/gallium/auxiliary/llvm/instructionssoa.h (renamed from src/mesa/pipe/llvm/instructionssoa.h)19
-rw-r--r--src/gallium/auxiliary/llvm/llvm_builtins.c (renamed from src/mesa/pipe/llvm/llvm_builtins.c)0
-rw-r--r--src/gallium/auxiliary/llvm/loweringpass.cpp (renamed from src/mesa/pipe/llvm/loweringpass.cpp)0
-rw-r--r--src/gallium/auxiliary/llvm/loweringpass.h (renamed from src/mesa/pipe/llvm/loweringpass.h)0
-rw-r--r--src/gallium/auxiliary/llvm/storage.cpp (renamed from src/mesa/pipe/llvm/storage.cpp)10
-rw-r--r--src/gallium/auxiliary/llvm/storage.h (renamed from src/mesa/pipe/llvm/storage.h)0
-rw-r--r--src/gallium/auxiliary/llvm/storagesoa.cpp389
-rw-r--r--src/gallium/auxiliary/llvm/storagesoa.h111
-rw-r--r--src/gallium/auxiliary/llvm/tgsitollvm.cpp (renamed from src/mesa/pipe/llvm/tgsitollvm.cpp)103
-rw-r--r--src/gallium/auxiliary/llvm/tgsitollvm.h (renamed from src/mesa/pipe/llvm/tgsitollvm.h)0
-rw-r--r--src/gallium/auxiliary/pipebuffer/Makefile (renamed from src/mesa/pipe/pipebuffer/Makefile)2
-rw-r--r--src/gallium/auxiliary/pipebuffer/linked_list.h (renamed from src/mesa/pipe/pipebuffer/linked_list.h)0
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer.h (renamed from src/mesa/pipe/pipebuffer/pb_buffer.h)0
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c (renamed from src/mesa/pipe/pipebuffer/pb_buffer_fenced.c)0
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h (renamed from src/mesa/pipe/pipebuffer/pb_buffer_fenced.h)0
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c (renamed from src/mesa/pipe/pipebuffer/pb_buffer_malloc.c)4
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr.h (renamed from src/mesa/pipe/pipebuffer/pb_bufmgr.h)0
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c (renamed from src/mesa/pipe/pipebuffer/pb_bufmgr_fenced.c)0
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c (renamed from src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c)0
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c (renamed from src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c)0
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_winsys.c (renamed from src/mesa/pipe/pipebuffer/pb_winsys.c)0
-rw-r--r--src/gallium/auxiliary/tgsi/Makefile (renamed from src/mesa/pipe/tgsi/Makefile)0
-rw-r--r--src/gallium/auxiliary/tgsi/exec/Makefile (renamed from src/mesa/pipe/tgsi/exec/Makefile)0
-rw-r--r--src/gallium/auxiliary/tgsi/exec/tgsi_exec.c (renamed from src/mesa/pipe/tgsi/exec/tgsi_exec.c)114
-rw-r--r--src/gallium/auxiliary/tgsi/exec/tgsi_exec.h (renamed from src/mesa/pipe/tgsi/exec/tgsi_exec.h)8
-rwxr-xr-xsrc/gallium/auxiliary/tgsi/exec/tgsi_sse2.c (renamed from src/mesa/pipe/tgsi/exec/tgsi_sse2.c)229
-rwxr-xr-xsrc/gallium/auxiliary/tgsi/exec/tgsi_sse2.h (renamed from src/mesa/pipe/tgsi/exec/tgsi_sse2.h)0
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_build.c (renamed from src/mesa/pipe/tgsi/util/tgsi_build.c)0
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_build.h (renamed from src/mesa/pipe/tgsi/util/tgsi_build.h)0
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_dump.c (renamed from src/mesa/pipe/tgsi/util/tgsi_dump.c)0
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_dump.h (renamed from src/mesa/pipe/tgsi/util/tgsi_dump.h)0
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_parse.c (renamed from src/mesa/pipe/tgsi/util/tgsi_parse.c)0
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_parse.h (renamed from src/mesa/pipe/tgsi/util/tgsi_parse.h)0
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_transform.c199
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_transform.h93
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_util.c (renamed from src/mesa/pipe/tgsi/util/tgsi_util.c)0
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_util.h (renamed from src/mesa/pipe/tgsi/util/tgsi_util.h)0
-rw-r--r--src/gallium/auxiliary/util/p_debug.c (renamed from src/mesa/pipe/util/p_debug.c)0
-rw-r--r--src/gallium/auxiliary/util/p_tile.c (renamed from src/mesa/pipe/util/p_tile.c)0
-rw-r--r--src/gallium/auxiliary/util/p_tile.h (renamed from src/mesa/pipe/util/p_tile.h)0
-rw-r--r--src/gallium/auxiliary/util/p_util.c (renamed from src/mesa/pipe/util/p_util.c)4
-rw-r--r--src/gallium/drivers/Makefile24
-rw-r--r--src/gallium/drivers/cell/Makefile (renamed from src/mesa/pipe/cell/Makefile)0
-rw-r--r--src/gallium/drivers/cell/common.h (renamed from src/mesa/pipe/cell/common.h)15
-rw-r--r--src/gallium/drivers/cell/ppu/Makefile (renamed from src/mesa/pipe/cell/ppu/Makefile)8
-rw-r--r--src/gallium/drivers/cell/ppu/cell_batch.c (renamed from src/mesa/pipe/cell/ppu/cell_batch.c)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_batch.h (renamed from src/mesa/pipe/cell/ppu/cell_batch.h)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_clear.c (renamed from src/mesa/pipe/cell/ppu/cell_clear.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_clear.h (renamed from src/mesa/pipe/cell/ppu/cell_clear.h)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.c (renamed from src/mesa/pipe/cell/ppu/cell_context.c)6
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.h (renamed from src/mesa/pipe/cell/ppu/cell_context.h)10
-rw-r--r--src/gallium/drivers/cell/ppu/cell_draw_arrays.c (renamed from src/mesa/pipe/cell/ppu/cell_draw_arrays.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_draw_arrays.h (renamed from src/mesa/pipe/cell/ppu/cell_draw_arrays.h)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_flush.c (renamed from src/mesa/pipe/cell/ppu/cell_flush.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_flush.h (renamed from src/mesa/pipe/cell/ppu/cell_flush.h)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_render.c (renamed from src/mesa/pipe/cell/ppu/cell_render.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_render.h (renamed from src/mesa/pipe/cell/ppu/cell_render.h)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_spu.c (renamed from src/mesa/pipe/cell/ppu/cell_spu.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_spu.h (renamed from src/mesa/pipe/cell/ppu/cell_spu.h)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state.h (renamed from src/mesa/pipe/cell/ppu/cell_state.h)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_blend.c (renamed from src/mesa/pipe/cell/ppu/cell_state_blend.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_clip.c (renamed from src/mesa/pipe/cell/ppu/cell_state_clip.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_derived.c (renamed from src/mesa/pipe/cell/ppu/cell_state_derived.c)4
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_emit.c (renamed from src/mesa/pipe/cell/ppu/cell_state_emit.c)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_emit.h (renamed from src/mesa/pipe/cell/ppu/cell_state_emit.h)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_fs.c (renamed from src/mesa/pipe/cell/ppu/cell_state_fs.c)8
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_rasterizer.c (renamed from src/mesa/pipe/cell/ppu/cell_state_rasterizer.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_sampler.c (renamed from src/mesa/pipe/cell/ppu/cell_state_sampler.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_surface.c (renamed from src/mesa/pipe/cell/ppu/cell_state_surface.c)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_vertex.c (renamed from src/mesa/pipe/cell/ppu/cell_state_vertex.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_surface.c (renamed from src/mesa/pipe/cell/ppu/cell_surface.c)7
-rw-r--r--src/gallium/drivers/cell/ppu/cell_surface.h (renamed from src/mesa/pipe/cell/ppu/cell_surface.h)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_texture.c (renamed from src/mesa/pipe/cell/ppu/cell_texture.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_texture.h (renamed from src/mesa/pipe/cell/ppu/cell_texture.h)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_vbuf.c (renamed from src/mesa/pipe/cell/ppu/cell_vbuf.c)2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_vbuf.h (renamed from src/mesa/pipe/cell/ppu/cell_vbuf.h)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_vertex_fetch.c383
-rw-r--r--src/gallium/drivers/cell/ppu/cell_vertex_shader.c (renamed from src/mesa/pipe/cell/ppu/cell_vertex_shader.c)27
-rw-r--r--src/gallium/drivers/cell/ppu/cell_winsys.c (renamed from src/mesa/pipe/cell/ppu/cell_winsys.c)0
-rw-r--r--src/gallium/drivers/cell/ppu/cell_winsys.h (renamed from src/mesa/pipe/cell/ppu/cell_winsys.h)0
-rw-r--r--src/gallium/drivers/cell/spu/Makefile (renamed from src/mesa/pipe/cell/spu/Makefile)6
-rw-r--r--src/gallium/drivers/cell/spu/spu_blend.c (renamed from src/mesa/pipe/cell/spu/spu_blend.c)0
-rw-r--r--src/gallium/drivers/cell/spu/spu_blend.h (renamed from src/mesa/pipe/cell/spu/spu_blend.h)0
-rw-r--r--src/gallium/drivers/cell/spu/spu_colorpack.h (renamed from src/mesa/pipe/cell/spu/spu_colorpack.h)0
-rw-r--r--src/gallium/drivers/cell/spu/spu_exec.c (renamed from src/mesa/pipe/cell/spu/spu_exec.c)4
-rw-r--r--src/gallium/drivers/cell/spu/spu_exec.h (renamed from src/mesa/pipe/cell/spu/spu_exec.h)2
-rw-r--r--src/gallium/drivers/cell/spu/spu_main.c (renamed from src/mesa/pipe/cell/spu/spu_main.c)24
-rw-r--r--src/gallium/drivers/cell/spu/spu_main.h (renamed from src/mesa/pipe/cell/spu/spu_main.h)4
-rw-r--r--src/gallium/drivers/cell/spu/spu_render.c (renamed from src/mesa/pipe/cell/spu/spu_render.c)2
-rw-r--r--src/gallium/drivers/cell/spu/spu_render.h (renamed from src/mesa/pipe/cell/spu/spu_render.h)2
-rw-r--r--src/gallium/drivers/cell/spu/spu_texture.c (renamed from src/mesa/pipe/cell/spu/spu_texture.c)0
-rw-r--r--src/gallium/drivers/cell/spu/spu_texture.h (renamed from src/mesa/pipe/cell/spu/spu_texture.h)0
-rw-r--r--src/gallium/drivers/cell/spu/spu_tile.c (renamed from src/mesa/pipe/cell/spu/spu_tile.c)0
-rw-r--r--src/gallium/drivers/cell/spu/spu_tile.h (renamed from src/mesa/pipe/cell/spu/spu_tile.h)2
-rw-r--r--src/gallium/drivers/cell/spu/spu_tri.c (renamed from src/mesa/pipe/cell/spu/spu_tri.c)0
-rw-r--r--src/gallium/drivers/cell/spu/spu_tri.h (renamed from src/mesa/pipe/cell/spu/spu_tri.h)0
-rw-r--r--src/gallium/drivers/cell/spu/spu_util.c (renamed from src/mesa/pipe/cell/spu/spu_util.c)4
-rw-r--r--src/gallium/drivers/cell/spu/spu_vertex_fetch.c214
-rw-r--r--src/gallium/drivers/cell/spu/spu_vertex_shader.c (renamed from src/mesa/pipe/cell/spu/spu_vertex_shader.c)6
-rw-r--r--src/gallium/drivers/cell/spu/spu_vertex_shader.h (renamed from src/mesa/pipe/cell/spu/spu_vertex_shader.h)6
-rw-r--r--src/gallium/drivers/cell/spu/spu_ztest.h (renamed from src/mesa/pipe/cell/spu/spu_ztest.h)0
-rw-r--r--src/gallium/drivers/failover/Makefile (renamed from src/mesa/pipe/failover/Makefile)2
-rw-r--r--src/gallium/drivers/failover/fo_context.c (renamed from src/mesa/pipe/failover/fo_context.c)0
-rw-r--r--src/gallium/drivers/failover/fo_context.h (renamed from src/mesa/pipe/failover/fo_context.h)0
-rw-r--r--src/gallium/drivers/failover/fo_state.c (renamed from src/mesa/pipe/failover/fo_state.c)0
-rw-r--r--src/gallium/drivers/failover/fo_state_emit.c (renamed from src/mesa/pipe/failover/fo_state_emit.c)0
-rw-r--r--src/gallium/drivers/failover/fo_winsys.h (renamed from src/mesa/pipe/failover/fo_winsys.h)0
-rw-r--r--src/gallium/drivers/i915simple/Makefile (renamed from src/mesa/pipe/i915simple/Makefile)2
-rw-r--r--src/gallium/drivers/i915simple/SConscript (renamed from src/mesa/pipe/i915simple/SConscript)0
-rw-r--r--src/gallium/drivers/i915simple/i915_batch.h (renamed from src/mesa/pipe/i915simple/i915_batch.h)0
-rw-r--r--src/gallium/drivers/i915simple/i915_blit.c (renamed from src/mesa/pipe/i915simple/i915_blit.c)1
-rw-r--r--src/gallium/drivers/i915simple/i915_blit.h (renamed from src/mesa/pipe/i915simple/i915_blit.h)1
-rw-r--r--src/gallium/drivers/i915simple/i915_clear.c (renamed from src/mesa/pipe/i915simple/i915_clear.c)0
-rw-r--r--src/gallium/drivers/i915simple/i915_context.c (renamed from src/mesa/pipe/i915simple/i915_context.c)2
-rw-r--r--src/gallium/drivers/i915simple/i915_context.h (renamed from src/mesa/pipe/i915simple/i915_context.h)2
-rw-r--r--src/gallium/drivers/i915simple/i915_debug.c (renamed from src/mesa/pipe/i915simple/i915_debug.c)0
-rw-r--r--src/gallium/drivers/i915simple/i915_debug.h (renamed from src/mesa/pipe/i915simple/i915_debug.h)0
-rw-r--r--src/gallium/drivers/i915simple/i915_debug_fp.c (renamed from src/mesa/pipe/i915simple/i915_debug_fp.c)0
-rw-r--r--src/gallium/drivers/i915simple/i915_flush.c (renamed from src/mesa/pipe/i915simple/i915_flush.c)0
-rw-r--r--src/gallium/drivers/i915simple/i915_fpc.h (renamed from src/mesa/pipe/i915simple/i915_fpc.h)0
-rw-r--r--src/gallium/drivers/i915simple/i915_fpc_emit.c (renamed from src/mesa/pipe/i915simple/i915_fpc_emit.c)0
-rw-r--r--src/gallium/drivers/i915simple/i915_fpc_translate.c (renamed from src/mesa/pipe/i915simple/i915_fpc_translate.c)4
-rw-r--r--src/gallium/drivers/i915simple/i915_prim_emit.c (renamed from src/mesa/pipe/i915simple/i915_prim_emit.c)2
-rw-r--r--src/gallium/drivers/i915simple/i915_prim_vbuf.c (renamed from src/mesa/pipe/i915simple/i915_prim_vbuf.c)2
-rw-r--r--src/gallium/drivers/i915simple/i915_reg.h (renamed from src/mesa/pipe/i915simple/i915_reg.h)0
-rw-r--r--src/gallium/drivers/i915simple/i915_state.c (renamed from src/mesa/pipe/i915simple/i915_state.c)2
-rw-r--r--src/gallium/drivers/i915simple/i915_state.h (renamed from src/mesa/pipe/i915simple/i915_state.h)0
-rw-r--r--src/gallium/drivers/i915simple/i915_state_derived.c (renamed from src/mesa/pipe/i915simple/i915_state_derived.c)4
-rw-r--r--src/gallium/drivers/i915simple/i915_state_dynamic.c (renamed from src/mesa/pipe/i915simple/i915_state_dynamic.c)0
-rw-r--r--src/gallium/drivers/i915simple/i915_state_emit.c (renamed from src/mesa/pipe/i915simple/i915_state_emit.c)0
-rw-r--r--src/gallium/drivers/i915simple/i915_state_immediate.c (renamed from src/mesa/pipe/i915simple/i915_state_immediate.c)0
-rw-r--r--src/gallium/drivers/i915simple/i915_state_inlines.h (renamed from src/mesa/pipe/i915simple/i915_state_inlines.h)0
-rw-r--r--src/gallium/drivers/i915simple/i915_state_sampler.c (renamed from src/mesa/pipe/i915simple/i915_state_sampler.c)0
-rw-r--r--src/gallium/drivers/i915simple/i915_strings.c (renamed from src/mesa/pipe/i915simple/i915_strings.c)2
-rw-r--r--src/gallium/drivers/i915simple/i915_surface.c (renamed from src/mesa/pipe/i915simple/i915_surface.c)8
-rw-r--r--src/gallium/drivers/i915simple/i915_texture.c (renamed from src/mesa/pipe/i915simple/i915_texture.c)0
-rw-r--r--src/gallium/drivers/i915simple/i915_texture.h (renamed from src/mesa/pipe/i915simple/i915_texture.h)0
-rw-r--r--src/gallium/drivers/i915simple/i915_winsys.h (renamed from src/mesa/pipe/i915simple/i915_winsys.h)0
-rw-r--r--src/gallium/drivers/i965simple/Makefile (renamed from src/mesa/pipe/i965simple/Makefile)2
-rw-r--r--src/gallium/drivers/i965simple/SConscript (renamed from src/mesa/pipe/i965simple/SConscript)0
-rw-r--r--src/gallium/drivers/i965simple/brw_batch.h (renamed from src/mesa/pipe/i965simple/brw_batch.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_blit.c (renamed from src/mesa/pipe/i965simple/brw_blit.c)1
-rw-r--r--src/gallium/drivers/i965simple/brw_blit.h (renamed from src/mesa/pipe/i965simple/brw_blit.h)1
-rw-r--r--src/gallium/drivers/i965simple/brw_cc.c (renamed from src/mesa/pipe/i965simple/brw_cc.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_clip.c (renamed from src/mesa/pipe/i965simple/brw_clip.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_clip.h (renamed from src/mesa/pipe/i965simple/brw_clip.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_clip_line.c (renamed from src/mesa/pipe/i965simple/brw_clip_line.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_clip_point.c (renamed from src/mesa/pipe/i965simple/brw_clip_point.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_clip_state.c (renamed from src/mesa/pipe/i965simple/brw_clip_state.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_clip_tri.c (renamed from src/mesa/pipe/i965simple/brw_clip_tri.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_clip_unfilled.c (renamed from src/mesa/pipe/i965simple/brw_clip_unfilled.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_clip_util.c (renamed from src/mesa/pipe/i965simple/brw_clip_util.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_context.c (renamed from src/mesa/pipe/i965simple/brw_context.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_context.h (renamed from src/mesa/pipe/i965simple/brw_context.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_curbe.c (renamed from src/mesa/pipe/i965simple/brw_curbe.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_defines.h (renamed from src/mesa/pipe/i965simple/brw_defines.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_draw.c (renamed from src/mesa/pipe/i965simple/brw_draw.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_draw.h (renamed from src/mesa/pipe/i965simple/brw_draw.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_draw_upload.c (renamed from src/mesa/pipe/i965simple/brw_draw_upload.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_eu.c (renamed from src/mesa/pipe/i965simple/brw_eu.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_eu.h (renamed from src/mesa/pipe/i965simple/brw_eu.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_eu_debug.c (renamed from src/mesa/pipe/i965simple/brw_eu_debug.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_eu_emit.c (renamed from src/mesa/pipe/i965simple/brw_eu_emit.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_eu_util.c (renamed from src/mesa/pipe/i965simple/brw_eu_util.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_flush.c (renamed from src/mesa/pipe/i965simple/brw_flush.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_gs.c (renamed from src/mesa/pipe/i965simple/brw_gs.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_gs.h (renamed from src/mesa/pipe/i965simple/brw_gs.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_gs_emit.c (renamed from src/mesa/pipe/i965simple/brw_gs_emit.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_gs_state.c (renamed from src/mesa/pipe/i965simple/brw_gs_state.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_misc_state.c (renamed from src/mesa/pipe/i965simple/brw_misc_state.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_reg.h (renamed from src/mesa/pipe/i965simple/brw_reg.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_sf.c (renamed from src/mesa/pipe/i965simple/brw_sf.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_sf.h (renamed from src/mesa/pipe/i965simple/brw_sf.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_sf_emit.c (renamed from src/mesa/pipe/i965simple/brw_sf_emit.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_sf_state.c (renamed from src/mesa/pipe/i965simple/brw_sf_state.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_shader_info.c (renamed from src/mesa/pipe/i965simple/brw_shader_info.c)2
-rw-r--r--src/gallium/drivers/i965simple/brw_state.c (renamed from src/mesa/pipe/i965simple/brw_state.c)2
-rw-r--r--src/gallium/drivers/i965simple/brw_state.h (renamed from src/mesa/pipe/i965simple/brw_state.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_state_batch.c (renamed from src/mesa/pipe/i965simple/brw_state_batch.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_state_cache.c (renamed from src/mesa/pipe/i965simple/brw_state_cache.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_state_pool.c (renamed from src/mesa/pipe/i965simple/brw_state_pool.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_state_upload.c (renamed from src/mesa/pipe/i965simple/brw_state_upload.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_strings.c (renamed from src/mesa/pipe/i965simple/brw_strings.c)2
-rw-r--r--src/gallium/drivers/i965simple/brw_structs.h (renamed from src/mesa/pipe/i965simple/brw_structs.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_surface.c (renamed from src/mesa/pipe/i965simple/brw_surface.c)8
-rw-r--r--src/gallium/drivers/i965simple/brw_tex_layout.c (renamed from src/mesa/pipe/i965simple/brw_tex_layout.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_tex_layout.h (renamed from src/mesa/pipe/i965simple/brw_tex_layout.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_urb.c (renamed from src/mesa/pipe/i965simple/brw_urb.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_util.c (renamed from src/mesa/pipe/i965simple/brw_util.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_util.h (renamed from src/mesa/pipe/i965simple/brw_util.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_vs.c (renamed from src/mesa/pipe/i965simple/brw_vs.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_vs.h (renamed from src/mesa/pipe/i965simple/brw_vs.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_vs_emit.c (renamed from src/mesa/pipe/i965simple/brw_vs_emit.c)2
-rw-r--r--src/gallium/drivers/i965simple/brw_vs_state.c (renamed from src/mesa/pipe/i965simple/brw_vs_state.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_winsys.h (renamed from src/mesa/pipe/i965simple/brw_winsys.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_wm.c (renamed from src/mesa/pipe/i965simple/brw_wm.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_wm.h (renamed from src/mesa/pipe/i965simple/brw_wm.h)0
-rw-r--r--src/gallium/drivers/i965simple/brw_wm_decl.c (renamed from src/mesa/pipe/i965simple/brw_wm_decl.c)2
-rw-r--r--src/gallium/drivers/i965simple/brw_wm_glsl.c (renamed from src/mesa/pipe/i965simple/brw_wm_glsl.c)2
-rw-r--r--src/gallium/drivers/i965simple/brw_wm_iz.c (renamed from src/mesa/pipe/i965simple/brw_wm_iz.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_wm_sampler_state.c (renamed from src/mesa/pipe/i965simple/brw_wm_sampler_state.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_wm_state.c (renamed from src/mesa/pipe/i965simple/brw_wm_state.c)0
-rw-r--r--src/gallium/drivers/i965simple/brw_wm_surface_state.c (renamed from src/mesa/pipe/i965simple/brw_wm_surface_state.c)0
-rw-r--r--src/gallium/drivers/softpipe/Makefile (renamed from src/mesa/pipe/softpipe/Makefile)5
-rw-r--r--src/gallium/drivers/softpipe/SConscript (renamed from src/mesa/pipe/softpipe/SConscript)0
-rw-r--r--src/gallium/drivers/softpipe/sp_clear.c (renamed from src/mesa/pipe/softpipe/sp_clear.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_clear.h (renamed from src/mesa/pipe/softpipe/sp_clear.h)0
-rw-r--r--src/gallium/drivers/softpipe/sp_context.c (renamed from src/mesa/pipe/softpipe/sp_context.c)2
-rw-r--r--src/gallium/drivers/softpipe/sp_context.h (renamed from src/mesa/pipe/softpipe/sp_context.h)10
-rw-r--r--src/gallium/drivers/softpipe/sp_draw_arrays.c (renamed from src/mesa/pipe/softpipe/sp_draw_arrays.c)2
-rw-r--r--src/gallium/drivers/softpipe/sp_flush.c (renamed from src/mesa/pipe/softpipe/sp_flush.c)3
-rw-r--r--src/gallium/drivers/softpipe/sp_flush.h (renamed from src/mesa/pipe/softpipe/sp_flush.h)0
-rw-r--r--src/gallium/drivers/softpipe/sp_fs.h (renamed from src/mesa/pipe/llvm/storagesoa.h)61
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_exec.c112
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_llvm.c200
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_sse.c192
-rw-r--r--src/gallium/drivers/softpipe/sp_headers.h (renamed from src/mesa/pipe/softpipe/sp_headers.h)2
-rw-r--r--src/gallium/drivers/softpipe/sp_prim_setup.c (renamed from src/mesa/pipe/softpipe/sp_prim_setup.c)25
-rw-r--r--src/gallium/drivers/softpipe/sp_prim_setup.h (renamed from src/mesa/pipe/softpipe/sp_prim_setup.h)0
-rw-r--r--src/gallium/drivers/softpipe/sp_prim_vbuf.c (renamed from src/mesa/pipe/softpipe/sp_prim_vbuf.c)11
-rw-r--r--src/gallium/drivers/softpipe/sp_prim_vbuf.h (renamed from src/mesa/pipe/softpipe/sp_prim_vbuf.h)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad.c (renamed from src/mesa/pipe/softpipe/sp_quad.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad.h (renamed from src/mesa/pipe/softpipe/sp_quad.h)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_alpha_test.c (renamed from src/mesa/pipe/softpipe/sp_quad_alpha_test.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_blend.c (renamed from src/mesa/pipe/softpipe/sp_quad_blend.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_bufloop.c (renamed from src/mesa/pipe/softpipe/sp_quad_bufloop.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_colormask.c (renamed from src/mesa/pipe/softpipe/sp_quad_colormask.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_coverage.c (renamed from src/mesa/pipe/softpipe/sp_quad_coverage.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_depth_test.c (renamed from src/mesa/pipe/softpipe/sp_quad_depth_test.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_earlyz.c (renamed from src/mesa/pipe/softpipe/sp_quad_earlyz.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_fs.c (renamed from src/mesa/pipe/softpipe/sp_quad_fs.c)198
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_occlusion.c (renamed from src/mesa/pipe/softpipe/sp_quad_occlusion.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_output.c (renamed from src/mesa/pipe/softpipe/sp_quad_output.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_stencil.c (renamed from src/mesa/pipe/softpipe/sp_quad_stencil.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_stipple.c (renamed from src/mesa/pipe/softpipe/sp_quad_stipple.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_query.c (renamed from src/mesa/pipe/softpipe/sp_query.c)2
-rw-r--r--src/gallium/drivers/softpipe/sp_query.h (renamed from src/mesa/pipe/softpipe/sp_query.h)0
-rw-r--r--src/gallium/drivers/softpipe/sp_state.h (renamed from src/mesa/pipe/softpipe/sp_state.h)46
-rw-r--r--src/gallium/drivers/softpipe/sp_state_blend.c (renamed from src/mesa/pipe/softpipe/sp_state_blend.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_state_clip.c (renamed from src/mesa/pipe/softpipe/sp_state_clip.c)2
-rw-r--r--src/gallium/drivers/softpipe/sp_state_derived.c235
-rw-r--r--src/gallium/drivers/softpipe/sp_state_fs.c (renamed from src/mesa/pipe/softpipe/sp_state_fs.c)71
-rw-r--r--src/gallium/drivers/softpipe/sp_state_rasterizer.c (renamed from src/mesa/pipe/softpipe/sp_state_rasterizer.c)2
-rw-r--r--src/gallium/drivers/softpipe/sp_state_sampler.c (renamed from src/mesa/pipe/softpipe/sp_state_sampler.c)6
-rw-r--r--src/gallium/drivers/softpipe/sp_state_surface.c (renamed from src/mesa/pipe/softpipe/sp_state_surface.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_state_vertex.c (renamed from src/mesa/pipe/softpipe/sp_state_vertex.c)2
-rw-r--r--src/gallium/drivers/softpipe/sp_surface.c (renamed from src/mesa/pipe/softpipe/sp_surface.c)7
-rw-r--r--src/gallium/drivers/softpipe/sp_surface.h (renamed from src/mesa/pipe/softpipe/sp_surface.h)0
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c (renamed from src/mesa/pipe/softpipe/sp_tex_sample.c)2
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.h (renamed from src/mesa/pipe/softpipe/sp_tex_sample.h)0
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c (renamed from src/mesa/pipe/softpipe/sp_texture.c)0
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.h (renamed from src/mesa/pipe/softpipe/sp_texture.h)0
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c (renamed from src/mesa/pipe/softpipe/sp_tile_cache.c)2
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.h (renamed from src/mesa/pipe/softpipe/sp_tile_cache.h)0
-rw-r--r--src/gallium/drivers/softpipe/sp_winsys.h (renamed from src/mesa/pipe/softpipe/sp_winsys.h)0
-rw-r--r--src/gallium/include/pipe/p_compiler.h (renamed from src/mesa/pipe/p_compiler.h)0
-rw-r--r--src/gallium/include/pipe/p_context.h (renamed from src/mesa/pipe/p_context.h)1
-rw-r--r--src/gallium/include/pipe/p_debug.h (renamed from src/mesa/pipe/p_debug.h)0
-rw-r--r--src/gallium/include/pipe/p_defines.h (renamed from src/mesa/pipe/p_defines.h)0
-rw-r--r--src/gallium/include/pipe/p_format.h (renamed from src/mesa/pipe/p_format.h)0
-rw-r--r--src/gallium/include/pipe/p_inlines.h (renamed from src/mesa/pipe/p_inlines.h)0
-rw-r--r--src/gallium/include/pipe/p_shader_tokens.h (renamed from src/mesa/pipe/p_shader_tokens.h)0
-rw-r--r--src/gallium/include/pipe/p_state.h (renamed from src/mesa/pipe/p_state.h)16
-rw-r--r--src/gallium/include/pipe/p_thread.h (renamed from src/mesa/pipe/p_thread.h)0
-rw-r--r--src/gallium/include/pipe/p_util.h (renamed from src/mesa/pipe/p_util.h)6
-rw-r--r--src/gallium/include/pipe/p_winsys.h (renamed from src/mesa/pipe/p_winsys.h)0
-rw-r--r--src/gallium/state_trackers/README2
-rw-r--r--src/gallium/winsys/dri/Makefile38
-rw-r--r--src/gallium/winsys/dri/Makefile.template113
-rw-r--r--src/gallium/winsys/dri/intel/Makefile (renamed from src/mesa/drivers/dri/intel_winsys/Makefile)8
-rw-r--r--src/gallium/winsys/dri/intel/SConscript (renamed from src/mesa/drivers/dri/intel_winsys/SConscript)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_batchbuffer.c (renamed from src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_batchbuffer.h (renamed from src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_batchpool.c (renamed from src/mesa/drivers/dri/intel_winsys/intel_batchpool.c)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_batchpool.h (renamed from src/mesa/drivers/dri/intel_winsys/intel_batchpool.h)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_context.c (renamed from src/mesa/drivers/dri/intel_winsys/intel_context.c)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_context.h (renamed from src/mesa/drivers/dri/intel_winsys/intel_context.h)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_lock.c (renamed from src/mesa/drivers/dri/intel_winsys/intel_lock.c)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_reg.h (renamed from src/mesa/drivers/dri/intel_winsys/intel_reg.h)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_screen.c (renamed from src/mesa/drivers/dri/intel_winsys/intel_screen.c)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_screen.h (renamed from src/mesa/drivers/dri/intel_winsys/intel_screen.h)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_swapbuffers.c (renamed from src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c)1
-rw-r--r--src/gallium/winsys/dri/intel/intel_swapbuffers.h (renamed from src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.h)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_winsys.h (renamed from src/mesa/drivers/dri/intel_winsys/intel_winsys.h)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_winsys_i915.c (renamed from src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c)2
-rw-r--r--src/gallium/winsys/dri/intel/intel_winsys_pipe.c (renamed from src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c)0
-rw-r--r--src/gallium/winsys/dri/intel/intel_winsys_softpipe.c (renamed from src/mesa/drivers/dri/intel_winsys/intel_winsys_softpipe.c)2
-rw-r--r--src/gallium/winsys/dri/intel/server/i830_common.h (renamed from src/mesa/drivers/dri/intel_winsys/server/i830_common.h)0
-rw-r--r--src/gallium/winsys/dri/intel/server/i830_dri.h (renamed from src/mesa/drivers/dri/intel_winsys/server/i830_dri.h)0
-rw-r--r--src/gallium/winsys/dri/intel/server/intel.h (renamed from src/mesa/drivers/dri/intel_winsys/server/intel.h)0
-rw-r--r--src/gallium/winsys/dri/intel/server/intel_dri.c (renamed from src/mesa/drivers/dri/intel_winsys/server/intel_dri.c)0
-rw-r--r--src/gallium/winsys/xlib/brw_aub.c (renamed from src/mesa/pipe/xlib/brw_aub.c)0
-rw-r--r--src/gallium/winsys/xlib/brw_aub.h (renamed from src/mesa/pipe/xlib/brw_aub.h)0
-rw-r--r--src/gallium/winsys/xlib/fakeglx.c (renamed from src/mesa/pipe/xlib/fakeglx.c)0
-rw-r--r--src/gallium/winsys/xlib/glxapi.c (renamed from src/mesa/pipe/xlib/glxapi.c)0
-rw-r--r--src/gallium/winsys/xlib/glxapi.h (renamed from src/mesa/pipe/xlib/glxapi.h)0
-rw-r--r--src/gallium/winsys/xlib/glxheader.h (renamed from src/mesa/pipe/xlib/glxheader.h)0
-rw-r--r--src/gallium/winsys/xlib/realglx.c (renamed from src/mesa/pipe/xlib/realglx.c)0
-rw-r--r--src/gallium/winsys/xlib/realglx.h (renamed from src/mesa/pipe/xlib/realglx.h)0
-rw-r--r--src/gallium/winsys/xlib/xfonts.c (renamed from src/mesa/pipe/xlib/xfonts.c)0
-rw-r--r--src/gallium/winsys/xlib/xfonts.h (renamed from src/mesa/pipe/xlib/xfonts.h)0
-rw-r--r--src/gallium/winsys/xlib/xm_api.c (renamed from src/mesa/pipe/xlib/xm_api.c)1
-rw-r--r--src/gallium/winsys/xlib/xm_image.c (renamed from src/mesa/pipe/xlib/xm_image.c)0
-rw-r--r--src/gallium/winsys/xlib/xm_image.h (renamed from src/mesa/pipe/xlib/xm_image.h)0
-rw-r--r--src/gallium/winsys/xlib/xm_winsys.c (renamed from src/mesa/pipe/xlib/xm_winsys.c)6
-rw-r--r--src/gallium/winsys/xlib/xm_winsys_aub.c (renamed from src/mesa/pipe/xlib/xm_winsys_aub.c)2
-rw-r--r--src/gallium/winsys/xlib/xm_winsys_aub.h (renamed from src/mesa/pipe/xlib/xm_winsys_aub.h)0
-rw-r--r--src/gallium/winsys/xlib/xmesaP.h (renamed from src/mesa/pipe/xlib/xmesaP.h)0
-rw-r--r--src/mesa/Makefile16
-rw-r--r--src/mesa/drivers/x11/xm_api.c2
-rw-r--r--src/mesa/drivers/x11/xm_dd.c2
-rw-r--r--src/mesa/drivers/x11/xm_surface.c8
-rw-r--r--src/mesa/drivers/x11/xm_winsys.c2
-rw-r--r--src/mesa/drivers/x11/xmesaP.h4
-rw-r--r--src/mesa/pipe/cell/spu/spu_vertex_fetch.c393
-rw-r--r--src/mesa/pipe/draw/Makefile2
-rw-r--r--src/mesa/pipe/llvm/gallivm_p.h56
-rw-r--r--src/mesa/pipe/llvm/instructionssoa.cpp26
-rw-r--r--src/mesa/pipe/llvm/llvm_base_shader.cpp833
-rw-r--r--src/mesa/pipe/llvm/llvm_entry.c163
-rw-r--r--src/mesa/pipe/llvm/storagesoa.cpp117
-rw-r--r--src/mesa/pipe/softpipe/sp_state_derived.c190
-rw-r--r--src/mesa/ppc/rtasm/spe_asm.c385
-rw-r--r--src/mesa/ppc/rtasm/spe_asm.h314
-rw-r--r--src/mesa/sources87
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c2
-rw-r--r--src/mesa/state_tracker/st_cache.c4
-rw-r--r--src/mesa/state_tracker/st_cache.h2
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c2
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c117
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c3
-rw-r--r--src/mesa/state_tracker/st_cb_feedback.c6
-rw-r--r--src/mesa/state_tracker/st_cb_program.c4
-rw-r--r--src/mesa/state_tracker/st_cb_rasterpos.c4
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c2
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c5
-rw-r--r--src/mesa/state_tracker/st_context.c4
-rw-r--r--src/mesa/state_tracker/st_debug.c4
-rw-r--r--src/mesa/state_tracker/st_draw.c4
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c2
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c6
-rw-r--r--src/mesa/state_tracker/st_program.c4
-rw-r--r--src/mesa/state_tracker/st_texture.c1
-rw-r--r--src/mesa/x86/rtasm/x86sse.c108
-rw-r--r--src/mesa/x86/rtasm/x86sse.h4
410 files changed, 5058 insertions, 2803 deletions
diff --git a/configs/beos b/configs/beos
index f07973d0c78..2b74af739d0 100644
--- a/configs/beos
+++ b/configs/beos
@@ -86,7 +86,7 @@ else
endif
# Directories
-SRC_DIRS = mesa glu glut/beos
+SRC_DIRS = gallium mesa glu glut/beos
GLU_DIRS = sgi
DRIVER_DIRS = beos
PROGRAM_DIRS = beos samples redbook demos tests
diff --git a/configs/darwin b/configs/darwin
index 7826ecc605e..bba78026962 100644
--- a/configs/darwin
+++ b/configs/darwin
@@ -25,5 +25,5 @@ GLW_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXt $(TOP)/lib/GL.dylib
APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
# omit glw lib for now:
-SRC_DIRS = mesa glu glut/glx
+SRC_DIRS = gallium mesa glu glut/glx
diff --git a/configs/darwin-x86ppc b/configs/darwin-x86ppc
index 13172327a76..ebeb25051f1 100644
--- a/configs/darwin-x86ppc
+++ b/configs/darwin-x86ppc
@@ -29,5 +29,5 @@ GLW_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXt $(TOP)/lib/GL.dylib
APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
# omit glw lib for now:
-SRC_DIRS = mesa glu glut/glx
+SRC_DIRS = gallium mesa glu glut/glx
diff --git a/configs/default b/configs/default
index 166205a1d31..25a87e66a1b 100644
--- a/configs/default
+++ b/configs/default
@@ -60,7 +60,7 @@ GLW_SOURCES = GLwDrawA.c
# Directories to build
LIB_DIR = lib
-SRC_DIRS = mesa glu glut/glx glw
+SRC_DIRS = gallium mesa glu glut/glx glw
GLU_DIRS = sgi
DRIVER_DIRS = x11 osmesa
# Which subdirs under $(TOP)/progs/ to enter:
diff --git a/configs/freebsd-dri b/configs/freebsd-dri
index 402883d1de0..67d253b8695 100644
--- a/configs/freebsd-dri
+++ b/configs/freebsd-dri
@@ -36,7 +36,7 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lX11
# Directories
-SRC_DIRS = glx/x11 mesa glu glut/glx glw
+SRC_DIRS = glx/x11 gallium mesa glu glut/glx glw
DRIVER_DIRS = dri
PROGRAM_DIRS =
WINDOW_SYSTEM=dri
diff --git a/configs/linux-cell b/configs/linux-cell
index 3d874491e41..09f62fc1ff0 100644
--- a/configs/linux-cell
+++ b/configs/linux-cell
@@ -21,7 +21,7 @@ CFLAGS = $(OPT_FLAGS) -Wall -Winline -fPIC -m32 -mabi=altivec -maltivec -I. -I$(
CXXFLAGS = $(CFLAGS)
# Omitting glw here:
-SRC_DIRS = mesa glu glut/glx
+SRC_DIRS = gallium mesa glu glut/glx
MKDEP_OPTIONS = -fdepend -Y
@@ -36,7 +36,9 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread \
SPU_CC = spu-gcc
-SPU_CFLAGS = $(OPT_FLAGS) -W -Wall -Winline -Wmissing-prototypes -Wno-main -I. -I $(SDK)/spu/include -include spu_intrinsics.h -I $(TOP)/src/mesa/
+SPU_CFLAGS = $(OPT_FLAGS) -W -Wall -Winline -Wmissing-prototypes -Wno-main \
+ -I. -I$(SDK)/spu/include -I$(TOP)/src/mesa/ $(INCLUDE_DIRS) \
+ -include spu_intrinsics.h
SPU_LFLAGS = -L$(SDK)/spu/lib -Wl,-N -lmisc
diff --git a/configs/linux-directfb b/configs/linux-directfb
index 09332f48081..dff27f78503 100644
--- a/configs/linux-directfb
+++ b/configs/linux-directfb
@@ -22,7 +22,7 @@ ifeq ($(HAVE_X86), yes)
endif
# Directories
-SRC_DIRS = mesa glu glut/directfb
+SRC_DIRS = gallium mesa glu glut/directfb
GLU_DIRS = sgi
DRIVER_DIRS = directfb
PROGRAM_DIRS = demos directfb
diff --git a/configs/linux-dri b/configs/linux-dri
index c7eb7112c0e..e6135856fc1 100644
--- a/configs/linux-dri
+++ b/configs/linux-dri
@@ -54,10 +54,10 @@ USING_EGL=0
# Directories
ifeq ($(USING_EGL), 1)
-SRC_DIRS = egl glx/x11 mesa glu glut/glx glw
+SRC_DIRS = egl glx/x11 gallium mesa glu glut/glx glw
PROGRAM_DIRS = egl
else
-SRC_DIRS = glx/x11 mesa glu glut/glx glw
+SRC_DIRS = glx/x11 gallium mesa glu glut/glx glw
PROGRAM_DIRS =
endif
@@ -66,4 +66,4 @@ WINDOW_SYSTEM=dri
# gamma are missing because they have not been converted to use the new
# interface.
-DRI_DIRS = nouveau_winsys
+DRI_DIRS = intel
diff --git a/configs/linux-dri-xcb b/configs/linux-dri-xcb
index aa292a13ec1..ea4bdf1864c 100644
--- a/configs/linux-dri-xcb
+++ b/configs/linux-dri-xcb
@@ -53,10 +53,10 @@ USING_EGL=0
# Directories
ifeq ($(USING_EGL), 1)
-SRC_DIRS = egl glx/x11 mesa glu glut/glx glw
+SRC_DIRS = egl glx/x11 gallium mesa glu glut/glx glw
PROGRAM_DIRS = egl
else
-SRC_DIRS = glx/x11 mesa glu glut/glx glw
+SRC_DIRS = glx/x11 gallium mesa glu glut/glx glw
PROGRAM_DIRS =
endif
diff --git a/configs/linux-fbdev b/configs/linux-fbdev
index e36d20a702c..1ddccb3f52b 100644
--- a/configs/linux-fbdev
+++ b/configs/linux-fbdev
@@ -6,7 +6,7 @@ CONFIG_NAME = linux-fbdev
CFLAGS = -O3 -ffast-math -ansi -pedantic -fPIC -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -DUSE_GLFBDEV_DRIVER
-SRC_DIRS = mesa glu glut/fbdev
+SRC_DIRS = gallium mesa glu glut/fbdev
DRIVER_DIRS = fbdev osmesa
PROGRAM_DIRS = fbdev demos redbook samples
diff --git a/configs/linux-osmesa b/configs/linux-osmesa
index cc1fbbd109a..0382a19553a 100644
--- a/configs/linux-osmesa
+++ b/configs/linux-osmesa
@@ -14,7 +14,7 @@ CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOUR
# Directories
-SRC_DIRS = mesa glu
+SRC_DIRS = gallium mesa glu
DRIVER_DIRS = osmesa
PROGRAM_DIRS = osdemos
diff --git a/configs/linux-osmesa16 b/configs/linux-osmesa16
index 1fb0186d315..9a527592f1d 100644
--- a/configs/linux-osmesa16
+++ b/configs/linux-osmesa16
@@ -17,7 +17,7 @@ OSMESA_LIB_NAME = libOSMesa16.so
# Directories
-SRC_DIRS = mesa glu
+SRC_DIRS = gallium mesa glu
DRIVER_DIRS = osmesa
PROGRAM_DIRS =
diff --git a/configs/linux-osmesa16-static b/configs/linux-osmesa16-static
index 6645504478e..1e6380b02e0 100644
--- a/configs/linux-osmesa16-static
+++ b/configs/linux-osmesa16-static
@@ -18,7 +18,7 @@ OSMESA_LIB_NAME = libOSMesa16.a
# Directories
-SRC_DIRS = mesa glu
+SRC_DIRS = gallium mesa glu
DRIVER_DIRS = osmesa
PROGRAM_DIRS =
diff --git a/configs/linux-osmesa32 b/configs/linux-osmesa32
index a1e5a358d60..f0ef1831b09 100644
--- a/configs/linux-osmesa32
+++ b/configs/linux-osmesa32
@@ -17,7 +17,7 @@ OSMESA_LIB_NAME = libOSMesa32.so
# Directories
-SRC_DIRS = mesa glu
+SRC_DIRS = gallium mesa glu
DRIVER_DIRS = osmesa
PROGRAM_DIRS =
diff --git a/configs/linux-solo b/configs/linux-solo
index 220fe58b9a4..d49b9722282 100644
--- a/configs/linux-solo
+++ b/configs/linux-solo
@@ -43,7 +43,7 @@ GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lpthread
# Directories
-SRC_DIRS = glx/mini mesa glu glut/mini
+SRC_DIRS = glx/mini gallium mesa glu glut/mini
DRIVER_DIRS = dri
PROGRAM_DIRS = miniglx
diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile
index 3a1caf15e71..d19abe7e865 100644
--- a/progs/trivial/Makefile
+++ b/progs/trivial/Makefile
@@ -39,6 +39,7 @@ SOURCES = \
linestrip-stipple-wide.c \
linestrip-stipple.c \
linestrip.c \
+ pgon-mode.c \
point-clip.c \
point-param.c \
point-sprite.c \
diff --git a/progs/trivial/pgon-mode.c b/progs/trivial/pgon-mode.c
new file mode 100644
index 00000000000..db586386196
--- /dev/null
+++ b/progs/trivial/pgon-mode.c
@@ -0,0 +1,136 @@
+/**
+ * Test glPolygonMode.
+ * A tri-strip w/ two tris is drawn so that the first tri is front-facing
+ * but the second tri is back-facing.
+ * Set glPolygonMode differently for the front/back faces
+ *
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <GL/glut.h>
+
+static int Win;
+static GLfloat Zrot = 0;
+static GLboolean FrontFillBackUnfilled = GL_TRUE;
+static GLboolean Lines = GL_TRUE;
+
+
+static void
+Draw(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ if (FrontFillBackUnfilled) {
+ if (Lines) {
+ printf("FrontMode = FILL, BackMode = LINE\n");
+ glPolygonMode(GL_BACK, GL_LINE);
+ }
+ else {
+ printf("FrontMode = FILL, BackMode = POINT\n");
+ glPolygonMode(GL_BACK, GL_POINT);
+ }
+ glPolygonMode(GL_FRONT, GL_FILL);
+ }
+ else {
+ if (Lines) {
+ printf("FrontMode = LINE, BackMode = FILL\n");
+ glPolygonMode(GL_FRONT, GL_LINE);
+ }
+ else {
+ printf("FrontMode = POINT, BackMode = FILL\n");
+ glPolygonMode(GL_FRONT, GL_POINT);
+ }
+ glPolygonMode(GL_BACK, GL_FILL);
+ }
+
+ glPushMatrix();
+ glRotatef(Zrot, 0, 0, 1);
+
+ glBegin(GL_TRIANGLE_STRIP);
+ glVertex2f(-1, 0);
+ glVertex2f( 1, 0);
+ glVertex2f(0, 1);
+ glVertex2f(0, -1);
+ glEnd();
+
+ glPopMatrix();
+
+ 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.0, 0.0, -15.0);
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+ const GLfloat step = 3.0;
+ (void) x;
+ (void) y;
+ switch (key) {
+ case 'p':
+ FrontFillBackUnfilled = !FrontFillBackUnfilled;
+ break;
+ case 'l':
+ Lines = !Lines;
+ break;
+ case 'z':
+ Zrot -= step;
+ break;
+ case 'Z':
+ Zrot += step;
+ break;
+ case 27:
+ glutDestroyWindow(Win);
+ exit(0);
+ break;
+ }
+ glutPostRedisplay();
+}
+
+
+static void
+Init(void)
+{
+ printf("GL_RENDERER = %s\n", (char*) glGetString(GL_RENDERER));
+
+ glLineWidth(3.0);
+ glPointSize(3.0);
+
+ glColor4f(1, 1, 1, 0.8);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ printf("Press 'p' to toggle polygon mode\n");
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ glutInit(&argc, argv);
+ glutInitWindowPosition(0, 0);
+ glutInitWindowSize(400, 400);
+ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
+ Win = glutCreateWindow(argv[0]);
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ Init();
+ glutMainLoop();
+ return 0;
+}
diff --git a/src/gallium/Makefile b/src/gallium/Makefile
new file mode 100644
index 00000000000..89e068a4492
--- /dev/null
+++ b/src/gallium/Makefile
@@ -0,0 +1,20 @@
+TOP = ../..
+include $(TOP)/configs/current
+
+
+SUBDIRS = auxiliary drivers
+
+
+default: subdirs
+
+
+subdirs:
+ @for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE)) || exit 1 ; \
+ fi \
+ done
+
+
+clean:
+ rm -f `find . -name \*.[oa]`
diff --git a/src/mesa/pipe/Makefile.template b/src/gallium/Makefile.template
index 8e84f8eb2d7..83b25f9b47c 100644
--- a/src/mesa/pipe/Makefile.template
+++ b/src/gallium/Makefile.template
@@ -15,7 +15,10 @@ OBJECTS = $(C_SOURCES:.c=.o) \
### Include directories
INCLUDES = \
-I. \
- -I$(TOP)/src/mesa/pipe \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/include/pipe \
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium/drivers \
-I$(TOP)/src/mesa \
-I$(TOP)/include \
$(DRIVER_INCLUDES)
@@ -38,7 +41,7 @@ INCLUDES = \
default: depend symlinks $(LIBNAME)
-$(LIBNAME): $(OBJECTS) Makefile $(TOP)/src/mesa/pipe/Makefile.template
+$(LIBNAME): $(OBJECTS) Makefile $(TOP)/src/gallium/Makefile.template
$(TOP)/bin/mklib -o $@ -static $(OBJECTS) $(DRIVER_LIBS)
diff --git a/src/mesa/pipe/README.portability b/src/gallium/README.portability
index c70ca774da0..c70ca774da0 100644
--- a/src/mesa/pipe/README.portability
+++ b/src/gallium/README.portability
diff --git a/src/mesa/pipe/SConscript b/src/gallium/SConscript
index d9c20e01007..d9c20e01007 100644
--- a/src/mesa/pipe/SConscript
+++ b/src/gallium/SConscript
diff --git a/src/mesa/pipe/Makefile b/src/gallium/auxiliary/Makefile
index 2b03b5c2446..da68498aa1f 100644
--- a/src/mesa/pipe/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -2,16 +2,11 @@ TOP = ../../..
include $(TOP)/configs/current
-ifeq ($(CONFIG_NAME), linux-cell)
-CELL_DIR = cell
-endif
-
ifeq ($(CONFIG_NAME), linux-llvm)
LLVM_DIR = llvm
endif
-SUBDIRS = softpipe i915simple i965simple nv30 nv40 nv50 failover pipebuffer \
- $(CELL_DIR) $(LLVM_DIR)
+SUBDIRS = pipebuffer $(LLVM_DIR)
default: subdirs
diff --git a/src/mesa/pipe/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c
index 9e77e0774dd..9e77e0774dd 100644
--- a/src/mesa/pipe/cso_cache/cso_cache.c
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.c
diff --git a/src/mesa/pipe/cso_cache/cso_cache.h b/src/gallium/auxiliary/cso_cache/cso_cache.h
index 116e2eaa2c8..116e2eaa2c8 100644
--- a/src/mesa/pipe/cso_cache/cso_cache.h
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.h
diff --git a/src/mesa/pipe/cso_cache/cso_hash.c b/src/gallium/auxiliary/cso_cache/cso_hash.c
index 0338cb3b474..0338cb3b474 100644
--- a/src/mesa/pipe/cso_cache/cso_hash.c
+++ b/src/gallium/auxiliary/cso_cache/cso_hash.c
diff --git a/src/mesa/pipe/cso_cache/cso_hash.h b/src/gallium/auxiliary/cso_cache/cso_hash.h
index b4aa111860f..b4aa111860f 100644
--- a/src/mesa/pipe/cso_cache/cso_hash.h
+++ b/src/gallium/auxiliary/cso_cache/cso_hash.h
diff --git a/src/gallium/auxiliary/draw/Makefile b/src/gallium/auxiliary/draw/Makefile
new file mode 100644
index 00000000000..fe9b150f304
--- /dev/null
+++ b/src/gallium/auxiliary/draw/Makefile
@@ -0,0 +1,2 @@
+default:
+ cd ../../../mesa ; make
diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/gallium/auxiliary/draw/draw_clip.c
index 61130c5600a..e3051507eaf 100644
--- a/src/mesa/pipe/draw/draw_clip.c
+++ b/src/gallium/auxiliary/draw/draw_clip.c
@@ -459,7 +459,7 @@ static void clip_reset_stipple_counter( struct draw_stage *stage )
static void clip_destroy( struct draw_stage *stage )
{
- draw_free_tmps( stage );
+ draw_free_temp_verts( stage );
FREE( stage );
}
@@ -472,7 +472,7 @@ struct draw_stage *draw_clip_stage( struct draw_context *draw )
{
struct clipper *clipper = CALLOC_STRUCT(clipper);
- draw_alloc_tmps( &clipper->stage, MAX_CLIPPED_VERTICES+1 );
+ draw_alloc_temp_verts( &clipper->stage, MAX_CLIPPED_VERTICES+1 );
clipper->stage.draw = draw;
clipper->stage.point = clip_point;
diff --git a/src/mesa/pipe/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index b15f57c8248..4be38303169 100644
--- a/src/mesa/pipe/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -242,7 +242,7 @@ draw_convert_wide_lines(struct draw_context *draw, boolean enable)
/**
* Allocate space for temporary post-transform vertices, such as for clipping.
*/
-void draw_alloc_tmps( struct draw_stage *stage, unsigned nr )
+void draw_alloc_temp_verts( struct draw_stage *stage, unsigned nr )
{
assert(!stage->tmp);
@@ -260,7 +260,7 @@ void draw_alloc_tmps( struct draw_stage *stage, unsigned nr )
}
-void draw_free_tmps( struct draw_stage *stage )
+void draw_free_temp_verts( struct draw_stage *stage )
{
if (stage->tmp) {
FREE( stage->tmp[0] );
diff --git a/src/mesa/pipe/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index ddeb184497a..ddeb184497a 100644
--- a/src/mesa/pipe/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
diff --git a/src/mesa/pipe/draw/draw_cull.c b/src/gallium/auxiliary/draw/draw_cull.c
index 05c274e4dc2..8177b0ac86e 100644
--- a/src/mesa/pipe/draw/draw_cull.c
+++ b/src/gallium/auxiliary/draw/draw_cull.c
@@ -123,7 +123,7 @@ static void cull_reset_stipple_counter( struct draw_stage *stage )
static void cull_destroy( struct draw_stage *stage )
{
- draw_free_tmps( stage );
+ draw_free_temp_verts( stage );
FREE( stage );
}
@@ -135,7 +135,7 @@ struct draw_stage *draw_cull_stage( struct draw_context *draw )
{
struct cull_stage *cull = CALLOC_STRUCT(cull_stage);
- draw_alloc_tmps( &cull->stage, 0 );
+ draw_alloc_temp_verts( &cull->stage, 0 );
cull->stage.draw = draw;
cull->stage.next = NULL;
diff --git a/src/mesa/pipe/draw/draw_debug.c b/src/gallium/auxiliary/draw/draw_debug.c
index d6220b5f62c..d6220b5f62c 100644
--- a/src/mesa/pipe/draw/draw_debug.c
+++ b/src/gallium/auxiliary/draw/draw_debug.c
diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/gallium/auxiliary/draw/draw_flatshade.c
index 1419f287d2c..4398abbc60c 100644
--- a/src/mesa/pipe/draw/draw_flatshade.c
+++ b/src/gallium/auxiliary/draw/draw_flatshade.c
@@ -176,7 +176,7 @@ static void flatshade_reset_stipple_counter( struct draw_stage *stage )
static void flatshade_destroy( struct draw_stage *stage )
{
- draw_free_tmps( stage );
+ draw_free_temp_verts( stage );
FREE( stage );
}
@@ -188,7 +188,7 @@ struct draw_stage *draw_flatshade_stage( struct draw_context *draw )
{
struct flat_stage *flatshade = CALLOC_STRUCT(flat_stage);
- draw_alloc_tmps( &flatshade->stage, 2 );
+ draw_alloc_temp_verts( &flatshade->stage, 2 );
flatshade->stage.draw = draw;
flatshade->stage.next = NULL;
diff --git a/src/mesa/pipe/draw/draw_offset.c b/src/gallium/auxiliary/draw/draw_offset.c
index a2990ee8a88..dbc676deae4 100644
--- a/src/mesa/pipe/draw/draw_offset.c
+++ b/src/gallium/auxiliary/draw/draw_offset.c
@@ -159,7 +159,7 @@ static void offset_reset_stipple_counter( struct draw_stage *stage )
static void offset_destroy( struct draw_stage *stage )
{
- draw_free_tmps( stage );
+ draw_free_temp_verts( stage );
FREE( stage );
}
@@ -171,7 +171,7 @@ struct draw_stage *draw_offset_stage( struct draw_context *draw )
{
struct offset_stage *offset = CALLOC_STRUCT(offset_stage);
- draw_alloc_tmps( &offset->stage, 3 );
+ draw_alloc_temp_verts( &offset->stage, 3 );
offset->stage.draw = draw;
offset->stage.next = NULL;
diff --git a/src/mesa/pipe/draw/draw_prim.c b/src/gallium/auxiliary/draw/draw_prim.c
index 51e2242719a..51e2242719a 100644
--- a/src/mesa/pipe/draw/draw_prim.c
+++ b/src/gallium/auxiliary/draw/draw_prim.c
diff --git a/src/mesa/pipe/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 7782db04770..bc11259cb21 100644
--- a/src/mesa/pipe/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -45,7 +45,7 @@
#include "pipe/p_defines.h"
#include "x86/rtasm/x86sse.h"
-#include "pipe/tgsi/exec/tgsi_exec.h"
+#include "tgsi/exec/tgsi_exec.h"
struct gallivm_prog;
@@ -128,13 +128,25 @@ struct draw_stage
* Private version of the compiled vertex_shader
*/
struct draw_vertex_shader {
+
+ /* This member will disappear shortly:
+ */
const struct pipe_shader_state *state;
-#if defined(__i386__) || defined(__386__)
- struct x86_function sse2_program;
-#endif
-#ifdef MESA_LLVM
- struct gallivm_prog *llvm_prog;
-#endif
+
+ void (*prepare)( struct draw_vertex_shader *shader,
+ struct draw_context *draw );
+
+ /* Run the shader - this interface will get cleaned up in the
+ * future:
+ */
+ void (*run)( struct draw_vertex_shader *shader,
+ struct draw_context *draw,
+ const unsigned *elts,
+ unsigned count,
+ struct vertex_header *vOut[] );
+
+
+ void (*delete)( struct draw_vertex_shader * );
};
@@ -176,7 +188,7 @@ struct draw_context
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX];
- const struct draw_vertex_shader *vertex_shader;
+ struct draw_vertex_shader *vertex_shader;
uint num_vs_outputs; /**< convenience, from vertex_shader */
@@ -201,6 +213,7 @@ struct draw_context
boolean convert_wide_points; /**< convert wide points to tris? */
boolean convert_wide_lines; /**< convert side lines to tris? */
+ boolean use_sse;
unsigned reduced_prim;
@@ -255,11 +268,10 @@ struct draw_context
unsigned queue_nr;
} pq;
- int use_sse : 1;
-#ifdef MESA_LLVM
- struct gallivm_cpu_engine *engine;
-#endif
-
+
+ /* This (and the tgsi_exec_machine struct) probably need to be moved somewhere private.
+ */
+ struct gallivm_cpu_engine *engine;
void *driver_private;
};
@@ -276,9 +288,9 @@ extern struct draw_stage *draw_wide_stage( struct draw_context *context );
extern struct draw_stage *draw_validate_stage( struct draw_context *context );
-extern void draw_free_tmps( struct draw_stage *stage );
-extern void draw_reset_tmps( struct draw_stage *stage );
-extern void draw_alloc_tmps( struct draw_stage *stage, unsigned nr );
+extern void draw_free_temp_verts( struct draw_stage *stage );
+
+extern void draw_alloc_temp_verts( struct draw_stage *stage, unsigned nr );
extern void draw_reset_vertex_ids( struct draw_context *draw );
@@ -290,11 +302,7 @@ extern void draw_vertex_cache_invalidate( struct draw_context *draw );
extern void draw_vertex_cache_unreference( struct draw_context *draw );
extern void draw_vertex_cache_reset_vertex_ids( struct draw_context *draw );
-
extern void draw_vertex_shader_queue_flush( struct draw_context *draw );
-#ifdef MESA_LLVM
-extern void draw_vertex_shader_queue_flush_llvm( struct draw_context *draw );
-#endif
struct tgsi_exec_machine;
diff --git a/src/mesa/pipe/draw/draw_stipple.c b/src/gallium/auxiliary/draw/draw_stipple.c
index 90291019165..506f33512c8 100644
--- a/src/mesa/pipe/draw/draw_stipple.c
+++ b/src/gallium/auxiliary/draw/draw_stipple.c
@@ -212,6 +212,7 @@ passthrough_tri(struct draw_stage *stage, struct prim_header *header)
static void
stipple_destroy( struct draw_stage *stage )
{
+ draw_free_temp_verts( stage );
FREE( stage );
}
@@ -223,7 +224,7 @@ struct draw_stage *draw_stipple_stage( struct draw_context *draw )
{
struct stipple_stage *stipple = CALLOC_STRUCT(stipple_stage);
- draw_alloc_tmps( &stipple->stage, 2 );
+ draw_alloc_temp_verts( &stipple->stage, 2 );
stipple->stage.draw = draw;
stipple->stage.next = NULL;
diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/gallium/auxiliary/draw/draw_twoside.c
index ad2aaf10bb9..1c389579871 100644
--- a/src/mesa/pipe/draw/draw_twoside.c
+++ b/src/gallium/auxiliary/draw/draw_twoside.c
@@ -176,7 +176,7 @@ static void twoside_reset_stipple_counter( struct draw_stage *stage )
static void twoside_destroy( struct draw_stage *stage )
{
- draw_free_tmps( stage );
+ draw_free_temp_verts( stage );
FREE( stage );
}
@@ -188,7 +188,7 @@ struct draw_stage *draw_twoside_stage( struct draw_context *draw )
{
struct twoside_stage *twoside = CALLOC_STRUCT(twoside_stage);
- draw_alloc_tmps( &twoside->stage, 3 );
+ draw_alloc_temp_verts( &twoside->stage, 3 );
twoside->stage.draw = draw;
twoside->stage.next = NULL;
diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/gallium/auxiliary/draw/draw_unfilled.c
index 364bda8b791..8777cfdfc86 100644
--- a/src/mesa/pipe/draw/draw_unfilled.c
+++ b/src/gallium/auxiliary/draw/draw_unfilled.c
@@ -165,6 +165,8 @@ static void unfilled_flush( struct draw_stage *stage,
unsigned flags )
{
stage->next->flush( stage->next, flags );
+
+ stage->tri = unfilled_first_tri;
}
@@ -176,7 +178,7 @@ static void unfilled_reset_stipple_counter( struct draw_stage *stage )
static void unfilled_destroy( struct draw_stage *stage )
{
- draw_free_tmps( stage );
+ draw_free_temp_verts( stage );
FREE( stage );
}
@@ -188,7 +190,7 @@ struct draw_stage *draw_unfilled_stage( struct draw_context *draw )
{
struct unfilled_stage *unfilled = CALLOC_STRUCT(unfilled_stage);
- draw_alloc_tmps( &unfilled->stage, 0 );
+ draw_alloc_temp_verts( &unfilled->stage, 0 );
unfilled->stage.draw = draw;
unfilled->stage.next = NULL;
diff --git a/src/mesa/pipe/draw/draw_validate.c b/src/gallium/auxiliary/draw/draw_validate.c
index 4375ebabbc4..4375ebabbc4 100644
--- a/src/mesa/pipe/draw/draw_validate.c
+++ b/src/gallium/auxiliary/draw/draw_validate.c
diff --git a/src/mesa/pipe/draw/draw_vbuf.c b/src/gallium/auxiliary/draw/draw_vbuf.c
index be96c8fdeb1..71ac73912b8 100644
--- a/src/mesa/pipe/draw/draw_vbuf.c
+++ b/src/gallium/auxiliary/draw/draw_vbuf.c
@@ -523,6 +523,9 @@ static void vbuf_destroy( struct draw_stage *stage )
if(vbuf->vf)
draw_vf_destroy( vbuf->vf );
+ if (vbuf->render)
+ vbuf->render->destroy( vbuf->render );
+
FREE( stage );
}
diff --git a/src/mesa/pipe/draw/draw_vbuf.h b/src/gallium/auxiliary/draw/draw_vbuf.h
index cfd2b9820c1..cfd2b9820c1 100644
--- a/src/mesa/pipe/draw/draw_vbuf.h
+++ b/src/gallium/auxiliary/draw/draw_vbuf.h
diff --git a/src/mesa/pipe/draw/draw_vertex.c b/src/gallium/auxiliary/draw/draw_vertex.c
index 2d6592150fc..daf1ef4b80f 100644
--- a/src/mesa/pipe/draw/draw_vertex.c
+++ b/src/gallium/auxiliary/draw/draw_vertex.c
@@ -34,8 +34,8 @@
*/
-#include "pipe/draw/draw_private.h"
-#include "pipe/draw/draw_vertex.h"
+#include "draw/draw_private.h"
+#include "draw/draw_vertex.h"
/**
diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/gallium/auxiliary/draw/draw_vertex.h
index dfc637b19b1..267c74203bd 100644
--- a/src/mesa/pipe/draw/draw_vertex.h
+++ b/src/gallium/auxiliary/draw/draw_vertex.h
@@ -25,7 +25,12 @@
*
**************************************************************************/
-/* Author:
+/**
+ * Post-transform vertex format info. The vertex_info struct is used by
+ * the draw_vbuf code to emit hardware-specific vertex layouts into hw
+ * vertex buffers.
+ *
+ * Author:
* Brian Paul
*/
diff --git a/src/mesa/pipe/draw/draw_vertex_cache.c b/src/gallium/auxiliary/draw/draw_vertex_cache.c
index 44427999ccf..44427999ccf 100644
--- a/src/mesa/pipe/draw/draw_vertex_cache.c
+++ b/src/gallium/auxiliary/draw/draw_vertex_cache.c
diff --git a/src/mesa/pipe/draw/draw_vertex_fetch.c b/src/gallium/auxiliary/draw/draw_vertex_fetch.c
index e13df04605c..e13df04605c 100644
--- a/src/mesa/pipe/draw/draw_vertex_fetch.c
+++ b/src/gallium/auxiliary/draw/draw_vertex_fetch.c
diff --git a/src/gallium/auxiliary/draw/draw_vertex_shader.c b/src/gallium/auxiliary/draw/draw_vertex_shader.c
new file mode 100644
index 00000000000..f68f6e32440
--- /dev/null
+++ b/src/gallium/auxiliary/draw/draw_vertex_shader.c
@@ -0,0 +1,126 @@
+/**************************************************************************
+ *
+ * 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 <[email protected]>
+ * Brian Paul
+ */
+
+#include "pipe/p_util.h"
+#include "pipe/p_shader_tokens.h"
+#include "draw_private.h"
+#include "draw_context.h"
+#include "draw_vs.h"
+
+
+
+/**
+ * Run the vertex shader on all vertices in the vertex queue.
+ * Called by the draw module when the vertx cache needs to be flushed.
+ */
+void
+draw_vertex_shader_queue_flush(struct draw_context *draw)
+{
+ struct draw_vertex_shader *shader = draw->vertex_shader;
+ unsigned i;
+
+ assert(draw->vs.queue_nr != 0);
+
+ /* XXX: do this on statechange:
+ */
+ shader->prepare( shader, draw );
+
+// fprintf(stderr, " q(%d) ", draw->vs.queue_nr );
+
+ /* run vertex shader on vertex cache entries, four per invokation */
+ for (i = 0; i < draw->vs.queue_nr; i += 4) {
+ struct vertex_header *dests[4];
+ unsigned elts[4];
+ int j, n = MIN2(4, draw->vs.queue_nr - i);
+
+ for (j = 0; j < n; j++) {
+ elts[j] = draw->vs.queue[i + j].elt;
+ dests[j] = draw->vs.queue[i + j].dest;
+ }
+
+ for ( ; j < 4; j++) {
+ elts[j] = elts[0];
+ dests[j] = dests[0];
+ }
+
+ assert(n > 0);
+ assert(n <= 4);
+
+ shader->run(shader, draw, elts, n, dests);
+ }
+
+ draw->vs.queue_nr = 0;
+}
+
+
+struct draw_vertex_shader *
+draw_create_vertex_shader(struct draw_context *draw,
+ const struct pipe_shader_state *shader)
+{
+ struct draw_vertex_shader *vs;
+
+ vs = draw_create_vs_llvm( draw, shader );
+ if (vs)
+ return vs;
+
+ vs = draw_create_vs_sse( draw, shader );
+ if (vs)
+ return vs;
+
+ vs = draw_create_vs_exec( draw, shader );
+ assert(vs);
+ return vs;
+}
+
+
+void
+draw_bind_vertex_shader(struct draw_context *draw,
+ struct draw_vertex_shader *dvs)
+{
+ draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
+
+ draw->vertex_shader = dvs;
+ draw->num_vs_outputs = dvs->state->num_outputs;
+
+ tgsi_exec_machine_init(&draw->machine);
+
+ dvs->prepare( dvs, draw );
+}
+
+
+void
+draw_delete_vertex_shader(struct draw_context *draw,
+ struct draw_vertex_shader *dvs)
+{
+ dvs->delete( dvs );
+}
diff --git a/src/mesa/pipe/draw/draw_vf.c b/src/gallium/auxiliary/draw/draw_vf.c
index f23d7fcec5c..dc3a5ecd219 100644
--- a/src/mesa/pipe/draw/draw_vf.c
+++ b/src/gallium/auxiliary/draw/draw_vf.c
@@ -370,7 +370,7 @@ void draw_vf_emit_vertex( struct draw_vertex_fetch *vf,
unsigned j;
for (j = 0; j < vf->attr_count; j++) {
- if(!a[j].isconst) {
+ if (!a[j].isconst) {
a[j].inputptr = (uint8_t *)&vertex->data[a[j].attrib][0];
a[j].inputstride = 0; /* XXX: one-vertex-max ATM */
}
diff --git a/src/mesa/pipe/draw/draw_vf.h b/src/gallium/auxiliary/draw/draw_vf.h
index e694b986754..011c8f0ff1c 100644
--- a/src/mesa/pipe/draw/draw_vf.h
+++ b/src/gallium/auxiliary/draw/draw_vf.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 Tungsten Graphics, inc.
+ * Copyright 2008 Tungsten Graphics, inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -20,6 +20,17 @@
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * Vertex fetch/store/convert code. This functionality is used in two places:
+ * 1. Vertex fetch/convert - to grab vertex data from incoming vertex
+ * arrays and convert to format needed by vertex shaders.
+ * 2. Vertex store/emit - to convert simple float[][4] vertex attributes
+ * (which is the organization used throughout the draw/prim pipeline) to
+ * hardware-specific formats and emit into hardware vertex buffers.
+ *
*
* Authors:
* Keith Whitwell <[email protected]>
@@ -33,7 +44,7 @@
#include "pipe/p_state.h"
#include "draw_vertex.h"
-#include "draw_private.h" // for vertex_header
+#include "draw_private.h" /* for vertex_header */
enum draw_vf_attr_format {
@@ -181,6 +192,7 @@ struct draw_vf_attr_type {
unsigned offset;
};
+/** XXX this could be moved into draw_vf.c */
struct draw_vf_fastpath {
unsigned vertex_stride;
unsigned attr_count;
@@ -209,6 +221,7 @@ void
draw_vf_generate_sse_emit( struct draw_vertex_fetch *vf );
+/** XXX this type and function could probably be moved into draw_vf.c */
struct draw_vf_format_info {
const char *name;
draw_vf_insert_func insert[4];
diff --git a/src/mesa/pipe/draw/draw_vf_generic.c b/src/gallium/auxiliary/draw/draw_vf_generic.c
index 7a60a9db9c3..7a60a9db9c3 100644
--- a/src/mesa/pipe/draw/draw_vf_generic.c
+++ b/src/gallium/auxiliary/draw/draw_vf_generic.c
diff --git a/src/mesa/pipe/draw/draw_vf_sse.c b/src/gallium/auxiliary/draw/draw_vf_sse.c
index 1ad2ae756dd..1ad2ae756dd 100644
--- a/src/mesa/pipe/draw/draw_vf_sse.c
+++ b/src/gallium/auxiliary/draw/draw_vf_sse.c
diff --git a/src/gallium/auxiliary/draw/draw_vs.h b/src/gallium/auxiliary/draw/draw_vs.h
new file mode 100644
index 00000000000..4ee7e705e93
--- /dev/null
+++ b/src/gallium/auxiliary/draw/draw_vs.h
@@ -0,0 +1,50 @@
+/**************************************************************************
+ *
+ * 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 <[email protected]>
+ */
+
+#ifndef DRAW_VS_H
+#define DRAW_VS_H
+
+struct draw_vertex_shader;
+struct draw_context;
+struct pipe_shader_state;
+
+struct draw_vertex_shader *
+draw_create_vs_exec(struct draw_context *draw,
+ const struct pipe_shader_state *templ);
+
+struct draw_vertex_shader *
+draw_create_vs_sse(struct draw_context *draw,
+ const struct pipe_shader_state *templ);
+
+struct draw_vertex_shader *
+draw_create_vs_llvm(struct draw_context *draw,
+ const struct pipe_shader_state *templ);
+
+#endif
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c
new file mode 100644
index 00000000000..8588879400a
--- /dev/null
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -0,0 +1,186 @@
+/**************************************************************************
+ *
+ * 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 <[email protected]>
+ * Brian Paul
+ */
+
+#include "pipe/p_util.h"
+#include "pipe/p_shader_tokens.h"
+
+#include "draw_private.h"
+#include "draw_context.h"
+#include "draw_vs.h"
+
+
+static INLINE unsigned
+compute_clipmask(const float *clip, /*const*/ float plane[][4], unsigned nr)
+{
+ unsigned mask = 0;
+ unsigned i;
+
+ /* Do the hardwired planes first:
+ */
+ if (-clip[0] + clip[3] < 0) mask |= CLIP_RIGHT_BIT;
+ if ( clip[0] + clip[3] < 0) mask |= CLIP_LEFT_BIT;
+ if (-clip[1] + clip[3] < 0) mask |= CLIP_TOP_BIT;
+ if ( clip[1] + clip[3] < 0) mask |= CLIP_BOTTOM_BIT;
+ if (-clip[2] + clip[3] < 0) mask |= CLIP_FAR_BIT;
+ if ( clip[2] + clip[3] < 0) mask |= CLIP_NEAR_BIT;
+
+ /* Followed by any remaining ones:
+ */
+ for (i = 6; i < nr; i++) {
+ if (dot4(clip, plane[i]) < 0)
+ mask |= (1<<i);
+ }
+
+ return mask;
+}
+
+
+static void
+vs_exec_prepare( struct draw_vertex_shader *shader,
+ struct draw_context *draw )
+{
+ /* specify the vertex program to interpret/execute */
+ tgsi_exec_machine_bind_shader(&draw->machine,
+ shader->state->tokens,
+ PIPE_MAX_SAMPLERS,
+ NULL /*samplers*/ );
+
+ draw_update_vertex_fetch( draw );
+}
+
+
+/**
+ * Transform vertices with the current vertex program/shader
+ * Up to four vertices can be shaded at a time.
+ * \param vbuffer the input vertex data
+ * \param elts indexes of four input vertices
+ * \param count number of vertices to shade [1..4]
+ * \param vOut array of pointers to four output vertices
+ */
+static void
+vs_exec_run( struct draw_vertex_shader *shader,
+ struct draw_context *draw,
+ const unsigned *elts,
+ unsigned count,
+ struct vertex_header *vOut[] )
+{
+ struct tgsi_exec_machine *machine = &draw->machine;
+ unsigned int j;
+
+ ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_ATTRIB_MAX);
+ ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_ATTRIB_MAX);
+ const float *scale = draw->viewport.scale;
+ const float *trans = draw->viewport.translate;
+
+ assert(count <= 4);
+ assert(draw->vertex_shader->state->output_semantic_name[0]
+ == TGSI_SEMANTIC_POSITION);
+
+ machine->Consts = (float (*)[4]) draw->user.constants;
+ machine->Inputs = ALIGN16_ASSIGN(inputs);
+ machine->Outputs = ALIGN16_ASSIGN(outputs);
+
+ draw->vertex_fetch.fetch_func( draw, machine, elts, count );
+
+ /* run interpreter */
+ tgsi_exec_machine_run( machine );
+
+
+ /* store machine results */
+ for (j = 0; j < count; j++) {
+ unsigned slot;
+ float x, y, z, w;
+
+ /* Handle attr[0] (position) specially:
+ *
+ * XXX: Computing the clipmask should be done in the vertex
+ * program as a set of DP4 instructions appended to the
+ * user-provided code.
+ */
+ x = vOut[j]->clip[0] = machine->Outputs[0].xyzw[0].f[j];
+ y = vOut[j]->clip[1] = machine->Outputs[0].xyzw[1].f[j];
+ z = vOut[j]->clip[2] = machine->Outputs[0].xyzw[2].f[j];
+ w = vOut[j]->clip[3] = machine->Outputs[0].xyzw[3].f[j];
+
+ vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes);
+ vOut[j]->edgeflag = 1;
+
+ /* divide by w */
+ w = 1.0f / w;
+ x *= w;
+ y *= w;
+ z *= w;
+
+ /* Viewport mapping */
+ vOut[j]->data[0][0] = x * scale[0] + trans[0];
+ vOut[j]->data[0][1] = y * scale[1] + trans[1];
+ vOut[j]->data[0][2] = z * scale[2] + trans[2];
+ vOut[j]->data[0][3] = w;
+
+ /* Remaining attributes are packed into sequential post-transform
+ * vertex attrib slots.
+ */
+ for (slot = 1; slot < draw->num_vs_outputs; slot++) {
+ vOut[j]->data[slot][0] = machine->Outputs[slot].xyzw[0].f[j];
+ vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
+ vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
+ vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
+ }
+ } /* loop over vertices */
+}
+
+
+
+static void
+vs_exec_delete( struct draw_vertex_shader *dvs )
+{
+ FREE( dvs );
+}
+
+
+struct draw_vertex_shader *
+draw_create_vs_exec(struct draw_context *draw,
+ const struct pipe_shader_state *state)
+{
+ struct draw_vertex_shader *vs = CALLOC_STRUCT( draw_vertex_shader );
+
+ if (vs == NULL)
+ return NULL;
+
+ vs->state = state;
+ vs->prepare = vs_exec_prepare;
+ vs->run = vs_exec_run;
+ vs->delete = vs_exec_delete;
+
+ return vs;
+}
diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c
index 9c31df1e3e1..44022b6e077 100644
--- a/src/mesa/pipe/draw/draw_vertex_shader.c
+++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c
@@ -27,23 +27,25 @@
/*
* Authors:
+ * Zack Rusin
* Keith Whitwell <[email protected]>
* Brian Paul
*/
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
-#if defined(__i386__) || defined(__386__)
-#include "pipe/tgsi/exec/tgsi_sse2.h"
-#endif
#include "draw_private.h"
#include "draw_context.h"
+#include "draw_vs.h"
-#include "x86/rtasm/x86sse.h"
-#include "pipe/llvm/gallivm.h"
+#ifdef MESA_LLVM
+#include "llvm/gallivm.h"
-#define DBG_VS 0
+struct draw_llvm_vertex_shader {
+ struct draw_vertex_shader base;
+ struct gallivm_prog *llvm_prog;
+};
static INLINE unsigned
@@ -72,11 +74,14 @@ compute_clipmask(const float *clip, /*const*/ float plane[][4], unsigned nr)
}
-typedef void (XSTDCALL *codegen_function) (
- const struct tgsi_exec_vector *input,
- struct tgsi_exec_vector *output,
- float (*constant)[4],
- struct tgsi_exec_vector *temporary );
+
+static void
+vs_llvm_prepare( struct draw_vertex_shader *base,
+ struct draw_context *draw )
+{
+ draw_update_vertex_fetch( draw );
+}
+
/**
@@ -88,10 +93,15 @@ typedef void (XSTDCALL *codegen_function) (
* \param vOut array of pointers to four output vertices
*/
static void
-run_vertex_program(struct draw_context *draw,
- unsigned elts[4], unsigned count,
- struct vertex_header *vOut[])
+vs_llvm_run( struct draw_vertex_shader *base,
+ struct draw_context *draw,
+ const unsigned *elts,
+ unsigned count,
+ struct vertex_header *vOut[] )
{
+ struct draw_llvm_vertex_shader *shader =
+ (struct draw_llvm_vertex_shader *)base;
+
struct tgsi_exec_machine *machine = &draw->machine;
unsigned int j;
@@ -100,6 +110,7 @@ run_vertex_program(struct draw_context *draw,
const float *scale = draw->viewport.scale;
const float *trans = draw->viewport.translate;
+
assert(count <= 4);
assert(draw->vertex_shader->state->output_semantic_name[0]
== TGSI_SEMANTIC_POSITION);
@@ -113,51 +124,17 @@ run_vertex_program(struct draw_context *draw,
draw->vertex_fetch.fetch_func( draw, machine, elts, count );
/* run shader */
-#ifdef MESA_LLVM
- if (1) {
- struct gallivm_prog *prog = draw->vertex_shader->llvm_prog;
- gallivm_cpu_vs_exec(prog,
+ gallivm_cpu_vs_exec(shader->llvm_prog,
machine->Inputs,
machine->Outputs,
- machine->Consts);
- } else
-#elif defined(__i386__) || defined(__386__)
- if (draw->use_sse) {
- /* SSE */
- /* cast away const */
- struct draw_vertex_shader *shader
- = (struct draw_vertex_shader *)draw->vertex_shader;
- codegen_function func
- = (codegen_function) x86_get_func( &shader->sse2_program );
-
- if (func)
- func(
- machine->Inputs,
- machine->Outputs,
- machine->Consts,
- machine->Temps );
- else
- /* interpreter */
- tgsi_exec_machine_run( machine );
- }
- else
-#endif
- {
- /* interpreter */
- tgsi_exec_machine_run( machine );
- }
+ machine->Consts,
+ machine->Temps);
/* store machine results */
for (j = 0; j < count; j++) {
unsigned slot;
float x, y, z, w;
- /* Handle attr[0] (position) specially:
- *
- * XXX: Computing the clipmask should be done in the vertex
- * program as a set of DP4 instructions appended to the
- * user-provided code.
- */
x = vOut[j]->clip[0] = machine->Outputs[0].xyzw[0].f[j];
y = vOut[j]->clip[1] = machine->Outputs[0].xyzw[1].f[j];
z = vOut[j]->clip[2] = machine->Outputs[0].xyzw[2].f[j];
@@ -178,13 +155,6 @@ run_vertex_program(struct draw_context *draw,
vOut[j]->data[0][2] = z * scale[2] + trans[2];
vOut[j]->data[0][3] = w;
-#if DBG_VS
- debug_printf("output[%d]win: %f %f %f %f\n", j,
- vOut[j]->data[0][0],
- vOut[j]->data[0][1],
- vOut[j]->data[0][2],
- vOut[j]->data[0][3]);
-#endif
/* Remaining attributes are packed into sequential post-transform
* vertex attrib slots.
*/
@@ -193,132 +163,75 @@ run_vertex_program(struct draw_context *draw,
vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
-#if DBG_VS
- debug_printf("output[%d][%d]: %f %f %f %f\n", j, slot,
- vOut[j]->data[slot][0],
- vOut[j]->data[slot][1],
- vOut[j]->data[slot][2],
- vOut[j]->data[slot][3]);
-#endif
}
} /* loop over vertices */
}
-
-/**
- * Run the vertex shader on all vertices in the vertex queue.
- * Called by the draw module when the vertx cache needs to be flushed.
- */
-void
-draw_vertex_shader_queue_flush(struct draw_context *draw)
+static void
+vs_llvm_delete( struct draw_vertex_shader *base )
{
- unsigned i;
+ struct draw_llvm_vertex_shader *shader =
+ (struct draw_llvm_vertex_shader *)base;
- assert(draw->vs.queue_nr != 0);
-
- /* XXX: do this on statechange:
+ /* Do something to free compiled shader:
*/
- draw_update_vertex_fetch( draw );
-
-// fprintf(stderr, " q(%d) ", draw->vs.queue_nr );
- /* run vertex shader on vertex cache entries, four per invokation */
- for (i = 0; i < draw->vs.queue_nr; i += 4) {
- struct vertex_header *dests[4];
- unsigned elts[4];
- int j, n = MIN2(4, draw->vs.queue_nr - i);
-
- for (j = 0; j < n; j++) {
- elts[j] = draw->vs.queue[i + j].elt;
- dests[j] = draw->vs.queue[i + j].dest;
- }
-
- for ( ; j < 4; j++) {
- elts[j] = elts[0];
- dests[j] = dests[0];
- }
+ FREE( shader );
+}
- assert(n > 0);
- assert(n <= 4);
- run_vertex_program(draw, elts, n, dests);
- }
-
- draw->vs.queue_nr = 0;
-}
struct draw_vertex_shader *
-draw_create_vertex_shader(struct draw_context *draw,
- const struct pipe_shader_state *shader)
+draw_create_vs_llvm(struct draw_context *draw,
+ const struct pipe_shader_state *templ)
{
- struct draw_vertex_shader *vs;
+ struct draw_llvm_vertex_shader *vs;
- vs = CALLOC_STRUCT( draw_vertex_shader );
- if (vs == NULL) {
+ vs = CALLOC_STRUCT( draw_llvm_vertex_shader );
+ if (vs == NULL)
return NULL;
- }
- vs->state = shader;
+ vs->base.state = templ;
+ vs->base.prepare = vs_llvm_prepare;
+ vs->base.run = vs_llvm_run;
+ vs->base.delete = vs_llvm_delete;
-#ifdef MESA_LLVM
- struct gallivm_ir *ir = gallivm_ir_new(GALLIVM_VS);
- gallivm_ir_set_layout(ir, GALLIVM_SOA);
- gallivm_ir_set_components(ir, 4);
- gallivm_ir_fill_from_tgsi(ir, shader->tokens);
- vs->llvm_prog = gallivm_ir_compile(ir);
- gallivm_ir_delete(ir);
+ {
+ struct gallivm_ir *ir = gallivm_ir_new(GALLIVM_VS);
+ gallivm_ir_set_layout(ir, GALLIVM_SOA);
+ gallivm_ir_set_components(ir, 4);
+ gallivm_ir_fill_from_tgsi(ir, vs->base.state->tokens);
+ vs->llvm_prog = gallivm_ir_compile(ir);
+ gallivm_ir_delete(ir);
+ }
draw->engine = gallivm_global_cpu_engine();
+
+ /* XXX: Why are there two versions of this? Shouldn't creating the
+ * engine be a separate operation to compiling a shader?
+ */
if (!draw->engine) {
draw->engine = gallivm_cpu_engine_create(vs->llvm_prog);
}
else {
gallivm_cpu_jit_compile(draw->engine, vs->llvm_prog);
}
-#elif defined(__i386__) || defined(__386__)
- if (draw->use_sse) {
- /* cast-away const */
- struct pipe_shader_state *sh = (struct pipe_shader_state *) shader;
-
- x86_init_func( &vs->sse2_program );
- if (!tgsi_emit_sse2( (struct tgsi_token *) sh->tokens,
- &vs->sse2_program )) {
- x86_release_func( (struct x86_function *) &vs->sse2_program );
- fprintf(stdout /*err*/,
- "tgsi_emit_sse2() failed, falling back to interpreter\n");
- }
- }
-#endif
- return vs;
+ return &vs->base;
}
-void
-draw_bind_vertex_shader(struct draw_context *draw,
- struct draw_vertex_shader *dvs)
-{
- draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
- draw->vertex_shader = dvs;
- draw->num_vs_outputs = dvs->state->num_outputs;
- /* specify the vertex program to interpret/execute */
- tgsi_exec_machine_init(&draw->machine,
- draw->vertex_shader->state->tokens,
- PIPE_MAX_SAMPLERS,
- NULL /*samplers*/ );
-}
+#else
-void
-draw_delete_vertex_shader(struct draw_context *draw,
- struct draw_vertex_shader *dvs)
+struct draw_vertex_shader *
+draw_create_vs_llvm(struct draw_context *draw,
+ const struct pipe_shader_state *shader)
{
-#if defined(__i386__) || defined(__386__)
- x86_release_func( (struct x86_function *) &dvs->sse2_program );
-#endif
-
- FREE( dvs );
+ return NULL;
}
+
+#endif
diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c
new file mode 100644
index 00000000000..27bc66812c3
--- /dev/null
+++ b/src/gallium/auxiliary/draw/draw_vs_sse.c
@@ -0,0 +1,251 @@
+/**************************************************************************
+ *
+ * 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 <[email protected]>
+ * Brian Paul
+ */
+
+#include "draw_vs.h"
+
+#if defined(__i386__) || defined(__386__)
+
+#include "pipe/p_util.h"
+#include "pipe/p_shader_tokens.h"
+
+#include "draw_private.h"
+#include "draw_context.h"
+
+#include "x86/rtasm/x86sse.h"
+#include "tgsi/exec/tgsi_sse2.h"
+
+
+typedef void (XSTDCALL *codegen_function) (
+ const struct tgsi_exec_vector *input,
+ struct tgsi_exec_vector *output,
+ float (*constant)[4],
+ struct tgsi_exec_vector *temporary );
+
+
+struct draw_sse_vertex_shader {
+ struct draw_vertex_shader base;
+ struct x86_function sse2_program;
+ codegen_function func;
+};
+
+
+/* Should be part of the generated shader:
+ */
+static INLINE unsigned
+compute_clipmask(const float *clip, /*const*/ float plane[][4], unsigned nr)
+{
+ unsigned mask = 0;
+ unsigned i;
+
+ /* Do the hardwired planes first:
+ */
+ if (-clip[0] + clip[3] < 0) mask |= CLIP_RIGHT_BIT;
+ if ( clip[0] + clip[3] < 0) mask |= CLIP_LEFT_BIT;
+ if (-clip[1] + clip[3] < 0) mask |= CLIP_TOP_BIT;
+ if ( clip[1] + clip[3] < 0) mask |= CLIP_BOTTOM_BIT;
+ if (-clip[2] + clip[3] < 0) mask |= CLIP_FAR_BIT;
+ if ( clip[2] + clip[3] < 0) mask |= CLIP_NEAR_BIT;
+
+ /* Followed by any remaining ones:
+ */
+ for (i = 6; i < nr; i++) {
+ if (dot4(clip, plane[i]) < 0)
+ mask |= (1<<i);
+ }
+
+ return mask;
+}
+
+
+static void
+vs_sse_prepare( struct draw_vertex_shader *base,
+ struct draw_context *draw )
+{
+ draw_update_vertex_fetch( draw );
+}
+
+/**
+ * Transform vertices with the current vertex program/shader
+ * Up to four vertices can be shaded at a time.
+ * \param vbuffer the input vertex data
+ * \param elts indexes of four input vertices
+ * \param count number of vertices to shade [1..4]
+ * \param vOut array of pointers to four output vertices
+ */
+static void
+vs_sse_run( struct draw_vertex_shader *base,
+ struct draw_context *draw,
+ const unsigned *elts,
+ unsigned count,
+ struct vertex_header *vOut[] )
+{
+ struct draw_sse_vertex_shader *shader = (struct draw_sse_vertex_shader *)base;
+ struct tgsi_exec_machine *machine = &draw->machine;
+ unsigned int j;
+
+ ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_ATTRIB_MAX);
+ ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_ATTRIB_MAX);
+ const float *scale = draw->viewport.scale;
+ const float *trans = draw->viewport.translate;
+
+ assert(count <= 4);
+ assert(draw->vertex_shader->state->output_semantic_name[0]
+ == TGSI_SEMANTIC_POSITION);
+
+ /* Consts does not require 16 byte alignment. */
+ machine->Consts = (float (*)[4]) draw->user.constants;
+ machine->Inputs = ALIGN16_ASSIGN(inputs);
+ machine->Outputs = ALIGN16_ASSIGN(outputs);
+
+
+ /* Fetch vertices. This may at some point be integrated into the
+ * compiled shader -- that would require a reorganization where
+ * multiple versions of the compiled shader might exist,
+ * specialized for each fetch state.
+ */
+ draw->vertex_fetch.fetch_func( draw, machine, elts, count );
+
+
+ /* run compiled shader
+ */
+ shader->func(
+ machine->Inputs,
+ machine->Outputs,
+ machine->Consts,
+ machine->Temps );
+
+
+ /* XXX: Computing the clipmask and emitting results should be done
+ * in the vertex program as a set of instructions appended to
+ * the user-provided code.
+ */
+ for (j = 0; j < count; j++) {
+ unsigned slot;
+ float x, y, z, w;
+
+ x = vOut[j]->clip[0] = machine->Outputs[0].xyzw[0].f[j];
+ y = vOut[j]->clip[1] = machine->Outputs[0].xyzw[1].f[j];
+ z = vOut[j]->clip[2] = machine->Outputs[0].xyzw[2].f[j];
+ w = vOut[j]->clip[3] = machine->Outputs[0].xyzw[3].f[j];
+
+ vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes);
+ vOut[j]->edgeflag = 1;
+
+ /* divide by w */
+ w = 1.0f / w;
+ x *= w;
+ y *= w;
+ z *= w;
+
+ /* Viewport mapping */
+ vOut[j]->data[0][0] = x * scale[0] + trans[0];
+ vOut[j]->data[0][1] = y * scale[1] + trans[1];
+ vOut[j]->data[0][2] = z * scale[2] + trans[2];
+ vOut[j]->data[0][3] = w;
+
+ /* Remaining attributes are packed into sequential post-transform
+ * vertex attrib slots.
+ */
+ for (slot = 1; slot < draw->num_vs_outputs; slot++) {
+ vOut[j]->data[slot][0] = machine->Outputs[slot].xyzw[0].f[j];
+ vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
+ vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
+ vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
+ }
+ }
+}
+
+
+
+static void
+vs_sse_delete( struct draw_vertex_shader *base )
+{
+ struct draw_sse_vertex_shader *shader = (struct draw_sse_vertex_shader *)base;
+
+ x86_release_func( &shader->sse2_program );
+
+ FREE( shader );
+}
+
+
+struct draw_vertex_shader *
+draw_create_vs_sse(struct draw_context *draw,
+ const struct pipe_shader_state *templ)
+{
+ struct draw_sse_vertex_shader *vs;
+
+ if (!draw->use_sse)
+ return NULL;
+
+ vs = CALLOC_STRUCT( draw_sse_vertex_shader );
+ if (vs == NULL)
+ return NULL;
+
+ vs->base.state = templ;
+ vs->base.prepare = vs_sse_prepare;
+ vs->base.run = vs_sse_run;
+ vs->base.delete = vs_sse_delete;
+
+ x86_init_func( &vs->sse2_program );
+
+ if (!tgsi_emit_sse2( (struct tgsi_token *) vs->base.state->tokens,
+ &vs->sse2_program ))
+ goto fail;
+
+ vs->func = (codegen_function) x86_get_func( &vs->sse2_program );
+
+ return &vs->base;
+
+fail:
+ fprintf(stderr, "tgsi_emit_sse2() failed, falling back to interpreter\n");
+
+ x86_release_func( &vs->sse2_program );
+
+ FREE(vs);
+ return NULL;
+}
+
+
+
+#else
+
+struct draw_vertex_shader *
+draw_create_vs_sse( struct draw_context *draw,
+ const struct pipe_shader_state *templ )
+{
+ return (void *) 0;
+}
+
+
+#endif
+
diff --git a/src/mesa/pipe/draw/draw_wide_prims.c b/src/gallium/auxiliary/draw/draw_wide_prims.c
index 4c7e279b20f..655774b155f 100644
--- a/src/mesa/pipe/draw/draw_wide_prims.c
+++ b/src/gallium/auxiliary/draw/draw_wide_prims.c
@@ -175,7 +175,7 @@ static void wide_line_aa(struct draw_stage *stage,
float *pos;
float dx = header->v[1]->data[0][0] - header->v[0]->data[0][0];
float dy = header->v[1]->data[0][1] - header->v[0]->data[0][1];
- const float len = sqrt(dx * dx + dy * dy);
+ const float len = (float) sqrt(dx * dx + dy * dy);
uint i;
dx = dx * half_width / len;
@@ -400,7 +400,7 @@ static void wide_flush( struct draw_stage *stage, unsigned flags )
}
-static void draw_reset_stipple_counter( struct draw_stage *stage )
+static void wide_reset_stipple_counter( struct draw_stage *stage )
{
stage->next->reset_stipple_counter( stage->next );
}
@@ -408,7 +408,7 @@ static void draw_reset_stipple_counter( struct draw_stage *stage )
static void wide_destroy( struct draw_stage *stage )
{
- draw_free_tmps( stage );
+ draw_free_temp_verts( stage );
FREE( stage );
}
@@ -417,7 +417,7 @@ struct draw_stage *draw_wide_stage( struct draw_context *draw )
{
struct wide_stage *wide = CALLOC_STRUCT(wide_stage);
- draw_alloc_tmps( &wide->stage, 4 );
+ draw_alloc_temp_verts( &wide->stage, 4 );
wide->stage.draw = draw;
wide->stage.next = NULL;
@@ -425,7 +425,7 @@ struct draw_stage *draw_wide_stage( struct draw_context *draw )
wide->stage.line = wide_first_line;
wide->stage.tri = passthrough_tri;
wide->stage.flush = wide_flush;
- wide->stage.reset_stipple_counter = draw_reset_stipple_counter;
+ wide->stage.reset_stipple_counter = wide_reset_stipple_counter;
wide->stage.destroy = wide_destroy;
return &wide->stage;
diff --git a/src/mesa/pipe/llvm/Makefile b/src/gallium/auxiliary/llvm/Makefile
index a0494ba966e..e0abf860c17 100644
--- a/src/mesa/pipe/llvm/Makefile
+++ b/src/gallium/auxiliary/llvm/Makefile
@@ -15,7 +15,7 @@ GALLIVM_SOURCES = \
storagesoa.cpp \
instructionssoa.cpp
-INC_SOURCES = gallivm_builtins.cpp llvm_base_shader.cpp
+INC_SOURCES = gallivm_builtins.cpp
CPP_SOURCES = \
$(GALLIVM_SOURCES)
@@ -30,7 +30,9 @@ OBJECTS = $(C_SOURCES:.c=.o) \
### Include directories
INCLUDES = \
-I. \
- -I$(TOP)/src/mesa/pipe \
+ -I$(TOP)/src/gallium/drivers
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium/include \
-I$(TOP)/src/mesa \
-I$(TOP)/include
@@ -65,8 +67,6 @@ depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(INC_SOURCES)
gallivm_builtins.cpp: llvm_builtins.c
clang --emit-llvm $< |llvm-as|opt -std-compile-opts|llvm2cpp -gen-contents -o=$@ -f -for=shader -funcname=createGallivmBuiltins
-llvm_base_shader.cpp: llvm_entry.c
- clang --emit-llvm $< |llvm-as |opt -std-compile-opts |llvm2cpp -for=Shader -gen-module -o=$@ -f -funcname=createBaseShader
# Emacs tags
tags:
@@ -77,7 +77,7 @@ tags:
clean:
-rm -f *.o */*.o *~ *.so *~ server/*.o
-rm -f depend depend.bak
- -rm -f gallivm_builtins.cpp llvm_base_shader.cpp
+ -rm -f gallivm_builtins.cpp
symlinks:
diff --git a/src/mesa/pipe/llvm/gallivm.cpp b/src/gallium/auxiliary/llvm/gallivm.cpp
index b99dc6db5b8..d14bb3b99a8 100644
--- a/src/mesa/pipe/llvm/gallivm.cpp
+++ b/src/gallium/auxiliary/llvm/gallivm.cpp
@@ -42,8 +42,8 @@
#include "pipe/p_context.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/exec/tgsi_exec.h"
-#include "pipe/tgsi/util/tgsi_dump.h"
+#include "tgsi/exec/tgsi_exec.h"
+#include "tgsi/util/tgsi_dump.h"
#include <llvm/Module.h>
#include <llvm/CallingConv.h>
@@ -289,9 +289,9 @@ void gallivm_ir_fill_from_tgsi(struct gallivm_ir *ir,
tgsi_dump(tokens, 0);
- llvm::Module *irmod = tgsi_to_llvmir(ir, tokens);
+ llvm::Module *mod = tgsi_to_llvmir(ir, tokens);
- llvm::Module *mod = tgsi_to_llvm(ir, tokens);
+ //llvm::Module *mod = tgsi_to_llvm(ir, tokens);
ir->module = mod;
gallivm_ir_dump(ir, 0);
}
@@ -318,6 +318,9 @@ struct gallivm_prog * gallivm_ir_compile(struct gallivm_ir *ir)
passes.run(*mod);
prog->module = mod;
+ std::cout << "After optimizations:"<<std::endl;
+ mod->dump();
+
return prog;
}
diff --git a/src/mesa/pipe/llvm/gallivm.h b/src/gallium/auxiliary/llvm/gallivm.h
index b104520cb7f..92da4bca7f4 100644
--- a/src/mesa/pipe/llvm/gallivm.h
+++ b/src/gallium/auxiliary/llvm/gallivm.h
@@ -82,7 +82,8 @@ struct gallivm_cpu_engine *gallivm_global_cpu_engine();
int gallivm_cpu_vs_exec(struct gallivm_prog *prog,
struct tgsi_exec_vector *inputs,
struct tgsi_exec_vector *dests,
- float (*consts)[4]);
+ float (*consts)[4],
+ struct tgsi_exec_vector *temps);
int gallivm_cpu_fs_exec(struct gallivm_prog *prog,
float x, float y,
float (*dests)[PIPE_MAX_SHADER_INPUTS][4],
diff --git a/src/mesa/pipe/llvm/gallivm_builtins.cpp b/src/gallium/auxiliary/llvm/gallivm_builtins.cpp
index 1796f0a1772..1796f0a1772 100644
--- a/src/mesa/pipe/llvm/gallivm_builtins.cpp
+++ b/src/gallium/auxiliary/llvm/gallivm_builtins.cpp
diff --git a/src/mesa/pipe/llvm/gallivm_cpu.cpp b/src/gallium/auxiliary/llvm/gallivm_cpu.cpp
index 5f1268bf4f8..8f9830d0b1e 100644
--- a/src/mesa/pipe/llvm/gallivm_cpu.cpp
+++ b/src/gallium/auxiliary/llvm/gallivm_cpu.cpp
@@ -42,8 +42,8 @@
#include "pipe/p_context.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/exec/tgsi_exec.h"
-#include "pipe/tgsi/util/tgsi_dump.h"
+#include "tgsi/exec/tgsi_exec.h"
+#include "tgsi/util/tgsi_dump.h"
#include <llvm/Module.h>
#include <llvm/CallingConv.h>
@@ -105,10 +105,10 @@ static inline llvm::Function *func_for_shader(struct gallivm_prog *prog)
switch (prog->type) {
case GALLIVM_VS:
- func = mod->getFunction("run_vertex_shader");
+ func = mod->getFunction("vs_shader");
break;
case GALLIVM_FS:
- func = mod->getFunction("run_fragment_shader");
+ func = mod->getFunction("fs_shader");
break;
default:
assert(!"Unknown shader type!");
@@ -177,10 +177,7 @@ struct gallivm_cpu_engine * gallivm_global_cpu_engine()
typedef void (*vertex_shader_runner)(void *ainputs,
void *dests,
float (*aconsts)[4],
- int num_vertices,
- int num_inputs,
- int num_attribs,
- int num_consts);
+ void *temps);
/*!
@@ -191,12 +188,13 @@ typedef void (*vertex_shader_runner)(void *ainputs,
int gallivm_cpu_vs_exec(struct gallivm_prog *prog,
struct tgsi_exec_vector *inputs,
struct tgsi_exec_vector *dests,
- float (*consts)[4])
+ float (*consts)[4],
+ struct tgsi_exec_vector *temps)
{
vertex_shader_runner runner = reinterpret_cast<vertex_shader_runner>(prog->function);
assert(runner);
/*FIXME*/
- runner(inputs, dests, consts, 4, 4, 4, prog->num_consts);
+ runner(inputs, dests, consts, temps);
return 0;
}
diff --git a/src/gallium/auxiliary/llvm/gallivm_p.h b/src/gallium/auxiliary/llvm/gallivm_p.h
new file mode 100644
index 00000000000..cfe7b1901b3
--- /dev/null
+++ b/src/gallium/auxiliary/llvm/gallivm_p.h
@@ -0,0 +1,110 @@
+#ifndef GALLIVM_P_H
+#define GALLIVM_P_H
+
+#ifdef MESA_LLVM
+
+#include "gallivm.h"
+#include "pipe/p_shader_tokens.h"
+#include "pipe/p_compiler.h"
+
+namespace llvm {
+ class Module;
+}
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+enum gallivm_shader_type;
+enum gallivm_vector_layout;
+
+struct gallivm_interpolate {
+ int attrib;
+ int chan;
+ int type;
+};
+
+struct gallivm_ir {
+ llvm::Module *module;
+ int id;
+ enum gallivm_shader_type type;
+ enum gallivm_vector_layout layout;
+ int num_components;
+ int num_consts;
+
+ //FIXME: this might not be enough for some shaders
+ struct gallivm_interpolate interpolators[32*4];
+ int num_interp;
+};
+
+struct gallivm_prog {
+ llvm::Module *module;
+ void *function;
+
+ int id;
+ enum gallivm_shader_type type;
+
+ int num_consts;
+
+ //FIXME: this might not be enough for some shaders
+ struct gallivm_interpolate interpolators[32*4];
+ int num_interp;
+};
+
+static INLINE void gallivm_swizzle_components(int swizzle,
+ int *xc, int *yc,
+ int *zc, int *wc)
+{
+ int x = swizzle / 1000; swizzle -= x * 1000;
+ int y = swizzle / 100; swizzle -= y * 100;
+ int z = swizzle / 10; swizzle -= z * 10;
+ int w = swizzle;
+
+ if (xc) *xc = x;
+ if (yc) *yc = y;
+ if (zc) *zc = z;
+ if (wc) *wc = w;
+}
+
+static INLINE boolean gallivm_is_swizzle(int swizzle)
+{
+ const int NO_SWIZZLE = TGSI_SWIZZLE_X * 1000 + TGSI_SWIZZLE_Y * 100 +
+ TGSI_SWIZZLE_Z * 10 + TGSI_SWIZZLE_W;
+ return swizzle != NO_SWIZZLE;
+}
+
+static INLINE int gallivm_x_swizzle(int swizzle)
+{
+ int x;
+ gallivm_swizzle_components(swizzle, &x, 0, 0, 0);
+ return x;
+}
+
+static INLINE int gallivm_y_swizzle(int swizzle)
+{
+ int y;
+ gallivm_swizzle_components(swizzle, 0, &y, 0, 0);
+ return y;
+}
+
+static INLINE int gallivm_z_swizzle(int swizzle)
+{
+ int z;
+ gallivm_swizzle_components(swizzle, 0, 0, &z, 0);
+ return z;
+}
+
+static INLINE int gallivm_w_swizzle(int swizzle)
+{
+ int w;
+ gallivm_swizzle_components(swizzle, 0, 0, 0, &w);
+ return w;
+}
+
+#endif /* MESA_LLVM */
+
+#if defined __cplusplus
+} // extern "C"
+#endif
+
+#endif
diff --git a/src/mesa/pipe/llvm/instructions.cpp b/src/gallium/auxiliary/llvm/instructions.cpp
index 55d39fa5f12..55d39fa5f12 100644
--- a/src/mesa/pipe/llvm/instructions.cpp
+++ b/src/gallium/auxiliary/llvm/instructions.cpp
diff --git a/src/mesa/pipe/llvm/instructions.h b/src/gallium/auxiliary/llvm/instructions.h
index 9ebc17dd8ec..9ebc17dd8ec 100644
--- a/src/mesa/pipe/llvm/instructions.h
+++ b/src/gallium/auxiliary/llvm/instructions.h
diff --git a/src/gallium/auxiliary/llvm/instructionssoa.cpp b/src/gallium/auxiliary/llvm/instructionssoa.cpp
new file mode 100644
index 00000000000..a4d50466373
--- /dev/null
+++ b/src/gallium/auxiliary/llvm/instructionssoa.cpp
@@ -0,0 +1,121 @@
+#include "instructionssoa.h"
+
+#include "storagesoa.h"
+
+#include <llvm/Constants.h>
+
+using namespace llvm;
+
+InstructionsSoa::InstructionsSoa(llvm::Module *mod, llvm::Function *func,
+ llvm::BasicBlock *block, StorageSoa *storage)
+ : m_builder(block),
+ m_storage(storage),
+ m_idx(0)
+{
+}
+
+const char * InstructionsSoa::name(const char *prefix) const
+{
+ ++m_idx;
+ snprintf(m_name, 32, "%s%d", prefix, m_idx);
+ return m_name;
+}
+
+llvm::Value * InstructionsSoa::vectorFromVals(llvm::Value *x, llvm::Value *y,
+ llvm::Value *z, llvm::Value *w)
+{
+ VectorType *vectorType = VectorType::get(Type::FloatTy, 4);
+ Constant *constVector = Constant::getNullValue(vectorType);
+ Value *res = m_builder.CreateInsertElement(constVector, x,
+ m_storage->constantInt(0),
+ name("vecx"));
+ res = m_builder.CreateInsertElement(res, y, m_storage->constantInt(1),
+ name("vecxy"));
+ res = m_builder.CreateInsertElement(res, z, m_storage->constantInt(2),
+ name("vecxyz"));
+ if (w)
+ res = m_builder.CreateInsertElement(res, w, m_storage->constantInt(3),
+ name("vecxyzw"));
+ return res;
+}
+
+std::vector<llvm::Value*> InstructionsSoa::arl(const std::vector<llvm::Value*> in)
+{
+ std::vector<llvm::Value*> res(4);
+
+ //Extract x's
+ llvm::Value *x1 = m_builder.CreateExtractElement(in[0],
+ m_storage->constantInt(0),
+ name("extractX"));
+ //cast it to an unsigned int
+ x1 = m_builder.CreateFPToUI(x1, IntegerType::get(32), name("x1IntCast"));
+
+ res[0] = x1;//vectorFromVals(x1, x2, x3, x4);
+ //only x is valid. the others shouldn't be necessary
+ /*
+ res[1] = Constant::getNullValue(m_floatVecType);
+ res[2] = Constant::getNullValue(m_floatVecType);
+ res[3] = Constant::getNullValue(m_floatVecType);
+ */
+
+ return res;
+}
+
+
+std::vector<llvm::Value*> InstructionsSoa::add(const std::vector<llvm::Value*> in1,
+ const std::vector<llvm::Value*> in2)
+{
+ std::vector<llvm::Value*> res(4);
+
+ res[0] = m_builder.CreateAdd(in1[0], in2[0], name("addx"));
+ res[1] = m_builder.CreateAdd(in1[1], in2[1], name("addy"));
+ res[2] = m_builder.CreateAdd(in1[2], in2[2], name("addz"));
+ res[3] = m_builder.CreateAdd(in1[3], in2[3], name("addw"));
+
+ return res;
+}
+
+std::vector<llvm::Value*> InstructionsSoa::mul(const std::vector<llvm::Value*> in1,
+ const std::vector<llvm::Value*> in2)
+{
+ std::vector<llvm::Value*> res(4);
+
+ res[0] = m_builder.CreateMul(in1[0], in2[0], name("mulx"));
+ res[1] = m_builder.CreateMul(in1[1], in2[1], name("muly"));
+ res[2] = m_builder.CreateMul(in1[2], in2[2], name("mulz"));
+ res[3] = m_builder.CreateMul(in1[3], in2[3], name("mulw"));
+
+ return res;
+}
+
+void InstructionsSoa::end()
+{
+ m_builder.CreateRetVoid();
+}
+
+std::vector<llvm::Value*> InstructionsSoa::madd(const std::vector<llvm::Value*> in1,
+ const std::vector<llvm::Value*> in2,
+ const std::vector<llvm::Value*> in3)
+{
+ std::vector<llvm::Value*> res = mul(in1, in2);
+ return add(res, in3);
+}
+
+std::vector<llvm::Value*> InstructionsSoa::extractVector(llvm::Value *vector)
+{
+ std::vector<llvm::Value*> res(4);
+ res[0] = m_builder.CreateExtractElement(vector,
+ m_storage->constantInt(0),
+ name("extract1X"));
+ res[1] = m_builder.CreateExtractElement(vector,
+ m_storage->constantInt(1),
+ name("extract2X"));
+ res[2] = m_builder.CreateExtractElement(vector,
+ m_storage->constantInt(2),
+ name("extract3X"));
+ res[3] = m_builder.CreateExtractElement(vector,
+ m_storage->constantInt(3),
+ name("extract4X"));
+
+ return res;
+}
diff --git a/src/mesa/pipe/llvm/instructionssoa.h b/src/gallium/auxiliary/llvm/instructionssoa.h
index 0b6b41cf056..4169dcbb2eb 100644
--- a/src/mesa/pipe/llvm/instructionssoa.h
+++ b/src/gallium/auxiliary/llvm/instructionssoa.h
@@ -28,6 +28,8 @@
#ifndef INSTRUCTIONSSOA_H
#define INSTRUCTIONSSOA_H
+#include <llvm/Support/LLVMBuilder.h>
+
#include <vector>
namespace llvm {
@@ -44,11 +46,28 @@ public:
InstructionsSoa(llvm::Module *mod, llvm::Function *func,
llvm::BasicBlock *block, StorageSoa *storage);
+ std::vector<llvm::Value*> arl(const std::vector<llvm::Value*> in);
+
std::vector<llvm::Value*> add(const std::vector<llvm::Value*> in1,
const std::vector<llvm::Value*> in2);
+ std::vector<llvm::Value*> madd(const std::vector<llvm::Value*> in1,
+ const std::vector<llvm::Value*> in2,
+ const std::vector<llvm::Value*> in3);
std::vector<llvm::Value*> mul(const std::vector<llvm::Value*> in1,
const std::vector<llvm::Value*> in2);
void end();
+
+ std::vector<llvm::Value*> extractVector(llvm::Value *vector);
+private:
+ const char * name(const char *prefix) const;
+ llvm::Value *vectorFromVals(llvm::Value *x, llvm::Value *y,
+ llvm::Value *z, llvm::Value *w);
+private:
+ llvm::LLVMFoldingBuilder m_builder;
+ StorageSoa *m_storage;
+private:
+ mutable int m_idx;
+ mutable char m_name[32];
};
diff --git a/src/mesa/pipe/llvm/llvm_builtins.c b/src/gallium/auxiliary/llvm/llvm_builtins.c
index 4f98d754baa..4f98d754baa 100644
--- a/src/mesa/pipe/llvm/llvm_builtins.c
+++ b/src/gallium/auxiliary/llvm/llvm_builtins.c
diff --git a/src/mesa/pipe/llvm/loweringpass.cpp b/src/gallium/auxiliary/llvm/loweringpass.cpp
index 556dbec3661..556dbec3661 100644
--- a/src/mesa/pipe/llvm/loweringpass.cpp
+++ b/src/gallium/auxiliary/llvm/loweringpass.cpp
diff --git a/src/mesa/pipe/llvm/loweringpass.h b/src/gallium/auxiliary/llvm/loweringpass.h
index f62dcf6ba73..f62dcf6ba73 100644
--- a/src/mesa/pipe/llvm/loweringpass.h
+++ b/src/gallium/auxiliary/llvm/loweringpass.h
diff --git a/src/mesa/pipe/llvm/storage.cpp b/src/gallium/auxiliary/llvm/storage.cpp
index 08b9d29a24a..c4326de8c53 100644
--- a/src/mesa/pipe/llvm/storage.cpp
+++ b/src/gallium/auxiliary/llvm/storage.cpp
@@ -33,6 +33,8 @@
#include "storage.h"
+#include "gallivm_p.h"
+
#include "pipe/p_shader_tokens.h"
#include <llvm/BasicBlock.h>
#include <llvm/Module.h>
@@ -82,10 +84,10 @@ llvm::Constant *Storage::shuffleMask(int vec)
if (origVec == 0) {
const_vec = Constant::getNullValue(m_intVecType);
} else {
- int x = vec / 1000; vec -= x * 1000;
- int y = vec / 100; vec -= y * 100;
- int z = vec / 10; vec -= z * 10;
- int w = vec;
+ int x = gallivm_x_swizzle(vec);
+ int y = gallivm_y_swizzle(vec);
+ int z = gallivm_z_swizzle(vec);
+ int w = gallivm_w_swizzle(vec);
std::vector<Constant*> elems;
elems.push_back(constantInt(x));
elems.push_back(constantInt(y));
diff --git a/src/mesa/pipe/llvm/storage.h b/src/gallium/auxiliary/llvm/storage.h
index 8574f7554e3..8574f7554e3 100644
--- a/src/mesa/pipe/llvm/storage.h
+++ b/src/gallium/auxiliary/llvm/storage.h
diff --git a/src/gallium/auxiliary/llvm/storagesoa.cpp b/src/gallium/auxiliary/llvm/storagesoa.cpp
new file mode 100644
index 00000000000..ed0674a96f0
--- /dev/null
+++ b/src/gallium/auxiliary/llvm/storagesoa.cpp
@@ -0,0 +1,389 @@
+/**************************************************************************
+ *
+ * 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 "storagesoa.h"
+
+#include "gallivm_p.h"
+
+#include "pipe/p_shader_tokens.h"
+#include "pipe/p_debug.h"
+
+#include <llvm/BasicBlock.h>
+#include <llvm/Module.h>
+#include <llvm/Value.h>
+
+#include <llvm/CallingConv.h>
+#include <llvm/Constants.h>
+#include <llvm/DerivedTypes.h>
+#include <llvm/InstrTypes.h>
+#include <llvm/Instructions.h>
+
+using namespace llvm;
+
+
+StorageSoa::StorageSoa(llvm::BasicBlock *block,
+ llvm::Value *input,
+ llvm::Value *output,
+ llvm::Value *consts,
+ llvm::Value *temps)
+ : m_block(block),
+ m_input(input),
+ m_output(output),
+ m_consts(consts),
+ m_temps(temps),
+ m_immediates(0),
+ m_idx(0)
+{
+}
+
+void StorageSoa::addImmediate(float *vec)
+{
+ std::vector<float> vals(4);
+ vals[0] = vec[0];
+ vals[1] = vec[1];
+ vals[2] = vec[2];
+ vals[3] = vec[3];
+ m_immediatesToFlush.push_back(vals);
+}
+
+void StorageSoa::declareImmediates()
+{
+ if (m_immediatesToFlush.empty())
+ return;
+
+ VectorType *vectorType = VectorType::get(Type::FloatTy, 4);
+ ArrayType *vectorChannels = ArrayType::get(vectorType, 4);
+ ArrayType *arrayType = ArrayType::get(vectorChannels, m_immediatesToFlush.size());
+
+ m_immediates = new GlobalVariable(
+ /*Type=*/arrayType,
+ /*isConstant=*/false,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Initializer=*/0, // has initializer, specified below
+ /*Name=*/name("immediates"),
+ currentModule());
+
+ std::vector<Constant*> arrayVals;
+ for (unsigned int i = 0; i < m_immediatesToFlush.size(); ++i) {
+ std::vector<float> vec = m_immediatesToFlush[i];
+ std::vector<float> vals(4);
+ std::vector<Constant*> channelArray;
+
+ vals[0] = vec[0]; vals[1] = vec[0]; vals[2] = vec[0]; vals[3] = vec[0];
+ llvm::Constant *xChannel = createConstGlobalVector(vals);
+
+ vals[0] = vec[1]; vals[1] = vec[1]; vals[2] = vec[1]; vals[3] = vec[1];
+ llvm::Constant *yChannel = createConstGlobalVector(vals);
+
+ vals[0] = vec[2]; vals[1] = vec[2]; vals[2] = vec[2]; vals[3] = vec[2];
+ llvm::Constant *zChannel = createConstGlobalVector(vals);
+
+ vals[0] = vec[3]; vals[1] = vec[3]; vals[2] = vec[3]; vals[3] = vec[3];
+ llvm::Constant *wChannel = createConstGlobalVector(vals);
+ channelArray.push_back(xChannel);
+ channelArray.push_back(yChannel);
+ channelArray.push_back(zChannel);
+ channelArray.push_back(wChannel);
+ Constant *constChannels = ConstantArray::get(vectorChannels,
+ channelArray);
+ arrayVals.push_back(constChannels);
+ }
+ Constant *constArray = ConstantArray::get(arrayType, arrayVals);
+ m_immediates->setInitializer(constArray);
+
+ m_immediatesToFlush.clear();
+}
+
+llvm::Value *StorageSoa::addrElement(int idx) const
+{
+ std::map<int, llvm::Value*>::const_iterator itr = m_addresses.find(idx);
+ if (itr == m_addresses.end()) {
+ debug_printf("Trying to access invalid shader 'address'\n");
+ return 0;
+ }
+ llvm::Value * res = (*itr).second;
+
+ res = new LoadInst(res, name("addr"), false, m_block);
+
+ return res;
+}
+
+std::vector<llvm::Value*> StorageSoa::inputElement(llvm::Value *idx)
+{
+ std::vector<llvm::Value*> res(4);
+
+ res[0] = element(m_input, idx, 0);
+ res[1] = element(m_input, idx, 1);
+ res[2] = element(m_input, idx, 2);
+ res[3] = element(m_input, idx, 3);
+
+ return res;
+}
+
+std::vector<llvm::Value*> StorageSoa::constElement(llvm::Value *idx)
+{
+ std::vector<llvm::Value*> res(4);
+ llvm::Value *xChannel, *yChannel, *zChannel, *wChannel;
+
+ xChannel = elementPointer(m_consts, idx, 0);
+ yChannel = elementPointer(m_consts, idx, 1);
+ zChannel = elementPointer(m_consts, idx, 2);
+ wChannel = elementPointer(m_consts, idx, 3);
+
+ res[0] = alignedArrayLoad(xChannel);
+ res[1] = alignedArrayLoad(yChannel);
+ res[2] = alignedArrayLoad(zChannel);
+ res[3] = alignedArrayLoad(wChannel);
+
+ return res;
+}
+
+std::vector<llvm::Value*> StorageSoa::outputElement(llvm::Value *idx)
+{
+ std::vector<llvm::Value*> res(4);
+
+ res[0] = element(m_output, idx, 0);
+ res[1] = element(m_output, idx, 1);
+ res[2] = element(m_output, idx, 2);
+ res[3] = element(m_output, idx, 3);
+
+ return res;
+}
+
+std::vector<llvm::Value*> StorageSoa::tempElement(llvm::Value *idx)
+{
+ std::vector<llvm::Value*> res(4);
+
+ res[0] = element(m_temps, idx, 0);
+ res[1] = element(m_temps, idx, 1);
+ res[2] = element(m_temps, idx, 2);
+ res[3] = element(m_temps, idx, 3);
+
+ return res;
+}
+
+std::vector<llvm::Value*> StorageSoa::immediateElement(llvm::Value *idx)
+{
+ std::vector<llvm::Value*> res(4);
+
+ res[0] = element(m_immediates, idx, 0);
+ res[1] = element(m_immediates, idx, 1);
+ res[2] = element(m_immediates, idx, 2);
+ res[3] = element(m_immediates, idx, 3);
+
+ return res;
+}
+
+llvm::Value * StorageSoa::elementPointer(llvm::Value *ptr, llvm::Value *index,
+ int channel) const
+{
+ std::vector<Value*> indices;
+ if (m_immediates == ptr)
+ indices.push_back(constantInt(0));
+ indices.push_back(index);
+ indices.push_back(constantInt(channel));
+
+ GetElementPtrInst *getElem = new GetElementPtrInst(ptr,
+ indices.begin(),
+ indices.end(),
+ name("ptr"),
+ m_block);
+ return getElem;
+}
+
+llvm::Value * StorageSoa::element(llvm::Value *ptr, llvm::Value *index,
+ int channel) const
+{
+ llvm::Value *res = elementPointer(ptr, index, channel);
+ LoadInst *load = new LoadInst(res, name("element"), false, m_block);
+ //load->setAlignment(8);
+ return load;
+}
+
+const char * StorageSoa::name(const char *prefix) const
+{
+ ++m_idx;
+ snprintf(m_name, 32, "%s%d", prefix, m_idx);
+ return m_name;
+}
+
+llvm::ConstantInt * StorageSoa::constantInt(int idx) const
+{
+ if (m_constInts.find(idx) != m_constInts.end()) {
+ return m_constInts[idx];
+ }
+ ConstantInt *constInt = ConstantInt::get(APInt(32, idx));
+ m_constInts[idx] = constInt;
+ return constInt;
+}
+
+llvm::Value *StorageSoa::alignedArrayLoad(llvm::Value *val)
+{
+ VectorType *vectorType = VectorType::get(Type::FloatTy, 4);
+ PointerType *vectorPtr = PointerType::get(vectorType, 0);
+
+ CastInst *cast = new BitCastInst(val, vectorPtr, name("toVector"), m_block);
+ LoadInst *load = new LoadInst(cast, name("alignLoad"), false, m_block);
+ load->setAlignment(8);
+ return load;
+}
+
+llvm::Module * StorageSoa::currentModule() const
+{
+ if (!m_block || !m_block->getParent())
+ return 0;
+
+ return m_block->getParent()->getParent();
+}
+
+llvm::Constant * StorageSoa::createConstGlobalVector(const std::vector<float> &vec)
+{
+ VectorType *vectorType = VectorType::get(Type::FloatTy, 4);
+ std::vector<Constant*> immValues;
+ ConstantFP *constx = ConstantFP::get(Type::FloatTy, APFloat(vec[0]));
+ ConstantFP *consty = ConstantFP::get(Type::FloatTy, APFloat(vec[1]));
+ ConstantFP *constz = ConstantFP::get(Type::FloatTy, APFloat(vec[2]));
+ ConstantFP *constw = ConstantFP::get(Type::FloatTy, APFloat(vec[3]));
+ immValues.push_back(constx);
+ immValues.push_back(consty);
+ immValues.push_back(constz);
+ immValues.push_back(constw);
+ Constant *constVector = ConstantVector::get(vectorType, immValues);
+
+ return constVector;
+}
+
+std::vector<llvm::Value*> StorageSoa::load(Argument type, int idx, int swizzle,
+ llvm::Value *indIdx)
+{
+ std::vector<llvm::Value*> val(4);
+
+ //if we have an indirect index, always use that
+ // if not use the integer offset to create one
+ llvm::Value *realIndex = 0;
+ if (indIdx)
+ realIndex = indIdx;
+ else
+ realIndex = constantInt(idx);
+ debug_printf("XXXXXXXXX realIdx = %p, indIdx = %p\n", realIndex, indIdx);
+
+ switch(type) {
+ case Input:
+ val = inputElement(realIndex);
+ break;
+ case Output:
+ val = outputElement(realIndex);
+ break;
+ case Temp:
+ val = tempElement(realIndex);
+ break;
+ case Const:
+ val = constElement(realIndex);
+ break;
+ case Immediate:
+ val = immediateElement(realIndex);
+ break;
+ case Address:
+ debug_printf("Address not handled in the load phase!\n");
+ assert(0);
+ break;
+ }
+ if (!gallivm_is_swizzle(swizzle))
+ return val;
+
+ std::vector<llvm::Value*> res(4);
+
+ res[0] = val[gallivm_x_swizzle(swizzle)];
+ res[1] = val[gallivm_y_swizzle(swizzle)];
+ res[2] = val[gallivm_z_swizzle(swizzle)];
+ res[3] = val[gallivm_w_swizzle(swizzle)];
+ return res;
+}
+
+void StorageSoa::store(Argument type, int idx, const std::vector<llvm::Value*> &val,
+ int mask)
+{
+ llvm::Value *out = 0;
+ switch(type) {
+ case Output:
+ out = m_output;
+ break;
+ case Temp:
+ out = m_temps;
+ break;
+ case Input:
+ out = m_input;
+ break;
+ case Address: {
+ llvm::Value *addr = m_addresses[idx];
+ if (!addr) {
+ addAddress(idx);
+ addr = m_addresses[idx];
+ assert(addr);
+ }
+ new StoreInst(val[0], addr, false, m_block);
+ return;
+ break;
+ }
+ default:
+ debug_printf("Can't save output of this type: %d !\n", type);
+ assert(0);
+ break;
+ }
+ llvm::Value *realIndex = constantInt(idx);
+ if ((mask & TGSI_WRITEMASK_X)) {
+ llvm::Value *xChannel = elementPointer(out, realIndex, 0);
+ new StoreInst(val[0], xChannel, false, m_block);
+ }
+ if ((mask & TGSI_WRITEMASK_Y)) {
+ llvm::Value *yChannel = elementPointer(out, realIndex, 1);
+ new StoreInst(val[1], yChannel, false, m_block);
+ }
+ if ((mask & TGSI_WRITEMASK_Z)) {
+ llvm::Value *zChannel = elementPointer(out, realIndex, 2);
+ new StoreInst(val[2], zChannel, false, m_block);
+ }
+ if ((mask & TGSI_WRITEMASK_W)) {
+ llvm::Value *wChannel = elementPointer(out, realIndex, 3);
+ new StoreInst(val[3], wChannel, false, m_block);
+ }
+}
+
+void StorageSoa::addAddress(int idx)
+{
+ GlobalVariable *val = new GlobalVariable(
+ /*Type=*/IntegerType::get(32),
+ /*isConstant=*/false,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Initializer=*/0, // has initializer, specified below
+ /*Name=*/name("address"),
+ currentModule());
+ val->setInitializer(Constant::getNullValue(IntegerType::get(32)));
+
+ debug_printf("adding to %d\n", idx);
+ m_addresses[idx] = val;
+}
diff --git a/src/gallium/auxiliary/llvm/storagesoa.h b/src/gallium/auxiliary/llvm/storagesoa.h
new file mode 100644
index 00000000000..6443351f270
--- /dev/null
+++ b/src/gallium/auxiliary/llvm/storagesoa.h
@@ -0,0 +1,111 @@
+/**************************************************************************
+ *
+ * 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.
+ *
+ **************************************************************************/
+
+#ifndef STORAGESOA_H
+#define STORAGESOA_H
+
+#include <vector>
+#include <list>
+#include <map>
+
+namespace llvm {
+ class BasicBlock;
+ class Constant;
+ class ConstantInt;
+ class GlobalVariable;
+ class LoadInst;
+ class Value;
+ class VectorType;
+ class Module;
+}
+
+class StorageSoa
+{
+public:
+ enum Argument {
+ Input,
+ Output,
+ Temp,
+ Const,
+ Immediate,
+ Address
+ };
+public:
+ StorageSoa(llvm::BasicBlock *block,
+ llvm::Value *input,
+ llvm::Value *output,
+ llvm::Value *consts,
+ llvm::Value *temps);
+
+
+ std::vector<llvm::Value*> load(Argument type, int idx, int swizzle,
+ llvm::Value *indIdx =0);
+ void store(Argument type, int idx, const std::vector<llvm::Value*> &val,
+ int mask);
+
+ void addImmediate(float *vec);
+ void declareImmediates();
+
+ void addAddress(int idx);
+
+ llvm::Value * addrElement(int idx) const;
+
+ llvm::ConstantInt *constantInt(int) const;
+private:
+ llvm::Value *elementPointer(llvm::Value *ptr, llvm::Value *indIdx,
+ int channel) const;
+ llvm::Value *element(llvm::Value *ptr, llvm::Value *idx,
+ int channel) const;
+ const char *name(const char *prefix) const;
+ llvm::Value *alignedArrayLoad(llvm::Value *val);
+ llvm::Module *currentModule() const;
+ llvm::Constant *createConstGlobalVector(const std::vector<float> &vec);
+
+ std::vector<llvm::Value*> inputElement(llvm::Value *indIdx);
+ std::vector<llvm::Value*> constElement(llvm::Value *indIdx);
+ std::vector<llvm::Value*> outputElement(llvm::Value *indIdx);
+ std::vector<llvm::Value*> tempElement(llvm::Value *indIdx);
+ std::vector<llvm::Value*> immediateElement(llvm::Value *indIdx);
+private:
+ llvm::BasicBlock *m_block;
+
+ llvm::Value *m_input;
+ llvm::Value *m_output;
+ llvm::Value *m_consts;
+ llvm::Value *m_temps;
+ llvm::GlobalVariable *m_immediates;
+
+ std::map<int, llvm::Value*> m_addresses;
+
+ std::vector<std::vector<float> > m_immediatesToFlush;
+
+ mutable std::map<int, llvm::ConstantInt*> m_constInts;
+ mutable char m_name[32];
+ mutable int m_idx;
+};
+
+#endif
diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/gallium/auxiliary/llvm/tgsitollvm.cpp
index bc4df610717..2cb4acce32f 100644
--- a/src/mesa/pipe/llvm/tgsitollvm.cpp
+++ b/src/gallium/auxiliary/llvm/tgsitollvm.cpp
@@ -10,11 +10,11 @@
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
-#include "pipe/tgsi/exec/tgsi_exec.h"
-#include "pipe/tgsi/util/tgsi_util.h"
-#include "pipe/tgsi/util/tgsi_build.h"
-#include "pipe/tgsi/util/tgsi_dump.h"
+#include "tgsi/util/tgsi_parse.h"
+#include "tgsi/exec/tgsi_exec.h"
+#include "tgsi/util/tgsi_util.h"
+#include "tgsi/util/tgsi_build.h"
+#include "tgsi/util/tgsi_dump.h"
#include <llvm/Module.h>
@@ -44,7 +44,38 @@
#include <iostream>
using namespace llvm;
-#include "llvm_base_shader.cpp"
+
+static inline FunctionType *vertexShaderFunctionType()
+{
+ //Function takes three arguments,
+ // the calling code has to make sure the types it will
+ // pass are castable to the following:
+ // [4 x <4 x float>] inputs,
+ // [4 x <4 x float>] output,
+ // [4 x [4 x float]] consts,
+ // [4 x <4 x float>] temps
+
+ std::vector<const Type*> funcArgs;
+ VectorType *vectorType = VectorType::get(Type::FloatTy, 4);
+ ArrayType *vectorArray = ArrayType::get(vectorType, 4);
+ PointerType *vectorArrayPtr = PointerType::get(vectorArray, 0);
+
+ ArrayType *floatArray = ArrayType::get(Type::FloatTy, 4);
+ ArrayType *constsArray = ArrayType::get(floatArray, 4);
+ PointerType *constsArrayPtr = PointerType::get(constsArray, 0);
+
+ funcArgs.push_back(vectorArrayPtr);//inputs
+ funcArgs.push_back(vectorArrayPtr);//output
+ funcArgs.push_back(constsArrayPtr);//consts
+ funcArgs.push_back(vectorArrayPtr);//temps
+
+ FunctionType *functionType = FunctionType::get(
+ /*Result=*/Type::VoidTy,
+ /*Params=*/funcArgs,
+ /*isVarArg=*/false);
+
+ return functionType;
+}
static inline void
add_interpolator(struct gallivm_ir *ir,
@@ -117,10 +148,14 @@ translate_declaration(struct gallivm_ir *prog,
static void
translate_declarationir(struct gallivm_ir *,
llvm::Module *,
- StorageSoa *,
- struct tgsi_full_declaration *,
+ StorageSoa *storage,
+ struct tgsi_full_declaration *decl,
struct tgsi_full_declaration *)
{
+ if (decl->Declaration.File == TGSI_FILE_ADDRESS) {
+ int idx = decl->u.DeclarationRange.First;
+ storage->addAddress(idx);
+ }
}
static void
@@ -178,9 +213,8 @@ swizzleVector(llvm::Value *val, struct tgsi_full_src_register *src,
Storage *storage)
{
int swizzle = swizzleInt(src);
- const int NO_SWIZZLE = TGSI_SWIZZLE_X * 1000 + TGSI_SWIZZLE_Y * 100 +
- TGSI_SWIZZLE_Z * 10 + TGSI_SWIZZLE_W;
- if (swizzle != NO_SWIZZLE) {
+
+ if (gallivm_is_swizzle(swizzle)) {
/*fprintf(stderr, "XXXXXXXX swizzle = %d\n", swizzle);*/
val = storage->shuffleVector(val, swizzle);
}
@@ -673,18 +707,22 @@ translate_instructionir(llvm::Module *module,
if (src->SrcRegister.Indirect) {
indIdx = storage->addrElement(src->SrcRegisterInd.Index);
- indIdx = storage->extractIndex(indIdx);
}
if (src->SrcRegister.File == TGSI_FILE_CONSTANT) {
- val = storage->constElement(src->SrcRegister.Index, swizzle, indIdx);
+ val = storage->load(StorageSoa::Const,
+ src->SrcRegister.Index, swizzle, indIdx);
} else if (src->SrcRegister.File == TGSI_FILE_INPUT) {
- val = storage->inputElement(src->SrcRegister.Index, swizzle, indIdx);
+ val = storage->load(StorageSoa::Input,
+ src->SrcRegister.Index, swizzle, indIdx);
} else if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) {
- val = storage->tempElement(src->SrcRegister.Index, swizzle);
+ val = storage->load(StorageSoa::Temp,
+ src->SrcRegister.Index, swizzle, indIdx);
} else if (src->SrcRegister.File == TGSI_FILE_OUTPUT) {
- val = storage->outputElement(src->SrcRegister.Index, swizzle, indIdx);
+ val = storage->load(StorageSoa::Output,
+ src->SrcRegister.Index, swizzle, indIdx);
} else if (src->SrcRegister.File == TGSI_FILE_IMMEDIATE) {
- val = storage->immediateElement(src->SrcRegister.Index, swizzle);
+ val = storage->load(StorageSoa::Immediate,
+ src->SrcRegister.Index, swizzle, indIdx);
} else {
fprintf(stderr, "ERROR: not supported llvm source %d\n", src->SrcRegister.File);
return;
@@ -696,6 +734,7 @@ translate_instructionir(llvm::Module *module,
std::vector<llvm::Value*> out(4);
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_ARL: {
+ out = instr->arl(inputs[0]);
}
break;
case TGSI_OPCODE_MOV: {
@@ -745,6 +784,7 @@ translate_instructionir(llvm::Module *module,
}
break;
case TGSI_OPCODE_MAD: {
+ out = instr->madd(inputs[0], inputs[1], inputs[2]);
}
break;
case TGSI_OPCODE_SUB: {
@@ -1028,11 +1068,14 @@ translate_instructionir(llvm::Module *module,
struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i];
if (dst->DstRegister.File == TGSI_FILE_OUTPUT) {
- storage->storeOutput(dst->DstRegister.Index, out, dst->DstRegister.WriteMask);
+ storage->store(StorageSoa::Output,
+ dst->DstRegister.Index, out, dst->DstRegister.WriteMask);
} else if (dst->DstRegister.File == TGSI_FILE_TEMPORARY) {
- storage->storeTemp(dst->DstRegister.Index, out, dst->DstRegister.WriteMask);
+ storage->store(StorageSoa::Temp,
+ dst->DstRegister.Index, out, dst->DstRegister.WriteMask);
} else if (dst->DstRegister.File == TGSI_FILE_ADDRESS) {
- storage->storeAddress(dst->DstRegister.Index, out, dst->DstRegister.WriteMask);
+ storage->store(StorageSoa::Address,
+ dst->DstRegister.Index, out, dst->DstRegister.WriteMask);
} else {
fprintf(stderr, "ERROR: unsupported LLVM destination!");
assert(!"wrong destination");
@@ -1043,7 +1086,7 @@ translate_instructionir(llvm::Module *module,
llvm::Module *
tgsi_to_llvm(struct gallivm_ir *ir, const struct tgsi_token *tokens)
{
- llvm::Module *mod = createBaseShader();
+ llvm::Module *mod = new Module("shader");
struct tgsi_parse_context parse;
struct tgsi_full_instruction fi;
struct tgsi_full_declaration fd;
@@ -1107,29 +1150,32 @@ tgsi_to_llvm(struct gallivm_ir *ir, const struct tgsi_token *tokens)
llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir,
const struct tgsi_token *tokens)
{
- llvm::Module *mod = createBaseShader();
+ llvm::Module *mod = new Module("shader");
struct tgsi_parse_context parse;
struct tgsi_full_instruction fi;
struct tgsi_full_declaration fd;
unsigned instno = 0;
- Function* shader = mod->getFunction("execute_shader");
std::ostringstream stream;
if (ir->type == GALLIVM_VS) {
stream << "vs_shader";
} else {
stream << "fs_shader";
}
- stream << ir->id;
+ //stream << ir->id;
std::string func_name = stream.str();
- shader->setName(func_name.c_str());
+ Function *shader = llvm::cast<Function>(mod->getOrInsertFunction(
+ func_name.c_str(),
+ vertexShaderFunctionType()));
Function::arg_iterator args = shader->arg_begin();
Value *input = args++;
- input->setName("input");
+ input->setName("inputs");
Value *output = args++;
- output->setName("output");
+ output->setName("outputs");
Value *consts = args++;
consts->setName("consts");
+ Value *temps = args++;
+ temps->setName("temps");
BasicBlock *label_entry = new BasicBlock("entry", shader, 0);
@@ -1138,7 +1184,7 @@ llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir,
fi = tgsi_default_full_instruction();
fd = tgsi_default_full_declaration();
- StorageSoa storage(label_entry, input, output, consts);
+ StorageSoa storage(label_entry, input, output, consts, temps);
InstructionsSoa instr(mod, shader, label_entry, &storage);
while(!tgsi_parse_end_of_tokens(&parse)) {
@@ -1157,6 +1203,7 @@ llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir,
break;
case TGSI_TOKEN_TYPE_INSTRUCTION:
+ storage.declareImmediates();
translate_instructionir(mod, &storage, &instr,
&parse.FullToken.FullInstruction,
&fi, instno);
diff --git a/src/mesa/pipe/llvm/tgsitollvm.h b/src/gallium/auxiliary/llvm/tgsitollvm.h
index 7ada04d6299..7ada04d6299 100644
--- a/src/mesa/pipe/llvm/tgsitollvm.h
+++ b/src/gallium/auxiliary/llvm/tgsitollvm.h
diff --git a/src/mesa/pipe/pipebuffer/Makefile b/src/gallium/auxiliary/pipebuffer/Makefile
index 75764a9a188..588629e8701 100644
--- a/src/mesa/pipe/pipebuffer/Makefile
+++ b/src/gallium/auxiliary/pipebuffer/Makefile
@@ -17,7 +17,7 @@ C_SOURCES = \
ASM_SOURCES =
-include ../Makefile.template
+include ../../Makefile.template
symlinks:
diff --git a/src/mesa/pipe/pipebuffer/linked_list.h b/src/gallium/auxiliary/pipebuffer/linked_list.h
index e99817fb130..e99817fb130 100644
--- a/src/mesa/pipe/pipebuffer/linked_list.h
+++ b/src/gallium/auxiliary/pipebuffer/linked_list.h
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
index 97beb5f72a9..97beb5f72a9 100644
--- a/src/mesa/pipe/pipebuffer/pb_buffer.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index f4fc3f6d714..f4fc3f6d714 100644
--- a/src/mesa/pipe/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_fenced.h b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
index c40b9c75e18..c40b9c75e18 100644
--- a/src/mesa/pipe/pipebuffer/pb_buffer_fenced.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
index c1b7759874c..9e8244f909b 100644
--- a/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
@@ -110,7 +110,7 @@ pb_malloc_buffer_create(size_t size,
buf = CALLOC_STRUCT(malloc_buffer);
if(!buf)
return NULL;
-
+
buf->base.base.refcount = 1;
buf->base.base.alignment = desc->alignment;
buf->base.base.usage = desc->usage;
@@ -119,7 +119,7 @@ pb_malloc_buffer_create(size_t size,
buf->data = align_malloc(size, desc->alignment < sizeof(void*) ? sizeof(void*) : desc->alignment);
if(!buf->data) {
- FREE(buf);
+ align_free(buf);
return NULL;
}
diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
index 1ddf784c978..1ddf784c978 100644
--- a/src/mesa/pipe/pipebuffer/pb_bufmgr.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c
index c535d3276c9..c535d3276c9 100644
--- a/src/mesa/pipe/pipebuffer/pb_bufmgr_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c
diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
index 8b1b51c0e28..8b1b51c0e28 100644
--- a/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
index 04477a865a5..04477a865a5 100644
--- a/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
diff --git a/src/mesa/pipe/pipebuffer/pb_winsys.c b/src/gallium/auxiliary/pipebuffer/pb_winsys.c
index 978944091fd..978944091fd 100644
--- a/src/mesa/pipe/pipebuffer/pb_winsys.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_winsys.c
diff --git a/src/mesa/pipe/tgsi/Makefile b/src/gallium/auxiliary/tgsi/Makefile
index 12a8bd0409e..12a8bd0409e 100644
--- a/src/mesa/pipe/tgsi/Makefile
+++ b/src/gallium/auxiliary/tgsi/Makefile
diff --git a/src/mesa/pipe/tgsi/exec/Makefile b/src/gallium/auxiliary/tgsi/exec/Makefile
index eb8b14e0e89..eb8b14e0e89 100644
--- a/src/mesa/pipe/tgsi/exec/Makefile
+++ b/src/gallium/auxiliary/tgsi/exec/Makefile
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c
index 336ae1c8b6d..d7b18dc9c59 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c
@@ -54,8 +54,8 @@
#include "pipe/p_state.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
-#include "pipe/tgsi/util/tgsi_util.h"
+#include "tgsi/util/tgsi_parse.h"
+#include "tgsi/util/tgsi_util.h"
#include "tgsi_exec.h"
#define TILE_TOP_LEFT 0
@@ -120,18 +120,41 @@
-static void
-tgsi_exec_prepare( struct tgsi_exec_machine *mach )
+/**
+ * Initialize machine state by expanding tokens to full instructions,
+ * allocating temporary storage, setting up constants, etc.
+ * After this, we can call tgsi_exec_machine_run() many times.
+ */
+void
+tgsi_exec_machine_bind_shader(
+ struct tgsi_exec_machine *mach,
+ const struct tgsi_token *tokens,
+ uint numSamplers,
+ struct tgsi_sampler *samplers)
{
- struct tgsi_exec_labels *labels = &mach->Labels;
+ uint k;
struct tgsi_parse_context parse;
+ struct tgsi_exec_labels *labels = &mach->Labels;
struct tgsi_full_instruction *instructions;
struct tgsi_full_declaration *declarations;
uint maxInstructions = 10, numInstructions = 0;
uint maxDeclarations = 10, numDeclarations = 0;
- uint k;
uint instno = 0;
+#if 0
+ tgsi_dump(tokens, 0);
+#endif
+
+ mach->Tokens = tokens;
+ mach->Samplers = samplers;
+
+ k = tgsi_parse_init (&parse, mach->Tokens);
+ if (k != TGSI_PARSE_OK) {
+ debug_printf( "Problem parsing!\n" );
+ return;
+ }
+
+ mach->Processor = parse.FullHeader.Processor.Processor;
mach->ImmLimit = 0;
labels->count = 0;
@@ -141,11 +164,6 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach )
instructions = (struct tgsi_full_instruction *)
MALLOC( maxInstructions * sizeof(struct tgsi_full_instruction) );
- k = tgsi_parse_init( &parse, mach->Tokens );
- if (k != TGSI_PARSE_OK) {
- debug_printf("Problem parsing!\n");
- return;
- }
while( !tgsi_parse_end_of_tokens( &parse ) ) {
uint pointer = parse.Position;
@@ -158,13 +176,13 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach )
if (numDeclarations == maxDeclarations) {
declarations = REALLOC(declarations,
maxDeclarations
- * sizeof(struct tgsi_full_instruction),
+ * sizeof(struct tgsi_full_declaration),
(maxDeclarations + 10)
- * sizeof(struct tgsi_full_instruction));
+ * sizeof(struct tgsi_full_declaration));
maxDeclarations += 10;
}
memcpy(declarations + numDeclarations,
- &parse.FullToken.FullInstruction,
+ &parse.FullToken.FullDeclaration,
sizeof(declarations[0]));
numDeclarations++;
break;
@@ -176,7 +194,8 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach )
assert( mach->ImmLimit + size / 4 <= TGSI_EXEC_NUM_IMMEDIATES );
for( i = 0; i < size; i++ ) {
- mach->Imms[mach->ImmLimit + i / 4][i % 4] = parse.FullToken.FullImmediate.u.ImmediateFloat32[i].Float;
+ mach->Imms[mach->ImmLimit + i / 4][i % 4] =
+ parse.FullToken.FullImmediate.u.ImmediateFloat32[i].Float;
}
mach->ImmLimit += size / 4;
}
@@ -224,37 +243,11 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach )
}
-/**
- * Initialize machine state by expanding tokens to full instructions,
- * allocating temporary storage, setting up constants, etc.
- * After this, we can call tgsi_exec_machine_run() many times.
- */
void
tgsi_exec_machine_init(
- struct tgsi_exec_machine *mach,
- const struct tgsi_token *tokens,
- uint numSamplers,
- struct tgsi_sampler *samplers)
+ struct tgsi_exec_machine *mach )
{
- uint i, k;
- struct tgsi_parse_context parse;
-
-#if 0
- tgsi_dump(tokens, 0);
-#endif
-
- mach->Tokens = tokens;
-
- mach->Samplers = samplers;
-
- k = tgsi_parse_init (&parse, mach->Tokens);
- if (k != TGSI_PARSE_OK) {
- debug_printf( "Problem parsing!\n" );
- return;
- }
-
- mach->Processor = parse.FullHeader.Processor.Processor;
- tgsi_parse_free (&parse);
+ uint i;
mach->Temps = (struct tgsi_exec_vector *) tgsi_align_128bit( mach->_Temps);
mach->Addrs = &mach->Temps[TGSI_EXEC_NUM_TEMPS];
@@ -270,8 +263,6 @@ tgsi_exec_machine_init(
mach->Temps[TEMP_128_I].xyzw[TEMP_128_C].f[i] = 128.0f;
mach->Temps[TEMP_M128_I].xyzw[TEMP_M128_C].f[i] = -128.0f;
}
-
- tgsi_exec_prepare( mach );
}
@@ -1346,9 +1337,12 @@ exec_tex(struct tgsi_exec_machine *mach,
}
-
+/**
+ * Evaluate a constant-valued coefficient at the position of the
+ * current quad.
+ */
static void
-constant_interpolation(
+eval_constant_coef(
struct tgsi_exec_machine *mach,
unsigned attrib,
unsigned chan )
@@ -1360,8 +1354,12 @@ constant_interpolation(
}
}
+/**
+ * Evaluate a linear-valued coefficient at the position of the
+ * current quad.
+ */
static void
-linear_interpolation(
+eval_linear_coef(
struct tgsi_exec_machine *mach,
unsigned attrib,
unsigned chan )
@@ -1377,8 +1375,12 @@ linear_interpolation(
mach->Inputs[attrib].xyzw[chan].f[3] = a0 + dadx + dady;
}
+/**
+ * Evaluate a perspective-valued coefficient at the position of the
+ * current quad.
+ */
static void
-perspective_interpolation(
+eval_perspective_coef(
struct tgsi_exec_machine *mach,
unsigned attrib,
unsigned chan )
@@ -1397,7 +1399,7 @@ perspective_interpolation(
}
-typedef void (* interpolation_func)(
+typedef void (* eval_coef_func)(
struct tgsi_exec_machine *mach,
unsigned attrib,
unsigned chan );
@@ -1410,7 +1412,7 @@ exec_declaration(
if( mach->Processor == TGSI_PROCESSOR_FRAGMENT ) {
if( decl->Declaration.File == TGSI_FILE_INPUT ) {
unsigned first, last, mask;
- interpolation_func interp;
+ eval_coef_func eval;
assert( decl->Declaration.Declare == TGSI_DECLARE_RANGE );
@@ -1420,15 +1422,15 @@ exec_declaration(
switch( decl->Interpolation.Interpolate ) {
case TGSI_INTERPOLATE_CONSTANT:
- interp = constant_interpolation;
+ eval = eval_constant_coef;
break;
case TGSI_INTERPOLATE_LINEAR:
- interp = linear_interpolation;
+ eval = eval_linear_coef;
break;
case TGSI_INTERPOLATE_PERSPECTIVE:
- interp = perspective_interpolation;
+ eval = eval_perspective_coef;
break;
default:
@@ -1440,7 +1442,7 @@ exec_declaration(
for( i = first; i <= last; i++ ) {
for( j = 0; j < NUM_CHANNELS; j++ ) {
- interp( mach, i, j );
+ eval( mach, i, j );
}
}
}
@@ -1450,7 +1452,7 @@ exec_declaration(
for( j = 0; j < NUM_CHANNELS; j++ ) {
if( mask & (1 << j) ) {
for( i = first; i <= last; i++ ) {
- interp( mach, i, j );
+ eval( mach, i, j );
}
}
}
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.h b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.h
index 1fb66ee960f..45c49dd007c 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.h
@@ -215,12 +215,16 @@ struct tgsi_exec_machine
struct tgsi_exec_labels Labels;
};
-
void
tgsi_exec_machine_init(
+ struct tgsi_exec_machine *mach );
+
+
+void
+tgsi_exec_machine_bind_shader(
struct tgsi_exec_machine *mach,
const struct tgsi_token *tokens,
- unsigned numSamplers,
+ uint numSamplers,
struct tgsi_sampler *samplers);
uint
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
index 40bacf85526..62c6a69c63f 100755
--- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
@@ -27,8 +27,8 @@
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
-#include "pipe/tgsi/util/tgsi_util.h"
+#include "tgsi/util/tgsi_parse.h"
+#include "tgsi/util/tgsi_util.h"
#include "tgsi_exec.h"
#include "tgsi_sse2.h"
@@ -44,6 +44,9 @@ static void
_print_reg(
struct x86_reg reg )
{
+ if (reg.mod != mod_REG)
+ debug_printf( "[" );
+
switch( reg.file ) {
case file_REG32:
switch( reg.idx ) {
@@ -83,6 +86,13 @@ _print_reg(
assert( 0 );
break;
}
+
+ if (reg.mod == mod_DISP8 ||
+ reg.mod == mod_DISP32)
+ debug_printf("+%d", reg.disp);
+
+ if (reg.mod != mod_REG)
+ debug_printf( "]" );
}
static void
@@ -318,8 +328,11 @@ emit_call(
struct x86_function *func,
void (* addr)() )
{
+ struct x86_reg ecx = x86_make_reg( file_REG32, reg_CX );
+
DUMP_I( "CALL", addr );
- x86_call( func, addr );
+ x86_mov_reg_imm( func, ecx, (unsigned long) addr );
+ x86_call( func, ecx );
}
static void
@@ -1426,7 +1439,7 @@ emit_cmp(
}
}
-static void
+static int
emit_instruction(
struct x86_function *func,
struct tgsi_full_instruction *inst )
@@ -1537,11 +1550,11 @@ emit_instruction(
break;
case TGSI_OPCODE_EXP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_LOG:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_MUL:
@@ -1696,24 +1709,24 @@ emit_instruction(
break;
case TGSI_OPCODE_CND:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_CND0:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_DOT2ADD:
/* TGSI_OPCODE_DP2A */
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_INDEX:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_NEGATE:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_FRAC:
@@ -1726,7 +1739,7 @@ emit_instruction(
break;
case TGSI_OPCODE_CLAMP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_FLOOR:
@@ -1739,7 +1752,7 @@ emit_instruction(
break;
case TGSI_OPCODE_ROUND:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_EXPBASE2:
@@ -1814,7 +1827,7 @@ emit_instruction(
break;
case TGSI_OPCODE_MULTIPLYMATRIX:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ABS:
@@ -1827,7 +1840,7 @@ emit_instruction(
break;
case TGSI_OPCODE_RCC:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_DPH:
@@ -1858,11 +1871,11 @@ emit_instruction(
break;
case TGSI_OPCODE_DDX:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_DDY:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_KIL:
@@ -1870,35 +1883,35 @@ emit_instruction(
break;
case TGSI_OPCODE_PK2H:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_PK2US:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_PK4B:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_PK4UB:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_RFL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SEQ:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SFL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SGT:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SIN:
@@ -1910,66 +1923,73 @@ emit_instruction(
break;
case TGSI_OPCODE_SLE:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SNE:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_STR:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_TEX:
- emit_tempf(
- func,
- 0,
- TGSI_EXEC_TEMP_ONE_I,
- TGSI_EXEC_TEMP_ONE_C );
- FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
- STORE( func, *inst, 0, 0, chan_index );
+ if (0) {
+ /* Disable dummy texture code:
+ */
+ emit_tempf(
+ func,
+ 0,
+ TGSI_EXEC_TEMP_ONE_I,
+ TGSI_EXEC_TEMP_ONE_C );
+ FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
+ STORE( func, *inst, 0, 0, chan_index );
+ }
+ }
+ else {
+ return 0;
}
break;
case TGSI_OPCODE_TXD:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_UP2H:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_UP2US:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_UP4B:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_UP4UB:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_X2D:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ARA:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ARR:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_BRA:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_CAL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_RET:
@@ -1982,7 +2002,7 @@ emit_instruction(
break;
case TGSI_OPCODE_SSG:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_CMP:
@@ -2011,132 +2031,134 @@ emit_instruction(
break;
case TGSI_OPCODE_TXB:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_NRM:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_DIV:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_DP2:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_TXL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_BRK:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_IF:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_LOOP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_REP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ELSE:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ENDIF:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ENDLOOP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ENDREP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_PUSHA:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_POPA:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_CEIL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_I2F:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_NOT:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_TRUNC:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SHL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SHR:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_AND:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_OR:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_MOD:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_XOR:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SAD:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_TXF:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_TXQ:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_CONT:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_EMIT:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ENDPRIM:
- assert( 0 );
+ return 0;
break;
default:
- assert( 0 );
+ return 0;
}
+
+ return 1;
}
static void
@@ -2154,14 +2176,6 @@ emit_declaration(
last = decl->u.DeclarationRange.Last;
mask = decl->Declaration.UsageMask;
- /* Do not touch WPOS.xy */
- if( first == 0 ) {
- mask &= ~TGSI_WRITEMASK_XY;
- if( mask == TGSI_WRITEMASK_NONE ) {
- first++;
- }
- }
-
for( i = first; i <= last; i++ ) {
for( j = 0; j < NUM_CHANNELS; j++ ) {
if( mask & (1 << j) ) {
@@ -2172,9 +2186,9 @@ emit_declaration(
break;
case TGSI_INTERPOLATE_LINEAR:
- emit_inputf( func, 0, 0, TGSI_SWIZZLE_X );
+ emit_tempf( func, 0, 0, TGSI_SWIZZLE_X );
emit_coef_dadx( func, 1, i, j );
- emit_inputf( func, 2, 0, TGSI_SWIZZLE_Y );
+ emit_tempf( func, 2, 0, TGSI_SWIZZLE_Y );
emit_coef_dady( func, 3, i, j );
emit_mul( func, 0, 1 ); /* x * dadx */
emit_coef_a0( func, 4, i, j );
@@ -2185,12 +2199,12 @@ emit_declaration(
break;
case TGSI_INTERPOLATE_PERSPECTIVE:
- emit_inputf( func, 0, 0, TGSI_SWIZZLE_X );
+ emit_tempf( func, 0, 0, TGSI_SWIZZLE_X );
emit_coef_dadx( func, 1, i, j );
- emit_inputf( func, 2, 0, TGSI_SWIZZLE_Y );
+ emit_tempf( func, 2, 0, TGSI_SWIZZLE_Y );
emit_coef_dady( func, 3, i, j );
emit_mul( func, 0, 1 ); /* x * dadx */
- emit_inputf( func, 4, 0, TGSI_SWIZZLE_W );
+ emit_tempf( func, 4, 0, TGSI_SWIZZLE_W );
emit_coef_a0( func, 5, i, j );
emit_rcp( func, 4, 4 ); /* 1.0 / w */
emit_mul( func, 2, 3 ); /* y * dady */
@@ -2202,6 +2216,7 @@ emit_declaration(
default:
assert( 0 );
+ break;
}
}
}
@@ -2215,6 +2230,7 @@ tgsi_emit_sse2(
struct x86_function *func )
{
struct tgsi_parse_context parse;
+ unsigned ok = 1;
DUMP_START();
@@ -2239,7 +2255,7 @@ tgsi_emit_sse2(
tgsi_parse_init( &parse, tokens );
- while( !tgsi_parse_end_of_tokens( &parse ) ) {
+ while( !tgsi_parse_end_of_tokens( &parse ) && ok ) {
tgsi_parse_token( &parse );
switch( parse.FullToken.Token.Type ) {
@@ -2247,17 +2263,26 @@ tgsi_emit_sse2(
break;
case TGSI_TOKEN_TYPE_INSTRUCTION:
- emit_instruction(
- func,
- &parse.FullToken.FullInstruction );
+ ok = emit_instruction(
+ func,
+ &parse.FullToken.FullInstruction );
+
+ if (!ok) {
+ debug_printf("failed to translate tgsi opcode %d\n",
+ parse.FullToken.FullInstruction.Instruction.Opcode );
+ }
break;
case TGSI_TOKEN_TYPE_IMMEDIATE:
/* XXX implement this */
- return 0;
+ ok = 0;
+ debug_printf("failed to emit immediate value\n");
+ break;
default:
assert( 0 );
+ ok = 0;
+ break;
}
}
@@ -2265,7 +2290,7 @@ tgsi_emit_sse2(
DUMP_END();
- return 1;
+ return ok;
}
/**
@@ -2283,6 +2308,7 @@ tgsi_emit_sse2_fs(
{
struct tgsi_parse_context parse;
boolean instruction_phase = FALSE;
+ unsigned ok = 1;
DUMP_START();
@@ -2308,7 +2334,7 @@ tgsi_emit_sse2_fs(
tgsi_parse_init( &parse, tokens );
- while( !tgsi_parse_end_of_tokens( &parse ) ) {
+ while( !tgsi_parse_end_of_tokens( &parse ) && ok ) {
tgsi_parse_token( &parse );
switch( parse.FullToken.Token.Type ) {
@@ -2327,17 +2353,18 @@ tgsi_emit_sse2_fs(
get_output_base(),
get_argument( 1 ) );
}
- emit_instruction(
+ ok = emit_instruction(
func,
&parse.FullToken.FullInstruction );
break;
case TGSI_TOKEN_TYPE_IMMEDIATE:
/* XXX implement this */
- assert(0);
+ ok = 0;
break;
default:
+ ok = 0;
assert( 0 );
}
}
@@ -2346,7 +2373,7 @@ tgsi_emit_sse2_fs(
DUMP_END();
- return 1;
+ return ok;
}
#endif /* i386 */
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.h b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h
index 9bee3717665..9bee3717665 100755
--- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.h
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h
diff --git a/src/mesa/pipe/tgsi/util/tgsi_build.c b/src/gallium/auxiliary/tgsi/util/tgsi_build.c
index a00ff1c2a5f..a00ff1c2a5f 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_build.c
diff --git a/src/mesa/pipe/tgsi/util/tgsi_build.h b/src/gallium/auxiliary/tgsi/util/tgsi_build.h
index 116c78abf34..116c78abf34 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_build.h
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_build.h
diff --git a/src/mesa/pipe/tgsi/util/tgsi_dump.c b/src/gallium/auxiliary/tgsi/util/tgsi_dump.c
index b5c54847e0b..b5c54847e0b 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_dump.c
diff --git a/src/mesa/pipe/tgsi/util/tgsi_dump.h b/src/gallium/auxiliary/tgsi/util/tgsi_dump.h
index 1adc9db2519..1adc9db2519 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_dump.h
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_dump.h
diff --git a/src/mesa/pipe/tgsi/util/tgsi_parse.c b/src/gallium/auxiliary/tgsi/util/tgsi_parse.c
index bf6b89ce564..bf6b89ce564 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_parse.c
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_parse.c
diff --git a/src/mesa/pipe/tgsi/util/tgsi_parse.h b/src/gallium/auxiliary/tgsi/util/tgsi_parse.h
index 9372da8d5d1..9372da8d5d1 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_parse.h
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_parse.h
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_transform.c b/src/gallium/auxiliary/tgsi/util/tgsi_transform.c
new file mode 100644
index 00000000000..357f77b05a6
--- /dev/null
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_transform.c
@@ -0,0 +1,199 @@
+/**************************************************************************
+ *
+ * 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.
+ *
+ **************************************************************************/
+
+/**
+ * TGSI program transformation utility.
+ *
+ * Authors: Brian Paul
+ */
+
+
+#include "tgsi_transform.h"
+
+
+
+static void
+emit_instruction(struct tgsi_transform_context *ctx,
+ const struct tgsi_full_instruction *inst)
+{
+ uint ti = ctx->ti;
+
+ ti += tgsi_build_full_instruction(inst,
+ ctx->tokens_out + ti,
+ ctx->header,
+ ctx->max_tokens_out - ti);
+ ctx->ti = ti;
+}
+
+
+static void
+emit_declaration(struct tgsi_transform_context *ctx,
+ const struct tgsi_full_declaration *decl)
+{
+ uint ti = ctx->ti;
+
+ ti += tgsi_build_full_declaration(decl,
+ ctx->tokens_out + ti,
+ ctx->header,
+ ctx->max_tokens_out - ti);
+ ctx->ti = ti;
+}
+
+
+static void
+emit_immediate(struct tgsi_transform_context *ctx,
+ const struct tgsi_full_immediate *imm)
+{
+ uint ti = ctx->ti;
+
+ ti += tgsi_build_full_immediate(imm,
+ ctx->tokens_out + ti,
+ ctx->header,
+ ctx->max_tokens_out - ti);
+ ctx->ti = ti;
+}
+
+
+
+/**
+ * Apply user-defined transformations to the input shader to produce
+ * the output shader.
+ * For example, a register search-and-replace operation could be applied
+ * by defining a transform_instruction() callback that examined and changed
+ * the instruction src/dest regs.
+ *
+ * \return number of tokens emitted
+ */
+int
+tgsi_transform_shader(const struct tgsi_token *tokens_in,
+ struct tgsi_token *tokens_out,
+ uint max_tokens_out,
+ struct tgsi_transform_context *ctx)
+{
+ uint procType;
+
+ /* input shader */
+ struct tgsi_parse_context parse;
+
+ /* output shader */
+ struct tgsi_processor *processor;
+
+
+ /**
+ ** callback context init
+ **/
+ ctx->emit_instruction = emit_instruction;
+ ctx->emit_declaration = emit_declaration;
+ ctx->emit_immediate = emit_immediate;
+ ctx->tokens_out = tokens_out;
+ ctx->max_tokens_out = max_tokens_out;
+
+
+ /**
+ ** Setup to begin parsing input shader
+ **/
+ if (tgsi_parse_init( &parse, tokens_in ) != TGSI_PARSE_OK) {
+ debug_printf("tgsi_parse_init() failed in tgsi_transform_shader()!\n");
+ return -1;
+ }
+ procType = parse.FullHeader.Processor.Processor;
+ assert(procType == TGSI_PROCESSOR_FRAGMENT ||
+ procType == TGSI_PROCESSOR_VERTEX ||
+ procType == TGSI_PROCESSOR_GEOMETRY);
+
+
+ /**
+ ** Setup output shader
+ **/
+ *(struct tgsi_version *) &tokens_out[0] = tgsi_build_version();
+
+ ctx->header = (struct tgsi_header *) (tokens_out + 1);
+ *ctx->header = tgsi_build_header();
+
+ processor = (struct tgsi_processor *) (tokens_out + 2);
+ *processor = tgsi_build_processor( procType, ctx->header );
+
+ ctx->ti = 3;
+
+
+ /**
+ ** Loop over incoming program tokens/instructions
+ */
+ while( !tgsi_parse_end_of_tokens( &parse ) ) {
+
+ tgsi_parse_token( &parse );
+
+ switch( parse.FullToken.Token.Type ) {
+ case TGSI_TOKEN_TYPE_INSTRUCTION:
+ {
+ struct tgsi_full_instruction *fullinst
+ = &parse.FullToken.FullInstruction;
+
+ if (ctx->transform_instruction)
+ ctx->transform_instruction(ctx, fullinst);
+ else
+ ctx->emit_instruction(ctx, fullinst);
+ }
+ break;
+
+ case TGSI_TOKEN_TYPE_DECLARATION:
+ {
+ struct tgsi_full_declaration *fulldecl
+ = &parse.FullToken.FullDeclaration;
+
+ if (ctx->transform_declaration)
+ ctx->transform_declaration(ctx, fulldecl);
+ else
+ ctx->emit_declaration(ctx, fulldecl);
+ }
+ break;
+
+ case TGSI_TOKEN_TYPE_IMMEDIATE:
+ {
+ struct tgsi_full_immediate *fullimm
+ = &parse.FullToken.FullImmediate;
+
+ if (ctx->transform_immediate)
+ ctx->transform_immediate(ctx, fullimm);
+ else
+ ctx->emit_immediate(ctx, fullimm);
+ }
+ break;
+
+ default:
+ assert( 0 );
+ }
+ }
+
+ if (ctx->epilog) {
+ ctx->epilog(ctx);
+ }
+
+ tgsi_parse_free (&parse);
+
+ return ctx->ti;
+}
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_transform.h b/src/gallium/auxiliary/tgsi/util/tgsi_transform.h
new file mode 100644
index 00000000000..fcf85d603be
--- /dev/null
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_transform.h
@@ -0,0 +1,93 @@
+/**************************************************************************
+ *
+ * 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 TGSI_TRANSFORM_H
+#define TGSI_TRANSFORM_H
+
+
+#include "pipe/p_util.h"
+#include "pipe/p_shader_tokens.h"
+#include "tgsi/util/tgsi_parse.h"
+#include "tgsi/util/tgsi_build.h"
+
+
+
+/**
+ * Subclass this to add caller-specific data
+ */
+struct tgsi_transform_context
+{
+/**** PUBLIC ***/
+
+ /**
+ * User-defined callbacks invoked per instruction.
+ */
+ void (*transform_instruction)(struct tgsi_transform_context *ctx,
+ struct tgsi_full_instruction *inst);
+
+ void (*transform_declaration)(struct tgsi_transform_context *ctx,
+ struct tgsi_full_declaration *decl);
+
+ void (*transform_immediate)(struct tgsi_transform_context *ctx,
+ struct tgsi_full_immediate *imm);
+
+ /**
+ * Called at end of input program to allow caller to append extra
+ * instructions. Return number of tokens emitted.
+ */
+ void (*epilog)(struct tgsi_transform_context *ctx);
+
+
+/*** PRIVATE ***/
+
+ /**
+ * These are setup by tgsi_transform_shader() and cannot be overridden.
+ * Meant to be called from in the above user callback functions.
+ */
+ void (*emit_instruction)(struct tgsi_transform_context *ctx,
+ const struct tgsi_full_instruction *inst);
+ void (*emit_declaration)(struct tgsi_transform_context *ctx,
+ const struct tgsi_full_declaration *decl);
+ void (*emit_immediate)(struct tgsi_transform_context *ctx,
+ const struct tgsi_full_immediate *imm);
+
+ struct tgsi_header *header;
+ uint max_tokens_out;
+ struct tgsi_token *tokens_out;
+ uint ti;
+};
+
+
+
+extern int
+tgsi_transform_shader(const struct tgsi_token *tokens_in,
+ struct tgsi_token *tokens_out,
+ uint max_tokens_out,
+ struct tgsi_transform_context *ctx);
+
+
+#endif /* TGSI_TRANSFORM_H */
diff --git a/src/mesa/pipe/tgsi/util/tgsi_util.c b/src/gallium/auxiliary/tgsi/util/tgsi_util.c
index 4cdd89182ad..4cdd89182ad 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_util.c
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_util.c
diff --git a/src/mesa/pipe/tgsi/util/tgsi_util.h b/src/gallium/auxiliary/tgsi/util/tgsi_util.h
index ef14446f0e4..ef14446f0e4 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_util.h
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_util.h
diff --git a/src/mesa/pipe/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c
index b9607a6ba7f..b9607a6ba7f 100644
--- a/src/mesa/pipe/util/p_debug.c
+++ b/src/gallium/auxiliary/util/p_debug.c
diff --git a/src/mesa/pipe/util/p_tile.c b/src/gallium/auxiliary/util/p_tile.c
index 3f795a38989..3f795a38989 100644
--- a/src/mesa/pipe/util/p_tile.c
+++ b/src/gallium/auxiliary/util/p_tile.c
diff --git a/src/mesa/pipe/util/p_tile.h b/src/gallium/auxiliary/util/p_tile.h
index cd8124bf11f..cd8124bf11f 100644
--- a/src/mesa/pipe/util/p_tile.h
+++ b/src/gallium/auxiliary/util/p_tile.h
diff --git a/src/mesa/pipe/util/p_util.c b/src/gallium/auxiliary/util/p_util.c
index c4882b77d2d..2a92f8e408b 100644
--- a/src/mesa/pipe/util/p_util.c
+++ b/src/gallium/auxiliary/util/p_util.c
@@ -47,9 +47,9 @@ pipe_copy_rect(ubyte * dst,
unsigned width,
unsigned height,
const ubyte * src,
- unsigned src_pitch,
+ int src_pitch,
unsigned src_x,
- unsigned src_y)
+ int src_y)
{
unsigned i;
diff --git a/src/gallium/drivers/Makefile b/src/gallium/drivers/Makefile
new file mode 100644
index 00000000000..c0345a9cb54
--- /dev/null
+++ b/src/gallium/drivers/Makefile
@@ -0,0 +1,24 @@
+TOP = ../../..
+include $(TOP)/configs/current
+
+
+ifeq ($(CONFIG_NAME), linux-cell)
+CELL_DIR = cell
+endif
+
+SUBDIRS = softpipe i915simple i965simple failover pipebuffer $(CELL_DIR)
+
+
+default: subdirs
+
+
+subdirs:
+ @for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE)) || exit 1 ; \
+ fi \
+ done
+
+
+clean:
+ rm -f `find . -name \*.[oa]`
diff --git a/src/mesa/pipe/cell/Makefile b/src/gallium/drivers/cell/Makefile
index 47aef7b05f6..47aef7b05f6 100644
--- a/src/mesa/pipe/cell/Makefile
+++ b/src/gallium/drivers/cell/Makefile
diff --git a/src/mesa/pipe/cell/common.h b/src/gallium/drivers/cell/common.h
index 4de514c3586..74b131fbefc 100644
--- a/src/mesa/pipe/cell/common.h
+++ b/src/gallium/drivers/cell/common.h
@@ -90,6 +90,7 @@
#define CELL_CMD_STATE_VS_ARRAY_INFO 16
#define CELL_CMD_STATE_BLEND 17
#define CELL_CMD_VS_EXECUTE 18
+#define CELL_CMD_STATE_ATTRIB_FETCH 19
#define CELL_NUM_BUFFERS 4
@@ -128,13 +129,19 @@ struct cell_command_clear_surface
*/
struct cell_array_info
{
- uint64_t base; /**< Base address of the 0th element. */
- uint attr; /**< Attribute that this state is for. */
- uint pitch; /**< Byte pitch from one entry to the next. */
- uint format; /**< Pipe format of each entry. */
+ uint64_t base; /**< Base address of the 0th element. */
+ uint attr; /**< Attribute that this state is for. */
+ uint pitch; /**< Byte pitch from one entry to the next. */
+ uint size;
+ uint function_offset;
} ALIGN16_ATTRIB;
+struct cell_attribute_fetch_code {
+ uint64_t base;
+ uint size;
+};
+
struct cell_shader_info
{
unsigned num_outputs;
diff --git a/src/mesa/pipe/cell/ppu/Makefile b/src/gallium/drivers/cell/ppu/Makefile
index 50060f5cd30..196ab777f54 100644
--- a/src/mesa/pipe/cell/ppu/Makefile
+++ b/src/gallium/drivers/cell/ppu/Makefile
@@ -34,14 +34,18 @@ SOURCES = \
cell_surface.c \
cell_texture.c \
cell_vbuf.c \
+ cell_vertex_fetch.c \
cell_vertex_shader.c \
cell_winsys.c
OBJECTS = $(SOURCES:.c=.o) \
-INCLUDE_DIRS = -I$(TOP)/src/mesa
-
+INCLUDE_DIRS = \
+ -I$(TOP)/src/mesa \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium/drivers
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
diff --git a/src/mesa/pipe/cell/ppu/cell_batch.c b/src/gallium/drivers/cell/ppu/cell_batch.c
index f45e5f25b64..f45e5f25b64 100644
--- a/src/mesa/pipe/cell/ppu/cell_batch.c
+++ b/src/gallium/drivers/cell/ppu/cell_batch.c
diff --git a/src/mesa/pipe/cell/ppu/cell_batch.h b/src/gallium/drivers/cell/ppu/cell_batch.h
index a6eee0a8b18..a6eee0a8b18 100644
--- a/src/mesa/pipe/cell/ppu/cell_batch.h
+++ b/src/gallium/drivers/cell/ppu/cell_batch.h
diff --git a/src/mesa/pipe/cell/ppu/cell_clear.c b/src/gallium/drivers/cell/ppu/cell_clear.c
index 07b908eec59..e588a30d5bc 100644
--- a/src/mesa/pipe/cell/ppu/cell_clear.c
+++ b/src/gallium/drivers/cell/ppu/cell_clear.c
@@ -35,7 +35,7 @@
#include <stdint.h>
#include "pipe/p_inlines.h"
#include "pipe/p_util.h"
-#include "pipe/cell/common.h"
+#include "cell/common.h"
#include "cell_clear.h"
#include "cell_context.h"
#include "cell_batch.h"
diff --git a/src/mesa/pipe/cell/ppu/cell_clear.h b/src/gallium/drivers/cell/ppu/cell_clear.h
index ff47d43f4cd..ff47d43f4cd 100644
--- a/src/mesa/pipe/cell/ppu/cell_clear.h
+++ b/src/gallium/drivers/cell/ppu/cell_clear.h
diff --git a/src/mesa/pipe/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c
index bbe1fd7a111..e1eb22f4685 100644
--- a/src/mesa/pipe/cell/ppu/cell_context.c
+++ b/src/gallium/drivers/cell/ppu/cell_context.c
@@ -37,9 +37,9 @@
#include "pipe/p_format.h"
#include "pipe/p_util.h"
#include "pipe/p_winsys.h"
-#include "pipe/cell/common.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/draw/draw_private.h"
+#include "cell/common.h"
+#include "draw/draw_context.h"
+#include "draw/draw_private.h"
#include "cell_clear.h"
#include "cell_context.h"
#include "cell_draw_arrays.h"
diff --git a/src/mesa/pipe/cell/ppu/cell_context.h b/src/gallium/drivers/cell/ppu/cell_context.h
index 3b63419b5eb..91f8e542a25 100644
--- a/src/mesa/pipe/cell/ppu/cell_context.h
+++ b/src/gallium/drivers/cell/ppu/cell_context.h
@@ -32,10 +32,11 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/draw/draw_vertex.h"
-#include "pipe/draw/draw_vbuf.h"
+#include "draw/draw_vertex.h"
+#include "draw/draw_vbuf.h"
#include "cell_winsys.h"
-#include "pipe/cell/common.h"
+#include "cell/common.h"
+#include "ppc/rtasm/spe_asm.h"
struct cell_vbuf_render;
@@ -111,6 +112,9 @@ struct cell_context
/** [4] to ensure 16-byte alignment for each status word */
uint buffer_status[CELL_MAX_SPUS][CELL_NUM_BUFFERS][4] ALIGN16_ATTRIB;
+
+ struct spe_function attrib_fetch;
+ unsigned attrib_fetch_offsets[PIPE_ATTRIB_MAX];
};
diff --git a/src/mesa/pipe/cell/ppu/cell_draw_arrays.c b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
index 717cd8370f9..f12613649b9 100644
--- a/src/mesa/pipe/cell/ppu/cell_draw_arrays.c
+++ b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
@@ -39,7 +39,7 @@
#include "cell_draw_arrays.h"
#include "cell_state.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
diff --git a/src/mesa/pipe/cell/ppu/cell_draw_arrays.h b/src/gallium/drivers/cell/ppu/cell_draw_arrays.h
index d5df4aa05f8..d5df4aa05f8 100644
--- a/src/mesa/pipe/cell/ppu/cell_draw_arrays.h
+++ b/src/gallium/drivers/cell/ppu/cell_draw_arrays.h
diff --git a/src/mesa/pipe/cell/ppu/cell_flush.c b/src/gallium/drivers/cell/ppu/cell_flush.c
index f62bc4650ce..20f27531fce 100644
--- a/src/mesa/pipe/cell/ppu/cell_flush.c
+++ b/src/gallium/drivers/cell/ppu/cell_flush.c
@@ -31,7 +31,7 @@
#include "cell_flush.h"
#include "cell_spu.h"
#include "cell_render.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
void
diff --git a/src/mesa/pipe/cell/ppu/cell_flush.h b/src/gallium/drivers/cell/ppu/cell_flush.h
index eda351b1cbc..eda351b1cbc 100644
--- a/src/mesa/pipe/cell/ppu/cell_flush.h
+++ b/src/gallium/drivers/cell/ppu/cell_flush.h
diff --git a/src/mesa/pipe/cell/ppu/cell_render.c b/src/gallium/drivers/cell/ppu/cell_render.c
index 4ab277a4b24..b663b376222 100644
--- a/src/mesa/pipe/cell/ppu/cell_render.c
+++ b/src/gallium/drivers/cell/ppu/cell_render.c
@@ -34,7 +34,7 @@
#include "cell_render.h"
#include "cell_spu.h"
#include "pipe/p_util.h"
-#include "pipe/draw/draw_private.h"
+#include "draw/draw_private.h"
struct render_stage {
diff --git a/src/mesa/pipe/cell/ppu/cell_render.h b/src/gallium/drivers/cell/ppu/cell_render.h
index 826dcbafeba..826dcbafeba 100644
--- a/src/mesa/pipe/cell/ppu/cell_render.h
+++ b/src/gallium/drivers/cell/ppu/cell_render.h
diff --git a/src/mesa/pipe/cell/ppu/cell_spu.c b/src/gallium/drivers/cell/ppu/cell_spu.c
index 7c83a47e574..419e74dc402 100644
--- a/src/mesa/pipe/cell/ppu/cell_spu.c
+++ b/src/gallium/drivers/cell/ppu/cell_spu.c
@@ -31,7 +31,7 @@
#include "cell_spu.h"
#include "pipe/p_format.h"
#include "pipe/p_state.h"
-#include "pipe/cell/common.h"
+#include "cell/common.h"
/*
diff --git a/src/mesa/pipe/cell/ppu/cell_spu.h b/src/gallium/drivers/cell/ppu/cell_spu.h
index 19eff94f967..137f26612e4 100644
--- a/src/mesa/pipe/cell/ppu/cell_spu.h
+++ b/src/gallium/drivers/cell/ppu/cell_spu.h
@@ -31,7 +31,7 @@
#include <libspe2.h>
#include <libmisc.h>
-#include "pipe/cell/common.h"
+#include "cell/common.h"
#include "cell_context.h"
diff --git a/src/mesa/pipe/cell/ppu/cell_state.h b/src/gallium/drivers/cell/ppu/cell_state.h
index 3a71ba14fa8..3a71ba14fa8 100644
--- a/src/mesa/pipe/cell/ppu/cell_state.h
+++ b/src/gallium/drivers/cell/ppu/cell_state.h
diff --git a/src/mesa/pipe/cell/ppu/cell_state_blend.c b/src/gallium/drivers/cell/ppu/cell_state_blend.c
index 4fc60548c85..b6d6d71f0ce 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_blend.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_blend.c
@@ -29,7 +29,7 @@
*/
#include "pipe/p_util.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
#include "cell_context.h"
#include "cell_state.h"
diff --git a/src/mesa/pipe/cell/ppu/cell_state_clip.c b/src/gallium/drivers/cell/ppu/cell_state_clip.c
index 4f43665941d..0482f87e889 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_clip.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_clip.c
@@ -30,7 +30,7 @@
#include "cell_context.h"
#include "cell_state.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
void cell_set_clip_state( struct pipe_context *pipe,
diff --git a/src/mesa/pipe/cell/ppu/cell_state_derived.c b/src/gallium/drivers/cell/ppu/cell_state_derived.c
index 56daf5dfde0..0c468292584 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_derived.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_derived.c
@@ -27,8 +27,8 @@
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/draw/draw_vertex.h"
+#include "draw/draw_context.h"
+#include "draw/draw_vertex.h"
#include "cell_context.h"
#include "cell_batch.h"
#include "cell_state.h"
diff --git a/src/mesa/pipe/cell/ppu/cell_state_emit.c b/src/gallium/drivers/cell/ppu/cell_state_emit.c
index 5d2a7864493..5d2a7864493 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_emit.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_emit.c
diff --git a/src/mesa/pipe/cell/ppu/cell_state_emit.h b/src/gallium/drivers/cell/ppu/cell_state_emit.h
index 59f8affe8d3..59f8affe8d3 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_emit.h
+++ b/src/gallium/drivers/cell/ppu/cell_state_emit.h
diff --git a/src/mesa/pipe/cell/ppu/cell_state_fs.c b/src/gallium/drivers/cell/ppu/cell_state_fs.c
index 3f46a87d189..b2ed699a5be 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_fs.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_fs.c
@@ -29,12 +29,12 @@
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
#if 0
#include "pipe/p_shader_tokens.h"
-#include "pipe/llvm/gallivm.h"
-#include "pipe/tgsi/util/tgsi_dump.h"
-#include "pipe/tgsi/exec/tgsi_sse2.h"
+#include "llvm/gallivm.h"
+#include "tgsi/util/tgsi_dump.h"
+#include "tgsi/exec/tgsi_sse2.h"
#endif
#include "cell_context.h"
diff --git a/src/mesa/pipe/cell/ppu/cell_state_rasterizer.c b/src/gallium/drivers/cell/ppu/cell_state_rasterizer.c
index d8128ece54d..7eca5b57656 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_rasterizer.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_rasterizer.c
@@ -27,7 +27,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
#include "cell_context.h"
#include "cell_state.h"
diff --git a/src/mesa/pipe/cell/ppu/cell_state_sampler.c b/src/gallium/drivers/cell/ppu/cell_state_sampler.c
index ade6cc8338e..a33421a4ad0 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_sampler.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_sampler.c
@@ -30,7 +30,7 @@
*/
#include "pipe/p_util.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
#include "cell_context.h"
#include "cell_state.h"
#include "cell_texture.h"
diff --git a/src/mesa/pipe/cell/ppu/cell_state_surface.c b/src/gallium/drivers/cell/ppu/cell_state_surface.c
index 287610b76b9..287610b76b9 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_surface.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_surface.c
diff --git a/src/mesa/pipe/cell/ppu/cell_state_vertex.c b/src/gallium/drivers/cell/ppu/cell_state_vertex.c
index 0f01e920f95..563831b62db 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_vertex.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_vertex.c
@@ -32,7 +32,7 @@
#include "cell_context.h"
#include "cell_state.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
void
diff --git a/src/mesa/pipe/cell/ppu/cell_surface.c b/src/gallium/drivers/cell/ppu/cell_surface.c
index 6b7b9181282..a35db0ef991 100644
--- a/src/mesa/pipe/cell/ppu/cell_surface.c
+++ b/src/gallium/drivers/cell/ppu/cell_surface.c
@@ -29,7 +29,7 @@
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-#include "pipe/util/p_tile.h"
+#include "util/p_tile.h"
#include "cell_context.h"
#include "cell_surface.h"
@@ -60,6 +60,7 @@ cell_surface_data(struct pipe_context *pipe,
static void
cell_surface_copy(struct pipe_context *pipe,
+ unsigned do_flip,
struct pipe_surface *dst,
unsigned dstx, unsigned dsty,
struct pipe_surface *src,
@@ -74,8 +75,8 @@ cell_surface_copy(struct pipe_context *pipe,
dstx, dsty,
width, height,
pipe_surface_map(src),
- src->pitch,
- srcx, srcy);
+ do_flip ? -src->pitch : src->pitch,
+ srcx, do_flip ? 1 - srcy - height : srcy);
pipe_surface_unmap(src);
pipe_surface_unmap(dst);
diff --git a/src/mesa/pipe/cell/ppu/cell_surface.h b/src/gallium/drivers/cell/ppu/cell_surface.h
index 9e58f329443..9e58f329443 100644
--- a/src/mesa/pipe/cell/ppu/cell_surface.h
+++ b/src/gallium/drivers/cell/ppu/cell_surface.h
diff --git a/src/mesa/pipe/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c
index df178d9ca24..c8ef36002f7 100644
--- a/src/mesa/pipe/cell/ppu/cell_texture.c
+++ b/src/gallium/drivers/cell/ppu/cell_texture.c
@@ -61,7 +61,7 @@ cell_texture_layout(struct cell_texture * spt)
spt->buffer_size = 0;
- for ( level = pt->first_level ; level <= pt->last_level ; level++ ) {
+ for ( level = 0 ; level <= pt->last_level ; level++ ) {
pt->width[level] = width;
pt->height[level] = height;
pt->depth[level] = depth;
diff --git a/src/mesa/pipe/cell/ppu/cell_texture.h b/src/gallium/drivers/cell/ppu/cell_texture.h
index 0264fed88e6..0264fed88e6 100644
--- a/src/mesa/pipe/cell/ppu/cell_texture.h
+++ b/src/gallium/drivers/cell/ppu/cell_texture.h
diff --git a/src/mesa/pipe/cell/ppu/cell_vbuf.c b/src/gallium/drivers/cell/ppu/cell_vbuf.c
index e9fafe492ee..cc727ff4edb 100644
--- a/src/mesa/pipe/cell/ppu/cell_vbuf.c
+++ b/src/gallium/drivers/cell/ppu/cell_vbuf.c
@@ -36,7 +36,7 @@
#include "cell_flush.h"
#include "cell_spu.h"
#include "cell_vbuf.h"
-#include "pipe/draw/draw_vbuf.h"
+#include "draw/draw_vbuf.h"
/** Allow vertex data to be inlined after RENDER command */
diff --git a/src/mesa/pipe/cell/ppu/cell_vbuf.h b/src/gallium/drivers/cell/ppu/cell_vbuf.h
index d265cbf7701..d265cbf7701 100644
--- a/src/mesa/pipe/cell/ppu/cell_vbuf.h
+++ b/src/gallium/drivers/cell/ppu/cell_vbuf.h
diff --git a/src/gallium/drivers/cell/ppu/cell_vertex_fetch.c b/src/gallium/drivers/cell/ppu/cell_vertex_fetch.c
new file mode 100644
index 00000000000..f10689a959e
--- /dev/null
+++ b/src/gallium/drivers/cell/ppu/cell_vertex_fetch.c
@@ -0,0 +1,383 @@
+/*
+ * (C) Copyright IBM Corporation 2008
+ * 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
+ * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <inttypes.h>
+#include "pipe/p_defines.h"
+#include "pipe/p_context.h"
+#include "pipe/p_format.h"
+
+#include "../auxiliary/draw/draw_context.h"
+#include "../auxiliary/draw/draw_private.h"
+
+#include "cell_context.h"
+#include "ppc/rtasm/spe_asm.h"
+
+typedef uint64_t register_mask;
+
+int allocate_available_register(register_mask *m)
+{
+ unsigned i;
+ for (i = 0; i < 64; i++) {
+ const uint64_t mask = (1ULL << i);
+
+ if ((m[0] & mask) != 0) {
+ m[0] &= ~mask;
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+
+int allocate_register(register_mask *m, unsigned reg)
+{
+ assert((m[0] & (1ULL << reg)) != 0);
+
+ m[0] &= ~(1ULL << reg);
+ return reg;
+}
+
+
+void release_register(register_mask *m, unsigned reg)
+{
+ assert((m[0] & (1ULL << reg)) == 0);
+
+ m[0] |= (1ULL << reg);
+}
+
+
+/**
+ * Emit a 4x4 matrix transpose operation
+ *
+ * \param p Function that the transpose operation is to be appended to
+ * \param m Live register mask
+ * \param row0 Register containing row 0 of the source matrix
+ * \param row1 Register containing row 1 of the source matrix
+ * \param row2 Register containing row 2 of the source matrix
+ * \param row3 Register containing row 3 of the source matrix
+ * \param dest_ptr Register containing the address of the destination matrix
+ * \param shuf_ptr Register containing the address of the shuffled data
+ * \param count Number of colums to actually be written to the destination
+ *
+ * \note
+ * This function assumes that the registers named by \c row0, \c row1,
+ * \c row2, and \c row3 are scratch and can be modified by the generated code.
+ * Furthermore, these registers will be released, via calls to
+ * \c release_register, by this function.
+ *
+ * \note
+ * This function requires that four temporary are available on entry.
+ */
+static void
+emit_matrix_transpose(struct spe_function *p, register_mask *m,
+ unsigned row0, unsigned row1, unsigned row2,
+ unsigned row3, unsigned dest_ptr,
+ unsigned shuf_ptr, unsigned count)
+{
+ int shuf_hi = allocate_available_register(m);
+ int shuf_lo = allocate_available_register(m);
+ int t1 = allocate_available_register(m);
+ int t2 = allocate_available_register(m);
+ int t3;
+ int t4;
+ int col0;
+ int col1;
+ int col2;
+ int col3;
+
+
+ spe_lqd(p, shuf_hi, shuf_ptr, 3);
+ spe_lqd(p, shuf_lo, shuf_ptr, 4);
+ spe_shufb(p, t1, row0, row2, shuf_hi);
+ spe_shufb(p, t2, row0, row2, shuf_lo);
+
+
+ /* row0 and row2 are now no longer needed. Re-use those registers as
+ * temporaries.
+ */
+ t3 = row0;
+ t4 = row2;
+
+ spe_shufb(p, t3, row1, row3, shuf_hi);
+ spe_shufb(p, t4, row1, row3, shuf_lo);
+
+
+ /* row1 and row3 are now no longer needed. Re-use those registers as
+ * temporaries.
+ */
+ col0 = row1;
+ col1 = row3;
+
+ spe_shufb(p, col0, t1, t3, shuf_hi);
+ if (count > 1) {
+ spe_shufb(p, col1, t1, t3, shuf_lo);
+ }
+
+ /* t1 and t3 are now no longer needed. Re-use those registers as
+ * temporaries.
+ */
+ col2 = t1;
+ col3 = t3;
+
+ if (count > 2) {
+ spe_shufb(p, col2, t2, t4, shuf_hi);
+ }
+
+ if (count > 3) {
+ spe_shufb(p, col3, t2, t4, shuf_lo);
+ }
+
+
+ /* Store the results. Remember that the stqd instruction is encoded using
+ * the qword offset (stand-alone assemblers to the byte-offset to
+ * qword-offset conversion for you), so the byte-offset needs be divided by
+ * 16.
+ */
+ switch (count) {
+ case 4:
+ spe_stqd(p, col3, dest_ptr, 3);
+ case 3:
+ spe_stqd(p, col2, dest_ptr, 2);
+ case 2:
+ spe_stqd(p, col1, dest_ptr, 1);
+ case 1:
+ spe_stqd(p, col0, dest_ptr, 0);
+ }
+
+
+ /* Release all of the temporary registers used.
+ */
+ release_register(m, col0);
+ release_register(m, col1);
+ release_register(m, col2);
+ release_register(m, col3);
+ release_register(m, shuf_hi);
+ release_register(m, shuf_lo);
+ release_register(m, t2);
+ release_register(m, t4);
+}
+
+
+static void
+emit_fetch(struct spe_function *p, register_mask *m,
+ unsigned in_ptr, unsigned *offset,
+ unsigned out_ptr, unsigned shuf_ptr,
+ enum pipe_format format)
+{
+ const unsigned count = (pf_size_x(format) != 0) + (pf_size_y(format) != 0)
+ + (pf_size_z(format) != 0) + (pf_size_w(format) != 0);
+ const unsigned type = pf_type(format);
+ const unsigned bytes = pf_size_x(format);
+
+ int v0 = allocate_available_register(m);
+ int v1 = allocate_available_register(m);
+ int v2 = allocate_available_register(m);
+ int v3 = allocate_available_register(m);
+ int tmp = allocate_available_register(m);
+ int float_zero = -1;
+ int float_one = -1;
+ float scale_signed = 0.0;
+ float scale_unsigned = 0.0;
+
+ spe_lqd(p, v0, in_ptr, 0 + offset[0]);
+ spe_lqd(p, v1, in_ptr, 1 + offset[0]);
+ spe_lqd(p, v2, in_ptr, 2 + offset[0]);
+ spe_lqd(p, v3, in_ptr, 3 + offset[0]);
+ offset[0] += 4;
+
+ switch (bytes) {
+ case 1:
+ scale_signed = 1.0f / 127.0f;
+ scale_unsigned = 1.0f / 255.0f;
+ spe_lqd(p, tmp, shuf_ptr, 1);
+ spe_shufb(p, v0, v0, v0, tmp);
+ spe_shufb(p, v1, v1, v1, tmp);
+ spe_shufb(p, v2, v2, v2, tmp);
+ spe_shufb(p, v3, v3, v3, tmp);
+ break;
+ case 2:
+ scale_signed = 1.0f / 32767.0f;
+ scale_unsigned = 1.0f / 65535.0f;
+ spe_lqd(p, tmp, shuf_ptr, 2);
+ spe_shufb(p, v0, v0, v0, tmp);
+ spe_shufb(p, v1, v1, v1, tmp);
+ spe_shufb(p, v2, v2, v2, tmp);
+ spe_shufb(p, v3, v3, v3, tmp);
+ break;
+ case 4:
+ scale_signed = 1.0f / 2147483647.0f;
+ scale_unsigned = 1.0f / 4294967295.0f;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ switch (type) {
+ case PIPE_FORMAT_TYPE_FLOAT:
+ break;
+ case PIPE_FORMAT_TYPE_UNORM:
+ spe_ilhu(p, tmp, ((unsigned) scale_unsigned) >> 16);
+ spe_iohl(p, tmp, ((unsigned) scale_unsigned) & 0x0ffff);
+ spe_cuflt(p, v0, v0, 0);
+ spe_fm(p, v0, v0, tmp);
+ break;
+ case PIPE_FORMAT_TYPE_SNORM:
+ spe_ilhu(p, tmp, ((unsigned) scale_signed) >> 16);
+ spe_iohl(p, tmp, ((unsigned) scale_signed) & 0x0ffff);
+ spe_csflt(p, v0, v0, 0);
+ spe_fm(p, v0, v0, tmp);
+ break;
+ case PIPE_FORMAT_TYPE_USCALED:
+ spe_cuflt(p, v0, v0, 0);
+ break;
+ case PIPE_FORMAT_TYPE_SSCALED:
+ spe_csflt(p, v0, v0, 0);
+ break;
+ }
+
+
+ if (count < 4) {
+ float_one = allocate_available_register(m);
+ spe_il(p, float_one, 1);
+ spe_cuflt(p, float_one, float_one, 0);
+
+ if (count < 3) {
+ float_zero = allocate_available_register(m);
+ spe_il(p, float_zero, 0);
+ }
+ }
+
+ release_register(m, tmp);
+
+ emit_matrix_transpose(p, m, v0, v1, v2, v3, out_ptr, shuf_ptr, count);
+
+ switch (count) {
+ case 1:
+ spe_stqd(p, float_zero, out_ptr, 1);
+ case 2:
+ spe_stqd(p, float_zero, out_ptr, 2);
+ case 3:
+ spe_stqd(p, float_one, out_ptr, 3);
+ }
+
+ if (float_zero != -1) {
+ release_register(m, float_zero);
+ }
+
+ if (float_one != -1) {
+ release_register(m, float_one);
+ }
+}
+
+
+void cell_update_vertex_fetch(struct draw_context *draw)
+{
+ struct cell_context *const cell =
+ (struct cell_context *) draw->driver_private;
+ register_mask m = ~0;
+ struct spe_function *p = &cell->attrib_fetch;
+ unsigned function_index[PIPE_ATTRIB_MAX];
+ unsigned unique_attr_formats;
+ int out_ptr;
+ int in_ptr;
+ int shuf_ptr;
+ unsigned i;
+ unsigned j;
+
+
+ /* Determine how many unique input attribute formats there are. At the
+ * same time, store the index of the lowest numbered attribute that has
+ * the same format as any non-unique format.
+ */
+ unique_attr_formats = 1;
+ function_index[0] = 0;
+ for (i = 1; i < draw->vertex_fetch.nr_attrs; i++) {
+ const enum pipe_format curr_fmt = draw->vertex_element[i].src_format;
+
+ for (j = 0; j < i; j++) {
+ if (curr_fmt == draw->vertex_element[j].src_format) {
+ break;
+ }
+ }
+
+ if (j == i) {
+ unique_attr_formats++;
+ }
+
+ function_index[i] = j;
+ }
+
+
+ /* Each fetch function can be a maximum of 34 instructions (note: this is
+ * actually a slight over-estimate). That means (34 * 4) = 136 bytes
+ * each maximum.
+ */
+ spe_init_func(p, 136 * unique_attr_formats);
+
+
+ /* Registers 0, 1, and 2 are reserved by the ABI.
+ */
+ allocate_register(&m, 0);
+ allocate_register(&m, 1);
+ allocate_register(&m, 2);
+
+
+ /* Allocate registers for the function's input parameters.
+ */
+ out_ptr = allocate_register(&m, 3);
+ in_ptr = allocate_register(&m, 4);
+ shuf_ptr = allocate_register(&m, 5);
+
+
+ /* Generate code for the individual attribute fetch functions.
+ */
+ for (i = 0; i < draw->vertex_fetch.nr_attrs; i++) {
+ unsigned offset;
+
+ if (function_index[i] == i) {
+ cell->attrib_fetch_offsets[i] = (unsigned) ((void *) p->csr
+ - (void *) p->store);
+
+ offset = 0;
+ emit_fetch(p, & m, in_ptr, &offset, out_ptr, shuf_ptr,
+ draw->vertex_element[i].src_format);
+ spe_bi(p, 0, 0, 0);
+
+ /* Round up to the next 16-byte boundary.
+ */
+ if ((((unsigned) p->store) & 0x0f) != 0) {
+ const unsigned align = ((unsigned) p->store) & 0x0f;
+ p->store = (uint32_t *) (((void *) p->store) + align);
+ }
+ } else {
+ /* Use the same function entry-point as a previously seen attribute
+ * with the same format.
+ */
+ cell->attrib_fetch_offsets[i] =
+ cell->attrib_fetch_offsets[function_index[i]];
+ }
+ }
+}
diff --git a/src/mesa/pipe/cell/ppu/cell_vertex_shader.c b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
index 80dd500b345..6a1d3bc20a1 100644
--- a/src/mesa/pipe/cell/ppu/cell_vertex_shader.c
+++ b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
@@ -38,9 +38,9 @@
#include "cell_spu.h"
#include "cell_batch.h"
-#include "pipe/cell/common.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/draw/draw_private.h"
+#include "cell/common.h"
+#include "draw/draw_context.h"
+#include "draw/draw_private.h"
/**
* Run the vertex shader on all vertices in the vertex queue.
@@ -55,14 +55,32 @@ cell_vertex_shader_queue_flush(struct draw_context *draw)
uint64_t *batch;
struct cell_array_info *array_info;
unsigned i, j;
+ struct cell_attribute_fetch_code *cf;
assert(draw->vs.queue_nr != 0);
/* XXX: do this on statechange:
*/
draw_update_vertex_fetch(draw);
+ cell_update_vertex_fetch(draw);
+
+
+ batch = cell_batch_alloc(cell, sizeof(batch[0]) + sizeof(*cf));
+ batch[0] = CELL_CMD_STATE_ATTRIB_FETCH;
+ cf = (struct cell_attribute_fetch_code *) (&batch[1]);
+ cf->base = cell->attrib_fetch.store;
+ cf->size = ROUNDUP16((unsigned)((void *) cell->attrib_fetch.csr
+ - (void *) cell->attrib_fetch.store));
+
for (i = 0; i < draw->vertex_fetch.nr_attrs; i++) {
+ const enum pipe_format format = draw->vertex_element[i].src_format;
+ const unsigned count = ((pf_size_x(format) != 0)
+ + (pf_size_y(format) != 0)
+ + (pf_size_z(format) != 0)
+ + (pf_size_w(format) != 0));
+ const unsigned size = pf_size_x(format) * count;
+
batch = cell_batch_alloc(cell, sizeof(batch[0]) + sizeof(*array_info));
batch[0] = CELL_CMD_STATE_VS_ARRAY_INFO;
@@ -72,7 +90,8 @@ cell_vertex_shader_queue_flush(struct draw_context *draw)
array_info->base = (uintptr_t) draw->vertex_fetch.src_ptr[i];
array_info->attr = i;
array_info->pitch = draw->vertex_fetch.pitch[i];
- array_info->format = draw->vertex_element[i].src_format;
+ array_info->size = size;
+ array_info->function_offset = cell->attrib_fetch_offsets[i];
}
batch = cell_batch_alloc(cell, sizeof(batch[0])
diff --git a/src/mesa/pipe/cell/ppu/cell_winsys.c b/src/gallium/drivers/cell/ppu/cell_winsys.c
index ebabce3c8f5..ebabce3c8f5 100644
--- a/src/mesa/pipe/cell/ppu/cell_winsys.c
+++ b/src/gallium/drivers/cell/ppu/cell_winsys.c
diff --git a/src/mesa/pipe/cell/ppu/cell_winsys.h b/src/gallium/drivers/cell/ppu/cell_winsys.h
index ae2af5696b5..ae2af5696b5 100644
--- a/src/mesa/pipe/cell/ppu/cell_winsys.h
+++ b/src/gallium/drivers/cell/ppu/cell_winsys.h
diff --git a/src/mesa/pipe/cell/spu/Makefile b/src/gallium/drivers/cell/spu/Makefile
index f202971d738..30ef2450ece 100644
--- a/src/mesa/pipe/cell/spu/Makefile
+++ b/src/gallium/drivers/cell/spu/Makefile
@@ -31,7 +31,11 @@ SPU_OBJECTS = $(SOURCES:.c=.o) \
SPU_ASM_OUT = $(SOURCES:.c=.s) \
-INCLUDE_DIRS = -I$(TOP)/src/mesa
+INCLUDE_DIRS = \
+ -I$(TOP)/src/mesa \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium/drivers
.c.o:
diff --git a/src/mesa/pipe/cell/spu/spu_blend.c b/src/gallium/drivers/cell/spu/spu_blend.c
index 23ec0eeb451..23ec0eeb451 100644
--- a/src/mesa/pipe/cell/spu/spu_blend.c
+++ b/src/gallium/drivers/cell/spu/spu_blend.c
diff --git a/src/mesa/pipe/cell/spu/spu_blend.h b/src/gallium/drivers/cell/spu/spu_blend.h
index 2b594b578b4..2b594b578b4 100644
--- a/src/mesa/pipe/cell/spu/spu_blend.h
+++ b/src/gallium/drivers/cell/spu/spu_blend.h
diff --git a/src/mesa/pipe/cell/spu/spu_colorpack.h b/src/gallium/drivers/cell/spu/spu_colorpack.h
index e9fee8a3a61..e9fee8a3a61 100644
--- a/src/mesa/pipe/cell/spu/spu_colorpack.h
+++ b/src/gallium/drivers/cell/spu/spu_colorpack.h
diff --git a/src/mesa/pipe/cell/spu/spu_exec.c b/src/gallium/drivers/cell/spu/spu_exec.c
index e51008b9b3c..109540b1f7b 100644
--- a/src/mesa/pipe/cell/spu/spu_exec.c
+++ b/src/gallium/drivers/cell/spu/spu_exec.c
@@ -67,8 +67,8 @@
#include "pipe/p_state.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
-#include "pipe/tgsi/util/tgsi_util.h"
+#include "tgsi/util/tgsi_parse.h"
+#include "tgsi/util/tgsi_util.h"
#include "spu_exec.h"
#include "spu_main.h"
#include "spu_vertex_shader.h"
diff --git a/src/mesa/pipe/cell/spu/spu_exec.h b/src/gallium/drivers/cell/spu/spu_exec.h
index b4c7661ef67..3e17c490d20 100644
--- a/src/mesa/pipe/cell/spu/spu_exec.h
+++ b/src/gallium/drivers/cell/spu/spu_exec.h
@@ -29,7 +29,7 @@
#define SPU_EXEC_H
#include "pipe/p_compiler.h"
-#include "pipe/tgsi/exec/tgsi_exec.h"
+#include "tgsi/exec/tgsi_exec.h"
#if defined __cplusplus
extern "C" {
diff --git a/src/mesa/pipe/cell/spu/spu_main.c b/src/gallium/drivers/cell/spu/spu_main.c
index e375197fe60..fcbf0f841e6 100644
--- a/src/mesa/pipe/cell/spu/spu_main.c
+++ b/src/gallium/drivers/cell/spu/spu_main.c
@@ -38,7 +38,7 @@
#include "spu_tile.h"
//#include "spu_test.h"
#include "spu_vertex_shader.h"
-#include "pipe/cell/common.h"
+#include "cell/common.h"
#include "pipe/p_defines.h"
@@ -54,6 +54,9 @@ struct spu_global spu;
struct spu_vs_context draw;
+static unsigned char attribute_fetch_code_buffer[136 * PIPE_ATTRIB_MAX]
+ ALIGN16_ATTRIB;
+
/**
* Tell the PPU that this SPU has finished copying a buffer to
* local store and that it may be reused by the PPU.
@@ -306,7 +309,8 @@ cmd_state_vs_array_info(const struct cell_array_info *vs_info)
ASSERT(attr < PIPE_ATTRIB_MAX);
draw.vertex_fetch.src_ptr[attr] = vs_info->base;
draw.vertex_fetch.pitch[attr] = vs_info->pitch;
- draw.vertex_fetch.format[attr] = vs_info->format;
+ draw.vertex_fetch.size[attr] = vs_info->size;
+ draw.vertex_fetch.code_offset[attr] = vs_info->function_offset;
draw.vertex_fetch.dirty = 1;
}
@@ -433,6 +437,22 @@ cmd_batch(uint opcode)
cmd_state_vs_array_info((struct cell_array_info *) &buffer[pos+1]);
pos += (1 + ROUNDUP8(sizeof(struct cell_array_info)) / 8);
break;
+ case CELL_CMD_STATE_ATTRIB_FETCH: {
+ struct cell_attribute_fetch_code *code =
+ (struct cell_attribute_fetch_code *) &buffer[pos+1];
+
+ mfc_get(attribute_fetch_code_buffer,
+ (unsigned int) code->base, /* src */
+ code->size,
+ TAG_BATCH_BUFFER,
+ 0, /* tid */
+ 0 /* rid */);
+ wait_on_mask(1 << TAG_BATCH_BUFFER);
+
+ draw.vertex_fetch.code = attribute_fetch_code_buffer;
+ pos += (1 + ROUNDUP8(sizeof(struct cell_attribute_fetch_code)) / 8);
+ break;
+ }
default:
printf("SPU %u: bad opcode: 0x%llx\n", spu.init.id, buffer[pos]);
ASSERT(0);
diff --git a/src/mesa/pipe/cell/spu/spu_main.h b/src/gallium/drivers/cell/spu/spu_main.h
index 1710a175123..5c95d112ac1 100644
--- a/src/mesa/pipe/cell/spu/spu_main.h
+++ b/src/gallium/drivers/cell/spu/spu_main.h
@@ -31,8 +31,8 @@
#include <spu_mfcio.h>
-#include "pipe/cell/common.h"
-#include "pipe/draw/draw_vertex.h"
+#include "cell/common.h"
+#include "draw/draw_vertex.h"
#include "pipe/p_state.h"
diff --git a/src/mesa/pipe/cell/spu/spu_render.c b/src/gallium/drivers/cell/spu/spu_render.c
index 932fb500b3f..20e77aa2e63 100644
--- a/src/mesa/pipe/cell/spu/spu_render.c
+++ b/src/gallium/drivers/cell/spu/spu_render.c
@@ -34,7 +34,7 @@
#include "spu_render.h"
#include "spu_tri.h"
#include "spu_tile.h"
-#include "pipe/cell/common.h"
+#include "cell/common.h"
diff --git a/src/mesa/pipe/cell/spu/spu_render.h b/src/gallium/drivers/cell/spu/spu_render.h
index fbcdc5ec316..493434f0878 100644
--- a/src/mesa/pipe/cell/spu/spu_render.h
+++ b/src/gallium/drivers/cell/spu/spu_render.h
@@ -29,7 +29,7 @@
#ifndef SPU_RENDER_H
#define SPU_RENDER_H
-#include "pipe/cell/common.h"
+#include "cell/common.h"
extern void
cmd_render(const struct cell_command_render *render, uint *pos_incr);
diff --git a/src/mesa/pipe/cell/spu/spu_texture.c b/src/gallium/drivers/cell/spu/spu_texture.c
index 3962aaa4a9b..3962aaa4a9b 100644
--- a/src/mesa/pipe/cell/spu/spu_texture.c
+++ b/src/gallium/drivers/cell/spu/spu_texture.c
diff --git a/src/mesa/pipe/cell/spu/spu_texture.h b/src/gallium/drivers/cell/spu/spu_texture.h
index 95eb87080f1..95eb87080f1 100644
--- a/src/mesa/pipe/cell/spu/spu_texture.h
+++ b/src/gallium/drivers/cell/spu/spu_texture.h
diff --git a/src/mesa/pipe/cell/spu/spu_tile.c b/src/gallium/drivers/cell/spu/spu_tile.c
index 12dc2463283..12dc2463283 100644
--- a/src/mesa/pipe/cell/spu/spu_tile.c
+++ b/src/gallium/drivers/cell/spu/spu_tile.c
diff --git a/src/mesa/pipe/cell/spu/spu_tile.h b/src/gallium/drivers/cell/spu/spu_tile.h
index e53340a55a4..3105b848fdc 100644
--- a/src/mesa/pipe/cell/spu/spu_tile.h
+++ b/src/gallium/drivers/cell/spu/spu_tile.h
@@ -32,7 +32,7 @@
#include <libmisc.h>
#include <spu_mfcio.h>
#include "spu_main.h"
-#include "pipe/cell/common.h"
+#include "cell/common.h"
diff --git a/src/mesa/pipe/cell/spu/spu_tri.c b/src/gallium/drivers/cell/spu/spu_tri.c
index be9624cf7d9..be9624cf7d9 100644
--- a/src/mesa/pipe/cell/spu/spu_tri.c
+++ b/src/gallium/drivers/cell/spu/spu_tri.c
diff --git a/src/mesa/pipe/cell/spu/spu_tri.h b/src/gallium/drivers/cell/spu/spu_tri.h
index aa694dd7c93..aa694dd7c93 100644
--- a/src/mesa/pipe/cell/spu/spu_tri.h
+++ b/src/gallium/drivers/cell/spu/spu_tri.h
diff --git a/src/mesa/pipe/cell/spu/spu_util.c b/src/gallium/drivers/cell/spu/spu_util.c
index ac373240c1f..ea4274a0a7b 100644
--- a/src/mesa/pipe/cell/spu/spu_util.c
+++ b/src/gallium/drivers/cell/spu/spu_util.c
@@ -1,8 +1,8 @@
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
+#include "tgsi/util/tgsi_parse.h"
//#include "tgsi_build.h"
-#include "pipe/tgsi/util/tgsi_util.h"
+#include "tgsi/util/tgsi_util.h"
unsigned
tgsi_util_get_src_register_swizzle(
diff --git a/src/gallium/drivers/cell/spu/spu_vertex_fetch.c b/src/gallium/drivers/cell/spu/spu_vertex_fetch.c
new file mode 100644
index 00000000000..55c6c287175
--- /dev/null
+++ b/src/gallium/drivers/cell/spu/spu_vertex_fetch.c
@@ -0,0 +1,214 @@
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * (C) Copyright IBM Corporation 2008
+ * 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 <[email protected]>
+ * Ian Romanick <[email protected]>
+ */
+
+#include <spu_mfcio.h>
+
+#include "pipe/p_util.h"
+#include "pipe/p_state.h"
+#include "pipe/p_shader_tokens.h"
+#include "spu_exec.h"
+#include "spu_vertex_shader.h"
+#include "spu_main.h"
+
+#define CACHE_NAME attribute
+#define CACHED_TYPE qword
+#define CACHE_TYPE CACHE_TYPE_RO
+#define CACHE_SET_TAGID(set) TAG_VERTEX_BUFFER
+#define CACHE_LOG2NNWAY 2
+#define CACHE_LOG2NSETS 6
+#include <cache-api.h>
+
+/* Yes folks, this is ugly.
+ */
+#undef CACHE_NWAY
+#undef CACHE_NSETS
+#define CACHE_NAME attribute
+#define CACHE_NWAY 4
+#define CACHE_NSETS (1U << 6)
+
+
+#define DRAW_DBG 0
+
+typedef void (*spu_fetch_func)(qword *out, const qword *in,
+ const qword *shuffle_data);
+
+
+static const qword fetch_shuffle_data[] = {
+ /* Shuffle used by CVT_64_FLOAT
+ */
+ {
+ 0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ },
+
+ /* Shuffle used by CVT_8_USCALED and CVT_8_SSCALED
+ */
+ {
+ 0x00, 0x80, 0x80, 0x80, 0x01, 0x80, 0x80, 0x80,
+ 0x02, 0x80, 0x80, 0x80, 0x03, 0x80, 0x80, 0x80,
+ },
+
+ /* Shuffle used by CVT_16_USCALED and CVT_16_SSCALED
+ */
+ {
+ 0x00, 0x01, 0x80, 0x80, 0x02, 0x03, 0x80, 0x80,
+ 0x04, 0x05, 0x80, 0x80, 0x06, 0x07, 0x80, 0x80,
+ },
+
+ /* High value shuffle used by trans4x4.
+ */
+ {
+ 0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
+ 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17
+ },
+
+ /* Low value shuffle used by trans4x4.
+ */
+ {
+ 0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
+ 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F
+ }
+};
+
+
+/**
+ * Fetch between 1 and 32 bytes from an unaligned address
+ */
+static INLINE void
+fetch_unaligned(qword *dst, unsigned ea, unsigned size)
+{
+ qword tmp[4];
+ const int shift = ea & 0x0f;
+ const unsigned aligned_start_ea = ea & ~0x0f;
+ const unsigned aligned_end_ea = (ea + size) & ~0x0f;
+ const unsigned num_entries = ((aligned_end_ea - aligned_start_ea) / 16) + 1;
+ unsigned i;
+
+
+ if (shift == 0) {
+ /* Data is already aligned. Fetch directly into the destination buffer.
+ */
+ for (i = 0; i < num_entries; i++) {
+ dst[i] = cache_rd(attribute, (ea & ~0x0f) + (i * 16));
+ }
+ } else {
+ /* Fetch data from the cache to the local buffer.
+ */
+ for (i = 0; i < num_entries; i++) {
+ tmp[i] = cache_rd(attribute, (ea & ~0x0f) + (i * 16));
+ }
+
+
+ /* Fix the alignment of the data and write to the destination buffer.
+ */
+ for (i = 0; i < ((size + 15) / 16); i++) {
+ dst[i] = si_or((qword) spu_slqwbyte(tmp[i], shift),
+ (qword) spu_rlmaskqwbyte(tmp[i + 1], shift - 16));
+ }
+ }
+}
+
+
+/**
+ * Fetch vertex attributes for 'count' vertices.
+ */
+static void generic_vertex_fetch(struct spu_vs_context *draw,
+ struct spu_exec_machine *machine,
+ const unsigned *elts,
+ unsigned count)
+{
+ unsigned nr_attrs = draw->vertex_fetch.nr_attrs;
+ unsigned attr;
+
+ assert(count <= 4);
+
+#if DRAW_DBG
+ printf("SPU: %s count = %u, nr_attrs = %u\n",
+ __FUNCTION__, count, nr_attrs);
+#endif
+
+ /* loop over vertex attributes (vertex shader inputs)
+ */
+ for (attr = 0; attr < nr_attrs; attr++) {
+ const unsigned pitch = draw->vertex_fetch.pitch[attr];
+ const uint64_t src = draw->vertex_fetch.src_ptr[attr];
+ const spu_fetch_func fetch = (spu_fetch_func)
+ (draw->vertex_fetch.code + draw->vertex_fetch.code_offset[attr]);
+ unsigned i;
+ unsigned idx;
+ const unsigned bytes_per_entry = draw->vertex_fetch.size[attr];
+ const unsigned quads_per_entry = (bytes_per_entry + 15) / 16;
+ qword in[2 * 4];
+
+
+ /* Fetch four attributes for four vertices.
+ */
+ idx = 0;
+ for (i = 0; i < count; i++) {
+ const uint64_t addr = src + (elts[i] * pitch);
+
+#if DRAW_DBG
+ printf("SPU: fetching = 0x%llx\n", addr);
+#endif
+
+ fetch_unaligned(& in[idx], addr, bytes_per_entry);
+ idx += quads_per_entry;
+ }
+
+ /* Be nice and zero out any missing vertices.
+ */
+ (void) memset(& in[idx], 0, (8 - idx) * sizeof(qword));
+
+
+ /* Convert all 4 vertices to vectors of float.
+ */
+ (*fetch)(&machine->Inputs[attr].xyzw[0].q, in, fetch_shuffle_data);
+ }
+}
+
+
+void spu_update_vertex_fetch( struct spu_vs_context *draw )
+{
+ unsigned i;
+
+
+ /* Invalidate the vertex cache.
+ */
+ for (i = 0; i < (CACHE_NWAY * CACHE_NSETS); i++) {
+ CACHELINE_CLEARVALID(i);
+ }
+
+
+ draw->vertex_fetch.fetch_func = generic_vertex_fetch;
+}
diff --git a/src/mesa/pipe/cell/spu/spu_vertex_shader.c b/src/gallium/drivers/cell/spu/spu_vertex_shader.c
index c1cbbb6d1e9..3f5bf41aa2f 100644
--- a/src/mesa/pipe/cell/spu/spu_vertex_shader.c
+++ b/src/gallium/drivers/cell/spu/spu_vertex_shader.c
@@ -39,9 +39,9 @@
#include "pipe/p_shader_tokens.h"
#include "spu_vertex_shader.h"
#include "spu_exec.h"
-#include "pipe/draw/draw_private.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/cell/common.h"
+#include "draw/draw_private.h"
+#include "draw/draw_context.h"
+#include "cell/common.h"
#include "spu_main.h"
static INLINE unsigned
diff --git a/src/mesa/pipe/cell/spu/spu_vertex_shader.h b/src/gallium/drivers/cell/spu/spu_vertex_shader.h
index c96b93ff0ac..0fb0bc28d03 100644
--- a/src/mesa/pipe/cell/spu/spu_vertex_shader.h
+++ b/src/gallium/drivers/cell/spu/spu_vertex_shader.h
@@ -6,7 +6,6 @@
struct spu_vs_context;
-typedef qword (*spu_fetch_func)(const void *ptr);
typedef void (*spu_full_fetch_func)( struct spu_vs_context *draw,
struct spu_exec_machine *machine,
const unsigned *elts,
@@ -18,12 +17,13 @@ struct spu_vs_context {
struct {
uint64_t src_ptr[PIPE_ATTRIB_MAX];
unsigned pitch[PIPE_ATTRIB_MAX];
- enum pipe_format format[PIPE_ATTRIB_MAX];
+ unsigned size[PIPE_ATTRIB_MAX];
+ unsigned code_offset[PIPE_ATTRIB_MAX];
unsigned nr_attrs;
boolean dirty;
- spu_fetch_func fetch[PIPE_ATTRIB_MAX];
spu_full_fetch_func fetch_func;
+ void *code;
} vertex_fetch;
/* Clip derived state:
diff --git a/src/mesa/pipe/cell/spu/spu_ztest.h b/src/gallium/drivers/cell/spu/spu_ztest.h
index ce8ad003393..ce8ad003393 100644
--- a/src/mesa/pipe/cell/spu/spu_ztest.h
+++ b/src/gallium/drivers/cell/spu/spu_ztest.h
diff --git a/src/mesa/pipe/failover/Makefile b/src/gallium/drivers/failover/Makefile
index 72d0895c74d..14389bd0551 100644
--- a/src/mesa/pipe/failover/Makefile
+++ b/src/gallium/drivers/failover/Makefile
@@ -15,7 +15,7 @@ C_SOURCES = \
ASM_SOURCES =
-include ../Makefile.template
+include ../../Makefile.template
symlinks:
diff --git a/src/mesa/pipe/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c
index 7ce4a7df17e..7ce4a7df17e 100644
--- a/src/mesa/pipe/failover/fo_context.c
+++ b/src/gallium/drivers/failover/fo_context.c
diff --git a/src/mesa/pipe/failover/fo_context.h b/src/gallium/drivers/failover/fo_context.h
index 1dc87291c9f..1dc87291c9f 100644
--- a/src/mesa/pipe/failover/fo_context.h
+++ b/src/gallium/drivers/failover/fo_context.h
diff --git a/src/mesa/pipe/failover/fo_state.c b/src/gallium/drivers/failover/fo_state.c
index 0fc5568da11..0fc5568da11 100644
--- a/src/mesa/pipe/failover/fo_state.c
+++ b/src/gallium/drivers/failover/fo_state.c
diff --git a/src/mesa/pipe/failover/fo_state_emit.c b/src/gallium/drivers/failover/fo_state_emit.c
index c663dd49476..c663dd49476 100644
--- a/src/mesa/pipe/failover/fo_state_emit.c
+++ b/src/gallium/drivers/failover/fo_state_emit.c
diff --git a/src/mesa/pipe/failover/fo_winsys.h b/src/gallium/drivers/failover/fo_winsys.h
index a8ce997a1f6..a8ce997a1f6 100644
--- a/src/mesa/pipe/failover/fo_winsys.h
+++ b/src/gallium/drivers/failover/fo_winsys.h
diff --git a/src/mesa/pipe/i915simple/Makefile b/src/gallium/drivers/i915simple/Makefile
index 2f91de3afc6..ee22ba86f9b 100644
--- a/src/mesa/pipe/i915simple/Makefile
+++ b/src/gallium/drivers/i915simple/Makefile
@@ -32,7 +32,7 @@ C_SOURCES = \
ASM_SOURCES =
-include ../Makefile.template
+include ../../Makefile.template
symlinks:
diff --git a/src/mesa/pipe/i915simple/SConscript b/src/gallium/drivers/i915simple/SConscript
index f5fb96b995c..f5fb96b995c 100644
--- a/src/mesa/pipe/i915simple/SConscript
+++ b/src/gallium/drivers/i915simple/SConscript
diff --git a/src/mesa/pipe/i915simple/i915_batch.h b/src/gallium/drivers/i915simple/i915_batch.h
index fb88cd6db0d..fb88cd6db0d 100644
--- a/src/mesa/pipe/i915simple/i915_batch.h
+++ b/src/gallium/drivers/i915simple/i915_batch.h
diff --git a/src/mesa/pipe/i915simple/i915_blit.c b/src/gallium/drivers/i915simple/i915_blit.c
index d49876f9708..db4671ff553 100644
--- a/src/mesa/pipe/i915simple/i915_blit.c
+++ b/src/gallium/drivers/i915simple/i915_blit.c
@@ -85,6 +85,7 @@ i915_fill_blit(struct i915_context *i915,
void
i915_copy_blit( struct i915_context *i915,
+ unsigned do_flip,
unsigned cpp,
short src_pitch,
struct pipe_buffer *src_buffer,
diff --git a/src/mesa/pipe/i915simple/i915_blit.h b/src/gallium/drivers/i915simple/i915_blit.h
index d7a66be10ae..6e5b44e1247 100644
--- a/src/mesa/pipe/i915simple/i915_blit.h
+++ b/src/gallium/drivers/i915simple/i915_blit.h
@@ -31,6 +31,7 @@
#include "i915_context.h"
extern void i915_copy_blit(struct i915_context *i915,
+ unsigned do_flip,
unsigned cpp,
short src_pitch,
struct pipe_buffer *src_buffer,
diff --git a/src/mesa/pipe/i915simple/i915_clear.c b/src/gallium/drivers/i915simple/i915_clear.c
index cde69daacc0..cde69daacc0 100644
--- a/src/mesa/pipe/i915simple/i915_clear.c
+++ b/src/gallium/drivers/i915simple/i915_clear.c
diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/gallium/drivers/i915simple/i915_context.c
index 497623a7006..7f71f8fd4f5 100644
--- a/src/mesa/pipe/i915simple/i915_context.c
+++ b/src/gallium/drivers/i915simple/i915_context.c
@@ -32,7 +32,7 @@
#include "i915_texture.h"
#include "i915_reg.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/p_util.h"
diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/gallium/drivers/i915simple/i915_context.h
index b4ea63c3e74..2d876925b2c 100644
--- a/src/mesa/pipe/i915simple/i915_context.h
+++ b/src/gallium/drivers/i915simple/i915_context.h
@@ -33,7 +33,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
-#include "pipe/draw/draw_vertex.h"
+#include "draw/draw_vertex.h"
#define I915_TEX_UNITS 8
diff --git a/src/mesa/pipe/i915simple/i915_debug.c b/src/gallium/drivers/i915simple/i915_debug.c
index 94db44e1aaf..94db44e1aaf 100644
--- a/src/mesa/pipe/i915simple/i915_debug.c
+++ b/src/gallium/drivers/i915simple/i915_debug.c
diff --git a/src/mesa/pipe/i915simple/i915_debug.h b/src/gallium/drivers/i915simple/i915_debug.h
index 0bcd0942334..0bcd0942334 100644
--- a/src/mesa/pipe/i915simple/i915_debug.h
+++ b/src/gallium/drivers/i915simple/i915_debug.h
diff --git a/src/mesa/pipe/i915simple/i915_debug_fp.c b/src/gallium/drivers/i915simple/i915_debug_fp.c
index ebfdb3d93c5..ebfdb3d93c5 100644
--- a/src/mesa/pipe/i915simple/i915_debug_fp.c
+++ b/src/gallium/drivers/i915simple/i915_debug_fp.c
diff --git a/src/mesa/pipe/i915simple/i915_flush.c b/src/gallium/drivers/i915simple/i915_flush.c
index 3c2069b8273..3c2069b8273 100644
--- a/src/mesa/pipe/i915simple/i915_flush.c
+++ b/src/gallium/drivers/i915simple/i915_flush.c
diff --git a/src/mesa/pipe/i915simple/i915_fpc.h b/src/gallium/drivers/i915simple/i915_fpc.h
index 8c7b68aefb5..8c7b68aefb5 100644
--- a/src/mesa/pipe/i915simple/i915_fpc.h
+++ b/src/gallium/drivers/i915simple/i915_fpc.h
diff --git a/src/mesa/pipe/i915simple/i915_fpc_emit.c b/src/gallium/drivers/i915simple/i915_fpc_emit.c
index 74924ff0a1d..74924ff0a1d 100644
--- a/src/mesa/pipe/i915simple/i915_fpc_emit.c
+++ b/src/gallium/drivers/i915simple/i915_fpc_emit.c
diff --git a/src/mesa/pipe/i915simple/i915_fpc_translate.c b/src/gallium/drivers/i915simple/i915_fpc_translate.c
index 868f0c7e046..6c1524c768e 100644
--- a/src/mesa/pipe/i915simple/i915_fpc_translate.c
+++ b/src/gallium/drivers/i915simple/i915_fpc_translate.c
@@ -33,9 +33,9 @@
#include "i915_fpc.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
+#include "tgsi/util/tgsi_parse.h"
-#include "pipe/draw/draw_vertex.h"
+#include "draw/draw_vertex.h"
/**
diff --git a/src/mesa/pipe/i915simple/i915_prim_emit.c b/src/gallium/drivers/i915simple/i915_prim_emit.c
index c4a706c37d8..44c43259369 100644
--- a/src/mesa/pipe/i915simple/i915_prim_emit.c
+++ b/src/gallium/drivers/i915simple/i915_prim_emit.c
@@ -26,7 +26,7 @@
**************************************************************************/
-#include "pipe/draw/draw_private.h"
+#include "draw/draw_private.h"
#include "pipe/p_util.h"
#include "i915_context.h"
diff --git a/src/mesa/pipe/i915simple/i915_prim_vbuf.c b/src/gallium/drivers/i915simple/i915_prim_vbuf.c
index e069773fd4e..c5bf6174f68 100644
--- a/src/mesa/pipe/i915simple/i915_prim_vbuf.c
+++ b/src/gallium/drivers/i915simple/i915_prim_vbuf.c
@@ -38,7 +38,7 @@
*/
-#include "pipe/draw/draw_vbuf.h"
+#include "draw/draw_vbuf.h"
#include "pipe/p_debug.h"
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
diff --git a/src/mesa/pipe/i915simple/i915_reg.h b/src/gallium/drivers/i915simple/i915_reg.h
index 04620fec681..04620fec681 100644
--- a/src/mesa/pipe/i915simple/i915_reg.h
+++ b/src/gallium/drivers/i915simple/i915_reg.h
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c
index abd5571b885..294e6fad035 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/gallium/drivers/i915simple/i915_state.c
@@ -29,7 +29,7 @@
*/
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
#include "pipe/p_winsys.h"
#include "pipe/p_util.h"
diff --git a/src/mesa/pipe/i915simple/i915_state.h b/src/gallium/drivers/i915simple/i915_state.h
index 86c6b0027d5..86c6b0027d5 100644
--- a/src/mesa/pipe/i915simple/i915_state.h
+++ b/src/gallium/drivers/i915simple/i915_state.h
diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/gallium/drivers/i915simple/i915_state_derived.c
index 653983e4a99..4767584fc60 100644
--- a/src/mesa/pipe/i915simple/i915_state_derived.c
+++ b/src/gallium/drivers/i915simple/i915_state_derived.c
@@ -27,8 +27,8 @@
#include "pipe/p_util.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/draw/draw_vertex.h"
+#include "draw/draw_context.h"
+#include "draw/draw_vertex.h"
#include "i915_context.h"
#include "i915_state.h"
#include "i915_reg.h"
diff --git a/src/mesa/pipe/i915simple/i915_state_dynamic.c b/src/gallium/drivers/i915simple/i915_state_dynamic.c
index 8cfbdddd19b..8cfbdddd19b 100644
--- a/src/mesa/pipe/i915simple/i915_state_dynamic.c
+++ b/src/gallium/drivers/i915simple/i915_state_dynamic.c
diff --git a/src/mesa/pipe/i915simple/i915_state_emit.c b/src/gallium/drivers/i915simple/i915_state_emit.c
index 3339287f498..3339287f498 100644
--- a/src/mesa/pipe/i915simple/i915_state_emit.c
+++ b/src/gallium/drivers/i915simple/i915_state_emit.c
diff --git a/src/mesa/pipe/i915simple/i915_state_immediate.c b/src/gallium/drivers/i915simple/i915_state_immediate.c
index 07031fc6c5b..07031fc6c5b 100644
--- a/src/mesa/pipe/i915simple/i915_state_immediate.c
+++ b/src/gallium/drivers/i915simple/i915_state_immediate.c
diff --git a/src/mesa/pipe/i915simple/i915_state_inlines.h b/src/gallium/drivers/i915simple/i915_state_inlines.h
index 0934ac79a41..0934ac79a41 100644
--- a/src/mesa/pipe/i915simple/i915_state_inlines.h
+++ b/src/gallium/drivers/i915simple/i915_state_inlines.h
diff --git a/src/mesa/pipe/i915simple/i915_state_sampler.c b/src/gallium/drivers/i915simple/i915_state_sampler.c
index 9c1a5bbbd65..9c1a5bbbd65 100644
--- a/src/mesa/pipe/i915simple/i915_state_sampler.c
+++ b/src/gallium/drivers/i915simple/i915_state_sampler.c
diff --git a/src/mesa/pipe/i915simple/i915_strings.c b/src/gallium/drivers/i915simple/i915_strings.c
index c713bf72086..301fedea197 100644
--- a/src/mesa/pipe/i915simple/i915_strings.c
+++ b/src/gallium/drivers/i915simple/i915_strings.c
@@ -70,7 +70,7 @@ static const char *i915_get_name( struct pipe_context *pipe )
break;
}
- sprintf(buffer, "pipe/i915 (chipset: %s)", chipset);
+ sprintf(buffer, "i915 (chipset: %s)", chipset);
return buffer;
}
diff --git a/src/mesa/pipe/i915simple/i915_surface.c b/src/gallium/drivers/i915simple/i915_surface.c
index 1bdaba773f1..17fd27895a2 100644
--- a/src/mesa/pipe/i915simple/i915_surface.c
+++ b/src/gallium/drivers/i915simple/i915_surface.c
@@ -33,7 +33,7 @@
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-#include "pipe/util/p_tile.h"
+#include "util/p_tile.h"
/*
@@ -83,6 +83,7 @@ i915_get_tex_surface(struct pipe_context *pipe,
*/
static void
i915_surface_copy(struct pipe_context *pipe,
+ unsigned do_flip,
struct pipe_surface *dst,
unsigned dstx, unsigned dsty,
struct pipe_surface *src,
@@ -98,14 +99,15 @@ i915_surface_copy(struct pipe_context *pipe,
dstx, dsty,
width, height,
pipe_surface_map(src),
- src->pitch,
- srcx, srcy);
+ do_flip ? -(int) src->pitch : src->pitch,
+ srcx, do_flip ? 1 - srcy - height : srcy);
pipe_surface_unmap(src);
pipe_surface_unmap(dst);
}
else {
i915_copy_blit( i915_context(pipe),
+ do_flip,
dst->cpp,
(short) src->pitch, src->buffer, src->offset,
(short) dst->pitch, dst->buffer, dst->offset,
diff --git a/src/mesa/pipe/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c
index 6d37ae3d747..6d37ae3d747 100644
--- a/src/mesa/pipe/i915simple/i915_texture.c
+++ b/src/gallium/drivers/i915simple/i915_texture.c
diff --git a/src/mesa/pipe/i915simple/i915_texture.h b/src/gallium/drivers/i915simple/i915_texture.h
index 330d111dc78..330d111dc78 100644
--- a/src/mesa/pipe/i915simple/i915_texture.h
+++ b/src/gallium/drivers/i915simple/i915_texture.h
diff --git a/src/mesa/pipe/i915simple/i915_winsys.h b/src/gallium/drivers/i915simple/i915_winsys.h
index fe49710852b..fe49710852b 100644
--- a/src/mesa/pipe/i915simple/i915_winsys.h
+++ b/src/gallium/drivers/i915simple/i915_winsys.h
diff --git a/src/mesa/pipe/i965simple/Makefile b/src/gallium/drivers/i965simple/Makefile
index 48c00ab50b8..1dec1f97495 100644
--- a/src/mesa/pipe/i965simple/Makefile
+++ b/src/gallium/drivers/i965simple/Makefile
@@ -61,6 +61,6 @@ ASM_SOURCES =
DRIVER_DEFINES = -I.
-include ../Makefile.template
+include ../../Makefile.template
symlinks:
diff --git a/src/mesa/pipe/i965simple/SConscript b/src/gallium/drivers/i965simple/SConscript
index 74621de84c9..74621de84c9 100644
--- a/src/mesa/pipe/i965simple/SConscript
+++ b/src/gallium/drivers/i965simple/SConscript
diff --git a/src/mesa/pipe/i965simple/brw_batch.h b/src/gallium/drivers/i965simple/brw_batch.h
index 5f5932a4883..5f5932a4883 100644
--- a/src/mesa/pipe/i965simple/brw_batch.h
+++ b/src/gallium/drivers/i965simple/brw_batch.h
diff --git a/src/mesa/pipe/i965simple/brw_blit.c b/src/gallium/drivers/i965simple/brw_blit.c
index bbd366294f5..8494f70493c 100644
--- a/src/mesa/pipe/i965simple/brw_blit.c
+++ b/src/gallium/drivers/i965simple/brw_blit.c
@@ -111,6 +111,7 @@ static unsigned translate_raster_op(unsigned logicop)
/* Copy BitBlt
*/
void brw_copy_blit(struct brw_context *brw,
+ unsigned do_flip,
unsigned cpp,
short src_pitch,
struct pipe_buffer *src_buffer,
diff --git a/src/mesa/pipe/i965simple/brw_blit.h b/src/gallium/drivers/i965simple/brw_blit.h
index 7f17a701732..111c5d91d39 100644
--- a/src/mesa/pipe/i965simple/brw_blit.h
+++ b/src/gallium/drivers/i965simple/brw_blit.h
@@ -16,6 +16,7 @@ void brw_fill_blit(struct brw_context *intel,
short w, short h,
unsigned color);
void brw_copy_blit(struct brw_context *intel,
+ unsigned do_flip,
unsigned cpp,
short src_pitch,
struct pipe_buffer *src_buffer,
diff --git a/src/mesa/pipe/i965simple/brw_cc.c b/src/gallium/drivers/i965simple/brw_cc.c
index 337e4f95f69..337e4f95f69 100644
--- a/src/mesa/pipe/i965simple/brw_cc.c
+++ b/src/gallium/drivers/i965simple/brw_cc.c
diff --git a/src/mesa/pipe/i965simple/brw_clip.c b/src/gallium/drivers/i965simple/brw_clip.c
index 268124cc53f..268124cc53f 100644
--- a/src/mesa/pipe/i965simple/brw_clip.c
+++ b/src/gallium/drivers/i965simple/brw_clip.c
diff --git a/src/mesa/pipe/i965simple/brw_clip.h b/src/gallium/drivers/i965simple/brw_clip.h
index a89d08b7910..a89d08b7910 100644
--- a/src/mesa/pipe/i965simple/brw_clip.h
+++ b/src/gallium/drivers/i965simple/brw_clip.h
diff --git a/src/mesa/pipe/i965simple/brw_clip_line.c b/src/gallium/drivers/i965simple/brw_clip_line.c
index 75d9e5fcda2..75d9e5fcda2 100644
--- a/src/mesa/pipe/i965simple/brw_clip_line.c
+++ b/src/gallium/drivers/i965simple/brw_clip_line.c
diff --git a/src/mesa/pipe/i965simple/brw_clip_point.c b/src/gallium/drivers/i965simple/brw_clip_point.c
index 6fce7210d1b..6fce7210d1b 100644
--- a/src/mesa/pipe/i965simple/brw_clip_point.c
+++ b/src/gallium/drivers/i965simple/brw_clip_point.c
diff --git a/src/mesa/pipe/i965simple/brw_clip_state.c b/src/gallium/drivers/i965simple/brw_clip_state.c
index ea5c05a2796..ea5c05a2796 100644
--- a/src/mesa/pipe/i965simple/brw_clip_state.c
+++ b/src/gallium/drivers/i965simple/brw_clip_state.c
diff --git a/src/mesa/pipe/i965simple/brw_clip_tri.c b/src/gallium/drivers/i965simple/brw_clip_tri.c
index c5da7b825e0..c5da7b825e0 100644
--- a/src/mesa/pipe/i965simple/brw_clip_tri.c
+++ b/src/gallium/drivers/i965simple/brw_clip_tri.c
diff --git a/src/mesa/pipe/i965simple/brw_clip_unfilled.c b/src/gallium/drivers/i965simple/brw_clip_unfilled.c
index b774a76dd63..b774a76dd63 100644
--- a/src/mesa/pipe/i965simple/brw_clip_unfilled.c
+++ b/src/gallium/drivers/i965simple/brw_clip_unfilled.c
diff --git a/src/mesa/pipe/i965simple/brw_clip_util.c b/src/gallium/drivers/i965simple/brw_clip_util.c
index 6d58ceafff3..6d58ceafff3 100644
--- a/src/mesa/pipe/i965simple/brw_clip_util.c
+++ b/src/gallium/drivers/i965simple/brw_clip_util.c
diff --git a/src/mesa/pipe/i965simple/brw_context.c b/src/gallium/drivers/i965simple/brw_context.c
index 5e58701e91c..5e58701e91c 100644
--- a/src/mesa/pipe/i965simple/brw_context.c
+++ b/src/gallium/drivers/i965simple/brw_context.c
diff --git a/src/mesa/pipe/i965simple/brw_context.h b/src/gallium/drivers/i965simple/brw_context.h
index 65664d853dd..65664d853dd 100644
--- a/src/mesa/pipe/i965simple/brw_context.h
+++ b/src/gallium/drivers/i965simple/brw_context.h
diff --git a/src/mesa/pipe/i965simple/brw_curbe.c b/src/gallium/drivers/i965simple/brw_curbe.c
index 52bbd525c16..52bbd525c16 100644
--- a/src/mesa/pipe/i965simple/brw_curbe.c
+++ b/src/gallium/drivers/i965simple/brw_curbe.c
diff --git a/src/mesa/pipe/i965simple/brw_defines.h b/src/gallium/drivers/i965simple/brw_defines.h
index 9379a397f63..9379a397f63 100644
--- a/src/mesa/pipe/i965simple/brw_defines.h
+++ b/src/gallium/drivers/i965simple/brw_defines.h
diff --git a/src/mesa/pipe/i965simple/brw_draw.c b/src/gallium/drivers/i965simple/brw_draw.c
index 7598e3dc8af..7598e3dc8af 100644
--- a/src/mesa/pipe/i965simple/brw_draw.c
+++ b/src/gallium/drivers/i965simple/brw_draw.c
diff --git a/src/mesa/pipe/i965simple/brw_draw.h b/src/gallium/drivers/i965simple/brw_draw.h
index 62fe0d5d0ee..62fe0d5d0ee 100644
--- a/src/mesa/pipe/i965simple/brw_draw.h
+++ b/src/gallium/drivers/i965simple/brw_draw.h
diff --git a/src/mesa/pipe/i965simple/brw_draw_upload.c b/src/gallium/drivers/i965simple/brw_draw_upload.c
index aa85d93866a..aa85d93866a 100644
--- a/src/mesa/pipe/i965simple/brw_draw_upload.c
+++ b/src/gallium/drivers/i965simple/brw_draw_upload.c
diff --git a/src/mesa/pipe/i965simple/brw_eu.c b/src/gallium/drivers/i965simple/brw_eu.c
index e2002d1821f..e2002d1821f 100644
--- a/src/mesa/pipe/i965simple/brw_eu.c
+++ b/src/gallium/drivers/i965simple/brw_eu.c
diff --git a/src/mesa/pipe/i965simple/brw_eu.h b/src/gallium/drivers/i965simple/brw_eu.h
index 23151ae9ed6..23151ae9ed6 100644
--- a/src/mesa/pipe/i965simple/brw_eu.h
+++ b/src/gallium/drivers/i965simple/brw_eu.h
diff --git a/src/mesa/pipe/i965simple/brw_eu_debug.c b/src/gallium/drivers/i965simple/brw_eu_debug.c
index 4a94ddefa6a..4a94ddefa6a 100644
--- a/src/mesa/pipe/i965simple/brw_eu_debug.c
+++ b/src/gallium/drivers/i965simple/brw_eu_debug.c
diff --git a/src/mesa/pipe/i965simple/brw_eu_emit.c b/src/gallium/drivers/i965simple/brw_eu_emit.c
index 400a80b6fba..400a80b6fba 100644
--- a/src/mesa/pipe/i965simple/brw_eu_emit.c
+++ b/src/gallium/drivers/i965simple/brw_eu_emit.c
diff --git a/src/mesa/pipe/i965simple/brw_eu_util.c b/src/gallium/drivers/i965simple/brw_eu_util.c
index 3a65b141f07..3a65b141f07 100644
--- a/src/mesa/pipe/i965simple/brw_eu_util.c
+++ b/src/gallium/drivers/i965simple/brw_eu_util.c
diff --git a/src/mesa/pipe/i965simple/brw_flush.c b/src/gallium/drivers/i965simple/brw_flush.c
index 5216c680cf6..5216c680cf6 100644
--- a/src/mesa/pipe/i965simple/brw_flush.c
+++ b/src/gallium/drivers/i965simple/brw_flush.c
diff --git a/src/mesa/pipe/i965simple/brw_gs.c b/src/gallium/drivers/i965simple/brw_gs.c
index de60868ccca..de60868ccca 100644
--- a/src/mesa/pipe/i965simple/brw_gs.c
+++ b/src/gallium/drivers/i965simple/brw_gs.c
diff --git a/src/mesa/pipe/i965simple/brw_gs.h b/src/gallium/drivers/i965simple/brw_gs.h
index f09141c6aa1..f09141c6aa1 100644
--- a/src/mesa/pipe/i965simple/brw_gs.h
+++ b/src/gallium/drivers/i965simple/brw_gs.h
diff --git a/src/mesa/pipe/i965simple/brw_gs_emit.c b/src/gallium/drivers/i965simple/brw_gs_emit.c
index c3cc90b10f8..c3cc90b10f8 100644
--- a/src/mesa/pipe/i965simple/brw_gs_emit.c
+++ b/src/gallium/drivers/i965simple/brw_gs_emit.c
diff --git a/src/mesa/pipe/i965simple/brw_gs_state.c b/src/gallium/drivers/i965simple/brw_gs_state.c
index 3932e9e9394..3932e9e9394 100644
--- a/src/mesa/pipe/i965simple/brw_gs_state.c
+++ b/src/gallium/drivers/i965simple/brw_gs_state.c
diff --git a/src/mesa/pipe/i965simple/brw_misc_state.c b/src/gallium/drivers/i965simple/brw_misc_state.c
index 925049ecc19..925049ecc19 100644
--- a/src/mesa/pipe/i965simple/brw_misc_state.c
+++ b/src/gallium/drivers/i965simple/brw_misc_state.c
diff --git a/src/mesa/pipe/i965simple/brw_reg.h b/src/gallium/drivers/i965simple/brw_reg.h
index 9e885c3b3b7..9e885c3b3b7 100644
--- a/src/mesa/pipe/i965simple/brw_reg.h
+++ b/src/gallium/drivers/i965simple/brw_reg.h
diff --git a/src/mesa/pipe/i965simple/brw_sf.c b/src/gallium/drivers/i965simple/brw_sf.c
index 7c83b81c858..7c83b81c858 100644
--- a/src/mesa/pipe/i965simple/brw_sf.c
+++ b/src/gallium/drivers/i965simple/brw_sf.c
diff --git a/src/mesa/pipe/i965simple/brw_sf.h b/src/gallium/drivers/i965simple/brw_sf.h
index b7ada475604..b7ada475604 100644
--- a/src/mesa/pipe/i965simple/brw_sf.h
+++ b/src/gallium/drivers/i965simple/brw_sf.h
diff --git a/src/mesa/pipe/i965simple/brw_sf_emit.c b/src/gallium/drivers/i965simple/brw_sf_emit.c
index 78d6fa5e9e5..78d6fa5e9e5 100644
--- a/src/mesa/pipe/i965simple/brw_sf_emit.c
+++ b/src/gallium/drivers/i965simple/brw_sf_emit.c
diff --git a/src/mesa/pipe/i965simple/brw_sf_state.c b/src/gallium/drivers/i965simple/brw_sf_state.c
index 9acd3ea61b2..9acd3ea61b2 100644
--- a/src/mesa/pipe/i965simple/brw_sf_state.c
+++ b/src/gallium/drivers/i965simple/brw_sf_state.c
diff --git a/src/mesa/pipe/i965simple/brw_shader_info.c b/src/gallium/drivers/i965simple/brw_shader_info.c
index 431b45466a6..a762a870fe9 100644
--- a/src/mesa/pipe/i965simple/brw_shader_info.c
+++ b/src/gallium/drivers/i965simple/brw_shader_info.c
@@ -3,7 +3,7 @@
#include "brw_state.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
+#include "tgsi/util/tgsi_parse.h"
diff --git a/src/mesa/pipe/i965simple/brw_state.c b/src/gallium/drivers/i965simple/brw_state.c
index 95dfce88e4a..f746d1cc57c 100644
--- a/src/mesa/pipe/i965simple/brw_state.c
+++ b/src/gallium/drivers/i965simple/brw_state.c
@@ -33,7 +33,7 @@
#include "pipe/p_winsys.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_dump.h"
+#include "tgsi/util/tgsi_dump.h"
#include "brw_context.h"
#include "brw_defines.h"
diff --git a/src/mesa/pipe/i965simple/brw_state.h b/src/gallium/drivers/i965simple/brw_state.h
index 258e9a556e2..258e9a556e2 100644
--- a/src/mesa/pipe/i965simple/brw_state.h
+++ b/src/gallium/drivers/i965simple/brw_state.h
diff --git a/src/mesa/pipe/i965simple/brw_state_batch.c b/src/gallium/drivers/i965simple/brw_state_batch.c
index 35db76b5941..35db76b5941 100644
--- a/src/mesa/pipe/i965simple/brw_state_batch.c
+++ b/src/gallium/drivers/i965simple/brw_state_batch.c
diff --git a/src/mesa/pipe/i965simple/brw_state_cache.c b/src/gallium/drivers/i965simple/brw_state_cache.c
index b3a5124461d..b3a5124461d 100644
--- a/src/mesa/pipe/i965simple/brw_state_cache.c
+++ b/src/gallium/drivers/i965simple/brw_state_cache.c
diff --git a/src/mesa/pipe/i965simple/brw_state_pool.c b/src/gallium/drivers/i965simple/brw_state_pool.c
index f3174bfe0ae..f3174bfe0ae 100644
--- a/src/mesa/pipe/i965simple/brw_state_pool.c
+++ b/src/gallium/drivers/i965simple/brw_state_pool.c
diff --git a/src/mesa/pipe/i965simple/brw_state_upload.c b/src/gallium/drivers/i965simple/brw_state_upload.c
index e727601e1e7..e727601e1e7 100644
--- a/src/mesa/pipe/i965simple/brw_state_upload.c
+++ b/src/gallium/drivers/i965simple/brw_state_upload.c
diff --git a/src/mesa/pipe/i965simple/brw_strings.c b/src/gallium/drivers/i965simple/brw_strings.c
index 29a41ed1e9b..3d9c50961fa 100644
--- a/src/mesa/pipe/i965simple/brw_strings.c
+++ b/src/gallium/drivers/i965simple/brw_strings.c
@@ -59,7 +59,7 @@ static const char *brw_get_name( struct pipe_context *pipe )
break;
}
- sprintf(buffer, "pipe/i965 (chipset: %s)", chipset);
+ sprintf(buffer, "i965 (chipset: %s)", chipset);
return buffer;
}
diff --git a/src/mesa/pipe/i965simple/brw_structs.h b/src/gallium/drivers/i965simple/brw_structs.h
index bbb087e95d6..bbb087e95d6 100644
--- a/src/mesa/pipe/i965simple/brw_structs.h
+++ b/src/gallium/drivers/i965simple/brw_structs.h
diff --git a/src/mesa/pipe/i965simple/brw_surface.c b/src/gallium/drivers/i965simple/brw_surface.c
index eb7835836ee..376a42b1a6a 100644
--- a/src/mesa/pipe/i965simple/brw_surface.c
+++ b/src/gallium/drivers/i965simple/brw_surface.c
@@ -32,7 +32,7 @@
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-#include "pipe/util/p_tile.h"
+#include "util/p_tile.h"
/*
@@ -103,6 +103,7 @@ brw_surface_data(struct pipe_context *pipe,
*/
static void
brw_surface_copy(struct pipe_context *pipe,
+ unsigned do_flip,
struct pipe_surface *dst,
unsigned dstx, unsigned dsty,
struct pipe_surface *src,
@@ -118,14 +119,15 @@ brw_surface_copy(struct pipe_context *pipe,
dstx, dsty,
width, height,
pipe_surface_map(src) + src->offset,
- src->pitch,
- srcx, srcy);
+ do_flip ? -src->pitch : src->pitch,
+ srcx, do_flip ? 1 - srcy - height : srcy);
pipe_surface_unmap(src);
pipe_surface_unmap(dst);
}
else {
brw_copy_blit(brw_context(pipe),
+ do_flip,
dst->cpp,
(short) src->pitch, src->buffer, src->offset, FALSE,
(short) dst->pitch, dst->buffer, dst->offset, FALSE,
diff --git a/src/mesa/pipe/i965simple/brw_tex_layout.c b/src/gallium/drivers/i965simple/brw_tex_layout.c
index 90561f1307d..90561f1307d 100644
--- a/src/mesa/pipe/i965simple/brw_tex_layout.c
+++ b/src/gallium/drivers/i965simple/brw_tex_layout.c
diff --git a/src/mesa/pipe/i965simple/brw_tex_layout.h b/src/gallium/drivers/i965simple/brw_tex_layout.h
index cfd6b1ef3ae..cfd6b1ef3ae 100644
--- a/src/mesa/pipe/i965simple/brw_tex_layout.h
+++ b/src/gallium/drivers/i965simple/brw_tex_layout.h
diff --git a/src/mesa/pipe/i965simple/brw_urb.c b/src/gallium/drivers/i965simple/brw_urb.c
index 101a4367b90..101a4367b90 100644
--- a/src/mesa/pipe/i965simple/brw_urb.c
+++ b/src/gallium/drivers/i965simple/brw_urb.c
diff --git a/src/mesa/pipe/i965simple/brw_util.c b/src/gallium/drivers/i965simple/brw_util.c
index 42391d7c8c5..42391d7c8c5 100644
--- a/src/mesa/pipe/i965simple/brw_util.c
+++ b/src/gallium/drivers/i965simple/brw_util.c
diff --git a/src/mesa/pipe/i965simple/brw_util.h b/src/gallium/drivers/i965simple/brw_util.h
index d60e5934dba..d60e5934dba 100644
--- a/src/mesa/pipe/i965simple/brw_util.h
+++ b/src/gallium/drivers/i965simple/brw_util.h
diff --git a/src/mesa/pipe/i965simple/brw_vs.c b/src/gallium/drivers/i965simple/brw_vs.c
index 738c6346d5e..738c6346d5e 100644
--- a/src/mesa/pipe/i965simple/brw_vs.c
+++ b/src/gallium/drivers/i965simple/brw_vs.c
diff --git a/src/mesa/pipe/i965simple/brw_vs.h b/src/gallium/drivers/i965simple/brw_vs.h
index 0e58f043b02..0e58f043b02 100644
--- a/src/mesa/pipe/i965simple/brw_vs.h
+++ b/src/gallium/drivers/i965simple/brw_vs.h
diff --git a/src/mesa/pipe/i965simple/brw_vs_emit.c b/src/gallium/drivers/i965simple/brw_vs_emit.c
index 98915ba1016..05df4860eda 100644
--- a/src/mesa/pipe/i965simple/brw_vs_emit.c
+++ b/src/gallium/drivers/i965simple/brw_vs_emit.c
@@ -33,7 +33,7 @@
#include "brw_vs.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
+#include "tgsi/util/tgsi_parse.h"
struct brw_prog_info {
unsigned num_temps;
diff --git a/src/mesa/pipe/i965simple/brw_vs_state.c b/src/gallium/drivers/i965simple/brw_vs_state.c
index c73469929ce..c73469929ce 100644
--- a/src/mesa/pipe/i965simple/brw_vs_state.c
+++ b/src/gallium/drivers/i965simple/brw_vs_state.c
diff --git a/src/mesa/pipe/i965simple/brw_winsys.h b/src/gallium/drivers/i965simple/brw_winsys.h
index 3523a58614f..3523a58614f 100644
--- a/src/mesa/pipe/i965simple/brw_winsys.h
+++ b/src/gallium/drivers/i965simple/brw_winsys.h
diff --git a/src/mesa/pipe/i965simple/brw_wm.c b/src/gallium/drivers/i965simple/brw_wm.c
index 539b1707444..539b1707444 100644
--- a/src/mesa/pipe/i965simple/brw_wm.c
+++ b/src/gallium/drivers/i965simple/brw_wm.c
diff --git a/src/mesa/pipe/i965simple/brw_wm.h b/src/gallium/drivers/i965simple/brw_wm.h
index a1ac0f504a6..a1ac0f504a6 100644
--- a/src/mesa/pipe/i965simple/brw_wm.h
+++ b/src/gallium/drivers/i965simple/brw_wm.h
diff --git a/src/mesa/pipe/i965simple/brw_wm_decl.c b/src/gallium/drivers/i965simple/brw_wm_decl.c
index b45a333a2e9..97418a52e7f 100644
--- a/src/mesa/pipe/i965simple/brw_wm_decl.c
+++ b/src/gallium/drivers/i965simple/brw_wm_decl.c
@@ -4,7 +4,7 @@
#include "brw_wm.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
+#include "tgsi/util/tgsi_parse.h"
static struct brw_reg alloc_tmp(struct brw_wm_compile *c)
{
diff --git a/src/mesa/pipe/i965simple/brw_wm_glsl.c b/src/gallium/drivers/i965simple/brw_wm_glsl.c
index d95645d1085..44f946ea748 100644
--- a/src/mesa/pipe/i965simple/brw_wm_glsl.c
+++ b/src/gallium/drivers/i965simple/brw_wm_glsl.c
@@ -4,7 +4,7 @@
#include "brw_wm.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
+#include "tgsi/util/tgsi_parse.h"
diff --git a/src/mesa/pipe/i965simple/brw_wm_iz.c b/src/gallium/drivers/i965simple/brw_wm_iz.c
index 6c5f25bf39e..6c5f25bf39e 100644
--- a/src/mesa/pipe/i965simple/brw_wm_iz.c
+++ b/src/gallium/drivers/i965simple/brw_wm_iz.c
diff --git a/src/mesa/pipe/i965simple/brw_wm_sampler_state.c b/src/gallium/drivers/i965simple/brw_wm_sampler_state.c
index de42ffc5b1e..de42ffc5b1e 100644
--- a/src/mesa/pipe/i965simple/brw_wm_sampler_state.c
+++ b/src/gallium/drivers/i965simple/brw_wm_sampler_state.c
diff --git a/src/mesa/pipe/i965simple/brw_wm_state.c b/src/gallium/drivers/i965simple/brw_wm_state.c
index 5ccd4888423..5ccd4888423 100644
--- a/src/mesa/pipe/i965simple/brw_wm_state.c
+++ b/src/gallium/drivers/i965simple/brw_wm_state.c
diff --git a/src/mesa/pipe/i965simple/brw_wm_surface_state.c b/src/gallium/drivers/i965simple/brw_wm_surface_state.c
index d16d919bce9..d16d919bce9 100644
--- a/src/mesa/pipe/i965simple/brw_wm_surface_state.c
+++ b/src/gallium/drivers/i965simple/brw_wm_surface_state.c
diff --git a/src/mesa/pipe/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile
index 31438a882e6..5479daf8ea2 100644
--- a/src/mesa/pipe/softpipe/Makefile
+++ b/src/gallium/drivers/softpipe/Makefile
@@ -5,6 +5,9 @@ include $(TOP)/configs/current
LIBNAME = softpipe
DRIVER_SOURCES = \
+ sp_fs_exec.c \
+ sp_fs_sse.c \
+ sp_fs_llvm.c \
sp_clear.c \
sp_flush.c \
sp_query.c \
@@ -44,7 +47,7 @@ C_SOURCES = \
ASM_SOURCES =
-include ../Makefile.template
+include ../../Makefile.template
symlinks:
diff --git a/src/mesa/pipe/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript
index d581ee8d3ca..d581ee8d3ca 100644
--- a/src/mesa/pipe/softpipe/SConscript
+++ b/src/gallium/drivers/softpipe/SConscript
diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c
index 8d295a30ca6..8d295a30ca6 100644
--- a/src/mesa/pipe/softpipe/sp_clear.c
+++ b/src/gallium/drivers/softpipe/sp_clear.c
diff --git a/src/mesa/pipe/softpipe/sp_clear.h b/src/gallium/drivers/softpipe/sp_clear.h
index a8ed1c4ecc4..a8ed1c4ecc4 100644
--- a/src/mesa/pipe/softpipe/sp_clear.h
+++ b/src/gallium/drivers/softpipe/sp_clear.h
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index cea6b90104f..5e98f190bbf 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -29,7 +29,7 @@
* Keith Whitwell <[email protected]>
*/
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_util.h"
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h
index aff8c2cc5dc..b70d4fea85a 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/gallium/drivers/softpipe/sp_context.h
@@ -34,7 +34,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/draw/draw_vertex.h"
+#include "draw/draw_vertex.h"
#include "sp_quad.h"
@@ -44,8 +44,8 @@ struct softpipe_vbuf_render;
struct draw_context;
struct draw_stage;
struct softpipe_tile_cache;
-struct sp_fragment_shader_state;
-struct sp_vertex_shader_state;
+struct sp_fragment_shader;
+struct sp_vertex_shader;
struct softpipe_context {
@@ -59,8 +59,8 @@ struct softpipe_context {
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_alpha_state *depth_stencil;
const struct pipe_rasterizer_state *rasterizer;
- const struct sp_fragment_shader_state *fs;
- const struct sp_vertex_shader_state *vs;
+ const struct sp_fragment_shader *fs;
+ const struct sp_vertex_shader *vs;
struct pipe_blend_color blend_color;
struct pipe_clip_state clip;
diff --git a/src/mesa/pipe/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c
index 71a303a8b58..2049afda34f 100644
--- a/src/mesa/pipe/softpipe/sp_draw_arrays.c
+++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c
@@ -38,7 +38,7 @@
#include "sp_context.h"
#include "sp_state.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
diff --git a/src/mesa/pipe/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c
index ec6bb4a0dca..2cbd0d7cabe 100644
--- a/src/mesa/pipe/softpipe/sp_flush.c
+++ b/src/gallium/drivers/softpipe/sp_flush.c
@@ -31,6 +31,7 @@
#include "pipe/p_defines.h"
+#include "draw/draw_context.h"
#include "sp_flush.h"
#include "sp_context.h"
#include "sp_surface.h"
@@ -50,6 +51,8 @@ softpipe_flush( struct pipe_context *pipe,
struct softpipe_context *softpipe = softpipe_context(pipe);
uint i;
+ draw_flush(softpipe->draw);
+
/* - flush the quad pipeline
* - flush the texture cache
* - flush the render cache
diff --git a/src/mesa/pipe/softpipe/sp_flush.h b/src/gallium/drivers/softpipe/sp_flush.h
index 34ec617866b..34ec617866b 100644
--- a/src/mesa/pipe/softpipe/sp_flush.h
+++ b/src/gallium/drivers/softpipe/sp_flush.h
diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/gallium/drivers/softpipe/sp_fs.h
index 551b0b97342..4792ace3a33 100644
--- a/src/mesa/pipe/llvm/storagesoa.h
+++ b/src/gallium/drivers/softpipe/sp_fs.h
@@ -1,5 +1,5 @@
/**************************************************************************
- *
+ *
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
@@ -10,11 +10,11 @@
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -22,50 +22,33 @@
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 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 STORAGESOA_H
-#define STORAGESOA_H
-
-#include <vector>
-
-namespace llvm {
- class BasicBlock;
- class Constant;
- class ConstantInt;
- class LoadInst;
- class Value;
- class VectorType;
-}
+/* Authors: Keith Whitwell <[email protected]>
+ */
-class StorageSoa
-{
-public:
- StorageSoa(llvm::BasicBlock *block,
- llvm::Value *input,
- llvm::Value *output,
- llvm::Value *consts);
+#ifndef SP_FS_H
+#define SP_FS_H
- void addImmediate(float *vec);
+struct sp_fragment_shader *
+softpipe_create_fs_exec(struct softpipe_context *softpipe,
+ const struct pipe_shader_state *templ);
- llvm::Value * addrElement(int idx) const;
+struct sp_fragment_shader *
+softpipe_create_fs_sse(struct softpipe_context *softpipe,
+ const struct pipe_shader_state *templ);
- std::vector<llvm::Value*> inputElement(int idx, int swizzle, llvm::Value *indIdx =0);
- std::vector<llvm::Value*> constElement(int idx, int swizzle, llvm::Value *indIdx =0);
- std::vector<llvm::Value*> outputElement(int idx, int swizzle, llvm::Value *indIdx =0);
- std::vector<llvm::Value*> tempElement(int idx, int swizzle, llvm::Value *indIdx =0);
- std::vector<llvm::Value*> immediateElement(int idx, int swizzle);
+struct sp_fragment_shader *
+softpipe_create_fs_llvm(struct softpipe_context *softpipe,
+ const struct pipe_shader_state *templ);
- llvm::Value *extractIndex(llvm::Value *vec);
+struct tgsi_interp_coef;
+struct tgsi_exec_vector;
- void storeOutput(int dstIdx, const std::vector<llvm::Value*> &val,
- int mask);
- void storeTemp(int idx, const std::vector<llvm::Value*> &val,
- int mask);
- void storeAddress(int idx, const std::vector<llvm::Value*> &val,
- int mask);
+void sp_setup_pos_vector(const struct tgsi_interp_coef *coef,
+ float x, float y,
+ struct tgsi_exec_vector *quadpos);
-};
#endif
diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c
new file mode 100644
index 00000000000..9ad30a76817
--- /dev/null
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -0,0 +1,112 @@
+/**************************************************************************
+ *
+ * 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 "sp_fs.h"
+#include "sp_headers.h"
+
+
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
+#include "pipe/p_inlines.h"
+#include "tgsi/exec/tgsi_exec.h"
+
+struct sp_exec_fragment_shader {
+ struct sp_fragment_shader base;
+};
+
+
+
+
+static void
+exec_prepare( struct sp_fragment_shader *base,
+ struct tgsi_exec_machine *machine,
+ struct tgsi_sampler *samplers )
+{
+ tgsi_exec_machine_bind_shader( machine,
+ base->shader.tokens,
+ PIPE_MAX_SAMPLERS,
+ samplers );
+}
+
+
+
+
+/* TODO: hide the machine struct in here somewhere, remove from this
+ * interface:
+ */
+static unsigned
+exec_run( struct sp_fragment_shader *base,
+ struct tgsi_exec_machine *machine,
+ struct quad_header *quad )
+{
+
+ /* Compute X, Y, Z, W vals for this quad */
+ sp_setup_pos_vector(quad->posCoef,
+ (float)quad->x0, (float)quad->y0,
+ &machine->QuadPos);
+
+ return tgsi_exec_machine_run( machine );
+}
+
+
+
+static void
+exec_delete( struct sp_fragment_shader *base )
+{
+ FREE(base);
+}
+
+
+
+
+
+struct sp_fragment_shader *
+softpipe_create_fs_exec(struct softpipe_context *softpipe,
+ const struct pipe_shader_state *templ)
+{
+ struct sp_exec_fragment_shader *shader;
+
+ /* Decide whether we'll be codegenerating this shader and if so do
+ * that now.
+ */
+
+ shader = CALLOC_STRUCT(sp_exec_fragment_shader);
+ if (!shader)
+ return NULL;
+
+ shader->base.shader = *templ;
+ shader->base.prepare = exec_prepare;
+ shader->base.run = exec_run;
+ shader->base.delete = exec_delete;
+
+ return &shader->base;
+}
+
diff --git a/src/gallium/drivers/softpipe/sp_fs_llvm.c b/src/gallium/drivers/softpipe/sp_fs_llvm.c
new file mode 100644
index 00000000000..22da4714533
--- /dev/null
+++ b/src/gallium/drivers/softpipe/sp_fs_llvm.c
@@ -0,0 +1,200 @@
+/**************************************************************************
+ *
+ * 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:
+ * Zack Rusin
+ */
+
+#include "sp_context.h"
+#include "sp_state.h"
+#include "sp_fs.h"
+
+
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
+#include "pipe/p_inlines.h"
+#include "tgsi/exec/tgsi_sse2.h"
+
+#if 0
+
+struct sp_llvm_fragment_shader {
+ struct sp_fragment_shader base;
+ struct gallivm_prog *llvm_prog;
+};
+
+static void
+shade_quad_llvm(struct quad_stage *qs,
+ struct quad_header *quad)
+{
+ struct quad_shade_stage *qss = quad_shade_stage(qs);
+ struct softpipe_context *softpipe = qs->softpipe;
+ float dests[4][16][4] ALIGN16_ATTRIB;
+ float inputs[4][16][4] ALIGN16_ATTRIB;
+ const float fx = (float) quad->x0;
+ const float fy = (float) quad->y0;
+ struct gallivm_prog *llvm = qss->llvm_prog;
+
+ inputs[0][0][0] = fx;
+ inputs[1][0][0] = fx + 1.0f;
+ inputs[2][0][0] = fx;
+ inputs[3][0][0] = fx + 1.0f;
+
+ inputs[0][0][1] = fy;
+ inputs[1][0][1] = fy;
+ inputs[2][0][1] = fy + 1.0f;
+ inputs[3][0][1] = fy + 1.0f;
+
+
+ gallivm_prog_inputs_interpolate(llvm, inputs, quad->coef);
+
+#if DLLVM
+ debug_printf("MASK = %d\n", quad->mask);
+ for (int i = 0; i < 4; ++i) {
+ for (int j = 0; j < 2; ++j) {
+ debug_printf("IN(%d,%d) [%f %f %f %f]\n", i, j,
+ inputs[i][j][0], inputs[i][j][1], inputs[i][j][2], inputs[i][j][3]);
+ }
+ }
+#endif
+
+ quad->mask &=
+ gallivm_fragment_shader_exec(llvm, fx, fy, dests, inputs,
+ softpipe->mapped_constants[PIPE_SHADER_FRAGMENT],
+ qss->samplers);
+#if DLLVM
+ debug_printf("OUT LLVM = 1[%f %f %f %f], 2[%f %f %f %f]\n",
+ dests[0][0][0], dests[0][0][1], dests[0][0][2], dests[0][0][3],
+ dests[0][1][0], dests[0][1][1], dests[0][1][2], dests[0][1][3]);
+#endif
+
+ /* store result color */
+ if (qss->colorOutSlot >= 0) {
+ unsigned i;
+ /* XXX need to handle multiple color outputs someday */
+ allvmrt(qss->stage.softpipe->fs->shader.output_semantic_name[qss->colorOutSlot]
+ == TGSI_SEMANTIC_COLOR);
+ for (i = 0; i < QUAD_SIZE; ++i) {
+ quad->outputs.color[0][i] = dests[i][qss->colorOutSlot][0];
+ quad->outputs.color[1][i] = dests[i][qss->colorOutSlot][1];
+ quad->outputs.color[2][i] = dests[i][qss->colorOutSlot][2];
+ quad->outputs.color[3][i] = dests[i][qss->colorOutSlot][3];
+ }
+ }
+#if DLLVM
+ for (int i = 0; i < QUAD_SIZE; ++i) {
+ debug_printf("QLLVM%d(%d) [%f, %f, %f, %f]\n", i, qss->colorOutSlot,
+ quad->outputs.color[0][i],
+ quad->outputs.color[1][i],
+ quad->outputs.color[2][i],
+ quad->outputs.color[3][i]);
+ }
+#endif
+
+ /* store result Z */
+ if (qss->depthOutSlot >= 0) {
+ /* output[slot] is new Z */
+ uint i;
+ for (i = 0; i < 4; i++) {
+ quad->outputs.depth[i] = dests[i][0][2];
+ }
+ }
+ else {
+ /* copy input Z (which was interpolated by the executor) to output Z */
+ uint i;
+ for (i = 0; i < 4; i++) {
+ quad->outputs.depth[i] = inputs[i][0][2];
+ }
+ }
+#if DLLVM
+ debug_printf("D [%f, %f, %f, %f] mask = %d\n",
+ quad->outputs.depth[0],
+ quad->outputs.depth[1],
+ quad->outputs.depth[2],
+ quad->outputs.depth[3], quad->mask);
+#endif
+
+ /* shader may cull fragments */
+ if( quad->mask ) {
+ qs->next->run( qs->next, quad );
+ }
+}
+
+
+unsigned
+run_llvm_fs( struct sp_fragment_shader *base,
+ struct foo *machine )
+{
+}
+
+
+void
+delete_llvm_fs( struct sp_fragment_shader *base )
+{
+ FREE(base);
+}
+
+
+struct sp_fragment_shader *
+softpipe_create_fs_llvm(struct softpipe_context *softpipe,
+ const struct pipe_shader_state *templ)
+{
+ struct sp_llvm_fragment_shader *shader = NULL;
+
+ /* LLVM fragment shaders currently disabled:
+ */
+ state = CALLOC_STRUCT(sp_llvm_shader_state);
+ if (!state)
+ return NULL;
+
+ state->llvm_prog = 0;
+
+ if (!gallivm_global_cpu_engine()) {
+ gallivm_cpu_engine_create(state->llvm_prog);
+ }
+ else
+ gallivm_cpu_jit_compile(gallivm_global_cpu_engine(), state->llvm_prog);
+
+ if (shader) {
+ shader->base.run = run_llvm_fs;
+ shader->base.delete = delete_llvm_fs;
+ }
+
+ return shader;
+}
+
+
+#else
+
+struct sp_fragment_shader *
+softpipe_create_fs_llvm(struct softpipe_context *softpipe,
+ const struct pipe_shader_state *templ)
+{
+ return NULL;
+}
+
+#endif
diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c
new file mode 100644
index 00000000000..d90066e0257
--- /dev/null
+++ b/src/gallium/drivers/softpipe/sp_fs_sse.c
@@ -0,0 +1,192 @@
+/**************************************************************************
+ *
+ * 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 "sp_fs.h"
+#include "sp_headers.h"
+
+
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
+#include "pipe/p_inlines.h"
+#include "tgsi/exec/tgsi_exec.h"
+#include "tgsi/exec/tgsi_sse2.h"
+
+
+#if defined(__i386__) || defined(__386__)
+
+#include "x86/rtasm/x86sse.h"
+
+/* Surely this should be defined somewhere in a tgsi header:
+ */
+typedef void (XSTDCALL *codegen_function)(
+ const struct tgsi_exec_vector *input,
+ struct tgsi_exec_vector *output,
+ float (*constant)[4],
+ struct tgsi_exec_vector *temporary,
+ const struct tgsi_interp_coef *coef
+ //, const struct tgsi_exec_vector *quadPos
+ );
+
+
+struct sp_sse_fragment_shader {
+ struct sp_fragment_shader base;
+ struct x86_function sse2_program;
+ codegen_function func;
+};
+
+
+/**
+ * Compute quad X,Y,Z,W for the four fragments in a quad.
+ *
+ * This should really be part of the compiled shader.
+ */
+void
+sp_setup_pos_vector(const struct tgsi_interp_coef *coef,
+ float x, float y,
+ struct tgsi_exec_vector *quadpos)
+{
+ uint chan;
+ /* do X */
+ quadpos->xyzw[0].f[0] = x;
+ quadpos->xyzw[0].f[1] = x + 1;
+ quadpos->xyzw[0].f[2] = x;
+ quadpos->xyzw[0].f[3] = x + 1;
+
+ /* do Y */
+ quadpos->xyzw[1].f[0] = y;
+ quadpos->xyzw[1].f[1] = y;
+ quadpos->xyzw[1].f[2] = y + 1;
+ quadpos->xyzw[1].f[3] = y + 1;
+
+ /* do Z and W for all fragments in the quad */
+ for (chan = 2; chan < 4; chan++) {
+ const float dadx = coef->dadx[chan];
+ const float dady = coef->dady[chan];
+ const float a0 = coef->a0[chan] + dadx * x + dady * y;
+ quadpos->xyzw[chan].f[0] = a0;
+ quadpos->xyzw[chan].f[1] = a0 + dadx;
+ quadpos->xyzw[chan].f[2] = a0 + dady;
+ quadpos->xyzw[chan].f[3] = a0 + dadx + dady;
+ }
+}
+
+
+static void
+fs_sse_prepare( struct sp_fragment_shader *base,
+ struct tgsi_exec_machine *machine,
+ struct tgsi_sampler *samplers )
+{
+}
+
+
+/* TODO: codegenerate the whole run function, skip this wrapper.
+ * TODO: break dependency on tgsi_exec_machine struct
+ * TODO: push Position calculation into the generated shader
+ * TODO: process >1 quad at a time
+ */
+static unsigned
+fs_sse_run( struct sp_fragment_shader *base,
+ struct tgsi_exec_machine *machine,
+ struct quad_header *quad )
+{
+ struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base;
+
+ /* Compute X, Y, Z, W vals for this quad -- place in temp[0] for now */
+ sp_setup_pos_vector(quad->posCoef,
+ (float)quad->x0, (float)quad->y0,
+ machine->Temps);
+
+ shader->func( machine->Inputs,
+ machine->Outputs,
+ machine->Consts,
+ machine->Temps,
+ machine->InterpCoefs
+ // , &machine->QuadPos
+ );
+
+ return ~(machine->Temps[TGSI_EXEC_TEMP_KILMASK_I].xyzw[TGSI_EXEC_TEMP_KILMASK_C].u[0]);
+}
+
+
+static void
+fs_sse_delete( struct sp_fragment_shader *base )
+{
+ struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base;
+
+ x86_release_func( &shader->sse2_program );
+ FREE(shader);
+}
+
+
+struct sp_fragment_shader *
+softpipe_create_fs_sse(struct softpipe_context *softpipe,
+ const struct pipe_shader_state *templ)
+{
+ struct sp_sse_fragment_shader *shader;
+
+ if (!softpipe->use_sse)
+ return NULL;
+
+ shader = CALLOC_STRUCT(sp_sse_fragment_shader);
+ if (!shader)
+ return NULL;
+
+ x86_init_func( &shader->sse2_program );
+
+ if (!tgsi_emit_sse2_fs( templ->tokens, &shader->sse2_program )) {
+ FREE(shader);
+ return NULL;
+ }
+
+ shader->func = (codegen_function) x86_get_func( &shader->sse2_program );
+ assert(shader->func);
+
+ shader->base.shader = *templ;
+ shader->base.prepare = fs_sse_prepare;
+ shader->base.run = fs_sse_run;
+ shader->base.delete = fs_sse_delete;
+
+ return &shader->base;
+}
+
+
+#else
+
+/* Maybe put this varient in the header file.
+ */
+struct sp_fragment_shader *
+softpipe_create_fs_sse(struct softpipe_context *softpipe,
+ const struct pipe_shader_state *templ)
+{
+ return NULL;
+}
+
+#endif
diff --git a/src/mesa/pipe/softpipe/sp_headers.h b/src/gallium/drivers/softpipe/sp_headers.h
index 0ae31d87961..9cf82221333 100644
--- a/src/mesa/pipe/softpipe/sp_headers.h
+++ b/src/gallium/drivers/softpipe/sp_headers.h
@@ -31,7 +31,7 @@
#ifndef SP_HEADERS_H
#define SP_HEADERS_H
-#include "pipe/tgsi/exec/tgsi_exec.h"
+#include "tgsi/exec/tgsi_exec.h"
#define PRIM_POINT 1
#define PRIM_LINE 2
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/gallium/drivers/softpipe/sp_prim_setup.c
index 7478b2336b6..d73521ccbe5 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.c
+++ b/src/gallium/drivers/softpipe/sp_prim_setup.c
@@ -38,8 +38,8 @@
#include "sp_quad.h"
#include "sp_state.h"
#include "sp_prim_setup.h"
-#include "pipe/draw/draw_private.h"
-#include "pipe/draw/draw_vertex.h"
+#include "draw/draw_private.h"
+#include "draw/draw_vertex.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
@@ -499,7 +499,7 @@ setup_fragcoord_coeff(struct setup_stage *setup)
setup->coef[0].a0[2] = setup->posCoef.a0[2];
setup->coef[0].dadx[2] = setup->posCoef.dadx[2];
setup->coef[0].dady[2] = setup->posCoef.dady[2];
- /*w*/
+ /*W*/
setup->coef[0].a0[3] = setup->posCoef.a0[3];
setup->coef[0].dadx[3] = setup->posCoef.dadx[3];
setup->coef[0].dady[3] = setup->posCoef.dady[3];
@@ -513,8 +513,9 @@ setup_fragcoord_coeff(struct setup_stage *setup)
*/
static void setup_tri_coefficients( struct setup_stage *setup )
{
- const struct softpipe_context *softpipe = setup->softpipe;
+ struct softpipe_context *softpipe = setup->softpipe;
const struct pipe_shader_state *fs = &softpipe->fs->shader;
+ const struct vertex_info *vinfo = softpipe_get_vertex_info(softpipe);
uint fragSlot;
/* z and w are done by linear interpolation:
@@ -525,10 +526,10 @@ static void setup_tri_coefficients( struct setup_stage *setup )
/* setup interpolation for all the remaining attributes:
*/
for (fragSlot = 0; fragSlot < fs->num_inputs; fragSlot++) {
- const uint vertSlot = softpipe->vertex_info.src_index[fragSlot];
+ const uint vertSlot = vinfo->src_index[fragSlot];
uint j;
- switch (softpipe->vertex_info.interp_mode[fragSlot]) {
+ switch (vinfo->interp_mode[fragSlot]) {
case INTERP_CONSTANT:
for (j = 0; j < NUM_CHANNELS; j++)
const_coeff(setup, &setup->coef[fragSlot], vertSlot, j);
@@ -756,8 +757,9 @@ line_persp_coeff(struct setup_stage *setup,
static INLINE void
setup_line_coefficients(struct setup_stage *setup, struct prim_header *prim)
{
- const struct softpipe_context *softpipe = setup->softpipe;
+ struct softpipe_context *softpipe = setup->softpipe;
const struct pipe_shader_state *fs = &setup->softpipe->fs->shader;
+ const struct vertex_info *vinfo = softpipe_get_vertex_info(softpipe);
uint fragSlot;
/* use setup->vmin, vmax to point to vertices */
@@ -779,10 +781,10 @@ setup_line_coefficients(struct setup_stage *setup, struct prim_header *prim)
/* setup interpolation for all the remaining attributes:
*/
for (fragSlot = 0; fragSlot < fs->num_inputs; fragSlot++) {
- const uint vertSlot = softpipe->vertex_info.src_index[fragSlot];
+ const uint vertSlot = vinfo->src_index[fragSlot];
uint j;
- switch (softpipe->vertex_info.interp_mode[fragSlot]) {
+ switch (vinfo->interp_mode[fragSlot]) {
case INTERP_CONSTANT:
for (j = 0; j < NUM_CHANNELS; j++)
const_coeff(setup, &setup->coef[fragSlot], vertSlot, j);
@@ -978,6 +980,7 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
const boolean round = (boolean) setup->softpipe->rasterizer->point_smooth;
const float x = v0->data[0][0]; /* Note: data[0] is always position */
const float y = v0->data[0][1];
+ const struct vertex_info *vinfo = softpipe_get_vertex_info(softpipe);
uint fragSlot;
/* For points, all interpolants are constant-valued.
@@ -1003,10 +1006,10 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
const_coeff(setup, &setup->posCoef, 0, 3);
for (fragSlot = 0; fragSlot < fs->num_inputs; fragSlot++) {
- const uint vertSlot = softpipe->vertex_info.src_index[fragSlot];
+ const uint vertSlot = vinfo->src_index[fragSlot];
uint j;
- switch (softpipe->vertex_info.interp_mode[fragSlot]) {
+ switch (vinfo->interp_mode[fragSlot]) {
case INTERP_CONSTANT:
/* fall-through */
case INTERP_LINEAR:
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.h b/src/gallium/drivers/softpipe/sp_prim_setup.h
index f3e8a79dd9e..f3e8a79dd9e 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.h
+++ b/src/gallium/drivers/softpipe/sp_prim_setup.h
diff --git a/src/mesa/pipe/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
index c9089e7eb22..69bea8a8f5c 100644
--- a/src/mesa/pipe/softpipe/sp_prim_vbuf.c
+++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
@@ -37,10 +37,11 @@
#include "sp_context.h"
+#include "sp_state.h"
#include "sp_prim_vbuf.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/draw/draw_private.h"
-#include "pipe/draw/draw_vbuf.h"
+#include "draw/draw_context.h"
+#include "draw/draw_private.h"
+#include "draw/draw_vbuf.h"
#define SP_MAX_VBUF_INDEXES 1024
@@ -73,9 +74,7 @@ static const struct vertex_info *
sp_vbuf_get_vertex_info(struct vbuf_render *vbr)
{
struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr);
- /* XXX check for state changes? */
- assert(!cvbr->softpipe->dirty );
- return &cvbr->softpipe->vertex_info_vbuf;
+ return softpipe_get_vbuf_vertex_info(cvbr->softpipe);
}
diff --git a/src/mesa/pipe/softpipe/sp_prim_vbuf.h b/src/gallium/drivers/softpipe/sp_prim_vbuf.h
index 1de9cc2a894..1de9cc2a894 100644
--- a/src/mesa/pipe/softpipe/sp_prim_vbuf.h
+++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.h
diff --git a/src/mesa/pipe/softpipe/sp_quad.c b/src/gallium/drivers/softpipe/sp_quad.c
index 6bd468a51cf..6bd468a51cf 100644
--- a/src/mesa/pipe/softpipe/sp_quad.c
+++ b/src/gallium/drivers/softpipe/sp_quad.c
diff --git a/src/mesa/pipe/softpipe/sp_quad.h b/src/gallium/drivers/softpipe/sp_quad.h
index f1e0281764f..f1e0281764f 100644
--- a/src/mesa/pipe/softpipe/sp_quad.h
+++ b/src/gallium/drivers/softpipe/sp_quad.h
diff --git a/src/mesa/pipe/softpipe/sp_quad_alpha_test.c b/src/gallium/drivers/softpipe/sp_quad_alpha_test.c
index 4ffeac35e16..4ffeac35e16 100644
--- a/src/mesa/pipe/softpipe/sp_quad_alpha_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_alpha_test.c
diff --git a/src/mesa/pipe/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index 17f3ecd0b83..17f3ecd0b83 100644
--- a/src/mesa/pipe/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
diff --git a/src/mesa/pipe/softpipe/sp_quad_bufloop.c b/src/gallium/drivers/softpipe/sp_quad_bufloop.c
index 2ae4e22a7de..2ae4e22a7de 100644
--- a/src/mesa/pipe/softpipe/sp_quad_bufloop.c
+++ b/src/gallium/drivers/softpipe/sp_quad_bufloop.c
diff --git a/src/mesa/pipe/softpipe/sp_quad_colormask.c b/src/gallium/drivers/softpipe/sp_quad_colormask.c
index 1f09d900ca8..1f09d900ca8 100644
--- a/src/mesa/pipe/softpipe/sp_quad_colormask.c
+++ b/src/gallium/drivers/softpipe/sp_quad_colormask.c
diff --git a/src/mesa/pipe/softpipe/sp_quad_coverage.c b/src/gallium/drivers/softpipe/sp_quad_coverage.c
index b3d3fae22fd..b3d3fae22fd 100644
--- a/src/mesa/pipe/softpipe/sp_quad_coverage.c
+++ b/src/gallium/drivers/softpipe/sp_quad_coverage.c
diff --git a/src/mesa/pipe/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index a9a0754f279..a9a0754f279 100644
--- a/src/mesa/pipe/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
diff --git a/src/mesa/pipe/softpipe/sp_quad_earlyz.c b/src/gallium/drivers/softpipe/sp_quad_earlyz.c
index 22ea99049fe..22ea99049fe 100644
--- a/src/mesa/pipe/softpipe/sp_quad_earlyz.c
+++ b/src/gallium/drivers/softpipe/sp_quad_earlyz.c
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c
index b5d7dfca1ca..cf1b1eff75c 100644
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/gallium/drivers/softpipe/sp_quad_fs.c
@@ -39,12 +39,6 @@
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
-#include "x86/rtasm/x86sse.h"
-
-#ifdef MESA_LLVM
-#include "pipe/llvm/gallivm.h"
-#endif
-
#include "sp_context.h"
#include "sp_state.h"
#include "sp_headers.h"
@@ -60,9 +54,6 @@ struct quad_shade_stage
struct tgsi_exec_machine machine;
struct tgsi_exec_vector *inputs, *outputs;
int colorOutSlot, depthOutSlot;
-#ifdef MESA_LLVM
- struct gallivm_prog *llvm_prog;
-#endif
};
@@ -74,46 +65,6 @@ quad_shade_stage(struct quad_stage *qs)
}
-/**
- * Compute quad X,Y,Z,W for the four fragments in a quad.
- * Note that we only need to "compute" X and Y for the upper-left fragment.
- * We could do less work if we're not depth testing, or there's no
- * perspective-corrected attributes, but that's seldom.
- */
-static void
-setup_pos_vector(const struct tgsi_interp_coef *coef,
- float x, float y,
- struct tgsi_exec_vector *quadpos)
-{
- uint chan;
- /* do X */
- quadpos->xyzw[0].f[0] = x;
- /* do Y */
- quadpos->xyzw[1].f[0] = y;
- /* do Z and W for all fragments in the quad */
- for (chan = 2; chan < 4; chan++) {
- const float dadx = coef->dadx[chan];
- const float dady = coef->dady[chan];
- const float a0 = coef->a0[chan] + dadx * x + dady * y;
- quadpos->xyzw[chan].f[0] = a0;
- quadpos->xyzw[chan].f[1] = a0 + dadx;
- quadpos->xyzw[chan].f[2] = a0 + dady;
- quadpos->xyzw[chan].f[3] = a0 + dadx + dady;
- }
-}
-
-
-typedef void (XSTDCALL *codegen_function)(
- const struct tgsi_exec_vector *input,
- struct tgsi_exec_vector *output,
- float (*constant)[4],
- struct tgsi_exec_vector *temporary,
- const struct tgsi_interp_coef *coef
-#if 0
- ,const struct tgsi_exec_vector *quadPos
-#endif
- );
-
/**
* Execute fragment shader for the four fragments in the quad.
@@ -132,30 +83,10 @@ shade_quad(
machine->InterpCoefs = quad->coef;
- /* Compute X, Y, Z, W vals for this quad */
- setup_pos_vector(quad->posCoef, (float) quad->x0, (float) quad->y0, &machine->QuadPos);
-
/* run shader */
-#if defined(__i386__) || defined(__386__)
- if( softpipe->use_sse ) {
- codegen_function func = (codegen_function) x86_get_func( &softpipe->fs->sse2_program );
- func(
- machine->Inputs,
- machine->Outputs,
- machine->Consts,
- machine->Temps,
- machine->InterpCoefs
-#if 0
- ,machine->QuadPos
-#endif
- );
- quad->mask &= ~(machine->Temps[TGSI_EXEC_TEMP_KILMASK_I].xyzw[TGSI_EXEC_TEMP_KILMASK_C].u[0]);
- }
- else
-#endif
- {
- quad->mask &= tgsi_exec_machine_run( machine );
- }
+ quad->mask &= softpipe->fs->run( softpipe->fs,
+ &qss->machine,
+ quad );
/* store result color */
if (qss->colorOutSlot >= 0) {
@@ -199,105 +130,6 @@ shade_quad(
}
}
-#ifdef MESA_LLVM
-#define DLLVM 0
-static void
-shade_quad_llvm(struct quad_stage *qs,
- struct quad_header *quad)
-{
- struct quad_shade_stage *qss = quad_shade_stage(qs);
- struct softpipe_context *softpipe = qs->softpipe;
- float dests[4][16][4] ALIGN16_ATTRIB;
- float inputs[4][16][4] ALIGN16_ATTRIB;
- const float fx = (float) quad->x0;
- const float fy = (float) quad->y0;
- struct gallivm_prog *llvm = qss->llvm_prog;
-
- inputs[0][0][0] = fx;
- inputs[1][0][0] = fx + 1.0f;
- inputs[2][0][0] = fx;
- inputs[3][0][0] = fx + 1.0f;
-
- inputs[0][0][1] = fy;
- inputs[1][0][1] = fy;
- inputs[2][0][1] = fy + 1.0f;
- inputs[3][0][1] = fy + 1.0f;
-#if DLLVM
- debug_printf("MASK = %d\n", quad->mask);
-#endif
- gallivm_prog_inputs_interpolate(llvm, inputs, quad->coef);
-#if DLLVM
- for (int i = 0; i < 4; ++i) {
- for (int j = 0; j < 2; ++j) {
- debug_printf("IN(%d,%d) [%f %f %f %f]\n", i, j,
- inputs[i][j][0], inputs[i][j][1], inputs[i][j][2], inputs[i][j][3]);
- }
- }
-#endif
-
- quad->mask &=
- gallivm_fragment_shader_exec(llvm, fx, fy, dests, inputs,
- softpipe->mapped_constants[PIPE_SHADER_FRAGMENT],
- qss->samplers);
-#if DLLVM
- debug_printf("OUT LLVM = 1[%f %f %f %f], 2[%f %f %f %f]\n",
- dests[0][0][0], dests[0][0][1], dests[0][0][2], dests[0][0][3],
- dests[0][1][0], dests[0][1][1], dests[0][1][2], dests[0][1][3]);
-#endif
-
- /* store result color */
- if (qss->colorOutSlot >= 0) {
- unsigned i;
- /* XXX need to handle multiple color outputs someday */
- assert(qss->stage.softpipe->fs->shader.output_semantic_name[qss->colorOutSlot]
- == TGSI_SEMANTIC_COLOR);
- for (i = 0; i < QUAD_SIZE; ++i) {
- quad->outputs.color[0][i] = dests[i][qss->colorOutSlot][0];
- quad->outputs.color[1][i] = dests[i][qss->colorOutSlot][1];
- quad->outputs.color[2][i] = dests[i][qss->colorOutSlot][2];
- quad->outputs.color[3][i] = dests[i][qss->colorOutSlot][3];
- }
- }
-#if DLLVM
- for (int i = 0; i < QUAD_SIZE; ++i) {
- debug_printf("QLLVM%d(%d) [%f, %f, %f, %f]\n", i, qss->colorOutSlot,
- quad->outputs.color[0][i],
- quad->outputs.color[1][i],
- quad->outputs.color[2][i],
- quad->outputs.color[3][i]);
- }
-#endif
-
- /* store result Z */
- if (qss->depthOutSlot >= 0) {
- /* output[slot] is new Z */
- uint i;
- for (i = 0; i < 4; i++) {
- quad->outputs.depth[i] = dests[i][0][2];
- }
- }
- else {
- /* copy input Z (which was interpolated by the executor) to output Z */
- uint i;
- for (i = 0; i < 4; i++) {
- quad->outputs.depth[i] = inputs[i][0][2];
- }
- }
-#if DLLVM
- debug_printf("D [%f, %f, %f, %f] mask = %d\n",
- quad->outputs.depth[0],
- quad->outputs.depth[1],
- quad->outputs.depth[2],
- quad->outputs.depth[3], quad->mask);
-#endif
-
- /* shader may cull fragments */
- if( quad->mask ) {
- qs->next->run( qs->next, quad );
- }
-}
-#endif /*MESA_LLVM*/
-
/**
* Per-primitive (or per-begin?) setup
*/
@@ -313,15 +145,6 @@ static void shade_begin(struct quad_stage *qs)
qss->samplers[i].texture = &softpipe->texture[i]->base;
}
-#ifdef MESA_LLVM
- qss->llvm_prog = softpipe->fs->llvm_prog;
-#endif
- /* XXX only do this if the fragment shader changes... */
- tgsi_exec_machine_init(&qss->machine,
- softpipe->fs->shader.tokens,
- PIPE_MAX_SAMPLERS,
- qss->samplers );
-
/* find output slots for depth, color */
qss->colorOutSlot = -1;
qss->depthOutSlot = -1;
@@ -335,6 +158,10 @@ static void shade_begin(struct quad_stage *qs)
break;
}
}
+
+ softpipe->fs->prepare( softpipe->fs,
+ &qss->machine,
+ qss->samplers );
qs->next->begin(qs->next);
}
@@ -364,16 +191,7 @@ struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe )
qss->stage.softpipe = softpipe;
qss->stage.begin = shade_begin;
-#ifdef MESA_LLVM
- /* disable until ported to accept
- * x/y and soa layout
- qss->stage.run = shade_quad_llvm;
- */
- softpipe->use_sse = FALSE;
- qss->stage.run = shade_quad;
-#else
qss->stage.run = shade_quad;
-#endif
qss->stage.destroy = shade_destroy;
/* set TGSI sampler state that's constant */
@@ -384,5 +202,7 @@ struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe )
qss->samplers[i].cache = softpipe->tex_cache[i];
}
+ tgsi_exec_machine_init( &qss->machine );
+
return &qss->stage;
}
diff --git a/src/mesa/pipe/softpipe/sp_quad_occlusion.c b/src/gallium/drivers/softpipe/sp_quad_occlusion.c
index 54254df1f11..54254df1f11 100644
--- a/src/mesa/pipe/softpipe/sp_quad_occlusion.c
+++ b/src/gallium/drivers/softpipe/sp_quad_occlusion.c
diff --git a/src/mesa/pipe/softpipe/sp_quad_output.c b/src/gallium/drivers/softpipe/sp_quad_output.c
index cfe8f118081..cfe8f118081 100644
--- a/src/mesa/pipe/softpipe/sp_quad_output.c
+++ b/src/gallium/drivers/softpipe/sp_quad_output.c
diff --git a/src/mesa/pipe/softpipe/sp_quad_stencil.c b/src/gallium/drivers/softpipe/sp_quad_stencil.c
index 92a0da00833..92a0da00833 100644
--- a/src/mesa/pipe/softpipe/sp_quad_stencil.c
+++ b/src/gallium/drivers/softpipe/sp_quad_stencil.c
diff --git a/src/mesa/pipe/softpipe/sp_quad_stipple.c b/src/gallium/drivers/softpipe/sp_quad_stipple.c
index 8660432259c..8660432259c 100644
--- a/src/mesa/pipe/softpipe/sp_quad_stipple.c
+++ b/src/gallium/drivers/softpipe/sp_quad_stipple.c
diff --git a/src/mesa/pipe/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c
index 6a8a43aedaf..adf9ccf64c6 100644
--- a/src/mesa/pipe/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -29,7 +29,7 @@
* Keith Whitwell <[email protected]>
*/
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_util.h"
diff --git a/src/mesa/pipe/softpipe/sp_query.h b/src/gallium/drivers/softpipe/sp_query.h
index 05060a45759..05060a45759 100644
--- a/src/mesa/pipe/softpipe/sp_query.h
+++ b/src/gallium/drivers/softpipe/sp_query.h
diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h
index af955c1e17b..ef8cf67d4c3 100644
--- a/src/mesa/pipe/softpipe/sp_state.h
+++ b/src/gallium/drivers/softpipe/sp_state.h
@@ -33,8 +33,6 @@
#include "pipe/p_state.h"
-#include "x86/rtasm/x86sse.h"
-
#define SP_NEW_VIEWPORT 0x1
#define SP_NEW_RASTERIZER 0x2
@@ -53,27 +51,37 @@
#define SP_NEW_QUERY 0x4000
+struct tgsi_sampler;
+struct tgsi_interp_coef;
+struct tgsi_exec_machine;
-#ifdef MESA_LLVM
-struct gallivm_prog;
-#endif
+/** Subclass of pipe_shader_state (though it doesn't really need to be).
+ *
+ * This is starting to look an awful lot like a quad pipeline stage...
+ */
+struct sp_fragment_shader {
+ struct pipe_shader_state shader;
+ void (*prepare)( struct sp_fragment_shader *shader,
+ struct tgsi_exec_machine *machine,
+ struct tgsi_sampler *samplers);
-/** Subclass of pipe_shader_state */
-struct sp_fragment_shader_state {
- struct pipe_shader_state shader;
-#if defined(__i386__) || defined(__386__)
- struct x86_function sse2_program;
-#endif
-#ifdef MESA_LLVM
- struct gallivm_prog *llvm_prog;
-#endif
+ /* Run the shader - this interface will get cleaned up in the
+ * future:
+ */
+ unsigned (*run)( struct sp_fragment_shader *shader,
+ struct tgsi_exec_machine *machine,
+ struct quad_header *quad );
+
+
+ void (*delete)( struct sp_fragment_shader * );
};
+struct vertex_info;
/** Subclass of pipe_shader_state */
-struct sp_vertex_shader_state {
+struct sp_vertex_shader {
struct pipe_shader_state shader;
struct draw_vertex_shader *draw_data;
};
@@ -174,4 +182,12 @@ softpipe_map_texture_surfaces(struct softpipe_context *sp);
void
softpipe_unmap_texture_surfaces(struct softpipe_context *sp);
+
+struct vertex_info *
+softpipe_get_vertex_info(struct softpipe_context *softpipe);
+
+struct vertex_info *
+softpipe_get_vbuf_vertex_info(struct softpipe_context *softpipe);
+
+
#endif
diff --git a/src/mesa/pipe/softpipe/sp_state_blend.c b/src/gallium/drivers/softpipe/sp_state_blend.c
index 2d40d6bd8f5..2d40d6bd8f5 100644
--- a/src/mesa/pipe/softpipe/sp_state_blend.c
+++ b/src/gallium/drivers/softpipe/sp_state_blend.c
diff --git a/src/mesa/pipe/softpipe/sp_state_clip.c b/src/gallium/drivers/softpipe/sp_state_clip.c
index 08c5f06d05d..c797c0dd3b1 100644
--- a/src/mesa/pipe/softpipe/sp_state_clip.c
+++ b/src/gallium/drivers/softpipe/sp_state_clip.c
@@ -29,7 +29,7 @@
*/
#include "sp_context.h"
#include "sp_state.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
void softpipe_set_clip_state( struct pipe_context *pipe,
diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c
new file mode 100644
index 00000000000..9d8fd8b750f
--- /dev/null
+++ b/src/gallium/drivers/softpipe/sp_state_derived.c
@@ -0,0 +1,235 @@
+/**************************************************************************
+ *
+ * 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_util.h"
+#include "pipe/p_shader_tokens.h"
+#include "draw/draw_context.h"
+#include "draw/draw_vertex.h"
+#include "draw/draw_private.h"
+#include "sp_context.h"
+#include "sp_state.h"
+
+
+/**
+ * Search vertex program's outputs to find a match for the given
+ * semantic name/index. Return the index of the output slot.
+ *
+ * Return 0 if not found. This will cause the fragment program to use
+ * vertex attrib 0 (position) in the cases where the fragment program
+ * attempts to use a missing vertex program output. This is an undefined
+ * condition that users shouldn't hit anyway.
+ */
+static int
+find_vs_output(const struct pipe_shader_state *vs,
+ uint semantic_name,
+ uint semantic_index)
+{
+ uint i;
+ for (i = 0; i < vs->num_outputs; i++) {
+ if (vs->output_semantic_name[i] == semantic_name &&
+ vs->output_semantic_index[i] == semantic_index)
+ return i;
+ }
+ return 0;
+}
+
+
+/**
+ * Mark the current vertex layout as "invalid".
+ * We'll validate the vertex layout later, when we start to actually
+ * render a point or line or tri.
+ */
+static void
+invalidate_vertex_layout(struct softpipe_context *softpipe)
+{
+ softpipe->vertex_info.num_attribs = 0;
+}
+
+
+/**
+ * The vertex info describes how to convert the post-transformed vertices
+ * (simple float[][4]) used by the 'draw' module into vertices for
+ * rasterization.
+ *
+ * This function validates the vertex layout and returns a pointer to a
+ * vertex_info object.
+ */
+struct vertex_info *
+softpipe_get_vertex_info(struct softpipe_context *softpipe)
+{
+ struct vertex_info *vinfo = &softpipe->vertex_info;
+
+ if (vinfo->num_attribs == 0) {
+ /* compute vertex layout now */
+ const struct pipe_shader_state *vs = &softpipe->vs->shader;
+ const struct pipe_shader_state *fs = &softpipe->fs->shader;
+ const enum interp_mode colorInterp
+ = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
+ uint i;
+
+ if (softpipe->vbuf) {
+ /* if using the post-transform vertex buffer, tell draw_vbuf to
+ * simply emit the whole post-xform vertex as-is:
+ */
+ struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf;
+ vinfo_vbuf->num_attribs = 0;
+ draw_emit_vertex_attr(vinfo_vbuf, EMIT_ALL, INTERP_NONE, 0);
+ vinfo_vbuf->size = 4 * vs->num_outputs
+ + sizeof(struct vertex_header) / 4;
+ }
+
+ /*
+ * Loop over fragment shader inputs, searching for the matching output
+ * from the vertex shader.
+ */
+ vinfo->num_attribs = 0;
+ for (i = 0; i < fs->num_inputs; i++) {
+ int src;
+ switch (fs->input_semantic_name[i]) {
+ case TGSI_SEMANTIC_POSITION:
+ src = find_vs_output(vs, TGSI_SEMANTIC_POSITION, 0);
+ draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, src);
+ break;
+
+ case TGSI_SEMANTIC_COLOR:
+ src = find_vs_output(vs, TGSI_SEMANTIC_COLOR,
+ fs->input_semantic_index[i]);
+ draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src);
+ break;
+
+ case TGSI_SEMANTIC_FOG:
+ src = find_vs_output(vs, TGSI_SEMANTIC_FOG, 0);
+ draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src);
+ break;
+
+ case TGSI_SEMANTIC_GENERIC:
+ /* this includes texcoords and varying vars */
+ src = find_vs_output(vs, TGSI_SEMANTIC_GENERIC,
+ fs->input_semantic_index[i]);
+ draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src);
+ break;
+
+ default:
+ assert(0);
+ }
+ }
+
+ softpipe->psize_slot = find_vs_output(vs, TGSI_SEMANTIC_PSIZE, 0);
+ if (softpipe->psize_slot > 0) {
+ draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT,
+ softpipe->psize_slot);
+ }
+
+ draw_compute_vertex_size(vinfo);
+ }
+
+ return vinfo;
+}
+
+
+/**
+ * Called from vbuf module.
+ *
+ * Note that there's actually two different vertex layouts in softpipe.
+ *
+ * The normal one is computed in softpipe_get_vertex_info() above and is
+ * used by the point/line/tri "setup" code.
+ *
+ * The other one (this one) is only used by the vbuf module (which is
+ * not normally used by default but used in testing). For the vbuf module,
+ * we basically want to pass-through the draw module's vertex layout as-is.
+ * When the softpipe vbuf code begins drawing, the normal vertex layout
+ * will come into play again.
+ */
+struct vertex_info *
+softpipe_get_vbuf_vertex_info(struct softpipe_context *softpipe)
+{
+ (void) softpipe_get_vertex_info(softpipe);
+ return &softpipe->vertex_info_vbuf;
+}
+
+
+/**
+ * Recompute cliprect from scissor bounds, scissor enable and surface size.
+ */
+static void
+compute_cliprect(struct softpipe_context *sp)
+{
+ unsigned surfWidth, surfHeight;
+
+ if (sp->framebuffer.num_cbufs > 0) {
+ surfWidth = sp->framebuffer.cbufs[0]->width;
+ surfHeight = sp->framebuffer.cbufs[0]->height;
+ }
+ else {
+ /* no surface? */
+ surfWidth = sp->scissor.maxx;
+ surfHeight = sp->scissor.maxy;
+ }
+
+ if (sp->rasterizer->scissor) {
+ /* clip to scissor rect */
+ sp->cliprect.minx = MAX2(sp->scissor.minx, 0);
+ sp->cliprect.miny = MAX2(sp->scissor.miny, 0);
+ sp->cliprect.maxx = MIN2(sp->scissor.maxx, surfWidth);
+ sp->cliprect.maxy = MIN2(sp->scissor.maxy, surfHeight);
+ }
+ else {
+ /* clip to surface bounds */
+ sp->cliprect.minx = 0;
+ sp->cliprect.miny = 0;
+ sp->cliprect.maxx = surfWidth;
+ sp->cliprect.maxy = surfHeight;
+ }
+}
+
+
+/* Hopefully this will remain quite simple, otherwise need to pull in
+ * something like the state tracker mechanism.
+ */
+void softpipe_update_derived( struct softpipe_context *softpipe )
+{
+ if (softpipe->dirty & (SP_NEW_RASTERIZER |
+ SP_NEW_FS |
+ SP_NEW_VS))
+ invalidate_vertex_layout( softpipe );
+
+ if (softpipe->dirty & (SP_NEW_SCISSOR |
+ SP_NEW_DEPTH_STENCIL_ALPHA |
+ SP_NEW_FRAMEBUFFER))
+ compute_cliprect(softpipe);
+
+ if (softpipe->dirty & (SP_NEW_BLEND |
+ SP_NEW_DEPTH_STENCIL_ALPHA |
+ SP_NEW_FRAMEBUFFER |
+ SP_NEW_RASTERIZER |
+ SP_NEW_FS |
+ SP_NEW_QUERY))
+ sp_build_quad_pipeline(softpipe);
+
+ softpipe->dirty = 0;
+}
diff --git a/src/mesa/pipe/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index 0b814fc2847..b0238f81737 100644
--- a/src/mesa/pipe/softpipe/sp_state_fs.c
+++ b/src/gallium/drivers/softpipe/sp_state_fs.c
@@ -27,16 +27,15 @@
#include "sp_context.h"
#include "sp_state.h"
+#include "sp_fs.h"
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-#include "pipe/draw/draw_context.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/llvm/gallivm.h"
-#include "pipe/tgsi/util/tgsi_dump.h"
-#include "pipe/tgsi/exec/tgsi_sse2.h"
+#include "draw/draw_context.h"
+#include "tgsi/util/tgsi_dump.h"
void *
@@ -44,40 +43,22 @@ softpipe_create_fs_state(struct pipe_context *pipe,
const struct pipe_shader_state *templ)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- struct sp_fragment_shader_state *state;
+ struct sp_fragment_shader *state;
- /* Decide whether we'll be codegenerating this shader and if so do
- * that now.
- */
+ if (softpipe->dump_fs)
+ tgsi_dump(templ->tokens, 0);
- state = CALLOC_STRUCT(sp_fragment_shader_state);
- if (!state)
- return NULL;
-
- state->shader = *templ;
+ state = softpipe_create_fs_llvm( softpipe, templ );
+ if (state)
+ return state;
+
+ state = softpipe_create_fs_sse( softpipe, templ );
+ if (state)
+ return state;
- if (softpipe->dump_fs) {
- tgsi_dump(state->shader.tokens, 0);
- }
-
-#ifdef MESA_LLVM
- state->llvm_prog = 0;
-
-#if 0
- if (!gallivm_global_cpu_engine()) {
- gallivm_cpu_engine_create(state->llvm_prog);
- }
- else
- gallivm_cpu_jit_compile(gallivm_global_cpu_engine(), state->llvm_prog);
-#endif
-
-#elif defined(__i386__) || defined(__386__)
- if (softpipe->use_sse) {
- x86_init_func( &state->sse2_program );
- tgsi_emit_sse2_fs( state->shader.tokens, &state->sse2_program );
- }
-#endif
+ state = softpipe_create_fs_exec( softpipe, templ );
+ assert(state);
return state;
}
@@ -87,7 +68,7 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- softpipe->fs = (struct sp_fragment_shader_state *) fs;
+ softpipe->fs = (struct sp_fragment_shader *) fs;
softpipe->dirty |= SP_NEW_FS;
}
@@ -96,13 +77,9 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
void
softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
{
- struct sp_fragment_shader_state *state = fs;
-
-#if defined(__i386__) || defined(__386__)
- x86_release_func( &state->sse2_program );
-#endif
-
- FREE( state );
+ struct sp_fragment_shader *state = fs;
+
+ state->delete( state );
}
@@ -111,9 +88,9 @@ softpipe_create_vs_state(struct pipe_context *pipe,
const struct pipe_shader_state *templ)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- struct sp_vertex_shader_state *state;
+ struct sp_vertex_shader *state;
- state = CALLOC_STRUCT(sp_vertex_shader_state);
+ state = CALLOC_STRUCT(sp_vertex_shader);
if (state == NULL ) {
return NULL;
}
@@ -136,7 +113,7 @@ softpipe_bind_vs_state(struct pipe_context *pipe, void *vs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- softpipe->vs = (const struct sp_vertex_shader_state *)vs;
+ softpipe->vs = (const struct sp_vertex_shader *)vs;
draw_bind_vertex_shader(softpipe->draw, softpipe->vs->draw_data);
@@ -149,8 +126,8 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- struct sp_vertex_shader_state *state =
- (struct sp_vertex_shader_state *)vs;
+ struct sp_vertex_shader *state =
+ (struct sp_vertex_shader *)vs;
draw_delete_vertex_shader(softpipe->draw, state->draw_data);
FREE( state );
diff --git a/src/mesa/pipe/softpipe/sp_state_rasterizer.c b/src/gallium/drivers/softpipe/sp_state_rasterizer.c
index 53755099dde..98e04352dbc 100644
--- a/src/mesa/pipe/softpipe/sp_state_rasterizer.c
+++ b/src/gallium/drivers/softpipe/sp_state_rasterizer.c
@@ -29,7 +29,7 @@
#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_state.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c
index 6a5a643c89e..460adccec4f 100644
--- a/src/mesa/pipe/softpipe/sp_state_sampler.c
+++ b/src/gallium/drivers/softpipe/sp_state_sampler.c
@@ -30,11 +30,15 @@
*/
#include "pipe/p_util.h"
+
+#include "draw/draw_context.h"
+
+#include "sp_context.h"
#include "sp_context.h"
#include "sp_state.h"
#include "sp_texture.h"
#include "sp_tile_cache.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
diff --git a/src/mesa/pipe/softpipe/sp_state_surface.c b/src/gallium/drivers/softpipe/sp_state_surface.c
index e2c6893e9f5..e2c6893e9f5 100644
--- a/src/mesa/pipe/softpipe/sp_state_surface.c
+++ b/src/gallium/drivers/softpipe/sp_state_surface.c
diff --git a/src/mesa/pipe/softpipe/sp_state_vertex.c b/src/gallium/drivers/softpipe/sp_state_vertex.c
index 09ff540ccfd..f01a10de3b4 100644
--- a/src/mesa/pipe/softpipe/sp_state_vertex.c
+++ b/src/gallium/drivers/softpipe/sp_state_vertex.c
@@ -33,7 +33,7 @@
#include "sp_state.h"
#include "sp_surface.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
void
diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/gallium/drivers/softpipe/sp_surface.c
index 5978ee48bd4..653449c4f18 100644
--- a/src/mesa/pipe/softpipe/sp_surface.c
+++ b/src/gallium/drivers/softpipe/sp_surface.c
@@ -29,7 +29,7 @@
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-#include "pipe/util/p_tile.h"
+#include "util/p_tile.h"
#include "sp_context.h"
#include "sp_surface.h"
@@ -40,6 +40,7 @@
*/
static void
sp_surface_copy(struct pipe_context *pipe,
+ unsigned do_flip,
struct pipe_surface *dst,
unsigned dstx, unsigned dsty,
struct pipe_surface *src,
@@ -53,8 +54,8 @@ sp_surface_copy(struct pipe_context *pipe,
dstx, dsty,
width, height,
pipe_surface_map(src),
- src->pitch,
- srcx, srcy);
+ do_flip ? -(int) src->pitch : src->pitch,
+ srcx, do_flip ? 1 - srcy - height : srcy);
pipe_surface_unmap(src);
pipe_surface_unmap(dst);
diff --git a/src/mesa/pipe/softpipe/sp_surface.h b/src/gallium/drivers/softpipe/sp_surface.h
index 22de3ba43f6..22de3ba43f6 100644
--- a/src/mesa/pipe/softpipe/sp_surface.h
+++ b/src/gallium/drivers/softpipe/sp_surface.h
diff --git a/src/mesa/pipe/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 325bdb86da5..2f82fd6abea 100644
--- a/src/mesa/pipe/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -40,7 +40,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
-#include "pipe/tgsi/exec/tgsi_exec.h"
+#include "tgsi/exec/tgsi_exec.h"
/*
diff --git a/src/mesa/pipe/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h
index 404bfd0c365..404bfd0c365 100644
--- a/src/mesa/pipe/softpipe/sp_tex_sample.h
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.h
diff --git a/src/mesa/pipe/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 6de7a9b543b..6de7a9b543b 100644
--- a/src/mesa/pipe/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
diff --git a/src/mesa/pipe/softpipe/sp_texture.h b/src/gallium/drivers/softpipe/sp_texture.h
index fa646c0de9f..fa646c0de9f 100644
--- a/src/mesa/pipe/softpipe/sp_texture.h
+++ b/src/gallium/drivers/softpipe/sp_texture.h
diff --git a/src/mesa/pipe/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index 1597361b82f..dde3fabc81e 100644
--- a/src/mesa/pipe/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -34,7 +34,7 @@
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
-#include "pipe/util/p_tile.h"
+#include "util/p_tile.h"
#include "sp_context.h"
#include "sp_surface.h"
#include "sp_tile_cache.h"
diff --git a/src/mesa/pipe/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h
index 7fd10812863..7fd10812863 100644
--- a/src/mesa/pipe/softpipe/sp_tile_cache.h
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.h
diff --git a/src/mesa/pipe/softpipe/sp_winsys.h b/src/gallium/drivers/softpipe/sp_winsys.h
index d6b379f58c6..d6b379f58c6 100644
--- a/src/mesa/pipe/softpipe/sp_winsys.h
+++ b/src/gallium/drivers/softpipe/sp_winsys.h
diff --git a/src/mesa/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 30cd729c564..30cd729c564 100644
--- a/src/mesa/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
diff --git a/src/mesa/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 92a1cd70c42..39f95695fb6 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -178,6 +178,7 @@ struct pipe_context {
*/
void (*surface_copy)(struct pipe_context *pipe,
+ unsigned 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/mesa/pipe/p_debug.h b/src/gallium/include/pipe/p_debug.h
index 2a11627b365..2a11627b365 100644
--- a/src/mesa/pipe/p_debug.h
+++ b/src/gallium/include/pipe/p_debug.h
diff --git a/src/mesa/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 0bf53ecb79d..0bf53ecb79d 100644
--- a/src/mesa/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
diff --git a/src/mesa/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index c9ad3243158..c9ad3243158 100644
--- a/src/mesa/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
diff --git a/src/mesa/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h
index ebf6ed86bcc..ebf6ed86bcc 100644
--- a/src/mesa/pipe/p_inlines.h
+++ b/src/gallium/include/pipe/p_inlines.h
diff --git a/src/mesa/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 3ce35310f6d..3ce35310f6d 100644
--- a/src/mesa/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
diff --git a/src/mesa/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 4d3a6b2f413..1082343e2f5 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -253,7 +253,8 @@ struct pipe_surface
unsigned status; /**< PIPE_SURFACE_STATUS_x */
unsigned clear_value; /**< may be temporary */
unsigned cpp; /**< bytes per pixel */
- unsigned width, height;
+ unsigned width;
+ unsigned height;
unsigned pitch; /**< in pixels */
unsigned offset; /**< offset from start of buffer, in bytes */
unsigned refcount;
@@ -272,13 +273,12 @@ struct pipe_texture
enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
enum pipe_format format; /**< PIPE_FORMAT_x */
- unsigned last_level; /**< Index of last mipmap level present/defined */
-
unsigned width[PIPE_MAX_TEXTURE_LEVELS];
unsigned height[PIPE_MAX_TEXTURE_LEVELS];
unsigned depth[PIPE_MAX_TEXTURE_LEVELS];
- unsigned cpp;
+ unsigned cpp:8;
+ unsigned last_level:8; /**< Index of last mipmap level present/defined */
unsigned compressed:1;
/* These are also refcounted:
@@ -294,7 +294,7 @@ struct pipe_texture
*/
struct pipe_vertex_buffer
{
- unsigned pitch:11; /**< stride to same attrib in next vertex, in bytes */
+ unsigned pitch; /**< stride to same attrib in next vertex, in bytes */
unsigned max_index; /**< number of vertices in this buffer */
unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */
struct pipe_buffer *buffer; /**< the actual buffer */
@@ -307,13 +307,13 @@ struct pipe_vertex_buffer
struct pipe_vertex_element
{
/** Offset of this attribute, in bytes, from the start of the vertex */
- unsigned src_offset:11;
+ unsigned src_offset;
/** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does
* this attribute live in?
*/
- unsigned vertex_buffer_index:5;
- unsigned nr_components:3;
+ unsigned vertex_buffer_index:8;
+ unsigned nr_components:8;
enum pipe_format src_format; /**< PIPE_FORMAT_* */
};
diff --git a/src/mesa/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h
index cd432c547ce..cd432c547ce 100644
--- a/src/mesa/pipe/p_thread.h
+++ b/src/gallium/include/pipe/p_thread.h
diff --git a/src/mesa/pipe/p_util.h b/src/gallium/include/pipe/p_util.h
index 469920efee3..d7da2801c92 100644
--- a/src/mesa/pipe/p_util.h
+++ b/src/gallium/include/pipe/p_util.h
@@ -185,12 +185,12 @@ align_free(void *ptr)
/**
- * Duplicate of a block of memory
+ * Duplicate a block of memory.
*/
static INLINE void *
mem_dup(const void *src, uint size)
{
- void *dup = malloc(size);
+ void *dup = MALLOC(size);
if (dup)
memcpy(dup, src, size);
return dup;
@@ -402,7 +402,7 @@ static INLINE int align(int value, int alignment)
extern void pipe_copy_rect(ubyte * dst, unsigned cpp, unsigned dst_pitch,
unsigned dst_x, unsigned dst_y, unsigned width,
unsigned height, const ubyte * src,
- unsigned src_pitch, unsigned src_x, unsigned src_y);
+ int src_pitch, unsigned src_x, int src_y);
#endif
diff --git a/src/mesa/pipe/p_winsys.h b/src/gallium/include/pipe/p_winsys.h
index 1e81eebd782..1e81eebd782 100644
--- a/src/mesa/pipe/p_winsys.h
+++ b/src/gallium/include/pipe/p_winsys.h
diff --git a/src/gallium/state_trackers/README b/src/gallium/state_trackers/README
new file mode 100644
index 00000000000..28dd27bbd50
--- /dev/null
+++ b/src/gallium/state_trackers/README
@@ -0,0 +1,2 @@
+This directory is a placeholder for incubating state-trackers. Mesa's
+state-tracker is in src/mesa.
diff --git a/src/gallium/winsys/dri/Makefile b/src/gallium/winsys/dri/Makefile
new file mode 100644
index 00000000000..f466ce6c3cc
--- /dev/null
+++ b/src/gallium/winsys/dri/Makefile
@@ -0,0 +1,38 @@
+# src/mesa/drivers/dri/Makefile
+
+TOP = ../../../..
+
+include $(TOP)/configs/current
+
+
+
+default: $(TOP)/$(LIB_DIR) subdirs
+
+
+$(TOP)/$(LIB_DIR):
+ -mkdir $(TOP)/$(LIB_DIR)
+
+
+subdirs:
+ @for dir in $(DRI_DIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE)) || exit 1 ; \
+ fi \
+ done
+
+
+install:
+ @for dir in $(DRI_DIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE) install) || exit 1 ; \
+ fi \
+ done
+
+
+clean:
+ @for dir in $(DRI_DIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE) clean) ; \
+ fi \
+ done
+ -rm -f common/*.o
diff --git a/src/gallium/winsys/dri/Makefile.template b/src/gallium/winsys/dri/Makefile.template
new file mode 100644
index 00000000000..2a261ed6694
--- /dev/null
+++ b/src/gallium/winsys/dri/Makefile.template
@@ -0,0 +1,113 @@
+# -*-makefile-*-
+
+MESA_MODULES = $(TOP)/src/mesa/libmesa.a
+
+COMMON_GALLIUM_SOURCES = \
+ $(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
+
+COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
+ $(TOP)/src/mesa/drivers/common/driverfuncs.c \
+ $(TOP)/src/mesa/drivers/dri/common/texmem.c \
+ $(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c
+
+COMMON_BM_SOURCES = \
+ $(TOP)/src/mesa/drivers/dri/common/dri_bufmgr.c \
+ $(TOP)/src/mesa/drivers/dri/common/dri_drmpool.c
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=
+WINLIB=
+INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES)
+
+OBJECTS = $(C_SOURCES:.c=.o) \
+ $(ASM_SOURCES:.S=.o)
+
+else
+# miniglx
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+INCLUDES = $(MINIGLX_INCLUDES) \
+ $(SHARED_INCLUDES) \
+ $(PCIACCESS_CFLAGS)
+
+OBJECTS = $(C_SOURCES:.c=.o) \
+ $(MINIGLX_SOURCES:.c=.o) \
+ $(ASM_SOURCES:.S=.o)
+endif
+
+
+### Include directories
+SHARED_INCLUDES = \
+ -I. \
+ -I$(TOP)/src/mesa/drivers/dri/common \
+ -Iserver \
+ -I$(TOP)/include \
+ -I$(TOP)/include/GL/internal \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/mesa \
+ -I$(TOP)/src/mesa/main \
+ -I$(TOP)/src/mesa/glapi \
+ -I$(TOP)/src/mesa/math \
+ -I$(TOP)/src/mesa/transform \
+ -I$(TOP)/src/mesa/shader \
+ -I$(TOP)/src/mesa/swrast \
+ -I$(TOP)/src/mesa/swrast_setup \
+ -I$(TOP)/src/egl/main \
+ -I$(TOP)/src/egl/drivers/dri \
+ $(LIBDRM_CFLAGS)
+
+
+##### RULES #####
+
+.c.o:
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
+
+.S.o:
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
+
+
+##### TARGETS #####
+
+default: depend symlinks $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
+
+
+$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
+ $(TOP)/bin/mklib -noprefix -o $@ \
+ $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
+
+
+$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
+ $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)
+
+
+depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
+ rm -f depend
+ touch depend
+ $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_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
+
+
+install: $(LIBNAME)
+ $(INSTALL) -d $(DRI_DRIVER_INSTALL_DIR)
+ $(INSTALL) -m 755 $(LIBNAME) $(DRI_DRIVER_INSTALL_DIR)
+
+
+include depend
diff --git a/src/mesa/drivers/dri/intel_winsys/Makefile b/src/gallium/winsys/dri/intel/Makefile
index 9ae0f013256..40654bb2ac3 100644
--- a/src/mesa/drivers/dri/intel_winsys/Makefile
+++ b/src/gallium/winsys/dri/intel/Makefile
@@ -7,8 +7,8 @@ LIBNAME = i915tex_dri.so
MINIGLX_SOURCES = server/intel_dri.c
PIPE_DRIVERS = \
- $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a \
- $(TOP)/src/mesa/pipe/i915simple/libi915simple.a
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/drivers/i915simple/libi915simple.a
DRIVER_SOURCES = \
intel_winsys_pipe.c \
@@ -28,11 +28,11 @@ C_SOURCES = \
ASM_SOURCES =
-DRIVER_DEFINES = -I../intel $(shell pkg-config libdrm --atleast-version=2.3.1 \
+DRIVER_DEFINES = -I$(TOP)/src/mesa/drivers/dri/intel $(shell pkg-config libdrm --atleast-version=2.3.1 \
&& echo "-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP")
include ../Makefile.template
-intel_tex_layout.o: ../intel/intel_tex_layout.c
+intel_tex_layout.o: $(TOP)/src/mesa/drivers/dri/intel/intel_tex_layout.c
symlinks:
diff --git a/src/mesa/drivers/dri/intel_winsys/SConscript b/src/gallium/winsys/dri/intel/SConscript
index a7cc10450e3..a7cc10450e3 100644
--- a/src/mesa/drivers/dri/intel_winsys/SConscript
+++ b/src/gallium/winsys/dri/intel/SConscript
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c b/src/gallium/winsys/dri/intel/intel_batchbuffer.c
index 49e04d81ec1..49e04d81ec1 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c
+++ b/src/gallium/winsys/dri/intel/intel_batchbuffer.c
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h b/src/gallium/winsys/dri/intel/intel_batchbuffer.h
index 82feafa21f6..82feafa21f6 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h
+++ b/src/gallium/winsys/dri/intel/intel_batchbuffer.h
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchpool.c b/src/gallium/winsys/dri/intel/intel_batchpool.c
index 33b56817f6a..33b56817f6a 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_batchpool.c
+++ b/src/gallium/winsys/dri/intel/intel_batchpool.c
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchpool.h b/src/gallium/winsys/dri/intel/intel_batchpool.h
index f6a95723bcf..f6a95723bcf 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_batchpool.h
+++ b/src/gallium/winsys/dri/intel/intel_batchpool.h
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.c b/src/gallium/winsys/dri/intel/intel_context.c
index c033f2a592c..c033f2a592c 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_context.c
+++ b/src/gallium/winsys/dri/intel/intel_context.c
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.h b/src/gallium/winsys/dri/intel/intel_context.h
index b01370c049c..b01370c049c 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_context.h
+++ b/src/gallium/winsys/dri/intel/intel_context.h
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_lock.c b/src/gallium/winsys/dri/intel/intel_lock.c
index 70aa7ea5f46..70aa7ea5f46 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_lock.c
+++ b/src/gallium/winsys/dri/intel/intel_lock.c
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_reg.h b/src/gallium/winsys/dri/intel/intel_reg.h
index f37c24fda9a..f37c24fda9a 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_reg.h
+++ b/src/gallium/winsys/dri/intel/intel_reg.h
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_screen.c b/src/gallium/winsys/dri/intel/intel_screen.c
index 9e31c013a95..9e31c013a95 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_screen.c
+++ b/src/gallium/winsys/dri/intel/intel_screen.c
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_screen.h b/src/gallium/winsys/dri/intel/intel_screen.h
index 3396f9e5643..3396f9e5643 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_screen.h
+++ b/src/gallium/winsys/dri/intel/intel_screen.h
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c b/src/gallium/winsys/dri/intel/intel_swapbuffers.c
index 454cd71f6c0..56b86d6a636 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c
+++ b/src/gallium/winsys/dri/intel/intel_swapbuffers.c
@@ -220,6 +220,7 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
if (back_surf) {
st_notify_swapbuffers(intel_fb->stfb);
intelDisplaySurface(dPriv, back_surf, NULL);
+ st_notify_swapbuffers_complete(intel_fb->stfb);
}
}
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.h b/src/gallium/winsys/dri/intel/intel_swapbuffers.h
index 7ae5fd15a5f..7ae5fd15a5f 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.h
+++ b/src/gallium/winsys/dri/intel/intel_swapbuffers.h
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys.h b/src/gallium/winsys/dri/intel/intel_winsys.h
index ffc40782be7..ffc40782be7 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_winsys.h
+++ b/src/gallium/winsys/dri/intel/intel_winsys.h
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c b/src/gallium/winsys/dri/intel/intel_winsys_i915.c
index 1ba6a9e1b25..0ed3890e936 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c
+++ b/src/gallium/winsys/dri/intel/intel_winsys_i915.c
@@ -39,7 +39,7 @@
#include "intel_winsys.h"
#include "pipe/p_util.h"
-#include "pipe/i915simple/i915_winsys.h"
+#include "i915simple/i915_winsys.h"
struct intel_i915_winsys {
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c b/src/gallium/winsys/dri/intel/intel_winsys_pipe.c
index 789a386500a..789a386500a 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c
+++ b/src/gallium/winsys/dri/intel/intel_winsys_pipe.c
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_softpipe.c b/src/gallium/winsys/dri/intel/intel_winsys_softpipe.c
index cec3437831c..9e483bdc9f5 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_winsys_softpipe.c
+++ b/src/gallium/winsys/dri/intel/intel_winsys_softpipe.c
@@ -34,7 +34,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
#include "pipe/p_format.h"
-#include "pipe/softpipe/sp_winsys.h"
+#include "softpipe/sp_winsys.h"
struct intel_softpipe_winsys {
diff --git a/src/mesa/drivers/dri/intel_winsys/server/i830_common.h b/src/gallium/winsys/dri/intel/server/i830_common.h
index d4d58886ce0..d4d58886ce0 100644
--- a/src/mesa/drivers/dri/intel_winsys/server/i830_common.h
+++ b/src/gallium/winsys/dri/intel/server/i830_common.h
diff --git a/src/mesa/drivers/dri/intel_winsys/server/i830_dri.h b/src/gallium/winsys/dri/intel/server/i830_dri.h
index c2a3af8cbf7..c2a3af8cbf7 100644
--- a/src/mesa/drivers/dri/intel_winsys/server/i830_dri.h
+++ b/src/gallium/winsys/dri/intel/server/i830_dri.h
diff --git a/src/mesa/drivers/dri/intel_winsys/server/intel.h b/src/gallium/winsys/dri/intel/server/intel.h
index 6ea72499c1c..6ea72499c1c 100644
--- a/src/mesa/drivers/dri/intel_winsys/server/intel.h
+++ b/src/gallium/winsys/dri/intel/server/intel.h
diff --git a/src/mesa/drivers/dri/intel_winsys/server/intel_dri.c b/src/gallium/winsys/dri/intel/server/intel_dri.c
index e49c4214ad4..e49c4214ad4 100644
--- a/src/mesa/drivers/dri/intel_winsys/server/intel_dri.c
+++ b/src/gallium/winsys/dri/intel/server/intel_dri.c
diff --git a/src/mesa/pipe/xlib/brw_aub.c b/src/gallium/winsys/xlib/brw_aub.c
index 541d50c6e40..541d50c6e40 100644
--- a/src/mesa/pipe/xlib/brw_aub.c
+++ b/src/gallium/winsys/xlib/brw_aub.c
diff --git a/src/mesa/pipe/xlib/brw_aub.h b/src/gallium/winsys/xlib/brw_aub.h
index f5c60c7be28..f5c60c7be28 100644
--- a/src/mesa/pipe/xlib/brw_aub.h
+++ b/src/gallium/winsys/xlib/brw_aub.h
diff --git a/src/mesa/pipe/xlib/fakeglx.c b/src/gallium/winsys/xlib/fakeglx.c
index 902a7550754..902a7550754 100644
--- a/src/mesa/pipe/xlib/fakeglx.c
+++ b/src/gallium/winsys/xlib/fakeglx.c
diff --git a/src/mesa/pipe/xlib/glxapi.c b/src/gallium/winsys/xlib/glxapi.c
index c2ccce6f520..c2ccce6f520 100644
--- a/src/mesa/pipe/xlib/glxapi.c
+++ b/src/gallium/winsys/xlib/glxapi.c
diff --git a/src/mesa/pipe/xlib/glxapi.h b/src/gallium/winsys/xlib/glxapi.h
index 37de81e55ac..37de81e55ac 100644
--- a/src/mesa/pipe/xlib/glxapi.h
+++ b/src/gallium/winsys/xlib/glxapi.h
diff --git a/src/mesa/pipe/xlib/glxheader.h b/src/gallium/winsys/xlib/glxheader.h
index a402191f131..a402191f131 100644
--- a/src/mesa/pipe/xlib/glxheader.h
+++ b/src/gallium/winsys/xlib/glxheader.h
diff --git a/src/mesa/pipe/xlib/realglx.c b/src/gallium/winsys/xlib/realglx.c
index 30adb7465ba..30adb7465ba 100644
--- a/src/mesa/pipe/xlib/realglx.c
+++ b/src/gallium/winsys/xlib/realglx.c
diff --git a/src/mesa/pipe/xlib/realglx.h b/src/gallium/winsys/xlib/realglx.h
index 150129db681..150129db681 100644
--- a/src/mesa/pipe/xlib/realglx.h
+++ b/src/gallium/winsys/xlib/realglx.h
diff --git a/src/mesa/pipe/xlib/xfonts.c b/src/gallium/winsys/xlib/xfonts.c
index d72c600bd1b..d72c600bd1b 100644
--- a/src/mesa/pipe/xlib/xfonts.c
+++ b/src/gallium/winsys/xlib/xfonts.c
diff --git a/src/mesa/pipe/xlib/xfonts.h b/src/gallium/winsys/xlib/xfonts.h
index e36f42f817a..e36f42f817a 100644
--- a/src/mesa/pipe/xlib/xfonts.h
+++ b/src/gallium/winsys/xlib/xfonts.h
diff --git a/src/mesa/pipe/xlib/xm_api.c b/src/gallium/winsys/xlib/xm_api.c
index 03985eab5a6..e5fef1d7a81 100644
--- a/src/mesa/pipe/xlib/xm_api.c
+++ b/src/gallium/winsys/xlib/xm_api.c
@@ -1229,6 +1229,7 @@ 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);
diff --git a/src/mesa/pipe/xlib/xm_image.c b/src/gallium/winsys/xlib/xm_image.c
index 087b4e4c3a7..087b4e4c3a7 100644
--- a/src/mesa/pipe/xlib/xm_image.c
+++ b/src/gallium/winsys/xlib/xm_image.c
diff --git a/src/mesa/pipe/xlib/xm_image.h b/src/gallium/winsys/xlib/xm_image.h
index 2a5e0f37779..2a5e0f37779 100644
--- a/src/mesa/pipe/xlib/xm_image.h
+++ b/src/gallium/winsys/xlib/xm_image.h
diff --git a/src/mesa/pipe/xlib/xm_winsys.c b/src/gallium/winsys/xlib/xm_winsys.c
index c3cd22eea3f..8da596d419e 100644
--- a/src/mesa/pipe/xlib/xm_winsys.c
+++ b/src/gallium/winsys/xlib/xm_winsys.c
@@ -41,11 +41,11 @@
#include "pipe/p_context.h"
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
-#include "pipe/softpipe/sp_winsys.h"
+#include "softpipe/sp_winsys.h"
#ifdef GALLIUM_CELL
-#include "pipe/cell/ppu/cell_context.h"
-#include "pipe/cell/ppu/cell_winsys.h"
+#include "cell/ppu/cell_context.h"
+#include "cell/ppu/cell_winsys.h"
#else
#define TILE_SIZE 32 /* avoid compilation errors */
#endif
diff --git a/src/mesa/pipe/xlib/xm_winsys_aub.c b/src/gallium/winsys/xlib/xm_winsys_aub.c
index bf415702570..dbfd37bda29 100644
--- a/src/mesa/pipe/xlib/xm_winsys_aub.c
+++ b/src/gallium/winsys/xlib/xm_winsys_aub.c
@@ -39,7 +39,7 @@
#include "pipe/p_winsys.h"
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
-#include "pipe/i965simple/brw_winsys.h"
+#include "i965simple/brw_winsys.h"
#include "brw_aub.h"
#include "xm_winsys_aub.h"
diff --git a/src/mesa/pipe/xlib/xm_winsys_aub.h b/src/gallium/winsys/xlib/xm_winsys_aub.h
index 7bee1991169..7bee1991169 100644
--- a/src/mesa/pipe/xlib/xm_winsys_aub.h
+++ b/src/gallium/winsys/xlib/xm_winsys_aub.h
diff --git a/src/mesa/pipe/xlib/xmesaP.h b/src/gallium/winsys/xlib/xmesaP.h
index fa8d1f14b95..fa8d1f14b95 100644
--- a/src/mesa/pipe/xlib/xmesaP.h
+++ b/src/gallium/winsys/xlib/xmesaP.h
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index 720f1b2e026..c8cb2b592fe 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -12,16 +12,16 @@ GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
PIPE_LIB = \
- $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a \
- $(TOP)/src/mesa/pipe/i965simple/libi965simple.a
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/drivers/i965simple/libi965simple.a
ifeq ($(CONFIG_NAME), linux-cell)
-CELL_LIB = $(TOP)/src/mesa/pipe/cell/ppu/libcell.a
-CELL_LIB_SPU = $(TOP)/src/mesa/pipe/cell/spu/g3d_spu.a
+CELL_LIB = $(TOP)/src/gallium/drivers/cell/ppu/libcell.a
+CELL_LIB_SPU = $(TOP)/src/gallium/drivers/cell/spu/g3d_spu.a
endif
ifeq ($(CONFIG_NAME), linux-llvm)
-LLVM_LIB = $(TOP)/src/mesa/pipe/llvm/libgallivm.a
+LLVM_LIB = $(TOP)/src/gallium/auxiliary/llvm/libgallivm.a
endif
.SUFFIXES : .cpp
@@ -71,7 +71,7 @@ libmesa.a: $(SOLO_OBJECTS)
fi
linux-solo: depend subdirs libmesa.a
- cd drivers/dri ; $(MAKE)
+ cd $(TOP)/src/gallium/winsys/dri ; $(MAKE)
#####################################################################
@@ -165,7 +165,6 @@ depend: $(ALL_SOURCES)
subdirs:
@ (cd x86 ; $(MAKE))
@ (cd x86-64 ; $(MAKE))
- (cd pipe ; $(MAKE))
install: default
$(INSTALL) -d $(INSTALL_DIR)/include/GL
@@ -178,7 +177,7 @@ install: default
$(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* $(INSTALL_DIR)/$(LIB_DIR); \
fi
@if [ "${DRIVER_DIRS}" = "dri" ] ; then \
- cd drivers/dri ; $(MAKE) install ; \
+ cd $(TOP)/gallium/winsys/dri ; $(MAKE) install ; \
fi
## NOT INSTALLED YET:
@@ -198,7 +197,6 @@ clean:
(cd drivers/dri && $(MAKE) clean)
(cd x86 && $(MAKE) clean)
(cd x86-64 && $(MAKE) clean)
- (cd pipe ; $(MAKE) clean )
include depend
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 08c98eab486..18b033666f0 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -85,7 +85,7 @@
#include "state_tracker/st_public.h"
#include "state_tracker/st_context.h"
-#include "pipe/softpipe/sp_context.h"
+#include "softpipe/sp_context.h"
#include "pipe/p_defines.h"
/**
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index 8ae243ae662..34287effe1c 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -53,7 +53,7 @@
#include "tnl/tnl.h"
#include "tnl/t_context.h"
-#include "pipe/softpipe/sp_context.h"
+#include "softpipe/sp_context.h"
#include "state_tracker/st_public.h"
#include "state_tracker/st_context.h"
#include "state_tracker/st_draw.h"
diff --git a/src/mesa/drivers/x11/xm_surface.c b/src/mesa/drivers/x11/xm_surface.c
index 5533158ece0..81616b92d96 100644
--- a/src/mesa/drivers/x11/xm_surface.c
+++ b/src/mesa/drivers/x11/xm_surface.c
@@ -45,10 +45,10 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
-#include "pipe/softpipe/sp_context.h"
-#include "pipe/softpipe/sp_clear.h"
-#include "pipe/softpipe/sp_tile_cache.h"
-#include "pipe/softpipe/sp_surface.h"
+#include "softpipe/sp_context.h"
+#include "softpipe/sp_clear.h"
+#include "softpipe/sp_tile_cache.h"
+#include "softpipe/sp_surface.h"
#include "state_tracker/st_context.h"
diff --git a/src/mesa/drivers/x11/xm_winsys.c b/src/mesa/drivers/x11/xm_winsys.c
index a690df27727..2edc6976933 100644
--- a/src/mesa/drivers/x11/xm_winsys.c
+++ b/src/mesa/drivers/x11/xm_winsys.c
@@ -38,7 +38,7 @@
#include "main/macros.h"
#include "pipe/p_winsys.h"
-#include "pipe/softpipe/sp_winsys.h"
+#include "softpipe/sp_winsys.h"
/**
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index 4709d633942..fd2dfcd79aa 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -37,8 +37,8 @@
#include "xm_image.h"
#endif
#include "state_tracker/st_cb_fbo.h"
-#include "pipe/softpipe/sp_context.h"
-#include "pipe/softpipe/sp_surface.h"
+#include "softpipe/sp_context.h"
+#include "softpipe/sp_surface.h"
extern _glthread_Mutex _xmesa_lock;
diff --git a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c b/src/mesa/pipe/cell/spu/spu_vertex_fetch.c
deleted file mode 100644
index 6e86a919ce4..00000000000
--- a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c
+++ /dev/null
@@ -1,393 +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 <[email protected]>
- */
-
-#include <spu_mfcio.h>
-#include <transpose_matrix4x4.h>
-
-#include "pipe/p_util.h"
-#include "pipe/p_state.h"
-#include "pipe/p_shader_tokens.h"
-#include "spu_exec.h"
-#include "spu_vertex_shader.h"
-#include "spu_main.h"
-
-
-#define DRAW_DBG 0
-
-
-static const vec_float4 defaults = { 0.0, 0.0, 0.0, 1.0 };
-
-/**
- * Fetch a float[4] vertex attribute from memory, doing format/type
- * conversion as needed.
- *
- * This is probably needed/dupliocated elsewhere, eg format
- * conversion, texture sampling etc.
- */
-#define FETCH_ATTRIB( NAME, SZ, CVT ) \
-static qword \
-fetch_##NAME(const void *ptr) \
-{ \
- vec_float4 attrib = defaults; \
- int i; \
- \
- for (i = 0; i < SZ; i++) { \
- attrib = spu_insert(CVT, attrib, i); \
- } \
- return (qword) attrib; \
-}
-
-#define CVT_64_FLOAT (float) ((double *) ptr)[i]
-#define CVT_32_FLOAT ((float *) ptr)[i]
-
-#define CVT_8_USCALED (float) ((unsigned char *) ptr)[i]
-#define CVT_16_USCALED (float) ((unsigned short *) ptr)[i]
-#define CVT_32_USCALED (float) ((unsigned int *) ptr)[i]
-
-#define CVT_8_SSCALED (float) ((char *) ptr)[i]
-#define CVT_16_SSCALED (float) ((short *) ptr)[i]
-#define CVT_32_SSCALED (float) ((int *) ptr)[i]
-
-#define CVT_8_UNORM (float) ((unsigned char *) ptr)[i] / 255.0f
-#define CVT_16_UNORM (float) ((unsigned short *) ptr)[i] / 65535.0f
-#define CVT_32_UNORM (float) ((unsigned int *) ptr)[i] / 4294967295.0f
-
-#define CVT_8_SNORM (float) ((char *) ptr)[i] / 127.0f
-#define CVT_16_SNORM (float) ((short *) ptr)[i] / 32767.0f
-#define CVT_32_SNORM (float) ((int *) ptr)[i] / 2147483647.0f
-
-FETCH_ATTRIB( R64G64B64A64_FLOAT, 4, CVT_64_FLOAT )
-FETCH_ATTRIB( R64G64B64_FLOAT, 3, CVT_64_FLOAT )
-FETCH_ATTRIB( R64G64_FLOAT, 2, CVT_64_FLOAT )
-FETCH_ATTRIB( R64_FLOAT, 1, CVT_64_FLOAT )
-
-FETCH_ATTRIB( R32G32B32A32_FLOAT, 4, CVT_32_FLOAT )
-FETCH_ATTRIB( R32G32B32_FLOAT, 3, CVT_32_FLOAT )
-FETCH_ATTRIB( R32G32_FLOAT, 2, CVT_32_FLOAT )
-FETCH_ATTRIB( R32_FLOAT, 1, CVT_32_FLOAT )
-
-FETCH_ATTRIB( R32G32B32A32_USCALED, 4, CVT_32_USCALED )
-FETCH_ATTRIB( R32G32B32_USCALED, 3, CVT_32_USCALED )
-FETCH_ATTRIB( R32G32_USCALED, 2, CVT_32_USCALED )
-FETCH_ATTRIB( R32_USCALED, 1, CVT_32_USCALED )
-
-FETCH_ATTRIB( R32G32B32A32_SSCALED, 4, CVT_32_SSCALED )
-FETCH_ATTRIB( R32G32B32_SSCALED, 3, CVT_32_SSCALED )
-FETCH_ATTRIB( R32G32_SSCALED, 2, CVT_32_SSCALED )
-FETCH_ATTRIB( R32_SSCALED, 1, CVT_32_SSCALED )
-
-FETCH_ATTRIB( R32G32B32A32_UNORM, 4, CVT_32_UNORM )
-FETCH_ATTRIB( R32G32B32_UNORM, 3, CVT_32_UNORM )
-FETCH_ATTRIB( R32G32_UNORM, 2, CVT_32_UNORM )
-FETCH_ATTRIB( R32_UNORM, 1, CVT_32_UNORM )
-
-FETCH_ATTRIB( R32G32B32A32_SNORM, 4, CVT_32_SNORM )
-FETCH_ATTRIB( R32G32B32_SNORM, 3, CVT_32_SNORM )
-FETCH_ATTRIB( R32G32_SNORM, 2, CVT_32_SNORM )
-FETCH_ATTRIB( R32_SNORM, 1, CVT_32_SNORM )
-
-FETCH_ATTRIB( R16G16B16A16_USCALED, 4, CVT_16_USCALED )
-FETCH_ATTRIB( R16G16B16_USCALED, 3, CVT_16_USCALED )
-FETCH_ATTRIB( R16G16_USCALED, 2, CVT_16_USCALED )
-FETCH_ATTRIB( R16_USCALED, 1, CVT_16_USCALED )
-
-FETCH_ATTRIB( R16G16B16A16_SSCALED, 4, CVT_16_SSCALED )
-FETCH_ATTRIB( R16G16B16_SSCALED, 3, CVT_16_SSCALED )
-FETCH_ATTRIB( R16G16_SSCALED, 2, CVT_16_SSCALED )
-FETCH_ATTRIB( R16_SSCALED, 1, CVT_16_SSCALED )
-
-FETCH_ATTRIB( R16G16B16A16_UNORM, 4, CVT_16_UNORM )
-FETCH_ATTRIB( R16G16B16_UNORM, 3, CVT_16_UNORM )
-FETCH_ATTRIB( R16G16_UNORM, 2, CVT_16_UNORM )
-FETCH_ATTRIB( R16_UNORM, 1, CVT_16_UNORM )
-
-FETCH_ATTRIB( R16G16B16A16_SNORM, 4, CVT_16_SNORM )
-FETCH_ATTRIB( R16G16B16_SNORM, 3, CVT_16_SNORM )
-FETCH_ATTRIB( R16G16_SNORM, 2, CVT_16_SNORM )
-FETCH_ATTRIB( R16_SNORM, 1, CVT_16_SNORM )
-
-FETCH_ATTRIB( R8G8B8A8_USCALED, 4, CVT_8_USCALED )
-FETCH_ATTRIB( R8G8B8_USCALED, 3, CVT_8_USCALED )
-FETCH_ATTRIB( R8G8_USCALED, 2, CVT_8_USCALED )
-FETCH_ATTRIB( R8_USCALED, 1, CVT_8_USCALED )
-
-FETCH_ATTRIB( R8G8B8A8_SSCALED, 4, CVT_8_SSCALED )
-FETCH_ATTRIB( R8G8B8_SSCALED, 3, CVT_8_SSCALED )
-FETCH_ATTRIB( R8G8_SSCALED, 2, CVT_8_SSCALED )
-FETCH_ATTRIB( R8_SSCALED, 1, CVT_8_SSCALED )
-
-FETCH_ATTRIB( R8G8B8A8_UNORM, 4, CVT_8_UNORM )
-FETCH_ATTRIB( R8G8B8_UNORM, 3, CVT_8_UNORM )
-FETCH_ATTRIB( R8G8_UNORM, 2, CVT_8_UNORM )
-FETCH_ATTRIB( R8_UNORM, 1, CVT_8_UNORM )
-
-FETCH_ATTRIB( R8G8B8A8_SNORM, 4, CVT_8_SNORM )
-FETCH_ATTRIB( R8G8B8_SNORM, 3, CVT_8_SNORM )
-FETCH_ATTRIB( R8G8_SNORM, 2, CVT_8_SNORM )
-FETCH_ATTRIB( R8_SNORM, 1, CVT_8_SNORM )
-
-FETCH_ATTRIB( A8R8G8B8_UNORM, 4, CVT_8_UNORM )
-//FETCH_ATTRIB( R8G8B8A8_UNORM, 4, CVT_8_UNORM )
-
-
-
-static spu_fetch_func get_fetch_func( enum pipe_format format )
-{
-#if 0
- {
- char tmp[80];
- pf_sprint_name(tmp, format);
- _mesa_printf("%s: %s\n", __FUNCTION__, tmp);
- }
-#endif
-
- switch (format) {
- case PIPE_FORMAT_R64_FLOAT:
- return fetch_R64_FLOAT;
- case PIPE_FORMAT_R64G64_FLOAT:
- return fetch_R64G64_FLOAT;
- case PIPE_FORMAT_R64G64B64_FLOAT:
- return fetch_R64G64B64_FLOAT;
- case PIPE_FORMAT_R64G64B64A64_FLOAT:
- return fetch_R64G64B64A64_FLOAT;
-
- case PIPE_FORMAT_R32_FLOAT:
- return fetch_R32_FLOAT;
- case PIPE_FORMAT_R32G32_FLOAT:
- return fetch_R32G32_FLOAT;
- case PIPE_FORMAT_R32G32B32_FLOAT:
- return fetch_R32G32B32_FLOAT;
- case PIPE_FORMAT_R32G32B32A32_FLOAT:
- return fetch_R32G32B32A32_FLOAT;
-
- case PIPE_FORMAT_R32_UNORM:
- return fetch_R32_UNORM;
- case PIPE_FORMAT_R32G32_UNORM:
- return fetch_R32G32_UNORM;
- case PIPE_FORMAT_R32G32B32_UNORM:
- return fetch_R32G32B32_UNORM;
- case PIPE_FORMAT_R32G32B32A32_UNORM:
- return fetch_R32G32B32A32_UNORM;
-
- case PIPE_FORMAT_R32_USCALED:
- return fetch_R32_USCALED;
- case PIPE_FORMAT_R32G32_USCALED:
- return fetch_R32G32_USCALED;
- case PIPE_FORMAT_R32G32B32_USCALED:
- return fetch_R32G32B32_USCALED;
- case PIPE_FORMAT_R32G32B32A32_USCALED:
- return fetch_R32G32B32A32_USCALED;
-
- case PIPE_FORMAT_R32_SNORM:
- return fetch_R32_SNORM;
- case PIPE_FORMAT_R32G32_SNORM:
- return fetch_R32G32_SNORM;
- case PIPE_FORMAT_R32G32B32_SNORM:
- return fetch_R32G32B32_SNORM;
- case PIPE_FORMAT_R32G32B32A32_SNORM:
- return fetch_R32G32B32A32_SNORM;
-
- case PIPE_FORMAT_R32_SSCALED:
- return fetch_R32_SSCALED;
- case PIPE_FORMAT_R32G32_SSCALED:
- return fetch_R32G32_SSCALED;
- case PIPE_FORMAT_R32G32B32_SSCALED:
- return fetch_R32G32B32_SSCALED;
- case PIPE_FORMAT_R32G32B32A32_SSCALED:
- return fetch_R32G32B32A32_SSCALED;
-
- case PIPE_FORMAT_R16_UNORM:
- return fetch_R16_UNORM;
- case PIPE_FORMAT_R16G16_UNORM:
- return fetch_R16G16_UNORM;
- case PIPE_FORMAT_R16G16B16_UNORM:
- return fetch_R16G16B16_UNORM;
- case PIPE_FORMAT_R16G16B16A16_UNORM:
- return fetch_R16G16B16A16_UNORM;
-
- case PIPE_FORMAT_R16_USCALED:
- return fetch_R16_USCALED;
- case PIPE_FORMAT_R16G16_USCALED:
- return fetch_R16G16_USCALED;
- case PIPE_FORMAT_R16G16B16_USCALED:
- return fetch_R16G16B16_USCALED;
- case PIPE_FORMAT_R16G16B16A16_USCALED:
- return fetch_R16G16B16A16_USCALED;
-
- case PIPE_FORMAT_R16_SNORM:
- return fetch_R16_SNORM;
- case PIPE_FORMAT_R16G16_SNORM:
- return fetch_R16G16_SNORM;
- case PIPE_FORMAT_R16G16B16_SNORM:
- return fetch_R16G16B16_SNORM;
- case PIPE_FORMAT_R16G16B16A16_SNORM:
- return fetch_R16G16B16A16_SNORM;
-
- case PIPE_FORMAT_R16_SSCALED:
- return fetch_R16_SSCALED;
- case PIPE_FORMAT_R16G16_SSCALED:
- return fetch_R16G16_SSCALED;
- case PIPE_FORMAT_R16G16B16_SSCALED:
- return fetch_R16G16B16_SSCALED;
- case PIPE_FORMAT_R16G16B16A16_SSCALED:
- return fetch_R16G16B16A16_SSCALED;
-
- case PIPE_FORMAT_R8_UNORM:
- return fetch_R8_UNORM;
- case PIPE_FORMAT_R8G8_UNORM:
- return fetch_R8G8_UNORM;
- case PIPE_FORMAT_R8G8B8_UNORM:
- return fetch_R8G8B8_UNORM;
- case PIPE_FORMAT_R8G8B8A8_UNORM:
- return fetch_R8G8B8A8_UNORM;
-
- case PIPE_FORMAT_R8_USCALED:
- return fetch_R8_USCALED;
- case PIPE_FORMAT_R8G8_USCALED:
- return fetch_R8G8_USCALED;
- case PIPE_FORMAT_R8G8B8_USCALED:
- return fetch_R8G8B8_USCALED;
- case PIPE_FORMAT_R8G8B8A8_USCALED:
- return fetch_R8G8B8A8_USCALED;
-
- case PIPE_FORMAT_R8_SNORM:
- return fetch_R8_SNORM;
- case PIPE_FORMAT_R8G8_SNORM:
- return fetch_R8G8_SNORM;
- case PIPE_FORMAT_R8G8B8_SNORM:
- return fetch_R8G8B8_SNORM;
- case PIPE_FORMAT_R8G8B8A8_SNORM:
- return fetch_R8G8B8A8_SNORM;
-
- case PIPE_FORMAT_R8_SSCALED:
- return fetch_R8_SSCALED;
- case PIPE_FORMAT_R8G8_SSCALED:
- return fetch_R8G8_SSCALED;
- case PIPE_FORMAT_R8G8B8_SSCALED:
- return fetch_R8G8B8_SSCALED;
- case PIPE_FORMAT_R8G8B8A8_SSCALED:
- return fetch_R8G8B8A8_SSCALED;
-
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- return fetch_A8R8G8B8_UNORM;
-
- case 0:
- return NULL; /* not sure why this is needed */
-
- default:
- assert(0);
- return NULL;
- }
-}
-
-
-/**
- * Fetch vertex attributes for 'count' vertices.
- */
-static void generic_vertex_fetch(struct spu_vs_context *draw,
- struct spu_exec_machine *machine,
- const unsigned *elts,
- unsigned count)
-{
- unsigned nr_attrs = draw->vertex_fetch.nr_attrs;
- unsigned attr;
-
- assert(count <= 4);
-
- wait_on_mask(1 << TAG_VERTEX_BUFFER);
-
-#if DRAW_DBG
- printf("SPU: %s count = %u, nr_attrs = %u\n",
- __FUNCTION__, count, nr_attrs);
-#endif
-
- /* loop over vertex attributes (vertex shader inputs)
- */
- for (attr = 0; attr < nr_attrs; attr++) {
- const unsigned pitch = draw->vertex_fetch.pitch[attr];
- const uint64_t src = draw->vertex_fetch.src_ptr[attr];
- const spu_fetch_func fetch = draw->vertex_fetch.fetch[attr];
- unsigned i;
- qword p[4];
-
-
- /* Fetch four attributes for four vertices.
- *
- * Could fetch directly into AOS format, but this is meant to be
- * a prototype for an sse implementation, which would have
- * difficulties doing that.
- */
- for (i = 0; i < count; i++) {
- uint8_t buffer[32] ALIGN16_ATTRIB;
- const uint64_t addr = src + (elts[i] * pitch);
- const unsigned size = ((addr & 0x0f) == 0) ? 16 : 32;
-
-#if DRAW_DBG
- printf("SPU: fetching = 0x%llx\n", addr);
-#endif
- mfc_get(buffer, addr & ~0x0f, size, TAG_VERTEX_BUFFER, 0, 0);
- wait_on_mask(1 << TAG_VERTEX_BUFFER);
-
- p[i] = (*fetch)(buffer + (addr & 0x0f));
- }
-
- /* Be nice and zero out any missing vertices:
- */
- for (/* empty */; i < 4; i++)
- p[i] = si_xor(p[i], p[i]);
-
- /* Transpose/swizzle into vector-friendly format. Currently
- * assuming that all vertex shader inputs are float[4], but this
- * isn't true -- if the vertex shader only wants tex0.xy, we
- * could optimize for that.
- *
- * To do so fully without codegen would probably require an
- * excessive number of fetch functions, but we could at least
- * minimize the transpose step:
- */
- _transpose_matrix4x4(&machine->Inputs[attr].xyzw[0].q, p);
- }
-}
-
-
-void spu_update_vertex_fetch( struct spu_vs_context *draw )
-{
- unsigned i;
-
-
- for (i = 0; i < draw->vertex_fetch.nr_attrs; i++) {
- draw->vertex_fetch.fetch[i] =
- get_fetch_func(draw->vertex_fetch.format[i]);
- }
-
- draw->vertex_fetch.fetch_func = generic_vertex_fetch;
-}
diff --git a/src/mesa/pipe/draw/Makefile b/src/mesa/pipe/draw/Makefile
deleted file mode 100644
index 451911a3545..00000000000
--- a/src/mesa/pipe/draw/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-default:
- cd .. ; make
diff --git a/src/mesa/pipe/llvm/gallivm_p.h b/src/mesa/pipe/llvm/gallivm_p.h
deleted file mode 100644
index 2c6e5e8f5f2..00000000000
--- a/src/mesa/pipe/llvm/gallivm_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef GALLIVM_P_H
-#define GALLIVM_P_H
-
-#ifdef MESA_LLVM
-
-namespace llvm {
- class Module;
-}
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-enum gallivm_shader_type;
-enum gallivm_vector_layout;
-
-struct gallivm_interpolate {
- int attrib;
- int chan;
- int type;
-};
-
-struct gallivm_ir {
- llvm::Module *module;
- int id;
- enum gallivm_shader_type type;
- enum gallivm_vector_layout layout;
- int num_components;
- int num_consts;
-
- //FIXME: this might not be enough for some shaders
- struct gallivm_interpolate interpolators[32*4];
- int num_interp;
-};
-
-struct gallivm_prog {
- llvm::Module *module;
- void *function;
-
- int id;
- enum gallivm_shader_type type;
-
- int num_consts;
-
- //FIXME: this might not be enough for some shaders
- struct gallivm_interpolate interpolators[32*4];
- int num_interp;
-};
-
-#endif /* MESA_LLVM */
-
-#if defined __cplusplus
-} // extern "C"
-#endif
-
-#endif
diff --git a/src/mesa/pipe/llvm/instructionssoa.cpp b/src/mesa/pipe/llvm/instructionssoa.cpp
deleted file mode 100644
index 9ac4d8fbc73..00000000000
--- a/src/mesa/pipe/llvm/instructionssoa.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "instructionssoa.h"
-
-InstructionsSoa::InstructionsSoa(llvm::Module *mod, llvm::Function *func,
- llvm::BasicBlock *block, StorageSoa *storage)
-{
-}
-
-std::vector<llvm::Value*> InstructionsSoa::add(const std::vector<llvm::Value*> in1,
- const std::vector<llvm::Value*> in2)
-{
- std::vector<llvm::Value*> res(4);
-
- return res;
-}
-
-std::vector<llvm::Value*> InstructionsSoa::mul(const std::vector<llvm::Value*> in1,
- const std::vector<llvm::Value*> in2)
-{
- std::vector<llvm::Value*> res(4);
-
- return res;
-}
-
-void InstructionsSoa::end()
-{
-}
diff --git a/src/mesa/pipe/llvm/llvm_base_shader.cpp b/src/mesa/pipe/llvm/llvm_base_shader.cpp
deleted file mode 100644
index 90a25a440ab..00000000000
--- a/src/mesa/pipe/llvm/llvm_base_shader.cpp
+++ /dev/null
@@ -1,833 +0,0 @@
-// Generated by llvm2cpp - DO NOT MODIFY!
-
-
-Module* createBaseShader() {
- // Module Construction
- Module* mod = new Module("Shader");
- mod->setDataLayout("e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128");
- mod->setTargetTriple("i686-pc-linux-gnu");
-
- // Type Definitions
- std::vector<const Type*>StructTy_struct_ShaderInput_fields;
- VectorType* VectorTy_1 = VectorType::get(Type::FloatTy, 4);
-
- PointerType* PointerTy_0 = PointerType::get(VectorTy_1, 0);
-
- StructTy_struct_ShaderInput_fields.push_back(PointerTy_0);
- StructTy_struct_ShaderInput_fields.push_back(PointerTy_0);
- StructTy_struct_ShaderInput_fields.push_back(PointerTy_0);
- StructTy_struct_ShaderInput_fields.push_back(PointerTy_0);
- StructTy_struct_ShaderInput_fields.push_back(IntegerType::get(32));
- StructType* StructTy_struct_ShaderInput = StructType::get(StructTy_struct_ShaderInput_fields, /*isPacked=*/false);
- mod->addTypeName("struct.ShaderInput", StructTy_struct_ShaderInput);
-
- OpaqueType* OpaqueTy_struct_pipe_sampler_state = OpaqueType::get();
- mod->addTypeName("struct.pipe_sampler_state", OpaqueTy_struct_pipe_sampler_state);
-
- OpaqueType* OpaqueTy_struct_softpipe_tile_cache = OpaqueType::get();
- mod->addTypeName("struct.softpipe_tile_cache", OpaqueTy_struct_softpipe_tile_cache);
-
- std::vector<const Type*>StructTy_struct_tgsi_sampler_fields;
- PointerType* PointerTy_2 = PointerType::get(OpaqueTy_struct_pipe_sampler_state, 0);
-
- StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_2);
- std::vector<const Type*>FuncTy_4_args;
- PATypeHolder StructTy_struct_tgsi_sampler_fwd = OpaqueType::get();
- PointerType* PointerTy_5 = PointerType::get(StructTy_struct_tgsi_sampler_fwd, 0);
-
- FuncTy_4_args.push_back(PointerTy_5);
- PointerType* PointerTy_6 = PointerType::get(Type::FloatTy, 0);
-
- FuncTy_4_args.push_back(PointerTy_6);
- FuncTy_4_args.push_back(PointerTy_6);
- FuncTy_4_args.push_back(PointerTy_6);
- FuncTy_4_args.push_back(Type::FloatTy);
- ArrayType* ArrayTy_8 = ArrayType::get(Type::FloatTy, 4);
-
- PointerType* PointerTy_7 = PointerType::get(ArrayTy_8, 0);
-
- FuncTy_4_args.push_back(PointerTy_7);
- FunctionType* FuncTy_4 = FunctionType::get(
- /*Result=*/Type::VoidTy,
- /*Params=*/FuncTy_4_args,
- /*isVarArg=*/false);
-
- PointerType* PointerTy_3 = PointerType::get(FuncTy_4, 0);
-
- StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_3);
- PointerType* PointerTy_9 = PointerType::get(IntegerType::get(8), 0);
-
- StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_9);
- PointerType* PointerTy_10 = PointerType::get(OpaqueTy_struct_softpipe_tile_cache, 0);
-
- StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_10);
- StructType* StructTy_struct_tgsi_sampler = StructType::get(StructTy_struct_tgsi_sampler_fields, /*isPacked=*/false);
- mod->addTypeName("struct.tgsi_sampler", StructTy_struct_tgsi_sampler);
- cast<OpaqueType>(StructTy_struct_tgsi_sampler_fwd.get())->refineAbstractTypeTo(StructTy_struct_tgsi_sampler);
- StructTy_struct_tgsi_sampler = cast<StructType>(StructTy_struct_tgsi_sampler_fwd.get());
-
-
- std::vector<const Type*>FuncTy_11_args;
- ArrayType* ArrayTy_13 = ArrayType::get(VectorTy_1, 16);
-
- PointerType* PointerTy_12 = PointerType::get(ArrayTy_13, 0);
-
- FuncTy_11_args.push_back(PointerTy_12);
- ArrayType* ArrayTy_15 = ArrayType::get(ArrayTy_8, 16);
-
- PointerType* PointerTy_14 = PointerType::get(ArrayTy_15, 0);
-
- FuncTy_11_args.push_back(PointerTy_14);
- FuncTy_11_args.push_back(IntegerType::get(32));
- FuncTy_11_args.push_back(IntegerType::get(32));
- FunctionType* FuncTy_11 = FunctionType::get(
- /*Result=*/Type::VoidTy,
- /*Params=*/FuncTy_11_args,
- /*isVarArg=*/false);
-
- std::vector<const Type*>FuncTy_16_args;
- FuncTy_16_args.push_back(PointerTy_0);
- FuncTy_16_args.push_back(PointerTy_7);
- FuncTy_16_args.push_back(IntegerType::get(32));
- FunctionType* FuncTy_16 = FunctionType::get(
- /*Result=*/Type::VoidTy,
- /*Params=*/FuncTy_16_args,
- /*isVarArg=*/false);
-
- std::vector<const Type*>FuncTy_17_args;
- FuncTy_17_args.push_back(PointerTy_7);
- FuncTy_17_args.push_back(PointerTy_0);
- FuncTy_17_args.push_back(IntegerType::get(32));
- FunctionType* FuncTy_17 = FunctionType::get(
- /*Result=*/Type::VoidTy,
- /*Params=*/FuncTy_17_args,
- /*isVarArg=*/false);
-
- std::vector<const Type*>FuncTy_18_args;
- FuncTy_18_args.push_back(PointerTy_9);
- FuncTy_18_args.push_back(PointerTy_9);
- FuncTy_18_args.push_back(PointerTy_7);
- FuncTy_18_args.push_back(IntegerType::get(32));
- FuncTy_18_args.push_back(IntegerType::get(32));
- FuncTy_18_args.push_back(IntegerType::get(32));
- FuncTy_18_args.push_back(IntegerType::get(32));
- FunctionType* FuncTy_18 = FunctionType::get(
- /*Result=*/Type::VoidTy,
- /*Params=*/FuncTy_18_args,
- /*isVarArg=*/false);
-
- ArrayType* ArrayTy_20 = ArrayType::get(VectorTy_1, 32);
-
- PointerType* PointerTy_19 = PointerType::get(ArrayTy_20, 0);
-
- ArrayType* ArrayTy_22 = ArrayType::get(VectorTy_1, 128);
-
- PointerType* PointerTy_21 = PointerType::get(ArrayTy_22, 0);
-
- PointerType* PointerTy_23 = PointerType::get(StructTy_struct_ShaderInput, 0);
-
- PointerType* PointerTy_24 = PointerType::get(PointerTy_0, 0);
-
- std::vector<const Type*>FuncTy_26_args;
- FuncTy_26_args.push_back(PointerTy_23);
- FunctionType* FuncTy_26 = FunctionType::get(
- /*Result=*/Type::VoidTy,
- /*Params=*/FuncTy_26_args,
- /*isVarArg=*/false);
-
- PointerType* PointerTy_25 = PointerType::get(FuncTy_26, 0);
-
- std::vector<const Type*>FuncTy_27_args;
- FuncTy_27_args.push_back(Type::FloatTy);
- FuncTy_27_args.push_back(Type::FloatTy);
- FuncTy_27_args.push_back(PointerTy_12);
- FuncTy_27_args.push_back(PointerTy_12);
- FuncTy_27_args.push_back(IntegerType::get(32));
- FuncTy_27_args.push_back(PointerTy_7);
- FuncTy_27_args.push_back(IntegerType::get(32));
- FuncTy_27_args.push_back(PointerTy_5);
- FunctionType* FuncTy_27 = FunctionType::get(
- /*Result=*/IntegerType::get(32),
- /*Params=*/FuncTy_27_args,
- /*isVarArg=*/false);
-
- PointerType* PointerTy_28 = PointerType::get(IntegerType::get(32), 0);
-
-
- // Function Declarations
-
- Function* func_from_array = new Function(
- /*Type=*/FuncTy_11,
- /*Linkage=*/GlobalValue::ExternalLinkage,
- /*Name=*/"from_array", mod);
- func_from_array->setCallingConv(CallingConv::C);
- const ParamAttrsList *func_from_array_PAL = 0;
- {
- ParamAttrsVector Attrs;
- ParamAttrsWithIndex PAWI;
- PAWI.index = 0; PAWI.attrs = 0 | ParamAttr::NoUnwind;
- Attrs.push_back(PAWI);
- func_from_array_PAL = ParamAttrsList::get(Attrs);
-
- }
- func_from_array->setParamAttrs(func_from_array_PAL);
-
- Function* func_from_consts = new Function(
- /*Type=*/FuncTy_16,
- /*Linkage=*/GlobalValue::ExternalLinkage,
- /*Name=*/"from_consts", mod);
- func_from_consts->setCallingConv(CallingConv::C);
- const ParamAttrsList *func_from_consts_PAL = 0;
- {
- ParamAttrsVector Attrs;
- ParamAttrsWithIndex PAWI;
- PAWI.index = 0; PAWI.attrs = 0 | ParamAttr::NoUnwind;
- Attrs.push_back(PAWI);
- func_from_consts_PAL = ParamAttrsList::get(Attrs);
-
- }
- func_from_consts->setParamAttrs(func_from_consts_PAL);
-
- Function* func_to_array = new Function(
- /*Type=*/FuncTy_17,
- /*Linkage=*/GlobalValue::ExternalLinkage,
- /*Name=*/"to_array", mod);
- func_to_array->setCallingConv(CallingConv::C);
- const ParamAttrsList *func_to_array_PAL = 0;
- {
- ParamAttrsVector Attrs;
- ParamAttrsWithIndex PAWI;
- PAWI.index = 0; PAWI.attrs = 0 | ParamAttr::NoUnwind;
- Attrs.push_back(PAWI);
- func_to_array_PAL = ParamAttrsList::get(Attrs);
-
- }
- func_to_array->setParamAttrs(func_to_array_PAL);
-
- Function* func_run_vertex_shader = new Function(
- /*Type=*/FuncTy_18,
- /*Linkage=*/GlobalValue::ExternalLinkage,
- /*Name=*/"run_vertex_shader", mod);
- func_run_vertex_shader->setCallingConv(CallingConv::C);
- const ParamAttrsList *func_run_vertex_shader_PAL = 0;
- func_run_vertex_shader->setParamAttrs(func_run_vertex_shader_PAL);
-
- Function* func_execute_shader = new Function(
- /*Type=*/FuncTy_26,
- /*Linkage=*/GlobalValue::ExternalLinkage,
- /*Name=*/"execute_shader", mod); // (external, no body)
- func_execute_shader->setCallingConv(CallingConv::C);
- const ParamAttrsList *func_execute_shader_PAL = 0;
- func_execute_shader->setParamAttrs(func_execute_shader_PAL);
-
- Function* func_run_fragment_shader = new Function(
- /*Type=*/FuncTy_27,
- /*Linkage=*/GlobalValue::ExternalLinkage,
- /*Name=*/"run_fragment_shader", mod);
- func_run_fragment_shader->setCallingConv(CallingConv::C);
- const ParamAttrsList *func_run_fragment_shader_PAL = 0;
- func_run_fragment_shader->setParamAttrs(func_run_fragment_shader_PAL);
-
- // Global Variable Declarations
-
-
- // Constant Definitions
- Constant* const_int32_29 = Constant::getNullValue(IntegerType::get(32));
- ConstantInt* const_int32_30 = ConstantInt::get(APInt(32, "-1", 10));
- ConstantInt* const_int32_31 = ConstantInt::get(APInt(32, "1", 10));
- UndefValue* const_packed_32 = UndefValue::get(VectorTy_1);
- ConstantInt* const_int32_33 = ConstantInt::get(APInt(32, "2", 10));
- ConstantInt* const_int32_34 = ConstantInt::get(APInt(32, "3", 10));
- ConstantInt* const_int32_35 = ConstantInt::get(APInt(32, "4", 10));
-
- // Global Variable Definitions
-
- // Function Definitions
-
- // Function: from_array (func_from_array)
- {
- Function::arg_iterator args = func_from_array->arg_begin();
- Value* ptr_res = args++;
- ptr_res->setName("res");
- Value* ptr_ainputs = args++;
- ptr_ainputs->setName("ainputs");
- Value* int32_count = args++;
- int32_count->setName("count");
- Value* int32_num_attribs = args++;
- int32_num_attribs->setName("num_attribs");
-
- BasicBlock* label_entry = new BasicBlock("entry",func_from_array,0);
- BasicBlock* label_forcond2_preheader_split = new BasicBlock("forcond2.preheader.split",func_from_array,0);
- BasicBlock* label_forcond2 = new BasicBlock("forcond2",func_from_array,0);
- BasicBlock* label_forbody6 = new BasicBlock("forbody6",func_from_array,0);
- BasicBlock* label_forinc57 = new BasicBlock("forinc57",func_from_array,0);
- BasicBlock* label_afterfor60 = new BasicBlock("afterfor60",func_from_array,0);
-
- // Block entry (label_entry)
- ICmpInst* int1_cmp = new ICmpInst(ICmpInst::ICMP_SGT, int32_count, const_int32_29, "cmp", label_entry);
- ICmpInst* int1_cmp5 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs, const_int32_29, "cmp5", label_entry);
- BinaryOperator* int1_bothcond = BinaryOperator::create(Instruction::And, int1_cmp, int1_cmp5, "bothcond", label_entry);
- new BranchInst(label_forcond2_preheader_split, label_afterfor60, int1_bothcond, label_entry);
-
- // Block forcond2.preheader.split (label_forcond2_preheader_split)
- BinaryOperator* int32_tmp21 = BinaryOperator::create(Instruction::Add, int32_count, const_int32_30, "tmp21", label_forcond2_preheader_split);
- ICmpInst* int1_tmp22 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp21, const_int32_29, "tmp22", label_forcond2_preheader_split);
- SelectInst* int32_tmp25 = new SelectInst(int1_tmp22, const_int32_31, int32_count, "tmp25", label_forcond2_preheader_split);
- new BranchInst(label_forcond2, label_forcond2_preheader_split);
-
- // Block forcond2 (label_forcond2)
- Argument* fwdref_38 = new Argument(IntegerType::get(32));
- PHINode* int32_i_0_reg2mem_0 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forcond2);
- int32_i_0_reg2mem_0->reserveOperandSpace(2);
- int32_i_0_reg2mem_0->addIncoming(const_int32_29, label_forcond2_preheader_split);
- int32_i_0_reg2mem_0->addIncoming(fwdref_38, label_forinc57);
-
- Argument* fwdref_39 = new Argument(VectorTy_1);
- PHINode* packed_vec_1_reg2mem_0 = new PHINode(VectorTy_1, "vec.1.reg2mem.0", label_forcond2);
- packed_vec_1_reg2mem_0->reserveOperandSpace(2);
- packed_vec_1_reg2mem_0->addIncoming(const_packed_32, label_forcond2_preheader_split);
- packed_vec_1_reg2mem_0->addIncoming(fwdref_39, label_forinc57);
-
- BinaryOperator* int32_tmp = BinaryOperator::create(Instruction::Add, int32_num_attribs, const_int32_30, "tmp", label_forcond2);
- ICmpInst* int1_tmp18 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp, const_int32_29, "tmp18", label_forcond2);
- SelectInst* int32_tmp19 = new SelectInst(int1_tmp18, const_int32_31, int32_num_attribs, "tmp19", label_forcond2);
- new BranchInst(label_forbody6, label_forcond2);
-
- // Block forbody6 (label_forbody6)
- Argument* fwdref_41 = new Argument(IntegerType::get(32));
- PHINode* int32_j_0_reg2mem_0 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0", label_forbody6);
- int32_j_0_reg2mem_0->reserveOperandSpace(2);
- int32_j_0_reg2mem_0->addIncoming(const_int32_29, label_forcond2);
- int32_j_0_reg2mem_0->addIncoming(fwdref_41, label_forbody6);
-
- PHINode* packed_vec_0_reg2mem_0 = new PHINode(VectorTy_1, "vec.0.reg2mem.0", label_forbody6);
- packed_vec_0_reg2mem_0->reserveOperandSpace(2);
- packed_vec_0_reg2mem_0->addIncoming(packed_vec_1_reg2mem_0, label_forcond2);
- packed_vec_0_reg2mem_0->addIncoming(fwdref_39, label_forbody6);
-
- std::vector<Value*> ptr_arraydecay11_indices;
- ptr_arraydecay11_indices.push_back(int32_i_0_reg2mem_0);
- ptr_arraydecay11_indices.push_back(int32_j_0_reg2mem_0);
- ptr_arraydecay11_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay11 = new GetElementPtrInst(ptr_ainputs, ptr_arraydecay11_indices.begin(), ptr_arraydecay11_indices.end(), "arraydecay11", label_forbody6);
- LoadInst* float_tmp13 = new LoadInst(ptr_arraydecay11, "tmp13", false, label_forbody6);
- InsertElementInst* packed_tmp15 = new InsertElementInst(packed_vec_0_reg2mem_0, float_tmp13, const_int32_29, "tmp15", label_forbody6);
- std::vector<Value*> ptr_arrayidx23_indices;
- ptr_arrayidx23_indices.push_back(int32_i_0_reg2mem_0);
- ptr_arrayidx23_indices.push_back(int32_j_0_reg2mem_0);
- ptr_arrayidx23_indices.push_back(const_int32_31);
- Instruction* ptr_arrayidx23 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx23_indices.begin(), ptr_arrayidx23_indices.end(), "arrayidx23", label_forbody6);
- LoadInst* float_tmp24 = new LoadInst(ptr_arrayidx23, "tmp24", false, label_forbody6);
- InsertElementInst* packed_tmp26 = new InsertElementInst(packed_tmp15, float_tmp24, const_int32_31, "tmp26", label_forbody6);
- std::vector<Value*> ptr_arrayidx34_indices;
- ptr_arrayidx34_indices.push_back(int32_i_0_reg2mem_0);
- ptr_arrayidx34_indices.push_back(int32_j_0_reg2mem_0);
- ptr_arrayidx34_indices.push_back(const_int32_33);
- Instruction* ptr_arrayidx34 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx34_indices.begin(), ptr_arrayidx34_indices.end(), "arrayidx34", label_forbody6);
- LoadInst* float_tmp35 = new LoadInst(ptr_arrayidx34, "tmp35", false, label_forbody6);
- InsertElementInst* packed_tmp37 = new InsertElementInst(packed_tmp26, float_tmp35, const_int32_33, "tmp37", label_forbody6);
- std::vector<Value*> ptr_arrayidx45_indices;
- ptr_arrayidx45_indices.push_back(int32_i_0_reg2mem_0);
- ptr_arrayidx45_indices.push_back(int32_j_0_reg2mem_0);
- ptr_arrayidx45_indices.push_back(const_int32_34);
- Instruction* ptr_arrayidx45 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx45_indices.begin(), ptr_arrayidx45_indices.end(), "arrayidx45", label_forbody6);
- LoadInst* float_tmp46 = new LoadInst(ptr_arrayidx45, "tmp46", false, label_forbody6);
- InsertElementInst* packed_tmp48 = new InsertElementInst(packed_tmp37, float_tmp46, const_int32_34, "tmp48", label_forbody6);
- std::vector<Value*> ptr_arrayidx54_indices;
- ptr_arrayidx54_indices.push_back(int32_i_0_reg2mem_0);
- ptr_arrayidx54_indices.push_back(int32_j_0_reg2mem_0);
- Instruction* ptr_arrayidx54 = new GetElementPtrInst(ptr_res, ptr_arrayidx54_indices.begin(), ptr_arrayidx54_indices.end(), "arrayidx54", label_forbody6);
- StoreInst* void_42 = new StoreInst(packed_tmp48, ptr_arrayidx54, false, label_forbody6);
- BinaryOperator* int32_indvar_next = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0, const_int32_31, "indvar.next", label_forbody6);
- ICmpInst* int1_exitcond = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next, int32_tmp19, "exitcond", label_forbody6);
- new BranchInst(label_forinc57, label_forbody6, int1_exitcond, label_forbody6);
-
- // Block forinc57 (label_forinc57)
- BinaryOperator* int32_indvar_next20 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0, const_int32_31, "indvar.next20", label_forinc57);
- ICmpInst* int1_exitcond26 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next20, int32_tmp25, "exitcond26", label_forinc57);
- new BranchInst(label_afterfor60, label_forcond2, int1_exitcond26, label_forinc57);
-
- // Block afterfor60 (label_afterfor60)
- new ReturnInst(label_afterfor60);
-
- // Resolve Forward References
- fwdref_39->replaceAllUsesWith(packed_tmp48); delete fwdref_39;
- fwdref_41->replaceAllUsesWith(int32_indvar_next); delete fwdref_41;
- fwdref_38->replaceAllUsesWith(int32_indvar_next20); delete fwdref_38;
-
- }
-
- // Function: from_consts (func_from_consts)
- {
- Function::arg_iterator args = func_from_consts->arg_begin();
- Value* ptr_res_46 = args++;
- ptr_res_46->setName("res");
- Value* ptr_ainputs_47 = args++;
- ptr_ainputs_47->setName("ainputs");
- Value* int32_count_48 = args++;
- int32_count_48->setName("count");
-
- BasicBlock* label_entry_49 = new BasicBlock("entry",func_from_consts,0);
- BasicBlock* label_forbody_preheader = new BasicBlock("forbody.preheader",func_from_consts,0);
- BasicBlock* label_forbody = new BasicBlock("forbody",func_from_consts,0);
- BasicBlock* label_afterfor = new BasicBlock("afterfor",func_from_consts,0);
-
- // Block entry (label_entry_49)
- ICmpInst* int1_cmp_50 = new ICmpInst(ICmpInst::ICMP_SGT, int32_count_48, const_int32_29, "cmp", label_entry_49);
- new BranchInst(label_forbody_preheader, label_afterfor, int1_cmp_50, label_entry_49);
-
- // Block forbody.preheader (label_forbody_preheader)
- BinaryOperator* int32_tmp_52 = BinaryOperator::create(Instruction::Add, int32_count_48, const_int32_30, "tmp", label_forbody_preheader);
- ICmpInst* int1_tmp9 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_52, const_int32_29, "tmp9", label_forbody_preheader);
- SelectInst* int32_tmp10 = new SelectInst(int1_tmp9, const_int32_31, int32_count_48, "tmp10", label_forbody_preheader);
- new BranchInst(label_forbody, label_forbody_preheader);
-
- // Block forbody (label_forbody)
- Argument* fwdref_55 = new Argument(IntegerType::get(32));
- PHINode* int32_i_0_reg2mem_0_54 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody);
- int32_i_0_reg2mem_0_54->reserveOperandSpace(2);
- int32_i_0_reg2mem_0_54->addIncoming(const_int32_29, label_forbody_preheader);
- int32_i_0_reg2mem_0_54->addIncoming(fwdref_55, label_forbody);
-
- Argument* fwdref_57 = new Argument(VectorTy_1);
- PHINode* packed_vec_0_reg2mem_0_56 = new PHINode(VectorTy_1, "vec.0.reg2mem.0", label_forbody);
- packed_vec_0_reg2mem_0_56->reserveOperandSpace(2);
- packed_vec_0_reg2mem_0_56->addIncoming(const_packed_32, label_forbody_preheader);
- packed_vec_0_reg2mem_0_56->addIncoming(fwdref_57, label_forbody);
-
- std::vector<Value*> ptr_arraydecay_indices;
- ptr_arraydecay_indices.push_back(int32_i_0_reg2mem_0_54);
- ptr_arraydecay_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay = new GetElementPtrInst(ptr_ainputs_47, ptr_arraydecay_indices.begin(), ptr_arraydecay_indices.end(), "arraydecay", label_forbody);
- LoadInst* float_tmp5 = new LoadInst(ptr_arraydecay, "tmp5", false, label_forbody);
- InsertElementInst* packed_tmp7 = new InsertElementInst(packed_vec_0_reg2mem_0_56, float_tmp5, const_int32_29, "tmp7", label_forbody);
- std::vector<Value*> ptr_arrayidx12_indices;
- ptr_arrayidx12_indices.push_back(int32_i_0_reg2mem_0_54);
- ptr_arrayidx12_indices.push_back(const_int32_31);
- Instruction* ptr_arrayidx12 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx12_indices.begin(), ptr_arrayidx12_indices.end(), "arrayidx12", label_forbody);
- LoadInst* float_tmp13_58 = new LoadInst(ptr_arrayidx12, "tmp13", false, label_forbody);
- InsertElementInst* packed_tmp15_59 = new InsertElementInst(packed_tmp7, float_tmp13_58, const_int32_31, "tmp15", label_forbody);
- std::vector<Value*> ptr_arrayidx20_indices;
- ptr_arrayidx20_indices.push_back(int32_i_0_reg2mem_0_54);
- ptr_arrayidx20_indices.push_back(const_int32_33);
- Instruction* ptr_arrayidx20 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx20_indices.begin(), ptr_arrayidx20_indices.end(), "arrayidx20", label_forbody);
- LoadInst* float_tmp21 = new LoadInst(ptr_arrayidx20, "tmp21", false, label_forbody);
- InsertElementInst* packed_tmp23 = new InsertElementInst(packed_tmp15_59, float_tmp21, const_int32_33, "tmp23", label_forbody);
- std::vector<Value*> ptr_arrayidx28_indices;
- ptr_arrayidx28_indices.push_back(int32_i_0_reg2mem_0_54);
- ptr_arrayidx28_indices.push_back(const_int32_34);
- Instruction* ptr_arrayidx28 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx28_indices.begin(), ptr_arrayidx28_indices.end(), "arrayidx28", label_forbody);
- LoadInst* float_tmp29 = new LoadInst(ptr_arrayidx28, "tmp29", false, label_forbody);
- InsertElementInst* packed_tmp31 = new InsertElementInst(packed_tmp23, float_tmp29, const_int32_34, "tmp31", label_forbody);
- GetElementPtrInst* ptr_arrayidx34_60 = new GetElementPtrInst(ptr_res_46, int32_i_0_reg2mem_0_54, "arrayidx34", label_forbody);
- StoreInst* void_61 = new StoreInst(packed_tmp31, ptr_arrayidx34_60, false, label_forbody);
- BinaryOperator* int32_indvar_next_62 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_54, const_int32_31, "indvar.next", label_forbody);
- ICmpInst* int1_exitcond_63 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_62, int32_tmp10, "exitcond", label_forbody);
- new BranchInst(label_afterfor, label_forbody, int1_exitcond_63, label_forbody);
-
- // Block afterfor (label_afterfor)
- new ReturnInst(label_afterfor);
-
- // Resolve Forward References
- fwdref_57->replaceAllUsesWith(packed_tmp31); delete fwdref_57;
- fwdref_55->replaceAllUsesWith(int32_indvar_next_62); delete fwdref_55;
-
- }
-
- // Function: to_array (func_to_array)
- {
- Function::arg_iterator args = func_to_array->arg_begin();
- Value* ptr_dests = args++;
- ptr_dests->setName("dests");
- Value* ptr_in = args++;
- ptr_in->setName("in");
- Value* int32_num_attribs_66 = args++;
- int32_num_attribs_66->setName("num_attribs");
-
- BasicBlock* label_entry_67 = new BasicBlock("entry",func_to_array,0);
- BasicBlock* label_forbody_preheader_68 = new BasicBlock("forbody.preheader",func_to_array,0);
- BasicBlock* label_forbody_69 = new BasicBlock("forbody",func_to_array,0);
- BasicBlock* label_afterfor_70 = new BasicBlock("afterfor",func_to_array,0);
-
- // Block entry (label_entry_67)
- ICmpInst* int1_cmp_71 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs_66, const_int32_29, "cmp", label_entry_67);
- new BranchInst(label_forbody_preheader_68, label_afterfor_70, int1_cmp_71, label_entry_67);
-
- // Block forbody.preheader (label_forbody_preheader_68)
- BinaryOperator* int32_tmp_73 = BinaryOperator::create(Instruction::Add, int32_num_attribs_66, const_int32_30, "tmp", label_forbody_preheader_68);
- ICmpInst* int1_tmp9_74 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_73, const_int32_29, "tmp9", label_forbody_preheader_68);
- SelectInst* int32_tmp10_75 = new SelectInst(int1_tmp9_74, const_int32_31, int32_num_attribs_66, "tmp10", label_forbody_preheader_68);
- new BranchInst(label_forbody_69, label_forbody_preheader_68);
-
- // Block forbody (label_forbody_69)
- Argument* fwdref_78 = new Argument(IntegerType::get(32));
- PHINode* int32_i_0_reg2mem_0_77 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_69);
- int32_i_0_reg2mem_0_77->reserveOperandSpace(2);
- int32_i_0_reg2mem_0_77->addIncoming(const_int32_29, label_forbody_preheader_68);
- int32_i_0_reg2mem_0_77->addIncoming(fwdref_78, label_forbody_69);
-
- std::vector<Value*> ptr_arraydecay_79_indices;
- ptr_arraydecay_79_indices.push_back(int32_i_0_reg2mem_0_77);
- ptr_arraydecay_79_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay_79 = new GetElementPtrInst(ptr_dests, ptr_arraydecay_79_indices.begin(), ptr_arraydecay_79_indices.end(), "arraydecay", label_forbody_69);
- GetElementPtrInst* ptr_arrayidx6 = new GetElementPtrInst(ptr_in, int32_i_0_reg2mem_0_77, "arrayidx6", label_forbody_69);
- LoadInst* packed_tmp7_80 = new LoadInst(ptr_arrayidx6, "tmp7", false, label_forbody_69);
- ExtractElementInst* float_tmp11 = new ExtractElementInst(packed_tmp7_80, const_int32_29, "tmp11", label_forbody_69);
- StoreInst* void_81 = new StoreInst(float_tmp11, ptr_arraydecay_79, false, label_forbody_69);
- std::vector<Value*> ptr_arrayidx13_indices;
- ptr_arrayidx13_indices.push_back(int32_i_0_reg2mem_0_77);
- ptr_arrayidx13_indices.push_back(const_int32_31);
- Instruction* ptr_arrayidx13 = new GetElementPtrInst(ptr_dests, ptr_arrayidx13_indices.begin(), ptr_arrayidx13_indices.end(), "arrayidx13", label_forbody_69);
- ExtractElementInst* float_tmp15 = new ExtractElementInst(packed_tmp7_80, const_int32_31, "tmp15", label_forbody_69);
- StoreInst* void_82 = new StoreInst(float_tmp15, ptr_arrayidx13, false, label_forbody_69);
- std::vector<Value*> ptr_arrayidx17_indices;
- ptr_arrayidx17_indices.push_back(int32_i_0_reg2mem_0_77);
- ptr_arrayidx17_indices.push_back(const_int32_33);
- Instruction* ptr_arrayidx17 = new GetElementPtrInst(ptr_dests, ptr_arrayidx17_indices.begin(), ptr_arrayidx17_indices.end(), "arrayidx17", label_forbody_69);
- ExtractElementInst* float_tmp19 = new ExtractElementInst(packed_tmp7_80, const_int32_33, "tmp19", label_forbody_69);
- StoreInst* void_83 = new StoreInst(float_tmp19, ptr_arrayidx17, false, label_forbody_69);
- std::vector<Value*> ptr_arrayidx21_indices;
- ptr_arrayidx21_indices.push_back(int32_i_0_reg2mem_0_77);
- ptr_arrayidx21_indices.push_back(const_int32_34);
- Instruction* ptr_arrayidx21 = new GetElementPtrInst(ptr_dests, ptr_arrayidx21_indices.begin(), ptr_arrayidx21_indices.end(), "arrayidx21", label_forbody_69);
- ExtractElementInst* float_tmp23 = new ExtractElementInst(packed_tmp7_80, const_int32_34, "tmp23", label_forbody_69);
- StoreInst* void_84 = new StoreInst(float_tmp23, ptr_arrayidx21, false, label_forbody_69);
- BinaryOperator* int32_indvar_next_85 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_77, const_int32_31, "indvar.next", label_forbody_69);
- ICmpInst* int1_exitcond_86 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_85, int32_tmp10_75, "exitcond", label_forbody_69);
- new BranchInst(label_afterfor_70, label_forbody_69, int1_exitcond_86, label_forbody_69);
-
- // Block afterfor (label_afterfor_70)
- new ReturnInst(label_afterfor_70);
-
- // Resolve Forward References
- fwdref_78->replaceAllUsesWith(int32_indvar_next_85); delete fwdref_78;
-
- }
-
- // Function: run_vertex_shader (func_run_vertex_shader)
- {
- Function::arg_iterator args = func_run_vertex_shader->arg_begin();
- Value* ptr_inputs = args++;
- ptr_inputs->setName("inputs");
- Value* ptr_results = args++;
- ptr_results->setName("results");
- Value* ptr_aconsts = args++;
- ptr_aconsts->setName("aconsts");
- Value* int32_num_vertices = args++;
- int32_num_vertices->setName("num_vertices");
- Value* int32_num_inputs = args++;
- int32_num_inputs->setName("num_inputs");
- Value* int32_num_attribs_89 = args++;
- int32_num_attribs_89->setName("num_attribs");
- Value* int32_num_consts = args++;
- int32_num_consts->setName("num_consts");
-
- BasicBlock* label_entry_90 = new BasicBlock("entry",func_run_vertex_shader,0);
- BasicBlock* label_forbody_preheader_i = new BasicBlock("forbody.preheader.i",func_run_vertex_shader,0);
- BasicBlock* label_forbody_i = new BasicBlock("forbody.i",func_run_vertex_shader,0);
- BasicBlock* label_from_consts_exit = new BasicBlock("from_consts.exit",func_run_vertex_shader,0);
-
- // Block entry (label_entry_90)
- AllocaInst* ptr_consts = new AllocaInst(ArrayTy_20, "consts", label_entry_90);
- AllocaInst* ptr_temps = new AllocaInst(ArrayTy_22, "temps", label_entry_90);
- AllocaInst* ptr_args = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_90);
- std::vector<Value*> ptr_tmp_indices;
- ptr_tmp_indices.push_back(const_int32_29);
- ptr_tmp_indices.push_back(const_int32_29);
- Instruction* ptr_tmp = new GetElementPtrInst(ptr_args, ptr_tmp_indices.begin(), ptr_tmp_indices.end(), "tmp", label_entry_90);
- CastInst* ptr_conv = new BitCastInst(ptr_results, PointerTy_0, "conv", label_entry_90);
- StoreInst* void_91 = new StoreInst(ptr_conv, ptr_tmp, false, label_entry_90);
- std::vector<Value*> ptr_tmp2_indices;
- ptr_tmp2_indices.push_back(const_int32_29);
- ptr_tmp2_indices.push_back(const_int32_31);
- Instruction* ptr_tmp2 = new GetElementPtrInst(ptr_args, ptr_tmp2_indices.begin(), ptr_tmp2_indices.end(), "tmp2", label_entry_90);
- CastInst* ptr_conv4 = new BitCastInst(ptr_inputs, PointerTy_0, "conv4", label_entry_90);
- StoreInst* void_92 = new StoreInst(ptr_conv4, ptr_tmp2, false, label_entry_90);
- ICmpInst* int1_cmp_i = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts, const_int32_29, "cmp.i", label_entry_90);
- new BranchInst(label_forbody_preheader_i, label_from_consts_exit, int1_cmp_i, label_entry_90);
-
- // Block forbody.preheader.i (label_forbody_preheader_i)
- BinaryOperator* int32_tmp_i = BinaryOperator::create(Instruction::Add, int32_num_consts, const_int32_30, "tmp.i", label_forbody_preheader_i);
- ICmpInst* int1_tmp9_i = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_i, const_int32_29, "tmp9.i", label_forbody_preheader_i);
- SelectInst* int32_tmp10_i = new SelectInst(int1_tmp9_i, const_int32_31, int32_num_consts, "tmp10.i", label_forbody_preheader_i);
- new BranchInst(label_forbody_i, label_forbody_preheader_i);
-
- // Block forbody.i (label_forbody_i)
- Argument* fwdref_95 = new Argument(IntegerType::get(32));
- PHINode* int32_i_0_reg2mem_0_i = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i", label_forbody_i);
- int32_i_0_reg2mem_0_i->reserveOperandSpace(2);
- int32_i_0_reg2mem_0_i->addIncoming(const_int32_29, label_forbody_preheader_i);
- int32_i_0_reg2mem_0_i->addIncoming(fwdref_95, label_forbody_i);
-
- Argument* fwdref_96 = new Argument(VectorTy_1);
- PHINode* packed_vec_0_reg2mem_0_i = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody_i);
- packed_vec_0_reg2mem_0_i->reserveOperandSpace(2);
- packed_vec_0_reg2mem_0_i->addIncoming(const_packed_32, label_forbody_preheader_i);
- packed_vec_0_reg2mem_0_i->addIncoming(fwdref_96, label_forbody_i);
-
- std::vector<Value*> ptr_arraydecay_i_indices;
- ptr_arraydecay_i_indices.push_back(int32_i_0_reg2mem_0_i);
- ptr_arraydecay_i_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay_i = new GetElementPtrInst(ptr_aconsts, ptr_arraydecay_i_indices.begin(), ptr_arraydecay_i_indices.end(), "arraydecay.i", label_forbody_i);
- LoadInst* float_tmp5_i = new LoadInst(ptr_arraydecay_i, "tmp5.i", false, label_forbody_i);
- InsertElementInst* packed_tmp7_i = new InsertElementInst(packed_vec_0_reg2mem_0_i, float_tmp5_i, const_int32_29, "tmp7.i", label_forbody_i);
- std::vector<Value*> ptr_arrayidx12_i_indices;
- ptr_arrayidx12_i_indices.push_back(int32_i_0_reg2mem_0_i);
- ptr_arrayidx12_i_indices.push_back(const_int32_31);
- Instruction* ptr_arrayidx12_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx12_i_indices.begin(), ptr_arrayidx12_i_indices.end(), "arrayidx12.i", label_forbody_i);
- LoadInst* float_tmp13_i = new LoadInst(ptr_arrayidx12_i, "tmp13.i", false, label_forbody_i);
- InsertElementInst* packed_tmp15_i = new InsertElementInst(packed_tmp7_i, float_tmp13_i, const_int32_31, "tmp15.i", label_forbody_i);
- std::vector<Value*> ptr_arrayidx20_i_indices;
- ptr_arrayidx20_i_indices.push_back(int32_i_0_reg2mem_0_i);
- ptr_arrayidx20_i_indices.push_back(const_int32_33);
- Instruction* ptr_arrayidx20_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx20_i_indices.begin(), ptr_arrayidx20_i_indices.end(), "arrayidx20.i", label_forbody_i);
- LoadInst* float_tmp21_i = new LoadInst(ptr_arrayidx20_i, "tmp21.i", false, label_forbody_i);
- InsertElementInst* packed_tmp23_i = new InsertElementInst(packed_tmp15_i, float_tmp21_i, const_int32_33, "tmp23.i", label_forbody_i);
- std::vector<Value*> ptr_arrayidx28_i_indices;
- ptr_arrayidx28_i_indices.push_back(int32_i_0_reg2mem_0_i);
- ptr_arrayidx28_i_indices.push_back(const_int32_34);
- Instruction* ptr_arrayidx28_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx28_i_indices.begin(), ptr_arrayidx28_i_indices.end(), "arrayidx28.i", label_forbody_i);
- LoadInst* float_tmp29_i = new LoadInst(ptr_arrayidx28_i, "tmp29.i", false, label_forbody_i);
- InsertElementInst* packed_tmp31_i = new InsertElementInst(packed_tmp23_i, float_tmp29_i, const_int32_34, "tmp31.i", label_forbody_i);
- std::vector<Value*> ptr_arrayidx34_i_indices;
- ptr_arrayidx34_i_indices.push_back(const_int32_29);
- ptr_arrayidx34_i_indices.push_back(int32_i_0_reg2mem_0_i);
- Instruction* ptr_arrayidx34_i = new GetElementPtrInst(ptr_consts, ptr_arrayidx34_i_indices.begin(), ptr_arrayidx34_i_indices.end(), "arrayidx34.i", label_forbody_i);
- StoreInst* void_97 = new StoreInst(packed_tmp31_i, ptr_arrayidx34_i, false, label_forbody_i);
- BinaryOperator* int32_indvar_next_98 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i, const_int32_31, "indvar.next", label_forbody_i);
- ICmpInst* int1_exitcond_99 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_98, int32_tmp10_i, "exitcond", label_forbody_i);
- new BranchInst(label_from_consts_exit, label_forbody_i, int1_exitcond_99, label_forbody_i);
-
- // Block from_consts.exit (label_from_consts_exit)
- std::vector<Value*> ptr_tmp7_indices;
- ptr_tmp7_indices.push_back(const_int32_29);
- ptr_tmp7_indices.push_back(const_int32_34);
- Instruction* ptr_tmp7 = new GetElementPtrInst(ptr_args, ptr_tmp7_indices.begin(), ptr_tmp7_indices.end(), "tmp7", label_from_consts_exit);
- std::vector<Value*> ptr_arraydecay8_indices;
- ptr_arraydecay8_indices.push_back(const_int32_29);
- ptr_arraydecay8_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay8 = new GetElementPtrInst(ptr_consts, ptr_arraydecay8_indices.begin(), ptr_arraydecay8_indices.end(), "arraydecay8", label_from_consts_exit);
- StoreInst* void_101 = new StoreInst(ptr_arraydecay8, ptr_tmp7, false, label_from_consts_exit);
- std::vector<Value*> ptr_tmp9_indices;
- ptr_tmp9_indices.push_back(const_int32_29);
- ptr_tmp9_indices.push_back(const_int32_33);
- Instruction* ptr_tmp9 = new GetElementPtrInst(ptr_args, ptr_tmp9_indices.begin(), ptr_tmp9_indices.end(), "tmp9", label_from_consts_exit);
- std::vector<Value*> ptr_arraydecay10_indices;
- ptr_arraydecay10_indices.push_back(const_int32_29);
- ptr_arraydecay10_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay10 = new GetElementPtrInst(ptr_temps, ptr_arraydecay10_indices.begin(), ptr_arraydecay10_indices.end(), "arraydecay10", label_from_consts_exit);
- StoreInst* void_102 = new StoreInst(ptr_arraydecay10, ptr_tmp9, false, label_from_consts_exit);
- CallInst* void_103 = new CallInst(func_execute_shader, ptr_args, "", label_from_consts_exit);
- void_103->setCallingConv(CallingConv::C);
- void_103->setTailCall(false);const ParamAttrsList *void_103_PAL = 0;
- void_103->setParamAttrs(void_103_PAL);
-
- new ReturnInst(label_from_consts_exit);
-
- // Resolve Forward References
- fwdref_96->replaceAllUsesWith(packed_tmp31_i); delete fwdref_96;
- fwdref_95->replaceAllUsesWith(int32_indvar_next_98); delete fwdref_95;
-
- }
-
- // Function: run_fragment_shader (func_run_fragment_shader)
- {
- Function::arg_iterator args = func_run_fragment_shader->arg_begin();
- Value* float_x = args++;
- float_x->setName("x");
- Value* float_y = args++;
- float_y->setName("y");
- Value* ptr_results_105 = args++;
- ptr_results_105->setName("results");
- Value* ptr_inputs_106 = args++;
- ptr_inputs_106->setName("inputs");
- Value* int32_num_inputs_107 = args++;
- int32_num_inputs_107->setName("num_inputs");
- Value* ptr_aconsts_108 = args++;
- ptr_aconsts_108->setName("aconsts");
- Value* int32_num_consts_109 = args++;
- int32_num_consts_109->setName("num_consts");
- Value* ptr_samplers = args++;
- ptr_samplers->setName("samplers");
-
- BasicBlock* label_entry_110 = new BasicBlock("entry",func_run_fragment_shader,0);
- BasicBlock* label_forbody_preheader_i_111 = new BasicBlock("forbody.preheader.i",func_run_fragment_shader,0);
- BasicBlock* label_forbody_i_112 = new BasicBlock("forbody.i",func_run_fragment_shader,0);
- BasicBlock* label_from_consts_exit_113 = new BasicBlock("from_consts.exit",func_run_fragment_shader,0);
-
- // Block entry (label_entry_110)
- AllocaInst* ptr_consts_114 = new AllocaInst(ArrayTy_20, "consts", label_entry_110);
- AllocaInst* ptr_temps_115 = new AllocaInst(ArrayTy_22, "temps", label_entry_110);
- AllocaInst* ptr_args_116 = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_110);
- std::vector<Value*> ptr_tmp_117_indices;
- ptr_tmp_117_indices.push_back(const_int32_29);
- ptr_tmp_117_indices.push_back(const_int32_35);
- Instruction* ptr_tmp_117 = new GetElementPtrInst(ptr_args_116, ptr_tmp_117_indices.begin(), ptr_tmp_117_indices.end(), "tmp", label_entry_110);
- StoreInst* void_118 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_entry_110);
- ICmpInst* int1_cmp_i_119 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts_109, const_int32_29, "cmp.i", label_entry_110);
- new BranchInst(label_forbody_preheader_i_111, label_from_consts_exit_113, int1_cmp_i_119, label_entry_110);
-
- // Block forbody.preheader.i (label_forbody_preheader_i_111)
- BinaryOperator* int32_tmp_i_121 = BinaryOperator::create(Instruction::Add, int32_num_consts_109, const_int32_30, "tmp.i", label_forbody_preheader_i_111);
- ICmpInst* int1_tmp9_i_122 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_i_121, const_int32_29, "tmp9.i", label_forbody_preheader_i_111);
- SelectInst* int32_tmp10_i_123 = new SelectInst(int1_tmp9_i_122, const_int32_31, int32_num_consts_109, "tmp10.i", label_forbody_preheader_i_111);
- new BranchInst(label_forbody_i_112, label_forbody_preheader_i_111);
-
- // Block forbody.i (label_forbody_i_112)
- Argument* fwdref_126 = new Argument(IntegerType::get(32));
- PHINode* int32_i_0_reg2mem_0_i_125 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i", label_forbody_i_112);
- int32_i_0_reg2mem_0_i_125->reserveOperandSpace(2);
- int32_i_0_reg2mem_0_i_125->addIncoming(const_int32_29, label_forbody_preheader_i_111);
- int32_i_0_reg2mem_0_i_125->addIncoming(fwdref_126, label_forbody_i_112);
-
- Argument* fwdref_128 = new Argument(VectorTy_1);
- PHINode* packed_vec_0_reg2mem_0_i_127 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody_i_112);
- packed_vec_0_reg2mem_0_i_127->reserveOperandSpace(2);
- packed_vec_0_reg2mem_0_i_127->addIncoming(const_packed_32, label_forbody_preheader_i_111);
- packed_vec_0_reg2mem_0_i_127->addIncoming(fwdref_128, label_forbody_i_112);
-
- std::vector<Value*> ptr_arraydecay_i_129_indices;
- ptr_arraydecay_i_129_indices.push_back(int32_i_0_reg2mem_0_i_125);
- ptr_arraydecay_i_129_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay_i_129 = new GetElementPtrInst(ptr_aconsts_108, ptr_arraydecay_i_129_indices.begin(), ptr_arraydecay_i_129_indices.end(), "arraydecay.i", label_forbody_i_112);
- LoadInst* float_tmp5_i_130 = new LoadInst(ptr_arraydecay_i_129, "tmp5.i", false, label_forbody_i_112);
- InsertElementInst* packed_tmp7_i_131 = new InsertElementInst(packed_vec_0_reg2mem_0_i_127, float_tmp5_i_130, const_int32_29, "tmp7.i", label_forbody_i_112);
- std::vector<Value*> ptr_arrayidx12_i_132_indices;
- ptr_arrayidx12_i_132_indices.push_back(int32_i_0_reg2mem_0_i_125);
- ptr_arrayidx12_i_132_indices.push_back(const_int32_31);
- Instruction* ptr_arrayidx12_i_132 = new GetElementPtrInst(ptr_aconsts_108, ptr_arrayidx12_i_132_indices.begin(), ptr_arrayidx12_i_132_indices.end(), "arrayidx12.i", label_forbody_i_112);
- LoadInst* float_tmp13_i_133 = new LoadInst(ptr_arrayidx12_i_132, "tmp13.i", false, label_forbody_i_112);
- InsertElementInst* packed_tmp15_i_134 = new InsertElementInst(packed_tmp7_i_131, float_tmp13_i_133, const_int32_31, "tmp15.i", label_forbody_i_112);
- std::vector<Value*> ptr_arrayidx20_i_135_indices;
- ptr_arrayidx20_i_135_indices.push_back(int32_i_0_reg2mem_0_i_125);
- ptr_arrayidx20_i_135_indices.push_back(const_int32_33);
- Instruction* ptr_arrayidx20_i_135 = new GetElementPtrInst(ptr_aconsts_108, ptr_arrayidx20_i_135_indices.begin(), ptr_arrayidx20_i_135_indices.end(), "arrayidx20.i", label_forbody_i_112);
- LoadInst* float_tmp21_i_136 = new LoadInst(ptr_arrayidx20_i_135, "tmp21.i", false, label_forbody_i_112);
- InsertElementInst* packed_tmp23_i_137 = new InsertElementInst(packed_tmp15_i_134, float_tmp21_i_136, const_int32_33, "tmp23.i", label_forbody_i_112);
- std::vector<Value*> ptr_arrayidx28_i_138_indices;
- ptr_arrayidx28_i_138_indices.push_back(int32_i_0_reg2mem_0_i_125);
- ptr_arrayidx28_i_138_indices.push_back(const_int32_34);
- Instruction* ptr_arrayidx28_i_138 = new GetElementPtrInst(ptr_aconsts_108, ptr_arrayidx28_i_138_indices.begin(), ptr_arrayidx28_i_138_indices.end(), "arrayidx28.i", label_forbody_i_112);
- LoadInst* float_tmp29_i_139 = new LoadInst(ptr_arrayidx28_i_138, "tmp29.i", false, label_forbody_i_112);
- InsertElementInst* packed_tmp31_i_140 = new InsertElementInst(packed_tmp23_i_137, float_tmp29_i_139, const_int32_34, "tmp31.i", label_forbody_i_112);
- std::vector<Value*> ptr_arrayidx34_i_141_indices;
- ptr_arrayidx34_i_141_indices.push_back(const_int32_29);
- ptr_arrayidx34_i_141_indices.push_back(int32_i_0_reg2mem_0_i_125);
- Instruction* ptr_arrayidx34_i_141 = new GetElementPtrInst(ptr_consts_114, ptr_arrayidx34_i_141_indices.begin(), ptr_arrayidx34_i_141_indices.end(), "arrayidx34.i", label_forbody_i_112);
- StoreInst* void_142 = new StoreInst(packed_tmp31_i_140, ptr_arrayidx34_i_141, false, label_forbody_i_112);
- BinaryOperator* int32_indvar_next7 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i_125, const_int32_31, "indvar.next7", label_forbody_i_112);
- ICmpInst* int1_exitcond8 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next7, int32_tmp10_i_123, "exitcond8", label_forbody_i_112);
- new BranchInst(label_from_consts_exit_113, label_forbody_i_112, int1_exitcond8, label_forbody_i_112);
-
- // Block from_consts.exit (label_from_consts_exit_113)
- std::vector<Value*> ptr_tmp3_indices;
- ptr_tmp3_indices.push_back(const_int32_29);
- ptr_tmp3_indices.push_back(const_int32_34);
- Instruction* ptr_tmp3 = new GetElementPtrInst(ptr_args_116, ptr_tmp3_indices.begin(), ptr_tmp3_indices.end(), "tmp3", label_from_consts_exit_113);
- std::vector<Value*> ptr_arraydecay4_indices;
- ptr_arraydecay4_indices.push_back(const_int32_29);
- ptr_arraydecay4_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay4 = new GetElementPtrInst(ptr_consts_114, ptr_arraydecay4_indices.begin(), ptr_arraydecay4_indices.end(), "arraydecay4", label_from_consts_exit_113);
- StoreInst* void_144 = new StoreInst(ptr_arraydecay4, ptr_tmp3, false, label_from_consts_exit_113);
- std::vector<Value*> ptr_tmp5_indices;
- ptr_tmp5_indices.push_back(const_int32_29);
- ptr_tmp5_indices.push_back(const_int32_33);
- Instruction* ptr_tmp5 = new GetElementPtrInst(ptr_args_116, ptr_tmp5_indices.begin(), ptr_tmp5_indices.end(), "tmp5", label_from_consts_exit_113);
- std::vector<Value*> ptr_arraydecay6_indices;
- ptr_arraydecay6_indices.push_back(const_int32_29);
- ptr_arraydecay6_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay6 = new GetElementPtrInst(ptr_temps_115, ptr_arraydecay6_indices.begin(), ptr_arraydecay6_indices.end(), "arraydecay6", label_from_consts_exit_113);
- StoreInst* void_145 = new StoreInst(ptr_arraydecay6, ptr_tmp5, false, label_from_consts_exit_113);
- std::vector<Value*> ptr_tmp8_indices;
- ptr_tmp8_indices.push_back(const_int32_29);
- ptr_tmp8_indices.push_back(const_int32_31);
- Instruction* ptr_tmp8 = new GetElementPtrInst(ptr_args_116, ptr_tmp8_indices.begin(), ptr_tmp8_indices.end(), "tmp8", label_from_consts_exit_113);
- std::vector<Value*> ptr_tmp12_indices;
- ptr_tmp12_indices.push_back(const_int32_29);
- ptr_tmp12_indices.push_back(const_int32_29);
- Instruction* ptr_tmp12 = new GetElementPtrInst(ptr_args_116, ptr_tmp12_indices.begin(), ptr_tmp12_indices.end(), "tmp12", label_from_consts_exit_113);
- std::vector<Value*> ptr_arraydecay11_146_indices;
- ptr_arraydecay11_146_indices.push_back(const_int32_29);
- ptr_arraydecay11_146_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay11_146 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_146_indices.begin(), ptr_arraydecay11_146_indices.end(), "arraydecay11", label_from_consts_exit_113);
- StoreInst* void_147 = new StoreInst(ptr_arraydecay11_146, ptr_tmp8, false, label_from_consts_exit_113);
- std::vector<Value*> ptr_arraydecay16_indices;
- ptr_arraydecay16_indices.push_back(const_int32_29);
- ptr_arraydecay16_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay16 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_indices.begin(), ptr_arraydecay16_indices.end(), "arraydecay16", label_from_consts_exit_113);
- StoreInst* void_148 = new StoreInst(ptr_arraydecay16, ptr_tmp12, false, label_from_consts_exit_113);
- StoreInst* void_149 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113);
- CallInst* void_150 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113);
- void_150->setCallingConv(CallingConv::C);
- void_150->setTailCall(false);const ParamAttrsList *void_150_PAL = 0;
- void_150->setParamAttrs(void_150_PAL);
-
- LoadInst* int32_tmp23 = new LoadInst(ptr_tmp_117, "tmp23", false, label_from_consts_exit_113);
- std::vector<Value*> ptr_arraydecay11_1_indices;
- ptr_arraydecay11_1_indices.push_back(const_int32_31);
- ptr_arraydecay11_1_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay11_1 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_1_indices.begin(), ptr_arraydecay11_1_indices.end(), "arraydecay11.1", label_from_consts_exit_113);
- StoreInst* void_151 = new StoreInst(ptr_arraydecay11_1, ptr_tmp8, false, label_from_consts_exit_113);
- std::vector<Value*> ptr_arraydecay16_1_indices;
- ptr_arraydecay16_1_indices.push_back(const_int32_31);
- ptr_arraydecay16_1_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay16_1 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_1_indices.begin(), ptr_arraydecay16_1_indices.end(), "arraydecay16.1", label_from_consts_exit_113);
- StoreInst* void_152 = new StoreInst(ptr_arraydecay16_1, ptr_tmp12, false, label_from_consts_exit_113);
- StoreInst* void_153 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113);
- CallInst* void_154 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113);
- void_154->setCallingConv(CallingConv::C);
- void_154->setTailCall(false);const ParamAttrsList *void_154_PAL = 0;
- void_154->setParamAttrs(void_154_PAL);
-
- LoadInst* int32_tmp23_1 = new LoadInst(ptr_tmp_117, "tmp23.1", false, label_from_consts_exit_113);
- BinaryOperator* int32_shl_1 = BinaryOperator::create(Instruction::Shl, int32_tmp23_1, const_int32_31, "shl.1", label_from_consts_exit_113);
- BinaryOperator* int32_or_1 = BinaryOperator::create(Instruction::Or, int32_shl_1, int32_tmp23, "or.1", label_from_consts_exit_113);
- std::vector<Value*> ptr_arraydecay11_2_indices;
- ptr_arraydecay11_2_indices.push_back(const_int32_33);
- ptr_arraydecay11_2_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay11_2 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_2_indices.begin(), ptr_arraydecay11_2_indices.end(), "arraydecay11.2", label_from_consts_exit_113);
- StoreInst* void_155 = new StoreInst(ptr_arraydecay11_2, ptr_tmp8, false, label_from_consts_exit_113);
- std::vector<Value*> ptr_arraydecay16_2_indices;
- ptr_arraydecay16_2_indices.push_back(const_int32_33);
- ptr_arraydecay16_2_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay16_2 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_2_indices.begin(), ptr_arraydecay16_2_indices.end(), "arraydecay16.2", label_from_consts_exit_113);
- StoreInst* void_156 = new StoreInst(ptr_arraydecay16_2, ptr_tmp12, false, label_from_consts_exit_113);
- StoreInst* void_157 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113);
- CallInst* void_158 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113);
- void_158->setCallingConv(CallingConv::C);
- void_158->setTailCall(false);const ParamAttrsList *void_158_PAL = 0;
- void_158->setParamAttrs(void_158_PAL);
-
- LoadInst* int32_tmp23_2 = new LoadInst(ptr_tmp_117, "tmp23.2", false, label_from_consts_exit_113);
- BinaryOperator* int32_shl_2 = BinaryOperator::create(Instruction::Shl, int32_tmp23_2, const_int32_33, "shl.2", label_from_consts_exit_113);
- BinaryOperator* int32_or_2 = BinaryOperator::create(Instruction::Or, int32_shl_2, int32_or_1, "or.2", label_from_consts_exit_113);
- std::vector<Value*> ptr_arraydecay11_3_indices;
- ptr_arraydecay11_3_indices.push_back(const_int32_34);
- ptr_arraydecay11_3_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay11_3 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_3_indices.begin(), ptr_arraydecay11_3_indices.end(), "arraydecay11.3", label_from_consts_exit_113);
- StoreInst* void_159 = new StoreInst(ptr_arraydecay11_3, ptr_tmp8, false, label_from_consts_exit_113);
- std::vector<Value*> ptr_arraydecay16_3_indices;
- ptr_arraydecay16_3_indices.push_back(const_int32_34);
- ptr_arraydecay16_3_indices.push_back(const_int32_29);
- Instruction* ptr_arraydecay16_3 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_3_indices.begin(), ptr_arraydecay16_3_indices.end(), "arraydecay16.3", label_from_consts_exit_113);
- StoreInst* void_160 = new StoreInst(ptr_arraydecay16_3, ptr_tmp12, false, label_from_consts_exit_113);
- StoreInst* void_161 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113);
- CallInst* void_162 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113);
- void_162->setCallingConv(CallingConv::C);
- void_162->setTailCall(false);const ParamAttrsList *void_162_PAL = 0;
- void_162->setParamAttrs(void_162_PAL);
-
- LoadInst* int32_tmp23_3 = new LoadInst(ptr_tmp_117, "tmp23.3", false, label_from_consts_exit_113);
- BinaryOperator* int32_shl_3 = BinaryOperator::create(Instruction::Shl, int32_tmp23_3, const_int32_34, "shl.3", label_from_consts_exit_113);
- BinaryOperator* int32_or_3 = BinaryOperator::create(Instruction::Or, int32_shl_3, int32_or_2, "or.3", label_from_consts_exit_113);
- BinaryOperator* int32_neg = BinaryOperator::create(Instruction::Xor, int32_or_3, const_int32_30, "neg", label_from_consts_exit_113);
- new ReturnInst(int32_neg, label_from_consts_exit_113);
-
- // Resolve Forward References
- fwdref_128->replaceAllUsesWith(packed_tmp31_i_140); delete fwdref_128;
- fwdref_126->replaceAllUsesWith(int32_indvar_next7); delete fwdref_126;
-
- }
-
- return mod;
-}
diff --git a/src/mesa/pipe/llvm/llvm_entry.c b/src/mesa/pipe/llvm/llvm_entry.c
deleted file mode 100644
index fa50b60e663..00000000000
--- a/src/mesa/pipe/llvm/llvm_entry.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* clang --emit-llvm llvm_entry.c |llvm-as |opt -std-compile-opts |llvm2cpp -for=Shader -gen-module -funcname=createBaseShader */
-/**************************************************************************
- *
- * 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:
- * Zack Rusin [email protected]
- */
-
-/* clang --emit-llvm llvm_builtins.c |llvm-as |opt -std-compile-opts |llvm-dis */
-typedef __attribute__(( ocu_vector_type(4) )) float float4;
-
-void from_array(float4 (*res)[16], float (*ainputs)[16][4],
- int count, int num_attribs)
-{
- for (int i = 0; i < count; ++i) {
- for (int j = 0; j < num_attribs; ++j) {
- float4 vec;
- vec.x = ainputs[i][j][0];
- vec.y = ainputs[i][j][1];
- vec.z = ainputs[i][j][2];
- vec.w = ainputs[i][j][3];
- res[i][j] = vec;
- }
- }
-}
-
-void from_consts(float4 *res, float (*ainputs)[4],
- int count)
-{
- for (int i = 0; i < count; ++i) {
- float4 vec;
- vec.x = ainputs[i][0];
- vec.y = ainputs[i][1];
- vec.z = ainputs[i][2];
- vec.w = ainputs[i][3];
- res[i] = vec;
- }
-}
-
-void to_array(float (*dests)[4], float4 *in, int num_attribs)
-{
- for (int i = 0; i < num_attribs; ++i) {
- float *rd = dests[i];
- float4 ri = in[i];
- rd[0] = ri.x;
- rd[1] = ri.y;
- rd[2] = ri.z;
- rd[3] = ri.w;
- }
-}
-
-
-struct ShaderInput
-{
- float4 *dests;
- float4 *inputs;
- float4 *temps;
- float4 *consts;
- int kilmask;
-};
-
-extern void execute_shader(struct ShaderInput *input);
-
-void run_vertex_shader(void *inputs,
- void *results,
- float (*aconsts)[4],
- int num_vertices,
- int num_inputs,
- int num_attribs,
- int num_consts)
-{
- float4 consts[32];
- float4 temps[128];//MAX_PROGRAM_TEMPS
-
- struct ShaderInput args;
- args.dests = results;
- args.inputs = inputs;
-
- /*printf("XXX LLVM run_vertex_shader vertices = %d, inputs = %d, attribs = %d, consts = %d\n",
- num_vertices, num_inputs, num_attribs, num_consts);*/
- from_consts(consts, aconsts, num_consts);
- args.consts = consts;
- args.temps = temps;
-
- execute_shader(&args);
-}
-
-
-struct pipe_sampler_state;
-struct softpipe_tile_cache;
-
-#define NUM_CHANNELS 4 /* R,G,B,A */
-#define QUAD_SIZE 4 /* 4 pixel/quad */
-
-struct tgsi_sampler
-{
- const struct pipe_sampler_state *state;
- /** Get samples for four fragments in a quad */
- void (*get_samples)(struct tgsi_sampler *sampler,
- const float s[QUAD_SIZE],
- const float t[QUAD_SIZE],
- const float p[QUAD_SIZE],
- float lodbias,
- float rgba[NUM_CHANNELS][QUAD_SIZE]);
- void *pipe; /*XXX temporary*/
- struct softpipe_tile_cache *cache;
-};
-
-
-int run_fragment_shader(float x, float y,
- float4 (*results)[16],
- float4 (*inputs)[16],
- int num_inputs,
- float (*aconsts)[4],
- int num_consts,
- struct tgsi_sampler *samplers)
-{
- float4 consts[32];
- float4 temps[128];//MAX_PROGRAM_TEMPS
- struct ShaderInput args;
- int mask = 0;
- args.kilmask = 0;
-
- from_consts(consts, aconsts, num_consts);
- args.consts = consts;
- args.temps = temps;
- //printf("AAAAAAAAAAAAAAAAAAAAAAA FRAGMENT SHADER %f %f\n", x, y);
- for (int i = 0; i < 4; ++i) {
- args.inputs = inputs[i];
- args.dests = results[i];
- mask = args.kilmask;
- args.kilmask = 0;
- execute_shader(&args);
- args.kilmask = mask | (args.kilmask << i);
- }
- return ~args.kilmask;
-}
-
diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp
deleted file mode 100644
index b2aca3557a9..00000000000
--- a/src/mesa/pipe/llvm/storagesoa.cpp
+++ /dev/null
@@ -1,117 +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 "storagesoa.h"
-
-
-#include "pipe/p_shader_tokens.h"
-#include <llvm/BasicBlock.h>
-#include <llvm/Module.h>
-#include <llvm/Value.h>
-
-#include <llvm/CallingConv.h>
-#include <llvm/Constants.h>
-#include <llvm/DerivedTypes.h>
-#include <llvm/InstrTypes.h>
-#include <llvm/Instructions.h>
-
-using namespace llvm;
-
-StorageSoa::StorageSoa(llvm::BasicBlock *block,
- llvm::Value *input,
- llvm::Value *output,
- llvm::Value *consts)
-{
-}
-
-void StorageSoa::addImmediate(float *vec)
-{
-}
-
-llvm::Value *StorageSoa::addrElement(int idx) const
-{
- return 0;
-}
-
-std::vector<llvm::Value*> StorageSoa::inputElement(int idx, int swizzle,
- llvm::Value *indIdx)
-{
- std::vector<llvm::Value*> res(4);
-
- return res;
-}
-
-std::vector<llvm::Value*> StorageSoa::constElement(int idx, int swizzle,
- llvm::Value *indIdx)
-{
- std::vector<llvm::Value*> res(4);
-
- return res;
-}
-
-std::vector<llvm::Value*> StorageSoa::outputElement(int idx, int swizzle,
- llvm::Value *indIdx)
-{
- std::vector<llvm::Value*> res(4);
-
- return res;
-}
-
-std::vector<llvm::Value*> StorageSoa::tempElement(int idx, int swizzle,
- llvm::Value *indIdx)
-{
- std::vector<llvm::Value*> res(4);
-
- return res;
-}
-
-std::vector<llvm::Value*> StorageSoa::immediateElement(int idx, int swizzle)
-{
- std::vector<llvm::Value*> res(4);
-
- return res;
-}
-
-llvm::Value * StorageSoa::extractIndex(llvm::Value *vec)
-{
- return 0;
-}
-
-void StorageSoa::storeOutput(int dstIdx, const std::vector<llvm::Value*> &val,
- int mask)
-{
-}
-
-void StorageSoa::storeTemp(int idx, const std::vector<llvm::Value*> &val,
- int mask)
-{
-}
-
-void StorageSoa::storeAddress(int idx, const std::vector<llvm::Value*> &val,
- int mask)
-{
-}
diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c
deleted file mode 100644
index 39c3e1afe10..00000000000
--- a/src/mesa/pipe/softpipe/sp_state_derived.c
+++ /dev/null
@@ -1,190 +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_util.h"
-#include "pipe/p_shader_tokens.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/draw/draw_vertex.h"
-#include "pipe/draw/draw_private.h"
-#include "sp_context.h"
-#include "sp_state.h"
-
-
-static int
-find_vs_output(const struct pipe_shader_state *vs,
- uint semantic_name,
- uint semantic_index)
-{
- uint i;
- for (i = 0; i < vs->num_outputs; i++) {
- if (vs->output_semantic_name[i] == semantic_name &&
- vs->output_semantic_index[i] == semantic_index)
- return i;
- }
- return -1;
-}
-
-
-
-/**
- * Determine how to map vertex program outputs to fragment program inputs.
- * Basically, this will be used when computing the triangle interpolation
- * coefficients from the post-transform vertex attributes.
- */
-static void calculate_vertex_layout( struct softpipe_context *softpipe )
-{
- const struct pipe_shader_state *vs = &softpipe->vs->shader;
- const struct pipe_shader_state *fs = &softpipe->fs->shader;
- const enum interp_mode colorInterp
- = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
- struct vertex_info *vinfo = &softpipe->vertex_info;
- uint i;
-
- if (softpipe->vbuf) {
- /* if using the post-transform vertex buffer, tell draw_vbuf to
- * simply emit the whole post-xform vertex as-is:
- */
- struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf;
- vinfo_vbuf->num_attribs = 0;
- draw_emit_vertex_attr(vinfo_vbuf, EMIT_ALL, INTERP_NONE, 0);
- vinfo_vbuf->size = 4 * vs->num_outputs + sizeof(struct vertex_header)/4;
- }
-
- /*
- * Loop over fragment shader inputs, searching for the matching output
- * from the vertex shader.
- */
- vinfo->num_attribs = 0;
- for (i = 0; i < fs->num_inputs; i++) {
- int src;
- switch (fs->input_semantic_name[i]) {
- case TGSI_SEMANTIC_POSITION:
- src = find_vs_output(vs, TGSI_SEMANTIC_POSITION, 0);
- assert(src >= 0);
- draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, src);
- break;
-
- case TGSI_SEMANTIC_COLOR:
- src = find_vs_output(vs, TGSI_SEMANTIC_COLOR,
- fs->input_semantic_index[i]);
- assert(src >= 0);
- draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src);
- break;
-
- case TGSI_SEMANTIC_FOG:
- src = find_vs_output(vs, TGSI_SEMANTIC_FOG, 0);
-#if 1
- if (src < 0) /* XXX temp hack, try demos/fogcoord.c with this */
- src = 0;
-#endif
- assert(src >= 0);
- draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src);
- break;
-
- case TGSI_SEMANTIC_GENERIC:
- /* this includes texcoords and varying vars */
- src = find_vs_output(vs, TGSI_SEMANTIC_GENERIC,
- fs->input_semantic_index[i]);
- assert(src >= 0);
- draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src);
- break;
-
- default:
- assert(0);
- }
- }
-
- softpipe->psize_slot = find_vs_output(vs, TGSI_SEMANTIC_PSIZE, 0);
- if (softpipe->psize_slot >= 0) {
- draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT,
- softpipe->psize_slot);
- }
-
- draw_compute_vertex_size(vinfo);
-}
-
-
-/**
- * Recompute cliprect from scissor bounds, scissor enable and surface size.
- */
-static void
-compute_cliprect(struct softpipe_context *sp)
-{
- unsigned surfWidth, surfHeight;
-
- if (sp->framebuffer.num_cbufs > 0) {
- surfWidth = sp->framebuffer.cbufs[0]->width;
- surfHeight = sp->framebuffer.cbufs[0]->height;
- }
- else {
- /* no surface? */
- surfWidth = sp->scissor.maxx;
- surfHeight = sp->scissor.maxy;
- }
-
- if (sp->rasterizer->scissor) {
- /* clip to scissor rect */
- sp->cliprect.minx = MAX2(sp->scissor.minx, 0);
- sp->cliprect.miny = MAX2(sp->scissor.miny, 0);
- sp->cliprect.maxx = MIN2(sp->scissor.maxx, surfWidth);
- sp->cliprect.maxy = MIN2(sp->scissor.maxy, surfHeight);
- }
- else {
- /* clip to surface bounds */
- sp->cliprect.minx = 0;
- sp->cliprect.miny = 0;
- sp->cliprect.maxx = surfWidth;
- sp->cliprect.maxy = surfHeight;
- }
-}
-
-
-/* Hopefully this will remain quite simple, otherwise need to pull in
- * something like the state tracker mechanism.
- */
-void softpipe_update_derived( struct softpipe_context *softpipe )
-{
- if (softpipe->dirty & (SP_NEW_RASTERIZER |
- SP_NEW_FS |
- SP_NEW_VS))
- calculate_vertex_layout( softpipe );
-
- if (softpipe->dirty & (SP_NEW_SCISSOR |
- SP_NEW_DEPTH_STENCIL_ALPHA |
- SP_NEW_FRAMEBUFFER))
- compute_cliprect(softpipe);
-
- if (softpipe->dirty & (SP_NEW_BLEND |
- SP_NEW_DEPTH_STENCIL_ALPHA |
- SP_NEW_FRAMEBUFFER |
- SP_NEW_RASTERIZER |
- SP_NEW_FS |
- SP_NEW_QUERY))
- sp_build_quad_pipeline(softpipe);
-
- softpipe->dirty = 0;
-}
diff --git a/src/mesa/ppc/rtasm/spe_asm.c b/src/mesa/ppc/rtasm/spe_asm.c
new file mode 100644
index 00000000000..10376372502
--- /dev/null
+++ b/src/mesa/ppc/rtasm/spe_asm.c
@@ -0,0 +1,385 @@
+/*
+ * (C) Copyright IBM Corporation 2008
+ * 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
+ * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file spe_asm.c
+ * Real-time assembly generation interface for Cell B.E. SPEs.
+ *
+ * \author Ian Romanick <[email protected]>
+ */
+#ifdef GALLIUM_CELL
+#include <inttypes.h>
+#include <imports.h>
+#include "spe_asm.h"
+
+/**
+ * SPE instruction types
+ *
+ * There are 6 primary instruction encodings used on the Cell's SPEs. Each of
+ * the following unions encodes one type.
+ *
+ * \bug
+ * If, at some point, we start generating SPE code from a little-endian host
+ * these unions will not work.
+ */
+/*@{*/
+/**
+ * Encode one output register with two input registers
+ */
+union spe_inst_RR {
+ uint32_t bits;
+ struct {
+ unsigned op:11;
+ unsigned rB:7;
+ unsigned rA:7;
+ unsigned rT:7;
+ } inst;
+};
+
+
+/**
+ * Encode one output register with three input registers
+ */
+union spe_inst_RRR {
+ uint32_t bits;
+ struct {
+ unsigned op:4;
+ unsigned rT:7;
+ unsigned rB:7;
+ unsigned rA:7;
+ unsigned rC:7;
+ } inst;
+};
+
+
+/**
+ * Encode one output register with one input reg. and a 7-bit signed immed
+ */
+union spe_inst_RI7 {
+ uint32_t bits;
+ struct {
+ unsigned op:11;
+ unsigned i7:7;
+ unsigned rA:7;
+ unsigned rT:7;
+ } inst;
+};
+
+
+/**
+ * Encode one output register with one input reg. and an 8-bit signed immed
+ */
+union spe_inst_RI8 {
+ uint32_t bits;
+ struct {
+ unsigned op:10;
+ unsigned i8:8;
+ unsigned rA:7;
+ unsigned rT:7;
+ } inst;
+};
+
+
+/**
+ * Encode one output register with one input reg. and a 10-bit signed immed
+ */
+union spe_inst_RI10 {
+ uint32_t bits;
+ struct {
+ unsigned op:8;
+ unsigned i10:10;
+ unsigned rA:7;
+ unsigned rT:7;
+ } inst;
+};
+
+
+/**
+ * Encode one output register with a 16-bit signed immediate
+ */
+union spe_inst_RI16 {
+ uint32_t bits;
+ struct {
+ unsigned op:9;
+ unsigned i16:16;
+ unsigned rT:7;
+ } inst;
+};
+
+
+/**
+ * Encode one output register with a 18-bit signed immediate
+ */
+union spe_inst_RI18 {
+ uint32_t bits;
+ struct {
+ unsigned op:7;
+ unsigned i18:18;
+ unsigned rT:7;
+ } inst;
+};
+/*@}*/
+
+
+static void emit_RR(struct spe_function *p, unsigned op, unsigned rT,
+ unsigned rA, unsigned rB)
+{
+ union spe_inst_RR inst;
+ inst.inst.op = op;
+ inst.inst.rB = rB;
+ inst.inst.rA = rA;
+ inst.inst.rT = rT;
+ *p->csr = inst.bits;
+ p->csr++;
+}
+
+
+static void emit_RRR(struct spe_function *p, unsigned op, unsigned rT,
+ unsigned rA, unsigned rB, unsigned rC)
+{
+ union spe_inst_RRR inst;
+ inst.inst.op = op;
+ inst.inst.rT = rT;
+ inst.inst.rB = rB;
+ inst.inst.rA = rA;
+ inst.inst.rC = rC;
+ *p->csr = inst.bits;
+ p->csr++;
+}
+
+
+static void emit_RI7(struct spe_function *p, unsigned op, unsigned rT,
+ unsigned rA, int imm)
+{
+ union spe_inst_RI7 inst;
+ inst.inst.op = op;
+ inst.inst.i7 = imm;
+ inst.inst.rA = rA;
+ inst.inst.rT = rT;
+ *p->csr = inst.bits;
+ p->csr++;
+}
+
+
+
+static void emit_RI8(struct spe_function *p, unsigned op, unsigned rT,
+ unsigned rA, int imm)
+{
+ union spe_inst_RI8 inst;
+ inst.inst.op = op;
+ inst.inst.i8 = imm;
+ inst.inst.rA = rA;
+ inst.inst.rT = rT;
+ *p->csr = inst.bits;
+ p->csr++;
+}
+
+
+
+static void emit_RI10(struct spe_function *p, unsigned op, unsigned rT,
+ unsigned rA, int imm)
+{
+ union spe_inst_RI10 inst;
+ inst.inst.op = op;
+ inst.inst.i10 = imm;
+ inst.inst.rA = rA;
+ inst.inst.rT = rT;
+ *p->csr = inst.bits;
+ p->csr++;
+}
+
+
+static void emit_RI16(struct spe_function *p, unsigned op, unsigned rT,
+ int imm)
+{
+ union spe_inst_RI16 inst;
+ inst.inst.op = op;
+ inst.inst.i16 = imm;
+ inst.inst.rT = rT;
+ *p->csr = inst.bits;
+ p->csr++;
+}
+
+
+static void emit_RI18(struct spe_function *p, unsigned op, unsigned rT,
+ int imm)
+{
+ union spe_inst_RI18 inst;
+ inst.inst.op = op;
+ inst.inst.i18 = imm;
+ inst.inst.rT = rT;
+ *p->csr = inst.bits;
+ p->csr++;
+}
+
+
+
+
+#define EMIT_(_name, _op) \
+void _name (struct spe_function *p, unsigned rT) \
+{ \
+ emit_RR(p, _op, rT, 0, 0); \
+}
+
+#define EMIT_R(_name, _op) \
+void _name (struct spe_function *p, unsigned rT, unsigned rA) \
+{ \
+ emit_RR(p, _op, rT, rA, 0); \
+}
+
+#define EMIT_RR(_name, _op) \
+void _name (struct spe_function *p, unsigned rT, unsigned rA, unsigned rB) \
+{ \
+ emit_RR(p, _op, rT, rA, rB); \
+}
+
+#define EMIT_RRR(_name, _op) \
+void _name (struct spe_function *p, unsigned rT, unsigned rA, unsigned rB, unsigned rC) \
+{ \
+ emit_RRR(p, _op, rT, rA, rB, rC); \
+}
+
+#define EMIT_RI7(_name, _op) \
+void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \
+{ \
+ emit_RI7(p, _op, rT, rA, imm); \
+}
+
+#define EMIT_RI8(_name, _op) \
+void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \
+{ \
+ emit_RI8(p, _op, rT, rA, 155 - imm); \
+}
+
+#define EMIT_RI10(_name, _op) \
+void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \
+{ \
+ emit_RI10(p, _op, rT, rA, imm); \
+}
+
+#define EMIT_RI16(_name, _op) \
+void _name (struct spe_function *p, unsigned rT, int imm) \
+{ \
+ emit_RI16(p, _op, rT, imm); \
+}
+
+#define EMIT_RI18(_name, _op) \
+void _name (struct spe_function *p, unsigned rT, int imm) \
+{ \
+ emit_RI18(p, _op, rT, imm); \
+}
+
+#define EMIT_I16(_name, _op) \
+void _name (struct spe_function *p, int imm) \
+{ \
+ emit_RI16(p, _op, 0, imm); \
+}
+
+#include "spe_asm.h"
+
+
+/*
+ */
+void spe_init_func(struct spe_function *p, unsigned code_size)
+{
+ p->store = _mesa_align_malloc(code_size, 16);
+ p->csr = p->store;
+}
+
+
+void spe_release_func(struct spe_function *p)
+{
+ _mesa_align_free(p->store);
+ p->store = NULL;
+ p->csr = NULL;
+}
+
+
+void spe_bi(struct spe_function *p, unsigned rA, int d, int e)
+{
+ emit_RI7(p, 0x1a8, 0, rA, (d << 5) | (e << 4));
+}
+
+void spe_iret(struct spe_function *p, unsigned rA, int d, int e)
+{
+ emit_RI7(p, 0x1aa, 0, rA, (d << 5) | (e << 4));
+}
+
+void spe_bisled(struct spe_function *p, unsigned rT, unsigned rA, int d,
+ int e)
+{
+ emit_RI7(p, 0x1ab, rT, rA, (d << 5) | (e << 4));
+}
+
+void spe_bisl(struct spe_function *p, unsigned rT, unsigned rA, int d,
+ int e)
+{
+ emit_RI7(p, 0x1a9, rT, rA, (d << 5) | (e << 4));
+}
+
+void spe_biz(struct spe_function *p, unsigned rT, unsigned rA, int d,
+ int e)
+{
+ emit_RI7(p, 0x128, rT, rA, (d << 5) | (e << 4));
+}
+
+void spe_binz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e)
+{
+ emit_RI7(p, 0x129, rT, rA, (d << 5) | (e << 4));
+}
+
+void spe_bihz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e)
+{
+ emit_RI7(p, 0x12a, rT, rA, (d << 5) | (e << 4));
+}
+
+void spe_bihnz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e)
+{
+ emit_RI7(p, 0x12b, rT, rA, (d << 5) | (e << 4));
+}
+
+
+/* Hint-for-branch instructions
+ */
+#if 0
+hbr;
+hbra;
+hbrr;
+#endif
+
+
+/* Control instructions
+ */
+#if 0
+stop;
+EMIT_RR (spe_stopd, 0x140);
+EMIT_ (spe_lnop, 0x001);
+EMIT_ (spe_nop, 0x201);
+sync;
+EMIT_ (spe_dsync, 0x003);
+EMIT_R (spe_mfspr, 0x00c);
+EMIT_R (spe_mtspr, 0x10c);
+#endif
+
+#endif /* GALLIUM_CELL */
diff --git a/src/mesa/ppc/rtasm/spe_asm.h b/src/mesa/ppc/rtasm/spe_asm.h
new file mode 100644
index 00000000000..6d69ae655d1
--- /dev/null
+++ b/src/mesa/ppc/rtasm/spe_asm.h
@@ -0,0 +1,314 @@
+/*
+ * (C) Copyright IBM Corporation 2008
+ * 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
+ * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file spe_asm.h
+ * Real-time assembly generation interface for Cell B.E. SPEs.
+ *
+ * \author Ian Romanick <[email protected]>
+ */
+
+#ifndef SPE_ASM_H
+#define SPE_ASM_H
+
+struct spe_function {
+ /**
+ *
+ */
+ uint32_t *store;
+ uint32_t *csr;
+ const char *fn;
+};
+
+extern void spe_init_func(struct spe_function *p, unsigned code_size);
+extern void spe_release_func(struct spe_function *p);
+
+#endif /* SPE_ASM_H */
+
+#ifndef EMIT_
+#define EMIT_(name, _op) \
+ extern void _name (struct spe_function *p, unsigned rT)
+#define EMIT_R(_name, _op) \
+ extern void _name (struct spe_function *p, unsigned rT, unsigned rA)
+#define EMIT_RR(_name, _op) \
+ extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
+ unsigned rB)
+#define EMIT_RRR(_name, _op) \
+ extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
+ unsigned rB, unsigned rC)
+#define EMIT_RI7(_name, _op) \
+ extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
+ int imm)
+#define EMIT_RI8(_name, _op) \
+ extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
+ int imm)
+#define EMIT_RI10(_name, _op) \
+ extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
+ int imm)
+#define EMIT_RI16(_name, _op) \
+ extern void _name (struct spe_function *p, unsigned rT, int imm)
+#define EMIT_RI18(_name, _op) \
+ extern void _name (struct spe_function *p, unsigned rT, int imm)
+#define EMIT_I16(_name, _op) \
+ extern void _name (struct spe_function *p, int imm)
+#define UNDEF_EMIT_MACROS
+#endif /* EMIT_ */
+
+
+/* Memory load / store instructions
+ */
+EMIT_RI10(spe_lqd, 0x034);
+EMIT_RR (spe_lqx, 0x1c4);
+EMIT_RI16(spe_lqa, 0x061);
+EMIT_RI16(spe_lqr, 0x067);
+EMIT_RI10(spe_stqd, 0x024);
+EMIT_RR (spe_stqx, 0x144);
+EMIT_RI16(spe_stqa, 0x041);
+EMIT_RI16(spe_stqr, 0x047);
+EMIT_RI7 (spe_cbd, 0x1f4);
+EMIT_RR (spe_cbx, 0x1d4);
+EMIT_RI7 (spe_chd, 0x1f5);
+EMIT_RI7 (spe_chx, 0x1d5);
+EMIT_RI7 (spe_cwd, 0x1f6);
+EMIT_RI7 (spe_cwx, 0x1d6);
+EMIT_RI7 (spe_cdd, 0x1f7);
+EMIT_RI7 (spe_cdx, 0x1d7);
+
+
+/* Constant formation instructions
+ */
+EMIT_RI16(spe_ilh, 0x083);
+EMIT_RI16(spe_ilhu, 0x082);
+EMIT_RI16(spe_il, 0x081);
+EMIT_RI18(spe_ila, 0x021);
+EMIT_RI16(spe_iohl, 0x0c1);
+EMIT_RI16(spe_fsmbi, 0x0c5);
+
+
+/* Integer and logical instructions
+ */
+EMIT_RR (spe_ah, 0x0c8);
+EMIT_RI10(spe_ahi, 0x01d);
+EMIT_RR (spe_a, 0x0c0);
+EMIT_RI10(spe_ai, 0x01c);
+EMIT_RR (spe_sfh, 0x048);
+EMIT_RI10(spe_sfhi, 0x00d);
+EMIT_RR (spe_sf, 0x040);
+EMIT_RI10(spe_sfi, 0x00c);
+EMIT_RR (spe_addx, 0x340);
+EMIT_RR (spe_cg, 0x0c2);
+EMIT_RR (spe_cgx, 0x342);
+EMIT_RR (spe_sfx, 0x341);
+EMIT_RR (spe_bg, 0x042);
+EMIT_RR (spe_bgx, 0x343);
+EMIT_RR (spe_mpy, 0x3c4);
+EMIT_RR (spe_mpyu, 0x3cc);
+EMIT_RI10(spe_mpyi, 0x074);
+EMIT_RI10(spe_mpyui, 0x075);
+EMIT_RRR (spe_mpya, 0x00c);
+EMIT_RR (spe_mpyh, 0x3c5);
+EMIT_RR (spe_mpys, 0x3c7);
+EMIT_RR (spe_mpyhh, 0x3c6);
+EMIT_RR (spe_mpyhha, 0x346);
+EMIT_RR (spe_mpyhhu, 0x3ce);
+EMIT_RR (spe_mpyhhau, 0x34e);
+EMIT_R (spe_clz, 0x2a5);
+EMIT_R (spe_cntb, 0x2b4);
+EMIT_R (spe_fsmb, 0x1b6);
+EMIT_R (spe_fsmh, 0x1b5);
+EMIT_R (spe_fsm, 0x1b4);
+EMIT_R (spe_gbb, 0x1b2);
+EMIT_R (spe_gbh, 0x1b1);
+EMIT_R (spe_gb, 0x1b0);
+EMIT_RR (spe_avgb, 0x0d3);
+EMIT_RR (spe_absdb, 0x053);
+EMIT_RR (spe_sumb, 0x253);
+EMIT_R (spe_xsbh, 0x2b6);
+EMIT_R (spe_xshw, 0x2ae);
+EMIT_R (spe_xswd, 0x2a6);
+EMIT_RR (spe_and, 0x0c1);
+EMIT_RR (spe_andc, 0x2c1);
+EMIT_RI10(spe_andbi, 0x016);
+EMIT_RI10(spe_andhi, 0x015);
+EMIT_RI10(spe_andi, 0x014);
+EMIT_RR (spe_or, 0x041);
+EMIT_RR (spe_orc, 0x2c9);
+EMIT_RI10(spe_orbi, 0x006);
+EMIT_RI10(spe_orhi, 0x005);
+EMIT_RI10(spe_ori, 0x004);
+EMIT_R (spe_orx, 0x1f0);
+EMIT_RR (spe_xor, 0x241);
+EMIT_RI10(spe_xorbi, 0x026);
+EMIT_RI10(spe_xorhi, 0x025);
+EMIT_RI10(spe_xori, 0x024);
+EMIT_RR (spe_nand, 0x0c9);
+EMIT_RR (spe_nor, 0x049);
+EMIT_RR (spe_eqv, 0x249);
+EMIT_RRR (spe_selb, 0x008);
+EMIT_RRR (spe_shufb, 0x00b);
+
+
+/* Shift and rotate instructions
+ */
+EMIT_RR (spe_shlh, 0x05f);
+EMIT_RI7 (spe_shlhi, 0x07f);
+EMIT_RR (spe_shl, 0x05b);
+EMIT_RI7 (spe_shli, 0x07b);
+EMIT_RR (spe_shlqbi, 0x1db);
+EMIT_RI7 (spe_shlqbii, 0x1fb);
+EMIT_RR (spe_shlqby, 0x1df);
+EMIT_RI7 (spe_shlqbyi, 0x1ff);
+EMIT_RR (spe_shlqbybi, 0x1cf);
+EMIT_RR (spe_roth, 0x05c);
+EMIT_RI7 (spe_rothi, 0x07c);
+EMIT_RR (spe_rot, 0x058);
+EMIT_RI7 (spe_roti, 0x078);
+EMIT_RR (spe_rotqby, 0x1dc);
+EMIT_RI7 (spe_rotqbyi, 0x1fc);
+EMIT_RR (spe_rotqbybi, 0x1cc);
+EMIT_RR (spe_rotqbi, 0x1d8);
+EMIT_RI7 (spe_rotqbii, 0x1f8);
+EMIT_RR (spe_rothm, 0x05d);
+EMIT_RI7 (spe_rothmi, 0x07d);
+EMIT_RR (spe_rotm, 0x059);
+EMIT_RI7 (spe_rotmi, 0x079);
+EMIT_RR (spe_rotqmby, 0x1dd);
+EMIT_RI7 (spe_rotqmbyi, 0x1fd);
+EMIT_RR (spe_rotqmbybi, 0x1cd);
+EMIT_RR (spe_rotqmbi, 0x1c9);
+EMIT_RI7 (spe_rotqmbii, 0x1f9);
+EMIT_RR (spe_rotmah, 0x05e);
+EMIT_RI7 (spe_rotmahi, 0x07e);
+EMIT_RR (spe_rotma, 0x05a);
+EMIT_RI7 (spe_rotmai, 0x07a);
+
+
+/* Compare, branch, and halt instructions
+ */
+EMIT_RR (spe_heq, 0x3d8);
+EMIT_RI10(spe_heqi, 0x07f);
+EMIT_RR (spe_hgt, 0x258);
+EMIT_RI10(spe_hgti, 0x04f);
+EMIT_RR (spe_hlgt, 0x2d8);
+EMIT_RI10(spe_hlgti, 0x05f);
+EMIT_RR (spe_ceqb, 0x3d0);
+EMIT_RI10(spe_ceqbi, 0x07e);
+EMIT_RR (spe_ceqh, 0x3c8);
+EMIT_RI10(spe_ceqhi, 0x07d);
+EMIT_RR (spe_ceq, 0x3c0);
+EMIT_RI10(spe_ceqi, 0x07c);
+EMIT_RR (spe_cgtb, 0x250);
+EMIT_RI10(spe_cgtbi, 0x04e);
+EMIT_RR (spe_cgth, 0x248);
+EMIT_RI10(spe_cgthi, 0x04d);
+EMIT_RR (spe_cgt, 0x240);
+EMIT_RI10(spe_cgti, 0x04c);
+EMIT_RR (spe_clgtb, 0x2d0);
+EMIT_RI10(spe_clgtbi, 0x05e);
+EMIT_RR (spe_clgth, 0x2c8);
+EMIT_RI10(spe_clgthi, 0x05d);
+EMIT_RR (spe_clgt, 0x2c0);
+EMIT_RI10(spe_clgti, 0x05c);
+EMIT_I16 (spe_br, 0x064);
+EMIT_I16 (spe_bra, 0x060);
+EMIT_RI16(spe_brsl, 0x066);
+EMIT_RI16(spe_brasl, 0x062);
+EMIT_RI16(spe_brnz, 0x042);
+EMIT_RI16(spe_brz, 0x040);
+EMIT_RI16(spe_brhnz, 0x046);
+EMIT_RI16(spe_brhz, 0x044);
+
+extern void spe_bi(struct spe_function *p, unsigned rA, int d, int e);
+extern void spe_iret(struct spe_function *p, unsigned rA, int d, int e);
+extern void spe_bisled(struct spe_function *p, unsigned rT, unsigned rA,
+ int d, int e);
+extern void spe_bisl(struct spe_function *p, unsigned rT, unsigned rA,
+ int d, int e);
+extern void spe_biz(struct spe_function *p, unsigned rT, unsigned rA,
+ int d, int e);
+extern void spe_binz(struct spe_function *p, unsigned rT, unsigned rA,
+ int d, int e);
+extern void spe_bihz(struct spe_function *p, unsigned rT, unsigned rA,
+ int d, int e);
+extern void spe_bihnz(struct spe_function *p, unsigned rT, unsigned rA,
+ int d, int e);
+
+
+/* Floating-point instructions
+ */
+EMIT_RR (spe_fa, 0x2c4);
+EMIT_RR (spe_dfa, 0x2cc);
+EMIT_RR (spe_fs, 0x2c5);
+EMIT_RR (spe_dfs, 0x2cd);
+EMIT_RR (spe_fm, 0x2c6);
+EMIT_RR (spe_dfm, 0x2ce);
+EMIT_RRR (spe_fma, 0x00e);
+EMIT_RR (spe_dfma, 0x35c);
+EMIT_RRR (spe_fnms, 0x00d);
+EMIT_RR (spe_dfnms, 0x35e);
+EMIT_RRR (spe_fms, 0x00f);
+EMIT_RR (spe_dfms, 0x35d);
+EMIT_RR (spe_dfnma, 0x35f);
+EMIT_R (spe_frest, 0x1b8);
+EMIT_R (spe_frsqest, 0x1b9);
+EMIT_RR (spe_fi, 0x3d4);
+EMIT_RI8 (spe_csflt, 0x1da);
+EMIT_RI8 (spe_cflts, 0x1d8);
+EMIT_RI8 (spe_cuflt, 0x1db);
+EMIT_RI8 (spe_cfltu, 0x1d9);
+EMIT_R (spe_frds, 0x3b9);
+EMIT_R (spe_fesd, 0x3b8);
+EMIT_RR (spe_dfceq, 0x3c3);
+EMIT_RR (spe_dfcmeq, 0x3cb);
+EMIT_RR (spe_dfcgt, 0x2c3);
+EMIT_RR (spe_dfcmgt, 0x2cb);
+EMIT_RI7 (spe_dftsv, 0x3bf);
+EMIT_RR (spe_fceq, 0x3c2);
+EMIT_RR (spe_fcmeq, 0x3ca);
+EMIT_RR (spe_fcgt, 0x2c2);
+EMIT_RR (spe_fcmgt, 0x2ca);
+EMIT_R (spe_fscrwr, 0x3ba);
+EMIT_ (spe_fscrrd, 0x398);
+
+
+/* Channel instructions
+ */
+EMIT_R (spe_rdch, 0x00d);
+EMIT_R (spe_rdchcnt, 0x00f);
+EMIT_R (spe_wrch, 0x10d);
+
+
+#ifdef UNDEF_EMIT_MACROS
+#undef EMIT_
+#undef EMIT_R
+#undef EMIT_RR
+#undef EMIT_RRR
+#undef EMIT_RI7
+#undef EMIT_RI8
+#undef EMIT_RI10
+#undef EMIT_RI16
+#undef EMIT_RI18
+#undef EMIT_I16
+#undef UNDEF_EMIT_MACROS
+#endif /* EMIT_ */
diff --git a/src/mesa/sources b/src/mesa/sources
index 96ae3dbca00..f83d247a1e2 100644
--- a/src/mesa/sources
+++ b/src/mesa/sources
@@ -158,45 +158,48 @@ VF_SOURCES = \
DRAW_SOURCES = \
- pipe/draw/draw_clip.c \
- pipe/draw/draw_context.c\
- pipe/draw/draw_cull.c \
- pipe/draw/draw_debug.c \
- pipe/draw/draw_flatshade.c \
- pipe/draw/draw_offset.c \
- pipe/draw/draw_prim.c \
- pipe/draw/draw_stipple.c \
- pipe/draw/draw_twoside.c \
- pipe/draw/draw_unfilled.c \
- pipe/draw/draw_validate.c \
- pipe/draw/draw_vbuf.c \
- pipe/draw/draw_vertex.c \
- pipe/draw/draw_vertex_cache.c \
- pipe/draw/draw_vertex_fetch.c \
- pipe/draw/draw_vertex_shader.c \
- pipe/draw/draw_vf.c \
- pipe/draw/draw_vf_generic.c \
- pipe/draw/draw_vf_sse.c \
- pipe/draw/draw_wide_prims.c
+ $(TOP)/src/gallium/auxiliary/draw/draw_clip.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_vs_exec.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_vs_sse.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_vs_llvm.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_context.c\
+ $(TOP)/src/gallium/auxiliary/draw/draw_cull.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_debug.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_flatshade.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_offset.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_prim.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_stipple.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_twoside.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_unfilled.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_validate.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_vbuf.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_vertex.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_vertex_cache.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_vertex_fetch.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_vertex_shader.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_vf.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_vf_generic.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_vf_sse.c \
+ $(TOP)/src/gallium/auxiliary/draw/draw_wide_prims.c
TGSIEXEC_SOURCES = \
- pipe/tgsi/exec/tgsi_exec.c \
- pipe/tgsi/exec/tgsi_sse2.c
+ $(TOP)/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c \
+ $(TOP)/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
TGSIUTIL_SOURCES = \
- pipe/tgsi/util/tgsi_build.c \
- pipe/tgsi/util/tgsi_dump.c \
- pipe/tgsi/util/tgsi_parse.c \
- pipe/tgsi/util/tgsi_util.c
+ $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_build.c \
+ $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_dump.c \
+ $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_parse.c \
+ $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_util.c
STATECACHE_SOURCES = \
- pipe/cso_cache/cso_hash.c \
- pipe/cso_cache/cso_cache.c
+ $(TOP)/src/gallium/auxiliary/cso_cache/cso_hash.c \
+ $(TOP)/src/gallium/auxiliary/cso_cache/cso_cache.c
PIPEUTIL_SOURCES = \
- pipe/util/p_debug.c \
- pipe/util/p_tile.c \
- pipe/util/p_util.c
+ $(TOP)/src/gallium/auxiliary/util/p_debug.c \
+ $(TOP)/src/gallium/auxiliary/util/p_tile.c \
+ $(TOP)/src/gallium/auxiliary/util/p_util.c
STATETRACKER_SOURCES = \
state_tracker/st_atom.c \
@@ -288,6 +291,7 @@ ASM_C_SOURCES = \
x86/rtasm/x86sse.c \
sparc/sparc.c \
ppc/common_ppc.c \
+ ppc/rtasm/spe_asm.c \
x86-64/x86-64.c
X86_SOURCES = \
@@ -330,13 +334,13 @@ __COMMON_DRIVER_SOURCES = \
drivers/common/driverfuncs.c
X11_DRIVER_SOURCES = \
- pipe/xlib/glxapi.c \
- pipe/xlib/fakeglx.c \
- pipe/xlib/xfonts.c \
- pipe/xlib/xm_api.c \
- pipe/xlib/xm_winsys.c \
- pipe/xlib/xm_winsys_aub.c \
- pipe/xlib/brw_aub.c
+ $(TOP)/src/gallium/winsys/xlib/glxapi.c \
+ $(TOP)/src/gallium/winsys/xlib/fakeglx.c \
+ $(TOP)/src/gallium/winsys/xlib/xfonts.c \
+ $(TOP)/src/gallium/winsys/xlib/xm_api.c \
+ $(TOP)/src/gallium/winsys/xlib/xm_winsys.c \
+ $(TOP)/src/gallium/winsys/xlib/xm_winsys_aub.c \
+ $(TOP)/src/gallium/winsys/xlib/brw_aub.c
OSMESA_DRIVER_SOURCES = \
drivers/osmesa/osmesa.c
@@ -424,7 +428,10 @@ FBDEV_DRIVER_OBJECTS = $(FBDEV_DRIVER_SOURCES:.c=.o)
INCLUDE_DIRS = \
-I$(TOP)/include \
-I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main
+ -I$(TOP)/src/mesa/main \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/gallium/auxiliary
OLD_INCLUDE_DIRS = \
-I$(TOP)/src/mesa/tnl \
@@ -434,4 +441,4 @@ OLD_INCLUDE_DIRS = \
-I$(TOP)/src/mesa/shader \
-I$(TOP)/src/mesa/shader/grammar \
-I$(TOP)/src/mesa/shader/slang \
- -I$(TOP)/src/mesa/pipe/tgsi
+ -I$(TOP)/s$(TOP)/src/gallium/auxiliary/tgsi
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 2c6ec8421b0..b67b620eaa5 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -43,7 +43,7 @@
#include "pipe/p_context.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/cso_cache/cso_cache.h"
+#include "cso_cache/cso_cache.h"
#include "st_context.h"
#include "st_cache.h"
diff --git a/src/mesa/state_tracker/st_cache.c b/src/mesa/state_tracker/st_cache.c
index e0965b217ab..2979e7fae54 100644
--- a/src/mesa/state_tracker/st_cache.c
+++ b/src/mesa/state_tracker/st_cache.c
@@ -36,8 +36,8 @@
#include "pipe/p_state.h"
-#include "pipe/cso_cache/cso_cache.h"
-#include "pipe/cso_cache/cso_hash.h"
+#include "cso_cache/cso_cache.h"
+#include "cso_cache/cso_hash.h"
/* Those function will either find the state of the given template
diff --git a/src/mesa/state_tracker/st_cache.h b/src/mesa/state_tracker/st_cache.h
index e0c176b0ffc..b81de316ec9 100644
--- a/src/mesa/state_tracker/st_cache.h
+++ b/src/mesa/state_tracker/st_cache.h
@@ -33,7 +33,7 @@
#ifndef ST_CACHE_H
#define ST_CACHE_H
-#include "pipe/cso_cache/cso_cache.h"
+#include "cso_cache/cso_cache.h"
struct pipe_blend_state;
struct pipe_sampler_state;
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index 3a3bf9016dd..663c4f205d8 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -43,7 +43,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/util/p_tile.h"
+#include "util/p_tile.h"
#define UNCLAMPED_FLOAT_TO_SHORT(us, f) \
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 410062e1e80..78baf772f44 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -272,6 +272,14 @@ clear_with_quad(GLcontext *ctx,
const GLfloat x1 = ctx->DrawBuffer->_Xmax;
const GLfloat y1 = ctx->DrawBuffer->_Ymax;
+ /*
+ printf("%s %s%s%s %f,%f %f,%f\n", __FUNCTION__,
+ color ? "color, " : "",
+ depth ? "depth, " : "",
+ stencil ? "stencil" : "",
+ x0, y0,
+ x1, y1);
+ */
/* blend state: RGBA masking */
{
@@ -389,13 +397,44 @@ clear_with_quad(GLcontext *ctx,
* Determine if we need to clear the depth buffer by drawing a quad.
*/
static INLINE GLboolean
-check_clear_color_with_quad(GLcontext *ctx)
+check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
+{
+ const struct st_renderbuffer *strb = st_renderbuffer(rb);
+
+ if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
+ return FALSE;
+
+ if (ctx->Scissor.Enabled)
+ return TRUE;
+
+ if (!ctx->Color.ColorMask[0] ||
+ !ctx->Color.ColorMask[1] ||
+ !ctx->Color.ColorMask[2] ||
+ !ctx->Color.ColorMask[3])
+ return TRUE;
+
+ return FALSE;
+}
+
+
+static INLINE GLboolean
+check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
{
- return !(ctx->Color.ColorMask[0] &&
- ctx->Color.ColorMask[1] &&
- ctx->Color.ColorMask[2] &&
- ctx->Color.ColorMask[3] &&
- !ctx->Scissor.Enabled);
+ const struct st_renderbuffer *strb = st_renderbuffer(rb);
+ const GLuint stencilMax = (1 << rb->StencilBits) - 1;
+ GLboolean maskStencil
+ = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
+
+ if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
+ return FALSE;
+
+ if (ctx->Scissor.Enabled)
+ return TRUE;
+
+ if (maskStencil)
+ return TRUE;
+
+ return FALSE;
}
@@ -407,10 +446,19 @@ check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
{
const struct st_renderbuffer *strb = st_renderbuffer(rb);
const GLboolean isDS = is_depth_stencil_format(strb->surface->format);
- return ctx->Scissor.Enabled
- || (isDS &&
- strb->surface->status == PIPE_SURFACE_STATUS_DEFINED &&
- ctx->DrawBuffer->Visual.stencilBits > 0);
+
+ if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
+ return FALSE;
+
+ if (ctx->Scissor.Enabled)
+ return TRUE;
+
+ if (isDS &&
+ strb->surface->status == PIPE_SURFACE_STATUS_DEFINED &&
+ ctx->DrawBuffer->Visual.stencilBits > 0)
+ return TRUE;
+
+ return FALSE;
}
@@ -425,9 +473,27 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
const GLuint stencilMax = (1 << rb->StencilBits) - 1;
const GLboolean maskStencil
= (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
- return maskStencil
- || ctx->Scissor.Enabled
- || (isDS && ctx->DrawBuffer->Visual.depthBits > 0);
+
+ if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
+ return FALSE;
+
+ if (maskStencil)
+ return TRUE;
+
+ if (ctx->Scissor.Enabled)
+ return TRUE;
+
+ /* This is correct, but it is necessary to look at the depth clear
+ * value held in the surface when it comes time to issue the clear,
+ * rather than taking depth and stencil clear values from the
+ * current state.
+ */
+ if (isDS &&
+ strb->surface->status == PIPE_SURFACE_STATUS_DEFINED &&
+ ctx->DrawBuffer->Visual.depthBits > 0)
+ return TRUE;
+
+ return FALSE;
}
@@ -436,14 +502,10 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
static void
clear_color_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
- struct st_renderbuffer *strb = st_renderbuffer(rb);
-
- if (ctx->Color.ColorMask[0] &&
- ctx->Color.ColorMask[1] &&
- ctx->Color.ColorMask[2] &&
- ctx->Color.ColorMask[3] &&
- !ctx->Scissor.Enabled)
+ if (!check_clear_color_with_quad( ctx, rb ))
{
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+
/* clear whole buffer w/out masking */
GLuint clearValue
= color_value(strb->surface->format, ctx->Color.ClearColor);
@@ -482,14 +544,8 @@ static void
clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
struct st_renderbuffer *strb = st_renderbuffer(rb);
- const GLboolean isDS = is_depth_stencil_format(strb->surface->format);
- const GLuint stencilMax = (1 << rb->StencilBits) - 1;
- GLboolean maskStencil
- = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
- if (maskStencil ||
- ctx->Scissor.Enabled ||
- (isDS && ctx->DrawBuffer->Visual.depthBits > 0)) {
+ if (check_clear_stencil_with_quad(ctx, rb)) {
/* masking or scissoring or combined depth/stencil buffer */
clear_with_quad(ctx, GL_FALSE, GL_FALSE, GL_TRUE);
}
@@ -505,13 +561,10 @@ static void
clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
struct st_renderbuffer *strb = st_renderbuffer(rb);
- const GLuint stencilMax = (1 << rb->StencilBits) - 1;
- GLboolean maskStencil
- = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
assert(is_depth_stencil_format(strb->surface->format));
- if (!maskStencil && !ctx->Scissor.Enabled) {
+ if (check_clear_depth_stencil_with_quad(ctx, rb)) {
/* clear whole buffer w/out masking */
GLuint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear);
@@ -520,7 +573,7 @@ clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
clearValue |= ctx->Stencil.Clear << 24;
break;
case PIPE_FORMAT_Z24S8_UNORM:
- clearValue |= clearValue | ctx->Stencil.Clear;
+ clearValue |= ctx->Stencil.Clear;
break;
default:
assert(0);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 3245a7488bc..e2d4e06da19 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -56,7 +56,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-#include "pipe/util/p_tile.h"
+#include "util/p_tile.h"
#include "shader/prog_instruction.h"
@@ -1259,6 +1259,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
if (st->haveFramebufferSurfaces) {
/* copy source framebuffer surface into mipmap/texture */
pipe->surface_copy(pipe,
+ FALSE,
psTex, /* dest */
0, 0, /* destx/y */
psRead,
diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c
index 31744151f1d..5315294c07b 100644
--- a/src/mesa/state_tracker/st_cb_feedback.c
+++ b/src/mesa/state_tracker/st_cb_feedback.c
@@ -53,10 +53,10 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
-#include "pipe/cso_cache/cso_cache.h"
+#include "cso_cache/cso_cache.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/draw/draw_private.h"
+#include "draw/draw_context.h"
+#include "draw/draw_private.h"
/**
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index af3ee655048..61d4f4c41c6 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -39,8 +39,8 @@
#include "shader/programopt.h"
#include "shader/shader_api.h"
-#include "pipe/cso_cache/cso_cache.h"
-#include "pipe/draw/draw_context.h"
+#include "cso_cache/cso_cache.h"
+#include "draw/draw_context.h"
#include "st_context.h"
#include "st_program.h"
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c
index 7e347c48938..5b0eb6022be 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -44,8 +44,8 @@
#include "st_draw.h"
#include "st_cb_rasterpos.h"
#include "st_draw.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/draw/draw_private.h"
+#include "draw/draw_context.h"
+#include "draw/draw_private.h"
#include "shader/prog_instruction.h"
#include "vbo/vbo.h"
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 868c5f3c5f9..c89c74229e5 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -40,7 +40,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/util/p_tile.h"
+#include "util/p_tile.h"
#include "st_context.h"
#include "st_cb_readpixels.h"
#include "st_cb_fbo.h"
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 0ea367549b8..03dbb30b0fe 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -47,7 +47,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/util/p_tile.h"
+#include "util/p_tile.h"
#define DBG if (0) printf
@@ -1132,6 +1132,7 @@ do_copy_texsubimage(GLcontext *ctx,
struct pipe_context *pipe = ctx->st->pipe;
struct pipe_surface *dest_surface;
uint dest_format, src_format;
+ uint do_flip = FALSE;
(void) texImage;
@@ -1153,6 +1154,7 @@ do_copy_texsubimage(GLcontext *ctx,
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
srcY = strb->Base.Height - srcY - height;
+ do_flip = TRUE;
}
src_format = strb->surface->format;
@@ -1190,6 +1192,7 @@ do_copy_texsubimage(GLcontext *ctx,
#else
pipe->surface_copy(pipe,
+ do_flip,
/* dest */
dest_surface,
destX, destY,
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index bf4618bed8e..09e389f9dc7 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -54,8 +54,8 @@
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
#include "pipe/p_inlines.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/cso_cache/cso_cache.h"
+#include "draw/draw_context.h"
+#include "cso_cache/cso_cache.h"
/**
diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c
index 57450e52bf4..5888bcb98a3 100644
--- a/src/mesa/state_tracker/st_debug.c
+++ b/src/mesa/state_tracker/st_debug.c
@@ -31,9 +31,9 @@
#include "pipe/p_state.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_dump.h"
+#include "tgsi/util/tgsi_dump.h"
-#include "pipe/cso_cache/cso_cache.h"
+#include "cso_cache/cso_cache.h"
#include "st_context.h"
#include "st_debug.h"
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index ae9f5c8b117..1c0fa8c6aad 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -47,8 +47,8 @@
#include "pipe/p_winsys.h"
#include "pipe/p_inlines.h"
-#include "pipe/draw/draw_private.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_private.h"
+#include "draw/draw_context.h"
static GLuint double_types[4] = {
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index 459941cca87..6c09b86033b 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -37,7 +37,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-#include "pipe/cso_cache/cso_cache.h"
+#include "cso_cache/cso_cache.h"
#include "st_context.h"
#include "st_draw.h"
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 325aa201734..97206752af3 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -32,9 +32,9 @@
#include "pipe/p_compiler.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
-#include "pipe/tgsi/util/tgsi_build.h"
-#include "pipe/tgsi/util/tgsi_util.h"
+#include "tgsi/util/tgsi_parse.h"
+#include "tgsi/util/tgsi_build.h"
+#include "tgsi/util/tgsi_util.h"
#include "st_mesa_to_tgsi.h"
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index c8297badedd..dc992ee9c24 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -38,8 +38,8 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/tgsi/util/tgsi_dump.h"
+#include "draw/draw_context.h"
+#include "tgsi/util/tgsi_dump.h"
#include "st_context.h"
#include "st_cache.h"
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 2622d009530..b86f416c9b4 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -300,6 +300,7 @@ st_texture_image_copy(struct pipe_context *pipe,
src_surface = pipe->get_tex_surface(pipe, src, face, srcLevel, i);
pipe->surface_copy(pipe,
+ FALSE,
dst_surface,
0, 0, /* destX, Y */
src_surface,
diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c
index f8da6e405f4..39c0e9b851a 100644
--- a/src/mesa/x86/rtasm/x86sse.c
+++ b/src/mesa/x86/rtasm/x86sse.c
@@ -12,55 +12,73 @@ static unsigned char *cptr( void (*label)() )
}
+static void do_realloc( struct x86_function *p )
+{
+ if (p->size == 0) {
+ p->size = 1024;
+ p->store = _mesa_exec_malloc(p->size);
+ p->csr = p->store;
+ }
+ else {
+ unsigned used = p->csr - p->store;
+ unsigned char *tmp = p->store;
+ p->size *= 2;
+ p->store = _mesa_exec_malloc(p->size);
+ memcpy(p->store, tmp, used);
+ p->csr = p->store + used;
+ _mesa_exec_free(tmp);
+ }
+}
+
/* Emit bytes to the instruction stream:
*/
-static void emit_1b( struct x86_function *p, char b0 )
+static unsigned char *reserve( struct x86_function *p, int bytes )
{
- *(char *)(p->csr++) = b0;
+ if (p->csr + bytes - p->store > p->size)
+ do_realloc(p);
+
+ {
+ unsigned char *csr = p->csr;
+ p->csr += bytes;
+ return csr;
+ }
}
-static void emit_1i( struct x86_function *p, int i0 )
+
+
+static void emit_1b( struct x86_function *p, char b0 )
{
- *(int *)(p->csr) = i0;
- p->csr += 4;
+ char *csr = (char *)reserve(p, 1);
+ *csr = b0;
}
-static void disassem( struct x86_function *p, const char *fn )
+static void emit_1i( struct x86_function *p, int i0 )
{
-#if DISASSEM && 0
- if (fn && fn != p->fn) {
- _mesa_printf("0x%x: %s\n", p->csr, fn);
- p->fn = fn;
- }
-#endif
+ int *icsr = (int *)reserve(p, sizeof(i0));
+ *icsr = i0;
}
-static void emit_1ub_fn( struct x86_function *p, unsigned char b0, const char *fn )
+static void emit_1ub( struct x86_function *p, unsigned char b0 )
{
- disassem(p, fn);
- *(p->csr++) = b0;
+ unsigned char *csr = reserve(p, 1);
+ *csr++ = b0;
}
-static void emit_2ub_fn( struct x86_function *p, unsigned char b0, unsigned char b1, const char *fn )
+static void emit_2ub( struct x86_function *p, unsigned char b0, unsigned char b1 )
{
- disassem(p, fn);
- *(p->csr++) = b0;
- *(p->csr++) = b1;
+ unsigned char *csr = reserve(p, 2);
+ *csr++ = b0;
+ *csr++ = b1;
}
-static void emit_3ub_fn( struct x86_function *p, unsigned char b0, unsigned char b1, unsigned char b2, const char *fn )
+static void emit_3ub( struct x86_function *p, unsigned char b0, unsigned char b1, unsigned char b2 )
{
- disassem(p, fn);
- *(p->csr++) = b0;
- *(p->csr++) = b1;
- *(p->csr++) = b2;
+ unsigned char *csr = reserve(p, 3);
+ *csr++ = b0;
+ *csr++ = b1;
+ *csr++ = b2;
}
-#define emit_1ub(p, b0) emit_1ub_fn(p, b0, __FUNCTION__)
-#define emit_2ub(p, b0, b1) emit_2ub_fn(p, b0, b1, __FUNCTION__)
-#define emit_3ub(p, b0, b1, b2) emit_3ub_fn(p, b0, b1, b2, __FUNCTION__)
-
-
/* Build a modRM byte + possible displacement. No treatment of SIB
* indexing. BZZT - no way to encode an absolute address.
@@ -77,13 +95,13 @@ static void emit_modrm( struct x86_function *p,
val |= reg.idx << 3; /* reg field */
val |= regmem.idx; /* r/m field */
- emit_1ub_fn(p, val, 0);
+ emit_1ub(p, val);
/* Oh-oh we've stumbled into the SIB thing.
*/
if (regmem.file == file_REG32 &&
regmem.idx == reg_SP) {
- emit_1ub_fn(p, 0x24, 0); /* simplistic! */
+ emit_1ub(p, 0x24); /* simplistic! */
}
switch (regmem.mod) {
@@ -124,14 +142,14 @@ static void emit_op_modrm( struct x86_function *p,
{
switch (dst.mod) {
case mod_REG:
- emit_1ub_fn(p, op_dst_is_reg, 0);
+ emit_1ub(p, op_dst_is_reg);
emit_modrm(p, dst, src);
break;
case mod_INDIRECT:
case mod_DISP32:
case mod_DISP8:
assert(src.mod == mod_REG);
- emit_1ub_fn(p, op_dst_is_mem, 0);
+ emit_1ub(p, op_dst_is_mem);
emit_modrm(p, src, dst);
break;
default:
@@ -258,11 +276,24 @@ void x86_jmp( struct x86_function *p, unsigned char *label)
emit_1i(p, label - x86_get_label(p) - 4);
}
+#if 0
+/* This doesn't work once we start reallocating & copying the
+ * generated code on buffer fills, because the call is relative to the
+ * current pc.
+ */
void x86_call( struct x86_function *p, void (*label)())
{
emit_1ub(p, 0xe8);
emit_1i(p, cptr(label) - x86_get_label(p) - 4);
}
+#else
+void x86_call( struct x86_function *p, struct x86_reg reg)
+{
+ emit_1ub(p, 0xff);
+ emit_modrm(p, reg, reg);
+}
+#endif
+
/* michal:
* Temporary. As I need immediate operands, and dont want to mess with the codegen,
@@ -789,7 +820,7 @@ static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86
assert(0);
}
else if (dst.idx == 0) {
- assert(arg.file = file_REG32);
+ assert(arg.file == file_REG32);
emit_1ub(p, 0xd8);
emit_modrm_noreg(p, argmem_noreg, arg);
}
@@ -1125,11 +1156,14 @@ struct x86_reg x86_fn_arg( struct x86_function *p,
void x86_init_func( struct x86_function *p )
{
- x86_init_func_size(p, 2048);
+ p->size = 0;
+ p->store = NULL;
+ p->csr = p->store;
}
void x86_init_func_size( struct x86_function *p, unsigned code_size )
{
+ p->size = code_size;
p->store = _mesa_exec_malloc(code_size);
p->csr = p->store;
}
@@ -1138,12 +1172,14 @@ void x86_release_func( struct x86_function *p )
{
_mesa_exec_free(p->store);
p->store = NULL;
+ p->csr = NULL;
+ p->size = 0;
}
void (*x86_get_func( struct x86_function *p ))(void)
{
- if (DISASSEM)
+ if (DISASSEM && p->store)
_mesa_printf("disassemble %p %p\n", p->store, p->csr);
return (void (*)(void)) (unsigned long) p->store;
}
diff --git a/src/mesa/x86/rtasm/x86sse.h b/src/mesa/x86/rtasm/x86sse.h
index 63b9a36392a..c2aa416492e 100644
--- a/src/mesa/x86/rtasm/x86sse.h
+++ b/src/mesa/x86/rtasm/x86sse.h
@@ -16,6 +16,7 @@ struct x86_reg {
};
struct x86_function {
+ unsigned size;
unsigned char *store;
unsigned char *csr;
unsigned stack_offset;
@@ -118,7 +119,8 @@ void x86_fixup_fwd_jump( struct x86_function *p,
void x86_jmp( struct x86_function *p, unsigned char *label );
-void x86_call( struct x86_function *p, void (*label)() );
+/* void x86_call( struct x86_function *p, void (*label)() ); */
+void x86_call( struct x86_function *p, struct x86_reg reg);
/* michal:
* Temporary. As I need immediate operands, and dont want to mess with the codegen,