summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-04-10 17:16:08 -0400
committerAlex Deucher <alexdeucher@gmail.com>2009-04-10 17:16:08 -0400
commit04f335fd16c2a13b9425797acf5c3989cb6def7f (patch)
tree9e92cecb0b2ac512fac1fc4ef911878849eaeb42
parentc0419f190c836130932164ac47cfb53de668d423 (diff)
parent5e361c47abf2ee20140628d327eda9b39351d415 (diff)
Merge branch 'radeon-rewrite' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa into r6xx-rewrite
-rw-r--r--SConstruct2
-rwxr-xr-xbin/mklib28
-rw-r--r--common.py2
-rw-r--r--configure.ac35
-rw-r--r--docs/MESA_texture_signed_rgba.spec214
-rw-r--r--docs/cell.html13
-rw-r--r--docs/extensions.html1
-rw-r--r--docs/relnotes-7.5.html20
-rw-r--r--docs/shading.html32
-rw-r--r--include/EGL/eglext.h4
-rw-r--r--include/EGL/eglplatform.h5
-rw-r--r--include/GL/glext.h158
-rw-r--r--progs/fp/fp-tri.c6
-rw-r--r--progs/fp/kil-pos.txt (renamed from progs/fp/kill-pos.txt)0
-rw-r--r--progs/fp/kil-texcoord-sgt.txt8
-rw-r--r--progs/glsl/.gitignore1
-rw-r--r--progs/glsl/Makefile7
-rw-r--r--progs/glsl/linktest.c258
-rw-r--r--progs/tests/.gitignore5
-rw-r--r--progs/tests/SConscript1
-rw-r--r--progs/tests/texcompress2.c1
-rw-r--r--progs/trivial/.gitignore1
-rw-r--r--progs/trivial/Makefile1
-rw-r--r--progs/trivial/SConscript1
-rw-r--r--progs/trivial/clear-fbo-tex.c1
-rw-r--r--progs/trivial/clear-fbo.c1
-rw-r--r--progs/trivial/clear-random.c1
-rw-r--r--progs/trivial/clear-repeat.c1
-rw-r--r--progs/trivial/clear-scissor.c1
-rw-r--r--progs/trivial/clear-undefined.c1
-rw-r--r--progs/trivial/clear.c1
-rw-r--r--progs/trivial/createwin.c1
-rw-r--r--progs/trivial/dlist-dangling.c1
-rw-r--r--progs/trivial/dlist-edgeflag-dangling.c1
-rw-r--r--progs/trivial/dlist-edgeflag.c1
-rw-r--r--progs/trivial/line-clip.c1
-rw-r--r--progs/trivial/line-cull.c1
-rw-r--r--progs/trivial/line-smooth.c2
-rw-r--r--progs/trivial/line-stipple-wide.c1
-rw-r--r--progs/trivial/line-userclip-clip.c1
-rw-r--r--progs/trivial/line-userclip-nop-clip.c1
-rw-r--r--progs/trivial/line-userclip-nop.c1
-rw-r--r--progs/trivial/line-userclip.c1
-rw-r--r--progs/trivial/line-wide.c1
-rw-r--r--progs/trivial/line.c1
-rw-r--r--progs/trivial/lineloop-clip.c1
-rw-r--r--progs/trivial/lineloop.c1
-rw-r--r--progs/trivial/linestrip-clip.c1
-rw-r--r--progs/trivial/linestrip-flat-stipple.c1
-rw-r--r--progs/trivial/linestrip-stipple-wide.c1
-rw-r--r--progs/trivial/linestrip-stipple.c1
-rw-r--r--progs/trivial/linestrip.c1
-rw-r--r--progs/trivial/long-fixed-func.c1
-rw-r--r--progs/trivial/point-clip.c1
-rw-r--r--progs/trivial/point-param.c1
-rw-r--r--progs/trivial/point-sprite.c1
-rw-r--r--progs/trivial/point-wide-smooth.c1
-rw-r--r--progs/trivial/point-wide.c1
-rw-r--r--progs/trivial/point.c1
-rw-r--r--progs/trivial/poly-flat-clip.c1
-rw-r--r--progs/trivial/poly-flat-unfilled-clip.c1
-rw-r--r--progs/trivial/poly-flat.c1
-rw-r--r--progs/trivial/poly-unfilled.c1
-rw-r--r--progs/trivial/poly.c1
-rw-r--r--progs/trivial/quad-clip-all-vertices.c1
-rw-r--r--progs/trivial/quad-clip-nearplane.c1
-rw-r--r--progs/trivial/quad-clip.c1
-rw-r--r--progs/trivial/quad-degenerate.c1
-rw-r--r--progs/trivial/quad-flat.c1
-rw-r--r--progs/trivial/quad-offset-factor.c1
-rw-r--r--progs/trivial/quad-offset-unfilled.c1
-rw-r--r--progs/trivial/quad-offset-units.c1
-rw-r--r--progs/trivial/quad-tex-2d.c1
-rw-r--r--progs/trivial/quad-tex-3d.c1
-rw-r--r--progs/trivial/quad-tex-alpha.c1
-rw-r--r--progs/trivial/quad-tex-pbo.c1
-rw-r--r--progs/trivial/quad-tex-sub.c1
-rw-r--r--progs/trivial/quad-unfilled-clip.c1
-rw-r--r--progs/trivial/quad-unfilled-stipple.c1
-rw-r--r--progs/trivial/quad-unfilled.c1
-rw-r--r--progs/trivial/quad.c1
-rw-r--r--progs/trivial/quads.c1
-rw-r--r--progs/trivial/quadstrip-clip.c1
-rw-r--r--progs/trivial/quadstrip-cont.c1
-rw-r--r--progs/trivial/quadstrip-flat.c1
-rw-r--r--progs/trivial/quadstrip.c1
-rw-r--r--progs/trivial/readpixels.c1
-rw-r--r--progs/trivial/tri-alpha-tex.c1
-rw-r--r--progs/trivial/tri-alpha.c1
-rw-r--r--progs/trivial/tri-blend-color.c1
-rw-r--r--progs/trivial/tri-clear.c1
-rw-r--r--progs/trivial/tri-clip.c1
-rw-r--r--progs/trivial/tri-cull-both.c1
-rw-r--r--progs/trivial/tri-cull.c1
-rw-r--r--progs/trivial/tri-dlist.c1
-rw-r--r--progs/trivial/tri-edgeflag.c1
-rw-r--r--progs/trivial/tri-fbo.c1
-rw-r--r--progs/trivial/tri-flat-clip.c1
-rw-r--r--progs/trivial/tri-flat.c1
-rw-r--r--progs/trivial/tri-fog.c1
-rw-r--r--progs/trivial/tri-fp-const-imm.c1
-rw-r--r--progs/trivial/tri-fp.c1
-rw-r--r--progs/trivial/tri-lit.c1
-rw-r--r--progs/trivial/tri-logicop-none.c1
-rw-r--r--progs/trivial/tri-logicop-xor.c1
-rw-r--r--progs/trivial/tri-mask-tri.c1
-rw-r--r--progs/trivial/tri-multitex-vbo.c261
-rw-r--r--progs/trivial/tri-orig.c1
-rw-r--r--progs/trivial/tri-query.c1
-rw-r--r--progs/trivial/tri-repeat.c1
-rw-r--r--progs/trivial/tri-scissor-tri.c1
-rw-r--r--progs/trivial/tri-square.c1
-rw-r--r--progs/trivial/tri-stipple.c1
-rw-r--r--progs/trivial/tri-tex-3d.c1
-rw-r--r--progs/trivial/tri-tex.c1
-rw-r--r--progs/trivial/tri-tri.c1
-rw-r--r--progs/trivial/tri-unfilled-clip.c1
-rw-r--r--progs/trivial/tri-unfilled-edgeflag.c1
-rw-r--r--progs/trivial/tri-unfilled-fog.c1
-rw-r--r--progs/trivial/tri-unfilled-point.c1
-rw-r--r--progs/trivial/tri-unfilled-smooth.c1
-rw-r--r--progs/trivial/tri-unfilled-tri-lit.c1
-rw-r--r--progs/trivial/tri-unfilled-tri.c1
-rw-r--r--progs/trivial/tri-unfilled-userclip-stip.c1
-rw-r--r--progs/trivial/tri-unfilled-userclip.c1
-rw-r--r--progs/trivial/tri-unfilled.c1
-rw-r--r--progs/trivial/tri-userclip.c1
-rw-r--r--progs/trivial/tri-viewport.c1
-rw-r--r--progs/trivial/tri-z-9.c1
-rw-r--r--progs/trivial/tri-z-eq.c1
-rw-r--r--progs/trivial/tri.c1
-rw-r--r--progs/trivial/trifan-flat-clip.c1
-rw-r--r--progs/trivial/trifan-flat-unfilled-clip.c1
-rw-r--r--progs/trivial/trifan-flat.c1
-rw-r--r--progs/trivial/trifan-unfilled.c1
-rw-r--r--progs/trivial/trifan.c1
-rw-r--r--progs/trivial/tristrip-clip.c1
-rw-r--r--progs/trivial/tristrip-flat.c1
-rw-r--r--progs/trivial/tristrip.c1
-rw-r--r--progs/vp/psiz-imm.txt5
-rw-r--r--progs/vp/psiz-mul-clamp.txt9
-rw-r--r--progs/vp/psiz-param-clamp.txt10
-rw-r--r--progs/vpglsl/SConscript13
-rw-r--r--progs/xdemos/Makefile2
-rw-r--r--scons/gallium.py14
-rw-r--r--scons/generic.py14
-rw-r--r--scons/python.py4
-rw-r--r--scons/winsdk.py139
-rw-r--r--src/egl/drivers/dri/Makefile3
-rw-r--r--src/egl/drivers/glx/Makefile3
-rw-r--r--src/egl/drivers/xdri/Makefile3
-rw-r--r--src/egl/main/eglconfigutil.c8
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aapoint.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex.h9
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_exec.c1
-rw-r--r--src/gallium/auxiliary/indices/SConscript6
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer.h8
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c12
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c6
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c4
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c2
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c4
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c2
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_execmem.c6
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt79
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c61
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.h4
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.c238
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.h2
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c79
-rw-r--r--src/gallium/auxiliary/translate/translate.c2
-rw-r--r--src/gallium/auxiliary/util/Makefile2
-rw-r--r--src/gallium/auxiliary/util/SConscript1
-rw-r--r--src/gallium/auxiliary/util/u_clear.h60
-rw-r--r--src/gallium/auxiliary/util/u_debug.c83
-rw-r--r--src/gallium/auxiliary/util/u_debug.h14
-rw-r--r--src/gallium/auxiliary/util/u_debug_stack.c5
-rw-r--r--src/gallium/auxiliary/util/u_debug_symbol.c250
-rw-r--r--src/gallium/auxiliary/util/u_debug_symbol.h53
-rw-r--r--src/gallium/auxiliary/util/u_double_list.h3
-rw-r--r--src/gallium/auxiliary/util/u_math.h28
-rw-r--r--src/gallium/auxiliary/util/u_pack_color.h30
-rw-r--r--src/gallium/auxiliary/util/u_stream_stdc.c2
-rw-r--r--src/gallium/auxiliary/util/u_string.h2
-rw-r--r--src/gallium/auxiliary/util/u_tile.c16
-rw-r--r--src/gallium/auxiliary/util/u_time.c12
-rw-r--r--src/gallium/auxiliary/util/u_time.h6
-rw-r--r--src/gallium/drivers/cell/ppu/cell_clear.c69
-rw-r--r--src/gallium/drivers/cell/ppu/cell_clear.h6
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.c2
-rw-r--r--src/gallium/drivers/i915simple/i915_clear.c14
-rw-r--r--src/gallium/drivers/i915simple/i915_context.h4
-rw-r--r--src/gallium/drivers/i915simple/i915_texture.c9
-rw-r--r--src/gallium/drivers/i965simple/brw_defines.h18
-rw-r--r--src/gallium/drivers/i965simple/brw_tex_layout.c1
-rw-r--r--src/gallium/drivers/nouveau/nouveau_stateobj.h6
-rw-r--r--src/gallium/drivers/nv04/nv04_miptree.c1
-rw-r--r--src/gallium/drivers/nv10/nv10_clear.c8
-rw-r--r--src/gallium/drivers/nv10/nv10_context.h5
-rw-r--r--src/gallium/drivers/nv10/nv10_miptree.c1
-rw-r--r--src/gallium/drivers/nv20/nv20_clear.c9
-rw-r--r--src/gallium/drivers/nv20/nv20_context.h4
-rw-r--r--src/gallium/drivers/nv20/nv20_miptree.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_clear.c9
-rw-r--r--src/gallium/drivers/nv30/nv30_context.h4
-rw-r--r--src/gallium/drivers/nv30/nv30_miptree.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_state_emit.c8
-rw-r--r--src/gallium/drivers/nv40/nv40_clear.c9
-rw-r--r--src/gallium/drivers/nv40/nv40_context.h4
-rw-r--r--src/gallium/drivers/nv40/nv40_miptree.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_state_emit.c8
-rw-r--r--src/gallium/drivers/nv50/nv50_clear.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_context.h4
-rw-r--r--src/gallium/drivers/nv50/nv50_miptree.c1
-rw-r--r--src/gallium/drivers/nv50/nv50_query.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c10
-rw-r--r--src/gallium/drivers/r300/Makefile3
-rw-r--r--src/gallium/drivers/r300/SConscript28
-rw-r--r--src/gallium/drivers/r300/r300_chipset.c2
-rw-r--r--src/gallium/drivers/r300/r300_clear.c16
-rw-r--r--src/gallium/drivers/r300/r300_clear.h15
-rw-r--r--src/gallium/drivers/r300/r300_context.c2
-rw-r--r--src/gallium/drivers/r300/r300_context.h32
-rw-r--r--src/gallium/drivers/r300/r300_cs.h10
-rw-r--r--src/gallium/drivers/r300/r300_debug.c20
-rw-r--r--src/gallium/drivers/r300/r300_debug.h3
-rw-r--r--src/gallium/drivers/r300/r300_emit.c85
-rw-r--r--src/gallium/drivers/r300/r300_emit.h5
-rw-r--r--src/gallium/drivers/r300/r300_query.c8
-rw-r--r--src/gallium/drivers/r300/r300_reg.h9
-rw-r--r--src/gallium/drivers/r300/r300_render.c (renamed from src/gallium/drivers/r300/r300_swtcl_emit.c)83
-rw-r--r--src/gallium/drivers/r300/r300_state.c99
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c39
-rw-r--r--src/gallium/drivers/r300/r300_state_inlines.h2
-rw-r--r--src/gallium/drivers/r300/r300_state_invariant.c47
-rw-r--r--src/gallium/drivers/r300/r300_state_invariant.h1
-rw-r--r--src/gallium/drivers/r300/r300_state_shader.c125
-rw-r--r--src/gallium/drivers/r300/r300_state_shader.h90
-rw-r--r--src/gallium/drivers/r300/r300_state_tcl.c285
-rw-r--r--src/gallium/drivers/r300/r300_state_tcl.h146
-rw-r--r--src/gallium/drivers/r300/r300_surface.c147
-rw-r--r--src/gallium/drivers/r300/r300_surface.h42
-rw-r--r--src/gallium/drivers/r300/r300_texture.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_clear.c70
-rw-r--r--src/gallium/drivers/softpipe/sp_clear.h4
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_exec.c17
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_llvm.c14
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_sse.c25
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_fs.c21
-rw-r--r--src/gallium/drivers/softpipe/sp_setup.c27
-rw-r--r--src/gallium/drivers/softpipe/sp_surface.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c7
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c43
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.h3
-rw-r--r--src/gallium/drivers/trace/README6
-rw-r--r--src/gallium/drivers/trace/tr_context.c31
-rw-r--r--src/gallium/drivers/trace/tr_dump.c33
-rw-r--r--src/gallium/drivers/trace/tr_screen.c31
-rw-r--r--src/gallium/drivers/trace/tr_state.c2
-rw-r--r--src/gallium/drivers/trace/tr_texture.c12
-rw-r--r--src/gallium/drivers/trace/tr_texture.h27
-rw-r--r--src/gallium/drivers/trace/trace.xsl3
-rw-r--r--src/gallium/include/pipe/p_compiler.h19
-rw-r--r--src/gallium/include/pipe/p_config.h12
-rw-r--r--src/gallium/include/pipe/p_context.h16
-rw-r--r--src/gallium/include/pipe/p_defines.h9
-rw-r--r--src/gallium/include/pipe/p_format.h7
-rw-r--r--src/gallium/include/pipe/p_refcnt.h12
-rw-r--r--src/gallium/include/pipe/p_state.h2
-rw-r--r--src/gallium/include/pipe/p_thread.h10
-rw-r--r--src/gallium/state_trackers/egl/egl_surface.c9
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.c29
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.h3
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_basic_csc.c3
-rw-r--r--src/gallium/state_trackers/python/README24
-rw-r--r--src/gallium/state_trackers/python/gallium.i8
-rw-r--r--src/gallium/state_trackers/python/p_context.i78
-rw-r--r--src/gallium/state_trackers/python/p_device.i4
-rw-r--r--src/gallium/state_trackers/python/p_state.i35
-rw-r--r--src/gallium/state_trackers/python/p_texture.i342
-rwxr-xr-xsrc/gallium/state_trackers/python/retrace/format.py75
-rwxr-xr-xsrc/gallium/state_trackers/python/retrace/interpreter.py218
-rwxr-xr-xsrc/gallium/state_trackers/python/retrace/model.py4
-rwxr-xr-xsrc/gallium/state_trackers/python/retrace/parser.py53
-rw-r--r--src/gallium/state_trackers/python/samples/tri.py69
-rw-r--r--src/gallium/state_trackers/python/st_device.c42
-rw-r--r--src/gallium/state_trackers/python/st_device.h25
-rw-r--r--src/gallium/state_trackers/python/st_sample.c24
-rw-r--r--src/gallium/state_trackers/python/st_sample.h2
-rw-r--r--src/gallium/state_trackers/python/st_softpipe_winsys.c3
-rw-r--r--src/gallium/state_trackers/python/tests/.gitignore3
-rwxr-xr-x[-rw-r--r--]src/gallium/state_trackers/python/tests/base.py169
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.sh13
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-add.sh8
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp3.sh8
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp4.sh8
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dst.sh8
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-ex2.sh11
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-flr.sh15
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-frc.sh13
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lg2.sh15
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lit.sh8
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lrp.sh11
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mad.sh11
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-max.sh10
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-min.sh10
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mov.sh8
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mul.sh10
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rcp.sh15
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rsq.sh15
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sge.sh13
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh13
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-abs.sh13
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-absneg.sh15
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-neg.sh11
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-swz.sh8
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sub.sh8
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-xpd.sh8
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py218
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh15
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh13
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arl.sh23
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arr.sh23
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh16
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh16
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dst.sh11
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh18
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-flr.sh23
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh15
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh18
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lit.sh11
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh14
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mad.sh14
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-max.sh13
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-min.sh13
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh11
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh13
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh18
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh18
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sge.sh16
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-slt.sh16
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-abs.sh15
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh16
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-neg.sh12
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh11
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh13
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh11
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py247
-rwxr-xr-xsrc/gallium/state_trackers/python/tests/surface_copy.py199
-rwxr-xr-xsrc/gallium/state_trackers/python/tests/texture_render.py320
-rwxr-xr-x[-rw-r--r--]src/gallium/state_trackers/python/tests/texture_sample.py (renamed from src/gallium/state_trackers/python/tests/texture.py)151
-rwxr-xr-xsrc/gallium/state_trackers/python/tests/texture_transfer.py179
-rwxr-xr-xsrc/gallium/state_trackers/python/tests/tree.py23
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_context.c27
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_device.c30
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_device.h5
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_framebuffer.c90
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_framebuffer.h5
-rw-r--r--src/gallium/winsys/drm/SConscript5
-rw-r--r--src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c3
-rw-r--r--src/gallium/winsys/drm/radeon/SConscript28
-rw-r--r--src/gallium/winsys/drm/radeon/core/SConscript17
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_buffer.c17
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_buffer.h3
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_r300.c15
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c17
-rw-r--r--src/gallium/winsys/drm/radeon/dri2/SConscript14
-rw-r--r--src/gallium/winsys/drm/radeon/python/README15
-rw-r--r--src/gallium/winsys/drm/radeon/python/SConscript33
-rw-r--r--src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c140
-rw-r--r--src/gallium/winsys/drm/radeon/python/xf86dri.c605
-rw-r--r--src/gallium/winsys/drm/radeon/python/xf86dri.h123
-rw-r--r--src/gallium/winsys/drm/radeon/python/xf86dristr.h389
-rw-r--r--src/gallium/winsys/gdi/SConscript3
-rw-r--r--src/glew/Makefile2
-rw-r--r--src/glx/x11/dri2_glx.c52
-rw-r--r--src/glx/x11/glx_pbuffer.c1
-rw-r--r--src/glx/x11/glxclient.h6
-rw-r--r--src/glx/x11/glxcurrent.c48
-rw-r--r--src/glx/x11/indirect.c60
-rw-r--r--src/glx/x11/indirect_vertex_program.c4
-rw-r--r--src/glx/x11/pixelstore.c4
-rw-r--r--src/mesa/SConscript1
-rw-r--r--src/mesa/drivers/common/driverfuncs.c1
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c35
-rw-r--r--src/mesa/drivers/dri/common/utils.c2
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_tex.c13
-rw-r--r--src/mesa/drivers/dri/i810/i810tex.c6
-rw-r--r--src/mesa/drivers/dri/i915/i830_texstate.c14
-rw-r--r--src/mesa/drivers/dri/i915/i915_texstate.c22
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h19
-rw-r--r--src/mesa/drivers/dri/i965/brw_curbe.c30
-rw-r--r--src/mesa/drivers/dri/i965/brw_defines.h26
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c66
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu.h14
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu_debug.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu_emit.c104
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c20
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf_emit.c32
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf_state.c28
-rw-r--r--src/mesa/drivers/dri/i965/brw_tex.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_emit.c42
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.h15
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_debug.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_emit.c54
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_fp.c62
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_glsl.c628
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_pass1.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_state.c32
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c160
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.c23
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c8
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h1
-rw-r--r--src/mesa/drivers/dri/intel/intel_decode.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_extensions.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c7
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.h1
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_format.c23
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c25
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_tex.c6
-rw-r--r--src/mesa/drivers/dri/mga/mgatex.c14
-rw-r--r--src/mesa/drivers/dri/r128/r128_tex.c11
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c8
-rw-r--r--src/mesa/drivers/dri/r200/r200_tex.c15
-rw-r--r--src/mesa/drivers/dri/r300/r300_cmdbuf.c10
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c6
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h2
-rw-r--r--src/mesa/drivers/dri/r300/r300_emit.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c32
-rw-r--r--src/mesa/drivers/dri/r300/r300_swtcl.c87
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.c11
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h19
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_lighting.c8
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c35
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c8
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tex.c11
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_tex.c13
-rw-r--r--src/mesa/drivers/dri/savage/savagetex.c6
-rw-r--r--src/mesa/drivers/dri/sis/sis_texstate.c15
-rw-r--r--src/mesa/glapi/gl_API.xml54
-rw-r--r--src/mesa/main/attrib.c2
-rw-r--r--src/mesa/main/colormac.h9
-rw-r--r--src/mesa/main/compiler.h5
-rw-r--r--src/mesa/main/config.h2
-rw-r--r--src/mesa/main/dlist.c2
-rw-r--r--src/mesa/main/drawpix.c52
-rw-r--r--src/mesa/main/enums.c6023
-rw-r--r--src/mesa/main/extensions.c1
-rw-r--r--src/mesa/main/ffvertex_prog.c65
-rw-r--r--src/mesa/main/image.c31
-rw-r--r--src/mesa/main/imports.c42
-rw-r--r--src/mesa/main/light.c31
-rw-r--r--src/mesa/main/macros.h22
-rw-r--r--src/mesa/main/matrix.c3
-rw-r--r--src/mesa/main/mipmap.c111
-rw-r--r--src/mesa/main/mtypes.h22
-rw-r--r--src/mesa/main/readpix.c3
-rw-r--r--src/mesa/main/shared.c8
-rw-r--r--src/mesa/main/sources1
-rw-r--r--src/mesa/main/texenv.c50
-rw-r--r--src/mesa/main/texenvprogram.c13
-rw-r--r--src/mesa/main/texformat.c406
-rw-r--r--src/mesa/main/texformat.h6
-rw-r--r--src/mesa/main/texformat_tmp.h493
-rw-r--r--src/mesa/main/texgetimage.c356
-rw-r--r--src/mesa/main/texgetimage.h46
-rw-r--r--src/mesa/main/teximage.c13
-rw-r--r--src/mesa/main/texparam.c152
-rw-r--r--src/mesa/main/texstore.c419
-rw-r--r--src/mesa/main/texstore.h14
-rw-r--r--src/mesa/math/m_matrix.c5
-rw-r--r--src/mesa/shader/arbprogparse.c11
-rw-r--r--src/mesa/shader/prog_execute.c8
-rw-r--r--src/mesa/shader/prog_instruction.c6
-rw-r--r--src/mesa/shader/prog_optimize.c6
-rw-r--r--src/mesa/shader/prog_parameter.c19
-rw-r--r--src/mesa/shader/prog_statevars.c136
-rw-r--r--src/mesa/shader/slang/slang_builtin.c24
-rw-r--r--src/mesa/shader/slang/slang_codegen.c19
-rw-r--r--src/mesa/shader/slang/slang_codegen.h1
-rw-r--r--src/mesa/shader/slang/slang_compile.c5
-rw-r--r--src/mesa/shader/slang/slang_emit.c7
-rw-r--r--src/mesa/shader/slang/slang_link.c141
-rw-r--r--src/mesa/shader/slang/slang_typeinfo.c1
-rw-r--r--src/mesa/sources.mak1
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c49
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c210
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c100
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c83
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.h3
-rw-r--r--src/mesa/state_tracker/st_cb_strings.c15
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c21
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c26
-rw-r--r--src/mesa/state_tracker/st_program.c8
-rw-r--r--src/mesa/state_tracker/st_public.h1
-rw-r--r--src/mesa/state_tracker/st_texture.c2
-rw-r--r--src/mesa/state_tracker/st_texture.h6
-rw-r--r--src/mesa/swrast/s_atifragshader.c7
-rw-r--r--src/mesa/swrast/s_context.c62
-rw-r--r--src/mesa/swrast/s_context.h7
-rw-r--r--src/mesa/swrast/s_fragprog.c21
-rw-r--r--src/mesa/swrast/s_points.c5
-rw-r--r--src/mesa/swrast/s_span.c24
-rw-r--r--src/mesa/swrast/s_texcombine.c1273
-rw-r--r--src/mesa/swrast/s_texfilter.c1001
-rw-r--r--src/mesa/tnl/t_rasterpos.c2
-rw-r--r--src/mesa/tnl/t_vb_lighttmp.h6
-rw-r--r--src/mesa/tnl/t_vb_program.c7
-rw-r--r--src/mesa/x86/gen_matypes.c4
512 files changed, 15313 insertions, 7906 deletions
diff --git a/SConstruct b/SConstruct
index 7e7f51516e8..1e5fd71adce 100644
--- a/SConstruct
+++ b/SConstruct
@@ -48,7 +48,7 @@ opts.Add(ListOption('statetrackers', 'state trackers to build', default_statetra
opts.Add(ListOption('drivers', 'pipe drivers to build', default_drivers,
['softpipe', 'failover', 'i915simple', 'i965simple', 'cell', 'trace', 'r300']))
opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys,
- ['xlib', 'intel', 'gdi', 'amd']))
+ ['xlib', 'intel', 'gdi', 'radeon']))
opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
diff --git a/bin/mklib b/bin/mklib
index d7b740f8e34..a3e826abac9 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -394,6 +394,30 @@ case $ARCH in
fi
fi
+ # If using Sun C++ compiler, need to tell it not to add runpaths
+ # that are specific to the build machine
+ if [ ${LINK} = "CC" ] ; then
+ OPTS="${OPTS} -norunpath"
+ fi
+
+ # Solaris linker requires explicitly listing the Standard C & C++
+ # libraries in the link path when building shared objects
+ if [ ${LINK} = "CC" ] ; then
+ DEPS="${DEPS} -lCrun"
+ fi
+ DEPS="${DEPS} -lc"
+
+ if [ $EXPORTS ] ; then
+ # Make the 'mapfile.scope' linker mapfile
+ echo "{" > mapfile.scope
+ echo "global:" >> mapfile.scope
+ sed 's/$/;/' ${EXPORTS} >> mapfile.scope
+ echo "local:" >> mapfile.scope
+ echo " *;" >> mapfile.scope
+ echo "};" >> mapfile.scope
+ OPTS="${OPTS} -Wl,-Mmapfile.scope"
+ fi
+
# Check if objects are SPARC v9
# file says: ELF 64-bit MSB relocatable SPARCV9 Version 1
set ${OBJECTS}
@@ -406,17 +430,19 @@ case $ARCH in
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
fi
+
# for debug:
#echo "mklib: linker is" ${LINK} ${OPTS}
if [ $NOPREFIX = 1 ] ; then
rm -f ${LIBNAME}
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
+ FINAL_LIBS="${LIBNAME}"
else
rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} -h ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
+ FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"
fi
- FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"
fi
;;
diff --git a/common.py b/common.py
index 1a99df41c01..f1c6372abde 100644
--- a/common.py
+++ b/common.py
@@ -61,7 +61,7 @@ def AddOptions(opts):
opts.Add(EnumOption('platform', 'target platform', default_platform,
allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince')))
opts.Add(EnumOption('toolchain', 'compiler toolchain', 'default',
- allowed_values=('default', 'crossmingw', 'winddk')))
+ allowed_values=('default', 'crossmingw', 'winsdk', 'winddk')))
opts.Add(BoolOption('llvm', 'use LLVM', 'no'))
opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))
diff --git a/configure.ac b/configure.ac
index f81f34966b8..fd0d5110424 100644
--- a/configure.ac
+++ b/configure.ac
@@ -375,17 +375,6 @@ if test "x$enable_selinux" = "xyes"; then
DEFINES="$DEFINES -DMESA_SELINUX"
fi
-dnl OS-specific libraries
-OS_LIBS=""
-case "$host_os" in
-solaris*)
- OS_LIBS="-lc"
- if test "x$GXX" != xyes; then
- OS_CPLUSPLUS_LIBS="-lCrun $OS_LIBS"
- fi
- ;;
-esac
-
dnl
dnl Driver configuration. Options are xlib, dri and osmesa right now.
dnl More later: directfb, fbdev, ...
@@ -563,8 +552,8 @@ xlib)
GL_PC_LIB_PRIV="$GL_LIB_DEPS"
GL_PC_CFLAGS="$X11_INCLUDES"
fi
- GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS"
- GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $OS_LIBS"
+ GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
+ GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
# if static, move the external libraries to the programs
# and empty the libraries for libGL
@@ -621,12 +610,12 @@ dri)
fi
# need DRM libs, -lpthread, etc.
- GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS"
- GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS $OS_LIBS"
+ GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
+ GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
;;
osmesa)
# No libGL for osmesa
- GL_LIB_DEPS="$OS_LIBS"
+ GL_LIB_DEPS=""
;;
esac
AC_SUBST([GL_LIB_DEPS])
@@ -869,9 +858,9 @@ osmesa)
;;
esac
if test "$enable_static" = no; then
- OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS"
+ OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS"
fi
-OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV $OS_LIBS"
+OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
AC_SUBST([OSMESA_LIB_DEPS])
AC_SUBST([OSMESA_MESA_DEPS])
AC_SUBST([OSMESA_PC_REQ])
@@ -887,7 +876,7 @@ else
# should check these...
EGL_LIB_DEPS="$X_LIBS -lX11"
fi
-EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS $OS_LIBS"
+EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
AC_SUBST([EGL_LIB_DEPS])
dnl
@@ -997,10 +986,10 @@ if test "x$enable_glw" = xyes; then
fi
# If static, empty GLW_LIB_DEPS and add libs for programs to link
- GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV $OS_LIBS"
+ GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
if test "$enable_static" = no; then
GLW_MESA_DEPS='-l$(GL_LIB)'
- GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS"
+ GLW_LIB_DEPS="$GLW_LIB_DEPS"
else
APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
GLW_LIB_DEPS=""
@@ -1056,8 +1045,8 @@ if test "x$enable_glut" = xyes; then
GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
GLUT_PC_CFLAGS="$X11_INCLUDES"
fi
- GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS"
- GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm $OS_LIBS"
+ GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
+ GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
# If glut is available, we can build most programs
if test "$with_demos" = yes; then
diff --git a/docs/MESA_texture_signed_rgba.spec b/docs/MESA_texture_signed_rgba.spec
new file mode 100644
index 00000000000..49c8e9e5dd4
--- /dev/null
+++ b/docs/MESA_texture_signed_rgba.spec
@@ -0,0 +1,214 @@
+Name
+
+ MESA_texture_signed_rgba
+
+Name Strings
+
+ GL_MESA_texture_signed_rgba
+
+Contact
+
+
+
+Notice
+
+
+
+IP Status
+
+ No known IP issues
+
+Status
+
+
+
+Version
+
+ 0.3, 2009-03-24
+
+Number
+
+ Not assigned ?
+
+Dependencies
+
+ Written based on the wording of the OpenGL 2.0 specification.
+
+ This extension trivially interacts with ARB_texture_float.
+ This extension shares some language with ARB_texture_compression_rgtc
+ but does not depend on it.
+
+Overview
+
+ OpenGL prior to 3.1 does not support any signed texture formats.
+ ARB_texture_compression_rgtc introduces some compressed red and
+ red_green signed formats but no uncompressed ones, which might
+ still be useful. NV_texture_shader adds signed texture formats,
+ but also a lot of functionality which has been superceded by fragment
+ shaders.
+ It is usually possible to get the same functionality
+ using a unsigned format by doing scale and bias in a shader, but this
+ is undesirable since modern hardware has direct support for this.
+ This extension adds a signed 4-channel texture format by backporting
+ the relevant features from OpenGL 3.1, as a means to support this in
+ OpenGL implementations only supporting older versions.
+
+Issues
+
+ 1) What should this extension be called?
+
+ RESOLVED: MESA_texture_signed_rgba seems reasonable.
+ The rgba part is there because only 4 channel format is supported.
+
+
+ 2) Should the full set of signed formats (alpha, luminance, rgb, etc.)
+ be supported?
+
+ RESOLVED: NO. To keep this extension simple, only add the most
+ universal format, rgba. alpha/luminance can't be trivially supported
+ since OpenGL 3.1 does not support them any longer, and there is some
+ implied dependency on ARB_texture_rg for red/red_green formats so
+ avoid all this. Likewise, only 8 bits per channel is supported.
+
+
+ 3) Should this extension use new enums for the texture formats?
+
+ RESOLVED: NO. Same enums as those used in OpenGL 3.1.
+
+
+ 4) How are signed integer values mapped to floating-point values?
+
+ RESOLVED: Same as described in issue 5) of
+ ARB_texture_compression_rgtc (quote):
+ A signed 8-bit two's complement value X is computed to
+ a floating-point value Xf with the formula:
+
+ { X / 127.0, X > -128
+ Xf = {
+ { -1.0, X == -128
+
+ This conversion means -1, 0, and +1 are all exactly representable,
+ however -128 and -127 both map to -1.0. Mapping -128 to -1.0
+ avoids the numerical awkwardness of have a representable value
+ slightly more negative than -1.0.
+
+ This conversion is intentionally NOT the "byte" conversion listed
+ in Table 2.9 for component conversions. That conversion says:
+
+ Xf = (2*X + 1) / 255.0
+
+ The Table 2.9 conversion is incapable of exactly representing
+ zero.
+
+ (Difference to ARB_texture_compression_rgtc):
+ This is the same mapping as OpenGL 3.1 uses.
+ This is also different to what NV_texture_shader used.
+ The above mapping should be considered the reference, but there
+ is some leeway so other mappings are allowed for implementations which
+ cannot do this. Particulary the mapping given in NV_texture_shader or
+ the standard OpenGL byte/float mapping is considered acceptable too, as
+ might be a mapping which represents -1.0 by -128, 0.0 by 0 and 1.0 by
+ 127 (that is, uses different scale factors for negative and positive
+ numbers).
+ Also, it is ok to store incoming GL_BYTE user data as-is, without
+ converting to GL_FLOAT (using the standard OpenGL float/byte mapping)
+ and converting back (using the mapping described here).
+ Other than those subtle issues there are no other non-standard
+ conversions used, so when using for instance CopyTexImage2D with
+ a framebuffer clamped to [0,1] all converted numbers will be in the range
+ [0, 127] (and not scaled and biased).
+
+
+ 5) How will signed components resulting from RGBA8_SNORM texture
+ fetches interact with fragment coloring?
+
+ RESOLVED: Same as described in issue 6) of
+ ARB_texture_compression_rgtc (quote):
+ The specification language for this extension is silent
+ about clamping behavior leaving this to the core specification
+ and other extensions. The clamping or lack of clamping is left
+ to the core specification and other extensions.
+
+ For assembly program extensions supporting texture fetches
+ (ARB_fragment_program, NV_fragment_program, NV_vertex_program3,
+ etc.) or the OpenGL Shading Language, these signed formats will
+ appear as expected with unclamped signed components as a result
+ of a texture fetch instruction.
+
+ If ARB_color_buffer_float is supported, its clamping controls
+ will apply.
+
+ NV_texture_shader extension, if supported, adds support for
+ fixed-point textures with signed components and relaxed the
+ fixed-function texture environment clamping appropriately. If the
+ NV_texture_shader extension is supported, its specified behavior
+ for the texture environment applies where intermediate values
+ are clamped to [-1,1] unless stated otherwise as in the case
+ of explicitly clamped to [0,1] for GL_COMBINE. or clamping the
+ linear interpolation weight to [0,1] for GL_DECAL and GL_BLEND.
+
+ Otherwise, the conventional core texture environment clamps
+ incoming, intermediate, and output color components to [0,1].
+
+ This implies that the conventional texture environment
+ functionality of unextended OpenGL 1.5 or OpenGL 2.0 without
+ using GLSL (and with none of the extensions referred to above)
+ is unable to make proper use of the signed texture formats added
+ by this extension because the conventional texture environment
+ requires texture source colors to be clamped to [0,1]. Texture
+ filtering of these signed formats would be still signed, but
+ negative values generated post-filtering would be clamped to
+ zero by the core texture environment functionality. The
+ expectation is clearly that this extension would be co-implemented
+ with one of the previously referred to extensions or used with
+ GLSL for the new signed formats to be useful.
+
+
+ 6) Should the RGBA_SNORM tokens also be accepted by CopyTexImage
+ functions?
+
+ RESOLVED: YES.
+
+
+ 7) What to do with GetTexParameter if ARB_texture_float is supported,
+ in particular what datatype should this return for TEXTURE_RED_TYPE_ARB,
+ TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB, TEXTURE_ALPHA_TYPE_ARB?
+
+ RESOLVED: ARB_texture_float states type is either NONE,
+ UNSIGNED_NORMALIZED_ARB, or FLOAT. This extension adds a new enum,
+ SIGNED_NORMALIZED, which will be returned accordingly. This is the
+ same behaviour as in OpenGL 3.1.
+
+
+New Tokens
+
+
+ Accepted by the <internalformat> parameter of
+ TexImage1D, TexImage2D, TexImage3D, CopyTexImage1D, and CopyTexImage2D:
+
+ RGBA_SNORM 0x8F93
+ RGBA8_SNORM 0x8F97
+
+ Returned by the <params> parameter of GetTexLevelParameter:
+
+ SIGNED_NORMALIZED 0x8F9C
+
+
+Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization):
+
+ -- Section 3.8.1, Texture Image Specification
+
+ Add to Table 3.16 (page 154): Sized internal formats
+
+ Sized Base R G B A L I D
+ Internal Format Internal Format bits bits bits bits bits bits bits
+ --------------- --------------- ---- ---- ---- ---- ---- ---- ----
+ RGBA8_SNORM RGBA 8 8 8 8 0 0 0
+
+
+Dependencies on ARB_texture_float extension:
+
+ If ARB_texture_float is supported, GetTexParameter queries with <value>
+ of TEXTURE_RED_TYPE_ARB, TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB or
+ TEXTURE_ALPHA_TYPE_ARB return SIGNED_NORMALIZED if
+ the base internal format is RGBA_SNORM.
diff --git a/docs/cell.html b/docs/cell.html
index 49b62cac7b0..ada903cf8a9 100644
--- a/docs/cell.html
+++ b/docs/cell.html
@@ -14,16 +14,7 @@ The Mesa
driver is part of the
<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D" target="_parent">Gallium3D</a>
architecture.
-</p>
-
-<p>
-<a href="http://www.tungstengraphics.com/" target="_parent">Tungsten Graphics</a>
-is leading the project.
-Two phases are planned.
-First, to implement the framework for parallel rasterization using the Cell
-SPEs, including texture mapping.
-Second, to implement a full-featured OpenGL driver with support for GLSL, etc.
-The second phase is now underway.
+Tungsten Graphics did the original implementation of the Cell driver.
</p>
@@ -60,7 +51,7 @@ Mesa tree, then set <code>LD_LIBRARY_PATH</code> like this:
Verify that the Cell driver is being used by running
<code>progs/xdemos/glxinfo</code> and looking for:
<pre>
- OpenGL renderer string: Gallium 0.2, Cell on Xlib
+ OpenGL renderer string: Gallium 0.3, Cell on Xlib
</pre>
diff --git a/docs/extensions.html b/docs/extensions.html
index dbb8ebadaf2..91ed20e5ceb 100644
--- a/docs/extensions.html
+++ b/docs/extensions.html
@@ -24,6 +24,7 @@ The specifications follow.
<LI><A HREF="MESA_resize_buffers.spec">MESA_resize_buffers.spec</A>
<LI><A HREF="MESA_set_3dfx_mode.spec">MESA_set_3dfx_mode.spec</A>
<LI><A HREF="MESA_sprite_point.spec">MESA_sprite_point.spec</A> (obsolete)
+<LI><A HREF="MESA_texture_signed_rgba.spec">MESA_texture_signed_rgba.spec</A>
<LI><A HREF="MESA_trace.spec">MESA_trace.spec</A> (obsolete)
<LI><A HREF="MESA_window_pos.spec">MESA_window_pos.spec</A>
<LI><A HREF="MESA_ycbcr_texture.spec">MESA_ycbcr_texture.spec</A>
diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html
index f29553b0fb2..3c822da863b 100644
--- a/docs/relnotes-7.5.html
+++ b/docs/relnotes-7.5.html
@@ -12,6 +12,13 @@
<p>
Mesa 7.5 is a new development release.
+People who are concerned with stability and reliability should stick
+with the 7.4.x branch or wait for Mesa 7.6.
+</p>
+<p>
+The main new feature of Mesa 7.5 is the
+<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
+target="_parent">Gallium3D</a> infrastructure.
</p>
<p>
Mesa 7.5 implements the OpenGL 2.1 API, but the version reported by
@@ -32,6 +39,17 @@ tbd
<h2>New features</h2>
<ul>
+<li>Gallium - this is the new architecture for OS-independent and
+ API-independent 3D drivers.
+ Gallium3D is intended for GPUs that fully support vertex/fragment shaders.
+ The Gallium3D drivers currently included are:
+ <ul>
+ <li>softpipe - a software/reference driver
+ <li>i915 - Intel 915/945 driver
+ <li><a href="cell.html">Cell</a> - IBM/Sony/Toshiba Cell processor driver
+ <li>nouveau - preliminary driver for NVIDIA GPUs (still under development)
+ <li>r300 - preliminary driver for R300 (still under development)
+ </ul>
<li>GL_ARB_framebuffer_object extension (software drivers, i965 driver)
<li>Reworked two-sided stencil support.
This allows a driver to support all three variations of two-sided stencil
@@ -45,8 +63,10 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
<h2>Bug fixes</h2>
<ul>
+<li>Lots of i965 driver bug fixes
</ul>
+
<h2>Changes</h2>
<ul>
<li>Remove support for GL_SGIX_shadow, GL_SGIX_shadow_ambient and
diff --git a/docs/shading.html b/docs/shading.html
index b77745fbf37..77c86be3aa6 100644
--- a/docs/shading.html
+++ b/docs/shading.html
@@ -22,6 +22,7 @@ Last updated on 15 December 2008.
Contents
</p>
<ul>
+<li><a href="#envvars">Environment variables</a>
<li><a href="#120">GLSL 1.20 support</a>
<li><a href="#unsup">Unsupported Features</a>
<li><a href="#notes">Implementation Notes</a>
@@ -33,11 +34,32 @@ Contents
+<a name="envvars">
+<h2>Environment Variables</h2>
+
+<p>
+The <b>MESA_GLSL</b> environment variable can be set to a comma-separated
+list of keywords to control some aspects of the GLSL compiler:
+</p>
+<ul>
+<li>dump - print GLSL shader code to stdout at link time
+<li>log - log all GLSL shaders to files.
+ The filenames will be "shader_X.vert" or "shader_X.frag" where X
+ the shader ID.
+<li>nopt - disable compiler optimizations
+<li>opt - force compiler optimizations
+<li>uniform - print message to stdout when glUniform is called
+</ul>
+<p>
+Example: export MESA_GLSL=dump,nopt
+</p>
+
+
<a name="120">
<h2>GLSL 1.20 support</h2>
<p>
-GLSL version 1.20 is supported in Mesa 7.3.
+GLSL version 1.20 is supported in Mesa 7.3 and later.
Among the features/differences of GLSL 1.20 are:
<ul>
<li><code>mat2x3, mat2x4</code>, etc. types and functions
@@ -59,12 +81,14 @@ Among the features/differences of GLSL 1.20 are:
<h2>Unsupported Features</h2>
<p>
-The following features of the shading language are not yet supported
+The following features of the shading language are not yet fully supported
in Mesa:
</p>
<ul>
-<li>Linking of multiple shaders is not supported
+<li>Linking of multiple shaders does not always work. Currently, linking
+ is implemented through shader concatenation and re-compiling. This
+ doesn't always work because of some #pragma and preprocessor issues.
<li>gl_ClipVertex
<li>The gl_Color and gl_SecondaryColor varying vars are interpolated
without perspective correction
@@ -177,6 +201,8 @@ This tool is useful for:
After building Mesa, the glslcompiler can be built by manually running:
</p>
<pre>
+ make realclean
+ make linux
cd src/mesa/drivers/glslcompiler
make
</pre>
diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
index a4698ccd160..b65f7f2bcc6 100644
--- a/include/EGL/eglext.h
+++ b/include/EGL/eglext.h
@@ -136,8 +136,8 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGL
#define EGL_INTERLACED_MESA 0x4008
#define EGL_SCREEN_BIT_MESA 0x08
-typedef u_int32_t EGLScreenMESA;
-typedef u_int32_t EGLModeMESA;
+typedef uint32_t EGLScreenMESA;
+typedef uint32_t EGLModeMESA;
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
index d873428d756..83e89cd7043 100644
--- a/include/EGL/eglplatform.h
+++ b/include/EGL/eglplatform.h
@@ -15,6 +15,7 @@
#if !defined(_WIN32_WCE)
#include <sys/types.h>
+#include <stdint.h>
#endif
/* Macros used in EGL function prototype declarations.
@@ -57,7 +58,7 @@
#endif
typedef long int32_t;
-typedef unsigned long u_int32_t;
+typedef unsigned long uint32_t;
typedef unsigned char uint8_t;
#define snprintf _snprintf
#define strcasecmp _stricmp
@@ -68,7 +69,7 @@ typedef HWND NativeWindowType;
typedef HBITMAP NativePixmapType;
/** END Added for Windows **/
-#elif defined(__gnu_linux__) || defined(__FreeBSD__)
+#elif defined(__gnu_linux__) || defined(__FreeBSD__) || defined(__sun)
/** BEGIN Added for X (Mesa) **/
#ifndef EGLAPI
diff --git a/include/GL/glext.h b/include/GL/glext.h
index d3f01a2b6c4..41149c935a9 100644
--- a/include/GL/glext.h
+++ b/include/GL/glext.h
@@ -46,9 +46,9 @@ extern "C" {
/*************************************************************/
/* Header file version number, required by OpenGL ABI for Linux */
-/* glext.h last updated 2009/03/04 */
+/* glext.h last updated 2009/03/19 */
/* Current version at http://www.opengl.org/registry/ */
-#define GL_GLEXT_VERSION 46
+#define GL_GLEXT_VERSION 48
#ifndef GL_VERSION_1_2
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
@@ -716,6 +716,24 @@ extern "C" {
/* reuse GL_VERTEX_ARRAY_BINDING */
#endif
+#ifndef GL_VERSION_3_1
+#define GL_RED_SNORM 0x8F90
+#define GL_RG_SNORM 0x8F91
+#define GL_RGB_SNORM 0x8F92
+#define GL_RGBA_SNORM 0x8F93
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_R16_SNORM 0x8F98
+#define GL_RG16_SNORM 0x8F99
+#define GL_RGB16_SNORM 0x8F9A
+#define GL_RGBA16_SNORM 0x8F9B
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_PRIMITIVE_RESTART 0x8F9D
+#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E
+#endif
+
#ifndef GL_ARB_multitexture
#define GL_TEXTURE0_ARB 0x84C0
#define GL_TEXTURE1_ARB 0x84C1
@@ -1327,6 +1345,7 @@ extern "C" {
#endif
#ifndef GL_ARB_instanced_arrays
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE
#endif
#ifndef GL_ARB_map_buffer_range
@@ -1382,6 +1401,51 @@ extern "C" {
#define GL_VERTEX_ARRAY_BINDING 0x85B5
#endif
+#ifndef GL_ARB_uniform_buffer_object
+#define GL_UNIFORM_BUFFER 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING 0x8A28
+#define GL_UNIFORM_BUFFER_START 0x8A29
+#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+#define GL_UNIFORM_TYPE 0x8A37
+#define GL_UNIFORM_SIZE 0x8A38
+#define GL_UNIFORM_NAME_LENGTH 0x8A39
+#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+#define GL_UNIFORM_OFFSET 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX_ARB 0xFFFFFFFFu
+#endif
+
+#ifndef GL_ARB_compatibility
+/* ARB_compatibility just defines tokens from core 3.0 */
+#endif
+
+#ifndef GL_ARB_copy_buffer
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#endif
+
#ifndef GL_EXT_abgr
#define GL_ABGR_EXT 0x8000
#endif
@@ -3878,6 +3942,26 @@ extern "C" {
#define GL_PERFMON_RESULT_AMD 0x8BC6
#endif
+#ifndef GL_AMD_texture_texture4
+#endif
+
+#ifndef GL_AMD_vertex_shader_tesselator
+#define GL_SAMPLER_BUFFER_AMD 0x9001
+#define GL_INT_SAMPLER_BUFFER_AMD 0x9002
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003
+#define GL_TESSELLATION_MODE_AMD 0x9004
+#define GL_TESSELLATION_FACTOR_AMD 0x9005
+#define GL_DISCRETE_AMD 0x9006
+#define GL_CONTINUOUS_AMD 0x9007
+#endif
+
+#ifndef GL_EXT_provoking_vertex
+#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C
+#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E
+#define GL_PROVOKING_VERTEX_EXT 0x8E4F
+#endif
+
/*************************************************************/
@@ -4503,8 +4587,8 @@ GLAPI void APIENTRY glBeginTransformFeedback (GLenum);
GLAPI void APIENTRY glEndTransformFeedback (void);
GLAPI void APIENTRY glBindBufferRange (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
GLAPI void APIENTRY glBindBufferBase (GLenum, GLuint, GLuint);
-GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint, GLsizei, const GLint *, GLenum);
-GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLint *);
+GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint, GLsizei, const GLchar* *, GLenum);
+GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
GLAPI void APIENTRY glClampColor (GLenum, GLenum);
GLAPI void APIENTRY glBeginConditionalRender (GLuint, GLenum);
GLAPI void APIENTRY glEndConditionalRender (void);
@@ -4562,8 +4646,8 @@ typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLint *location);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);
typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);
typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void);
@@ -5321,6 +5405,38 @@ typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
#endif
+#ifndef GL_ARB_uniform_buffer_object
+#define GL_ARB_uniform_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetUniformIndices (GLuint, GLsizei, const GLchar* *, GLuint *);
+GLAPI void APIENTRY glGetActiveUniformsiv (GLuint, GLsizei, const GLuint *, GLenum, GLint *);
+GLAPI void APIENTRY glGetActiveUniformName (GLuint, GLuint, GLsizei, GLsizei *, GLchar *);
+GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint, const GLchar *);
+GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint, GLuint, GLenum, GLint *);
+GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint, GLuint, GLsizei, GLsizei *, GLchar *);
+GLAPI void APIENTRY glUniformBlockBinding (GLuint, GLuint, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
+typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+#endif
+
+#ifndef GL_ARB_compatibility
+#define GL_ARB_compatibility 1
+#endif
+
+#ifndef GL_ARB_copy_buffer
+#define GL_ARB_copy_buffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCopyBufferSubData (GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#endif
+
#ifndef GL_EXT_abgr
#define GL_EXT_abgr 1
#endif
@@ -8053,16 +8169,16 @@ GLAPI void APIENTRY glEndTransformFeedbackEXT (void);
GLAPI void APIENTRY glBindBufferRangeEXT (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum, GLuint, GLuint, GLintptr);
GLAPI void APIENTRY glBindBufferBaseEXT (GLenum, GLuint, GLuint);
-GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint, GLsizei, const GLint *, GLenum);
-GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint, GLuint, GLint *);
+GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint, GLsizei, const GLchar* *, GLenum);
+GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode);
typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void);
typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLint *location);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
#endif
#ifndef GL_EXT_direct_state_access
@@ -8515,6 +8631,28 @@ typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
#endif
+#ifndef GL_AMD_texture_texture4
+#define GL_AMD_texture_texture4 1
+#endif
+
+#ifndef GL_AMD_vertex_shader_tesselator
+#define GL_AMD_vertex_shader_tesselator 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTessellationFactorAMD (GLfloat);
+GLAPI void APIENTRY glTessellationModeAMD (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor);
+typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);
+#endif
+
+#ifndef GL_EXT_provoking_vertex
+#define GL_EXT_provoking_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProvokingVertexEXT (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);
+#endif
+
#ifdef __cplusplus
}
diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c
index bc490c05201..6c15540d38d 100644
--- a/progs/fp/fp-tri.c
+++ b/progs/fp/fp-tri.c
@@ -210,11 +210,17 @@ static void Display(void)
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, 1.0, 1.0, 0.0, 0.0);
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 0.0, 0.0, 1.0, 1.0);
glBegin(GL_TRIANGLES);
+
glColor3f(0,0,1);
+ glTexCoord3f(1,1,0);
glVertex3f( 0.9, -0.9, -30.0);
+
glColor3f(1,0,0);
+ glTexCoord3f(1,-1,0);
glVertex3f( 0.9, 0.9, -30.0);
+
glColor3f(0,1,0);
+ glTexCoord3f(-1,0,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
diff --git a/progs/fp/kill-pos.txt b/progs/fp/kil-pos.txt
index 5ff4f6f2c84..5ff4f6f2c84 100644
--- a/progs/fp/kill-pos.txt
+++ b/progs/fp/kil-pos.txt
diff --git a/progs/fp/kil-texcoord-sgt.txt b/progs/fp/kil-texcoord-sgt.txt
new file mode 100644
index 00000000000..c74fd10dacb
--- /dev/null
+++ b/progs/fp/kil-texcoord-sgt.txt
@@ -0,0 +1,8 @@
+!!ARBfp1.0
+TEMP R0;
+MUL R0.xy, fragment.texcoord[0], fragment.texcoord[0];
+ADD R0.x, R0.x, R0.y;
+SGE R0.y, R0.x, fragment.texcoord[0].w;
+KIL -R0.y;
+MOV result.color, fragment.color;
+END
diff --git a/progs/glsl/.gitignore b/progs/glsl/.gitignore
index 5fdb4ef16d4..d3e31163d8e 100644
--- a/progs/glsl/.gitignore
+++ b/progs/glsl/.gitignore
@@ -6,6 +6,7 @@ deriv
extfuncs.h
fragcoord
identity
+linktest
mandelbrot
multinoise
multitex
diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile
index 80612770332..0f1a299570f 100644
--- a/progs/glsl/Makefile
+++ b/progs/glsl/Makefile
@@ -17,6 +17,7 @@ PROGS = \
deriv \
identity \
fragcoord \
+ linktest \
mandelbrot \
multinoise \
multitex \
@@ -128,6 +129,12 @@ fragcoord: fragcoord.o shaderutil.o
$(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) fragcoord.o shaderutil.o $(LIBS) -o $@
+linktest.o: linktest.c extfuncs.h shaderutil.h
+ $(APP_CC) -c -I$(INCDIR) $(CFLAGS) linktest.c
+
+linktest: linktest.o shaderutil.o
+ $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) linktest.o shaderutil.o $(LIBS) -o $@
+
mandelbrot.o: mandelbrot.c extfuncs.h shaderutil.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) mandelbrot.c
diff --git a/progs/glsl/linktest.c b/progs/glsl/linktest.c
new file mode 100644
index 00000000000..601b24e893e
--- /dev/null
+++ b/progs/glsl/linktest.c
@@ -0,0 +1,258 @@
+/**
+ * Test linking of multiple compilation units.
+ * Brian Paul
+ * 28 March 2009
+ */
+
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <GL/gl.h>
+#include <GL/glut.h>
+#include <GL/glext.h>
+#include "extfuncs.h"
+#include "shaderutil.h"
+
+
+static GLfloat diffuse[4] = { 0.5f, 1.0f, 0.5f, 1.0f };
+static GLfloat specular[4] = { 0.8f, 0.8f, 0.8f, 1.0f };
+static GLfloat lightPos[4] = { 0.0f, 10.0f, 20.0f, 0.0f };
+static GLfloat delta = 1.0f;
+
+static GLuint VertShader1;
+static GLuint VertShader2;
+static GLuint FragShader1;
+static GLuint FragShader2;
+static GLuint Program;
+
+static GLint uDiffuse;
+static GLint uSpecular;
+static GLint uTexture;
+
+static GLint Win = 0;
+static GLboolean anim = GL_TRUE;
+
+
+
+static const char *FragShaderSource1 =
+ "float compute_dotprod(const vec3 normal) \n"
+ "{ \n"
+ " float dotProd = max(dot(gl_LightSource[0].position.xyz, \n"
+ " normalize(normal)), 0.0); \n"
+ " return dotProd; \n"
+ "} \n";
+
+static const char *FragShaderSource2 =
+ "uniform vec4 diffuse;\n"
+ "uniform vec4 specular;\n"
+ "varying vec3 normal;\n"
+ "\n"
+ "// external function \n"
+ "float compute_dotprod(const vec3 normal); \n"
+ "\n"
+ "void main() \n"
+ "{ \n"
+ " float dotProd = compute_dotprod(normal); \n"
+ " gl_FragColor = diffuse * dotProd + specular * pow(dotProd, 20.0); \n"
+ "} \n";
+
+
+static const char *VertShaderSource1 =
+ "vec3 compute_normal() \n"
+ "{ \n"
+ " return gl_NormalMatrix * gl_Normal; \n"
+ "} \n";
+
+static const char *VertShaderSource2 =
+ "varying vec3 normal;\n"
+ "\n"
+ "// external function \n"
+ "vec3 compute_normal(); \n"
+ "\n"
+ "void main() \n"
+ "{ \n"
+ " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n"
+ " normal = compute_normal(); \n"
+ "} \n";
+
+
+static void
+normalize(GLfloat *dst, const GLfloat *src)
+{
+ GLfloat len = sqrt(src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
+ dst[0] = src[0] / len;
+ dst[1] = src[1] / len;
+ dst[2] = src[2] / len;
+ dst[3] = src[3];
+}
+
+
+static void
+Redisplay(void)
+{
+ GLfloat vec[4];
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ /* update light position */
+ normalize(vec, lightPos);
+ glLightfv(GL_LIGHT0, GL_POSITION, vec);
+
+ glutSolidSphere(2.0, 10, 5);
+
+ glutSwapBuffers();
+}
+
+
+static void
+Idle(void)
+{
+ lightPos[0] += delta;
+ if (lightPos[0] > 25.0f || lightPos[0] < -25.0f)
+ delta = -delta;
+ glutPostRedisplay();
+}
+
+
+static void
+Reshape(int width, int height)
+{
+ glViewport(0, 0, width, height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0f, 0.0f, -15.0f);
+}
+
+
+static void
+CleanUp(void)
+{
+ glDeleteShader_func(VertShader1);
+ glDeleteShader_func(VertShader2);
+ glDeleteShader_func(FragShader1);
+ glDeleteShader_func(FragShader2);
+ glDeleteProgram_func(Program);
+ glutDestroyWindow(Win);
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+ (void) x;
+ (void) y;
+
+ switch(key) {
+ case ' ':
+ case 'a':
+ anim = !anim;
+ if (anim)
+ glutIdleFunc(Idle);
+ else
+ glutIdleFunc(NULL);
+ break;
+ case 'x':
+ lightPos[0] -= 1.0f;
+ break;
+ case 'X':
+ lightPos[0] += 1.0f;
+ break;
+ case 27:
+ CleanUp();
+ exit(0);
+ break;
+ }
+ glutPostRedisplay();
+}
+
+
+static void
+CheckLink(GLuint prog)
+{
+ GLint stat;
+ glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
+ if (!stat) {
+ GLchar log[1000];
+ GLsizei len;
+ glGetProgramInfoLog_func(prog, 1000, &len, log);
+ fprintf(stderr, "Linker error:\n%s\n", log);
+ }
+}
+
+
+static void
+Init(void)
+{
+ if (!ShadersSupported())
+ exit(1);
+
+ GetExtensionFuncs();
+
+ printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
+
+ VertShader1 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource1);
+ VertShader2 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource2);
+ FragShader1 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource1);
+ FragShader2 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource2);
+
+ Program = glCreateProgram_func();
+ glAttachShader_func(Program, VertShader1);
+ glAttachShader_func(Program, VertShader2);
+ glAttachShader_func(Program, FragShader1);
+ glAttachShader_func(Program, FragShader2);
+
+ glLinkProgram_func(Program);
+
+ CheckLink(Program);
+
+ glUseProgram_func(Program);
+
+ uDiffuse = glGetUniformLocation_func(Program, "diffuse");
+ uSpecular = glGetUniformLocation_func(Program, "specular");
+ uTexture = glGetUniformLocation_func(Program, "texture");
+ printf("DiffusePos %d SpecularPos %d TexturePos %d\n",
+ uDiffuse, uSpecular, uTexture);
+
+ glUniform4fv_func(uDiffuse, 1, diffuse);
+ glUniform4fv_func(uSpecular, 1, specular);
+
+ glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
+ glEnable(GL_DEPTH_TEST);
+
+ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
+ glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 10.0f);
+
+ assert(glIsProgram_func(Program));
+ assert(glIsShader_func(VertShader1));
+ assert(glIsShader_func(VertShader2));
+ assert(glIsShader_func(FragShader1));
+ assert(glIsShader_func(FragShader2));
+
+ glColor3f(1, 0, 0);
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ glutInit(&argc, argv);
+ glutInitWindowPosition( 0, 0);
+ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
+ Win = glutCreateWindow(argv[0]);
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Redisplay);
+ if (anim)
+ glutIdleFunc(Idle);
+ Init();
+ glutMainLoop();
+ return 0;
+}
+
+
diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore
index 0ed3a885c26..e6369de3ab2 100644
--- a/progs/tests/.gitignore
+++ b/progs/tests/.gitignore
@@ -45,7 +45,10 @@ invert
jkrahntest
lineclip
manytex
+mapbufrange
+mapvbo
minmag
+mipgen
mipmap_limits
mipmap_view
multipal
@@ -54,10 +57,12 @@ packedpixels
pbo
prog_parameter
projtex
+quads
random
readrate
readtex.c
readtex.h
+rubberband
seccolor
sharedtex
shader_api
diff --git a/progs/tests/SConscript b/progs/tests/SConscript
index cfeb9d1c378..bf1e7f8a7d8 100644
--- a/progs/tests/SConscript
+++ b/progs/tests/SConscript
@@ -105,6 +105,7 @@ progs = [
'subtexrate',
'tex1d',
'texcmp',
+ 'texcompress2',
'texfilt',
'texgenmix',
'texline',
diff --git a/progs/tests/texcompress2.c b/progs/tests/texcompress2.c
index 3e8e9908cbe..cbb8f1d3a22 100644
--- a/progs/tests/texcompress2.c
+++ b/progs/tests/texcompress2.c
@@ -7,7 +7,6 @@
#include <stdio.h>
#include <GL/glew.h>
#include <GL/glut.h>
-#include <GL/glx.h>
#include "readtex.c"
#define IMAGE_FILE "../images/arch.rgb"
diff --git a/progs/trivial/.gitignore b/progs/trivial/.gitignore
index aec4c94527d..8dcb20a68ff 100644
--- a/progs/trivial/.gitignore
+++ b/progs/trivial/.gitignore
@@ -96,6 +96,7 @@ tri-lit
tri-logicop-none
tri-logicop-xor
tri-mask-tri
+tri-multitex-vbo
tri-orig
tri-query
tri-repeat
diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile
index 082387d86ea..69c71cbaf61 100644
--- a/progs/trivial/Makefile
+++ b/progs/trivial/Makefile
@@ -111,6 +111,7 @@ SOURCES = \
tri-scissor-tri.c \
tri-stencil.c \
tri-stipple.c \
+ tri-multitex-vbo.c \
tri-tex.c \
tri-tex-3d.c \
tri-tri.c \
diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript
index 6a9ffafe509..480630e210e 100644
--- a/progs/trivial/SConscript
+++ b/progs/trivial/SConscript
@@ -107,6 +107,7 @@ progs = [
'tri-scissor-tri',
'tri-stencil',
'tri-stipple',
+ 'tri-multitex-vbo',
'tri-tex',
'tri-tex-3d',
'tri-tri',
diff --git a/progs/trivial/clear-fbo-tex.c b/progs/trivial/clear-fbo-tex.c
index eccfde5ae63..a206676e48e 100644
--- a/progs/trivial/clear-fbo-tex.c
+++ b/progs/trivial/clear-fbo-tex.c
@@ -27,6 +27,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
diff --git a/progs/trivial/clear-fbo.c b/progs/trivial/clear-fbo.c
index 64b25430c66..0aeb45489f2 100644
--- a/progs/trivial/clear-fbo.c
+++ b/progs/trivial/clear-fbo.c
@@ -23,6 +23,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
diff --git a/progs/trivial/clear-random.c b/progs/trivial/clear-random.c
index f3a67dbe8a8..e3da23a8f55 100644
--- a/progs/trivial/clear-random.c
+++ b/progs/trivial/clear-random.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
}
diff --git a/progs/trivial/clear-repeat.c b/progs/trivial/clear-repeat.c
index 9c618d492f3..f966adb0801 100644
--- a/progs/trivial/clear-repeat.c
+++ b/progs/trivial/clear-repeat.c
@@ -38,6 +38,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.3, 0.1, 0.3, 0.0);
}
diff --git a/progs/trivial/clear-scissor.c b/progs/trivial/clear-scissor.c
index 5e2025bed74..01735327480 100644
--- a/progs/trivial/clear-scissor.c
+++ b/progs/trivial/clear-scissor.c
@@ -16,6 +16,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
}
static void Reshape(int width, int height)
diff --git a/progs/trivial/clear-undefined.c b/progs/trivial/clear-undefined.c
index ce066bf8e6f..5ec33bf3d78 100644
--- a/progs/trivial/clear-undefined.c
+++ b/progs/trivial/clear-undefined.c
@@ -17,6 +17,7 @@ static void Init(void)
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fprintf(stderr, "Top right corner should be red\n");
+ fflush(stderr);
}
static void Reshape(int width, int height)
diff --git a/progs/trivial/clear.c b/progs/trivial/clear.c
index 37cfd54fbe2..03857b4b893 100644
--- a/progs/trivial/clear.c
+++ b/progs/trivial/clear.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/createwin.c b/progs/trivial/createwin.c
index 44d5b1b2c5f..f2cc6f1cffc 100644
--- a/progs/trivial/createwin.c
+++ b/progs/trivial/createwin.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/dlist-dangling.c b/progs/trivial/dlist-dangling.c
index 64054ec96c1..de106280092 100644
--- a/progs/trivial/dlist-dangling.c
+++ b/progs/trivial/dlist-dangling.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/dlist-edgeflag-dangling.c b/progs/trivial/dlist-edgeflag-dangling.c
index 1b66244cabf..3d3aaeb6944 100644
--- a/progs/trivial/dlist-edgeflag-dangling.c
+++ b/progs/trivial/dlist-edgeflag-dangling.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/dlist-edgeflag.c b/progs/trivial/dlist-edgeflag.c
index 350100681e5..8002129ed14 100644
--- a/progs/trivial/dlist-edgeflag.c
+++ b/progs/trivial/dlist-edgeflag.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/line-clip.c b/progs/trivial/line-clip.c
index bcee32e25fc..5276baffd5d 100644
--- a/progs/trivial/line-clip.c
+++ b/progs/trivial/line-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/line-cull.c b/progs/trivial/line-cull.c
index 98218731304..1e1b77a942c 100644
--- a/progs/trivial/line-cull.c
+++ b/progs/trivial/line-cull.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/line-smooth.c b/progs/trivial/line-smooth.c
index f030de9b9fe..9c4b9a01155 100644
--- a/progs/trivial/line-smooth.c
+++ b/progs/trivial/line-smooth.c
@@ -44,10 +44,12 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glGetFloatv(GL_LINE_WIDTH_RANGE, aarange);
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range);
printf("Non-AA line width range: %f .. %f\n", range[0], range[1]);
printf("AA line width range: %f .. %f\n", aarange[0], aarange[1]);
+ fflush(stdout);
}
diff --git a/progs/trivial/line-stipple-wide.c b/progs/trivial/line-stipple-wide.c
index 28d96c797b0..1804ffad3f0 100644
--- a/progs/trivial/line-stipple-wide.c
+++ b/progs/trivial/line-stipple-wide.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/line-userclip-clip.c b/progs/trivial/line-userclip-clip.c
index 1b9f059729c..8e030b47cea 100644
--- a/progs/trivial/line-userclip-clip.c
+++ b/progs/trivial/line-userclip-clip.c
@@ -41,6 +41,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
glClipPlane(GL_CLIP_PLANE0, plane);
diff --git a/progs/trivial/line-userclip-nop-clip.c b/progs/trivial/line-userclip-nop-clip.c
index 9f144a6e9a3..6fcd4bcfe73 100644
--- a/progs/trivial/line-userclip-nop-clip.c
+++ b/progs/trivial/line-userclip-nop-clip.c
@@ -41,6 +41,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
glClipPlane(GL_CLIP_PLANE0, plane);
diff --git a/progs/trivial/line-userclip-nop.c b/progs/trivial/line-userclip-nop.c
index 7588faeb98f..e59fd133a5f 100644
--- a/progs/trivial/line-userclip-nop.c
+++ b/progs/trivial/line-userclip-nop.c
@@ -41,6 +41,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
glClipPlane(GL_CLIP_PLANE0, plane);
diff --git a/progs/trivial/line-userclip.c b/progs/trivial/line-userclip.c
index 77d8228188c..e30be5580bd 100644
--- a/progs/trivial/line-userclip.c
+++ b/progs/trivial/line-userclip.c
@@ -41,6 +41,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
glClipPlane(GL_CLIP_PLANE0, plane);
diff --git a/progs/trivial/line-wide.c b/progs/trivial/line-wide.c
index f20505378cb..b74021dea73 100644
--- a/progs/trivial/line-wide.c
+++ b/progs/trivial/line-wide.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/line.c b/progs/trivial/line.c
index 7ccbce3750a..e1d73280bfc 100644
--- a/progs/trivial/line.c
+++ b/progs/trivial/line.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/lineloop-clip.c b/progs/trivial/lineloop-clip.c
index fbeca985b90..45fa47491f8 100644
--- a/progs/trivial/lineloop-clip.c
+++ b/progs/trivial/lineloop-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/lineloop.c b/progs/trivial/lineloop.c
index 5863df654b8..c290dbd8cb3 100644
--- a/progs/trivial/lineloop.c
+++ b/progs/trivial/lineloop.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/linestrip-clip.c b/progs/trivial/linestrip-clip.c
index dae27c31d44..f2528229218 100644
--- a/progs/trivial/linestrip-clip.c
+++ b/progs/trivial/linestrip-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/linestrip-flat-stipple.c b/progs/trivial/linestrip-flat-stipple.c
index ee79f150194..5caa7244235 100644
--- a/progs/trivial/linestrip-flat-stipple.c
+++ b/progs/trivial/linestrip-flat-stipple.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/linestrip-stipple-wide.c b/progs/trivial/linestrip-stipple-wide.c
index c6307d59941..701c82c266a 100644
--- a/progs/trivial/linestrip-stipple-wide.c
+++ b/progs/trivial/linestrip-stipple-wide.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/linestrip-stipple.c b/progs/trivial/linestrip-stipple.c
index 2b40b5f1b8e..df2eef96b5d 100644
--- a/progs/trivial/linestrip-stipple.c
+++ b/progs/trivial/linestrip-stipple.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/linestrip.c b/progs/trivial/linestrip.c
index 865a752796c..0219b1ab70e 100644
--- a/progs/trivial/linestrip.c
+++ b/progs/trivial/linestrip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/long-fixed-func.c b/progs/trivial/long-fixed-func.c
index f2a29a9d376..4b6c412f9e8 100644
--- a/progs/trivial/long-fixed-func.c
+++ b/progs/trivial/long-fixed-func.c
@@ -53,6 +53,7 @@ Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.3, 0.1, 0.3, 0.0);
diff --git a/progs/trivial/point-clip.c b/progs/trivial/point-clip.c
index 6aaee0d1a5f..4c89ba598d7 100644
--- a/progs/trivial/point-clip.c
+++ b/progs/trivial/point-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/point-param.c b/progs/trivial/point-param.c
index 1edeec3468a..6f43720a892 100644
--- a/progs/trivial/point-param.c
+++ b/progs/trivial/point-param.c
@@ -38,6 +38,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/point-sprite.c b/progs/trivial/point-sprite.c
index 2f8226ee273..5d29a6a3cf9 100644
--- a/progs/trivial/point-sprite.c
+++ b/progs/trivial/point-sprite.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
#define SIZE 16
diff --git a/progs/trivial/point-wide-smooth.c b/progs/trivial/point-wide-smooth.c
index 63f83badf8c..f6e9b8df5f9 100644
--- a/progs/trivial/point-wide-smooth.c
+++ b/progs/trivial/point-wide-smooth.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/point-wide.c b/progs/trivial/point-wide.c
index 725edae49ec..8abd64c6a99 100644
--- a/progs/trivial/point-wide.c
+++ b/progs/trivial/point-wide.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/point.c b/progs/trivial/point.c
index 3c472c1b91e..49959dcc487 100644
--- a/progs/trivial/point.c
+++ b/progs/trivial/point.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/poly-flat-clip.c b/progs/trivial/poly-flat-clip.c
index d58a3a358f8..5490068b08e 100644
--- a/progs/trivial/poly-flat-clip.c
+++ b/progs/trivial/poly-flat-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/poly-flat-unfilled-clip.c b/progs/trivial/poly-flat-unfilled-clip.c
index 74249eb4999..26b90ef9645 100644
--- a/progs/trivial/poly-flat-unfilled-clip.c
+++ b/progs/trivial/poly-flat-unfilled-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/poly-flat.c b/progs/trivial/poly-flat.c
index 82098bc1bbc..a4e3cdb6334 100644
--- a/progs/trivial/poly-flat.c
+++ b/progs/trivial/poly-flat.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/poly-unfilled.c b/progs/trivial/poly-unfilled.c
index 5cc8523f815..2ad443dc159 100644
--- a/progs/trivial/poly-unfilled.c
+++ b/progs/trivial/poly-unfilled.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/poly.c b/progs/trivial/poly.c
index 8944f148d09..e5b788ea5be 100644
--- a/progs/trivial/poly.c
+++ b/progs/trivial/poly.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quad-clip-all-vertices.c b/progs/trivial/quad-clip-all-vertices.c
index 6559adf4af8..60c87fc9ce1 100644
--- a/progs/trivial/quad-clip-all-vertices.c
+++ b/progs/trivial/quad-clip-all-vertices.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quad-clip-nearplane.c b/progs/trivial/quad-clip-nearplane.c
index 0e4f4c947c3..9380e4f9ae1 100644
--- a/progs/trivial/quad-clip-nearplane.c
+++ b/progs/trivial/quad-clip-nearplane.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
fprintf(stderr, "Press z/Z to translate quad\n");
diff --git a/progs/trivial/quad-clip.c b/progs/trivial/quad-clip.c
index fd3522a89a2..063de6106a6 100644
--- a/progs/trivial/quad-clip.c
+++ b/progs/trivial/quad-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quad-degenerate.c b/progs/trivial/quad-degenerate.c
index 29fb2774deb..fdc142bcd61 100644
--- a/progs/trivial/quad-degenerate.c
+++ b/progs/trivial/quad-degenerate.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quad-flat.c b/progs/trivial/quad-flat.c
index 570eb6bc715..e3147b3b3fe 100644
--- a/progs/trivial/quad-flat.c
+++ b/progs/trivial/quad-flat.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quad-offset-factor.c b/progs/trivial/quad-offset-factor.c
index 2c4946a13a6..dfe99bbae68 100644
--- a/progs/trivial/quad-offset-factor.c
+++ b/progs/trivial/quad-offset-factor.c
@@ -34,6 +34,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(1.0, 1.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quad-offset-unfilled.c b/progs/trivial/quad-offset-unfilled.c
index 40762825bd1..06590021fed 100644
--- a/progs/trivial/quad-offset-unfilled.c
+++ b/progs/trivial/quad-offset-unfilled.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(1.0, 1.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quad-offset-units.c b/progs/trivial/quad-offset-units.c
index b4b138b4b44..922529d977e 100644
--- a/progs/trivial/quad-offset-units.c
+++ b/progs/trivial/quad-offset-units.c
@@ -34,6 +34,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(1.0, 1.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quad-tex-2d.c b/progs/trivial/quad-tex-2d.c
index ed6f4a07330..8a886ef578c 100644
--- a/progs/trivial/quad-tex-2d.c
+++ b/progs/trivial/quad-tex-2d.c
@@ -38,6 +38,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/quad-tex-3d.c b/progs/trivial/quad-tex-3d.c
index 84acb35fd82..d05131d3b8a 100644
--- a/progs/trivial/quad-tex-3d.c
+++ b/progs/trivial/quad-tex-3d.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/quad-tex-alpha.c b/progs/trivial/quad-tex-alpha.c
index be24255a3e2..eebaf9170ec 100644
--- a/progs/trivial/quad-tex-alpha.c
+++ b/progs/trivial/quad-tex-alpha.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/quad-tex-pbo.c b/progs/trivial/quad-tex-pbo.c
index dcb4ae0e7f8..ad41a9a22e5 100644
--- a/progs/trivial/quad-tex-pbo.c
+++ b/progs/trivial/quad-tex-pbo.c
@@ -42,6 +42,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/quad-tex-sub.c b/progs/trivial/quad-tex-sub.c
index aabbb9edce9..5620dbc6f81 100644
--- a/progs/trivial/quad-tex-sub.c
+++ b/progs/trivial/quad-tex-sub.c
@@ -89,6 +89,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/quad-unfilled-clip.c b/progs/trivial/quad-unfilled-clip.c
index e25a34bda85..761878bd4b6 100644
--- a/progs/trivial/quad-unfilled-clip.c
+++ b/progs/trivial/quad-unfilled-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quad-unfilled-stipple.c b/progs/trivial/quad-unfilled-stipple.c
index d33e5918bce..cd7d2769284 100644
--- a/progs/trivial/quad-unfilled-stipple.c
+++ b/progs/trivial/quad-unfilled-stipple.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quad-unfilled.c b/progs/trivial/quad-unfilled.c
index b60af3e7f56..d64f17fdf95 100644
--- a/progs/trivial/quad-unfilled.c
+++ b/progs/trivial/quad-unfilled.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quad.c b/progs/trivial/quad.c
index c4773ec7dab..d360e309d30 100644
--- a/progs/trivial/quad.c
+++ b/progs/trivial/quad.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quads.c b/progs/trivial/quads.c
index 5bc622144ed..fe11fef207c 100644
--- a/progs/trivial/quads.c
+++ b/progs/trivial/quads.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quadstrip-clip.c b/progs/trivial/quadstrip-clip.c
index 82a6d4e0769..4cea81a45d7 100644
--- a/progs/trivial/quadstrip-clip.c
+++ b/progs/trivial/quadstrip-clip.c
@@ -34,6 +34,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quadstrip-cont.c b/progs/trivial/quadstrip-cont.c
index 62208dfae75..329523531aa 100644
--- a/progs/trivial/quadstrip-cont.c
+++ b/progs/trivial/quadstrip-cont.c
@@ -34,6 +34,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quadstrip-flat.c b/progs/trivial/quadstrip-flat.c
index 9011ee0873f..228c6c255e5 100644
--- a/progs/trivial/quadstrip-flat.c
+++ b/progs/trivial/quadstrip-flat.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/quadstrip.c b/progs/trivial/quadstrip.c
index 6923afc04b5..d49a9a53020 100644
--- a/progs/trivial/quadstrip.c
+++ b/progs/trivial/quadstrip.c
@@ -34,6 +34,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/readpixels.c b/progs/trivial/readpixels.c
index 88aac2684a8..5671618446a 100644
--- a/progs/trivial/readpixels.c
+++ b/progs/trivial/readpixels.c
@@ -17,6 +17,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.3, 0.1, 0.3, 0.0);
}
diff --git a/progs/trivial/tri-alpha-tex.c b/progs/trivial/tri-alpha-tex.c
index 382d7b21029..780ebe6be5b 100644
--- a/progs/trivial/tri-alpha-tex.c
+++ b/progs/trivial/tri-alpha-tex.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/tri-alpha.c b/progs/trivial/tri-alpha.c
index 1a653713bbf..aec1cbb3772 100644
--- a/progs/trivial/tri-alpha.c
+++ b/progs/trivial/tri-alpha.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-blend-color.c b/progs/trivial/tri-blend-color.c
index db831e3d6e0..92f019259ec 100644
--- a/progs/trivial/tri-blend-color.c
+++ b/progs/trivial/tri-blend-color.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
}
diff --git a/progs/trivial/tri-clear.c b/progs/trivial/tri-clear.c
index a3908e38e9d..f49186bd8ae 100644
--- a/progs/trivial/tri-clear.c
+++ b/progs/trivial/tri-clear.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-clip.c b/progs/trivial/tri-clip.c
index 0d31086c855..e1deca1bdcf 100644
--- a/progs/trivial/tri-clip.c
+++ b/progs/trivial/tri-clip.c
@@ -37,6 +37,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-cull-both.c b/progs/trivial/tri-cull-both.c
index 73c5583cfdd..864be710c2a 100644
--- a/progs/trivial/tri-cull-both.c
+++ b/progs/trivial/tri-cull-both.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
glCullFace(GL_FRONT_AND_BACK);
diff --git a/progs/trivial/tri-cull.c b/progs/trivial/tri-cull.c
index c6bcf444e42..c71ad9a0315 100644
--- a/progs/trivial/tri-cull.c
+++ b/progs/trivial/tri-cull.c
@@ -60,6 +60,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
cull();
}
diff --git a/progs/trivial/tri-dlist.c b/progs/trivial/tri-dlist.c
index 1c0e320f61a..c410be221a7 100644
--- a/progs/trivial/tri-dlist.c
+++ b/progs/trivial/tri-dlist.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/tri-edgeflag.c b/progs/trivial/tri-edgeflag.c
index e1278dd6490..4c8736ad8c2 100644
--- a/progs/trivial/tri-edgeflag.c
+++ b/progs/trivial/tri-edgeflag.c
@@ -35,6 +35,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
}
static void Reshape(int width, int height)
diff --git a/progs/trivial/tri-fbo.c b/progs/trivial/tri-fbo.c
index 7a38f2124cc..1ed177ffdfb 100644
--- a/progs/trivial/tri-fbo.c
+++ b/progs/trivial/tri-fbo.c
@@ -23,6 +23,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
diff --git a/progs/trivial/tri-flat-clip.c b/progs/trivial/tri-flat-clip.c
index 3235100385c..2aab5ba00a5 100644
--- a/progs/trivial/tri-flat-clip.c
+++ b/progs/trivial/tri-flat-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.5, 0.5, 0.5, 0.0);
}
diff --git a/progs/trivial/tri-flat.c b/progs/trivial/tri-flat.c
index a7fdaa1f469..ea703ec6f3f 100644
--- a/progs/trivial/tri-flat.c
+++ b/progs/trivial/tri-flat.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.5, 0.5, 0.5, 0.0);
}
diff --git a/progs/trivial/tri-fog.c b/progs/trivial/tri-fog.c
index 0099a90ad6c..0cea3d32582 100644
--- a/progs/trivial/tri-fog.c
+++ b/progs/trivial/tri-fog.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/tri-fp-const-imm.c b/progs/trivial/tri-fp-const-imm.c
index 2b1499903c1..d2df442abfc 100644
--- a/progs/trivial/tri-fp-const-imm.c
+++ b/progs/trivial/tri-fp-const-imm.c
@@ -51,6 +51,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
/* Setup the fragment program */
glGenProgramsARB(1, &prognum);
diff --git a/progs/trivial/tri-fp.c b/progs/trivial/tri-fp.c
index b30f9b73e0f..4d1508120ea 100644
--- a/progs/trivial/tri-fp.c
+++ b/progs/trivial/tri-fp.c
@@ -49,6 +49,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
/* Setup the fragment program */
glGenProgramsARB(1, &prognum);
diff --git a/progs/trivial/tri-lit.c b/progs/trivial/tri-lit.c
index 91fac1a5981..15a7ad24c51 100644
--- a/progs/trivial/tri-lit.c
+++ b/progs/trivial/tri-lit.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
diff --git a/progs/trivial/tri-logicop-none.c b/progs/trivial/tri-logicop-none.c
index aba3614bf68..53c2614ac32 100644
--- a/progs/trivial/tri-logicop-none.c
+++ b/progs/trivial/tri-logicop-none.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.3, 0.1, 0.3, 0.0);
}
diff --git a/progs/trivial/tri-logicop-xor.c b/progs/trivial/tri-logicop-xor.c
index e2c94f9bee7..f018a851ace 100644
--- a/progs/trivial/tri-logicop-xor.c
+++ b/progs/trivial/tri-logicop-xor.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.3, 0.1, 0.3, 0.0);
}
diff --git a/progs/trivial/tri-mask-tri.c b/progs/trivial/tri-mask-tri.c
index 449125a4db7..d62620905dd 100644
--- a/progs/trivial/tri-mask-tri.c
+++ b/progs/trivial/tri-mask-tri.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-multitex-vbo.c b/progs/trivial/tri-multitex-vbo.c
new file mode 100644
index 00000000000..e319447ac15
--- /dev/null
+++ b/progs/trivial/tri-multitex-vbo.c
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the name of
+ * Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
+ * ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+
+#define NR_VERTS 4
+
+struct {
+ GLfloat position[NR_VERTS][4];
+ GLubyte color[NR_VERTS][4];
+ GLfloat tex0[NR_VERTS][2];
+ GLfloat tex1[NR_VERTS][2];
+} verts = {
+
+ { { 0.9, -0.9, 0.0, 1.0 },
+ { 0.9, 0.9, 0.0, 1.0 },
+ { -0.9, 0.9, 0.0, 1.0 },
+ { -0.9, -0.9, 0.0, 1.0 } },
+
+ { { 0x00, 0x00, 0xff, 0x00 },
+ { 0x00, 0xff, 0x00, 0x00 },
+ { 0xff, 0x00, 0x00, 0x00 },
+ { 0xff, 0xff, 0xff, 0x00 }
+ },
+
+ { { 1, -1 },
+ { 1, 1 },
+ { -1, 1 },
+ { -1, -1 } },
+
+ { { 3, 0 },
+ { 0, 3 },
+ { -3, 0 },
+ { 0, -3} },
+
+};
+
+GLuint indices[] = { 0, 1, 2, 3 };
+
+GLuint arrayObj, elementObj;
+
+
+GLenum doubleBuffer;
+
+
+#define Offset(ptr, member) (void *)((const char *)&((ptr)->member) - (const char *)(ptr))
+
+static void Init(void)
+{
+ GLuint texObj[2];
+
+ fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+ fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
+ fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
+
+ glClearColor(0.0, 0.0, 1.0, 0.0);
+
+ glGenTextures(2, texObj);
+
+#define SIZE 32
+ {
+ GLubyte tex2d[SIZE][SIZE][3];
+ GLint s, t;
+
+ for (s = 0; s < SIZE; s++) {
+ for (t = 0; t < SIZE; t++) {
+ tex2d[t][s][0] = s*255/(SIZE-1);
+ tex2d[t][s][1] = t*255/(SIZE-1);
+ tex2d[t][s][2] = 0;
+ }
+ }
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glActiveTextureARB(GL_TEXTURE0_ARB);
+ glBindTexture(GL_TEXTURE_2D, texObj[0]);
+
+
+ glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0,
+ GL_RGB, GL_UNSIGNED_BYTE, tex2d);
+
+ glEnable(GL_TEXTURE_2D);
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+ }
+
+ {
+ GLubyte tex2d[SIZE][SIZE][3];
+ GLint s, t;
+
+ for (s = 0; s < SIZE; s++) {
+ for (t = 0; t < SIZE; t++) {
+ GLboolean on = ((s/4) ^ (t/4)) & 1;
+ tex2d[t][s][0] = on ? 128 : 0;
+ tex2d[t][s][1] = on ? 128 : 0;
+ tex2d[t][s][2] = on ? 128 : 0;
+ }
+ }
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glActiveTextureARB(GL_TEXTURE1_ARB);
+ glBindTexture(GL_TEXTURE_2D, texObj[1]);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0,
+ GL_RGB, GL_UNSIGNED_BYTE, tex2d);
+
+ glEnable(GL_TEXTURE_2D);
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+ }
+
+ glActiveTextureARB( GL_TEXTURE0_ARB );
+
+
+ {
+
+ glGenBuffersARB(1, &arrayObj);
+ glGenBuffersARB(1, &elementObj);
+
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj);
+ glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj);
+
+ glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), &verts, GL_STATIC_DRAW_ARB);
+ glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB);
+
+ glEnableClientState( GL_VERTEX_ARRAY );
+ glVertexPointer( 4, GL_FLOAT, 0, Offset(&verts, position) );
+
+ glEnableClientState( GL_COLOR_ARRAY );
+ glColorPointer( 4, GL_UNSIGNED_BYTE, 0, Offset(&verts, color) );
+
+ glClientActiveTextureARB( GL_TEXTURE0_ARB );
+ glEnableClientState( GL_TEXTURE_COORD_ARRAY );
+ glTexCoordPointer( 2, GL_FLOAT, 0, Offset(&verts, tex0) );
+
+ glClientActiveTextureARB( GL_TEXTURE1_ARB );
+ glEnableClientState( GL_TEXTURE_COORD_ARRAY );
+ glTexCoordPointer( 2, GL_FLOAT, 0, Offset(&verts, tex1) );
+
+ glClientActiveTextureARB( GL_TEXTURE0_ARB );
+ }
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL );
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ fprintf(stderr, "%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ GLenum type;
+
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+
+ type = GLUT_RGB | GLUT_ALPHA;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow(*argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glewInit();
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/progs/trivial/tri-orig.c b/progs/trivial/tri-orig.c
index 6861ff6e492..e7cfee3a367 100644
--- a/progs/trivial/tri-orig.c
+++ b/progs/trivial/tri-orig.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-query.c b/progs/trivial/tri-query.c
index 9b319ba2a7d..85e39df2dfa 100644
--- a/progs/trivial/tri-query.c
+++ b/progs/trivial/tri-query.c
@@ -42,6 +42,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/tri-repeat.c b/progs/trivial/tri-repeat.c
index a271fab54cc..91e355c71f3 100644
--- a/progs/trivial/tri-repeat.c
+++ b/progs/trivial/tri-repeat.c
@@ -38,6 +38,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.3, 0.1, 0.3, 0.0);
}
diff --git a/progs/trivial/tri-scissor-tri.c b/progs/trivial/tri-scissor-tri.c
index 2b5536ecd65..608ebf29cff 100644
--- a/progs/trivial/tri-scissor-tri.c
+++ b/progs/trivial/tri-scissor-tri.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-square.c b/progs/trivial/tri-square.c
index 9102888abd0..0b82a1dd8e3 100644
--- a/progs/trivial/tri-square.c
+++ b/progs/trivial/tri-square.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-stipple.c b/progs/trivial/tri-stipple.c
index 33e6dd16a7e..aa94fa224b7 100644
--- a/progs/trivial/tri-stipple.c
+++ b/progs/trivial/tri-stipple.c
@@ -51,6 +51,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glEnable (GL_POLYGON_STIPPLE);
glPolygonStipple (fly);
diff --git a/progs/trivial/tri-tex-3d.c b/progs/trivial/tri-tex-3d.c
index 4f276af653f..3ccbe125105 100644
--- a/progs/trivial/tri-tex-3d.c
+++ b/progs/trivial/tri-tex-3d.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/tri-tex.c b/progs/trivial/tri-tex.c
index 1dbbe6aa586..56afb4748d7 100644
--- a/progs/trivial/tri-tex.c
+++ b/progs/trivial/tri-tex.c
@@ -36,6 +36,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/progs/trivial/tri-tri.c b/progs/trivial/tri-tri.c
index 8b0c2dafefe..f996bd01a16 100644
--- a/progs/trivial/tri-tri.c
+++ b/progs/trivial/tri-tri.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-unfilled-clip.c b/progs/trivial/tri-unfilled-clip.c
index 438899dc1a0..2fd894a49a8 100644
--- a/progs/trivial/tri-unfilled-clip.c
+++ b/progs/trivial/tri-unfilled-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-unfilled-edgeflag.c b/progs/trivial/tri-unfilled-edgeflag.c
index 78c5ae8e9cd..11c21d1bf68 100644
--- a/progs/trivial/tri-unfilled-edgeflag.c
+++ b/progs/trivial/tri-unfilled-edgeflag.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-unfilled-fog.c b/progs/trivial/tri-unfilled-fog.c
index 113b8d051df..c6ecc705b37 100644
--- a/progs/trivial/tri-unfilled-fog.c
+++ b/progs/trivial/tri-unfilled-fog.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-unfilled-point.c b/progs/trivial/tri-unfilled-point.c
index b0502801552..750a254669a 100644
--- a/progs/trivial/tri-unfilled-point.c
+++ b/progs/trivial/tri-unfilled-point.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-unfilled-smooth.c b/progs/trivial/tri-unfilled-smooth.c
index 9306af849a4..eddae176e5f 100644
--- a/progs/trivial/tri-unfilled-smooth.c
+++ b/progs/trivial/tri-unfilled-smooth.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-unfilled-tri-lit.c b/progs/trivial/tri-unfilled-tri-lit.c
index 775c3530b7e..1d42b40b713 100644
--- a/progs/trivial/tri-unfilled-tri-lit.c
+++ b/progs/trivial/tri-unfilled-tri-lit.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
diff --git a/progs/trivial/tri-unfilled-tri.c b/progs/trivial/tri-unfilled-tri.c
index ce789255fd9..695cc890955 100644
--- a/progs/trivial/tri-unfilled-tri.c
+++ b/progs/trivial/tri-unfilled-tri.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-unfilled-userclip-stip.c b/progs/trivial/tri-unfilled-userclip-stip.c
index 6835b53c0f5..ddc0dffd4f4 100644
--- a/progs/trivial/tri-unfilled-userclip-stip.c
+++ b/progs/trivial/tri-unfilled-userclip-stip.c
@@ -41,6 +41,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
glClipPlane(GL_CLIP_PLANE0, plane);
diff --git a/progs/trivial/tri-unfilled-userclip.c b/progs/trivial/tri-unfilled-userclip.c
index aab5abc2303..0dec0bfc9b4 100644
--- a/progs/trivial/tri-unfilled-userclip.c
+++ b/progs/trivial/tri-unfilled-userclip.c
@@ -41,6 +41,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
glClipPlane(GL_CLIP_PLANE0, plane);
diff --git a/progs/trivial/tri-unfilled.c b/progs/trivial/tri-unfilled.c
index 4f50d083c2d..b98cb9a842a 100644
--- a/progs/trivial/tri-unfilled.c
+++ b/progs/trivial/tri-unfilled.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tri-userclip.c b/progs/trivial/tri-userclip.c
index 43d19cebab5..8f37e0fae20 100644
--- a/progs/trivial/tri-userclip.c
+++ b/progs/trivial/tri-userclip.c
@@ -41,6 +41,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
glClipPlane(GL_CLIP_PLANE0, plane);
diff --git a/progs/trivial/tri-viewport.c b/progs/trivial/tri-viewport.c
index 3205b9ee9c3..8e5f155c7dd 100644
--- a/progs/trivial/tri-viewport.c
+++ b/progs/trivial/tri-viewport.c
@@ -35,6 +35,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.3, 0.1, 0.3, 0.0);
}
diff --git a/progs/trivial/tri-z-9.c b/progs/trivial/tri-z-9.c
index e7d4184bdb0..099e89f6f4a 100644
--- a/progs/trivial/tri-z-9.c
+++ b/progs/trivial/tri-z-9.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
}
diff --git a/progs/trivial/tri-z-eq.c b/progs/trivial/tri-z-eq.c
index 4ec55ac080a..b81c992f7d1 100644
--- a/progs/trivial/tri-z-eq.c
+++ b/progs/trivial/tri-z-eq.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
}
diff --git a/progs/trivial/tri.c b/progs/trivial/tri.c
index d99d5872a90..d44cb6a9fe3 100644
--- a/progs/trivial/tri.c
+++ b/progs/trivial/tri.c
@@ -40,6 +40,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.3, 0.1, 0.3, 0.0);
}
diff --git a/progs/trivial/trifan-flat-clip.c b/progs/trivial/trifan-flat-clip.c
index ec7a50a75e0..199f91a637e 100644
--- a/progs/trivial/trifan-flat-clip.c
+++ b/progs/trivial/trifan-flat-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/trifan-flat-unfilled-clip.c b/progs/trivial/trifan-flat-unfilled-clip.c
index 4887b5a30c5..ea3e1553872 100644
--- a/progs/trivial/trifan-flat-unfilled-clip.c
+++ b/progs/trivial/trifan-flat-unfilled-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/trifan-flat.c b/progs/trivial/trifan-flat.c
index cf75d4cf08f..d69b4887e39 100644
--- a/progs/trivial/trifan-flat.c
+++ b/progs/trivial/trifan-flat.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/trifan-unfilled.c b/progs/trivial/trifan-unfilled.c
index 491fe5b3df2..91447e4e44d 100644
--- a/progs/trivial/trifan-unfilled.c
+++ b/progs/trivial/trifan-unfilled.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/trifan.c b/progs/trivial/trifan.c
index ee9854dc94a..84eb4172de1 100644
--- a/progs/trivial/trifan.c
+++ b/progs/trivial/trifan.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tristrip-clip.c b/progs/trivial/tristrip-clip.c
index eeab676ea90..343e2938049 100644
--- a/progs/trivial/tristrip-clip.c
+++ b/progs/trivial/tristrip-clip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tristrip-flat.c b/progs/trivial/tristrip-flat.c
index 49bb432b9df..02da97efcea 100644
--- a/progs/trivial/tristrip-flat.c
+++ b/progs/trivial/tristrip-flat.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/trivial/tristrip.c b/progs/trivial/tristrip.c
index 023e6475c0d..77bf2fad282 100644
--- a/progs/trivial/tristrip.c
+++ b/progs/trivial/tristrip.c
@@ -39,6 +39,7 @@ static void Init(void)
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
diff --git a/progs/vp/psiz-imm.txt b/progs/vp/psiz-imm.txt
new file mode 100644
index 00000000000..18de2498d67
--- /dev/null
+++ b/progs/vp/psiz-imm.txt
@@ -0,0 +1,5 @@
+!!ARBvp1.0
+MOV result.color, vertex.color;
+MOV result.pointsize, {2.0, 0, 0, 1};
+MOV result.position, vertex.position;
+END
diff --git a/progs/vp/psiz-mul-clamp.txt b/progs/vp/psiz-mul-clamp.txt
new file mode 100644
index 00000000000..284c032d790
--- /dev/null
+++ b/progs/vp/psiz-mul-clamp.txt
@@ -0,0 +1,9 @@
+!!ARBvp1.0
+TEMP R0;
+MOV result.color, vertex.color;
+MUL R0.x, vertex.color.x, {10.0}.x;
+MAX R0.x, R0.x, {2.0}.x;
+MIN result.pointsize.x, R0.x, {4.0}.x;
+MOV result.position, vertex.position;
+END
+
diff --git a/progs/vp/psiz-param-clamp.txt b/progs/vp/psiz-param-clamp.txt
new file mode 100644
index 00000000000..7f83fc45165
--- /dev/null
+++ b/progs/vp/psiz-param-clamp.txt
@@ -0,0 +1,10 @@
+!!ARBvp1.0
+TEMP R0;
+TEMP R1;
+MOV result.color, vertex.color;
+MUL R0.x, vertex.color.x, {10.0}.x;
+MAX R0.x, R0.x, {2.0}.x;
+MIN result.pointsize.x, R0.x, {4.0}.x;
+MOV result.position, vertex.position;
+END
+
diff --git a/progs/vpglsl/SConscript b/progs/vpglsl/SConscript
new file mode 100644
index 00000000000..640c5dd8470
--- /dev/null
+++ b/progs/vpglsl/SConscript
@@ -0,0 +1,13 @@
+Import('env')
+
+if not env['GLUT']:
+ Return()
+
+env = env.Clone()
+
+env.Prepend(LIBS = ['$GLUT_LIB'])
+
+env.Program(
+ target = 'vp-tris',
+ source = ['vp-tris.c'],
+ )
diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile
index bb353e318c9..6581df80398 100644
--- a/progs/xdemos/Makefile
+++ b/progs/xdemos/Makefile
@@ -99,7 +99,7 @@ xrotfontdemo.o: xrotfontdemo.c xuserotfont.h
$(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) xrotfontdemo.c
corender: corender.o ipc.o
- $(APP_CC) $(CFLAGS) corender.o ipc.o $(LIBS) -o $@
+ $(APP_CC) $(CFLAGS) $(LDFLAGS) corender.o ipc.o $(LIBS) -o $@
corender.o: corender.c ipc.h
$(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) corender.c
diff --git a/scons/gallium.py b/scons/gallium.py
index ecdeef06fdf..e2cd0546c1e 100644
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -198,14 +198,17 @@ def generate(env):
env['toolchain'] = 'wcesdk'
env.Tool(env['toolchain'])
+ env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
+ env['msvc'] = env['CC'] == 'cl'
+
# shortcuts
debug = env['debug']
machine = env['machine']
platform = env['platform']
x86 = env['machine'] == 'x86'
ppc = env['machine'] == 'ppc'
- gcc = env['platform'] in ('linux', 'freebsd', 'darwin') or env['toolchain'] == 'crossmingw'
- msvc = env['platform'] in ('windows', 'winddk', 'wince') and env['toolchain'] != 'crossmingw'
+ gcc = env['gcc']
+ msvc = env['msvc']
# Put build output in a separate dir, which depends on the current
# configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
@@ -248,9 +251,12 @@ def generate(env):
('WINVER', '0x0501'),
# http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
'WIN32_LEAN_AND_MEAN',
- 'VC_EXTRALEAN',
- '_CRT_SECURE_NO_DEPRECATE',
]
+ if msvc:
+ cppdefines += [
+ 'VC_EXTRALEAN',
+ '_CRT_SECURE_NO_DEPRECATE',
+ ]
if debug:
cppdefines += ['_DEBUG']
if platform == 'winddk':
diff --git a/scons/generic.py b/scons/generic.py
index 01a374e3633..03563e4c620 100644
--- a/scons/generic.py
+++ b/scons/generic.py
@@ -303,14 +303,17 @@ def generate(env):
# Load tool chain
env.Tool(env['toolchain'])
+ env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
+ env['msvc'] = env['CC'] == 'cl'
+
# shortcuts
debug = env['debug']
machine = env['machine']
platform = env['platform']
x86 = env['machine'] == 'x86'
ppc = env['machine'] == 'ppc'
- gcc = env['platform'] in ('linux', 'freebsd', 'darwin') or env['toolchain'] == 'crossmingw'
- msvc = env['platform'] in ('windows', 'winddk', 'wince') and env['toolchain'] != 'crossmingw'
+ gcc = env['gcc']
+ msvc = env['msvc']
# C preprocessor options
cppdefines = []
@@ -328,9 +331,12 @@ def generate(env):
#'UNICODE',
# http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
#'WIN32_LEAN_AND_MEAN',
- 'VC_EXTRALEAN',
- '_CRT_SECURE_NO_DEPRECATE',
]
+ if msvc:
+ cppdefines += [
+ 'VC_EXTRALEAN',
+ '_CRT_SECURE_NO_DEPRECATE',
+ ]
if debug:
cppdefines += ['_DEBUG']
if platform == 'winddk':
diff --git a/scons/python.py b/scons/python.py
index 539184dd39c..9e94d056e1c 100644
--- a/scons/python.py
+++ b/scons/python.py
@@ -38,7 +38,7 @@ import os.path
def generate(env):
# See http://www.scons.org/wiki/PythonExtensions
- if sys.platform in ['windows']:
+ if sys.platform in ['win32']:
python_root = sys.prefix
python_version = '%u%u' % sys.version_info[:2]
python_include = os.path.join(python_root, 'include')
@@ -56,6 +56,8 @@ def generate(env):
cppdefines = env['CPPDEFINES']
cppdefines = [define for define in cppdefines if define != '_DEBUG']
env.Replace(CPPDEFINES = cppdefines)
+ env.AppendUnique(CPPFLAGS = ['/U_DEBUG'])
+ env.AppendUnique(LINKFLAGS = ['/nodefaultlib:python25_d.lib'])
else:
#env.ParseConfig('python-config --cflags --ldflags --libs')
env.AppendUnique(CPPPATH = [distutils.sysconfig.get_python_inc()])
diff --git a/scons/winsdk.py b/scons/winsdk.py
new file mode 100644
index 00000000000..255f9c5a654
--- /dev/null
+++ b/scons/winsdk.py
@@ -0,0 +1,139 @@
+"""winsdk
+
+Tool-specific initialization for Microsoft Windows SDK.
+
+"""
+
+#
+# Copyright (c) 2001-2007 The SCons Foundation
+# Copyright (c) 2008 Tungsten Graphics, Inc.
+# Copyright (c) 2009 VMware, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+import os.path
+import platform
+
+import SCons.Errors
+import SCons.Util
+
+import msvc_sa
+import mslib_sa
+import mslink_sa
+
+
+def get_vs_root(env):
+ # TODO: Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7
+ path = os.path.join(os.getenv('ProgramFiles', r'C:\Program Files'), 'Microsoft Visual Studio 9.0')
+ return path
+
+def get_vs_paths(env):
+ vs_root = get_vs_root(env)
+ if vs_root is None:
+ raise SCons.Errors.InternalError, "WINSDK compiler not found"
+
+ tool_path = os.path.join(vs_root, 'Common7', 'IDE')
+
+ env.PrependENVPath('PATH', tool_path)
+
+def get_vc_root(env):
+ # TODO: Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VC7
+ path = os.path.join(os.getenv('ProgramFiles', r'C:\Program Files'), 'Microsoft Visual Studio 9.0', 'VC')
+ return path
+
+def get_vc_paths(env):
+ vc_root = get_vc_root(env)
+ if vc_root is None:
+ raise SCons.Errors.InternalError, "WINSDK compiler not found"
+
+ target_cpu = env['machine']
+
+ if target_cpu in ('generic', 'x86'):
+ bin_dir = 'bin'
+ lib_dir = 'lib'
+ elif target_cpu == 'x86_64':
+ # TODO: take in consideration the host cpu
+ bin_dir = r'bin\x86_amd64'
+ lib_dir = r'lib\amd64'
+ else:
+ raise SCons.Errors.InternalError, "Unsupported target machine"
+ include_dir = 'include'
+
+ exe_path = os.path.join(vc_root, bin_dir)
+ include_path = os.path.join(vc_root, include_dir)
+ lib_path = os.path.join(vc_root, lib_dir)
+
+ env.PrependENVPath('INCLUDE', include_path)
+ env.PrependENVPath('LIB', lib_path)
+ env.PrependENVPath('PATH', exe_path)
+
+def get_sdk_root(env):
+ if SCons.Util.can_read_reg:
+ key = r'SOFTWARE\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder'
+ try:
+ path, t = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key)
+ except SCons.Util.RegError:
+ pass
+ else:
+ return path
+
+ return None
+
+def get_sdk_paths(env):
+ sdk_root = get_sdk_root(env)
+ if sdk_root is None:
+ raise SCons.Errors.InternalError, "WINSDK not found"
+
+ target_cpu = env['machine']
+
+ bin_dir = 'Bin'
+ if target_cpu in ('generic', 'x86'):
+ lib_dir = 'Lib'
+ elif target_cpu == 'x86_64':
+ lib_dir = 'Lib/x64'
+ else:
+ raise SCons.Errors.InternalError, "Unsupported target machine"
+ include_dir = 'Include'
+
+ exe_path = os.path.join(sdk_root, bin_dir)
+ include_path = os.path.join(sdk_root, include_dir)
+ lib_path = os.path.join(sdk_root, lib_dir)
+
+ env.PrependENVPath('INCLUDE', include_path)
+ env.PrependENVPath('LIB', lib_path)
+ env.PrependENVPath('PATH', exe_path)
+
+def generate(env):
+ if not env.has_key('ENV'):
+ env['ENV'] = {}
+
+ get_vs_paths(env)
+ get_vc_paths(env)
+ get_sdk_paths(env)
+
+ msvc_sa.generate(env)
+ mslib_sa.generate(env)
+ mslink_sa.generate(env)
+
+def exists(env):
+ return get_vc_root(env) is not None and get_sdk_root(env) is not None
+
+# vim:set ts=4 sw=4 et:
diff --git a/src/egl/drivers/dri/Makefile b/src/egl/drivers/dri/Makefile
index be2f9b6bea3..4041d5c906a 100644
--- a/src/egl/drivers/dri/Makefile
+++ b/src/egl/drivers/dri/Makefile
@@ -48,7 +48,8 @@ $(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS)
-major 1 -minor 0 \
-install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS)
-install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
+install:
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) $(TOP)/$(LIB_DIR)/libEGLdri.so $(DESTDIR)$(INSTALL_LIB_DIR)
clean:
diff --git a/src/egl/drivers/glx/Makefile b/src/egl/drivers/glx/Makefile
index 090a230ca34..5f041a268f1 100644
--- a/src/egl/drivers/glx/Makefile
+++ b/src/egl/drivers/glx/Makefile
@@ -56,7 +56,8 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS)
-install $(TOP)/$(LIB_DIR) \
$(OBJECTS) $(DRM_LIB) $(MISC_LIBS)
-install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
+install:
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR)
clean:
diff --git a/src/egl/drivers/xdri/Makefile b/src/egl/drivers/xdri/Makefile
index db4b7100027..eb83867b718 100644
--- a/src/egl/drivers/xdri/Makefile
+++ b/src/egl/drivers/xdri/Makefile
@@ -52,7 +52,8 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS)
-install $(TOP)/$(LIB_DIR) \
$(OBJECTS) $(DRM_LIB) $(MISC_LIBS)
-install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
+install:
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR)
clean:
diff --git a/src/egl/main/eglconfigutil.c b/src/egl/main/eglconfigutil.c
index 7061df691b2..138dc729e74 100644
--- a/src/egl/main/eglconfigutil.c
+++ b/src/egl/main/eglconfigutil.c
@@ -192,8 +192,8 @@ _eglFillInConfigs(_EGLConfig * configs,
if ( bytes_per_pixel[index] == 0 ) {
_eglLog(_EGL_INFO,
- "[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.",
- __FUNCTION__, __LINE__, fb_type);
+ "[_eglFillInConfigs:%u] Framebuffer type 0x%04x has 0 bytes per pixel.",
+ __LINE__, fb_type);
return GL_FALSE;
}
@@ -227,8 +227,8 @@ _eglFillInConfigs(_EGLConfig * configs,
default:
_eglLog(_EGL_WARNING,
- "[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.",
- __FUNCTION__, __LINE__, fb_format);
+ "[_eglFillInConfigs:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.",
+ __LINE__, fb_format);
return GL_FALSE;
}
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
index 5008086cf26..3133abe5dc7 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
@@ -286,7 +286,7 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
ctx->emit_instruction(ctx, &newInst);
#endif
- /* SGT t0.y, t0.xxxx, t0.wwww; # bool b = d > 1 (NOTE t0.w == 1) */
+ /* SGT t0.y, t0.xxxx, tex.wwww; # bool b = d > 1 (NOTE tex.w == 1) */
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_SGT;
newInst.Instruction.NumDstRegs = 1;
diff --git a/src/gallium/auxiliary/draw/draw_vertex.h b/src/gallium/auxiliary/draw/draw_vertex.h
index c143cf23723..554f4ac3c18 100644
--- a/src/gallium/auxiliary/draw/draw_vertex.h
+++ b/src/gallium/auxiliary/draw/draw_vertex.h
@@ -87,18 +87,17 @@ struct vertex_info
} attrib[PIPE_MAX_SHADER_INPUTS];
};
-static INLINE int
+static INLINE size_t
draw_vinfo_size( const struct vertex_info *a )
{
- return ((const char *)&a->attrib[a->num_attribs] -
- (const char *)a);
+ return offsetof(const struct vertex_info, attrib[a->num_attribs]);
}
static INLINE int
draw_vinfo_compare( const struct vertex_info *a,
const struct vertex_info *b )
{
- unsigned sizea = draw_vinfo_size( a );
+ size_t sizea = draw_vinfo_size( a );
return memcmp( a, b, sizea );
}
@@ -106,7 +105,7 @@ static INLINE void
draw_vinfo_copy( struct vertex_info *dst,
const struct vertex_info *src )
{
- unsigned size = draw_vinfo_size( src );
+ size_t size = draw_vinfo_size( src );
memcpy( dst, src, size );
}
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c
index b3200df8112..dbbc33fffa7 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -151,6 +151,7 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
output[slot][1],
output[slot][2],
output[slot][3]);
+ assert(!util_is_inf_or_nan(output[slot][0]));
}
#endif
diff --git a/src/gallium/auxiliary/indices/SConscript b/src/gallium/auxiliary/indices/SConscript
index e5f7ee94845..712e215534f 100644
--- a/src/gallium/auxiliary/indices/SConscript
+++ b/src/gallium/auxiliary/indices/SConscript
@@ -1,17 +1,19 @@
Import('*')
+from sys import executable as python_cmd
+
env.CodeGenerate(
target = 'u_indices_gen.c',
script = 'u_indices_gen.py',
source = [],
- command = 'python $SCRIPT > $TARGET'
+ command = python_cmd + ' $SCRIPT > $TARGET'
)
env.CodeGenerate(
target = 'u_unfilled_gen.c',
script = 'u_unfilled_gen.py',
source = [],
- command = 'python $SCRIPT > $TARGET'
+ command = python_cmd + ' $SCRIPT > $TARGET'
)
indices = env.ConvenienceLibrary(
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
index 2a1315922a8..92b6fd00564 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
@@ -158,7 +158,7 @@ pb_map(struct pb_buffer *buf,
assert(buf);
if(!buf)
return NULL;
- assert(p_atomic_read(&buf->base.reference.count) > 0);
+ assert(pipe_is_referenced(&buf->base.reference));
return buf->vtbl->map(buf, flags);
}
@@ -169,7 +169,7 @@ pb_unmap(struct pb_buffer *buf)
assert(buf);
if(!buf)
return;
- assert(p_atomic_read(&buf->base.reference.count) > 0);
+ assert(pipe_is_referenced(&buf->base.reference));
buf->vtbl->unmap(buf);
}
@@ -185,7 +185,7 @@ pb_get_base_buffer( struct pb_buffer *buf,
offset = 0;
return;
}
- assert(p_atomic_read(&buf->base.reference.count) > 0);
+ assert(pipe_is_referenced(&buf->base.reference));
assert(buf->vtbl->get_base_buffer);
buf->vtbl->get_base_buffer(buf, base_buf, offset);
assert(*base_buf);
@@ -221,7 +221,7 @@ pb_destroy(struct pb_buffer *buf)
assert(buf);
if(!buf)
return;
- assert(p_atomic_read(&buf->base.reference.count) == 0);
+ assert(!pipe_is_referenced(&buf->base.reference));
buf->vtbl->destroy(buf);
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index 1bdf7a0b2da..2cd0b8a8cdf 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -36,7 +36,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#include <unistd.h>
#include <sched.h>
#endif
@@ -115,7 +115,7 @@ _fenced_buffer_add(struct fenced_buffer *fenced_buf)
{
struct fenced_buffer_list *fenced_list = fenced_buf->list;
- assert(p_atomic_read(&fenced_buf->base.base.reference.count));
+ assert(pipe_is_referenced(&fenced_buf->base.base.reference));
assert(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
assert(fenced_buf->fence);
@@ -137,7 +137,7 @@ _fenced_buffer_destroy(struct fenced_buffer *fenced_buf)
{
struct fenced_buffer_list *fenced_list = fenced_buf->list;
- assert(p_atomic_read(&fenced_buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
assert(!fenced_buf->fence);
#ifdef DEBUG
assert(fenced_buf->head.prev);
@@ -181,7 +181,7 @@ _fenced_buffer_remove(struct fenced_buffer_list *fenced_list,
* FIXME!!!
*/
- if(!p_atomic_read(&fenced_buf->base.base.reference.count))
+ if(!pipe_is_referenced(&fenced_buf->base.base.reference))
_fenced_buffer_destroy(fenced_buf);
}
@@ -257,7 +257,7 @@ fenced_buffer_destroy(struct pb_buffer *buf)
struct fenced_buffer_list *fenced_list = fenced_buf->list;
pipe_mutex_lock(fenced_list->mutex);
- assert(p_atomic_read(&fenced_buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
if (fenced_buf->fence) {
struct pb_fence_ops *ops = fenced_list->ops;
if(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) {
@@ -573,7 +573,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
/* Wait on outstanding fences */
while (fenced_list->numDelayed) {
pipe_mutex_unlock(fenced_list->mutex);
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
sched_yield();
#endif
_fenced_buffer_list_check_free(fenced_list, 1);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 010a2ecc1fa..35358430b43 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -112,7 +112,7 @@ _pb_cache_buffer_destroy(struct pb_cache_buffer *buf)
LIST_DEL(&buf->head);
assert(mgr->numDelayed);
--mgr->numDelayed;
- assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&buf->base.base.reference));
pb_reference(&buf->buffer, NULL);
FREE(buf);
}
@@ -153,7 +153,7 @@ pb_cache_buffer_destroy(struct pb_buffer *_buf)
struct pb_cache_manager *mgr = buf->mgr;
pipe_mutex_lock(mgr->mutex);
- assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&buf->base.base.reference));
_pb_cache_buffer_list_check_free(mgr);
@@ -310,7 +310,7 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
return NULL;
}
- assert(p_atomic_read(&buf->buffer->base.reference.count) >= 1);
+ assert(pipe_is_referenced(&buf->buffer->base.reference));
assert(pb_check_alignment(desc->alignment, buf->buffer->base.alignment));
assert(pb_check_usage(desc->usage, buf->buffer->base.usage));
assert(buf->buffer->base.size >= size);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index 478682dbee9..f1a05be46e4 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -208,7 +208,7 @@ pb_debug_buffer_destroy(struct pb_buffer *_buf)
{
struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
- assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&buf->base.base.reference));
pb_debug_buffer_check(buf);
@@ -315,7 +315,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
return NULL;
}
- assert(p_atomic_read(&buf->buffer->base.reference.count) >= 1);
+ assert(pipe_is_referenced(&buf->buffer->base.reference));
assert(pb_check_alignment(real_desc.alignment, buf->buffer->base.alignment));
assert(pb_check_usage(real_desc.usage, buf->buffer->base.usage));
assert(buf->buffer->base.size >= real_size);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
index fb18dcc5dca..5a342fbf3b1 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
@@ -97,7 +97,7 @@ mm_buffer_destroy(struct pb_buffer *buf)
struct mm_buffer *mm_buf = mm_buffer(buf);
struct mm_pb_manager *mm = mm_buf->mgr;
- assert(p_atomic_read(&mm_buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&mm_buf->base.base.reference));
pipe_mutex_lock(mm->mutex);
u_mmFreeMem(mm_buf->block);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
index 75b95e132e8..07fd1a22d93 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
@@ -108,7 +108,7 @@ pool_buffer_destroy(struct pb_buffer *buf)
struct pool_buffer *pool_buf = pool_buffer(buf);
struct pool_pb_manager *pool = pool_buf->mgr;
- assert(p_atomic_read(&pool_buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&pool_buf->base.base.reference));
pipe_mutex_lock(pool->mutex);
LIST_ADD(&pool_buf->head, &pool->free);
@@ -216,7 +216,7 @@ pool_bufmgr_create_buffer(struct pb_manager *mgr,
pipe_mutex_unlock(pool->mutex);
pool_buf = LIST_ENTRY(struct pool_buffer, item, head);
- assert(p_atomic_read(&pool_buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&pool_buf->base.base.reference));
pipe_reference_init(&pool_buf->base.base.reference, 1);
pool_buf->base.base.alignment = desc->alignment;
pool_buf->base.base.usage = desc->usage;
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
index a431fd5211e..724aaadb436 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
@@ -202,7 +202,7 @@ pb_slab_buffer_destroy(struct pb_buffer *_buf)
pipe_mutex_lock(mgr->mutex);
- assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&buf->base.base.reference));
buf->mapCount = 0;
diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
index 1f0923b6831..01811d50114 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
@@ -42,7 +42,7 @@
#endif
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
/*
@@ -118,7 +118,7 @@ rtasm_exec_free(void *addr)
}
-#else /* PIPE_OS_LINUX || PIPE_OS_BSD */
+#else /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
/*
* Just use regular memory.
@@ -138,4 +138,4 @@ rtasm_exec_free(void *addr)
}
-#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */
+#endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
index 5b21a2be0bd..a3f4947c734 100644
--- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
+++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
@@ -262,7 +262,7 @@ TGSI Instruction Specification
dst.w = round(src.w)
-1.3.10 EXPBASE2 - Exponent Base 2
+1.3.10 EXPBASE2 - Exponential Base 2
dst.x = pow(2.0, src.x)
dst.y = pow(2.0, src.x)
@@ -382,9 +382,7 @@ TGSI Instruction Specification
1.5.7 KILP - Predicated Discard
- if (cc.x || cc.y || cc.z || cc.w)
- discard
- endif
+ discard
1.5.8 LG2 - Logarithm Base 2
@@ -548,7 +546,7 @@ TGSI Instruction Specification
1.6.3 BRA - Branch
- TBD
+ pc = target
1.6.4 CAL - Subroutine Call
@@ -1038,3 +1036,74 @@ TGSI Instruction Specification
Alias for ARR.
+
+2 Explanation of symbols used
+==============================
+
+
+2.1 Functions
+--------------
+
+
+ abs(x) Absolute value of x.
+ |x|
+ (x < 0.0) ? -x : x
+
+ ceil(x) Ceiling of x.
+
+ clamp(x,y,z) Clamp x between y and z.
+ (x < y) ? y : (x > z) ? z : x
+
+ cos(x) Cosine of x.
+
+ floor(x) Floor of x.
+
+ lg2(x) Logarithm base 2 of x.
+
+ max(x,y) Maximum of x and y.
+ (x > y) ? x : y
+
+ min(x,y) Minimum of x and y.
+ (x < y) ? x : y
+
+ partialx(x) Derivative of x relative to fragment's X.
+
+ partialy(x) Derivative of x relative to fragment's Y.
+
+ pop() Pop from stack.
+
+ pow(x,y) Raise x to power of y.
+
+ push(x) Push x on stack.
+
+ round(x) Round x.
+
+ sin(x) Sine of x.
+
+ sqrt(x) Square root of x.
+
+ trunc(x) Truncate x.
+
+
+2.2 Keywords
+-------------
+
+
+ discard Discard fragment.
+
+ dst First destination register.
+
+ dst0 First destination register.
+
+ pc Program counter.
+
+ src First source register.
+
+ src0 First source register.
+
+ src1 Second source register.
+
+ src2 Third source register.
+
+ target Label of target instruction.
+
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index ba807e498f1..e8bd7cda3b1 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -123,6 +123,53 @@
#define UPDATE_EXEC_MASK(MACH) \
MACH->ExecMask = MACH->CondMask & MACH->LoopMask & MACH->ContMask & MACH->FuncMask
+
+static const union tgsi_exec_channel ZeroVec =
+ { { 0.0, 0.0, 0.0, 0.0 } };
+
+
+#ifdef DEBUG
+static void
+check_inf_or_nan(const union tgsi_exec_channel *chan)
+{
+ assert(!util_is_inf_or_nan(chan->f[0]));
+ assert(!util_is_inf_or_nan(chan->f[1]));
+ assert(!util_is_inf_or_nan(chan->f[2]));
+ assert(!util_is_inf_or_nan(chan->f[3]));
+}
+#endif
+
+
+#ifdef DEBUG
+static void
+print_chan(const char *msg, const union tgsi_exec_channel *chan)
+{
+ debug_printf("%s = {%f, %f, %f, %f}\n",
+ msg, chan->f[0], chan->f[1], chan->f[2], chan->f[3]);
+}
+#endif
+
+
+#ifdef DEBUG
+static void
+print_temp(const struct tgsi_exec_machine *mach, uint index)
+{
+ const struct tgsi_exec_vector *tmp = &mach->Temps[index];
+ int i;
+ debug_printf("Temp[%u] =\n", index);
+ for (i = 0; i < 4; i++) {
+ debug_printf(" %c: { %f, %f, %f, %f }\n",
+ "XYZW"[i],
+ tmp->xyzw[i].f[0],
+ tmp->xyzw[i].f[1],
+ tmp->xyzw[i].f[2],
+ tmp->xyzw[i].f[3]);
+ }
+}
+#endif
+
+
+
/**
* Initialize machine state by expanding tokens to full instructions,
* allocating temporary storage, setting up constants, etc.
@@ -278,6 +325,12 @@ tgsi_exec_machine_init(
mach->Temps[TEMP_3_I].xyzw[TEMP_3_C].f[i] = 3.0f;
mach->Temps[TEMP_HALF_I].xyzw[TEMP_HALF_C].f[i] = 0.5f;
}
+
+#ifdef DEBUG
+ /* silence warnings */
+ (void) print_chan;
+ (void) print_temp;
+#endif
}
@@ -1281,6 +1334,10 @@ store_dest(
union tgsi_exec_channel *dst;
uint execmask = mach->ExecMask;
+#ifdef DEBUG
+ check_inf_or_nan(chan);
+#endif
+
switch (reg->DstRegister.File) {
case TGSI_FILE_NULL:
dst = &null;
@@ -1643,7 +1700,7 @@ exec_tex(struct tgsi_exec_machine *mach,
lodBias = 0.0;
fetch_texel(mach->Samplers[unit],
- &r[0], NULL, NULL, lodBias, /* S, T, P, BIAS */
+ &r[0], &ZeroVec, &ZeroVec, lodBias, /* S, T, P, BIAS */
&r[0], &r[1], &r[2], &r[3]); /* R, G, B, A */
break;
@@ -1847,7 +1904,7 @@ exec_instruction(
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_ARL:
- /* TGSI_OPCODE_FLOOR */
+ case TGSI_OPCODE_FLOOR:
/* TGSI_OPCODE_FLR */
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 4ffd4efbffa..0b4b2a6fb6e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -205,8 +205,8 @@ struct tgsi_exec_machine
const float (*Consts)[4];
struct tgsi_exec_vector *Inputs;
struct tgsi_exec_vector *Outputs;
- const struct tgsi_token *Tokens;
- unsigned Processor;
+ const struct tgsi_token *Tokens; /**< Declarations, instructions */
+ unsigned Processor; /**< TGSI_PROCESSOR_x */
/* GEOMETRY processor only. */
unsigned *Primitives;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 2b8a6f0fb19..37f2b66d1f6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -30,125 +30,125 @@
static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{
- { 1, 1, 0, 0, "ARL" },
- { 1, 1, 0, 0, "MOV" },
- { 1, 1, 0, 0, "LIT" },
- { 1, 1, 0, 0, "RCP" },
- { 1, 1, 0, 0, "RSQ" },
- { 1, 1, 0, 0, "EXP" },
- { 1, 1, 0, 0, "LOG" },
- { 1, 2, 0, 0, "MUL" },
- { 1, 2, 0, 0, "ADD" },
- { 1, 2, 0, 0, "DP3" },
- { 1, 2, 0, 0, "DP4" },
- { 1, 2, 0, 0, "DST" },
- { 1, 2, 0, 0, "MIN" },
- { 1, 2, 0, 0, "MAX" },
- { 1, 2, 0, 0, "SLT" },
- { 1, 2, 0, 0, "SGE" },
- { 1, 3, 0, 0, "MAD" },
- { 1, 2, 0, 0, "SUB" },
- { 1, 3, 0, 0, "LERP" },
- { 1, 3, 0, 0, "CND" },
- { 1, 3, 0, 0, "CND0" },
- { 1, 3, 0, 0, "DOT2ADD" },
- { 1, 2, 0, 0, "INDEX" },
- { 1, 1, 0, 0, "NEGATE" },
- { 1, 1, 0, 0, "FRAC" },
- { 1, 3, 0, 0, "CLAMP" },
- { 1, 1, 0, 0, "FLOOR" },
- { 1, 1, 0, 0, "ROUND" },
- { 1, 1, 0, 0, "EXPBASE2" },
- { 1, 1, 0, 0, "LOGBASE2" },
- { 1, 2, 0, 0, "POWER" },
- { 1, 2, 0, 0, "CROSSPRODUCT" },
- { 1, 2, 0, 0, "MULTIPLYMATRIX" },
- { 1, 1, 0, 0, "ABS" },
- { 1, 1, 0, 0, "RCC" },
- { 1, 2, 0, 0, "DPH" },
- { 1, 1, 0, 0, "COS" },
- { 1, 1, 0, 0, "DDX" },
- { 1, 1, 0, 0, "DDY" },
- { 0, 0, 0, 0, "KILP" },
- { 1, 1, 0, 0, "PK2H" },
- { 1, 1, 0, 0, "PK2US" },
- { 1, 1, 0, 0, "PK4B" },
- { 1, 1, 0, 0, "PK4UB" },
- { 1, 2, 0, 0, "RFL" },
- { 1, 2, 0, 0, "SEQ" },
- { 1, 2, 0, 0, "SFL" },
- { 1, 2, 0, 0, "SGT" },
- { 1, 1, 0, 0, "SIN" },
- { 1, 2, 0, 0, "SLE" },
- { 1, 2, 0, 0, "SNE" },
- { 1, 2, 0, 0, "STR" },
- { 1, 2, 1, 0, "TEX" },
- { 1, 4, 1, 0, "TXD" },
- { 1, 2, 1, 0, "TXP" },
- { 1, 1, 0, 0, "UP2H" },
- { 1, 1, 0, 0, "UP2US" },
- { 1, 1, 0, 0, "UP4B" },
- { 1, 1, 0, 0, "UP4UB" },
- { 1, 3, 0, 0, "X2D" },
- { 1, 1, 0, 0, "ARA" },
- { 1, 1, 0, 0, "ARR" },
- { 0, 1, 0, 0, "BRA" },
- { 0, 0, 0, 1, "CAL" },
- { 0, 0, 0, 0, "RET" },
- { 1, 1, 0, 0, "SSG" },
- { 1, 3, 0, 0, "CMP" },
- { 1, 1, 0, 0, "SCS" },
- { 1, 2, 1, 0, "TXB" },
- { 1, 1, 0, 0, "NRM" },
- { 1, 2, 0, 0, "DIV" },
- { 1, 2, 0, 0, "DP2" },
- { 1, 2, 1, 0, "TXL" },
- { 0, 0, 0, 0, "BRK" },
- { 0, 1, 0, 1, "IF" },
- { 0, 0, 0, 0, "LOOP" },
- { 0, 1, 0, 0, "REP" },
- { 0, 0, 0, 1, "ELSE" },
- { 0, 0, 0, 0, "ENDIF" },
- { 0, 0, 0, 0, "ENDLOOP" },
- { 0, 0, 0, 0, "ENDREP" },
- { 0, 1, 0, 0, "PUSHA" },
- { 1, 0, 0, 0, "POPA" },
- { 1, 1, 0, 0, "CEIL" },
- { 1, 1, 0, 0, "I2F" },
- { 1, 1, 0, 0, "NOT" },
- { 1, 1, 0, 0, "TRUNC" },
- { 1, 2, 0, 0, "SHL" },
- { 1, 2, 0, 0, "SHR" },
- { 1, 2, 0, 0, "AND" },
- { 1, 2, 0, 0, "OR" },
- { 1, 2, 0, 0, "MOD" },
- { 1, 2, 0, 0, "XOR" },
- { 1, 3, 0, 0, "SAD" },
- { 1, 2, 1, 0, "TXF" },
- { 1, 2, 1, 0, "TXQ" },
- { 0, 0, 0, 0, "CONT" },
- { 0, 0, 0, 0, "EMIT" },
- { 0, 0, 0, 0, "ENDPRIM" },
- { 0, 0, 0, 1, "BGNLOOP2" },
- { 0, 0, 0, 0, "BGNSUB" },
- { 0, 0, 0, 1, "ENDLOOP2" },
- { 0, 0, 0, 0, "ENDSUB" },
- { 1, 1, 0, 0, "NOISE1" },
- { 1, 1, 0, 0, "NOISE2" },
- { 1, 1, 0, 0, "NOISE3" },
- { 1, 1, 0, 0, "NOISE4" },
- { 0, 0, 0, 0, "NOP" },
- { 1, 2, 0, 0, "M4X3" },
- { 1, 2, 0, 0, "M3X4" },
- { 1, 2, 0, 0, "M3X3" },
- { 1, 2, 0, 0, "M3X2" },
- { 1, 1, 0, 0, "NRM4" },
- { 0, 1, 0, 0, "CALLNZ" },
- { 0, 1, 0, 0, "IFC" },
- { 0, 1, 0, 0, "BREAKC" },
- { 0, 1, 0, 0, "KIL" },
- { 0, 0, 0, 0, "END" },
- { 1, 1, 0, 0, "SWZ" }
+ { 1, 1, 0, 0, "ARL", NULL, NULL },
+ { 1, 1, 0, 0, "MOV", NULL, NULL },
+ { 1, 1, 0, 0, "LIT", NULL, NULL },
+ { 1, 1, 0, 0, "RCP", "RECIP", NULL },
+ { 1, 1, 0, 0, "RSQ", "RECIPSQRT", NULL },
+ { 1, 1, 0, 0, "EXP", "EXPP", NULL },
+ { 1, 1, 0, 0, "LOG", NULL, NULL },
+ { 1, 2, 0, 0, "MUL", NULL, NULL },
+ { 1, 2, 0, 0, "ADD", NULL, NULL },
+ { 1, 2, 0, 0, "DP3", "DOT3", NULL },
+ { 1, 2, 0, 0, "DP4", "DOT4", NULL },
+ { 1, 2, 0, 0, "DST", NULL, NULL },
+ { 1, 2, 0, 0, "MIN", NULL, NULL },
+ { 1, 2, 0, 0, "MAX", NULL, NULL },
+ { 1, 2, 0, 0, "SLT", "SETLT", NULL },
+ { 1, 2, 0, 0, "SGE", "SETGE", NULL },
+ { 1, 3, 0, 0, "MAD", "MADD", NULL },
+ { 1, 2, 0, 0, "SUB", NULL, NULL },
+ { 1, 3, 0, 0, "LRP", "LERP", NULL },
+ { 1, 3, 0, 0, "CND", NULL, NULL },
+ { 1, 3, 0, 0, "CND0", NULL, NULL },
+ { 1, 3, 0, 0, "DP2A", "DP2ADD", "DOT2ADD" },
+ { 1, 2, 0, 0, "INDEX", NULL, NULL },
+ { 1, 1, 0, 0, "NEGATE", NULL, NULL },
+ { 1, 1, 0, 0, "FRC", "FRAC", NULL },
+ { 1, 3, 0, 0, "CLAMP", NULL, NULL },
+ { 1, 1, 0, 0, "FLR", "FLOOR", NULL },
+ { 1, 1, 0, 0, "ROUND", NULL, NULL },
+ { 1, 1, 0, 0, "EX2", "EXPBASE2", NULL },
+ { 1, 1, 0, 0, "LG2", "LOGBASE2", "LOGP" },
+ { 1, 2, 0, 0, "POW", "POWER", NULL },
+ { 1, 2, 0, 0, "XPD", "CRS", "CROSSPRODUCT" },
+ { 1, 2, 0, 0, "M4X4", "MULTIPLYMATRIX", NULL },
+ { 1, 1, 0, 0, "ABS", NULL, NULL },
+ { 1, 1, 0, 0, "RCC", NULL, NULL },
+ { 1, 2, 0, 0, "DPH", NULL, NULL },
+ { 1, 1, 0, 0, "COS", NULL, NULL },
+ { 1, 1, 0, 0, "DDX", "DSX", NULL },
+ { 1, 1, 0, 0, "DDY", "DSY", NULL },
+ { 0, 0, 0, 0, "KILP", NULL, NULL },
+ { 1, 1, 0, 0, "PK2H", NULL, NULL },
+ { 1, 1, 0, 0, "PK2US", NULL, NULL },
+ { 1, 1, 0, 0, "PK4B", NULL, NULL },
+ { 1, 1, 0, 0, "PK4UB", NULL, NULL },
+ { 1, 2, 0, 0, "RFL", NULL, NULL },
+ { 1, 2, 0, 0, "SEQ", NULL, NULL },
+ { 1, 2, 0, 0, "SFL", NULL, NULL },
+ { 1, 2, 0, 0, "SGT", NULL, NULL },
+ { 1, 1, 0, 0, "SIN", NULL, NULL },
+ { 1, 2, 0, 0, "SLE", NULL, NULL },
+ { 1, 2, 0, 0, "SNE", NULL, NULL },
+ { 1, 2, 0, 0, "STR", NULL, NULL },
+ { 1, 2, 1, 0, "TEX", "TEXLD", NULL },
+ { 1, 4, 1, 0, "TXD", "TEXLDD", NULL },
+ { 1, 2, 1, 0, "TXP", NULL, NULL },
+ { 1, 1, 0, 0, "UP2H", NULL, NULL },
+ { 1, 1, 0, 0, "UP2US", NULL, NULL },
+ { 1, 1, 0, 0, "UP4B", NULL, NULL },
+ { 1, 1, 0, 0, "UP4UB", NULL, NULL },
+ { 1, 3, 0, 0, "X2D", NULL, NULL },
+ { 1, 1, 0, 0, "ARA", NULL, NULL },
+ { 1, 1, 0, 0, "ARR", "MOVA", NULL },
+ { 0, 1, 0, 0, "BRA", NULL, NULL },
+ { 0, 0, 0, 1, "CAL", "CALL", NULL },
+ { 0, 0, 0, 0, "RET", NULL, NULL },
+ { 1, 1, 0, 0, "SGN", "SSG", NULL },
+ { 1, 3, 0, 0, "CMP", NULL, NULL },
+ { 1, 1, 0, 0, "SCS", "SINCOS", NULL },
+ { 1, 2, 1, 0, "TXB", "TEXLDB", NULL },
+ { 1, 1, 0, 0, "NRM", NULL, NULL },
+ { 1, 2, 0, 0, "DIV", NULL, NULL },
+ { 1, 2, 0, 0, "DP2", NULL, NULL },
+ { 1, 2, 1, 0, "TXL", NULL, NULL },
+ { 0, 0, 0, 0, "BRK", "BREAK", NULL },
+ { 0, 1, 0, 1, "IF", NULL, NULL },
+ { 0, 0, 0, 0, "LOOP", NULL, NULL },
+ { 0, 1, 0, 0, "REP", NULL, NULL },
+ { 0, 0, 0, 1, "ELSE", NULL, NULL },
+ { 0, 0, 0, 0, "ENDIF", NULL, NULL },
+ { 0, 0, 0, 0, "ENDLOOP", NULL, NULL },
+ { 0, 0, 0, 0, "ENDREP", NULL, NULL },
+ { 0, 1, 0, 0, "PUSHA", NULL, NULL },
+ { 1, 0, 0, 0, "POPA", NULL, NULL },
+ { 1, 1, 0, 0, "CEIL", NULL, NULL },
+ { 1, 1, 0, 0, "I2F", NULL, NULL },
+ { 1, 1, 0, 0, "NOT", NULL, NULL },
+ { 1, 1, 0, 0, "INT", "TRUNC", NULL },
+ { 1, 2, 0, 0, "SHL", NULL, NULL },
+ { 1, 2, 0, 0, "SHR", NULL, NULL },
+ { 1, 2, 0, 0, "AND", NULL, NULL },
+ { 1, 2, 0, 0, "OR", NULL, NULL },
+ { 1, 2, 0, 0, "MOD", NULL, NULL },
+ { 1, 2, 0, 0, "XOR", NULL, NULL },
+ { 1, 3, 0, 0, "SAD", NULL, NULL },
+ { 1, 2, 1, 0, "TXF", NULL, NULL },
+ { 1, 2, 1, 0, "TXQ", NULL, NULL },
+ { 0, 0, 0, 0, "CONT", NULL, NULL },
+ { 0, 0, 0, 0, "EMIT", NULL, NULL },
+ { 0, 0, 0, 0, "ENDPRIM", NULL, NULL },
+ { 0, 0, 0, 1, "BGNLOOP2", NULL, NULL },
+ { 0, 0, 0, 0, "BGNSUB", NULL, NULL },
+ { 0, 0, 0, 1, "ENDLOOP2", NULL, NULL },
+ { 0, 0, 0, 0, "ENDSUB", NULL, NULL },
+ { 1, 1, 0, 0, "NOISE1", NULL, NULL },
+ { 1, 1, 0, 0, "NOISE2", NULL, NULL },
+ { 1, 1, 0, 0, "NOISE3", NULL, NULL },
+ { 1, 1, 0, 0, "NOISE4", NULL, NULL },
+ { 0, 0, 0, 0, "NOP", NULL, NULL },
+ { 1, 2, 0, 0, "M4X3", NULL, NULL },
+ { 1, 2, 0, 0, "M3X4", NULL, NULL },
+ { 1, 2, 0, 0, "M3X3", NULL, NULL },
+ { 1, 2, 0, 0, "M3X2", NULL, NULL },
+ { 1, 1, 0, 0, "NRM4", NULL, NULL },
+ { 0, 1, 0, 0, "CALLNZ", NULL, NULL },
+ { 0, 1, 0, 0, "IFC", NULL, NULL },
+ { 0, 1, 0, 0, "BREAKC", NULL, NULL },
+ { 0, 1, 0, 0, "KIL", "TEXKILL", NULL },
+ { 0, 0, 0, 0, "END", NULL, NULL },
+ { 1, 1, 0, 0, "SWZ", NULL, NULL }
};
const struct tgsi_opcode_info *
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.h b/src/gallium/auxiliary/tgsi/tgsi_info.h
index 7230bdaae33..077e25acd7f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.h
@@ -41,6 +41,8 @@ struct tgsi_opcode_info
boolean is_tex;
boolean is_branch;
const char *mnemonic;
+ const char *alt_mnemonic1;
+ const char *alt_mnemonic2;
};
const struct tgsi_opcode_info *
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 58fe07c11d1..a40fcab2126 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -358,9 +358,9 @@ parse_register_dst(
/* Parse source register operand.
* <register_src> ::= <register_file_bracket_index> `]' |
- * <register_file_bracket> <register_dst> `]' |
- * <register_file_bracket> <register_dst> `+' <uint> `]' |
- * <register_file_bracket> <register_dst> `-' <uint> `]'
+ * <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `]' |
+ * <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `+' <uint> `]' |
+ * <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `-' <uint> `]'
*/
static boolean
parse_register_src(
@@ -368,11 +368,13 @@ parse_register_src(
uint *file,
int *index,
uint *ind_file,
- int *ind_index )
+ int *ind_index,
+ uint *ind_comp)
{
const char *cur;
uint uindex;
+ *ind_comp = TGSI_SWIZZLE_X;
if (!parse_register_file_bracket( ctx, file ))
return FALSE;
eat_opt_white( &ctx->cur );
@@ -381,6 +383,32 @@ parse_register_src(
if (!parse_register_dst( ctx, ind_file, ind_index ))
return FALSE;
eat_opt_white( &ctx->cur );
+
+ if (*ctx->cur == '.') {
+ ctx->cur++;
+ eat_opt_white(&ctx->cur);
+
+ switch (uprcase(*ctx->cur)) {
+ case 'X':
+ *ind_comp = TGSI_SWIZZLE_X;
+ break;
+ case 'Y':
+ *ind_comp = TGSI_SWIZZLE_Y;
+ break;
+ case 'Z':
+ *ind_comp = TGSI_SWIZZLE_Z;
+ break;
+ case 'W':
+ *ind_comp = TGSI_SWIZZLE_W;
+ break;
+ default:
+ report_error(ctx, "Expected indirect register swizzle component `x', `y', `z' or `w'");
+ return FALSE;
+ }
+ ctx->cur++;
+ eat_opt_white(&ctx->cur);
+ }
+
if (*ctx->cur == '+' || *ctx->cur == '-') {
boolean negate;
@@ -561,7 +589,9 @@ parse_src_operand(
int index;
uint ind_file;
int ind_index;
+ uint ind_comp;
uint swizzle[4];
+ boolean parsed_ext_negate_paren = FALSE;
boolean parsed_swizzle;
boolean parsed_extswizzle;
@@ -574,10 +604,17 @@ parse_src_operand(
src->SrcRegisterExtMod.Negate = 1;
eat_opt_white( &cur );
ctx->cur = cur;
+ parsed_ext_negate_paren = TRUE;
+ }
+ else if (*cur == '|') {
+ cur++;
+ src->SrcRegisterExtMod.Negate = 1;
+ src->SrcRegisterExtMod.Absolute = 1;
+ eat_opt_white(&cur);
+ ctx->cur = cur;
}
}
-
- if (*ctx->cur == '|') {
+ else if (*ctx->cur == '|') {
ctx->cur++;
eat_opt_white( &ctx->cur );
src->SrcRegisterExtMod.Absolute = 1;
@@ -635,7 +672,7 @@ parse_src_operand(
}
}
- if (!parse_register_src( ctx, &file, &index, &ind_file, &ind_index ))
+ if (!parse_register_src(ctx, &file, &index, &ind_file, &ind_index, &ind_comp))
return FALSE;
src->SrcRegister.File = file;
src->SrcRegister.Index = index;
@@ -643,6 +680,10 @@ parse_src_operand(
src->SrcRegister.Indirect = 1;
src->SrcRegisterInd.File = ind_file;
src->SrcRegisterInd.Index = ind_index;
+ src->SrcRegisterInd.SwizzleX = ind_comp;
+ src->SrcRegisterInd.SwizzleY = ind_comp;
+ src->SrcRegisterInd.SwizzleZ = ind_comp;
+ src->SrcRegisterInd.SwizzleW = ind_comp;
}
/* Parse optional swizzle.
@@ -715,7 +756,7 @@ parse_src_operand(
ctx->cur++;
}
- if (src->SrcRegisterExtMod.Negate) {
+ if (parsed_ext_negate_paren) {
eat_opt_white( &ctx->cur );
if (*ctx->cur != ')') {
report_error( ctx, "Expected `)'" );
@@ -741,6 +782,26 @@ static const char *texture_names[TGSI_TEXTURE_COUNT] =
};
static boolean
+match_inst_mnemonic(const char **pcur,
+ const struct tgsi_opcode_info *info)
+{
+ if (str_match_no_case(pcur, info->mnemonic)) {
+ return TRUE;
+ }
+ if (info->alt_mnemonic1) {
+ if (str_match_no_case(pcur, info->alt_mnemonic1)) {
+ return TRUE;
+ }
+ if (info->alt_mnemonic2) {
+ if (str_match_no_case(pcur, info->alt_mnemonic2)) {
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+static boolean
parse_instruction(
struct translate_ctx *ctx,
boolean has_label )
@@ -758,7 +819,7 @@ parse_instruction(
const char *cur = ctx->cur;
info = tgsi_get_opcode_info( i );
- if (str_match_no_case( &cur, info->mnemonic )) {
+ if (match_inst_mnemonic(&cur, info)) {
if (str_match_no_case( &cur, "_SATNV" ))
saturate = TGSI_SAT_MINUS_PLUS_ONE;
else if (str_match_no_case( &cur, "_SAT" ))
diff --git a/src/gallium/auxiliary/translate/translate.c b/src/gallium/auxiliary/translate/translate.c
index 7678903f75c..a9b7253bf44 100644
--- a/src/gallium/auxiliary/translate/translate.c
+++ b/src/gallium/auxiliary/translate/translate.c
@@ -42,6 +42,8 @@ struct translate *translate_create( const struct translate_key *key )
translate = translate_sse2_create( key );
if (translate)
return translate;
+#else
+ (void)translate;
#endif
return translate_generic_create( key );
diff --git a/src/gallium/auxiliary/util/Makefile b/src/gallium/auxiliary/util/Makefile
index d68bdeadcc8..5035e9cc133 100644
--- a/src/gallium/auxiliary/util/Makefile
+++ b/src/gallium/auxiliary/util/Makefile
@@ -5,6 +5,8 @@ LIBNAME = util
C_SOURCES = \
u_debug.c \
+ u_debug_symbol.c \
+ u_debug_stack.c \
u_blit.c \
u_cache.c \
u_draw_quad.c \
diff --git a/src/gallium/auxiliary/util/SConscript b/src/gallium/auxiliary/util/SConscript
index 0f15c632c3f..8317263bb8b 100644
--- a/src/gallium/auxiliary/util/SConscript
+++ b/src/gallium/auxiliary/util/SConscript
@@ -10,6 +10,7 @@ util = env.ConvenienceLibrary(
'u_debug_memory.c',
'u_debug_profile.c',
'u_debug_stack.c',
+ 'u_debug_symbol.c',
'u_draw_quad.c',
'u_gen_mipmap.c',
'u_handle_table.c',
diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h
new file mode 100644
index 00000000000..7c16b32cf9f
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_clear.h
@@ -0,0 +1,60 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/* Authors:
+ * Michel Dänzer
+ */
+
+
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "util/u_pack_color.h"
+
+
+/**
+ * Clear the given buffers to the specified values.
+ * No masking, no scissor (clear entire buffer).
+ */
+static INLINE void
+util_clear(struct pipe_context *pipe,
+ struct pipe_framebuffer_state *framebuffer, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil)
+{
+ if (buffers & PIPE_CLEAR_COLOR) {
+ struct pipe_surface *ps = framebuffer->cbufs[0];
+ unsigned color;
+
+ util_pack_color(rgba, ps->format, &color);
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
+ }
+
+ if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+ struct pipe_surface *ps = framebuffer->zsbuf;
+
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height,
+ util_pack_z_stencil(ps->format, depth, stencil));
+ }
+}
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index f96e27e09fd..96a2222f9b6 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -169,18 +169,18 @@ void debug_print_blob( const char *name,
#endif
-void _debug_break(void)
+#ifndef debug_break
+void debug_break(void)
{
-#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
- __asm("int3");
-#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
- _asm {int 3};
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+ DebugBreak();
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
EngDebugBreak();
#else
abort();
#endif
}
+#endif
#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
@@ -715,78 +715,85 @@ struct bmp_rgb_quad {
uint8_t rgbAlpha;
};
-void
+void
debug_dump_surface_bmp(const char *filename,
struct pipe_surface *surface)
{
+ struct pipe_transfer *transfer;
+ struct pipe_texture *texture = surface->texture;
+ struct pipe_screen *screen = texture->screen;
+
+ transfer = screen->get_tex_transfer(screen, texture, surface->face,
+ surface->level, surface->zslice,
+ PIPE_TRANSFER_READ, 0, 0, surface->width,
+ surface->height);
+
+ debug_dump_transfer_bmp(filename, transfer);
+
+ screen->tex_transfer_destroy(transfer);
+}
+
+void
+debug_dump_transfer_bmp(const char *filename,
+ struct pipe_transfer *transfer)
+{
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
- struct pipe_texture *texture;
- struct pipe_screen *screen;
struct util_stream *stream;
- struct pipe_transfer *transfer;
struct bmp_file_header bmfh;
struct bmp_info_header bmih;
float *rgba;
unsigned x, y;
- if (!surface)
+ if (!transfer)
goto error1;
- rgba = MALLOC(surface->width*4*sizeof(float));
+ rgba = MALLOC(transfer->width*transfer->height*4*sizeof(float));
if(!rgba)
goto error1;
-
+
bmfh.bfType = 0x4d42;
- bmfh.bfSize = 14 + 40 + surface->height*surface->width*4;
+ bmfh.bfSize = 14 + 40 + transfer->height*transfer->width*4;
bmfh.bfReserved1 = 0;
bmfh.bfReserved2 = 0;
bmfh.bfOffBits = 14 + 40;
-
+
bmih.biSize = 40;
- bmih.biWidth = surface->width;
- bmih.biHeight = surface->height;
+ bmih.biWidth = transfer->width;
+ bmih.biHeight = transfer->height;
bmih.biPlanes = 1;
bmih.biBitCount = 32;
bmih.biCompression = 0;
- bmih.biSizeImage = surface->height*surface->width*4;
+ bmih.biSizeImage = transfer->height*transfer->width*4;
bmih.biXPelsPerMeter = 0;
bmih.biYPelsPerMeter = 0;
bmih.biClrUsed = 0;
bmih.biClrImportant = 0;
-
+
stream = util_stream_create(filename, bmfh.bfSize);
if(!stream)
goto error2;
-
+
util_stream_write(stream, &bmfh, 14);
util_stream_write(stream, &bmih, 40);
- texture = surface->texture;
- screen = texture->screen;
-
- transfer = screen->get_tex_transfer(screen, texture, surface->face,
- surface->level, surface->zslice,
- PIPE_TRANSFER_READ, 0, 0, surface->width,
- surface->height);
+ pipe_get_tile_rgba(transfer, 0, 0,
+ transfer->width, transfer->height,
+ rgba);
- y = surface->height;
+ y = transfer->height;
while(y--) {
- pipe_get_tile_rgba(transfer,
- 0, y, surface->width, 1,
- rgba);
- for(x = 0; x < surface->width; ++x)
+ float *ptr = rgba + (transfer->width * y * 4);
+ for(x = 0; x < transfer->width; ++x)
{
struct bmp_rgb_quad pixel;
- pixel.rgbRed = float_to_ubyte(rgba[x*4 + 0]);
- pixel.rgbGreen = float_to_ubyte(rgba[x*4 + 1]);
- pixel.rgbBlue = float_to_ubyte(rgba[x*4 + 2]);
- pixel.rgbAlpha = float_to_ubyte(rgba[x*4 + 3]);
+ pixel.rgbRed = float_to_ubyte(ptr[x*4 + 0]);
+ pixel.rgbGreen = float_to_ubyte(ptr[x*4 + 1]);
+ pixel.rgbBlue = float_to_ubyte(ptr[x*4 + 2]);
+ pixel.rgbAlpha = 255;
util_stream_write(stream, &pixel, 4);
- }
+ }
}
- screen->tex_transfer_destroy(transfer);
-
util_stream_close(stream);
error2:
FREE(rgba);
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index 7c829707b20..8d703e47fce 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -125,19 +125,16 @@ void debug_print_format(const char *msg, unsigned fmt );
#endif
-void _debug_break(void);
-
-
/**
* Hard-coded breakpoint.
*/
#ifdef DEBUG
-#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
+#if (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)) && defined(PIPE_CC_GCC)
#define debug_break() __asm("int3")
-#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
-#define debug_break() do { _asm {int 3} } while(0)
+#elif defined(PIPE_CC_MSVC)
+#define debug_break() __debugbreak()
#else
-#define debug_break() _debug_break()
+void debug_break(void);
#endif
#else /* !DEBUG */
#define debug_break() ((void)0)
@@ -338,6 +335,7 @@ debug_profile_stop(void);
#ifdef DEBUG
struct pipe_surface;
+struct pipe_transfer;
void debug_dump_image(const char *prefix,
unsigned format, unsigned cpp,
unsigned width, unsigned height,
@@ -347,6 +345,8 @@ void debug_dump_surface(const char *prefix,
struct pipe_surface *surface);
void debug_dump_surface_bmp(const char *filename,
struct pipe_surface *surface);
+void debug_dump_transfer_bmp(const char *filename,
+ struct pipe_transfer *transfer);
#else
#define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0)
#define debug_dump_surface(prefix, surface) ((void)0)
diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c
index 76068a65091..e9891fde8a3 100644
--- a/src/gallium/auxiliary/util/u_debug_stack.c
+++ b/src/gallium/auxiliary/util/u_debug_stack.c
@@ -33,6 +33,7 @@
*/
#include "u_debug.h"
+#include "u_debug_symbol.h"
#include "u_debug_stack.h"
@@ -49,7 +50,7 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace,
#if defined(PIPE_CC_GCC)
frame_pointer = ((const void **)__builtin_frame_address(1));
-#elif defined(PIPE_CC_MSVC)
+#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
__asm {
mov frame_pointer, ebp
}
@@ -91,7 +92,7 @@ debug_backtrace_dump(const struct debug_stack_frame *backtrace,
for(i = 0; i < nr_frames; ++i) {
if(!backtrace[i].function)
break;
- debug_printf("\t%p\n", backtrace[i].function);
+ debug_symbol_print(backtrace[i].function);
}
}
diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c
new file mode 100644
index 00000000000..811931f81b0
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_debug_symbol.c
@@ -0,0 +1,250 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Symbol lookup.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+#include "pipe/p_compiler.h"
+
+#include "u_debug.h"
+#include "u_debug_symbol.h"
+
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86)
+
+#include <windows.h>
+#include <stddef.h>
+#include <imagehlp.h>
+
+/*
+ * TODO: Cleanup code.
+ * TODO: Support x86_64
+ */
+
+static BOOL bSymInitialized = FALSE;
+
+static HMODULE hModule_Imagehlp = NULL;
+
+typedef BOOL (WINAPI *PFNSYMINITIALIZE)(HANDLE, LPSTR, BOOL);
+static PFNSYMINITIALIZE pfnSymInitialize = NULL;
+
+static
+BOOL WINAPI j_SymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymInitialize || (pfnSymInitialize = (PFNSYMINITIALIZE) GetProcAddress(hModule_Imagehlp, "SymInitialize")))
+ )
+ return pfnSymInitialize(hProcess, UserSearchPath, fInvadeProcess);
+ else
+ return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMCLEANUP)(HANDLE);
+static PFNSYMCLEANUP pfnSymCleanup = NULL;
+
+static
+BOOL WINAPI j_SymCleanup(HANDLE hProcess)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymCleanup || (pfnSymCleanup = (PFNSYMCLEANUP) GetProcAddress(hModule_Imagehlp, "SymCleanup")))
+ )
+ return pfnSymCleanup(hProcess);
+ else
+ return FALSE;
+}
+
+typedef DWORD (WINAPI *PFNSYMSETOPTIONS)(DWORD);
+static PFNSYMSETOPTIONS pfnSymSetOptions = NULL;
+
+static
+DWORD WINAPI j_SymSetOptions(DWORD SymOptions)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymSetOptions || (pfnSymSetOptions = (PFNSYMSETOPTIONS) GetProcAddress(hModule_Imagehlp, "SymSetOptions")))
+ )
+ return pfnSymSetOptions(SymOptions);
+ else
+ return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMUNDNAME)(PIMAGEHLP_SYMBOL, PSTR, DWORD);
+static PFNSYMUNDNAME pfnSymUnDName = NULL;
+
+static
+BOOL WINAPI j_SymUnDName(PIMAGEHLP_SYMBOL Symbol, PSTR UnDecName, DWORD UnDecNameLength)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymUnDName || (pfnSymUnDName = (PFNSYMUNDNAME) GetProcAddress(hModule_Imagehlp, "SymUnDName")))
+ )
+ return pfnSymUnDName(Symbol, UnDecName, UnDecNameLength);
+ else
+ return FALSE;
+}
+
+typedef PFUNCTION_TABLE_ACCESS_ROUTINE PFNSYMFUNCTIONTABLEACCESS;
+static PFNSYMFUNCTIONTABLEACCESS pfnSymFunctionTableAccess = NULL;
+
+static
+PVOID WINAPI j_SymFunctionTableAccess(HANDLE hProcess, DWORD AddrBase)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymFunctionTableAccess || (pfnSymFunctionTableAccess = (PFNSYMFUNCTIONTABLEACCESS) GetProcAddress(hModule_Imagehlp, "SymFunctionTableAccess")))
+ )
+ return pfnSymFunctionTableAccess(hProcess, AddrBase);
+ else
+ return NULL;
+}
+
+typedef PGET_MODULE_BASE_ROUTINE PFNSYMGETMODULEBASE;
+static PFNSYMGETMODULEBASE pfnSymGetModuleBase = NULL;
+
+static
+DWORD WINAPI j_SymGetModuleBase(HANDLE hProcess, DWORD dwAddr)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymGetModuleBase || (pfnSymGetModuleBase = (PFNSYMGETMODULEBASE) GetProcAddress(hModule_Imagehlp, "SymGetModuleBase")))
+ )
+ return pfnSymGetModuleBase(hProcess, dwAddr);
+ else
+ return 0;
+}
+
+typedef BOOL (WINAPI *PFNSTACKWALK)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE);
+static PFNSTACKWALK pfnStackWalk = NULL;
+
+static
+BOOL WINAPI j_StackWalk(
+ DWORD MachineType,
+ HANDLE hProcess,
+ HANDLE hThread,
+ LPSTACKFRAME StackFrame,
+ PVOID ContextRecord,
+ PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,
+ PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
+ PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,
+ PTRANSLATE_ADDRESS_ROUTINE TranslateAddress
+)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnStackWalk || (pfnStackWalk = (PFNSTACKWALK) GetProcAddress(hModule_Imagehlp, "StackWalk")))
+ )
+ return pfnStackWalk(
+ MachineType,
+ hProcess,
+ hThread,
+ StackFrame,
+ ContextRecord,
+ ReadMemoryRoutine,
+ FunctionTableAccessRoutine,
+ GetModuleBaseRoutine,
+ TranslateAddress
+ );
+ else
+ return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMGETSYMFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_SYMBOL);
+static PFNSYMGETSYMFROMADDR pfnSymGetSymFromAddr = NULL;
+
+static
+BOOL WINAPI j_SymGetSymFromAddr(HANDLE hProcess, DWORD Address, PDWORD Displacement, PIMAGEHLP_SYMBOL Symbol)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymGetSymFromAddr || (pfnSymGetSymFromAddr = (PFNSYMGETSYMFROMADDR) GetProcAddress(hModule_Imagehlp, "SymGetSymFromAddr")))
+ )
+ return pfnSymGetSymFromAddr(hProcess, Address, Displacement, Symbol);
+ else
+ return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMGETLINEFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_LINE);
+static PFNSYMGETLINEFROMADDR pfnSymGetLineFromAddr = NULL;
+
+static
+BOOL WINAPI j_SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE Line)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymGetLineFromAddr || (pfnSymGetLineFromAddr = (PFNSYMGETLINEFROMADDR) GetProcAddress(hModule_Imagehlp, "SymGetLineFromAddr")))
+ )
+ return pfnSymGetLineFromAddr(hProcess, dwAddr, pdwDisplacement, Line);
+ else
+ return FALSE;
+}
+
+
+static INLINE boolean
+debug_symbol_print_imagehlp(const void *addr)
+{
+ HANDLE hProcess;
+ BYTE symbolBuffer[1024];
+ PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL) symbolBuffer;
+ DWORD dwDisplacement = 0; // Displacement of the input address, relative to the start of the symbol
+
+ hProcess = GetCurrentProcess();
+
+ pSymbol->SizeOfStruct = sizeof(symbolBuffer);
+ pSymbol->MaxNameLength = sizeof(symbolBuffer) - offsetof(IMAGEHLP_SYMBOL, Name);
+
+ if(!bSymInitialized) {
+ j_SymSetOptions(/* SYMOPT_UNDNAME | */ SYMOPT_LOAD_LINES);
+ if(j_SymInitialize(hProcess, NULL, TRUE))
+ bSymInitialized = TRUE;
+ }
+
+ if(!j_SymGetSymFromAddr(hProcess, (DWORD)addr, &dwDisplacement, pSymbol))
+ return FALSE;
+
+ debug_printf("\t%s\n", pSymbol->Name);
+
+ return TRUE;
+
+}
+#endif
+
+
+void
+debug_symbol_print(const void *addr)
+{
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86)
+ if(debug_symbol_print_imagehlp(addr))
+ return;
+#endif
+
+ debug_printf("\t%p\n", addr);
+}
diff --git a/src/gallium/auxiliary/util/u_debug_symbol.h b/src/gallium/auxiliary/util/u_debug_symbol.h
new file mode 100644
index 00000000000..021586987b6
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_debug_symbol.h
@@ -0,0 +1,53 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef U_DEBUG_SYMBOL_H_
+#define U_DEBUG_SYMBOL_H_
+
+
+/**
+ * @file
+ * Symbol lookup.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void
+debug_symbol_print(const void *addr);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* U_DEBUG_SYMBOL_H_ */
diff --git a/src/gallium/auxiliary/util/u_double_list.h b/src/gallium/auxiliary/util/u_double_list.h
index d108d92e52b..53bb1342ddc 100644
--- a/src/gallium/auxiliary/util/u_double_list.h
+++ b/src/gallium/auxiliary/util/u_double_list.h
@@ -95,5 +95,8 @@ struct list_head
#define LIST_ENTRY(__type, __item, __field) \
((__type *)(((char *)(__item)) - offsetof(__type, __field)))
+#define LIST_IS_EMPTY(__list) \
+ ((__list)->next == (__list))
+
#endif /*_U_DOUBLE_LIST_H_*/
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 1ecde7a9125..e5003af01d8 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -319,11 +319,33 @@ util_iround(float f)
-#if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
+/**
+ * Test if x is NaN or +/- infinity.
+ */
+static INLINE boolean
+util_is_inf_or_nan(float x)
+{
+ union fi tmp;
+ tmp.f = x;
+ return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31);
+}
+
+
/**
* Find first bit set in word. Least significant bit is 1.
* Return 0 if no bits set.
*/
+#if defined(_MSC_VER) && _MSC_VER >= 1300
+static INLINE
+unsigned long ffs( unsigned long u )
+{
+ unsigned long i;
+ if(_BitScanForward(&i, u))
+ return i + 1;
+ else
+ return 0;
+}
+#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
static INLINE
unsigned ffs( unsigned u )
{
@@ -339,9 +361,7 @@ unsigned ffs( unsigned u )
return i;
}
-#endif
-
-#ifdef __MINGW32__
+#elif defined(__MINGW32__)
#define ffs __builtin_ffs
#endif
diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h
index e0e8aa8e9fe..eda883b3b92 100644
--- a/src/gallium/auxiliary/util/u_pack_color.h
+++ b/src/gallium/auxiliary/util/u_pack_color.h
@@ -434,12 +434,42 @@ util_pack_z(enum pipe_format format, double z)
if (z == 1.0)
return 0xffffff00;
return ((uint) (z * 0xffffff)) << 8;
+ case PIPE_FORMAT_S8_UNORM:
+ /* this case can get it via util_pack_z_stencil() */
+ return 0;
default:
debug_print_format("gallium: unhandled format in util_pack_z()", format);
assert(0);
return 0;
}
}
+
+
+/**
+ * Pack Z and/or stencil values into a 32-bit value described by format.
+ * Note: it's assumed that z is in [0,1] and s in [0,255]
+ */
+static INLINE uint
+util_pack_z_stencil(enum pipe_format format, double z, uint s)
+{
+ unsigned packed = util_pack_z(format, z);
+
+ switch (format) {
+ case PIPE_FORMAT_S8Z24_UNORM:
+ packed |= s << 24;
+ break;
+ case PIPE_FORMAT_Z24S8_UNORM:
+ packed |= s;
+ break;
+ case PIPE_FORMAT_S8_UNORM:
+ packed |= s;
+ break;
+ default:
+ break;
+ }
+
+ return packed;
+}
/**
diff --git a/src/gallium/auxiliary/util/u_stream_stdc.c b/src/gallium/auxiliary/util/u_stream_stdc.c
index 0ead45a7491..d8f648e5dd1 100644
--- a/src/gallium/auxiliary/util/u_stream_stdc.c
+++ b/src/gallium/auxiliary/util/u_stream_stdc.c
@@ -32,7 +32,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_OS_SOLARIS)
#include <stdio.h>
diff --git a/src/gallium/auxiliary/util/u_string.h b/src/gallium/auxiliary/util/u_string.h
index 08c89bbf770..cc7992d7391 100644
--- a/src/gallium/auxiliary/util/u_string.h
+++ b/src/gallium/auxiliary/util/u_string.h
@@ -130,7 +130,7 @@ static INLINE char *
util_strstr(const char *haystack, const char *needle)
{
const char *p = haystack;
- int len = strlen(needle);
+ size_t len = strlen(needle);
for (; (p = util_strchr(p, *needle)) != 0; p++) {
if (util_strncmp(p, needle, len) == 0) {
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index d31ca9c029e..f0a5a339eb3 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -957,6 +957,7 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
s8z24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
z24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_Z32_FLOAT:
@@ -1069,6 +1070,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
/*s8z24_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
break;
case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
/*z24s8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
break;
default:
@@ -1198,6 +1200,20 @@ pipe_put_tile_z(struct pipe_transfer *pt,
}
}
break;
+ case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
+ {
+ uint *pDest = (uint *) (map + y * pt->stride + x*4);
+ for (i = 0; i < h; i++) {
+ for (j = 0; j < w; j++) {
+ /* convert 32-bit Z to 24-bit Z (0 stencil) */
+ pDest[j] = ptrc[j] << 8;
+ }
+ pDest += pt->stride/4;
+ ptrc += srcStride;
+ }
+ }
+ break;
case PIPE_FORMAT_Z16_UNORM:
{
ushort *pDest = (ushort *) (map + y * pt->stride + x*2);
diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c
index 357d9360c90..8afe4fccf7b 100644
--- a/src/gallium/auxiliary/util/u_time.c
+++ b/src/gallium/auxiliary/util/u_time.c
@@ -35,7 +35,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#include <sys/time.h>
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
#include <windows.h>
@@ -77,7 +77,7 @@ util_time_get_frequency(void)
void
util_time_get(struct util_time *t)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
gettimeofday(&t->tv, NULL);
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
LONGLONG temp;
@@ -102,7 +102,7 @@ util_time_add(const struct util_time *t1,
int64_t usecs,
struct util_time *t2)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000;
t2->tv.tv_usec = t1->tv.tv_usec + usecs % 1000000;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
@@ -124,7 +124,7 @@ int64_t
util_time_diff(const struct util_time *t1,
const struct util_time *t2)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
return (t2->tv.tv_usec - t1->tv.tv_usec) +
(t2->tv.tv_sec - t1->tv.tv_sec)*1000000;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
@@ -144,7 +144,7 @@ util_time_micros( void )
util_time_get(&t1);
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
return t1.tv.tv_usec + t1.tv.tv_sec*1000000LL;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
util_time_get_frequency();
@@ -166,7 +166,7 @@ static INLINE int
util_time_compare(const struct util_time *t1,
const struct util_time *t2)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
if (t1->tv.tv_sec < t2->tv.tv_sec)
return -1;
else if(t1->tv.tv_sec > t2->tv.tv_sec)
diff --git a/src/gallium/auxiliary/util/u_time.h b/src/gallium/auxiliary/util/u_time.h
index 4346ce1fa45..6bca6077a2a 100644
--- a/src/gallium/auxiliary/util/u_time.h
+++ b/src/gallium/auxiliary/util/u_time.h
@@ -38,7 +38,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#include <time.h> /* timeval */
#include <unistd.h> /* usleep */
#endif
@@ -58,7 +58,7 @@ extern "C" {
*/
struct util_time
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
struct timeval tv;
#else
int64_t counter;
@@ -89,7 +89,7 @@ util_time_timeout(const struct util_time *start,
const struct util_time *end,
const struct util_time *curr);
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#define util_time_sleep usleep
#else
void
diff --git a/src/gallium/drivers/cell/ppu/cell_clear.c b/src/gallium/drivers/cell/ppu/cell_clear.c
index edc06747ac1..79ad687ea94 100644
--- a/src/gallium/drivers/cell/ppu/cell_clear.c
+++ b/src/gallium/drivers/cell/ppu/cell_clear.c
@@ -46,53 +46,41 @@
/**
- * Convert packed pixel from one format to another.
- */
-static unsigned
-convert_color(enum pipe_format srcFormat, unsigned srcColor,
- enum pipe_format dstFormat)
-{
- ubyte r, g, b, a;
- unsigned dstColor;
-
- util_unpack_color_ub(srcFormat, &srcColor, &r, &g, &b, &a);
- util_pack_color_ub(r, g, b, a, dstFormat, &dstColor);
-
- return dstColor;
-}
-
-
-
-/**
* Called via pipe->clear()
*/
void
-cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue)
+cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
+ double depth, unsigned stencil)
{
struct cell_context *cell = cell_context(pipe);
- uint surfIndex;
if (cell->dirty)
cell_update_derived(cell);
- if (ps == cell->framebuffer.zsbuf) {
- /* clear z/stencil buffer */
- surfIndex = 1;
- }
- else {
- /* clear color buffer */
- surfIndex = 0;
+ if (buffers & PIPE_CLEAR_COLOR) {
+ uint surfIndex = 0;
+ uint clearValue;
- if (ps->format != PIPE_FORMAT_A8R8G8B8_UNORM) {
- clearValue = convert_color(PIPE_FORMAT_A8R8G8B8_UNORM, clearValue,
- ps->format);
- }
+ util_pack_color(rgba, cell->framebuffer.cbufs[0]->format, &clearValue);
+
+ /* Build a CLEAR command and place it in the current batch buffer */
+ STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0);
+ struct cell_command_clear_surface *clr
+ = (struct cell_command_clear_surface *)
+ cell_batch_alloc16(cell, sizeof(*clr));
+ clr->opcode[0] = CELL_CMD_CLEAR_SURFACE;
+ clr->surface = surfIndex;
+ clr->value = clearValue;
}
+ if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+ uint surfIndex = 1;
+ uint clearValue;
- /* Build a CLEAR command and place it in the current batch buffer */
- {
+ clearValue = util_pack_z_stencil(cell->framebuffer.zsbuf->format,
+ depth, stencil);
+
+ /* Build a CLEAR command and place it in the current batch buffer */
STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0);
struct cell_command_clear_surface *clr
= (struct cell_command_clear_surface *)
@@ -101,17 +89,4 @@ cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps,
clr->surface = surfIndex;
clr->value = clearValue;
}
-
- /* Technically, the surface's contents are now known and cleared,
- * so we could set the status to PIPE_SURFACE_STATUS_CLEAR. But
- * it turns out it's quite painful to recognize when any particular
- * surface goes from PIPE_SURFACE_STATUS_CLEAR to
- * PIPE_SURFACE_STATUS_DEFINED (i.e. with known contents), because
- * the drawing commands could be operating on numerous draw buffers,
- * which we'd have to iterate through to set all their stati...
- * For now, we cheat a bit and set the surface's status to DEFINED
- * right here. Later we should revisit this and set the status to
- * CLEAR here, and find a better place to set the status to DEFINED.
- */
- ps->status = PIPE_SURFACE_STATUS_DEFINED;
}
diff --git a/src/gallium/drivers/cell/ppu/cell_clear.h b/src/gallium/drivers/cell/ppu/cell_clear.h
index ff47d43f4cd..08e091adfdb 100644
--- a/src/gallium/drivers/cell/ppu/cell_clear.h
+++ b/src/gallium/drivers/cell/ppu/cell_clear.h
@@ -31,13 +31,11 @@
struct pipe_context;
-struct pipe_surface;
extern void
-cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue);
-
+cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
+ double depth, unsigned stencil);
#endif /* CELL_CLEAR_H */
diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c
index ae82ded334a..808be589bd9 100644
--- a/src/gallium/drivers/cell/ppu/cell_context.c
+++ b/src/gallium/drivers/cell/ppu/cell_context.c
@@ -119,7 +119,7 @@ cell_create_context(struct pipe_screen *screen,
cell->pipe.screen = screen;
cell->pipe.destroy = cell_destroy_context;
- cell->pipe.clear = cell_clear_surface;
+ cell->pipe.clear = cell_clear;
cell->pipe.flush = cell_flush;
#if 0
diff --git a/src/gallium/drivers/i915simple/i915_clear.c b/src/gallium/drivers/i915simple/i915_clear.c
index 8a2d3ca43f1..90530f2826f 100644
--- a/src/gallium/drivers/i915simple/i915_clear.c
+++ b/src/gallium/drivers/i915simple/i915_clear.c
@@ -25,24 +25,24 @@
*
**************************************************************************/
-/* Author:
+/* Authors:
* Brian Paul
*/
-#include "pipe/p_defines.h"
+#include "util/u_clear.h"
#include "i915_context.h"
#include "i915_state.h"
/**
- * Clear the given surface to the specified value.
+ * Clear the given buffers to the specified values.
* No masking, no scissor (clear entire buffer).
*/
void
-i915_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue)
+i915_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
+ double depth, unsigned stencil)
{
- pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
- ps->status = PIPE_SURFACE_STATUS_DEFINED;
+ util_clear(pipe, &i915_context(pipe)->framebuffer, buffers, rgba, depth,
+ stencil);
}
diff --git a/src/gallium/drivers/i915simple/i915_context.h b/src/gallium/drivers/i915simple/i915_context.h
index 3cdabe45f9d..b6983ba86e7 100644
--- a/src/gallium/drivers/i915simple/i915_context.h
+++ b/src/gallium/drivers/i915simple/i915_context.h
@@ -314,8 +314,8 @@ void i915_emit_hardware_state(struct i915_context *i915 );
/***********************************************************************
* i915_clear.c:
*/
-void i915_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue);
+void i915_clear( struct pipe_context *pipe, unsigned buffers, const float *rgba,
+ double depth, unsigned stencil);
/***********************************************************************
diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c
index 39aca9f8173..ca8e87af8d1 100644
--- a/src/gallium/drivers/i915simple/i915_texture.c
+++ b/src/gallium/drivers/i915simple/i915_texture.c
@@ -677,7 +677,6 @@ i915_get_tex_surface(struct pipe_screen *screen,
ps->height = pt->height[level];
ps->offset = offset;
ps->usage = flags;
- ps->status = PIPE_SURFACE_STATUS_DEFINED;
}
return ps;
}
@@ -725,14 +724,6 @@ i915_init_texture_functions(struct i915_context *i915)
static void
i915_tex_surface_destroy(struct pipe_surface *surf)
{
- /* This really should not be possible, but it's actually
- * happening quite a bit... Will fix.
- */
- if (surf->status == PIPE_SURFACE_STATUS_CLEAR) {
- debug_printf("XXX destroying a surface with pending clears...\n");
- assert(0);
- }
-
pipe_texture_reference(&surf->texture, NULL);
FREE(surf);
}
diff --git a/src/gallium/drivers/i965simple/brw_defines.h b/src/gallium/drivers/i965simple/brw_defines.h
index 9379a397f63..715d2d2d011 100644
--- a/src/gallium/drivers/i965simple/brw_defines.h
+++ b/src/gallium/drivers/i965simple/brw_defines.h
@@ -289,6 +289,24 @@
#define BRW_RASTRULE_UPPER_LEFT 0
#define BRW_RASTRULE_UPPER_RIGHT 1
+/* These are listed as "Reserved, but not seen as useful"
+ * in Intel documentation (page 212, "Point Rasterization Rule",
+ * section 7.4 "SF Pipeline State Summary", of document
+ * "Intel® 965 Express Chipset Family and Intel® G35 Express
+ * Chipset Graphics Controller Programmer's Reference Manual,
+ * Volume 2: 3D/Media", Revision 1.0b as of January 2008,
+ * available at
+ * http://intellinuxgraphics.org/documentation.html
+ * at the time of this writing).
+ *
+ * These appear to be supported on at least some
+ * i965-family devices, and the BRW_RASTRULE_LOWER_RIGHT
+ * is useful when using OpenGL to render to a FBO
+ * (which has the pixel coordinate Y orientation inverted
+ * with respect to the normal OpenGL pixel coordinate system).
+ */
+#define BRW_RASTRULE_LOWER_LEFT 2
+#define BRW_RASTRULE_LOWER_RIGHT 3
#define BRW_RENDERTARGET_CLAMPRANGE_UNORM 0
#define BRW_RENDERTARGET_CLAMPRANGE_SNORM 1
diff --git a/src/gallium/drivers/i965simple/brw_tex_layout.c b/src/gallium/drivers/i965simple/brw_tex_layout.c
index c921c0d38be..f44bd17451b 100644
--- a/src/gallium/drivers/i965simple/brw_tex_layout.c
+++ b/src/gallium/drivers/i965simple/brw_tex_layout.c
@@ -363,7 +363,6 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
ps->nblocksy = pt->nblocksy[level];
ps->stride = tex->stride;
ps->offset = offset;
- ps->status = PIPE_SURFACE_STATUS_DEFINED;
}
return ps;
}
diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h
index 97859110b5f..a54820e8512 100644
--- a/src/gallium/drivers/nouveau/nouveau_stateobj.h
+++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h
@@ -46,9 +46,12 @@ static INLINE void
so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso)
{
struct nouveau_stateobj *so = *pso;
+ int i;
if (pipe_reference((struct pipe_reference**)pso, &ref->reference)) {
free(so->push);
+ for (i = 0; i < so->cur_reloc; i++)
+ pipe_buffer_reference(&so->reloc[i].bo, NULL);
free(so->reloc);
free(so);
}
@@ -83,7 +86,8 @@ so_reloc(struct nouveau_stateobj *so, struct pipe_buffer *bo,
{
struct nouveau_stateobj_reloc *r = &so->reloc[so->cur_reloc++];
- r->bo = bo;
+ r->bo = NULL;
+ pipe_buffer_reference(&r->bo, bo);
r->offset = so->cur - so->push;
r->packet = so->cur_packet;
r->data = data;
diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c
index 85dc017fbc4..4da833c25e8 100644
--- a/src/gallium/drivers/nv04/nv04_miptree.c
+++ b/src/gallium/drivers/nv04/nv04_miptree.c
@@ -122,7 +122,6 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ns->base.width = pt->width[level];
ns->base.height = pt->height[level];
ns->base.usage = flags;
- ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
ns->base.level = level;
diff --git a/src/gallium/drivers/nv10/nv10_clear.c b/src/gallium/drivers/nv10/nv10_clear.c
index be7e09cf4b0..a39a2b5f525 100644
--- a/src/gallium/drivers/nv10/nv10_clear.c
+++ b/src/gallium/drivers/nv10/nv10_clear.c
@@ -1,12 +1,14 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
+#include "util/u_clear.h"
#include "nv10_context.h"
void
-nv10_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue)
+nv10_clear(struct pipe_context *pipe, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil)
{
- pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
+ util_clear(pipe, nv10_context(pipe)->framebuffer, buffers, rgba, depth,
+ stencil);
}
diff --git a/src/gallium/drivers/nv10/nv10_context.h b/src/gallium/drivers/nv10/nv10_context.h
index f3b56de25a7..f1e003c9537 100644
--- a/src/gallium/drivers/nv10/nv10_context.h
+++ b/src/gallium/drivers/nv10/nv10_context.h
@@ -118,8 +118,9 @@ extern void nv10_init_surface_functions(struct nv10_context *nv10);
extern void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen);
/* nv10_clear.c */
-extern void nv10_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue);
+extern void nv10_clear(struct pipe_context *pipe, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil);
+
/* nv10_draw.c */
extern struct draw_stage *nv10_draw_render_stage(struct nv10_context *nv10);
diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c
index bb3a1c0f19e..34e3c2ebd77 100644
--- a/src/gallium/drivers/nv10/nv10_miptree.c
+++ b/src/gallium/drivers/nv10/nv10_miptree.c
@@ -136,7 +136,6 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
ns->base.width = pt->width[level];
ns->base.height = pt->height[level];
ns->base.usage = flags;
- ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
ns->base.level = level;
diff --git a/src/gallium/drivers/nv20/nv20_clear.c b/src/gallium/drivers/nv20/nv20_clear.c
index 29f4afd87c9..2b4490fa5e1 100644
--- a/src/gallium/drivers/nv20/nv20_clear.c
+++ b/src/gallium/drivers/nv20/nv20_clear.c
@@ -1,13 +1,14 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
+#include "util/u_clear.h"
#include "nv20_context.h"
void
-nv20_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue)
+nv20_clear(struct pipe_context *pipe, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil)
{
- pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
- ps->status = PIPE_SURFACE_STATUS_CLEAR;
+ util_clear(pipe, nv20_context(pipe)->framebuffer, buffers, rgba, depth,
+ stencil);
}
diff --git a/src/gallium/drivers/nv20/nv20_context.h b/src/gallium/drivers/nv20/nv20_context.h
index 8ad926db20a..fc932f1f90e 100644
--- a/src/gallium/drivers/nv20/nv20_context.h
+++ b/src/gallium/drivers/nv20/nv20_context.h
@@ -118,8 +118,8 @@ extern void nv20_init_surface_functions(struct nv20_context *nv20);
extern void nv20_screen_init_miptree_functions(struct pipe_screen *pscreen);
/* nv20_clear.c */
-extern void nv20_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue);
+extern void nv20_clear(struct pipe_context *pipe, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil);
/* nv20_draw.c */
extern struct draw_stage *nv20_draw_render_stage(struct nv20_context *nv20);
diff --git a/src/gallium/drivers/nv20/nv20_miptree.c b/src/gallium/drivers/nv20/nv20_miptree.c
index b2f29aff8d2..185fbf53e0f 100644
--- a/src/gallium/drivers/nv20/nv20_miptree.c
+++ b/src/gallium/drivers/nv20/nv20_miptree.c
@@ -170,7 +170,6 @@ nv20_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
ns->base.width = pt->width[level];
ns->base.height = pt->height[level];
ns->base.usage = flags;
- ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
ns->base.level = level;
diff --git a/src/gallium/drivers/nv30/nv30_clear.c b/src/gallium/drivers/nv30/nv30_clear.c
index 8c3ca204d58..c4ba9266647 100644
--- a/src/gallium/drivers/nv30/nv30_clear.c
+++ b/src/gallium/drivers/nv30/nv30_clear.c
@@ -1,13 +1,14 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
+#include "util/u_clear.h"
#include "nv30_context.h"
void
-nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue)
+nv30_clear(struct pipe_context *pipe, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil)
{
- pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
- ps->status = PIPE_SURFACE_STATUS_CLEAR;
+ util_clear(pipe, &nv30_context(pipe)->framebuffer, buffers, rgba, depth,
+ stencil);
}
diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h
index b9337697008..4229c0a0e14 100644
--- a/src/gallium/drivers/nv30/nv30_context.h
+++ b/src/gallium/drivers/nv30/nv30_context.h
@@ -206,7 +206,7 @@ extern boolean nv30_draw_elements(struct pipe_context *pipe,
unsigned count);
/* nv30_clear.c */
-extern void nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue);
+extern void nv30_clear(struct pipe_context *pipe, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil);
#endif
diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
index d6dc621c9ee..7f8054de733 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -177,7 +177,6 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ns->base.width = pt->width[level];
ns->base.height = pt->height[level];
ns->base.usage = flags;
- ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
ns->base.level = level;
diff --git a/src/gallium/drivers/nv30/nv30_state_emit.c b/src/gallium/drivers/nv30/nv30_state_emit.c
index f77b08ff695..c18be20a327 100644
--- a/src/gallium/drivers/nv30/nv30_state_emit.c
+++ b/src/gallium/drivers/nv30/nv30_state_emit.c
@@ -21,14 +21,6 @@ static void
nv30_state_do_validate(struct nv30_context *nv30,
struct nv30_state_entry **states)
{
- const struct pipe_framebuffer_state *fb = &nv30->framebuffer;
- unsigned i;
-
- for (i = 0; i < fb->nr_cbufs; i++)
- fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
- if (fb->zsbuf)
- fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-
while (*states) {
struct nv30_state_entry *e = *states;
diff --git a/src/gallium/drivers/nv40/nv40_clear.c b/src/gallium/drivers/nv40/nv40_clear.c
index 59efd620e32..ddf13addf3b 100644
--- a/src/gallium/drivers/nv40/nv40_clear.c
+++ b/src/gallium/drivers/nv40/nv40_clear.c
@@ -1,13 +1,14 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
+#include "util/u_clear.h"
#include "nv40_context.h"
void
-nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue)
+nv40_clear(struct pipe_context *pipe, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil)
{
- pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
- ps->status = PIPE_SURFACE_STATUS_CLEAR;
+ util_clear(pipe, &nv40_context(pipe)->framebuffer, buffers, rgba, depth,
+ stencil);
}
diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h
index adcfbdd85a8..97bc83292d4 100644
--- a/src/gallium/drivers/nv40/nv40_context.h
+++ b/src/gallium/drivers/nv40/nv40_context.h
@@ -227,7 +227,7 @@ extern boolean nv40_draw_elements(struct pipe_context *pipe,
unsigned count);
/* nv40_clear.c */
-extern void nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue);
+extern void nv40_clear(struct pipe_context *pipe, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil);
#endif
diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c
index abadca8c933..5a201ccf458 100644
--- a/src/gallium/drivers/nv40/nv40_miptree.c
+++ b/src/gallium/drivers/nv40/nv40_miptree.c
@@ -176,7 +176,6 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ns->base.width = pt->width[level];
ns->base.height = pt->height[level];
ns->base.usage = flags;
- ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
ns->base.level = level;
diff --git a/src/gallium/drivers/nv40/nv40_state_emit.c b/src/gallium/drivers/nv40/nv40_state_emit.c
index ce859def108..10aae298328 100644
--- a/src/gallium/drivers/nv40/nv40_state_emit.c
+++ b/src/gallium/drivers/nv40/nv40_state_emit.c
@@ -38,14 +38,6 @@ static void
nv40_state_do_validate(struct nv40_context *nv40,
struct nv40_state_entry **states)
{
- const struct pipe_framebuffer_state *fb = &nv40->framebuffer;
- unsigned i;
-
- for (i = 0; i < fb->nr_cbufs; i++)
- fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
- if (fb->zsbuf)
- fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-
while (*states) {
struct nv40_state_entry *e = *states;
diff --git a/src/gallium/drivers/nv50/nv50_clear.c b/src/gallium/drivers/nv50/nv50_clear.c
index f9bc3b53caa..db44a9da0e3 100644
--- a/src/gallium/drivers/nv50/nv50_clear.c
+++ b/src/gallium/drivers/nv50/nv50_clear.c
@@ -86,7 +86,5 @@ nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
pipe->set_framebuffer_state(pipe, &s_fb);
pipe->set_scissor_state(pipe, &s_sc);
nv50->dirty |= dirty;
-
- ps->status = PIPE_SURFACE_STATUS_CLEAR;
}
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index 313e435e7a5..7b67a754397 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -184,8 +184,8 @@ extern boolean nv50_draw_elements(struct pipe_context *pipe,
extern void nv50_vbo_validate(struct nv50_context *nv50);
/* nv50_clear.c */
-extern void nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue);
+extern void nv50_clear(struct pipe_context *pipe, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil);
/* nv50_program.c */
extern void nv50_vertprog_validate(struct nv50_context *nv50);
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index dc4688ccdc4..f79a7ca86c9 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -163,7 +163,6 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ps->width = pt->width[level];
ps->height = pt->height[level];
ps->usage = flags;
- ps->status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ps->reference, 1);
ps->face = face;
ps->level = level;
diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c
index a2c56f99a89..35cebdbdc32 100644
--- a/src/gallium/drivers/nv50/nv50_query.c
+++ b/src/gallium/drivers/nv50/nv50_query.c
@@ -41,7 +41,7 @@ nv50_query(struct pipe_query *pipe)
static struct pipe_query *
nv50_query_create(struct pipe_context *pipe, unsigned type)
{
- struct pipe_screen *screen = pipe->winsys;
+ struct pipe_screen *screen = pipe->screen;
struct nv50_query *q = CALLOC_STRUCT(nv50_query);
assert (q->type == PIPE_QUERY_OCCLUSION_COUNTER);
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 85098a78a25..c13d3de1cb9 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -178,17 +178,10 @@ nv50_state_emit(struct nv50_context *nv50)
boolean
nv50_state_validate(struct nv50_context *nv50)
{
- const struct pipe_framebuffer_state *fb = &nv50->framebuffer;
struct nouveau_grobj *tesla = nv50->screen->tesla;
struct nouveau_stateobj *so;
unsigned i;
- for (i = 0; i < fb->nr_cbufs; i++)
- fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
-
- if (fb->zsbuf)
- fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-
if (nv50->dirty & NV50_NEW_FRAMEBUFFER)
nv50_state_validate_fb(nv50);
@@ -251,7 +244,7 @@ nv50_state_validate(struct nv50_context *nv50)
}
scissor_uptodate:
- if (nv50->dirty & NV50_NEW_VIEWPORT) {
+ if (nv50->dirty & (NV50_NEW_VIEWPORT | NV50_NEW_RASTERIZER)) {
unsigned bypass;
if (!nv50->rasterizer->pipe.bypass_vs_clip_and_viewport)
@@ -288,6 +281,7 @@ scissor_uptodate:
so_ref(so, &nv50->state.viewport);
so_ref(NULL, &so);
+ nv50->state.dirty |= NV50_NEW_VIEWPORT;
}
viewport_uptodate:
diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile
index 0e4e1155325..e44f9b9dfc5 100644
--- a/src/gallium/drivers/r300/Makefile
+++ b/src/gallium/drivers/r300/Makefile
@@ -11,13 +11,14 @@ C_SOURCES = \
r300_emit.c \
r300_flush.c \
r300_query.c \
+ r300_render.c \
r300_screen.c \
r300_state.c \
r300_state_derived.c \
r300_state_invariant.c \
r300_state_shader.c \
+ r300_state_tcl.c \
r300_surface.c \
- r300_swtcl_emit.c \
r300_texture.c
include ../../Makefile.template
diff --git a/src/gallium/drivers/r300/SConscript b/src/gallium/drivers/r300/SConscript
index 18684c3e7f9..182ed2d459a 100644
--- a/src/gallium/drivers/r300/SConscript
+++ b/src/gallium/drivers/r300/SConscript
@@ -3,15 +3,25 @@ Import('*')
env = env.Clone()
r300 = env.ConvenienceLibrary(
- target = 'r300',
- source = [
- 'r300_blit.c',
- 'r300_clear.c',
- 'r300_context.c',
- 'r300_screen.c',
- 'r300_state.c',
- 'r300_surface.c',
- ])
+ target = 'r300',
+ source = [
+ 'r300_chipset.c',
+ 'r300_clear.c',
+ 'r300_context.c',
+ 'r300_debug.c',
+ 'r300_emit.c',
+ 'r300_flush.c',
+ 'r300_query.c',
+ 'r300_render.c',
+ 'r300_screen.c',
+ 'r300_state.c',
+ 'r300_state_derived.c',
+ 'r300_state_invariant.c',
+ 'r300_state_shader.c',
+ 'r300_state_tcl.c',
+ 'r300_surface.c',
+ 'r300_texture.c',
+ ])
Export('r300')
diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c
index e01a0546b22..9d95ad918c2 100644
--- a/src/gallium/drivers/r300/r300_chipset.c
+++ b/src/gallium/drivers/r300/r300_chipset.c
@@ -30,7 +30,7 @@
void r300_parse_chipset(struct r300_capabilities* caps)
{
/* Reasonable defaults */
- caps->has_tcl = getenv("RADEON_NO_TCL") ? TRUE : FALSE;
+ caps->has_tcl = getenv("RADEON_NO_TCL") ? FALSE : TRUE;
caps->is_r500 = FALSE;
caps->num_vert_fpus = 4;
diff --git a/src/gallium/drivers/r300/r300_clear.c b/src/gallium/drivers/r300/r300_clear.c
index fd28437aaa4..8b9cb819ae6 100644
--- a/src/gallium/drivers/r300/r300_clear.c
+++ b/src/gallium/drivers/r300/r300_clear.c
@@ -22,12 +22,14 @@
#include "r300_clear.h"
-/* This gets its own file because Intel's is in its own file.
- * I assume there's a good reason. */
+/* Clears currently bound buffers. */
void r300_clear(struct pipe_context* pipe,
- struct pipe_surface* ps,
- unsigned color)
+ unsigned buffers,
+ const float* rgba,
+ double depth,
+ unsigned stencil)
{
- pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
- ps->status = PIPE_SURFACE_STATUS_DEFINED;
-} \ No newline at end of file
+ /* XXX we can and should do one clear if both color and zs are set */
+ util_clear(pipe, &r300_context(pipe)->framebuffer_state,
+ buffers, rgba, depth, stencil);
+}
diff --git a/src/gallium/drivers/r300/r300_clear.h b/src/gallium/drivers/r300/r300_clear.h
index e24a0690c9b..cd5900565e8 100644
--- a/src/gallium/drivers/r300/r300_clear.h
+++ b/src/gallium/drivers/r300/r300_clear.h
@@ -20,8 +20,17 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#include "pipe/p_context.h"
+#ifndef R300_CLEAR_H
+#define R300_CLEAR_H
+
+#include "util/u_clear.h"
+
+#include "r300_context.h"
void r300_clear(struct pipe_context* pipe,
- struct pipe_surface* ps,
- unsigned color);
+ unsigned buffers,
+ const float* rgba,
+ double depth,
+ unsigned stencil);
+
+#endif /* R300_CLEAR_H */
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index b8584702aad..31efe914171 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -125,7 +125,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->context.draw_range_elements = r300_draw_range_elements;
r300->draw = draw_create();
- draw_set_rasterize_stage(r300->draw, r300_draw_swtcl_stage(r300));
+ draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300));
r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state);
r300->rs_block = CALLOC_STRUCT(r300_rs_block);
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 0e5e471d116..fec2bad5461 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -169,10 +169,7 @@ struct r300_fragment_shader {
int indirections;
/* Indirection node offsets */
- int offset0;
- int offset1;
- int offset2;
- int offset3;
+ int alu_offset[4];
/* Machine instructions */
struct {
@@ -234,6 +231,29 @@ struct r300_vertex_format {
int tab[16];
};
+struct r300_vertex_shader {
+ /* Parent class */
+ struct pipe_shader_state state;
+ struct tgsi_shader_info info;
+
+ /* Fallback shader, because Draw has issues */
+ struct draw_vertex_shader* draw;
+
+ /* Has this shader been translated yet? */
+ boolean translated;
+
+ /* Number of used instructions */
+ int instruction_count;
+
+ /* Machine instructions */
+ struct {
+ uint32_t inst0;
+ uint32_t inst1;
+ uint32_t inst2;
+ uint32_t inst3;
+ } instructions[128]; /*< XXX magic number */
+};
+
struct r300_context {
/* Parent class */
struct pipe_context context;
@@ -273,6 +293,8 @@ struct r300_context {
int vertex_buffer_count;
/* Vertex information. */
struct r300_vertex_format vertex_info;
+ /* Vertex shader. */
+ struct r300_vertex_shader* vs;
/* Viewport state. */
struct r300_viewport_state* viewport_state;
/* Bitmask of dirty state objects. */
@@ -287,7 +309,7 @@ static struct r300_context* r300_context(struct pipe_context* context) {
}
/* Context initialization. */
-struct draw_stage* r300_draw_swtcl_stage(struct r300_context* r300);
+struct draw_stage* r300_draw_stage(struct r300_context* r300);
void r300_init_state_functions(struct r300_context* r300);
void r300_init_surface_functions(struct r300_context* r300);
diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h
index 9913678d272..5d9799dd723 100644
--- a/src/gallium/drivers/r300/r300_cs.h
+++ b/src/gallium/drivers/r300/r300_cs.h
@@ -132,4 +132,14 @@
OUT_CS(CP_PACKET3(op, count)); \
} while (0)
+#define OUT_CS_INDEX_RELOC(bo, offset, count, rd, wd, flags) do { \
+ debug_printf("r300: writing relocation for index buffer %p," \
+ "offset %d\n", bo, offset); \
+ assert(bo); \
+ OUT_CS(offset); \
+ OUT_CS(count); \
+ cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \
+ cs_count -= 2; \
+} while (0)
+
#endif /* R300_CS_H */
diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c
index f657588c720..dd63136c9d6 100644
--- a/src/gallium/drivers/r300/r300_debug.c
+++ b/src/gallium/drivers/r300/r300_debug.c
@@ -22,6 +22,14 @@
#include "r300_debug.h"
+static void r300_dump_fs(struct r300_fragment_shader* fs)
+{
+ int i;
+
+ for (i = 0; i < fs->alu_instruction_count; i++) {
+ }
+}
+
static char* r500_fs_swiz[] = {
" R",
" G",
@@ -216,3 +224,15 @@ void r500_fs_dump(struct r500_fragment_shader* fs)
}
}
}
+
+void r300_vs_dump(struct r300_vertex_shader* vs)
+{
+ int i;
+
+ for (i = 0; i < vs->instruction_count; i++) {
+ debug_printf("inst0: 0x%x\n", vs->instructions[i].inst0);
+ debug_printf("inst1: 0x%x\n", vs->instructions[i].inst1);
+ debug_printf("inst2: 0x%x\n", vs->instructions[i].inst2);
+ debug_printf("inst3: 0x%x\n", vs->instructions[i].inst3);
+ }
+}
diff --git a/src/gallium/drivers/r300/r300_debug.h b/src/gallium/drivers/r300/r300_debug.h
index de5d701ed9c..a1f873656dc 100644
--- a/src/gallium/drivers/r300/r300_debug.h
+++ b/src/gallium/drivers/r300/r300_debug.h
@@ -25,7 +25,10 @@
#include "r300_reg.h"
#include "r300_state_shader.h"
+#include "r300_state_tcl.h"
void r500_fs_dump(struct r500_fragment_shader* fs);
+void r300_vs_dump(struct r300_vertex_shader* vs);
+
#endif /* R300_DEBUG_H */
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 9bfb89626cd..a3d83376b66 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -82,20 +82,20 @@ void r300_emit_dsa_state(struct r300_context* r300,
void r300_emit_fragment_shader(struct r300_context* r300,
struct r300_fragment_shader* fs)
{
- CS_LOCALS(r300);
int i;
+ CS_LOCALS(r300);
BEGIN_CS(22);
- OUT_CS_REG(R300_US_CONFIG, MAX2(fs->indirections - 1, 0));
+ OUT_CS_REG(R300_US_CONFIG, fs->indirections);
OUT_CS_REG(R300_US_PIXSIZE, fs->shader.stack_size);
/* XXX figure out exactly how big the sizes are on this reg */
- OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
+ OUT_CS_REG(R300_US_CODE_OFFSET, 0x40);
/* XXX figure these ones out a bit better kthnx */
OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0);
OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0);
OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0);
- OUT_CS_REG(R300_US_CODE_ADDR_3, R300_RGBA_OUT);
+ OUT_CS_REG(R300_US_CODE_ADDR_3, 0x40 | R300_RGBA_OUT);
for (i = 0; i < fs->alu_instruction_count; i++) {
OUT_CS_REG(R300_US_ALU_RGB_INST_0 + (4 * i),
@@ -114,10 +114,10 @@ void r300_emit_fragment_shader(struct r300_context* r300,
void r500_emit_fragment_shader(struct r300_context* r300,
struct r500_fragment_shader* fs)
{
- CS_LOCALS(r300);
+ int i;
struct r300_constant_buffer* constants =
&r300->shader_constants[PIPE_SHADER_FRAGMENT];
- int i;
+ CS_LOCALS(r300);
BEGIN_CS(9 + (fs->instruction_count * 6) + (constants->count ? 3 : 0) +
(constants->count * 4));
@@ -156,9 +156,9 @@ void r500_emit_fragment_shader(struct r300_context* r300,
void r300_emit_fb_state(struct r300_context* r300,
struct pipe_framebuffer_state* fb)
{
- CS_LOCALS(r300);
- struct r300_texture* tex;
int i;
+ struct r300_texture* tex;
+ CS_LOCALS(r300);
BEGIN_CS((6 * fb->nr_cbufs) + (fb->zsbuf ? 6 : 0) + 4);
for (i = 0; i < fb->nr_cbufs; i++) {
@@ -217,9 +217,9 @@ void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs)
void r300_emit_rs_block_state(struct r300_context* r300,
struct r300_rs_block* rs)
{
+ int i;
struct r300_screen* r300screen = r300_screen(r300->context.screen);
CS_LOCALS(r300);
- int i;
BEGIN_CS(21);
if (r300screen->caps->is_r500) {
@@ -293,8 +293,8 @@ void r300_emit_texture(struct r300_context* r300,
void r300_emit_vertex_format_state(struct r300_context* r300)
{
- CS_LOCALS(r300);
int i;
+ CS_LOCALS(r300);
BEGIN_CS(26);
OUT_CS_REG(R300_VAP_VTX_SIZE, r300->vertex_info.vinfo.size);
@@ -325,25 +325,80 @@ void r300_emit_vertex_format_state(struct r300_context* r300)
END_CS;
}
+void r300_emit_vertex_shader(struct r300_context* r300,
+ struct r300_vertex_shader* vs)
+{
+ int i;
+ struct r300_screen* r300screen = r300_screen(r300->context.screen);
+ struct r300_constant_buffer* constants =
+ &r300->shader_constants[PIPE_SHADER_VERTEX];
+ CS_LOCALS(r300);
+
+ if (!r300screen->caps->has_tcl) {
+ debug_printf("r300: Implementation error: emit_vertex_shader called,"
+ " but has_tcl is FALSE!\n");
+ return;
+ }
+
+ BEGIN_CS(13 + (vs->instruction_count * 4) + (constants->count * 4));
+
+ OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, R300_PVS_FIRST_INST(0) |
+ R300_PVS_LAST_INST(vs->instruction_count - 1));
+ OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, vs->instruction_count - 1);
+
+ /* XXX */
+ OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x0);
+
+ OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0);
+ OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, vs->instruction_count * 4);
+ for (i = 0; i < vs->instruction_count; i++) {
+ OUT_CS(vs->instructions[i].inst0);
+ OUT_CS(vs->instructions[i].inst1);
+ OUT_CS(vs->instructions[i].inst2);
+ OUT_CS(vs->instructions[i].inst3);
+ }
+
+ if (constants->count) {
+ OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG,
+ (r300screen->caps->is_r500 ?
+ R500_PVS_CONST_START : R300_PVS_CONST_START));
+ OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, constants->count * 4);
+ for (i = 0; i < constants->count; i++) {
+ OUT_CS_32F(constants->constants[i][0]);
+ OUT_CS_32F(constants->constants[i][1]);
+ OUT_CS_32F(constants->constants[i][2]);
+ OUT_CS_32F(constants->constants[i][3]);
+ }
+ }
+
+ OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(10) |
+ R300_PVS_NUM_CNTLRS(5) |
+ R300_PVS_NUM_FPUS(r300screen->caps->num_vert_fpus) |
+ R300_PVS_VF_MAX_VTX_NUM(12));
+ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
+ END_CS;
+
+}
+
void r300_emit_viewport_state(struct r300_context* r300,
struct r300_viewport_state* viewport)
{
- return;
CS_LOCALS(r300);
- BEGIN_CS(7);
- OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 7);
+ BEGIN_CS(9);
+ OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
OUT_CS_32F(viewport->xscale);
OUT_CS_32F(viewport->xoffset);
OUT_CS_32F(viewport->yscale);
OUT_CS_32F(viewport->yoffset);
OUT_CS_32F(viewport->zscale);
OUT_CS_32F(viewport->zoffset);
- OUT_CS(viewport->vte_control);
+
+ OUT_CS_REG(R300_VAP_VTE_CNTL, viewport->vte_control);
END_CS;
}
-static void r300_flush_textures(struct r300_context* r300)
+void r300_flush_textures(struct r300_context* r300)
{
CS_LOCALS(r300);
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index 0bc1f90e6ab..31dbc7ab853 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -64,9 +64,14 @@ void r300_emit_texture(struct r300_context* r300,
void r300_emit_vertex_format_state(struct r300_context* r300);
+void r300_emit_vertex_shader(struct r300_context* r300,
+ struct r300_vertex_shader* vs);
+
void r300_emit_viewport_state(struct r300_context* r300,
struct r300_viewport_state* viewport);
+void r300_flush_textures(struct r300_context* r300);
+
/* Emit all dirty state. */
void r300_emit_dirty_state(struct r300_context* r300);
diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
index 5f5f4c4dbd4..8fc61c2dec7 100644
--- a/src/gallium/drivers/r300/r300_query.c
+++ b/src/gallium/drivers/r300/r300_query.c
@@ -46,12 +46,12 @@ static void r300_destroy_query(struct pipe_context* pipe,
static void r300_begin_query(struct pipe_context* pipe,
struct pipe_query* query)
{
+ uint32_t* map;
struct r300_context* r300 = r300_context(pipe);
struct r300_query* q = (struct r300_query*)query;
CS_LOCALS(r300);
- uint32_t* map = pipe_buffer_map(pipe->screen, q->buf,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ map = pipe_buffer_map(pipe->screen, q->buf, PIPE_BUFFER_USAGE_CPU_WRITE);
*map = ~0;
pipe_buffer_unmap(pipe->screen, q->buf);
@@ -79,6 +79,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
uint64_t* result)
{
struct r300_query* q = (struct r300_query*)query;
+ uint32_t* map;
uint32_t temp;
if (wait) {
@@ -88,8 +89,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
pipe->flush(pipe, 0, NULL);
}
- uint32_t* map = pipe_buffer_map(pipe->screen, q->buf,
- PIPE_BUFFER_USAGE_CPU_READ);
+ map = pipe_buffer_map(pipe->screen, q->buf, PIPE_BUFFER_USAGE_CPU_READ);
temp = *map;
pipe_buffer_unmap(pipe->screen, q->buf);
diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
index 3fe45e13932..660816e1da1 100644
--- a/src/gallium/drivers/r300/r300_reg.h
+++ b/src/gallium/drivers/r300/r300_reg.h
@@ -73,6 +73,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_PVS_NUM_CNTLRS_SHIFT 4
# define R300_PVS_NUM_FPUS_SHIFT 8
# define R300_VF_MAX_VTX_NUM_SHIFT 18
+# define R300_PVS_NUM_SLOTS(x) ((x) << 0)
+# define R300_PVS_NUM_CNTLRS(x) ((x) << 4)
+# define R300_PVS_NUM_FPUS(x) ((x) << 8)
+# define R300_PVS_VF_MAX_VTX_NUM(x) ((x) << 18)
# define R300_GL_CLIP_SPACE_DEF (0 << 22)
# define R300_DX_CLIP_SPACE_DEF (1 << 22)
# define R500_TCL_STATE_OPTIMIZATION (1 << 23)
@@ -506,6 +510,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_PVS_FIRST_INST_SHIFT 0
# define R300_PVS_XYZW_VALID_INST_SHIFT 10
# define R300_PVS_LAST_INST_SHIFT 20
+# define R300_PVS_FIRST_INST(x) ((x) << 0)
+# define R300_PVS_LAST_INST(x) ((x) << 20)
/* Addresses are relative the the vertex program parameters area. */
#define R300_VAP_PVS_CONST_CNTL 0x22D4
# define R300_PVS_CONST_BASE_OFFSET_SHIFT 0
@@ -1191,6 +1197,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_RS_INST_COUNT_MASK 0x0000000f
# define R300_RS_TX_OFFSET_SHIFT 5
# define R300_RS_TX_OFFSET_MASK 0x000000e0
+# define R300_RS_TX_OFFSET(x) ((x) << 5)
/* gap */
@@ -1434,6 +1441,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_TX_MAX_ANISO_8_TO_1 (3 << 21)
# define R300_TX_MAX_ANISO_16_TO_1 (4 << 21)
# define R300_TX_MAX_ANISO_MASK (7 << 21)
+# define R300_TX_WRAP_S(x) ((x) << 0)
+# define R300_TX_WRAP_T(x) ((x) << 3)
#define R300_TX_FILTER1_0 0x4440
# define R300_CHROMA_KEY_MODE_DISABLE 0
diff --git a/src/gallium/drivers/r300/r300_swtcl_emit.c b/src/gallium/drivers/r300/r300_render.c
index 83c25f496bf..b7ee8fb8a94 100644
--- a/src/gallium/drivers/r300/r300_swtcl_emit.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
+ * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -29,9 +29,9 @@
#include "r300_reg.h"
#include "r300_state_derived.h"
-/* r300_swtcl_emit: Vertex and index buffer primitive emission. No HW TCL. */
+/* r300_render: Vertex and index buffer primitive emission. */
-struct r300_swtcl_render {
+struct r300_render {
/* Parent class */
struct vbuf_render base;
@@ -52,16 +52,16 @@ struct r300_swtcl_render {
size_t vbo_max_used;
};
-static INLINE struct r300_swtcl_render*
-r300_swtcl_render(struct vbuf_render* render)
+static INLINE struct r300_render*
+r300_render(struct vbuf_render* render)
{
- return (struct r300_swtcl_render*)render;
+ return (struct r300_render*)render;
}
static const struct vertex_info*
-r300_swtcl_render_get_vertex_info(struct vbuf_render* render)
+r300_render_get_vertex_info(struct vbuf_render* render)
{
- struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+ struct r300_render* r300render = r300_render(render);
struct r300_context* r300 = r300render->r300;
r300_update_derived_state(r300);
@@ -69,11 +69,11 @@ r300_swtcl_render_get_vertex_info(struct vbuf_render* render)
return &r300->vertex_info.vinfo;
}
-static boolean r300_swtcl_render_allocate_vertices(struct vbuf_render* render,
+static boolean r300_render_allocate_vertices(struct vbuf_render* render,
ushort vertex_size,
ushort count)
{
- struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+ struct r300_render* r300render = r300_render(render);
struct r300_context* r300 = r300render->r300;
struct pipe_screen* screen = r300->context.screen;
size_t size = (size_t)vertex_size * (size_t)count;
@@ -98,9 +98,9 @@ static boolean r300_swtcl_render_allocate_vertices(struct vbuf_render* render,
}
}
-static void* r300_swtcl_render_map_vertices(struct vbuf_render* render)
+static void* r300_render_map_vertices(struct vbuf_render* render)
{
- struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+ struct r300_render* r300render = r300_render(render);
struct pipe_screen* screen = r300render->r300->context.screen;
r300render->vbo_map = pipe_buffer_map(screen, r300render->vbo,
@@ -109,11 +109,11 @@ static void* r300_swtcl_render_map_vertices(struct vbuf_render* render)
return (unsigned char*)r300render->vbo_map + r300render->vbo_offset;
}
-static void r300_swtcl_render_unmap_vertices(struct vbuf_render* render,
+static void r300_render_unmap_vertices(struct vbuf_render* render,
ushort min,
ushort max)
{
- struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+ struct r300_render* r300render = r300_render(render);
struct pipe_screen* screen = r300render->r300->context.screen;
r300render->vbo_max_used = MAX2(r300render->vbo_max_used,
@@ -122,17 +122,17 @@ static void r300_swtcl_render_unmap_vertices(struct vbuf_render* render,
pipe_buffer_unmap(screen, r300render->vbo);
}
-static void r300_swtcl_render_release_vertices(struct vbuf_render* render)
+static void r300_render_release_vertices(struct vbuf_render* render)
{
- struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+ struct r300_render* r300render = r300_render(render);
pipe_buffer_reference(&r300render->vbo, NULL);
}
-static boolean r300_swtcl_render_set_primitive(struct vbuf_render* render,
+static boolean r300_render_set_primitive(struct vbuf_render* render,
unsigned prim)
{
- struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+ struct r300_render* r300render = r300_render(render);
r300render->prim = prim;
switch (prim) {
@@ -174,7 +174,7 @@ static boolean r300_swtcl_render_set_primitive(struct vbuf_render* render,
return TRUE;
}
-static void prepare_render(struct r300_swtcl_render* render, unsigned count)
+static void prepare_render(struct r300_render* render, unsigned count)
{
struct r300_context* r300 = render->r300;
@@ -203,11 +203,11 @@ static void prepare_render(struct r300_swtcl_render* render, unsigned count)
END_CS;
}
-static void r300_swtcl_render_draw_arrays(struct vbuf_render* render,
+static void r300_render_draw_arrays(struct vbuf_render* render,
unsigned start,
unsigned count)
{
- struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+ struct r300_render* r300render = r300_render(render);
struct r300_context* r300 = r300render->r300;
CS_LOCALS(r300);
@@ -225,11 +225,11 @@ static void r300_swtcl_render_draw_arrays(struct vbuf_render* render,
END_CS;
}
-static void r300_swtcl_render_draw(struct vbuf_render* render,
+static void r300_render_draw(struct vbuf_render* render,
const ushort* indices,
uint count)
{
- struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+ struct r300_render* r300render = r300_render(render);
struct r300_context* r300 = r300render->r300;
struct pipe_screen* screen = r300->context.screen;
struct pipe_buffer* index_buffer;
@@ -241,7 +241,7 @@ static void r300_swtcl_render_draw(struct vbuf_render* render,
/* Send our indices into an index buffer. */
index_buffer = pipe_buffer_create(screen, 64, PIPE_BUFFER_USAGE_VERTEX,
- count);
+ count * 2);
if (!index_buffer) {
return;
}
@@ -253,25 +253,24 @@ static void r300_swtcl_render_draw(struct vbuf_render* render,
debug_printf("r300: Doing indexbuf render, count %d\n", count);
- BEGIN_CS(5);
+ BEGIN_CS(6);
OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0);
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) |
- r300render->hwprim | R300_VAP_VF_CNTL__INDEX_SIZE_32bit);
-
+ r300render->hwprim);
OUT_CS_PKT3(R300_PACKET3_INDX_BUFFER, 2);
OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2));
- OUT_CS_RELOC(index_buffer, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
+ OUT_CS_INDEX_RELOC(index_buffer, 0, count, RADEON_GEM_DOMAIN_GTT, 0, 0);
END_CS;
}
-static void r300_swtcl_render_destroy(struct vbuf_render* render)
+static void r300_render_destroy(struct vbuf_render* render)
{
FREE(render);
}
-static struct vbuf_render* r300_swtcl_render_create(struct r300_context* r300)
+static struct vbuf_render* r300_render_create(struct r300_context* r300)
{
- struct r300_swtcl_render* r300render = CALLOC_STRUCT(r300_swtcl_render);
+ struct r300_render* r300render = CALLOC_STRUCT(r300_render);
r300render->r300 = r300;
@@ -279,25 +278,25 @@ static struct vbuf_render* r300_swtcl_render_create(struct r300_context* r300)
r300render->base.max_vertex_buffer_bytes = 128 * 1024;
r300render->base.max_indices = 16 * 1024;
- r300render->base.get_vertex_info = r300_swtcl_render_get_vertex_info;
- r300render->base.allocate_vertices = r300_swtcl_render_allocate_vertices;
- r300render->base.map_vertices = r300_swtcl_render_map_vertices;
- r300render->base.unmap_vertices = r300_swtcl_render_unmap_vertices;
- r300render->base.set_primitive = r300_swtcl_render_set_primitive;
- r300render->base.draw = r300_swtcl_render_draw;
- r300render->base.draw_arrays = r300_swtcl_render_draw_arrays;
- r300render->base.release_vertices = r300_swtcl_render_release_vertices;
- r300render->base.destroy = r300_swtcl_render_destroy;
+ r300render->base.get_vertex_info = r300_render_get_vertex_info;
+ r300render->base.allocate_vertices = r300_render_allocate_vertices;
+ r300render->base.map_vertices = r300_render_map_vertices;
+ r300render->base.unmap_vertices = r300_render_unmap_vertices;
+ r300render->base.set_primitive = r300_render_set_primitive;
+ r300render->base.draw = r300_render_draw;
+ r300render->base.draw_arrays = r300_render_draw_arrays;
+ r300render->base.release_vertices = r300_render_release_vertices;
+ r300render->base.destroy = r300_render_destroy;
return &r300render->base;
}
-struct draw_stage* r300_draw_swtcl_stage(struct r300_context* r300)
+struct draw_stage* r300_draw_stage(struct r300_context* r300)
{
struct vbuf_render* render;
struct draw_stage* stage;
- render = r300_swtcl_render_create(r300);
+ render = r300_render_create(r300);
if (!render) {
return NULL;
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 2a026e7fcac..2a77fd17390 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -132,6 +132,7 @@ static void
const struct pipe_constant_buffer* buffer)
{
struct r300_context* r300 = r300_context(pipe);
+ int i = r300->shader_constants[shader].user_count;
/* This entire chunk of code seems ever-so-slightly baked.
* It's as if I've got pipe_buffer* matryoshkas... */
@@ -149,6 +150,17 @@ static void
}
r300->dirty_state |= R300_NEW_CONSTANTS;
+
+ /* If the number of constants have changed, invalidate the shader. */
+ if (r300->shader_constants[shader].user_count != i) {
+ if (shader == PIPE_SHADER_FRAGMENT && r300->fs) {
+ r300->fs->translated = FALSE;
+ r300_translate_fragment_shader(r300, r300->fs);
+ } else if (shader == PIPE_SHADER_VERTEX && r300->vs) {
+ r300->vs->translated = FALSE;
+ r300_translate_vertex_shader(r300, r300->vs);
+ }
+ }
}
/* Create a new depth, stencil, and alpha state based on the CSO dsa state.
@@ -293,11 +305,7 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader)
r300->fs = NULL;
return;
} else if (!fs->translated) {
- if (r300_screen(r300->context.screen)->caps->is_r500) {
- r500_translate_fragment_shader(r300, (struct r500_fragment_shader*)fs);
- } else {
- r300_translate_fragment_shader(r300, (struct r300_fragment_shader*)fs);
- }
+ r300_translate_fragment_shader(r300, fs);
}
fs->translated = TRUE;
@@ -330,9 +338,18 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
{
struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state);
- /* XXX this is part of HW TCL */
- /* XXX endian control */
- rs->vap_control_status = R300_VAP_TCL_BYPASS;
+ /* Copy rasterizer state for Draw. */
+ rs->rs = *state;
+
+ /* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL.
+ * Else, enable HW TCL and force Draw's TCL off. */
+ if (state->bypass_vs_clip_and_viewport ||
+ !r300_screen(pipe->screen)->caps->has_tcl) {
+ rs->vap_control_status = R300_VAP_TCL_BYPASS;
+ } else {
+ rs->rs.bypass_vs_clip_and_viewport = TRUE;
+ rs->vap_control_status = 0;
+ }
rs->point_size = pack_float_16_6x(state->point_size) |
(pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT);
@@ -395,8 +412,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
rs->color_control = R300_SHADE_MODEL_SMOOTH;
}
- rs->rs = *state;
-
return (void*)rs;
}
@@ -581,30 +596,68 @@ static void r300_set_vertex_elements(struct pipe_context* pipe,
const struct pipe_vertex_element* elements)
{
struct r300_context* r300 = r300_context(pipe);
- /* XXX Draw */
+
draw_flush(r300->draw);
draw_set_vertex_elements(r300->draw, count, elements);
}
static void* r300_create_vs_state(struct pipe_context* pipe,
- const struct pipe_shader_state* state)
+ const struct pipe_shader_state* shader)
{
- struct r300_context* context = r300_context(pipe);
- /* XXX handing this off to Draw for now */
- return draw_create_vertex_shader(context->draw, state);
+ struct r300_context* r300 = r300_context(pipe);
+
+ if (r300_screen(pipe->screen)->caps->has_tcl) {
+ struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader);
+ /* Copy state directly into shader. */
+ vs->state = *shader;
+
+ tgsi_scan_shader(shader->tokens, &vs->info);
+
+ /* Appease Draw. */
+ vs->draw = draw_create_vertex_shader(r300->draw, shader);
+
+ return (void*)vs;
+ } else {
+ return draw_create_vertex_shader(r300->draw, shader);
+ }
}
-static void r300_bind_vs_state(struct pipe_context* pipe, void* state) {
- struct r300_context* context = r300_context(pipe);
- /* XXX handing this off to Draw for now */
- draw_bind_vertex_shader(context->draw, (struct draw_vertex_shader*)state);
+static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
+{
+ struct r300_context* r300 = r300_context(pipe);
+
+ if (r300_screen(pipe->screen)->caps->has_tcl) {
+ struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
+
+ if (vs == NULL) {
+ r300->vs = NULL;
+ return;
+ } else if (!vs->translated) {
+ r300_translate_vertex_shader(r300, vs);
+ }
+
+ draw_bind_vertex_shader(r300->draw, vs->draw);
+ r300->vs = vs;
+ r300->dirty_state |= R300_NEW_VERTEX_SHADER;
+ } else {
+ draw_bind_vertex_shader(r300->draw,
+ (struct draw_vertex_shader*)shader);
+ }
}
-static void r300_delete_vs_state(struct pipe_context* pipe, void* state)
+static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
{
- struct r300_context* context = r300_context(pipe);
- /* XXX handing this off to Draw for now */
- draw_delete_vertex_shader(context->draw, (struct draw_vertex_shader*)state);
+ struct r300_context* r300 = r300_context(pipe);
+
+ if (r300_screen(pipe->screen)->caps->has_tcl) {
+ struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
+
+ draw_delete_vertex_shader(r300->draw, vs->draw);
+ FREE(shader);
+ } else {
+ draw_delete_vertex_shader(r300->draw,
+ (struct draw_vertex_shader*)shader);
+ }
}
void r300_init_state_functions(struct r300_context* r300)
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index d761a0302f0..f1feafbcf91 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -30,9 +30,9 @@
* The vertex_info struct describes the post-TCL format of vertices. It is
* required for Draw when doing SW TCL, and also for describing the
* dreaded RS block on R300 chipsets. */
-/* XXX this function should be able to handle vert shaders as well as draw */
static void r300_update_vertex_layout(struct r300_context* r300)
{
+ struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct r300_vertex_format vformat;
struct vertex_info vinfo;
boolean pos = FALSE, psize = FALSE, fog = FALSE;
@@ -74,6 +74,13 @@ static void r300_update_vertex_layout(struct r300_context* r300)
}
}
+ if (r300screen->caps->has_tcl) {
+ for (i = 0; i < info->num_inputs; i++) {
+ /* XXX should probably do real lookup with vert shader */
+ tab[i] = i;
+ }
+ }
+
/* Do the actual vertex_info setup.
*
* vertex_info has four uints of hardware-specific data in it.
@@ -211,7 +218,6 @@ static void r300_update_rs_block(struct r300_context* r300)
rs->ip[0] |= R500_RS_COL_FMT(R300_RS_COL_FMT_0001);
}
- /* Set up at least one texture pointer or RS will not be happy. */
if (tex_count == 0) {
rs->ip[0] |=
R500_RS_SEL_S(R500_RS_IP_PTR_K0) |
@@ -220,15 +226,20 @@ static void r300_update_rs_block(struct r300_context* r300)
R500_RS_SEL_Q(R500_RS_IP_PTR_K1);
}
+ /* Rasterize at least one color, or bad things happen. */
+ if ((col_count == 0) && (tex_count == 0)) {
+ col_count++;
+ }
+
for (i = 0; i < tex_count; i++) {
- rs->inst[i] |= R500_RS_INST_TEX_ID(i) | R500_RS_INST_TEX_CN_WRITE |
- R500_RS_INST_TEX_ADDR(fp_offset);
+ rs->inst[i] |= R500_RS_INST_TEX_ID(i) |
+ R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_offset);
fp_offset++;
}
for (i = 0; i < col_count; i++) {
- rs->inst[i] |= R500_RS_INST_COL_ID(i) | R500_RS_INST_COL_CN_WRITE |
- R500_RS_INST_COL_ADDR(fp_offset);
+ rs->inst[i] |= R500_RS_INST_COL_ID(i) |
+ R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(fp_offset);
fp_offset++;
}
} else {
@@ -268,15 +279,20 @@ static void r300_update_rs_block(struct r300_context* r300)
R300_RS_SEL_Q(R300_RS_SEL_K1);
}
+ /* Rasterize at least one color, or bad things happen. */
+ if ((col_count == 0) && (tex_count == 0)) {
+ col_count++;
+ }
+
for (i = 0; i < tex_count; i++) {
- rs->inst[i] |= R300_RS_INST_TEX_ID(i) | R300_RS_INST_TEX_CN_WRITE |
- R300_RS_INST_TEX_ADDR(fp_offset);
+ rs->inst[i] |= R300_RS_INST_TEX_ID(i) |
+ R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_offset);
fp_offset++;
}
for (i = 0; i < col_count; i++) {
- rs->inst[i] |= R300_RS_INST_COL_ID(i) | R300_RS_INST_COL_CN_WRITE |
- R300_RS_INST_COL_ADDR(fp_offset);
+ rs->inst[i] |= R300_RS_INST_COL_ID(i) |
+ R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_offset);
fp_offset++;
}
}
@@ -289,7 +305,8 @@ static void r300_update_rs_block(struct r300_context* r300)
void r300_update_derived_state(struct r300_context* r300)
{
- if (r300->dirty_state & R300_NEW_FRAGMENT_SHADER) {
+ if (r300->dirty_state &
+ (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) {
r300_update_vertex_layout(r300);
}
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
index b80ff1c1aba..91b93fc367e 100644
--- a/src/gallium/drivers/r300/r300_state_inlines.h
+++ b/src/gallium/drivers/r300/r300_state_inlines.h
@@ -292,6 +292,7 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
return R300_COLOR_FORMAT_ARGB4444;
/* 32-bit buffers */
case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_Z24S8_UNORM:
return R300_COLOR_FORMAT_ARGB8888;
/* XXX Not in pipe_format
case PIPE_FORMAT_A32R32G32B32:
@@ -337,6 +338,7 @@ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format)
{
switch (format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_Z24S8_UNORM:
return R300_US_OUT_FMT_C4_8 |
R300_C0_SEL_B | R300_C1_SEL_G |
R300_C2_SEL_R | R300_C3_SEL_A;
diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c
index e1837b63801..8bd9b41bd74 100644
--- a/src/gallium/drivers/r300/r300_state_invariant.c
+++ b/src/gallium/drivers/r300/r300_state_invariant.c
@@ -86,7 +86,7 @@ void r300_emit_invariant_state(struct r300_context* r300)
END_CS;
/* XXX unsorted stuff from surface_fill */
- BEGIN_CS(91 + (caps->has_tcl ? 26 : 0));
+ BEGIN_CS(79 + (caps->has_tcl ? 7 : 0));
/* Flush PVS. */
OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
@@ -141,28 +141,11 @@ void r300_emit_invariant_state(struct r300_context* r300)
OUT_CS_REG(R300_ZB_DEPTHCLEARVALUE, 0x00000000);
OUT_CS_REG(R300_ZB_HIZ_OFFSET, 0x00000000);
OUT_CS_REG(R300_ZB_HIZ_PITCH, 0x00000000);
- if (caps->has_tcl) {
- OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
- (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
- ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) |
- R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
- } else {
- OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
- (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
- ((R300_LAST_VEC | (2 << R300_DST_VEC_LOC_SHIFT) |
- R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
- }
- OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0,
- (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE0_SHIFT) |
- (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE1_SHIFT));
OUT_CS_REG(R300_VAP_VTX_STATE_CNTL, 0x1);
OUT_CS_REG(R300_VAP_VSM_VTX_ASSM, 0x405);
OUT_CS_REG(R300_SE_VTE_CNTL, 0x0000043F);
/* Vertex size. */
OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
- OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0, 0x00000003);
- OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x00000000);
- OUT_CS_REG(R300_TX_ENABLE, 0x0);
/* XXX */
OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa);
@@ -173,33 +156,5 @@ void r300_emit_invariant_state(struct r300_context* r300)
OUT_CS(R300_US_OUT_FMT_UNUSED);
OUT_CS(R300_US_OUT_FMT_UNUSED);
OUT_CS_REG(R300_US_W_FMT, R300_W_FMT_W0);
- /* XXX these magic numbers should be explained when
- * this becomes a cached state object */
- if (caps->has_tcl) {
- OUT_CS_REG(R300_VAP_CNTL, 0xA |
- (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) |
- (0xB << R300_VF_MAX_VTX_NUM_SHIFT) |
- (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT));
- OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, 0x00100000);
- OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x00000000);
- OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, 0x00000001);
- /* XXX translate these back into normal instructions */
- OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x1);
- OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0x0);
- OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, 8);
- OUT_CS(0x00F00203);
- OUT_CS(0x00D10001);
- OUT_CS(0x01248001);
- OUT_CS(0x00000000);
- OUT_CS(0x00F02203);
- OUT_CS(0x00D10021);
- OUT_CS(0x01248021);
- OUT_CS(0x00000000);
- } else {
- OUT_CS_REG(R300_VAP_CNTL, 0xA |
- (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) |
- (0x5 << R300_VF_MAX_VTX_NUM_SHIFT) |
- (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT));
- }
END_CS;
}
diff --git a/src/gallium/drivers/r300/r300_state_invariant.h b/src/gallium/drivers/r300/r300_state_invariant.h
index 8204bf9588b..5bea6779fe5 100644
--- a/src/gallium/drivers/r300/r300_state_invariant.h
+++ b/src/gallium/drivers/r300/r300_state_invariant.h
@@ -23,6 +23,7 @@
#ifndef R300_STATE_INVARIANT_H
#define R300_STATE_INVARIANT_H
+#include "r300_chipset.h"
#include "r300_context.h"
#include "r300_cs.h"
#include "r300_reg.h"
diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c
index 20b83bd15b1..1b02239ee76 100644
--- a/src/gallium/drivers/r300/r300_state_shader.c
+++ b/src/gallium/drivers/r300/r300_state_shader.c
@@ -171,6 +171,26 @@ static INLINE uint32_t r500_alpha_swiz(struct tgsi_full_src_register* reg)
(reg->SrcRegisterExtMod.Absolute ? (1 << 10) : 0);
}
+static INLINE uint32_t r300_rgb_op(unsigned op)
+{
+ switch (op) {
+ case TGSI_OPCODE_MOV:
+ return R300_ALU_OUTC_CMP;
+ default:
+ return 0;
+ }
+}
+
+static INLINE uint32_t r300_alpha_op(unsigned op)
+{
+ switch (op) {
+ case TGSI_OPCODE_MOV:
+ return R300_ALU_OUTA_CMP;
+ default:
+ return 0;
+ }
+}
+
static INLINE uint32_t r500_rgba_op(unsigned op)
{
switch (op) {
@@ -249,6 +269,31 @@ static INLINE uint32_t r500_tex_op(unsigned op)
}
}
+static INLINE void r300_emit_maths(struct r300_fragment_shader* fs,
+ struct r300_fs_asm* assembler,
+ struct tgsi_full_src_register* src,
+ struct tgsi_full_dst_register* dst,
+ unsigned op,
+ unsigned count)
+{
+ int i = fs->alu_instruction_count;
+
+ fs->instructions[i].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) |
+ R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) |
+ R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) |
+ r300_rgb_op(op);
+ fs->instructions[i].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) |
+ R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ;
+ fs->instructions[i].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) |
+ R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) |
+ R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) |
+ r300_alpha_op(op);
+ fs->instructions[i].alu_alpha_addr = R300_ALPHA_ADDR0(0) |
+ R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT;
+
+ fs->alu_instruction_count++;
+}
+
/* Setup an ALU operation. */
static INLINE void r500_emit_alu(struct r500_fragment_shader* fs,
struct r300_fs_asm* assembler,
@@ -367,11 +412,31 @@ static INLINE void r500_emit_tex(struct r500_fragment_shader* fs,
}
}
+static void r300_fs_instruction(struct r300_fragment_shader* fs,
+ struct r300_fs_asm* assembler,
+ struct tgsi_full_instruction* inst)
+{
+ switch (inst->Instruction.Opcode) {
+ case TGSI_OPCODE_MOV:
+ /* src0 -> src1 and src2 forced to zero */
+ inst->FullSrcRegisters[1] = inst->FullSrcRegisters[0];
+ inst->FullSrcRegisters[2] = r500_constant_zero;
+ r300_emit_maths(fs, assembler, inst->FullSrcRegisters,
+ &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3);
+ break;
+ case TGSI_OPCODE_END:
+ break;
+ default:
+ debug_printf("r300: fs: Bad opcode %d\n",
+ inst->Instruction.Opcode);
+ break;
+ }
+}
+
static void r500_fs_instruction(struct r500_fragment_shader* fs,
struct r300_fs_asm* assembler,
struct tgsi_full_instruction* inst)
{
- int i;
/* Switch between opcodes. When possible, prefer using the official
* AMD/ATI names for opcodes, please, as it facilitates using the
* documentation. */
@@ -487,35 +552,26 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs,
}
}
-static void r500_fs_finalize(struct r500_fragment_shader* fs,
+static void r300_fs_finalize(struct r3xx_fragment_shader* fs,
struct r300_fs_asm* assembler)
{
- fs->shader.stack_size = assembler->temp_count + assembler->temp_offset;
+ fs->stack_size = assembler->temp_count + assembler->temp_offset;
+}
+static void r500_fs_finalize(struct r500_fragment_shader* fs,
+ struct r300_fs_asm* assembler)
+{
/* XXX should this just go with OPCODE_END? */
fs->instructions[fs->instruction_count - 1].inst0 |=
R500_INST_LAST;
}
void r300_translate_fragment_shader(struct r300_context* r300,
- struct r300_fragment_shader* fs)
-{
- struct tgsi_parse_context parser;
-
- tgsi_parse_init(&parser, fs->shader.state.tokens);
-
- while (!tgsi_parse_end_of_tokens(&parser)) {
- tgsi_parse_token(&parser);
- }
-
- r300_copy_passthrough_shader(fs);
-}
-
-void r500_translate_fragment_shader(struct r300_context* r300,
- struct r500_fragment_shader* fs)
+ struct r3xx_fragment_shader* fs)
{
struct tgsi_parse_context parser;
int i;
+ boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
struct r300_constant_buffer* consts =
&r300->shader_constants[PIPE_SHADER_FRAGMENT];
@@ -526,7 +582,12 @@ void r500_translate_fragment_shader(struct r300_context* r300,
/* Setup starting offset for immediates. */
assembler->imm_offset = consts->user_count;
- tgsi_parse_init(&parser, fs->shader.state.tokens);
+ /* Make sure we start at the beginning of the shader. */
+ if (is_r500) {
+ ((struct r500_fragment_shader*)fs)->instruction_count = 0;
+ }
+
+ tgsi_parse_init(&parser, fs->state.tokens);
while (!tgsi_parse_end_of_tokens(&parser)) {
tgsi_parse_token(&parser);
@@ -553,25 +614,35 @@ void r500_translate_fragment_shader(struct r300_context* r300,
assembler->imm_count++;
break;
case TGSI_TOKEN_TYPE_INSTRUCTION:
- r500_fs_instruction(fs, assembler,
- &parser.FullToken.FullInstruction);
+ if (is_r500) {
+ r500_fs_instruction((struct r500_fragment_shader*)fs,
+ assembler, &parser.FullToken.FullInstruction);
+ } else {
+ r300_fs_instruction((struct r300_fragment_shader*)fs,
+ assembler, &parser.FullToken.FullInstruction);
+ }
break;
}
-
}
- debug_printf("r300: %d texs and %d colors, first free reg is %d\n",
+ debug_printf("r300: fs: %d texs and %d colors, first free reg is %d\n",
assembler->tex_count, assembler->color_count,
assembler->tex_count + assembler->color_count);
consts->count = consts->user_count + assembler->imm_count;
- debug_printf("r300: %d total constants, "
+ debug_printf("r300: fs: %d total constants, "
"%d from user and %d from immediates\n", consts->count,
consts->user_count, assembler->imm_count);
- r500_fs_finalize(fs, assembler);
+ r300_fs_finalize(fs, assembler);
+ if (is_r500) {
+ r500_fs_finalize((struct r500_fragment_shader*)fs, assembler);
+ }
- tgsi_dump(fs->shader.state.tokens);
- r500_fs_dump(fs);
+ tgsi_dump(fs->state.tokens);
+ /* XXX finish r300 dumper too */
+ if (is_r500) {
+ r500_fs_dump((struct r500_fragment_shader*)fs);
+ }
tgsi_parse_free(&parser);
FREE(assembler);
diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r300_state_shader.h
index 06c0bb73789..185fdd90f0c 100644
--- a/src/gallium/drivers/r300/r300_state_shader.h
+++ b/src/gallium/drivers/r300/r300_state_shader.h
@@ -102,12 +102,9 @@ struct r300_fs_asm {
};
void r300_translate_fragment_shader(struct r300_context* r300,
- struct r300_fragment_shader* fs);
+ struct r3xx_fragment_shader* fs);
-void r500_translate_fragment_shader(struct r300_context* r300,
- struct r500_fragment_shader* fs);
-
-static const struct r300_fragment_shader r300_passthrough_fragment_shader = {
+static struct r300_fragment_shader r300_passthrough_fragment_shader = {
/* XXX This is the emission code. TODO: decode
OUT_CS_REG(R300_US_CONFIG, 0);
OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
@@ -118,24 +115,24 @@ static const struct r300_fragment_shader r300_passthrough_fragment_shader = {
*/
.alu_instruction_count = 1,
.tex_instruction_count = 0,
- .indirections = 1,
- .shader.stack_size = 2,
+ .indirections = 0,
+ .shader.stack_size = 1,
.instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) |
- R300_RGB_SWIZB(R300_ALU_ARGC_ONE) |
+ R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) |
R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) |
- R300_ALU_OUTC_MAD,
+ R300_ALU_OUTC_CMP,
.instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) |
R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ,
.instructions[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) |
- R300_ALPHA_SWIZB(R300_ALU_ARGA_ONE) |
+ R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) |
R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) |
- R300_ALU_OUTA_MAD,
+ R300_ALU_OUTA_CMP,
.instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) |
R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT,
};
-static const struct r500_fragment_shader r500_passthrough_fragment_shader = {
+static struct r500_fragment_shader r500_passthrough_fragment_shader = {
.shader.stack_size = 0,
.instruction_count = 1,
.instructions[0].inst0 = R500_INST_TYPE_OUT |
@@ -161,4 +158,73 @@ static const struct r500_fragment_shader r500_passthrough_fragment_shader = {
R500_ALU_RGBA_A_SWIZ_0,
};
+static struct r300_fragment_shader r300_texture_fragment_shader = {
+ /* XXX This is the emission code. TODO: decode
+ OUT_CS_REG(R300_US_CONFIG, 0);
+ OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
+ OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0);
+ OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0);
+ OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0);
+ OUT_CS_REG(R300_US_CODE_ADDR_3, 0x400000);
+*/
+ .alu_instruction_count = 1,
+ .tex_instruction_count = 0,
+ .indirections = 0,
+ .shader.stack_size = 1,
+
+ .instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) |
+ R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) |
+ R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) |
+ R300_ALU_OUTC_CMP,
+ .instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) |
+ R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ,
+ .instructions[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) |
+ R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) |
+ R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) |
+ R300_ALU_OUTA_CMP,
+ .instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) |
+ R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT,
+};
+
+static struct r500_fragment_shader r500_texture_fragment_shader = {
+ .shader.stack_size = 1,
+ .instruction_count = 2,
+ .instructions[0].inst0 = R500_INST_TYPE_TEX |
+ R500_INST_TEX_SEM_WAIT |
+ R500_INST_RGB_OMASK_RGB | R500_INST_ALPHA_OMASK |
+ R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP,
+ .instructions[0].inst1 = R500_TEX_ID(0) | R500_TEX_INST_LD |
+ R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED,
+ .instructions[0].inst2 = R500_TEX_SRC_ADDR(0) |
+ R500_TEX_SRC_S_SWIZ_R | R500_TEX_SRC_T_SWIZ_G |
+ R500_TEX_SRC_R_SWIZ_B | R500_TEX_SRC_Q_SWIZ_A |
+ R500_TEX_DST_ADDR(0) |
+ R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G |
+ R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A,
+ .instructions[0].inst3 = 0x0,
+ .instructions[0].inst4 = 0x0,
+ .instructions[0].inst5 = 0x0,
+ .instructions[1].inst0 = R500_INST_TYPE_OUT |
+ R500_INST_TEX_SEM_WAIT | R500_INST_LAST |
+ R500_INST_RGB_OMASK_RGB | R500_INST_ALPHA_OMASK |
+ R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP,
+ .instructions[1].inst1 =
+ R500_RGB_ADDR0(0) | R500_RGB_ADDR1(0) | R500_RGB_ADDR1_CONST |
+ R500_RGB_ADDR2(0) | R500_RGB_ADDR2_CONST,
+ .instructions[1].inst2 =
+ R500_ALPHA_ADDR0(0) | R500_ALPHA_ADDR1(0) | R500_ALPHA_ADDR1_CONST |
+ R500_ALPHA_ADDR2(0) | R500_ALPHA_ADDR2_CONST,
+ .instructions[1].inst3 =
+ R500_ALU_RGB_SEL_A_SRC0 | R500_ALU_RGB_R_SWIZ_A_R |
+ R500_ALU_RGB_G_SWIZ_A_G | R500_ALU_RGB_B_SWIZ_A_B |
+ R500_ALU_RGB_SEL_B_SRC0 | R500_ALU_RGB_R_SWIZ_B_R |
+ R500_ALU_RGB_B_SWIZ_B_G | R500_ALU_RGB_G_SWIZ_B_B,
+ .instructions[1].inst4 =
+ R500_ALPHA_OP_CMP | R500_ALPHA_SWIZ_A_A | R500_ALPHA_SWIZ_B_A,
+ .instructions[1].inst5 =
+ R500_ALU_RGBA_OP_CMP | R500_ALU_RGBA_R_SWIZ_0 |
+ R500_ALU_RGBA_G_SWIZ_0 | R500_ALU_RGBA_B_SWIZ_0 |
+ R500_ALU_RGBA_A_SWIZ_0,
+};
+
#endif /* R300_STATE_SHADER_H */
diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c
new file mode 100644
index 00000000000..47d6c6dfcdf
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_state_tcl.c
@@ -0,0 +1,285 @@
+/*
+ * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "r300_state_tcl.h"
+
+static void r300_vs_declare(struct r300_vs_asm* assembler,
+ struct tgsi_full_declaration* decl)
+{
+ switch (decl->Declaration.File) {
+ case TGSI_FILE_INPUT:
+ break;
+ case TGSI_FILE_OUTPUT:
+ switch (decl->Semantic.SemanticName) {
+ case TGSI_SEMANTIC_POSITION:
+ assembler->tab[decl->DeclarationRange.First] = 0;
+ break;
+ case TGSI_SEMANTIC_COLOR:
+ assembler->tab[decl->DeclarationRange.First] = 2;
+ break;
+ case TGSI_SEMANTIC_GENERIC:
+ /* XXX multiple? */
+ assembler->tab[decl->DeclarationRange.First] = 6;
+ break;
+ default:
+ debug_printf("r300: vs: Bad semantic declaration %d\n",
+ decl->Semantic.SemanticName);
+ break;
+ }
+ break;
+ case TGSI_FILE_CONSTANT:
+ break;
+ case TGSI_FILE_TEMPORARY:
+ assembler->temp_count++;
+ break;
+ default:
+ debug_printf("r300: vs: Bad file %d\n", decl->Declaration.File);
+ break;
+ }
+}
+
+static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler,
+ struct tgsi_src_register* src)
+{
+ switch (src->File) {
+ case TGSI_FILE_NULL:
+ /* Probably a zero or one swizzle */
+ return R300_PVS_SRC_REG_INPUT;
+ break;
+ case TGSI_FILE_INPUT:
+ return R300_PVS_SRC_REG_INPUT;
+ break;
+ case TGSI_FILE_TEMPORARY:
+ return R300_PVS_SRC_REG_TEMPORARY;
+ break;
+ case TGSI_FILE_CONSTANT:
+ return R300_PVS_SRC_REG_CONSTANT;
+ default:
+ debug_printf("r300: vs: Unimplemented src type %d\n", src->File);
+ break;
+ }
+ return 0;
+}
+
+static INLINE unsigned r300_vs_dst_type(struct r300_vs_asm* assembler,
+ struct tgsi_dst_register* dst)
+{
+ switch (dst->File) {
+ case TGSI_FILE_TEMPORARY:
+ return R300_PVS_DST_REG_TEMPORARY;
+ break;
+ case TGSI_FILE_OUTPUT:
+ return R300_PVS_DST_REG_OUT;
+ break;
+ default:
+ debug_printf("r300: vs: Unimplemented dst type %d\n", dst->File);
+ break;
+ }
+ return 0;
+}
+
+static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler,
+ struct tgsi_dst_register* dst)
+{
+ switch (dst->File) {
+ case TGSI_FILE_TEMPORARY:
+ return dst->Index;
+ break;
+ case TGSI_FILE_OUTPUT:
+ return assembler->tab[dst->Index];
+ break;
+ default:
+ debug_printf("r300: vs: Unimplemented dst %d\n", dst->File);
+ break;
+ }
+ return 0;
+}
+
+static uint32_t r300_vs_op(unsigned op)
+{
+ switch (op) {
+ case TGSI_OPCODE_MUL:
+ return R300_VE_MULTIPLY;
+ case TGSI_OPCODE_ADD:
+ case TGSI_OPCODE_MOV:
+ case TGSI_OPCODE_SWZ:
+ return R300_VE_ADD;
+ case TGSI_OPCODE_MAD:
+ return R300_PVS_DST_MACRO_INST | R300_PVS_MACRO_OP_2CLK_MADD;
+ default:
+ break;
+ }
+ return 0;
+}
+
+static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg)
+{
+ if (reg->SrcRegister.Extended) {
+ return reg->SrcRegisterExtSwz.ExtSwizzleX |
+ (reg->SrcRegisterExtSwz.ExtSwizzleY << 3) |
+ (reg->SrcRegisterExtSwz.ExtSwizzleZ << 6) |
+ (reg->SrcRegisterExtSwz.ExtSwizzleW << 9);
+ } else {
+ return reg->SrcRegister.SwizzleX |
+ (reg->SrcRegister.SwizzleY << 3) |
+ (reg->SrcRegister.SwizzleZ << 6) |
+ (reg->SrcRegister.SwizzleW << 9);
+ }
+}
+
+static void r300_vs_emit_inst(struct r300_vertex_shader* vs,
+ struct r300_vs_asm* assembler,
+ struct tgsi_full_src_register* src,
+ struct tgsi_full_dst_register* dst,
+ unsigned op,
+ unsigned count)
+{
+ int i = vs->instruction_count;
+ vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(r300_vs_op(op)) |
+ R300_PVS_DST_REG_TYPE(r300_vs_dst_type(assembler, &dst->DstRegister)) |
+ R300_PVS_DST_OFFSET(r300_vs_dst(assembler, &dst->DstRegister)) |
+ R300_PVS_DST_WE_XYZW;
+ switch (count) {
+ case 3:
+ vs->instructions[i].inst3 =
+ R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler,
+ &src[2].SrcRegister)) |
+ R300_PVS_SRC_OFFSET(src[2].SrcRegister.Index) |
+ R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[2]));
+ /* Fall through */
+ case 2:
+ vs->instructions[i].inst2 =
+ R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler,
+ &src[1].SrcRegister)) |
+ R300_PVS_SRC_OFFSET(src[1].SrcRegister.Index) |
+ R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[1]));
+ /* Fall through */
+ case 1:
+ vs->instructions[i].inst1 =
+ R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler,
+ &src[0].SrcRegister)) |
+ R300_PVS_SRC_OFFSET(src[0].SrcRegister.Index) |
+ R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[0]));
+ break;
+ }
+ vs->instruction_count++;
+}
+
+static void r300_vs_instruction(struct r300_vertex_shader* vs,
+ struct r300_vs_asm* assembler,
+ struct tgsi_full_instruction* inst)
+{
+ switch (inst->Instruction.Opcode) {
+ case TGSI_OPCODE_ADD:
+ case TGSI_OPCODE_MUL:
+ r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
+ &inst->FullDstRegisters[0], inst->Instruction.Opcode,
+ 2);
+ break;
+ case TGSI_OPCODE_MOV:
+ case TGSI_OPCODE_SWZ:
+ inst->FullSrcRegisters[1] = r300_constant_zero;
+ r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
+ &inst->FullDstRegisters[0], inst->Instruction.Opcode,
+ 2);
+ break;
+ case TGSI_OPCODE_MAD:
+ r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
+ &inst->FullDstRegisters[0], inst->Instruction.Opcode,
+ 3);
+ break;
+ case TGSI_OPCODE_END:
+ break;
+ default:
+ debug_printf("r300: vs: Bad opcode %d\n",
+ inst->Instruction.Opcode);
+ break;
+ }
+}
+
+void r300_translate_vertex_shader(struct r300_context* r300,
+ struct r300_vertex_shader* vs)
+{
+ struct tgsi_parse_context parser;
+ int i;
+ struct r300_constant_buffer* consts =
+ &r300->shader_constants[PIPE_SHADER_VERTEX];
+
+ struct r300_vs_asm* assembler = CALLOC_STRUCT(r300_vs_asm);
+ if (assembler == NULL) {
+ return;
+ }
+ /* Setup starting offset for immediates. */
+ assembler->imm_offset = consts->user_count;
+
+ tgsi_parse_init(&parser, vs->state.tokens);
+
+ while (!tgsi_parse_end_of_tokens(&parser)) {
+ tgsi_parse_token(&parser);
+
+ /* This is seriously the lamest way to create fragment programs ever.
+ * I blame TGSI. */
+ switch (parser.FullToken.Token.Type) {
+ case TGSI_TOKEN_TYPE_DECLARATION:
+ /* Allocated registers sitting at the beginning
+ * of the program. */
+ r300_vs_declare(assembler, &parser.FullToken.FullDeclaration);
+ break;
+ case TGSI_TOKEN_TYPE_IMMEDIATE:
+ debug_printf("r300: Emitting immediate to constant buffer, "
+ "position %d\n",
+ assembler->imm_offset + assembler->imm_count);
+ /* I am not amused by the length of these. */
+ for (i = 0; i < 4; i++) {
+ consts->constants[assembler->imm_offset +
+ assembler->imm_count][i] =
+ parser.FullToken.FullImmediate.u.ImmediateFloat32[i]
+ .Float;
+ }
+ assembler->imm_count++;
+ break;
+ case TGSI_TOKEN_TYPE_INSTRUCTION:
+ r300_vs_instruction(vs, assembler,
+ &parser.FullToken.FullInstruction);
+ break;
+ }
+ }
+
+ debug_printf("r300: vs: %d texs and %d colors, first free reg is %d\n",
+ assembler->tex_count, assembler->color_count,
+ assembler->tex_count + assembler->color_count);
+
+ consts->count = consts->user_count + assembler->imm_count;
+ debug_printf("r300: vs: %d total constants, "
+ "%d from user and %d from immediates\n", consts->count,
+ consts->user_count, assembler->imm_count);
+
+ debug_printf("r300: vs: tab: %d %d %d %d\n", assembler->tab[0],
+ assembler->tab[1], assembler->tab[2], assembler->tab[3]);
+
+ tgsi_dump(vs->state.tokens);
+ /* XXX finish r300 vertex shader dumper */
+ r300_vs_dump(vs);
+
+ tgsi_parse_free(&parser);
+ FREE(assembler);
+}
diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h
new file mode 100644
index 00000000000..3d10e248e15
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_state_tcl.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef R300_STATE_TCL_H
+#define R300_STATE_TCL_H
+
+#include "tgsi/tgsi_parse.h"
+
+#include "r300_context.h"
+#include "r300_debug.h"
+#include "r300_reg.h"
+#include "r300_screen.h"
+
+/* XXX get these to r300_reg */
+#define R300_PVS_DST_OPCODE(x) ((x) << 0)
+# define R300_VE_MULTIPLY 2
+# define R300_VE_ADD 3
+#define R300_PVS_DST_MACRO_INST (1 << 7)
+# define R300_PVS_MACRO_OP_2CLK_MADD 0
+#define R300_PVS_DST_REG_TYPE(x) ((x) << 8)
+# define R300_PVS_DST_REG_TEMPORARY 0
+# define R300_PVS_DST_REG_A0 1
+# define R300_PVS_DST_REG_OUT 2
+# define R300_PVS_DST_REG_OUT_REPL_X 3
+# define R300_PVS_DST_REG_ALT_TEMPORARY 4
+# define R300_PVS_DST_REG_INPUT 5
+#define R300_PVS_DST_OFFSET(x) ((x) << 13)
+#define R300_PVS_DST_WE(x) ((x) << 20)
+#define R300_PVS_DST_WE_XYZW (0xf << 20)
+
+#define R300_PVS_SRC_REG_TYPE(x) ((x) << 0)
+# define R300_PVS_SRC_REG_TEMPORARY 0
+# define R300_PVS_SRC_REG_INPUT 1
+# define R300_PVS_SRC_REG_CONSTANT 2
+# define R300_PVS_SRC_REG_ALT_TEMPORARY 3
+#define R300_PVS_SRC_OFFSET(x) ((x) << 5)
+#define R300_PVS_SRC_SWIZZLE(x) ((x) << 13)
+# define R300_PVS_SRC_SELECT_X 0
+# define R300_PVS_SRC_SELECT_Y 1
+# define R300_PVS_SRC_SELECT_Z 2
+# define R300_PVS_SRC_SELECT_W 3
+# define R300_PVS_SRC_SELECT_FORCE_0 4
+# define R300_PVS_SRC_SELECT_FORCE_1 5
+# define R300_PVS_SRC_SWIZZLE_XYZW \
+ ((R300_PVS_SRC_SELECT_X | (R300_PVS_SRC_SELECT_Y << 3) | \
+ (R300_PVS_SRC_SELECT_Z << 6) | (R300_PVS_SRC_SELECT_W << 9)) << 13)
+# define R300_PVS_SRC_SWIZZLE_ZERO \
+ ((R300_PVS_SRC_SELECT_FORCE_0 | (R300_PVS_SRC_SELECT_FORCE_0 << 3) | \
+ (R300_PVS_SRC_SELECT_FORCE_0 << 6) | \
+ (R300_PVS_SRC_SELECT_FORCE_0 << 9)) << 13)
+# define R300_PVS_SRC_SWIZZLE_ONE \
+ ((R300_PVS_SRC_SELECT_FORCE_1 | (R300_PVS_SRC_SELECT_FORCE_1 << 3) | \
+ (R300_PVS_SRC_SELECT_FORCE_1 << 6) | \
+ (R300_PVS_SRC_SELECT_FORCE_1 << 9)) << 13)
+
+static const struct tgsi_full_src_register r300_constant_zero = {
+ .SrcRegister.Extended = TRUE,
+ .SrcRegister.File = TGSI_FILE_NULL,
+ .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ZERO,
+ .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ZERO,
+ .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ZERO,
+ .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ZERO,
+};
+
+/* Temporary struct used to hold assembly state while putting together
+ * fragment programs. */
+struct r300_vs_asm {
+ /* Pipe context. */
+ struct r300_context* r300;
+ /* Number of colors. */
+ unsigned color_count;
+ /* Number of texcoords. */
+ unsigned tex_count;
+ /* Number of requested temporary registers. */
+ unsigned temp_count;
+ /* Offset for immediate constants. Neither R300 nor R500 can do four
+ * inline constants per source, so instead we copy immediates into the
+ * constant buffer. */
+ unsigned imm_offset;
+ /* Number of immediate constants. */
+ unsigned imm_count;
+ /* Offsets into vertex output memory. */
+ unsigned tab[16];
+};
+
+static struct r300_vertex_shader r300_passthrough_vertex_shader = {
+ /* XXX translate these back into normal instructions */
+ .instruction_count = 2,
+ .instructions[0].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
+ R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
+ R300_PVS_DST_OFFSET(0) | R300_PVS_DST_WE_XYZW,
+ .instructions[0].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
+ R300_PVS_SRC_OFFSET(0) | R300_PVS_SRC_SWIZZLE_XYZW,
+ .instructions[0].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
+ .instructions[0].inst3 = 0x0,
+ .instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
+ R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
+ R300_PVS_DST_OFFSET(2) | R300_PVS_DST_WE_XYZW,
+ .instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
+ R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW,
+ .instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
+ .instructions[1].inst3 = 0x0,
+};
+
+static struct r300_vertex_shader r300_texture_vertex_shader = {
+ /* XXX translate these back into normal instructions */
+ .instruction_count = 2,
+ .instructions[0].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
+ R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
+ R300_PVS_DST_OFFSET(0) | R300_PVS_DST_WE_XYZW,
+ .instructions[0].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
+ R300_PVS_SRC_OFFSET(0) | R300_PVS_SRC_SWIZZLE_XYZW,
+ .instructions[0].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
+ .instructions[0].inst3 = 0x0,
+ .instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
+ R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
+ R300_PVS_DST_OFFSET(6) | R300_PVS_DST_WE_XYZW,
+ .instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
+ R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW,
+ .instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
+ .instructions[1].inst3 = 0x0,
+};
+
+void r300_translate_vertex_shader(struct r300_context* r300,
+ struct r300_vertex_shader* vs);
+
+#endif /* R300_STATE_TCL_H */
diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c
index db18975a10f..79bed032538 100644
--- a/src/gallium/drivers/r300/r300_surface.c
+++ b/src/gallium/drivers/r300/r300_surface.c
@@ -29,10 +29,10 @@ static void r300_surface_setup(struct pipe_context* pipe,
unsigned w, unsigned h)
{
struct r300_context* r300 = r300_context(pipe);
- CS_LOCALS(r300);
struct r300_capabilities* caps = r300_screen(pipe->screen)->caps;
struct r300_texture* tex = (struct r300_texture*)dest->texture;
unsigned pixpitch = tex->stride / tex->tex.block.size;
+ CS_LOCALS(r300);
r300_emit_blend_state(r300, &blend_clear_state);
r300_emit_blend_color_state(r300, &blend_color_clear_state);
@@ -80,14 +80,15 @@ static void r300_surface_fill(struct pipe_context* pipe,
unsigned w, unsigned h,
unsigned color)
{
+ int i;
+ float r, g, b, a, depth;
struct r300_context* r300 = r300_context(pipe);
- CS_LOCALS(r300);
struct r300_capabilities* caps = r300_screen(pipe->screen)->caps;
struct r300_texture* tex = (struct r300_texture*)dest->texture;
- int i;
- float r, g, b, a, depth;
unsigned pixpitch = tex->stride / tex->tex.block.size;
+ CS_LOCALS(r300);
+ a = (float)((color >> 24) & 0xff) / 255.0f;
r = (float)((color >> 16) & 0xff) / 255.0f;
g = (float)((color >> 8) & 0xff) / 255.0f;
b = (float)((color >> 0) & 0xff) / 255.0f;
@@ -96,7 +97,7 @@ static void r300_surface_fill(struct pipe_context* pipe,
dest, x, y, w, h, pixpitch, color);
/* Fallback? */
- if (tex->tex.format != PIPE_FORMAT_A8R8G8B8_UNORM) {
+ if (FALSE) {
debug_printf("r300: Falling back on surface clear...");
util_surface_fill(pipe, dest, x, y, w, h, color);
return;
@@ -104,6 +105,19 @@ static void r300_surface_fill(struct pipe_context* pipe,
r300_surface_setup(r300, dest, x, y, w, h);
+ /* Vertex shader setup */
+ if (caps->has_tcl) {
+ r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader);
+ } else {
+ BEGIN_CS(4);
+ OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VAP_TCL_BYPASS);
+ OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) |
+ R300_PVS_NUM_CNTLRS(5) |
+ R300_PVS_NUM_FPUS(caps->num_vert_fpus) |
+ R300_PVS_VF_MAX_VTX_NUM(12));
+ END_CS;
+ }
+
/* Fragment shader setup */
if (caps->is_r500) {
r500_emit_fragment_shader(r300, &r500_passthrough_fragment_shader);
@@ -113,7 +127,32 @@ static void r300_surface_fill(struct pipe_context* pipe,
r300_emit_rs_block_state(r300, &r300_rs_block_clear_state);
}
- BEGIN_CS(21);
+ BEGIN_CS(31);
+
+ /* VAP stream control, mapping from input memory to PVS/RS memory */
+ if (caps->has_tcl) {
+ OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
+ (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
+ ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) |
+ R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
+ } else {
+ OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
+ (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
+ ((R300_LAST_VEC | (2 << R300_DST_VEC_LOC_SHIFT) |
+ R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
+ }
+ OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0,
+ (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE0_SHIFT) |
+ (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE1_SHIFT));
+
+ /* VAP format controls */
+ OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0,
+ R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT |
+ R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT);
+ OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x0);
+
+ /* Disable textures */
+ OUT_CS_REG(R300_TX_ENABLE, 0x0);
/* Viewport setup */
OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
@@ -132,16 +171,17 @@ static void r300_surface_fill(struct pipe_context* pipe,
/* Packet3 with our point vertex */
OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8);
OUT_CS(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING |
- (1 << R300_PRIM_NUM_VERTICES_SHIFT));
+ (1 << R300_PRIM_NUM_VERTICES_SHIFT));
+ /* Position */
OUT_CS_32F(w / 2.0);
OUT_CS_32F(h / 2.0);
- /* XXX this should be the depth value to clear to */
OUT_CS_32F(1.0);
OUT_CS_32F(1.0);
+ /* Color */
OUT_CS_32F(r);
OUT_CS_32F(g);
OUT_CS_32F(b);
- OUT_CS_32F(1.0);
+ OUT_CS_32F(a);
/* XXX figure out why this is 0xA and not 0x2 */
OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA);
@@ -162,23 +202,100 @@ static void r300_surface_copy(struct pipe_context* pipe,
unsigned w, unsigned h)
{
struct r300_context* r300 = r300_context(pipe);
- CS_LOCALS(r300);
+ struct r300_capabilities* caps = r300_screen(pipe->screen)->caps;
struct r300_texture* srctex = (struct r300_texture*)src->texture;
struct r300_texture* desttex = (struct r300_texture*)dest->texture;
-
unsigned pixpitch = srctex->stride / srctex->tex.block.size;
+ CS_LOCALS(r300);
+
debug_printf("r300: Copying surface %p at (%d,%d) to %p at (%d, %d),"
" dimensions %dx%d (pixel pitch %d)\n",
src, srcx, srcy, dest, destx, desty, w, h, pixpitch);
- /* if ((srctex == desttex) &&
+ if ((srctex == desttex) &&
((destx < srcx + w) || (srcx < destx + w)) &&
- ((desty < srcy + h) || (srcy < destx + h))) { */
- if (TRUE) {
+ ((desty < srcy + h) || (srcy < desty + h))) {
debug_printf("r300: Falling back on surface_copy\n");
- return util_surface_copy(pipe, FALSE, dest, destx, desty, src,
+ util_surface_copy(pipe, FALSE, dest, destx, desty, src,
srcx, srcy, w, h);
}
+
+ r300_emit_sampler(r300, &r300_sampler_copy_state, 0);
+ r300_emit_texture(r300, srctex, 0);
+ r300_flush_textures(r300);
+
+ /* Vertex shader setup */
+ if (caps->has_tcl) {
+ r300_emit_vertex_shader(r300, &r300_texture_vertex_shader);
+ } else {
+ BEGIN_CS(4);
+ OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VAP_TCL_BYPASS);
+ OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) |
+ R300_PVS_NUM_CNTLRS(5) |
+ R300_PVS_NUM_FPUS(caps->num_vert_fpus) |
+ R300_PVS_VF_MAX_VTX_NUM(12));
+ END_CS;
+ }
+
+ /* Fragment shader setup */
+ if (caps->is_r500) {
+ r500_emit_fragment_shader(r300, &r500_texture_fragment_shader);
+ r300_emit_rs_block_state(r300, &r500_rs_block_copy_state);
+ } else {
+ r300_emit_fragment_shader(r300, &r300_texture_fragment_shader);
+ r300_emit_rs_block_state(r300, &r300_rs_block_copy_state);
+ }
+
+ /* VAP stream control, mapping from input memory to PVS/RS memory */
+ if (caps->has_tcl) {
+ OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
+ (R300_DATA_TYPE_FLOAT_2 << R300_DATA_TYPE_0_SHIFT) |
+ ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) |
+ R300_DATA_TYPE_FLOAT_2) << R300_DATA_TYPE_1_SHIFT));
+ } else {
+ OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
+ (R300_DATA_TYPE_FLOAT_2 << R300_DATA_TYPE_0_SHIFT) |
+ ((R300_LAST_VEC | (6 << R300_DST_VEC_LOC_SHIFT) |
+ R300_DATA_TYPE_FLOAT_2) << R300_DATA_TYPE_1_SHIFT));
+ }
+ OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0,
+ (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE0_SHIFT) |
+ (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE1_SHIFT));
+
+ /* VAP format controls */
+ OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0,
+ R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT);
+ /* Two components of texture 0 */
+ OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x2);
+
+ /* Packet3 with our texcoords */
+ OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8);
+ OUT_CS(R300_PRIM_TYPE_QUADS | R300_PRIM_WALK_RING |
+ (4 << R300_PRIM_NUM_VERTICES_SHIFT));
+ /* (x , y ) */
+ OUT_CS_32F((float)destx);
+ OUT_CS_32F((float)desty);
+ OUT_CS_32F((float)srcx);
+ OUT_CS_32F((float)srcy);
+ /* (x , y + h) */
+ OUT_CS_32F((float)destx);
+ OUT_CS_32F((float)(desty + h));
+ OUT_CS_32F((float)srcx);
+ OUT_CS_32F((float)(srcy + h));
+ /* (x + w, y + h) */
+ OUT_CS_32F((float)(destx + w));
+ OUT_CS_32F((float)(desty + h));
+ OUT_CS_32F((float)(srcx + w));
+ OUT_CS_32F((float)(srcy + h));
+ /* (x + w, y ) */
+ OUT_CS_32F((float)(destx + w));
+ OUT_CS_32F((float)desty);
+ OUT_CS_32F((float)(srcx + w));
+ OUT_CS_32F((float)srcy);
+
+ OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA);
+
+ r300->dirty_hw++;
}
void r300_init_surface_functions(struct r300_context* r300)
diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h
index b75b3ab84cf..894def07aa8 100644
--- a/src/gallium/drivers/r300/r300_surface.h
+++ b/src/gallium/drivers/r300/r300_surface.h
@@ -32,22 +32,23 @@
#include "r300_cs.h"
#include "r300_emit.h"
#include "r300_state_shader.h"
+#include "r300_state_tcl.h"
#include "r300_state_inlines.h"
-const struct r300_blend_state blend_clear_state = {
+static struct r300_blend_state blend_clear_state = {
.blend_control = 0x0,
.alpha_blend_control = 0x0,
.rop = 0x0,
.dither = 0x0,
};
-const struct r300_blend_color_state blend_color_clear_state = {
+static struct r300_blend_color_state blend_color_clear_state = {
.blend_color = 0x0,
.blend_color_red_alpha = 0x0,
.blend_color_green_blue = 0x0,
};
-const struct r300_dsa_state dsa_clear_state = {
+static struct r300_dsa_state dsa_clear_state = {
.alpha_function = 0x0,
.alpha_reference = 0x0,
.z_buffer_control = 0x0,
@@ -57,7 +58,7 @@ const struct r300_dsa_state dsa_clear_state = {
.stencil_ref_bf = 0x0,
};
-const struct r300_rs_state rs_clear_state = {
+static struct r300_rs_state rs_clear_state = {
.point_minmax = 0x36000006,
.line_control = 0x00030006,
.depth_scale_front = 0x0,
@@ -71,7 +72,7 @@ const struct r300_rs_state rs_clear_state = {
.color_control = R300_SHADE_MODEL_FLAT,
};
-const struct r300_rs_block r300_rs_block_clear_state = {
+static struct r300_rs_block r300_rs_block_clear_state = {
.ip[0] = R500_RS_SEL_S(R300_RS_SEL_K0) |
R500_RS_SEL_T(R300_RS_SEL_K0) |
R500_RS_SEL_R(R300_RS_SEL_K0) |
@@ -81,7 +82,7 @@ const struct r300_rs_block r300_rs_block_clear_state = {
.inst_count = 0,
};
-const struct r300_rs_block r500_rs_block_clear_state = {
+static struct r300_rs_block r500_rs_block_clear_state = {
.ip[0] = R500_RS_SEL_S(R500_RS_IP_PTR_K0) |
R500_RS_SEL_T(R500_RS_IP_PTR_K0) |
R500_RS_SEL_R(R500_RS_IP_PTR_K0) |
@@ -91,4 +92,33 @@ const struct r300_rs_block r500_rs_block_clear_state = {
.inst_count = 0,
};
+/* The following state is used for surface_copy only. */
+
+static struct r300_rs_block r300_rs_block_copy_state = {
+ .ip[0] = R500_RS_SEL_S(R300_RS_SEL_K0) |
+ R500_RS_SEL_T(R300_RS_SEL_K0) |
+ R500_RS_SEL_R(R300_RS_SEL_K0) |
+ R500_RS_SEL_Q(R300_RS_SEL_K1),
+ .inst[0] = R300_RS_INST_COL_CN_WRITE,
+ .count = R300_IT_COUNT(2) | R300_IC_COUNT(0) | R300_HIRES_EN,
+ .inst_count = R300_RS_TX_OFFSET(6),
+};
+
+static struct r300_rs_block r500_rs_block_copy_state = {
+ .ip[0] = R500_RS_SEL_S(0) |
+ R500_RS_SEL_T(1) |
+ R500_RS_SEL_R(R500_RS_IP_PTR_K0) |
+ R500_RS_SEL_Q(R500_RS_IP_PTR_K1),
+ .inst[0] = R500_RS_INST_TEX_CN_WRITE,
+ .count = R300_IT_COUNT(2) | R300_IC_COUNT(0) | R300_HIRES_EN,
+ .inst_count = R300_RS_TX_OFFSET(6),
+};
+
+static struct r300_sampler_state r300_sampler_copy_state = {
+ .filter0 = R300_TX_WRAP_S(R300_TX_CLAMP) |
+ R300_TX_WRAP_T(R300_TX_CLAMP) |
+ R300_TX_MAG_FILTER_NEAREST |
+ R300_TX_MIN_FILTER_NEAREST,
+};
+
#endif /* R300_SURFACE_H */
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 6cdea3d2854..fe91f4e1844 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -147,7 +147,6 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
surface->height = texture->height[level];
surface->offset = offset;
surface->usage = flags;
- surface->status = PIPE_SURFACE_STATUS_DEFINED;
}
return surface;
diff --git a/src/gallium/drivers/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c
index ad108ec446d..fa59277438c 100644
--- a/src/gallium/drivers/softpipe/sp_clear.c
+++ b/src/gallium/drivers/softpipe/sp_clear.c
@@ -2,6 +2,7 @@
*
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
+ * Copyright 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -27,6 +28,7 @@
/* Author:
* Brian Paul
+ * Michel Dänzer
*/
@@ -40,34 +42,15 @@
/**
- * Convert packed pixel from one format to another.
- */
-static unsigned
-convert_color(enum pipe_format srcFormat, unsigned srcColor,
- enum pipe_format dstFormat)
-{
- ubyte r, g, b, a;
- unsigned dstColor;
-
- util_unpack_color_ub(srcFormat, &srcColor, &r, &g, &b, &a);
- util_pack_color_ub(r, g, b, a, dstFormat, &dstColor);
-
- return dstColor;
-}
-
-
-
-/**
- * Clear the given surface to the specified value.
+ * Clear the given buffers to the specified values.
* No masking, no scissor (clear entire buffer).
- * Note: when clearing a color buffer, the clearValue is always
- * encoded as PIPE_FORMAT_A8R8G8B8_UNORM.
*/
void
-softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue)
+softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
+ double depth, unsigned stencil)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
+ unsigned cv;
uint i;
if (softpipe->no_rast)
@@ -77,31 +60,30 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
softpipe_update_derived(softpipe); /* not needed?? */
#endif
- if (ps == sp_tile_cache_get_surface(softpipe->zsbuf_cache)) {
- sp_tile_cache_clear(softpipe->zsbuf_cache, clearValue);
- softpipe->framebuffer.zsbuf->status = PIPE_SURFACE_STATUS_CLEAR;
-#if TILE_CLEAR_OPTIMIZATION
- return;
-#endif
- }
+ if (buffers & PIPE_CLEAR_COLOR) {
+ for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
+ struct pipe_surface *ps = softpipe->framebuffer.cbufs[i];
- for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
- if (ps == sp_tile_cache_get_surface(softpipe->cbuf_cache[i])) {
- unsigned cv;
- if (ps->format != PIPE_FORMAT_A8R8G8B8_UNORM) {
- cv = convert_color(PIPE_FORMAT_A8R8G8B8_UNORM, clearValue,
- ps->format);
- }
- else {
- cv = clearValue;
- }
- sp_tile_cache_clear(softpipe->cbuf_cache[i], cv);
- softpipe->framebuffer.cbufs[i]->status = PIPE_SURFACE_STATUS_CLEAR;
+ util_pack_color(rgba, ps->format, &cv);
+ sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, cv);
+
+#if !TILE_CLEAR_OPTIMIZATION
+ /* non-cached surface */
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv);
+#endif
}
}
+ if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+ static const float zero[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
+ struct pipe_surface *ps = softpipe->framebuffer.zsbuf;
+
+ cv = util_pack_z_stencil(ps->format, depth, stencil);
+ sp_tile_cache_clear(softpipe->zsbuf_cache, zero, cv);
+
#if !TILE_CLEAR_OPTIMIZATION
- /* non-cached surface */
- pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
+ /* non-cached surface */
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv);
#endif
+ }
}
diff --git a/src/gallium/drivers/softpipe/sp_clear.h b/src/gallium/drivers/softpipe/sp_clear.h
index a8ed1c4ecc4..2e450672f58 100644
--- a/src/gallium/drivers/softpipe/sp_clear.h
+++ b/src/gallium/drivers/softpipe/sp_clear.h
@@ -36,8 +36,8 @@
struct pipe_context;
extern void
-softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue);
+softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
+ double depth, unsigned stencil);
#endif /* SP_CLEAR_H */
diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c
index 0c14d92864f..9ee86fe7878 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -25,22 +25,29 @@
*
**************************************************************************/
+/**
+ * Execute fragment shader using the TGSI interpreter.
+ */
#include "sp_context.h"
#include "sp_state.h"
#include "sp_fs.h"
#include "sp_quad.h"
-
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
#include "tgsi/tgsi_exec.h"
#include "tgsi/tgsi_parse.h"
+
+/**
+ * Subclass of sp_fragment_shader
+ */
struct sp_exec_fragment_shader
{
struct sp_fragment_shader base;
+ /* No other members for now */
};
@@ -106,8 +113,6 @@ exec_prepare( const struct sp_fragment_shader *base,
}
-
-
/* TODO: hide the machine struct in here somewhere, remove from this
* interface:
*/
@@ -116,7 +121,6 @@ exec_run( const 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->input.x0, (float)quad->input.y0,
@@ -126,7 +130,6 @@ exec_run( const struct sp_fragment_shader *base,
}
-
static void
exec_delete( struct sp_fragment_shader *base )
{
@@ -135,9 +138,6 @@ exec_delete( struct sp_fragment_shader *base )
}
-
-
-
struct sp_fragment_shader *
softpipe_create_fs_exec(struct softpipe_context *softpipe,
const struct pipe_shader_state *templ)
@@ -160,4 +160,3 @@ softpipe_create_fs_exec(struct softpipe_context *softpipe,
return &shader->base;
}
-
diff --git a/src/gallium/drivers/softpipe/sp_fs_llvm.c b/src/gallium/drivers/softpipe/sp_fs_llvm.c
index f33b3e32854..95c0d982d12 100644
--- a/src/gallium/drivers/softpipe/sp_fs_llvm.c
+++ b/src/gallium/drivers/softpipe/sp_fs_llvm.c
@@ -25,7 +25,9 @@
*
**************************************************************************/
-/* Authors:
+/**
+ * Execute fragment shader using LLVM code generation.
+ * Authors:
* Zack Rusin
*/
@@ -33,7 +35,6 @@
#include "sp_state.h"
#include "sp_fs.h"
-
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
@@ -41,11 +42,16 @@
#if 0
-struct sp_llvm_fragment_shader {
+/**
+ * Subclass of sp_fragment_shader
+ */
+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)
@@ -160,7 +166,7 @@ delete_llvm_fs( struct sp_fragment_shader *base )
struct sp_fragment_shader *
softpipe_create_fs_llvm(struct softpipe_context *softpipe,
- const struct pipe_shader_state *templ)
+ const struct pipe_shader_state *templ)
{
struct sp_llvm_fragment_shader *shader = NULL;
diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c
index 366abe2ed49..31c3ca21c51 100644
--- a/src/gallium/drivers/softpipe/sp_fs_sse.c
+++ b/src/gallium/drivers/softpipe/sp_fs_sse.c
@@ -25,13 +25,15 @@
*
**************************************************************************/
+/**
+ * Execute fragment shader using runtime SSE code generation.
+ */
#include "sp_context.h"
#include "sp_state.h"
#include "sp_fs.h"
#include "sp_quad.h"
-
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
@@ -56,14 +58,25 @@ typedef void (PIPE_CDECL *codegen_function)(
);
-struct sp_sse_fragment_shader {
+/**
+ * Subclass of sp_fragment_shader
+ */
+struct sp_sse_fragment_shader
+{
struct sp_fragment_shader base;
- struct x86_function sse2_program;
+ struct x86_function sse2_program;
codegen_function func;
float immediates[TGSI_EXEC_NUM_IMMEDIATES][4];
};
+/** cast wrapper */
+static INLINE struct sp_sse_fragment_shader *
+sp_sse_fragment_shader(const struct sp_fragment_shader *base)
+{
+ return (struct sp_sse_fragment_shader *) base;
+}
+
static void
fs_sse_prepare( const struct sp_fragment_shader *base,
@@ -83,7 +96,7 @@ fs_sse_run( const 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;
+ struct sp_sse_fragment_shader *shader = 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,
@@ -110,7 +123,7 @@ fs_sse_run( const struct sp_fragment_shader *base,
static void
fs_sse_delete( struct sp_fragment_shader *base )
{
- struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base;
+ struct sp_sse_fragment_shader *shader = sp_sse_fragment_shader(base);
x86_release_func( &shader->sse2_program );
FREE(shader);
@@ -156,7 +169,7 @@ softpipe_create_fs_sse(struct softpipe_context *softpipe,
#else
-/* Maybe put this varient in the header file.
+/* Maybe put this variant in the header file.
*/
struct sp_fragment_shader *
softpipe_create_fs_sse(struct softpipe_context *softpipe,
diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c
index adca5df73d8..ca637a1d6a4 100644
--- a/src/gallium/drivers/softpipe/sp_quad_fs.c
+++ b/src/gallium/drivers/softpipe/sp_quad_fs.c
@@ -65,14 +65,11 @@ quad_shade_stage(struct quad_stage *qs)
}
-
/**
* Execute fragment shader for the four fragments in the quad.
*/
static void
-shade_quad(
- struct quad_stage *qs,
- struct quad_header *quad )
+shade_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct quad_shade_stage *qss = quad_shade_stage( qs );
struct softpipe_context *softpipe = qs->softpipe;
@@ -85,9 +82,7 @@ shade_quad(
machine->InterpCoefs = quad->coef;
/* run shader */
- quad->inout.mask &= softpipe->fs->run( softpipe->fs,
- &qss->machine,
- quad );
+ quad->inout.mask &= softpipe->fs->run( softpipe->fs, machine, quad );
/* store outputs */
z_written = FALSE;
@@ -135,15 +130,17 @@ shade_quad(
}
/* shader may cull fragments */
- if( quad->inout.mask ) {
+ if (quad->inout.mask) {
qs->next->run( qs->next, quad );
}
}
+
/**
* Per-primitive (or per-begin?) setup
*/
-static void shade_begin(struct quad_stage *qs)
+static void
+shade_begin(struct quad_stage *qs)
{
struct quad_shade_stage *qss = quad_shade_stage(qs);
struct softpipe_context *softpipe = qs->softpipe;
@@ -157,7 +154,8 @@ static void shade_begin(struct quad_stage *qs)
}
-static void shade_destroy(struct quad_stage *qs)
+static void
+shade_destroy(struct quad_stage *qs)
{
struct quad_shade_stage *qss = (struct quad_shade_stage *) qs;
@@ -168,7 +166,8 @@ static void shade_destroy(struct quad_stage *qs)
}
-struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe )
+struct quad_stage *
+sp_quad_shade_stage( struct softpipe_context *softpipe )
{
struct quad_shade_stage *qss = CALLOC_STRUCT(quad_shade_stage);
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index 96cb09b9051..accc692b66f 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -252,16 +252,6 @@ static PIPE_THREAD_ROUTINE( quad_thread, param )
#endif
-/**
- * Test if x is NaN or +/- infinity.
- */
-static INLINE boolean
-is_inf_or_nan(float x)
-{
- union fi tmp;
- tmp.f = x;
- return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31);
-}
/**
@@ -506,6 +496,9 @@ static void print_vertex(const struct setup_context *setup,
for (i = 0; i < setup->quad.nr_attrs; i++) {
debug_printf(" %d: %f %f %f %f\n", i,
v[i][0], v[i][1], v[i][2], v[i][3]);
+ if (util_is_inf_or_nan(v[i][0])) {
+ debug_printf(" NaN!\n");
+ }
}
}
#endif
@@ -595,7 +588,7 @@ static boolean setup_sort_vertices( struct setup_context *setup,
debug_printf("%s one-over-area %f area %f det %f\n",
__FUNCTION__, setup->oneoverarea, area, det );
*/
- if (is_inf_or_nan(setup->oneoverarea))
+ if (util_is_inf_or_nan(setup->oneoverarea))
return FALSE;
}
@@ -1065,7 +1058,7 @@ setup_line_coefficients(struct setup_context *setup,
/* NOTE: this is not really area but something proportional to it */
area = setup->emaj.dx * setup->emaj.dx + setup->emaj.dy * setup->emaj.dy;
- if (area == 0.0f || is_inf_or_nan(area))
+ if (area == 0.0f || util_is_inf_or_nan(area))
return FALSE;
setup->oneoverarea = 1.0f / area;
@@ -1489,16 +1482,6 @@ void setup_prepare( struct setup_context *setup )
softpipe_update_derived(sp);
}
- /* Mark surfaces as defined now */
- for (i = 0; i < sp->framebuffer.nr_cbufs; i++){
- if (sp->framebuffer.cbufs[i]) {
- sp->framebuffer.cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
- }
- }
- if (sp->framebuffer.zsbuf) {
- sp->framebuffer.zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
- }
-
/* Note: nr_attrs is only used for debugging (vertex printing) */
setup->quad.nr_attrs = draw_num_vs_outputs(sp->draw);
diff --git a/src/gallium/drivers/softpipe/sp_surface.c b/src/gallium/drivers/softpipe/sp_surface.c
index ef04843f172..b04c2a63ad6 100644
--- a/src/gallium/drivers/softpipe/sp_surface.c
+++ b/src/gallium/drivers/softpipe/sp_surface.c
@@ -27,6 +27,7 @@
#include "util/u_rect.h"
#include "sp_context.h"
+#include "sp_surface.h"
static void
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 48b2c22af45..c0113c47adb 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -138,7 +138,6 @@ softpipe_texture_create(struct pipe_screen *screen,
goto fail;
}
- assert(p_atomic_read(&spt->base.reference.count) == 1);
return &spt->base;
fail:
@@ -328,7 +327,7 @@ static void *
softpipe_transfer_map( struct pipe_screen *screen,
struct pipe_transfer *transfer )
{
- ubyte *map;
+ ubyte *map, *xfer_map;
struct softpipe_texture *spt;
unsigned flags = 0;
@@ -358,9 +357,11 @@ softpipe_transfer_map( struct pipe_screen *screen,
softpipe_screen(screen)->timestamp++;
}
- return map + softpipe_transfer(transfer)->offset +
+ xfer_map = map + softpipe_transfer(transfer)->offset +
transfer->y / transfer->block.height * transfer->stride +
transfer->x / transfer->block.width * transfer->block.size;
+ /*printf("map = %p xfer map = %p\n", map, xfer_map);*/
+ return xfer_map;
}
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index 69292753f13..1f9b8f1f4fb 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -57,9 +57,9 @@ struct softpipe_tile_cache
struct pipe_texture *texture; /**< if caching a texture */
struct softpipe_cached_tile entries[NUM_ENTRIES];
uint clear_flags[(MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32];
- float clear_color[4];
- uint clear_val;
- boolean depth_stencil; /** Is the surface a depth/stencil format? */
+ float clear_color[4]; /**< for color bufs */
+ uint clear_val; /**< for z+stencil, or packed color clear value */
+ boolean depth_stencil; /**< Is the surface a depth/stencil format? */
struct pipe_transfer *tex_trans;
void *tex_trans_map;
@@ -599,40 +599,17 @@ sp_get_cached_tile_tex(struct softpipe_context *sp,
* Save the color and set a 'clearflag' for each tile of the screen.
*/
void
-sp_tile_cache_clear(struct softpipe_tile_cache *tc, uint clearValue)
+sp_tile_cache_clear(struct softpipe_tile_cache *tc, const float *rgba,
+ uint clearValue)
{
- uint r, g, b, a;
uint pos;
- tc->clear_val = clearValue;
-
- switch (tc->transfer->format) {
- case PIPE_FORMAT_R8G8B8A8_UNORM:
- r = (clearValue >> 24) & 0xff;
- g = (clearValue >> 16) & 0xff;
- b = (clearValue >> 8) & 0xff;
- a = (clearValue ) & 0xff;
- break;
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- r = (clearValue >> 16) & 0xff;
- g = (clearValue >> 8) & 0xff;
- b = (clearValue ) & 0xff;
- a = (clearValue >> 24) & 0xff;
- break;
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- r = (clearValue >> 8) & 0xff;
- g = (clearValue >> 16) & 0xff;
- b = (clearValue >> 24) & 0xff;
- a = (clearValue ) & 0xff;
- break;
- default:
- r = g = b = a = 0;
- }
+ tc->clear_color[0] = rgba[0];
+ tc->clear_color[1] = rgba[1];
+ tc->clear_color[2] = rgba[2];
+ tc->clear_color[3] = rgba[3];
- tc->clear_color[0] = r / 255.0f;
- tc->clear_color[1] = g / 255.0f;
- tc->clear_color[2] = b / 255.0f;
- tc->clear_color[3] = a / 255.0f;
+ tc->clear_val = clearValue;
#if TILE_CLEAR_OPTIMIZATION
/* set flags to indicate all the tiles are cleared */
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h
index 9ac3fdda948..8f247d0e580 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.h
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.h
@@ -89,7 +89,8 @@ sp_flush_tile_cache(struct softpipe_context *softpipe,
struct softpipe_tile_cache *tc);
extern void
-sp_tile_cache_clear(struct softpipe_tile_cache *tc, uint clearValue);
+sp_tile_cache_clear(struct softpipe_tile_cache *tc, const float *rgba,
+ uint clearValue);
extern struct softpipe_cached_tile *
sp_get_cached_tile(struct softpipe_context *softpipe,
diff --git a/src/gallium/drivers/trace/README b/src/gallium/drivers/trace/README
index f0e1cd596d3..73dce20372e 100644
--- a/src/gallium/drivers/trace/README
+++ b/src/gallium/drivers/trace/README
@@ -10,15 +10,14 @@ This directory contains a Gallium3D pipe driver which traces all incoming calls.
To build, invoke scons on the top dir as
- scons statetrackers=mesa drivers=softpipe,i965simple,trace winsys=xlib
+ scons dri=no statetrackers=mesa drivers=softpipe,i965simple,trace winsys=xlib
= Usage =
To use do
- ln -s libGL.so build/linux-x86-debug/gallium/winsys/xlib/libGL.so.1
- export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/gallium/winsys/xlib
+ export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib
ensure the right libGL.so is being picked by doing
@@ -26,6 +25,7 @@ ensure the right libGL.so is being picked by doing
and then try running
+ export XMESA_TRACE=y
GALLIUM_TRACE=tri.trace progs/trivial/tri
which should create a tri.trace file, which is an XML file. You can view copying
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index c8949729047..d8d5821a1d1 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -58,16 +58,14 @@ static INLINE struct pipe_texture *
trace_texture_unwrap(struct trace_context *tr_ctx,
struct pipe_texture *texture)
{
- struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
struct trace_texture *tr_tex;
if(!texture)
return NULL;
- tr_tex = trace_texture(tr_scr, texture);
+ tr_tex = trace_texture(texture);
assert(tr_tex->texture);
- assert(tr_tex->texture->screen == tr_scr->screen);
return tr_tex->texture;
}
@@ -77,7 +75,6 @@ trace_surface_unwrap(struct trace_context *tr_ctx,
struct pipe_surface *surface)
{
struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
- struct trace_texture *tr_tex;
struct trace_surface *tr_surf;
if(!surface)
@@ -87,8 +84,7 @@ trace_surface_unwrap(struct trace_context *tr_ctx,
if(!surface->texture)
return surface;
- tr_tex = trace_texture(tr_scr, surface->texture);
- tr_surf = trace_surface(tr_tex, surface);
+ tr_surf = trace_surface(surface);
assert(tr_surf->surface);
assert(tr_surf->surface->texture->screen == tr_scr->screen);
@@ -973,21 +969,23 @@ trace_context_surface_fill(struct pipe_context *_pipe,
static INLINE void
trace_context_clear(struct pipe_context *_pipe,
- struct pipe_surface *surface,
- unsigned clearValue)
+ unsigned buffers,
+ const float *rgba,
+ double depth,
+ unsigned stencil)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
- surface = trace_surface_unwrap(tr_ctx, surface);
-
trace_dump_call_begin("pipe_context", "clear");
trace_dump_arg(ptr, pipe);
- trace_dump_arg(ptr, surface);
- trace_dump_arg(uint, clearValue);
+ trace_dump_arg(uint, buffers);
+ trace_dump_arg_array(float, rgba, 4);
+ trace_dump_arg(float, depth);
+ trace_dump_arg(uint, stencil);
- pipe->clear(pipe, surface, clearValue);;
+ pipe->clear(pipe, buffers, rgba, depth, stencil);
trace_dump_call_end();
}
@@ -1037,9 +1035,9 @@ struct pipe_context *
trace_context_create(struct pipe_screen *_screen,
struct pipe_context *pipe)
{
- struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_screen *tr_scr;
struct trace_context *tr_ctx;
- struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_screen *screen;
if(!pipe)
goto error1;
@@ -1047,6 +1045,9 @@ trace_context_create(struct pipe_screen *_screen,
if(!trace_dump_enabled())
goto error1;
+ tr_scr = trace_screen(_screen);
+ screen = tr_scr->screen;
+
tr_ctx = CALLOC_STRUCT(trace_context);
if(!tr_ctx)
goto error1;
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index 6837c94542d..2618883e70d 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -40,11 +40,12 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#include <stdlib.h>
#endif
#include "pipe/p_compiler.h"
+#include "pipe/p_thread.h"
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "util/u_string.h"
@@ -58,6 +59,8 @@
static struct util_stream *stream = NULL;
static unsigned refcount = 0;
+static pipe_mutex call_mutex;
+static long unsigned call_no = 0;
static INLINE void
@@ -218,6 +221,8 @@ trace_dump_trace_close(void)
util_stream_close(stream);
stream = NULL;
refcount = 0;
+ call_no = 0;
+ pipe_mutex_destroy(call_mutex);
}
}
@@ -235,11 +240,13 @@ boolean trace_dump_trace_begin()
if(!stream)
return FALSE;
+ pipe_mutex_init(call_mutex);
+
trace_dump_writes("<?xml version='1.0' encoding='UTF-8'?>\n");
trace_dump_writes("<?xml-stylesheet type='text/xsl' href='trace.xsl'?>\n");
trace_dump_writes("<trace version='0.1'>\n");
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
/* Linux applications rarely cleanup GL / Gallium resources so catch
* application exit here */
atexit(trace_dump_trace_close);
@@ -265,8 +272,16 @@ void trace_dump_trace_end(void)
void trace_dump_call_begin(const char *klass, const char *method)
{
+ pipe_mutex_lock(call_mutex);
+ ++call_no;
trace_dump_indent(1);
- trace_dump_tag_begin2("call", "class", klass, "method", method);
+ trace_dump_writes("<call no=\'");
+ trace_dump_writef("%lu", call_no);
+ trace_dump_writes("\' class =\'");
+ trace_dump_escape(klass);
+ trace_dump_writes("\' method=\'");
+ trace_dump_escape(method);
+ trace_dump_writes("\'>");
trace_dump_newline();
}
@@ -276,6 +291,7 @@ void trace_dump_call_end(void)
trace_dump_tag_end("call");
trace_dump_newline();
util_stream_flush(stream);
+ pipe_mutex_unlock(call_mutex);
}
void trace_dump_arg_begin(const char *name)
@@ -420,8 +436,7 @@ void trace_dump_buffer_ptr(struct pipe_buffer *_buffer)
void trace_dump_texture_ptr(struct pipe_texture *_texture)
{
if (_texture) {
- struct trace_screen *tr_scr = trace_screen(_texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+ struct trace_texture *tr_tex = trace_texture(_texture);
trace_dump_ptr(tr_tex->texture);
} else {
trace_dump_null();
@@ -431,9 +446,7 @@ void trace_dump_texture_ptr(struct pipe_texture *_texture)
void trace_dump_surface_ptr(struct pipe_surface *_surface)
{
if (_surface) {
- struct trace_screen *tr_scr = trace_screen(_surface->texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
- struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+ struct trace_surface *tr_surf = trace_surface(_surface);
trace_dump_ptr(tr_surf->surface);
} else {
trace_dump_null();
@@ -443,9 +456,7 @@ void trace_dump_surface_ptr(struct pipe_surface *_surface)
void trace_dump_transfer_ptr(struct pipe_transfer *_transfer)
{
if (_transfer) {
- struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
- struct trace_transfer *tr_tran = trace_transfer(tr_tex, _transfer);
+ struct trace_transfer *tr_tran = trace_transfer(_transfer);
trace_dump_ptr(tr_tran->transfer);
} else {
trace_dump_null();
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 954576d7217..67925053833 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -159,8 +159,7 @@ trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
void *context_private)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
- struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+ struct trace_surface *tr_surf = trace_surface(_surface);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_surface *surface = tr_surf->surface;
@@ -242,7 +241,7 @@ static void
trace_screen_texture_destroy(struct pipe_texture *_texture)
{
struct trace_screen *tr_scr = trace_screen(_texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+ struct trace_texture *tr_tex = trace_texture(_texture);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_texture *texture = tr_tex->texture;
@@ -255,7 +254,7 @@ trace_screen_texture_destroy(struct pipe_texture *_texture)
trace_dump_call_end();
- trace_texture_destroy(tr_scr, _texture);
+ trace_texture_destroy(tr_tex);
}
@@ -272,7 +271,7 @@ trace_screen_get_tex_surface(struct pipe_screen *_screen,
unsigned usage)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+ struct trace_texture *tr_tex = trace_texture(_texture);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_texture *texture = tr_tex->texture;
struct pipe_surface *result = NULL;
@@ -304,8 +303,7 @@ static void
trace_screen_tex_surface_destroy(struct pipe_surface *_surface)
{
struct trace_screen *tr_scr = trace_screen(_surface->texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
- struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+ struct trace_surface *tr_surf = trace_surface(_surface);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_surface *surface = tr_surf->surface;
@@ -316,7 +314,7 @@ trace_screen_tex_surface_destroy(struct pipe_surface *_surface)
trace_dump_call_end();
- trace_surface_destroy(tr_tex, _surface);
+ trace_surface_destroy(tr_surf);
}
@@ -334,7 +332,7 @@ trace_screen_get_tex_transfer(struct pipe_screen *_screen,
unsigned x, unsigned y, unsigned w, unsigned h)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+ struct trace_texture *tr_tex = trace_texture(_texture);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_texture *texture = tr_tex->texture;
struct pipe_transfer *result = NULL;
@@ -372,10 +370,9 @@ static void
trace_screen_tex_transfer_destroy(struct pipe_transfer *_transfer)
{
struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
- struct trace_transfer *tr_tran = trace_transfer(tr_tex, _transfer);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
struct pipe_screen *screen = tr_scr->screen;
- struct pipe_transfer *transfer = tr_tran->transfer;
+ struct pipe_transfer *transfer = tr_trans->transfer;
trace_dump_call_begin("pipe_screen", "tex_transfer_destroy");
@@ -384,7 +381,7 @@ trace_screen_tex_transfer_destroy(struct pipe_transfer *_transfer)
trace_dump_call_end();
- trace_transfer_destroy(tr_tex, _transfer);
+ trace_transfer_destroy(tr_trans);
}
@@ -393,8 +390,7 @@ trace_screen_transfer_map(struct pipe_screen *_screen,
struct pipe_transfer *_transfer)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
- struct trace_transfer *tr_trans = trace_transfer(tr_tex, _transfer);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_transfer *transfer = tr_trans->transfer;
void *map;
@@ -416,8 +412,7 @@ trace_screen_transfer_unmap(struct pipe_screen *_screen,
struct pipe_transfer *_transfer)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
- struct trace_transfer *tr_trans = trace_transfer(tr_tex, _transfer);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_transfer *transfer = tr_trans->transfer;
@@ -706,7 +701,7 @@ trace_screen_buffer_unmap(struct pipe_screen *_screen,
struct pipe_buffer *buffer = tr_buf->buffer;
if (tr_buf->map && !tr_buf->range_flushed)
- buffer_write(screen, buffer, tr_buf->map, 0, buffer->size);
+ buffer_write(screen, buffer, 0, tr_buf->map, buffer->size);
tr_buf->map = NULL;
tr_buf->range_flushed = FALSE;
screen->buffer_unmap(screen, buffer);
diff --git a/src/gallium/drivers/trace/tr_state.c b/src/gallium/drivers/trace/tr_state.c
index f9fbe9aee79..a9570c1aebd 100644
--- a/src/gallium/drivers/trace/tr_state.c
+++ b/src/gallium/drivers/trace/tr_state.c
@@ -406,8 +406,6 @@ void trace_dump_surface(const struct pipe_surface *state)
trace_dump_reference(&state->reference);
trace_dump_member(format, state, format);
- trace_dump_member(uint, state, status);
- trace_dump_member(uint, state, clear_value);
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c
index 7b392f07286..f4e433792b1 100644
--- a/src/gallium/drivers/trace/tr_texture.c
+++ b/src/gallium/drivers/trace/tr_texture.c
@@ -62,10 +62,8 @@ error:
void
-trace_texture_destroy(struct trace_screen *tr_scr,
- struct pipe_texture *texture)
+trace_texture_destroy(struct trace_texture *tr_tex)
{
- struct trace_texture *tr_tex = trace_texture(tr_scr, texture);
pipe_texture_reference(&tr_tex->texture, NULL);
FREE(tr_tex);
}
@@ -102,10 +100,8 @@ error:
void
-trace_surface_destroy(struct trace_texture *tr_tex,
- struct pipe_surface *surface)
+trace_surface_destroy(struct trace_surface *tr_surf)
{
- struct trace_surface *tr_surf = trace_surface(tr_tex, surface);
pipe_texture_reference(&tr_surf->base.texture, NULL);
pipe_surface_reference(&tr_surf->surface, NULL);
FREE(tr_surf);
@@ -143,10 +139,8 @@ error:
void
-trace_transfer_destroy(struct trace_texture *tr_tex,
- struct pipe_transfer *transfer)
+trace_transfer_destroy(struct trace_transfer *tr_trans)
{
- struct trace_transfer *tr_trans = trace_transfer(tr_tex, transfer);
struct pipe_screen *screen = tr_trans->transfer->texture->screen;
pipe_texture_reference(&tr_trans->base.texture, NULL);
screen->tex_transfer_destroy(tr_trans->transfer);
diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h
index 9c21bc7d276..14dafd8b2c3 100644
--- a/src/gallium/drivers/trace/tr_texture.h
+++ b/src/gallium/drivers/trace/tr_texture.h
@@ -62,37 +62,31 @@ struct trace_transfer
static INLINE struct trace_texture *
-trace_texture(struct trace_screen *tr_scr,
- struct pipe_texture *texture)
+trace_texture(struct pipe_texture *texture)
{
if(!texture)
return NULL;
- assert(tr_scr);
- assert(texture->screen == &tr_scr->base);
+ (void)trace_screen(texture->screen);
return (struct trace_texture *)texture;
}
static INLINE struct trace_surface *
-trace_surface(struct trace_texture *tr_tex,
- struct pipe_surface *surface)
+trace_surface(struct pipe_surface *surface)
{
if(!surface)
return NULL;
- assert(tr_tex);
- assert(surface->texture == &tr_tex->base);
+ (void)trace_texture(surface->texture);
return (struct trace_surface *)surface;
}
static INLINE struct trace_transfer *
-trace_transfer(struct trace_texture *tr_tex,
- struct pipe_transfer *transfer)
+trace_transfer(struct pipe_transfer *transfer)
{
if(!transfer)
return NULL;
- assert(tr_tex);
- assert(transfer->texture == &tr_tex->base);
+ (void)trace_texture(transfer->texture);
return (struct trace_transfer *)transfer;
}
@@ -102,24 +96,21 @@ trace_texture_create(struct trace_screen *tr_scr,
struct pipe_texture *texture);
void
-trace_texture_destroy(struct trace_screen *tr_scr,
- struct pipe_texture *texture);
+trace_texture_destroy(struct trace_texture *tr_tex);
struct pipe_surface *
trace_surface_create(struct trace_texture *tr_tex,
struct pipe_surface *surface);
void
-trace_surface_destroy(struct trace_texture *tr_tex,
- struct pipe_surface *surface);
+trace_surface_destroy(struct trace_surface *tr_surf);
struct pipe_transfer *
trace_transfer_create(struct trace_texture *tr_tex,
struct pipe_transfer *transfer);
void
-trace_transfer_destroy(struct trace_texture *tr_tex,
- struct pipe_transfer *transfer);
+trace_transfer_destroy(struct trace_transfer *tr_trans);
#endif /* TR_TEXTURE_H_ */
diff --git a/src/gallium/drivers/trace/trace.xsl b/src/gallium/drivers/trace/trace.xsl
index 9cd621e7ab9..7be95e0e753 100644
--- a/src/gallium/drivers/trace/trace.xsl
+++ b/src/gallium/drivers/trace/trace.xsl
@@ -68,6 +68,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<xsl:template match="call">
<li>
+ <xsl:attribute name="value">
+ <xsl:apply-templates select="@no"/>
+ </xsl:attribute>
<span class="fun">
<xsl:value-of select="@class"/>
<xsl:text>::</xsl:text>
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index bc2a0a7ef3a..e6a67f8c2fd 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -124,11 +124,30 @@ typedef unsigned char boolean;
# define INLINE inline
# elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
# define INLINE __inline
+# elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
+# define INLINE inline
+# elif (__STDC_VERSION__ >= 199901L) /* C99 */
+# define INLINE inline
# else
# define INLINE
# endif
#endif
+/* The __FUNCTION__ gcc variable is generally only used for debugging.
+ * If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
+ */
+#ifndef __FUNCTION__
+# if (!defined(__GNUC__) || (__GNUC__ < 2))
+# if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
+ (defined(__SUNPRO_C) && defined(__C99FEATURES__))
+# define __FUNCTION__ __func__
+# else
+# define __FUNCTION__ "<unknown>"
+# endif
+# endif
+#endif
+
+
/* This should match linux gcc cdecl semantics everywhere, so that we
* just codegen one calling convention on all platforms.
diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h
index 7f7657031d8..63238ea46e9 100644
--- a/src/gallium/include/pipe/p_config.h
+++ b/src/gallium/include/pipe/p_config.h
@@ -77,11 +77,11 @@
* Processor architecture
*/
-#if defined(__i386__) /* gcc */ || defined(_M_IX86) /* msvc */ || defined(_X86_) || defined(__386__) || defined(i386)
+#if defined(__i386__) /* gcc */ || defined(_M_IX86) /* msvc */ || defined(_X86_) || defined(__386__) || defined(i386) || defined(__i386) /* Sun cc */
#define PIPE_ARCH_X86
#endif
-#if defined(__x86_64__) /* gcc */ || defined(_M_X64) /* msvc */ || defined(_M_AMD64) /* msvc */
+#if defined(__x86_64__) /* gcc */ || defined(_M_X64) /* msvc */ || defined(_M_AMD64) /* msvc */ || defined(__x86_64) /* Sun cc */
#define PIPE_ARCH_X86_64
#endif
@@ -115,6 +115,10 @@
#define PIPE_OS_BSD
#endif
+#if defined(__sun)
+#define PIPE_OS_SOLARIS
+#endif
+
#if defined(_WIN32) || defined(WIN32)
#define PIPE_OS_WINDOWS
#endif
@@ -126,9 +130,9 @@
* NOTE: There is no way to auto-detect most of these.
*/
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#define PIPE_SUBSYSTEM_DRI
-#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */
+#endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
#if defined(PIPE_OS_WINDOWS)
#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 2452bf3522b..29095dcdc3b 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -205,12 +205,20 @@ struct pipe_context {
unsigned dstx, unsigned dsty,
unsigned width, unsigned height,
unsigned value);
-
- void (*clear)(struct pipe_context *pipe,
- struct pipe_surface *ps,
- unsigned clearValue);
/*@}*/
+ /**
+ * Clear the specified set of currently bound buffers to specified values.
+ *
+ * buffers is a bitfield of PIPE_CLEAR_* values.
+ *
+ * rgba is a pointer to an array of one float for each of r, g, b, a.
+ */
+ void (*clear)(struct pipe_context *pipe,
+ unsigned buffers,
+ const float *rgba,
+ double depth,
+ unsigned stencil);
/** Flush rendering (flags = bitmask of PIPE_FLUSH_x tokens) */
void (*flush)( struct pipe_context *pipe,
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 52d443970b0..81defa445bf 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -186,11 +186,12 @@ enum pipe_texture_target {
/**
- * Surface status
+ * Clear buffer bits
*/
-#define PIPE_SURFACE_STATUS_UNDEFINED 0
-#define PIPE_SURFACE_STATUS_DEFINED 1
-#define PIPE_SURFACE_STATUS_CLEAR 2
+/** All color buffers currently bound */
+#define PIPE_CLEAR_COLOR (1 << 0)
+/** Depth/stencil combined */
+#define PIPE_CLEAR_DEPTHSTENCIL (1 << 1)
/**
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 3f65a604364..a279eefef9e 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -537,6 +537,13 @@ pf_get_nblocks(const struct pipe_format_block *block, unsigned width, unsigned h
}
static INLINE boolean
+pf_is_depth_stencil( enum pipe_format format )
+{
+ return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) +
+ pf_get_component_bits( format, PIPE_FORMAT_COMP_S )) != 0;
+}
+
+static INLINE boolean
pf_is_compressed( enum pipe_format format )
{
return pf_layout(format) == PIPE_FORMAT_LAYOUT_DXT ? TRUE : FALSE;
diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h
index 60844e40a57..1f89453e09a 100644
--- a/src/gallium/include/pipe/p_refcnt.h
+++ b/src/gallium/include/pipe/p_refcnt.h
@@ -51,6 +51,13 @@ pipe_reference_init(struct pipe_reference *reference, unsigned count)
}
+static INLINE bool
+pipe_is_referenced(struct pipe_reference *reference)
+{
+ return p_atomic_read(&reference->count) != 0;
+}
+
+
/**
* Set 'ptr' to point to 'reference' and update reference counting.
* The old thing pointed to, if any, will be unreferenced first.
@@ -65,12 +72,12 @@ pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference)
/* bump the reference.count first */
if (reference) {
- assert(p_atomic_read(&reference->count) != 0);
+ assert(pipe_is_referenced(reference));
p_atomic_inc(&reference->count);
}
if (*ptr) {
- assert(p_atomic_read(&(*ptr)->count) != 0);
+ assert(pipe_is_referenced(*ptr));
if (p_atomic_dec_zero(&(*ptr)->count)) {
destroy = TRUE;
}
@@ -81,6 +88,7 @@ pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference)
return destroy;
}
+
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 9c7baa3d92e..705ae68ec65 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -281,8 +281,6 @@ struct pipe_surface
{
struct pipe_reference reference;
enum pipe_format format; /**< PIPE_FORMAT_x */
- unsigned status; /**< PIPE_SURFACE_STATUS_x */
- unsigned clear_value; /**< XXX may be temporary */
unsigned width; /**< logical width in pixels */
unsigned height; /**< logical height in pixels */
unsigned layout; /**< PIPE_SURFACE_LAYOUT_x */
diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h
index a9cd77541d4..de55e99ed49 100644
--- a/src/gallium/include/pipe/p_thread.h
+++ b/src/gallium/include/pipe/p_thread.h
@@ -38,7 +38,7 @@
#include "pipe/p_compiler.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#include <pthread.h> /* POSIX threads headers */
#include <stdio.h> /* for perror() */
@@ -210,7 +210,7 @@ typedef unsigned pipe_condvar;
*/
typedef struct {
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
pthread_key_t key;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
DWORD key;
@@ -225,7 +225,7 @@ typedef struct {
static INLINE void
pipe_tsd_init(pipe_tsd *tsd)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
perror("pthread_key_create(): failed to allocate key for thread specific data");
exit(-1);
@@ -242,7 +242,7 @@ pipe_tsd_get(pipe_tsd *tsd)
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
pipe_tsd_init(tsd);
}
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
return pthread_getspecific(tsd->key);
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
assert(0);
@@ -259,7 +259,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value)
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
pipe_tsd_init(tsd);
}
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
if (pthread_setspecific(tsd->key, value) != 0) {
perror("pthread_set_specific() failed");
exit(-1);
diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c
index e6e80b985aa..489aa8d9af5 100644
--- a/src/gallium/state_trackers/egl/egl_surface.c
+++ b/src/gallium/state_trackers/egl/egl_surface.c
@@ -330,6 +330,13 @@ drm_show_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy,
if (ret)
goto err_crtc;
+
+ if (scrn->dpms)
+ drmModeConnectorSetProperty(dev->drmFD,
+ scrn->connectorID,
+ scrn->dpms->prop_id,
+ DRM_MODE_DPMS_ON);
+
surf->screen = scrn;
scrn->surf = surf;
@@ -399,8 +406,6 @@ drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
/* TODO stuff here */
}
-
- st_notify_swapbuffers_complete(surf->stfb);
}
return EGL_TRUE;
diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c
index a22ef381b96..abdf84544f3 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.c
+++ b/src/gallium/state_trackers/egl/egl_tracker.c
@@ -66,10 +66,13 @@ drm_get_device_id(struct drm_device *device)
{
char path[512];
FILE *file;
+ char *ret;
/* TODO get the real minor */
int minor = 0;
+ device->deviceID = 0;
+
snprintf(path, sizeof(path), "/sys/class/drm/card%d/device/device", minor);
file = fopen(path, "r");
if (!file) {
@@ -77,7 +80,10 @@ drm_get_device_id(struct drm_device *device)
return;
}
- fgets(path, sizeof( path ), file);
+ ret = fgets(path, sizeof( path ), file);
+ if (!ret)
+ return;
+
sscanf(path, "%x", &device->deviceID);
fclose(file);
}
@@ -101,6 +107,25 @@ drm_add_modes_from_connector(_EGLScreen *screen, drmModeConnectorPtr connector)
}
}
+static void
+drm_find_dpms(struct drm_device *dev, struct drm_screen *screen)
+{
+ drmModeConnectorPtr c = screen->connector;
+ drmModePropertyPtr p;
+ int i;
+
+ for (i = 0; i < c->count_props; i++) {
+ p = drmModeGetProperty(dev->drmFD, c->props[i]);
+ if (!strcmp(p->name, "DPMS"))
+ break;
+
+ drmModeFreeProperty(p);
+ p = NULL;
+ }
+
+ screen->dpms = p;
+}
+
EGLBoolean
drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
{
@@ -154,6 +179,7 @@ drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
_eglInitScreen(&screen->base);
_eglAddScreen(disp, &screen->base);
drm_add_modes_from_connector(&screen->base, connector);
+ drm_find_dpms(dev, screen);
dev->screens[num_screens++] = screen;
}
dev->count_screens = num_screens;
@@ -200,6 +226,7 @@ drm_terminate(_EGLDriver *drv, EGLDisplay dpy)
if (screen->shown)
drm_takedown_shown_screen(drv, screen);
+ drmModeFreeProperty(screen->dpms);
drmModeFreeConnector(screen->connector);
_eglDestroyScreen(&screen->base);
dev->screens[i] = NULL;
diff --git a/src/gallium/state_trackers/egl/egl_tracker.h b/src/gallium/state_trackers/egl/egl_tracker.h
index 908bab5f9bf..ce2717de639 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.h
+++ b/src/gallium/state_trackers/egl/egl_tracker.h
@@ -114,6 +114,9 @@ struct drm_screen
drmModeConnectorPtr connector;
uint32_t connectorID;
+ /* dpms property */
+ drmModePropertyPtr dpms;
+
/* Has this screen been shown */
int shown;
diff --git a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
index b61b49a2f8a..16d4f1e32c9 100644
--- a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
+++ b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
@@ -98,7 +98,8 @@ static int vlResizeFrameBuffer
);
/* Clear to black, in case video doesn't fill the entire window */
- pipe->clear(pipe, basic_csc->framebuffer.cbufs[0], 0);
+ pipe->set_framebuffer_state(pipe, &basic_csc->framebuffer);
+ pipe->clear(pipe, PIPE_CLEAR_COLOR, 0, 0.0f, 0);
return 0;
}
diff --git a/src/gallium/state_trackers/python/README b/src/gallium/state_trackers/python/README
index 8f45fb6d1b7..e03d5468304 100644
--- a/src/gallium/state_trackers/python/README
+++ b/src/gallium/state_trackers/python/README
@@ -6,16 +6,27 @@ the python script perspective.
To build you'll need:
* Python (with development packages)
* SCons
-* SWIG
-* Python Imaging Library with TK support (for the samples)
+* SWIG, http://www.swig.org/download.html
+* Python Imaging Library with TK support, http://www.pythonware.com/products/pil/,
+ for the samples
+
+On a debian-based distro you can simply do:
+
+ aptitude install python-dev scons swig python-imaging python-imaging-tk
+
+On a Windows machine ensure the swig command is in your PATH.
Invoke scons on the top dir as
- scons statetrackers=python
+ scons debug=yes statetrackers=python drivers=softpipe,trace winsys=none
+
+To use it set PYTHONPATH appropriately, e.g, in Linux do:
+
+ export PYTHONPATH=$PWD/build/linux-x86-debug/gallium/state_trackers/python
-To use do
+or (in Windows)
- export PYTHONPATH=build/XXXX-XXXX-XXXX/gallium/state_trackers/python
+ set PYTHONPATH=%CD%\build\windows-x86-debug\gallium\state_trackers\python
and then try running
@@ -27,7 +38,6 @@ which should show a triangle.
This is still work in progress:
- errors are not handled properly and almost always result in crash
- state atoms with array members are awkward to set
-- there no efficient way to view images
--
-Jose Fonseca <jrfonseca@tungstengraphics.com>
+Jose Fonseca <jfonseca@vmware.com>
diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i
index 79e68de1df8..3f79cc1a3d7 100644
--- a/src/gallium/state_trackers/python/gallium.i
+++ b/src/gallium/state_trackers/python/gallium.i
@@ -37,13 +37,11 @@
%{
#include <stdio.h>
-#include <Python.h>
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/internal/p_winsys_screen.h"
#include "cso_cache/cso_context.h"
#include "util/u_draw_quad.h"
#include "util/u_tile.h"
@@ -58,7 +56,7 @@
%}
%include "typemaps.i"
-
+%include "exception.i"
%include "cstring.i"
%include "carrays.i"
@@ -71,8 +69,8 @@
%rename(Device) st_device;
%rename(Context) st_context;
%rename(Texture) pipe_texture;
-%rename(Surface) pipe_surface;
-%rename(Buffer) st_buffer;
+%rename(Surface) st_surface;
+%rename(Buffer) pipe_buffer;
%rename(BlendColor) pipe_blend_color;
%rename(Blend) pipe_blend_state;
diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i
index 1fdbdf98b26..a40aa1e5187 100644
--- a/src/gallium/state_trackers/python/p_context.i
+++ b/src/gallium/state_trackers/python/p_context.i
@@ -116,15 +116,17 @@ struct st_context {
}
void set_constant_buffer(unsigned shader, unsigned index,
- struct st_buffer *buffer )
+ struct pipe_buffer *buffer )
{
struct pipe_constant_buffer state;
memset(&state, 0, sizeof(state));
- state.buffer = buffer ? buffer->buffer : NULL;
+ state.buffer = buffer;
$self->pipe->set_constant_buffer($self->pipe, shader, index, &state);
}
- void set_framebuffer(const struct pipe_framebuffer_state *state ) {
+ void set_framebuffer(const struct pipe_framebuffer_state *state )
+ {
+ memcpy(&$self->framebuffer, state, sizeof *state);
cso_set_framebuffer($self->cso, state);
}
@@ -151,19 +153,19 @@ struct st_context {
}
void set_vertex_buffer(unsigned index,
- unsigned pitch,
+ unsigned stride,
unsigned max_index,
unsigned buffer_offset,
- struct st_buffer *buffer)
+ struct pipe_buffer *buffer)
{
unsigned i;
struct pipe_vertex_buffer state;
memset(&state, 0, sizeof(state));
- state.stride = pitch;
+ state.stride = stride;
state.max_index = max_index;
state.buffer_offset = buffer_offset;
- state.buffer = buffer ? buffer->buffer : NULL;
+ state.buffer = buffer;
memcpy(&$self->vertex_buffers[index], &state, sizeof(state));
@@ -198,22 +200,22 @@ struct st_context {
$self->pipe->draw_arrays($self->pipe, mode, start, count);
}
- void draw_elements( struct st_buffer *indexBuffer,
+ void draw_elements( struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
$self->pipe->draw_elements($self->pipe,
- indexBuffer->buffer,
+ indexBuffer,
indexSize,
mode, start, count);
}
- void draw_range_elements( struct st_buffer *indexBuffer,
+ void draw_range_elements( struct pipe_buffer *indexBuffer,
unsigned indexSize, unsigned minIndex, unsigned maxIndex,
unsigned mode, unsigned start, unsigned count)
{
$self->pipe->draw_range_elements($self->pipe,
- indexBuffer->buffer,
+ indexBuffer,
indexSize, minIndex, maxIndex,
mode, start, count);
}
@@ -256,32 +258,62 @@ error1:
flush(unsigned flags = 0) {
struct pipe_fence_handle *fence = NULL;
$self->pipe->flush($self->pipe, flags | PIPE_FLUSH_RENDER_CACHE, &fence);
- /* TODO: allow asynchronous operation */
- $self->pipe->winsys->fence_finish( $self->pipe->winsys, fence, 0 );
- $self->pipe->winsys->fence_reference( $self->pipe->winsys, &fence, NULL );
+ if(fence) {
+ /* TODO: allow asynchronous operation */
+ $self->pipe->screen->fence_finish( $self->pipe->screen, fence, 0 );
+ $self->pipe->screen->fence_reference( $self->pipe->screen, &fence, NULL );
+ }
}
/*
* Surface functions
*/
- void surface_copy(struct pipe_surface *dest,
+ void surface_copy(struct st_surface *dst,
unsigned destx, unsigned desty,
- struct pipe_surface *src,
+ struct st_surface *src,
unsigned srcx, unsigned srcy,
- unsigned width, unsigned height) {
- $self->pipe->surface_copy($self->pipe, dest, destx, desty, src, srcx, srcy, width, height);
+ unsigned width, unsigned height)
+ {
+ struct pipe_surface *_dst = NULL;
+ struct pipe_surface *_src = NULL;
+
+ _dst = st_pipe_surface(dst, PIPE_BUFFER_USAGE_GPU_WRITE);
+ if(!_dst)
+ SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
+
+ _src = st_pipe_surface(src, PIPE_BUFFER_USAGE_GPU_READ);
+ if(!_src)
+ SWIG_exception(SWIG_ValueError, "couldn't acquire source surface for reading");
+
+ $self->pipe->surface_copy($self->pipe, _dst, destx, desty, _src, srcx, srcy, width, height);
+
+ fail:
+ pipe_surface_reference(&_src, NULL);
+ pipe_surface_reference(&_dst, NULL);
}
- void surface_fill(struct pipe_surface *dst,
+ void surface_fill(struct st_surface *dst,
unsigned x, unsigned y,
unsigned width, unsigned height,
- unsigned value) {
- $self->pipe->surface_fill($self->pipe, dst, x, y, width, height, value);
+ unsigned value)
+ {
+ struct pipe_surface *_dst = NULL;
+
+ _dst = st_pipe_surface(dst, PIPE_BUFFER_USAGE_GPU_WRITE);
+ if(!_dst)
+ SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
+
+ $self->pipe->surface_fill($self->pipe, _dst, x, y, width, height, value);
+
+ fail:
+ pipe_surface_reference(&_dst, NULL);
}
- void surface_clear(struct pipe_surface *surface, unsigned value = 0) {
- $self->pipe->clear($self->pipe, surface, value);
+ void clear(unsigned buffers, const float *rgba, double depth = 0.0f,
+ unsigned stencil = 0)
+ {
+ $self->pipe->clear($self->pipe, buffers, rgba, depth, stencil);
}
};
diff --git a/src/gallium/state_trackers/python/p_device.i b/src/gallium/state_trackers/python/p_device.i
index 84fd2e4349b..f16fe5b0ff7 100644
--- a/src/gallium/state_trackers/python/p_device.i
+++ b/src/gallium/state_trackers/python/p_device.i
@@ -122,9 +122,9 @@ struct st_device {
return $self->screen->texture_create($self->screen, &templat);
}
- struct st_buffer *
+ struct pipe_buffer *
buffer_create(unsigned size, unsigned alignment = 0, unsigned usage = 0) {
- return st_buffer_create($self, alignment, usage, size);
+ return pipe_buffer_create($self->screen, alignment, usage, size);
}
};
diff --git a/src/gallium/state_trackers/python/p_state.i b/src/gallium/state_trackers/python/p_state.i
index 110b3d5da43..90f157e0ab0 100644
--- a/src/gallium/state_trackers/python/p_state.i
+++ b/src/gallium/state_trackers/python/p_state.i
@@ -59,13 +59,40 @@
}
void
- set_cbuf(unsigned index, struct pipe_surface *surface) {
- pipe_surface_reference(&$self->cbufs[index], surface);
+ set_cbuf(unsigned index, struct st_surface *surface)
+ {
+ struct pipe_surface *_surface = NULL;
+
+ if(index >= PIPE_MAX_COLOR_BUFS)
+ SWIG_exception(SWIG_ValueError, "index out of bounds");
+
+ if(surface) {
+ _surface = st_pipe_surface(surface, PIPE_BUFFER_USAGE_GPU_WRITE);
+ if(!_surface)
+ SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
+ }
+
+ pipe_surface_reference(&$self->cbufs[index], _surface);
+
+ fail:
+ return;
}
void
- set_zsbuf(struct pipe_surface *surface) {
- pipe_surface_reference(&$self->zsbuf, surface);
+ set_zsbuf(struct st_surface *surface)
+ {
+ struct pipe_surface *_surface = NULL;
+
+ if(surface) {
+ _surface = st_pipe_surface(surface, PIPE_BUFFER_USAGE_GPU_WRITE);
+ if(!_surface)
+ SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
+ }
+
+ pipe_surface_reference(&$self->zsbuf, _surface);
+
+ fail:
+ return;
}
};
diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i
index 1e64fc8e41f..f41a95e6eb0 100644
--- a/src/gallium/state_trackers/python/p_texture.i
+++ b/src/gallium/state_trackers/python/p_texture.i
@@ -34,18 +34,19 @@
%nodefaultctor pipe_texture;
-%nodefaultctor pipe_surface;
-%nodefaultctor st_buffer;
+%nodefaultctor st_surface;
+%nodefaultctor pipe_buffer;
%nodefaultdtor pipe_texture;
-%nodefaultdtor pipe_surface;
-%nodefaultdtor st_buffer;
+%nodefaultdtor st_surface;
+%nodefaultdtor pipe_buffer;
%ignore pipe_texture::screen;
-%ignore pipe_surface::winsys;
-%immutable pipe_surface::texture;
-%immutable pipe_surface::buffer;
+%immutable st_surface::texture;
+%immutable st_surface::face;
+%immutable st_surface::level;
+%immutable st_surface::zslice;
%newobject pipe_texture::get_surface;
@@ -78,54 +79,160 @@
}
/** Get a surface which is a "view" into a texture */
- struct pipe_surface *
- get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0, unsigned usage=0 )
+ struct st_surface *
+ get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0)
{
- struct pipe_screen *screen = $self->screen;
- return screen->get_tex_surface(screen, $self, face, level, zslice, usage);
+ struct st_surface *surface;
+
+ if(face >= ($self->target == PIPE_TEXTURE_CUBE ? 6U : 1U))
+ SWIG_exception(SWIG_ValueError, "face out of bounds");
+ if(level > $self->last_level)
+ SWIG_exception(SWIG_ValueError, "level out of bounds");
+ if(zslice >= $self->depth[level])
+ SWIG_exception(SWIG_ValueError, "zslice out of bounds");
+
+ surface = CALLOC_STRUCT(st_surface);
+ if(!surface)
+ return NULL;
+
+ pipe_texture_reference(&surface->texture, $self);
+ surface->face = face;
+ surface->level = level;
+ surface->zslice = zslice;
+
+ return surface;
+
+ fail:
+ return NULL;
}
};
+struct st_surface
+{
+ %immutable;
+
+ struct pipe_texture *texture;
+ unsigned face;
+ unsigned level;
+ unsigned zslice;
+
+};
-%extend pipe_surface {
+%extend st_surface {
+
+ %immutable;
- ~pipe_surface() {
- struct pipe_surface *ptr = $self;
- pipe_surface_reference(&ptr, NULL);
+ unsigned format;
+ unsigned width;
+ unsigned height;
+ unsigned nblocksx;
+ unsigned nblocksy;
+
+ ~st_surface() {
+ pipe_texture_reference(&$self->texture, NULL);
+ FREE($self);
}
- // gets mapped to pipe_surface_map automatically
- void * map( unsigned flags );
+ %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
+ void get_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH)
+ {
+ struct pipe_texture *texture = $self->texture;
+ struct pipe_screen *screen = texture->screen;
+ struct pipe_transfer *transfer;
+ unsigned stride;
- // gets mapped to pipe_surface_unmap automatically
- void unmap( void );
+ stride = pf_get_nblocksx(&texture->block, w) * texture->block.size;
+ *LENGTH = pf_get_nblocksy(&texture->block, h) * stride;
+ *STRING = (char *) malloc(*LENGTH);
+ if(!*STRING)
+ return;
- void
- get_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, char *raw, unsigned stride) {
- pipe_get_tile_raw($self, x, y, w, h, raw, stride);
+ transfer = screen->get_tex_transfer(screen,
+ $self->texture,
+ $self->face,
+ $self->level,
+ $self->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
+ if(transfer) {
+ pipe_get_tile_raw(transfer, 0, 0, w, h, *STRING, stride);
+ screen->tex_transfer_destroy(transfer);
+ }
}
- void
- put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const char *raw, unsigned stride) {
- pipe_put_tile_raw($self, x, y, w, h, raw, stride);
+ %cstring_input_binary(const char *STRING, unsigned LENGTH);
+ void put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const char *STRING, unsigned LENGTH, unsigned stride = 0)
+ {
+ struct pipe_texture *texture = $self->texture;
+ struct pipe_screen *screen = texture->screen;
+ struct pipe_transfer *transfer;
+
+ if(stride == 0)
+ stride = pf_get_nblocksx(&texture->block, w) * texture->block.size;
+
+ if(LENGTH < pf_get_nblocksy(&texture->block, h) * stride)
+ SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
+
+ transfer = screen->get_tex_transfer(screen,
+ $self->texture,
+ $self->face,
+ $self->level,
+ $self->zslice,
+ PIPE_TRANSFER_WRITE,
+ x, y, w, h);
+ if(!transfer)
+ SWIG_exception(SWIG_MemoryError, "couldn't initiate transfer");
+
+ pipe_put_tile_raw(transfer, 0, 0, w, h, STRING, stride);
+ screen->tex_transfer_destroy(transfer);
+
+ fail:
+ return;
}
void
- get_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, float *rgba) {
- pipe_get_tile_rgba($self, x, y, w, h, rgba);
+ get_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, float *rgba)
+ {
+ struct pipe_screen *screen = $self->texture->screen;
+ struct pipe_transfer *transfer;
+ transfer = screen->get_tex_transfer(screen,
+ $self->texture,
+ $self->face,
+ $self->level,
+ $self->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
+ if(transfer) {
+ pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba);
+ screen->tex_transfer_destroy(transfer);
+ }
}
void
- put_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba) {
- pipe_put_tile_rgba($self, x, y, w, h, rgba);
+ put_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba)
+ {
+ struct pipe_screen *screen = $self->texture->screen;
+ struct pipe_transfer *transfer;
+ transfer = screen->get_tex_transfer(screen,
+ $self->texture,
+ $self->face,
+ $self->level,
+ $self->zslice,
+ PIPE_TRANSFER_WRITE,
+ x, y, w, h);
+ if(transfer) {
+ pipe_put_tile_rgba(transfer, 0, 0, w, h, rgba);
+ screen->tex_transfer_destroy(transfer);
+ }
}
%cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
void
get_tile_rgba8(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH)
{
- unsigned surface_usage;
+ struct pipe_screen *screen = $self->texture->screen;
+ struct pipe_transfer *transfer;
float *rgba;
unsigned char *rgba8;
unsigned i, j, k;
@@ -141,38 +248,67 @@
if(!*STRING)
return;
- rgba = malloc(w*4*sizeof(float));
+ rgba = malloc(h*w*4*sizeof(float));
if(!rgba)
return;
rgba8 = (unsigned char *) *STRING;
- /* XXX: force mappable surface */
- surface_usage = $self->usage;
- $self->usage |= PIPE_BUFFER_USAGE_CPU_READ;
-
- for(j = 0; j < h; ++j) {
- pipe_get_tile_rgba($self,
- x, y + j, w, 1,
- rgba);
- for(i = 0; i < w; ++i)
- for(k = 0; k <4; ++k)
- rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[i*4 + k]);
+ transfer = screen->get_tex_transfer(screen,
+ $self->texture,
+ $self->face,
+ $self->level,
+ $self->zslice,
+ PIPE_TRANSFER_READ,
+ x, y,
+ w, h);
+ if(transfer) {
+ pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba);
+ for(j = 0; j < h; ++j) {
+ for(i = 0; i < w; ++i)
+ for(k = 0; k <4; ++k)
+ rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[j*w*4 + i*4 + k]);
+ }
+ screen->tex_transfer_destroy(transfer);
}
- $self->usage = surface_usage;
-
free(rgba);
}
void
- get_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, unsigned *z) {
- pipe_get_tile_z($self, x, y, w, h, z);
+ get_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, unsigned *z)
+ {
+ struct pipe_screen *screen = $self->texture->screen;
+ struct pipe_transfer *transfer;
+ transfer = screen->get_tex_transfer(screen,
+ $self->texture,
+ $self->face,
+ $self->level,
+ $self->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
+ if(transfer) {
+ pipe_get_tile_z(transfer, 0, 0, w, h, z);
+ screen->tex_transfer_destroy(transfer);
+ }
}
void
- put_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, const unsigned *z) {
- pipe_put_tile_z($self, x, y, w, h, z);
+ put_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, const unsigned *z)
+ {
+ struct pipe_screen *screen = $self->texture->screen;
+ struct pipe_transfer *transfer;
+ transfer = screen->get_tex_transfer(screen,
+ $self->texture,
+ $self->face,
+ $self->level,
+ $self->zslice,
+ PIPE_TRANSFER_WRITE,
+ x, y, w, h);
+ if(transfer) {
+ pipe_put_tile_z(transfer, 0, 0, w, h, z);
+ screen->tex_transfer_destroy(transfer);
+ }
}
void
@@ -183,6 +319,8 @@
unsigned
compare_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba, float tol = 0.0)
{
+ struct pipe_screen *screen = $self->texture->screen;
+ struct pipe_transfer *transfer;
float *rgba2;
const float *p1;
const float *p2;
@@ -192,7 +330,20 @@
if(!rgba2)
return ~0;
- pipe_get_tile_rgba($self, x, y, w, h, rgba2);
+ transfer = screen->get_tex_transfer(screen,
+ $self->texture,
+ $self->face,
+ $self->level,
+ $self->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
+ if(!transfer) {
+ FREE(rgba2);
+ return ~0;
+ }
+
+ pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba2);
+ screen->tex_transfer_destroy(transfer);
p1 = rgba;
p2 = rgba2;
@@ -214,63 +365,86 @@
};
-struct st_buffer {
-};
+%{
+ static enum pipe_format
+ st_surface_format_get(struct st_surface *surface)
+ {
+ return surface->texture->format;
+ }
+
+ static unsigned
+ st_surface_width_get(struct st_surface *surface)
+ {
+ return surface->texture->width[surface->level];
+ }
+
+ static unsigned
+ st_surface_height_get(struct st_surface *surface)
+ {
+ return surface->texture->height[surface->level];
+ }
+
+ static unsigned
+ st_surface_nblocksx_get(struct st_surface *surface)
+ {
+ return surface->texture->nblocksx[surface->level];
+ }
+
+ static unsigned
+ st_surface_nblocksy_get(struct st_surface *surface)
+ {
+ return surface->texture->nblocksy[surface->level];
+ }
+%}
+
+/* Avoid naming conflict with p_inlines.h's pipe_buffer_read/write */
+%rename(read) read_;
+%rename(write) write_;
-%extend st_buffer {
+%extend pipe_buffer {
- ~st_buffer() {
- st_buffer_destroy($self);
+ ~pipe_buffer() {
+ struct pipe_buffer *ptr = $self;
+ pipe_buffer_reference(&ptr, NULL);
}
unsigned __len__(void)
{
- assert(p_atomic_read(&$self->buffer->reference.count) > 0);
- return $self->buffer->size;
+ assert(p_atomic_read(&$self->reference.count) > 0);
+ return $self->size;
}
%cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
- void read(char **STRING, int *LENGTH)
+ void read_(char **STRING, int *LENGTH)
{
- struct pipe_screen *screen = $self->st_dev->screen;
- const char *map;
+ struct pipe_screen *screen = $self->screen;
- assert(p_atomic_read(&$self->buffer->reference.count) > 0);
+ assert(p_atomic_read(&$self->reference.count) > 0);
- *LENGTH = $self->buffer->size;
- *STRING = (char *) malloc($self->buffer->size);
+ *LENGTH = $self->size;
+ *STRING = (char *) malloc($self->size);
if(!*STRING)
return;
- map = pipe_buffer_map(screen, $self->buffer, PIPE_BUFFER_USAGE_CPU_READ);
- if(map) {
- memcpy(*STRING, map, $self->buffer->size);
- pipe_buffer_unmap(screen, $self->buffer);
- }
+ pipe_buffer_read(screen, $self, 0, $self->size, STRING);
}
%cstring_input_binary(const char *STRING, unsigned LENGTH);
- void write(const char *STRING, unsigned LENGTH, unsigned offset = 0)
+ void write_(const char *STRING, unsigned LENGTH, unsigned offset = 0)
{
- struct pipe_screen *screen = $self->st_dev->screen;
- char *map;
+ struct pipe_screen *screen = $self->screen;
- assert(p_atomic_read(&$self->buffer->reference.count) > 0);
+ assert(p_atomic_read(&$self->reference.count) > 0);
- if(offset > $self->buffer->size) {
- PyErr_SetString(PyExc_ValueError, "offset must be smaller than buffer size");
- return;
- }
+ if(offset > $self->size)
+ SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
- if(offset + LENGTH > $self->buffer->size) {
- PyErr_SetString(PyExc_ValueError, "data length must fit inside the buffer");
- return;
- }
+ if(offset + LENGTH > $self->size)
+ SWIG_exception(SWIG_ValueError, "data length must fit inside the buffer");
- map = pipe_buffer_map(screen, $self->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
- if(map) {
- memcpy(map + offset, STRING, LENGTH);
- pipe_buffer_unmap(screen, $self->buffer);
- }
+ pipe_buffer_write(screen, $self, offset, LENGTH, STRING);
+
+fail:
+ return;
}
};
diff --git a/src/gallium/state_trackers/python/retrace/format.py b/src/gallium/state_trackers/python/retrace/format.py
index 0bf6baf0b94..a4285bfe075 100755
--- a/src/gallium/state_trackers/python/retrace/format.py
+++ b/src/gallium/state_trackers/python/retrace/format.py
@@ -27,6 +27,9 @@
##########################################################################
+import sys
+
+
class Formatter:
'''Plain formatter'''
@@ -91,10 +94,80 @@ class AnsiFormatter(Formatter):
self._escape(self._normal)
+class WindowsConsoleFormatter(Formatter):
+ '''Formatter for the Windows Console. See
+ http://code.activestate.com/recipes/496901/ for more information.
+ '''
+
+ STD_INPUT_HANDLE = -10
+ STD_OUTPUT_HANDLE = -11
+ STD_ERROR_HANDLE = -12
+
+ FOREGROUND_BLUE = 0x01
+ FOREGROUND_GREEN = 0x02
+ FOREGROUND_RED = 0x04
+ FOREGROUND_INTENSITY = 0x08
+ BACKGROUND_BLUE = 0x10
+ BACKGROUND_GREEN = 0x20
+ BACKGROUND_RED = 0x40
+ BACKGROUND_INTENSITY = 0x80
+
+ _normal = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED
+ _bold = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY
+ _italic = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED
+ _red = FOREGROUND_RED | FOREGROUND_INTENSITY
+ _green = FOREGROUND_GREEN | FOREGROUND_INTENSITY
+ _blue = FOREGROUND_BLUE | FOREGROUND_INTENSITY
+
+ def __init__(self, stream):
+ Formatter.__init__(self, stream)
+
+ if stream is sys.stdin:
+ nStdHandle = self.STD_INPUT_HANDLE
+ elif stream is sys.stdout:
+ nStdHandle = self.STD_OUTPUT_HANDLE
+ elif stream is sys.stderr:
+ nStdHandle = self.STD_ERROR_HANDLE
+ else:
+ nStdHandle = None
+
+ if nStdHandle:
+ import ctypes
+ self.handle = ctypes.windll.kernel32.GetStdHandle(nStdHandle)
+ else:
+ self.handle = None
+
+ def _attribute(self, attr):
+ if self.handle:
+ import ctypes
+ ctypes.windll.kernel32.SetConsoleTextAttribute(self.handle, attr)
+
+ def function(self, name):
+ self._attribute(self._bold)
+ Formatter.function(self, name)
+ self._attribute(self._normal)
+
+ def variable(self, name):
+ self._attribute(self._italic)
+ Formatter.variable(self, name)
+ self._attribute(self._normal)
+
+ def literal(self, value):
+ self._attribute(self._blue)
+ Formatter.literal(self, value)
+ self._attribute(self._normal)
+
+ def address(self, value):
+ self._attribute(self._green)
+ Formatter.address(self, value)
+ self._attribute(self._normal)
+
def DefaultFormatter(stream):
- if stream.isatty():
+ if sys.platform in ('linux2', 'cygwin'):
return AnsiFormatter(stream)
+ elif sys.platform in ('win32',):
+ return WindowsConsoleFormatter(stream)
else:
return Formatter(stream)
diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py
index e6999a2211e..5ea07724a50 100755
--- a/src/gallium/state_trackers/python/retrace/interpreter.py
+++ b/src/gallium/state_trackers/python/retrace/interpreter.py
@@ -54,14 +54,14 @@ def save_image(filename, surface):
outimage = make_image(surface)
outimage.save(filename, "PNG")
-def show_image(surface):
+def show_image(surface, title):
outimage = make_image(surface)
import Tkinter as tk
from PIL import Image, ImageTk
root = tk.Tk()
- root.title('background image')
+ root.title(title)
image1 = ImageTk.PhotoImage(outimage)
w = image1.width()
@@ -75,9 +75,6 @@ def show_image(surface):
root.mainloop()
-verbose = 1
-
-
class Struct:
"""C-like struct"""
@@ -184,8 +181,12 @@ class Global(Object):
def pipe_winsys_create(self):
return Winsys(self.interpreter, gallium.Device())
- def pipe_screen_create(self, winsys):
- return Screen(self.interpreter, winsys.real)
+ def pipe_screen_create(self, winsys=None):
+ if winsys is None:
+ real = gallium.Device()
+ else:
+ real = winsys.real
+ return Screen(self.interpreter, real)
def pipe_context_create(self, screen):
context = screen.real.context_create()
@@ -237,6 +238,16 @@ class Winsys(Object):
pass
+class Transfer:
+
+ def __init__(self, surface, x, y, w, h):
+ self.surface = surface
+ self.x = x
+ self.y = y
+ self.w = w
+ self.h = h
+
+
class Screen(Object):
def destroy(self):
@@ -257,15 +268,15 @@ class Screen(Object):
def is_format_supported(self, format, target, tex_usage, geom_flags):
return self.real.is_format_supported(format, target, tex_usage, geom_flags)
- def texture_create(self, template):
+ def texture_create(self, templat):
return self.real.texture_create(
- format = template.format,
- width = template.width[0],
- height = template.height[0],
- depth = template.depth[0],
- last_level = template.last_level,
- target = template.target,
- tex_usage = template.tex_usage,
+ format = templat.format,
+ width = templat.width[0],
+ height = templat.height[0],
+ depth = templat.depth[0],
+ last_level = templat.last_level,
+ target = templat.target,
+ tex_usage = templat.tex_usage,
)
def texture_destroy(self, texture):
@@ -275,7 +286,9 @@ class Screen(Object):
pass
def get_tex_surface(self, texture, face, level, zslice, usage):
- return texture.get_surface(face, level, zslice, usage)
+ if texture is None:
+ return None
+ return texture.get_surface(face, level, zslice)
def tex_surface_destroy(self, surface):
self.interpreter.unregister_object(surface)
@@ -284,9 +297,53 @@ class Screen(Object):
pass
def surface_write(self, surface, data, stride, size):
+ if surface is None:
+ return
assert surface.nblocksy * stride == size
surface.put_tile_raw(0, 0, surface.width, surface.height, data, stride)
+ def get_tex_transfer(self, texture, face, level, zslice, usage, x, y, w, h):
+ if texture is None:
+ return None
+ return Transfer(texture.get_surface(face, level, zslice), x, y, w, h)
+
+ def tex_transfer_destroy(self, transfer):
+ self.interpreter.unregister_object(transfer)
+
+ def transfer_write(self, transfer, stride, data, size):
+ if transfer is None:
+ return
+ transfer.surface.put_tile_raw(transfer.x, transfer.y, transfer.w, transfer.h, data, stride)
+
+ def user_buffer_create(self, data, size):
+ # We don't really care to distinguish between user and regular buffers
+ buffer = self.real.buffer_create(size,
+ 4,
+ gallium.PIPE_BUFFER_USAGE_CPU_READ |
+ gallium.PIPE_BUFFER_USAGE_CPU_WRITE )
+ assert size == len(data)
+ buffer.write(data)
+ return buffer
+
+ def buffer_create(self, alignment, usage, size):
+ return self.real.buffer_create(size, alignment, usage)
+
+ def buffer_destroy(self, buffer):
+ pass
+
+ def buffer_write(self, buffer, data, size, offset=0):
+ assert size == len(data)
+ buffer.write(data)
+
+ def fence_finish(self, fence, flags):
+ pass
+
+ def fence_reference(self, dst, src):
+ pass
+
+ def flush_frontbuffer(self, surface):
+ pass
+
class Context(Object):
@@ -317,8 +374,8 @@ class Context(Object):
def delete_sampler_state(self, state):
pass
- def bind_sampler_states(self, n, states):
- for i in range(n):
+ def bind_sampler_states(self, num_states, states):
+ for i in range(num_states):
self.real.set_sampler(i, states[i])
def create_rasterizer_state(self, state):
@@ -375,7 +432,7 @@ class Context(Object):
self.real.set_clip(_state)
def dump_constant_buffer(self, buffer):
- if verbose < 2:
+ if not self.interpreter.verbosity(2):
return
data = buffer.read()
@@ -386,17 +443,17 @@ class Context(Object):
sys.stdout.write('\tCONST[%2u] = {%10.4f, %10.4f, %10.4f, %10.4f}\n' % (index, x, y, z, w))
index += 1
- def set_constant_buffer(self, shader, index, state):
- if state is not None:
- self.real.set_constant_buffer(shader, index, state.buffer)
+ def set_constant_buffer(self, shader, index, buffer):
+ if buffer is not None:
+ self.real.set_constant_buffer(shader, index, buffer.buffer)
- self.dump_constant_buffer(state.buffer)
+ self.dump_constant_buffer(buffer.buffer)
def set_framebuffer_state(self, state):
_state = gallium.Framebuffer()
_state.width = state.width
_state.height = state.height
- _state.num_cbufs = state.num_cbufs
+ _state.nr_cbufs = state.nr_cbufs
for i in range(len(state.cbufs)):
_state.set_cbuf(i, state.cbufs[i])
_state.set_zsbuf(state.zsbuf)
@@ -414,34 +471,34 @@ class Context(Object):
def set_viewport_state(self, state):
self.real.set_viewport(state)
- def set_sampler_textures(self, n, textures):
- for i in range(n):
+ def set_sampler_textures(self, num_textures, textures):
+ for i in range(num_textures):
self.real.set_sampler_texture(i, textures[i])
- def set_vertex_buffers(self, n, vbufs):
- self.vbufs = vbufs[0:n]
- for i in range(n):
- vbuf = vbufs[i]
+ def set_vertex_buffers(self, num_buffers, buffers):
+ self.vbufs = buffers[0:num_buffers]
+ for i in range(num_buffers):
+ vbuf = buffers[i]
self.real.set_vertex_buffer(
i,
- pitch = vbuf.pitch,
+ stride = vbuf.stride,
max_index = vbuf.max_index,
buffer_offset = vbuf.buffer_offset,
buffer = vbuf.buffer,
)
- def set_vertex_elements(self, n, elements):
- self.velems = elements[0:n]
- for i in range(n):
+ def set_vertex_elements(self, num_elements, elements):
+ self.velems = elements[0:num_elements]
+ for i in range(num_elements):
self.real.set_vertex_element(i, elements[i])
- self.real.set_vertex_elements(n)
+ self.real.set_vertex_elements(num_elements)
def set_edgeflags(self, bitfield):
# FIXME
pass
def dump_vertices(self, start, count):
- if verbose < 2:
+ if not self.interpreter.verbosity(2):
return
for index in range(start, start + count):
@@ -452,7 +509,7 @@ class Context(Object):
for velem in self.velems:
vbuf = self.vbufs[velem.vertex_buffer_index]
- offset = vbuf.buffer_offset + velem.src_offset + vbuf.pitch*index
+ offset = vbuf.buffer_offset + velem.src_offset + vbuf.stride*index
format = {
gallium.PIPE_FORMAT_R32_FLOAT: 'f',
gallium.PIPE_FORMAT_R32G32_FLOAT: '2f',
@@ -468,7 +525,7 @@ class Context(Object):
sys.stdout.write('\t},\n')
def dump_indices(self, ibuf, isize, start, count):
- if verbose < 2:
+ if not self.interpreter.verbosity(2):
return
format = {
@@ -500,45 +557,51 @@ class Context(Object):
self.dump_vertices(start, count)
self.real.draw_arrays(mode, start, count)
-
- self.dirty = True
+ self._set_dirty()
def draw_elements(self, indexBuffer, indexSize, mode, start, count):
- if verbose >= 2:
+ if self.interpreter.verbosity(2):
minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count)
self.dump_vertices(minindex, maxindex - minindex)
self.real.draw_elements(indexBuffer, indexSize, mode, start, count)
-
- self.dirty = True
+ self._set_dirty()
def draw_range_elements(self, indexBuffer, indexSize, minIndex, maxIndex, mode, start, count):
- if verbose >= 2:
+ if self.interpreter.verbosity(2):
minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count)
minindex = min(minindex, minIndex)
maxindex = min(maxindex, maxIndex)
self.dump_vertices(minindex, maxindex - minindex)
self.real.draw_range_elements(indexBuffer, indexSize, minIndex, maxIndex, mode, start, count)
-
- self.dirty = True
+ self._set_dirty()
+ def _set_dirty(self):
+ if self.interpreter.options.step:
+ self._present()
+ else:
+ self.dirty = True
+
def flush(self, flags):
self.real.flush(flags)
if self.dirty:
if flags & gallium.PIPE_FLUSH_FRAME:
- self._update()
+ self._present()
self.dirty = False
return None
- def clear(self, surface, value):
- self.real.surface_clear(surface, value)
+ def clear(self, buffers, rgba, depth, stencil):
+ _rgba = gallium.FloatArray(4)
+ for i in range(4):
+ _rgba[i] = rgba[i]
+ self.real.clear(buffers, _rgba, depth, stencil)
- def _update(self):
+ def _present(self):
self.real.flush()
if self.cbufs and self.cbufs[0]:
- show_image(self.cbufs[0])
+ self.interpreter.present(self.cbufs[0], "cbuf")
class Interpreter(parser.TraceDumper):
@@ -549,11 +612,13 @@ class Interpreter(parser.TraceDumper):
('pipe_screen', 'get_paramf'),
))
- def __init__(self, stream):
+ def __init__(self, stream, options):
parser.TraceDumper.__init__(self, stream)
+ self.options = options
self.objects = {}
self.result = None
self.globl = Global(self, None)
+ self.call_no = None
def register_object(self, address, object):
self.objects[address] = object
@@ -570,31 +635,70 @@ class Interpreter(parser.TraceDumper):
self.interpret_call(call)
def handle_call(self, call):
+ if self.options.stop and call.no >= self.options.stop:
+ sys.exit(0)
if (call.klass, call.method) in self.ignore_calls:
return
- if verbose >= 1:
+ self.call_no = call.no
+
+ if self.verbosity(1):
parser.TraceDumper.handle_call(self, call)
- args = [self.interpret_arg(arg) for name, arg in call.args]
+ args = [(str(name), self.interpret_arg(arg)) for name, arg in call.args]
if call.klass:
- obj = args[0]
+ name, obj = args[0]
args = args[1:]
else:
obj = self.globl
method = getattr(obj, call.method)
- ret = method(*args)
+ ret = method(**dict(args))
if call.ret and isinstance(call.ret, model.Pointer):
+ if ret is None:
+ sys.stderr.write('warning: NULL returned\n')
self.register_object(call.ret.address, ret)
+ self.call_no = None
+
def interpret_arg(self, node):
translator = Translator(self)
return translator.visit(node)
+
+ def verbosity(self, level):
+ return self.options.verbosity >= level
+
+ def present(self, surface, description):
+ if self.call_no < self.options.start:
+ return
+
+ if self.options.images:
+ filename = '%s_%04u.png' % (description, self.call_no)
+ save_image(filename, surface)
+ else:
+ title = '%u. %s' % (self.call_no, description)
+ show_image(surface, title)
+class Main(parser.Main):
+
+ def get_optparser(self):
+ optparser = parser.Main.get_optparser(self)
+ optparser.add_option("-q", "--quiet", action="store_const", const=0, dest="verbosity", help="no messages")
+ optparser.add_option("-v", "--verbose", action="count", dest="verbosity", default=1, help="increase verbosity level")
+ optparser.add_option("-i", "--images", action="store_true", dest="images", default=False, help="save images instead of showing them")
+ optparser.add_option("-s", "--step", action="store_true", dest="step", default=False, help="step trhough every draw")
+ optparser.add_option("-f", "--from", action="store", type="int", dest="start", default=0, help="from call no")
+ optparser.add_option("-t", "--to", action="store", type="int", dest="stop", default=0, help="until call no")
+ return optparser
+
+ def process_arg(self, stream, options):
+ parser = Interpreter(stream, options)
+ parser.parse()
+
+
if __name__ == '__main__':
- parser.main(Interpreter)
+ Main().main()
diff --git a/src/gallium/state_trackers/python/retrace/model.py b/src/gallium/state_trackers/python/retrace/model.py
index ae0f4327d76..d4a079fb1e5 100755
--- a/src/gallium/state_trackers/python/retrace/model.py
+++ b/src/gallium/state_trackers/python/retrace/model.py
@@ -101,7 +101,8 @@ class Pointer(Node):
class Call:
- def __init__(self, klass, method, args, ret):
+ def __init__(self, no, klass, method, args, ret):
+ self.no = no
self.klass = klass
self.method = method
self.args = args
@@ -187,6 +188,7 @@ class PrettyPrinter:
self.formatter.address(node.address)
def visit_call(self, node):
+ self.formatter.text('%s ' % node.no)
if node.klass is not None:
self.formatter.function(node.klass + '::' + node.method)
else:
diff --git a/src/gallium/state_trackers/python/retrace/parser.py b/src/gallium/state_trackers/python/retrace/parser.py
index 5205f2d8dd5..b0f3e8a432f 100755
--- a/src/gallium/state_trackers/python/retrace/parser.py
+++ b/src/gallium/state_trackers/python/retrace/parser.py
@@ -30,6 +30,7 @@
import sys
import xml.parsers.expat
import binascii
+import optparse
from model import *
@@ -189,6 +190,10 @@ class XmlParser:
class TraceParser(XmlParser):
+ def __init__(self, fp):
+ XmlParser.__init__(self, fp)
+ self.last_call_no = 0
+
def parse(self):
self.element_start('trace')
while self.token.type not in (ELEMENT_END, EOF):
@@ -199,6 +204,13 @@ class TraceParser(XmlParser):
def parse_call(self):
attrs = self.element_start('call')
+ try:
+ no = int(attrs['no'])
+ except KeyError:
+ self.last_call_no += 1
+ no = self.last_call_no
+ else:
+ self.last_call_no = no
klass = attrs['class']
method = attrs['method']
args = []
@@ -216,7 +228,7 @@ class TraceParser(XmlParser):
raise TokenMismatch("<arg ...> or <ret ...>", self.token)
self.element_end('call')
- return Call(klass, method, args, ret)
+ return Call(no, klass, method, args, ret)
def parse_arg(self):
attrs = self.element_start('arg')
@@ -342,16 +354,39 @@ class TraceDumper(TraceParser):
self.formatter.newline()
-def main(ParserFactory):
- for arg in sys.argv[1:]:
- if arg.endswith('.gz'):
- import gzip
- stream = gzip.GzipFile(arg, 'rt')
+class Main:
+ '''Common main class for all retrace command line utilities.'''
+
+ def __init__(self):
+ pass
+
+ def main(self):
+ optparser = self.get_optparser()
+ (options, args) = optparser.parse_args(sys.argv[1:])
+
+ if args:
+ for arg in args:
+ if arg.endswith('.gz'):
+ from gzip import GzipFile
+ stream = GzipFile(arg, 'rt')
+ elif arg.endswith('.bz2'):
+ from bz2 import BZ2File
+ stream = BZ2File(arg, 'rt')
+ else:
+ stream = open(arg, 'rt')
+ self.process_arg(stream, options)
else:
- stream = open(arg, 'rt')
- parser = ParserFactory(stream)
+ self.process_arg(stream, options)
+
+ def get_optparser(self):
+ optparser = optparse.OptionParser(
+ usage="\n\t%prog [options] [traces] ...")
+ return optparser
+
+ def process_arg(self, stream, options):
+ parser = TraceDumper(stream)
parser.parse()
if __name__ == '__main__':
- main(TraceDumper)
+ Main().main()
diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py
index d3ccb6c2f46..4b9659861df 100644
--- a/src/gallium/state_trackers/python/samples/tri.py
+++ b/src/gallium/state_trackers/python/samples/tri.py
@@ -67,6 +67,8 @@ def test(dev):
width = 255
height = 255
+ minz = 0.0
+ maxz = 1.0
# disabled blending/masking
blend = Blend()
@@ -77,31 +79,32 @@ def test(dev):
blend.colormask = PIPE_MASK_RGBA
ctx.set_blend(blend)
- # no-op depth/stencil/alpha
+ # depth/stencil/alpha
depth_stencil_alpha = DepthStencilAlpha()
+ depth_stencil_alpha.depth.enabled = 1
+ depth_stencil_alpha.depth.writemask = 1
+ depth_stencil_alpha.depth.func = PIPE_FUNC_LESS
ctx.set_depth_stencil_alpha(depth_stencil_alpha)
# rasterizer
rasterizer = Rasterizer()
rasterizer.front_winding = PIPE_WINDING_CW
rasterizer.cull_mode = PIPE_WINDING_NONE
- rasterizer.bypass_clipping = 1
rasterizer.scissor = 1
- #rasterizer.bypass_vs = 1
ctx.set_rasterizer(rasterizer)
- # viewport (identity, we setup vertices in wincoords)
+ # viewport
viewport = Viewport()
scale = FloatArray(4)
- scale[0] = 1.0
- scale[1] = 1.0
- scale[2] = 1.0
+ scale[0] = width / 2.0
+ scale[1] = -height / 2.0
+ scale[2] = (maxz - minz) / 2.0
scale[3] = 1.0
viewport.scale = scale
translate = FloatArray(4)
- translate[0] = 0.0
- translate[1] = 0.0
- translate[2] = 0.0
+ translate[0] = width / 2.0
+ translate[1] = height / 2.0
+ translate[2] = (maxz - minz) / 2.0
translate[3] = 0.0
viewport.translate = translate
ctx.set_viewport(viewport)
@@ -134,17 +137,25 @@ def test(dev):
PIPE_FORMAT_X8R8G8B8_UNORM,
width, height,
tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET,
- )
- _cbuf = cbuf.get_surface(usage = PIPE_BUFFER_USAGE_GPU_READ|PIPE_BUFFER_USAGE_GPU_WRITE)
+ ).get_surface()
+ zbuf = dev.texture_create(
+ PIPE_FORMAT_Z32_UNORM,
+ width, height,
+ tex_usage=PIPE_TEXTURE_USAGE_DEPTH_STENCIL,
+ ).get_surface()
fb = Framebuffer()
fb.width = width
fb.height = height
- fb.num_cbufs = 1
- fb.set_cbuf(0, _cbuf)
+ fb.nr_cbufs = 1
+ fb.set_cbuf(0, cbuf)
+ fb.set_zsbuf(zbuf)
ctx.set_framebuffer(fb)
- _cbuf.clear_value = 0x00000000
- ctx.surface_clear(_cbuf, _cbuf.clear_value)
- del _cbuf
+ rgba = FloatArray(4);
+ rgba[0] = 0.0
+ rgba[1] = 0.0
+ rgba[2] = 0.0
+ rgba[3] = 0.0
+ ctx.clear(PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL, rgba, 1.0, 0xff)
# vertex shader
vs = Shader('''
@@ -173,25 +184,25 @@ def test(dev):
nattrs = 2
verts = FloatArray(nverts * nattrs * 4)
- verts[ 0] = 128.0 # x1
- verts[ 1] = 32.0 # y1
- verts[ 2] = 0.0 # z1
+ verts[ 0] = 0.0 # x1
+ verts[ 1] = 0.8 # y1
+ verts[ 2] = 0.2 # z1
verts[ 3] = 1.0 # w1
verts[ 4] = 1.0 # r1
verts[ 5] = 0.0 # g1
verts[ 6] = 0.0 # b1
verts[ 7] = 1.0 # a1
- verts[ 8] = 32.0 # x2
- verts[ 9] = 224.0 # y2
- verts[10] = 0.0 # z2
+ verts[ 8] = -0.8 # x2
+ verts[ 9] = -0.8 # y2
+ verts[10] = 0.5 # z2
verts[11] = 1.0 # w2
verts[12] = 0.0 # r2
verts[13] = 1.0 # g2
verts[14] = 0.0 # b2
verts[15] = 1.0 # a2
- verts[16] = 224.0 # x3
- verts[17] = 224.0 # y3
- verts[18] = 0.0 # z3
+ verts[16] = 0.8 # x3
+ verts[17] = -0.8 # y3
+ verts[18] = 0.8 # z3
verts[19] = 1.0 # w3
verts[20] = 0.0 # r3
verts[21] = 0.0 # g3
@@ -205,8 +216,10 @@ def test(dev):
ctx.flush()
- show_image(cbuf.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE))
- #save_image('tri.png', cbuf.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE))
+ show_image(cbuf)
+ #show_image(zbuf)
+ #save_image('cbuf.png', cbuf)
+ #save_image('zbuf.png', zbuf)
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index 366d4eb19af..8246b378ce0 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -192,10 +192,16 @@ st_context_create(struct st_device *st_dev)
memset(&rasterizer, 0, sizeof(rasterizer));
rasterizer.front_winding = PIPE_WINDING_CW;
rasterizer.cull_mode = PIPE_WINDING_NONE;
- rasterizer.bypass_vs_clip_and_viewport = 1;
cso_set_rasterizer(st_ctx->cso, &rasterizer);
}
+ /* clip */
+ {
+ struct pipe_clip_state clip;
+ memset(&clip, 0, sizeof(clip));
+ st_ctx->pipe->set_clip_state(st_ctx->pipe, &clip);
+ }
+
/* identity viewport */
{
struct pipe_viewport_state viewport;
@@ -291,37 +297,3 @@ st_context_create(struct st_device *st_dev)
return st_ctx;
}
-
-
-void
-st_buffer_destroy(struct st_buffer *st_buf)
-{
- if(st_buf) {
- pipe_buffer_reference(&st_buf->buffer, NULL);
- FREE(st_buf);
- }
-}
-
-
-struct st_buffer *
-st_buffer_create(struct st_device *st_dev,
- unsigned alignment, unsigned usage, unsigned size)
-{
- struct pipe_screen *screen = st_dev->screen;
- struct st_buffer *st_buf;
-
- st_buf = CALLOC_STRUCT(st_buffer);
- if(!st_buf)
- return NULL;
-
- st_buf->st_dev = st_dev;
-
- st_buf->buffer = pipe_buffer_create(screen, alignment, usage, size);
- if(!st_buf->buffer) {
- st_buffer_destroy(st_buf);
- return NULL;
- }
-
- return st_buf;
-}
-
diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h
index 0641aff149f..a246b6a1f25 100644
--- a/src/gallium/state_trackers/python/st_device.h
+++ b/src/gallium/state_trackers/python/st_device.h
@@ -38,10 +38,12 @@ struct pipe_context;
struct st_winsys;
-struct st_buffer {
- struct st_device *st_dev;
-
- struct pipe_buffer *buffer;
+struct st_surface
+{
+ struct pipe_texture *texture;
+ unsigned face;
+ unsigned level;
+ unsigned zslice;
};
@@ -64,6 +66,8 @@ struct st_context {
unsigned num_vertex_elements;
struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS];
+
+ struct pipe_framebuffer_state framebuffer;
};
@@ -78,12 +82,13 @@ struct st_device {
};
-struct st_buffer *
-st_buffer_create(struct st_device *st_dev,
- unsigned alignment, unsigned usage, unsigned size);
-
-void
-st_buffer_destroy(struct st_buffer *st_buf);
+static INLINE struct pipe_surface *
+st_pipe_surface(struct st_surface *surface, unsigned usage)
+{
+ struct pipe_texture *texture = surface->texture;
+ struct pipe_screen *screen = texture->screen;
+ return screen->get_tex_surface(screen, texture, surface->face, surface->level, surface->zslice, usage);
+}
struct st_context *
st_context_create(struct st_device *st_dev);
diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c
index c2ffe9fce1d..53a01891e12 100644
--- a/src/gallium/state_trackers/python/st_sample.c
+++ b/src/gallium/state_trackers/python/st_sample.c
@@ -34,6 +34,7 @@
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "st_device.h"
#include "st_sample.h"
@@ -523,10 +524,13 @@ st_sample_pixel_block(enum pipe_format format,
void
-st_sample_surface(struct pipe_surface *surface, float *rgba)
+st_sample_surface(struct st_surface *surface, float *rgba)
{
- struct pipe_screen *screen = surface->texture->screen;
- uint rgba_stride = surface->width * 4;
+ struct pipe_texture *texture = surface->texture;
+ struct pipe_screen *screen = texture->screen;
+ unsigned width = texture->width[surface->level];
+ unsigned height = texture->height[surface->level];
+ uint rgba_stride = width * 4;
struct pipe_transfer *transfer;
void *raw;
@@ -535,27 +539,27 @@ st_sample_surface(struct pipe_surface *surface, float *rgba)
surface->face,
surface->level,
surface->zslice,
- PIPE_TRANSFER_READ,
+ PIPE_TRANSFER_WRITE,
0, 0,
- surface->width,
- surface->height);
+ width,
+ height);
if (!transfer)
return;
raw = screen->transfer_map(screen, transfer);
if (raw) {
- const struct pipe_format_block *block = &transfer->block;
+ const struct pipe_format_block *block = &texture->block;
uint x, y;
for (y = 0; y < transfer->nblocksy; ++y) {
for (x = 0; x < transfer->nblocksx; ++x) {
- st_sample_pixel_block(surface->format,
+ st_sample_pixel_block(texture->format,
block,
(uint8_t *) raw + y * transfer->stride + x * block->size,
rgba + y * block->height * rgba_stride + x * block->width * 4,
rgba_stride,
- MIN2(block->width, surface->width - x*block->width),
- MIN2(block->height, surface->height - y*block->height));
+ MIN2(block->width, width - x*block->width),
+ MIN2(block->height, height - y*block->height));
}
}
diff --git a/src/gallium/state_trackers/python/st_sample.h b/src/gallium/state_trackers/python/st_sample.h
index ff04a12613f..0a27083549f 100644
--- a/src/gallium/state_trackers/python/st_sample.h
+++ b/src/gallium/state_trackers/python/st_sample.h
@@ -41,7 +41,7 @@ st_sample_pixel_block(enum pipe_format format,
unsigned w, unsigned h);
void
-st_sample_surface(struct pipe_surface *surface, float *rgba);
+st_sample_surface(struct st_surface *surface, float *rgba);
#endif /* ST_SAMPLE_H_ */
diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c
index 426f347d189..41cdeaa6fdc 100644
--- a/src/gallium/state_trackers/python/st_softpipe_winsys.c
+++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c
@@ -84,8 +84,7 @@ st_softpipe_buffer_unmap(struct pipe_winsys *winsys,
static void
-st_softpipe_buffer_destroy(struct pipe_winsys *winsys,
- struct pipe_buffer *buf)
+st_softpipe_buffer_destroy(struct pipe_buffer *buf)
{
struct st_softpipe_buffer *oldBuf = st_softpipe_buffer(buf);
diff --git a/src/gallium/state_trackers/python/tests/.gitignore b/src/gallium/state_trackers/python/tests/.gitignore
new file mode 100644
index 00000000000..0dbbaeea16b
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/.gitignore
@@ -0,0 +1,3 @@
+*.txt
+*.tsv
+*.dot
diff --git a/src/gallium/state_trackers/python/tests/base.py b/src/gallium/state_trackers/python/tests/base.py
index 8477aa5fc9b..1fa7fe6f3b3 100644..100755
--- a/src/gallium/state_trackers/python/tests/base.py
+++ b/src/gallium/state_trackers/python/tests/base.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
##########################################################################
#
+# Copyright 2009 VMware, Inc.
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
# All Rights Reserved.
#
@@ -19,7 +20,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -33,6 +34,9 @@ Loosely inspired on Python's unittest module.
"""
+import os.path
+import sys
+
from gallium import *
@@ -115,17 +119,77 @@ class Test:
self._run(result)
result.summary()
+ def assert_rgba(self, surface, x, y, w, h, expected_rgba, pixel_tol=4.0/256, surface_tol=0.85):
+ total = h*w
+ different = surface.compare_tile_rgba(x, y, w, h, expected_rgba, tol=pixel_tol)
+ if different:
+ sys.stderr.write("%u out of %u pixels differ\n" % (different, total))
+
+ if float(total - different)/float(total) < surface_tol:
+ if 0:
+ rgba = FloatArray(h*w*4)
+ surface.get_tile_rgba(x, y, w, h, rgba)
+ show_image(w, h, Result=rgba, Expected=expected_rgba)
+ save_image(w, h, rgba, "result.png")
+ save_image(w, h, expected_rgba, "expected.png")
+ #sys.exit(0)
+
+ raise TestFailure
+
class TestCase(Test):
+ tags = ()
+
def __init__(self, dev, **kargs):
Test.__init__(self)
self.dev = dev
self.__dict__.update(kargs)
def description(self):
- raise NotImplementedError
-
+ descriptions = []
+ for tag in self.tags:
+ value = self.get(tag)
+ if value is not None and value != '':
+ descriptions.append(tag + '=' + str(value))
+ return ' '.join(descriptions)
+
+ def get(self, tag):
+ try:
+ method = getattr(self, '_get_' + tag)
+ except AttributeError:
+ return getattr(self, tag, None)
+ else:
+ return method()
+
+ def _get_target(self):
+ return {
+ PIPE_TEXTURE_1D: "1d",
+ PIPE_TEXTURE_2D: "2d",
+ PIPE_TEXTURE_3D: "3d",
+ PIPE_TEXTURE_CUBE: "cube",
+ }[self.target]
+
+ def _get_format(self):
+ name = formats[self.format]
+ if name.startswith('PIPE_FORMAT_'):
+ name = name[12:]
+ name = name.lower()
+ return name
+
+ def _get_face(self):
+ if self.target == PIPE_TEXTURE_CUBE:
+ return {
+ PIPE_TEX_FACE_POS_X: "+x",
+ PIPE_TEX_FACE_NEG_X: "-x",
+ PIPE_TEX_FACE_POS_Y: "+y",
+ PIPE_TEX_FACE_NEG_Y: "-y",
+ PIPE_TEX_FACE_POS_Z: "+z",
+ PIPE_TEX_FACE_NEG_Z: "-z",
+ }[self.face]
+ else:
+ return ''
+
def test(self):
raise NotImplementedError
@@ -167,27 +231,106 @@ class TestResult:
self.passed = 0
self.skipped = 0
self.failed = 0
- self.failed_descriptions = []
+
+ self.names = ['result']
+ self.types = ['pass skip fail']
+ self.rows = []
def test_start(self, test):
+ sys.stdout.write("Running %s...\n" % test.description())
+ sys.stdout.flush()
self.tests += 1
- print "Running %s..." % test.description()
def test_passed(self, test):
+ sys.stdout.write("PASS\n")
+ sys.stdout.flush()
self.passed += 1
- print "PASS"
+ self.log_result(test, 'pass')
def test_skipped(self, test):
+ sys.stdout.write("SKIP\n")
+ sys.stdout.flush()
self.skipped += 1
- print "SKIP"
+ #self.log_result(test, 'skip')
def test_failed(self, test):
+ sys.stdout.write("FAIL\n")
+ sys.stdout.flush()
self.failed += 1
- self.failed_descriptions.append(test.description())
- print "FAIL"
+ self.log_result(test, 'fail')
+
+ def log_result(self, test, result):
+ row = ['']*len(self.names)
+
+ # add result
+ assert self.names[0] == 'result'
+ assert result in ('pass', 'skip', 'fail')
+ row[0] = result
+
+ # add tags
+ for tag in test.tags:
+ value = test.get(tag)
+
+ # infer type
+ if value is None:
+ continue
+ elif isinstance(value, (int, float)):
+ value = str(value)
+ type = 'c' # continous
+ elif isinstance(value, basestring):
+ type = 'd' # discrete
+ else:
+ assert False
+ value = str(value)
+ type = 'd' # discrete
+
+ # insert value
+ try:
+ col = self.names.index(tag, 1)
+ except ValueError:
+ self.names.append(tag)
+ self.types.append(type)
+ row.append(value)
+ else:
+ row[col] = value
+ assert self.types[col] == type
+
+ self.rows.append(row)
def summary(self):
- print "%u tests, %u passed, %u skipped, %u failed" % (self.tests, self.passed, self.skipped, self.failed)
- for description in self.failed_descriptions:
- print " %s" % description
- \ No newline at end of file
+ sys.stdout.write("%u tests, %u passed, %u skipped, %u failed\n\n" % (self.tests, self.passed, self.skipped, self.failed))
+ sys.stdout.flush()
+
+ name, ext = os.path.splitext(os.path.basename(sys.argv[0]))
+ filename = name + '.tsv'
+ stream = file(filename, 'wt')
+
+ # header
+ stream.write('\t'.join(self.names) + '\n')
+ stream.write('\t'.join(self.types) + '\n')
+ stream.write('class\n')
+
+ # rows
+ for row in self.rows:
+ row += ['']*(len(self.names) - len(row))
+ stream.write('\t'.join(row) + '\n')
+
+ stream.close()
+
+ # See http://www.ailab.si/orange/doc/ofb/c_otherclass.htm
+ try:
+ import orange
+ import orngTree
+ except ImportError:
+ sys.stderr.write('Install Orange from http://www.ailab.si/orange/ for a classification tree.\n')
+ return
+
+ data = orange.ExampleTable(filename)
+
+ tree = orngTree.TreeLearner(data, sameMajorityPruning=1, mForPruning=2)
+
+ orngTree.printTxt(tree, maxDepth=4)
+
+ file(name+'.txt', 'wt').write(orngTree.dumpTree(tree))
+
+ orngTree.printDot(tree, fileName=name+'.dot', nodeShape='ellipse', leafShape='box')
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.sh
new file mode 100644
index 00000000000..7a0006bf660
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.sh
@@ -0,0 +1,13 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { -0.5, -0.4, -0.6, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+ABS OUT[0], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-add.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-add.sh
new file mode 100644
index 00000000000..f7836c85ddb
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-add.sh
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+ADD OUT[0], IN[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp3.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp3.sh
new file mode 100644
index 00000000000..c89cd748a80
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp3.sh
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DP3 OUT[0], IN[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp4.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp4.sh
new file mode 100644
index 00000000000..6517e3c4945
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp4.sh
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DP4 OUT[0], IN[0].xyzx, IN[0].xyzx
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dst.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dst.sh
new file mode 100644
index 00000000000..464880ba68f
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dst.sh
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DST OUT[0], IN[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-ex2.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-ex2.sh
new file mode 100644
index 00000000000..2684076f1d6
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-ex2.sh
@@ -0,0 +1,11 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+EX2 TEMP[0], IN[0].xxxx
+MUL OUT[0], TEMP[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-flr.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-flr.sh
new file mode 100644
index 00000000000..ad11e28918a
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-flr.sh
@@ -0,0 +1,15 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 2.5, 4.0, 2.0, 1.0 }
+IMM FLT32 { 0.4, 0.25, 0.5, 1.0 }
+
+MUL TEMP[0], IN[0], IMM[0]
+FLR TEMP[0], TEMP[0]
+MUL OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-frc.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-frc.sh
new file mode 100644
index 00000000000..4f3aa30d666
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-frc.sh
@@ -0,0 +1,13 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 2.7, 3.1, 4.5, 1.0 }
+
+MUL TEMP[0], IN[0], IMM[0]
+FRC OUT[0], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lg2.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lg2.sh
new file mode 100644
index 00000000000..54c7c644598
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lg2.sh
@@ -0,0 +1,15 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 0.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+LG2 TEMP[0].x, TEMP[0].xxxx
+ADD OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lit.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lit.sh
new file mode 100644
index 00000000000..0e78ef86b54
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lit.sh
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+LIT OUT[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lrp.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lrp.sh
new file mode 100644
index 00000000000..e9ee0f81478
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lrp.sh
@@ -0,0 +1,11 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+ABS TEMP[0], IN[0]
+LRP OUT[0], TEMP[0], IN[0].xxxx, IN[0].yyyy
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mad.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mad.sh
new file mode 100644
index 00000000000..439acd5bbde
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mad.sh
@@ -0,0 +1,11 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.5, 0.4, 0.6, 1.0 }
+IMM FLT32 { 0.5, 0.4, 0.6, 0.0 }
+
+MAD OUT[0], IN[0], IMM[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-max.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-max.sh
new file mode 100644
index 00000000000..ab21b245dd8
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-max.sh
@@ -0,0 +1,10 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.4, 0.4, 0.4, 0.0 }
+
+MAX OUT[0], IN[0], IMM[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-min.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-min.sh
new file mode 100644
index 00000000000..969ae73d98e
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-min.sh
@@ -0,0 +1,10 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.6, 0.6, 0.6, 1.0 }
+
+MIN OUT[0], IN[0], IMM[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mov.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mov.sh
new file mode 100644
index 00000000000..612975e0570
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mov.sh
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+MOV OUT[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mul.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mul.sh
new file mode 100644
index 00000000000..ed158b0fc69
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mul.sh
@@ -0,0 +1,10 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.5, 0.6, 0.7, 1.0 }
+
+MUL OUT[0], IN[0], IMM[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rcp.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rcp.sh
new file mode 100644
index 00000000000..cc9feef07e1
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rcp.sh
@@ -0,0 +1,15 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 1.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+RCP TEMP[0].x, TEMP[0].xxxx
+SUB OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rsq.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rsq.sh
new file mode 100644
index 00000000000..695621fdc97
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rsq.sh
@@ -0,0 +1,15 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 1.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+RSQ TEMP[0].x, TEMP[0].xxxx
+SUB OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sge.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sge.sh
new file mode 100644
index 00000000000..9505bc3c3e3
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sge.sh
@@ -0,0 +1,13 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 0.6, 0.6, 0.6, 0.0 }
+
+SGE TEMP[0], IN[0], IMM[0]
+MUL OUT[0], IN[0], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh
new file mode 100644
index 00000000000..f2a1521cbf0
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh
@@ -0,0 +1,13 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 0.6, 0.6, 0.6, 0.0 }
+
+SLT TEMP[0], IN[0], IMM[0]
+MUL OUT[0], IN[0], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-abs.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-abs.sh
new file mode 100644
index 00000000000..9cd4b682955
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-abs.sh
@@ -0,0 +1,13 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { -0.3, -0.5, -0.4, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+MOV OUT[0], |TEMP[0]|
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-absneg.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-absneg.sh
new file mode 100644
index 00000000000..acd6aa750dd
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-absneg.sh
@@ -0,0 +1,15 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { -0.2, -0.3, -0.4, 0.0 }
+IMM FLT32 { -1.0, -1.0, -1.0, -1.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+MOV TEMP[0], -|TEMP[0]|
+MUL OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-neg.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-neg.sh
new file mode 100644
index 00000000000..ba1b61503b8
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-neg.sh
@@ -0,0 +1,11 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+SUB TEMP[0], IN[0], IN[0].yzxw
+MOV OUT[0], -TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-swz.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-swz.sh
new file mode 100644
index 00000000000..192aa7bb26b
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-swz.sh
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+MOV OUT[0], IN[0].yxzw
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sub.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sub.sh
new file mode 100644
index 00000000000..83441fa8207
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sub.sh
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+SUB OUT[0], IN[0], IN[0].yzxw
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-xpd.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-xpd.sh
new file mode 100644
index 00000000000..d6f66c4927a
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-xpd.sh
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+XPD OUT[0], IN[0], IN[0].yzxw
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py
new file mode 100644
index 00000000000..d60fb38d1ae
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py
@@ -0,0 +1,218 @@
+#!/usr/bin/env python
+##########################################################################
+#
+# Copyright 2009 VMware, Inc.
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sub license, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice (including the
+# next paragraph) shall be included in all copies or substantial portions
+# of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+##########################################################################
+
+
+from gallium import *
+
+def make_image(surface):
+ data = surface.get_tile_rgba8(0, 0, surface.width, surface.height)
+
+ import Image
+ outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1)
+ return outimage
+
+def save_image(filename, surface):
+ outimage = make_image(surface)
+ outimage.save(filename, "PNG")
+
+def test(dev, name):
+ ctx = dev.context_create()
+
+ width = 320
+ height = 320
+ minz = 0.0
+ maxz = 1.0
+
+ # disabled blending/masking
+ blend = Blend()
+ blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
+ blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
+ blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
+ blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
+ blend.colormask = PIPE_MASK_RGBA
+ ctx.set_blend(blend)
+
+ # depth/stencil/alpha
+ depth_stencil_alpha = DepthStencilAlpha()
+ depth_stencil_alpha.depth.enabled = 0
+ depth_stencil_alpha.depth.writemask = 1
+ depth_stencil_alpha.depth.func = PIPE_FUNC_LESS
+ ctx.set_depth_stencil_alpha(depth_stencil_alpha)
+
+ # rasterizer
+ rasterizer = Rasterizer()
+ rasterizer.front_winding = PIPE_WINDING_CW
+ rasterizer.cull_mode = PIPE_WINDING_NONE
+ rasterizer.scissor = 1
+ ctx.set_rasterizer(rasterizer)
+
+ # viewport
+ viewport = Viewport()
+ scale = FloatArray(4)
+ scale[0] = width / 2.0
+ scale[1] = -height / 2.0
+ scale[2] = (maxz - minz) / 2.0
+ scale[3] = 1.0
+ viewport.scale = scale
+ translate = FloatArray(4)
+ translate[0] = width / 2.0
+ translate[1] = height / 2.0
+ translate[2] = (maxz - minz) / 2.0
+ translate[3] = 0.0
+ viewport.translate = translate
+ ctx.set_viewport(viewport)
+
+ # samplers
+ sampler = Sampler()
+ sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+ sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+ sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+ sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE
+ sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST
+ sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST
+ sampler.normalized_coords = 1
+ ctx.set_sampler(0, sampler)
+
+ # scissor
+ scissor = Scissor()
+ scissor.minx = 0
+ scissor.miny = 0
+ scissor.maxx = width
+ scissor.maxy = height
+ ctx.set_scissor(scissor)
+
+ clip = Clip()
+ clip.nr = 0
+ ctx.set_clip(clip)
+
+ # framebuffer
+ cbuf = dev.texture_create(
+ PIPE_FORMAT_X8R8G8B8_UNORM,
+ width, height,
+ tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET,
+ ).get_surface()
+ fb = Framebuffer()
+ fb.width = width
+ fb.height = height
+ fb.nr_cbufs = 1
+ fb.set_cbuf(0, cbuf)
+ ctx.set_framebuffer(fb)
+ rgba = FloatArray(4);
+ rgba[0] = 0.5
+ rgba[1] = 0.5
+ rgba[2] = 0.5
+ rgba[3] = 0.5
+ ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0)
+
+ # vertex shader
+ vs = Shader('''
+ VERT1.1
+ DCL IN[0], POSITION
+ DCL IN[1], COLOR
+ DCL OUT[0], POSITION
+ DCL OUT[1], COLOR
+ MOV OUT[0], IN[0]
+ MOV OUT[1], IN[1]
+ END
+ ''')
+ ctx.set_vertex_shader(vs)
+
+ # fragment shader
+ fs = Shader(file('frag-' + name + '.sh', 'rt').read())
+ ctx.set_fragment_shader(fs)
+
+ xy = [
+ -0.8, -0.8,
+ 0.8, -0.8,
+ 0.0, 0.8,
+ ]
+ color = [
+ 1.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0,
+ 0.0, 0.0, 1.0,
+ ]
+
+ nverts = 3
+ nattrs = 2
+ verts = FloatArray(nverts * nattrs * 4)
+
+ for i in range(0, nverts):
+ verts[i * nattrs * 4 + 0] = xy[i * 2 + 0] # x
+ verts[i * nattrs * 4 + 1] = xy[i * 2 + 1] # y
+ verts[i * nattrs * 4 + 2] = 0.5 # z
+ verts[i * nattrs * 4 + 3] = 1.0 # w
+ verts[i * nattrs * 4 + 4] = color[i * 3 + 0] # r
+ verts[i * nattrs * 4 + 5] = color[i * 3 + 1] # g
+ verts[i * nattrs * 4 + 6] = color[i * 3 + 2] # b
+ verts[i * nattrs * 4 + 7] = 1.0 # a
+
+ ctx.draw_vertices(PIPE_PRIM_TRIANGLES,
+ nverts,
+ nattrs,
+ verts)
+
+ ctx.flush()
+
+ save_image('frag-' + name + '.png', cbuf)
+
+def main():
+ tests = [
+ 'abs',
+ 'add',
+ 'dp3',
+ 'dp4',
+ 'dst',
+ 'ex2',
+ 'flr',
+ 'frc',
+ 'lg2',
+ 'lit',
+ 'lrp',
+ 'mad',
+ 'max',
+ 'min',
+ 'mov',
+ 'mul',
+ 'rcp',
+ 'rsq',
+ 'sge',
+ 'slt',
+ 'srcmod-abs',
+ 'srcmod-absneg',
+ 'srcmod-neg',
+ 'srcmod-swz',
+ 'sub',
+ 'xpd',
+ ]
+
+ dev = Device()
+ for t in tests:
+ test(dev, t)
+
+if __name__ == '__main__':
+ main()
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh
new file mode 100644
index 00000000000..f0d0d5de171
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh
@@ -0,0 +1,15 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL TEMP[0]
+
+IMM FLT32 { 0.2, 0.2, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+ABS OUT[0], TEMP[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh
new file mode 100644
index 00000000000..936c851c9dc
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh
@@ -0,0 +1,13 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.2, -0.1, 0.0, 0.0 }
+
+ADD OUT[0], IN[0], IMM[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arl.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arl.sh
new file mode 100644
index 00000000000..7638e96346e
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arl.sh
@@ -0,0 +1,23 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+DCL ADDR[0]
+
+IMM FLT32 { 3.0, 1.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 0.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 0.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 1.0, 1.0 }
+
+MOV OUT[0], IN[0]
+MUL TEMP[0], IN[0], IMM[0]
+ARL ADDR[0].x, TEMP[0]
+MOV OUT[1], IMM[ADDR[0].x + 3]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arr.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arr.sh
new file mode 100644
index 00000000000..28ce6f9a0cf
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arr.sh
@@ -0,0 +1,23 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+DCL ADDR[0]
+
+IMM FLT32 { 3.0, 1.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 0.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 0.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 1.0, 1.0 }
+
+MOV OUT[0], IN[0]
+MUL TEMP[0], IN[0], IMM[0]
+ARR ADDR[0].x, TEMP[0]
+MOV OUT[1], IMM[ADDR[0].x + 3]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh
new file mode 100644
index 00000000000..b57d68520fc
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh
@@ -0,0 +1,16 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL TEMP[0]
+
+IMM FLT32 { 0.0, 0.0, 1.0, 1.0 }
+
+DP3 TEMP[0].xy, IN[0], IN[0]
+MOV TEMP[0].zw, IMM[0]
+MUL OUT[0], IN[0], TEMP[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh
new file mode 100644
index 00000000000..0eb31719c58
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh
@@ -0,0 +1,16 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL TEMP[0]
+
+IMM FLT32 { 0.0, 0.0, 1.0, 1.0 }
+
+DP4 TEMP[0].xy, IN[0], IN[0]
+MOV TEMP[0].zw, IMM[0]
+MUL OUT[0], IN[0], TEMP[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dst.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dst.sh
new file mode 100644
index 00000000000..dc5e0eb92e5
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dst.sh
@@ -0,0 +1,11 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0], IN[0]
+DST OUT[1], IN[1], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh
new file mode 100644
index 00000000000..34057af4e66
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh
@@ -0,0 +1,18 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0..1]
+
+IMM FLT32 { 0.3, 0.3, 0.3, 1.0 }
+
+EX2 TEMP[0], IN[0]
+EX2 TEMP[1], IN[1].yyyy
+MUL TEMP[0], TEMP[0], IMM[0]
+MOV OUT[0], IN[0]
+MUL OUT[1], TEMP[0], TEMP[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-flr.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-flr.sh
new file mode 100644
index 00000000000..44ad708119d
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-flr.sh
@@ -0,0 +1,23 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+DCL ADDR[0]
+
+IMM FLT32 { 3.0, 1.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 0.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 0.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 1.0, 1.0 }
+
+MOV OUT[0], IN[0]
+MUL TEMP[0], IN[0], IMM[0]
+FLR ADDR[0].x, TEMP[0]
+MOV OUT[1], IMM[ADDR[0].x + 3]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh
new file mode 100644
index 00000000000..d179749de84
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh
@@ -0,0 +1,15 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 2.7, 3.1, 4.5, 1.0 }
+
+MUL TEMP[0], IN[0].xyxw, IMM[0]
+MOV OUT[0], IN[0]
+FRC OUT[1], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh
new file mode 100644
index 00000000000..f6e08d087c1
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh
@@ -0,0 +1,18 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 0.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+LG2 TEMP[0].x, TEMP[0].xxxx
+ADD OUT[0], TEMP[0], IMM[1]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lit.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lit.sh
new file mode 100644
index 00000000000..da98f30928e
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lit.sh
@@ -0,0 +1,11 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0], IN[0]
+LIT OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh
new file mode 100644
index 00000000000..8c262580e23
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh
@@ -0,0 +1,14 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+ABS TEMP[0], IN[0]
+MOV OUT[0], IN[0]
+LRP OUT[1], TEMP[0], IN[1].xxxx, IN[1].yyyy
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mad.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mad.sh
new file mode 100644
index 00000000000..eb07a3bd565
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mad.sh
@@ -0,0 +1,14 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.5, 1.0, 1.0, 1.0 }
+IMM FLT32 { 0.5, 0.0, 0.0, 0.0 }
+
+MAD OUT[0], IN[0], IMM[0], IMM[1]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-max.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-max.sh
new file mode 100644
index 00000000000..2d8b1fe3bfb
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-max.sh
@@ -0,0 +1,13 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.5, 0.5, 0.5, 0.0 }
+
+MOV OUT[0], IN[0]
+MAX OUT[1], IN[1], IMM[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-min.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-min.sh
new file mode 100644
index 00000000000..84af0e29051
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-min.sh
@@ -0,0 +1,13 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.5, 0.5, 0.5, 0.0 }
+
+MOV OUT[0], IN[0]
+MIN OUT[1], IN[1], IMM[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh
new file mode 100644
index 00000000000..bcdec07c204
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh
@@ -0,0 +1,11 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0], IN[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh
new file mode 100644
index 00000000000..f3b57c30382
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh
@@ -0,0 +1,13 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.6, 0.6, 1.0, 1.0 }
+
+MUL OUT[0], IN[0], IMM[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh
new file mode 100644
index 00000000000..78af589b5c0
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh
@@ -0,0 +1,18 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 1.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+RCP TEMP[0].x, TEMP[0].xxxx
+SUB OUT[0], TEMP[0], IMM[1]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh
new file mode 100644
index 00000000000..1675c7d5ff1
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh
@@ -0,0 +1,18 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 1.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+RSQ TEMP[0].x, TEMP[0].xxxx
+SUB OUT[0], TEMP[0], IMM[1]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sge.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sge.sh
new file mode 100644
index 00000000000..3d92cd5aaeb
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sge.sh
@@ -0,0 +1,16 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { -0.1, -0.1, 1.0, 0.0 }
+
+SGE TEMP[0], IN[0], IMM[0]
+MOV OUT[0], IN[0]
+MUL OUT[1], IN[1], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-slt.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-slt.sh
new file mode 100644
index 00000000000..85c60ff4ec8
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-slt.sh
@@ -0,0 +1,16 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 0.6, 0.6, 0.0, 0.0 }
+
+SLT TEMP[0], IN[0], IMM[0]
+MOV OUT[0], IN[0]
+MUL OUT[1], IN[1], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-abs.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-abs.sh
new file mode 100644
index 00000000000..6db417a62e5
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-abs.sh
@@ -0,0 +1,15 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL TEMP[0]
+
+IMM FLT32 { 0.1, 0.1, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+MOV OUT[0], |TEMP[0]|
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh
new file mode 100644
index 00000000000..fc832380520
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh
@@ -0,0 +1,16 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL TEMP[0]
+
+IMM FLT32 { -0.2, -0.2, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+MOV OUT[0].xy, -|TEMP[0]|
+MOV OUT[0].zw, IN[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-neg.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-neg.sh
new file mode 100644
index 00000000000..ce4e90b5e10
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-neg.sh
@@ -0,0 +1,12 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0].xy, -IN[0]
+MOV OUT[0].zw, IN[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh
new file mode 100644
index 00000000000..c03de4c674e
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh
@@ -0,0 +1,11 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0], IN[0].yxzw
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh
new file mode 100644
index 00000000000..a583b958284
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh
@@ -0,0 +1,13 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.1, 0.1, 0.0, 0.0 }
+
+SUB OUT[0], IN[0], IMM[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh
new file mode 100644
index 00000000000..8def8943b03
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh
@@ -0,0 +1,11 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0], IN[0]
+XPD OUT[1], IN[0], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
new file mode 100644
index 00000000000..472769f2592
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
@@ -0,0 +1,247 @@
+#!/usr/bin/env python
+##########################################################################
+#
+# Copyright 2009 VMware, Inc.
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sub license, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice (including the
+# next paragraph) shall be included in all copies or substantial portions
+# of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+##########################################################################
+
+
+from gallium import *
+
+def make_image(surface):
+ data = surface.get_tile_rgba8(0, 0, surface.width, surface.height)
+
+ import Image
+ outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1)
+ return outimage
+
+def save_image(filename, surface):
+ outimage = make_image(surface)
+ outimage.save(filename, "PNG")
+
+def test(dev, name):
+ ctx = dev.context_create()
+
+ width = 320
+ height = 320
+ minz = 0.0
+ maxz = 1.0
+
+ # disabled blending/masking
+ blend = Blend()
+ blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
+ blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
+ blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
+ blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
+ blend.colormask = PIPE_MASK_RGBA
+ ctx.set_blend(blend)
+
+ # depth/stencil/alpha
+ depth_stencil_alpha = DepthStencilAlpha()
+ depth_stencil_alpha.depth.enabled = 0
+ depth_stencil_alpha.depth.writemask = 1
+ depth_stencil_alpha.depth.func = PIPE_FUNC_LESS
+ ctx.set_depth_stencil_alpha(depth_stencil_alpha)
+
+ # rasterizer
+ rasterizer = Rasterizer()
+ rasterizer.front_winding = PIPE_WINDING_CW
+ rasterizer.cull_mode = PIPE_WINDING_NONE
+ rasterizer.scissor = 1
+ ctx.set_rasterizer(rasterizer)
+
+ # viewport
+ viewport = Viewport()
+ scale = FloatArray(4)
+ scale[0] = width / 2.0
+ scale[1] = -height / 2.0
+ scale[2] = (maxz - minz) / 2.0
+ scale[3] = 1.0
+ viewport.scale = scale
+ translate = FloatArray(4)
+ translate[0] = width / 2.0
+ translate[1] = height / 2.0
+ translate[2] = (maxz - minz) / 2.0
+ translate[3] = 0.0
+ viewport.translate = translate
+ ctx.set_viewport(viewport)
+
+ # samplers
+ sampler = Sampler()
+ sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+ sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+ sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+ sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE
+ sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST
+ sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST
+ sampler.normalized_coords = 1
+ ctx.set_sampler(0, sampler)
+
+ # scissor
+ scissor = Scissor()
+ scissor.minx = 0
+ scissor.miny = 0
+ scissor.maxx = width
+ scissor.maxy = height
+ ctx.set_scissor(scissor)
+
+ clip = Clip()
+ clip.nr = 0
+ ctx.set_clip(clip)
+
+ # framebuffer
+ cbuf = dev.texture_create(
+ PIPE_FORMAT_X8R8G8B8_UNORM,
+ width, height,
+ tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET,
+ ).get_surface()
+ fb = Framebuffer()
+ fb.width = width
+ fb.height = height
+ fb.nr_cbufs = 1
+ fb.set_cbuf(0, cbuf)
+ ctx.set_framebuffer(fb)
+ rgba = FloatArray(4);
+ rgba[0] = 0.5
+ rgba[1] = 0.5
+ rgba[2] = 0.5
+ rgba[3] = 0.5
+ ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0)
+
+ # vertex shader
+ vs = Shader(file('vert-' + name + '.sh', 'rt').read())
+ ctx.set_vertex_shader(vs)
+
+ # fragment shader
+ fs = Shader('''
+ FRAG1.1
+ DCL IN[0], COLOR, LINEAR
+ DCL OUT[0], COLOR, CONSTANT
+ 0:MOV OUT[0], IN[0]
+ 1:END
+ ''')
+ ctx.set_fragment_shader(fs)
+
+ xy = [
+ 0.0, 0.8,
+ -0.2, 0.4,
+ 0.2, 0.4,
+ -0.4, 0.0,
+ 0.0, 0.0,
+ 0.4, 0.0,
+ -0.6, -0.4,
+ -0.2, -0.4,
+ 0.2, -0.4,
+ 0.6, -0.4,
+ -0.8, -0.8,
+ -0.4, -0.8,
+ 0.0, -0.8,
+ 0.4, -0.8,
+ 0.8, -0.8,
+ ]
+ color = [
+ 1.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0,
+