summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2009-10-22 19:27:34 -0700
committerIan Romanick <ian.d.romanick@intel.com>2009-10-22 19:27:34 -0700
commit21c795b64d14dbd3496903ba5aaab196de2e7a2a (patch)
tree6ab54c3279819342757dae4c3b7fd28d968dd819
parentea92bef2898bc3391407702b0843ebb9d5e083fc (diff)
parent286611d99060c38c4cc12f18fde5448213e2a44b (diff)
downloadmesa-asm-shader-rework-3.tar.gz
Merge branch 'master' into asm-shader-rework-3asm-shader-rework-3
Conflicts: src/mesa/shader/lex.yy.c
-rw-r--r--Makefile22
-rw-r--r--configs/linux-dri4
-rw-r--r--configs/linux-dri-debug2
-rw-r--r--configs/linux-dri-xcb4
-rw-r--r--configure.ac10
-rw-r--r--docs/envvars.html1
-rw-r--r--docs/relnotes-7.6.1.html1
-rw-r--r--docs/shading.html9
-rw-r--r--progs/Makefile24
-rw-r--r--progs/demos/fbo_firecube.c36
-rw-r--r--progs/egl/eglgears.c10
-rw-r--r--progs/egl/egltri.c5
-rw-r--r--progs/egl/peglgears.c10
-rw-r--r--progs/egl/xeglgears.c399
-rw-r--r--progs/tests/arraytexture.c19
-rw-r--r--progs/tests/invert.c2
-rw-r--r--progs/tests/prog_parameter.c4
-rw-r--r--progs/trivial/tri-query.c5
-rw-r--r--progs/xdemos/glsync.c2
-rw-r--r--scons/gallium.py15
-rw-r--r--scons/llvm.py45
-rw-r--r--src/egl/drivers/glx/egl_glx.c903
-rw-r--r--src/egl/main/eglapi.c140
-rw-r--r--src/egl/main/eglapi.h8
-rw-r--r--src/egl/main/eglconfig.c9
-rw-r--r--src/egl/main/eglconfigutil.c7
-rw-r--r--src/egl/main/eglconfigutil.h2
-rw-r--r--src/egl/main/eglcurrent.c2
-rw-r--r--src/egl/main/egldriver.c2
-rw-r--r--src/egl/main/eglmisc.c3
-rw-r--r--src/egl/main/eglmisc.h2
-rw-r--r--src/egl/main/eglsurface.c27
-rw-r--r--src/egl/main/eglsurface.h2
-rw-r--r--src/gallium/auxiliary/util/u_blit.c19
-rw-r--r--src/gallium/auxiliary/util/u_clear.h16
-rw-r--r--src/gallium/auxiliary/util/u_cpu_detect.c35
-rw-r--r--src/gallium/auxiliary/util/u_cpu_detect.h2
-rw-r--r--src/gallium/auxiliary/util/u_hash_table.c95
-rw-r--r--src/gallium/auxiliary/util/u_hash_table.h33
-rw-r--r--src/gallium/auxiliary/util/u_keymap.c2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_gen_fp.c4
-rw-r--r--src/gallium/drivers/i915/i915_debug.c2
-rw-r--r--src/gallium/drivers/i915/i915_fpc_translate.c2
-rw-r--r--src/gallium/drivers/llvmpipe/Makefile1
-rw-r--r--src/gallium/drivers/llvmpipe/SConscript1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_arit.c96
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_arit.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_const.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_conv.c240
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_conv.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_logic.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_pack.c419
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_pack.h95
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_swizzle.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_type.c29
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_type.h4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c7
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test.h20
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_blend.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_conv.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_format.c3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_main.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c14
-rw-r--r--src/gallium/drivers/nouveau/Makefile3
-rw-r--r--src/gallium/drivers/nouveau/nouveau_context.c41
-rw-r--r--src/gallium/drivers/nouveau/nouveau_context.h11
-rw-r--r--src/gallium/drivers/nv04/nv04_context.c28
-rw-r--r--src/gallium/drivers/nv04/nv04_context.h1
-rw-r--r--src/gallium/drivers/nv10/nv10_context.c27
-rw-r--r--src/gallium/drivers/nv10/nv10_context.h1
-rw-r--r--src/gallium/drivers/nv20/nv20_context.c28
-rw-r--r--src/gallium/drivers/nv20/nv20_context.h1
-rw-r--r--src/gallium/drivers/nv30/nv30_context.c30
-rw-r--r--src/gallium/drivers/nv30/nv30_context.h1
-rw-r--r--src/gallium/drivers/nv30/nv30_fragtex.c10
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c29
-rw-r--r--src/gallium/drivers/nv30/nv30_state_fb.c58
-rw-r--r--src/gallium/drivers/nv40/nv40_context.c30
-rw-r--r--src/gallium/drivers/nv40/nv40_context.h1
-rw-r--r--src/gallium/drivers/nv50/nv50_context.c34
-rw-r--r--src/gallium/drivers/nv50/nv50_context.h9
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c309
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c52
-rw-r--r--src/gallium/drivers/nv50/nv50_state.c26
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c53
-rw-r--r--src/gallium/drivers/nv50/nv50_tex.c177
-rw-r--r--src/gallium/drivers/nv50/nv50_texture.h2
-rw-r--r--src/gallium/drivers/nv50/nv50_vbo.c413
-rw-r--r--src/gallium/drivers/r300/Makefile3
-rw-r--r--src/gallium/drivers/r300/r300_chipset.c3
-rw-r--r--src/gallium/drivers/r300/r300_chipset.h6
-rw-r--r--src/gallium/drivers/r300/r300_clear.c3
-rw-r--r--src/gallium/drivers/r300/r300_clear.h4
-rw-r--r--src/gallium/drivers/r300/r300_context.c114
-rw-r--r--src/gallium/drivers/r300/r300_context.h45
-rw-r--r--src/gallium/drivers/r300/r300_debug.c1
-rw-r--r--src/gallium/drivers/r300/r300_emit.c140
-rw-r--r--src/gallium/drivers/r300/r300_emit.h11
-rw-r--r--src/gallium/drivers/r300/r300_flush.c27
-rw-r--r--src/gallium/drivers/r300/r300_flush.h7
-rw-r--r--src/gallium/drivers/r300/r300_fs.c17
-rw-r--r--src/gallium/drivers/r300/r300_fs.h12
-rw-r--r--src/gallium/drivers/r300/r300_query.c63
-rw-r--r--src/gallium/drivers/r300/r300_query.h4
-rw-r--r--src/gallium/drivers/r300/r300_reg.h36
-rw-r--r--src/gallium/drivers/r300/r300_render.c255
-rw-r--r--src/gallium/drivers/r300/r300_render.h52
-rw-r--r--src/gallium/drivers/r300/r300_screen.c45
-rw-r--r--src/gallium/drivers/r300/r300_screen.h5
-rw-r--r--src/gallium/drivers/r300/r300_shader_inlines.h47
-rw-r--r--src/gallium/drivers/r300/r300_state.c12
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c207
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.h4
-rw-r--r--src/gallium/drivers/r300/r300_state_inlines.h70
-rw-r--r--src/gallium/drivers/r300/r300_state_invariant.c5
-rw-r--r--src/gallium/drivers/r300/r300_state_invariant.h6
-rw-r--r--src/gallium/drivers/r300/r300_surface.c382
-rw-r--r--src/gallium/drivers/r300/r300_surface.h124
-rw-r--r--src/gallium/drivers/r300/r300_texture.c25
-rw-r--r--src/gallium/drivers/r300/r300_texture.h4
-rw-r--r--src/gallium/drivers/r300/r300_vs.c86
-rw-r--r--src/gallium/drivers/r300/r300_winsys.h9
-rw-r--r--src/gallium/drivers/r300/r3xx_fs.c74
-rw-r--r--src/gallium/drivers/r300/r3xx_fs.h32
-rw-r--r--src/gallium/drivers/r300/r5xx_fs.c125
-rw-r--r--src/gallium/drivers/r300/r5xx_fs.h32
-rw-r--r--src/gallium/drivers/trace/tr_drm.c4
-rw-r--r--src/gallium/drivers/trace/tr_screen.c3
-rw-r--r--src/gallium/include/pipe/p_compiler.h6
-rw-r--r--src/gallium/include/pipe/p_context.h3
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c22
-rw-r--r--src/gallium/state_trackers/dri/dri_extensions.c4
-rw-r--r--src/gallium/state_trackers/egl/egl_surface.c23
-rw-r--r--src/gallium/state_trackers/vega/renderer.c16
-rw-r--r--src/gallium/state_trackers/vega/vg_tracker.c24
-rw-r--r--src/gallium/state_trackers/xorg/Makefile3
-rw-r--r--src/gallium/state_trackers/xorg/xorg_composite.c279
-rw-r--r--src/gallium/state_trackers/xorg/xorg_crtc.c167
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c190
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c104
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.h8
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa_tgsi.c37
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa_tgsi.h3
-rw-r--r--src/gallium/state_trackers/xorg/xorg_output.c107
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.c162
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.h4
-rw-r--r--src/gallium/state_trackers/xorg/xorg_tracker.h9
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm.c4
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm.h1
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_r300.c33
-rw-r--r--src/glx/x11/glxcmds.c10
-rw-r--r--src/mesa/drivers/common/driverfuncs.c2
-rw-r--r--src/mesa/drivers/common/meta.c6
-rw-r--r--src/mesa/drivers/dri/Makefile.template24
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.h2
-rw-r--r--src/mesa/drivers/dri/fb/Makefile2
-rw-r--r--src/mesa/drivers/dri/ffb/Makefile1
-rw-r--r--src/mesa/drivers/dri/gamma/Makefile1
-rw-r--r--src/mesa/drivers/dri/i810/Makefile1
-rw-r--r--src/mesa/drivers/dri/i915/Makefile1
-rw-r--r--src/mesa/drivers/dri/i915/intel_tris.c8
-rw-r--r--src/mesa/drivers/dri/i965/Makefile1
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h5
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c12
-rw-r--r--src/mesa/drivers/dri/intel/intel_batchbuffer.h2
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c19
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h10
-rw-r--r--src/mesa/drivers/dri/intel/intel_syncobj.c2
-rw-r--r--src/mesa/drivers/dri/mach64/Makefile1
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_tex.c1
-rw-r--r--src/mesa/drivers/dri/mga/Makefile1
-rw-r--r--src/mesa/drivers/dri/r128/Makefile1
-rw-r--r--src/mesa/drivers/dri/r200/Makefile1
-rw-r--r--src/mesa/drivers/dri/r300/Makefile12
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c20
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c12
-rw-r--r--src/mesa/drivers/dri/r600/Makefile1
-rw-r--r--src/mesa/drivers/dri/r600/r600_cmdbuf.c18
-rw-r--r--src/mesa/drivers/dri/r600/r600_context.c1
-rw-r--r--src/mesa/drivers/dri/r600/r600_texstate.c12
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.c59
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.h1
-rw-r--r--src/mesa/drivers/dri/r600/r700_fragprog.c37
-rw-r--r--src/mesa/drivers/dri/radeon/Makefile1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_bo_legacy.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_fbo.c5
-rw-r--r--src/mesa/drivers/dri/s3v/Makefile36
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_common.h83
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_context.c260
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_context.h443
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_dd.c90
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_dri.h143
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_inithw.c79
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_lock.c62
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_lock.h99
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_macros.h230
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_regs.h367
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_render.c203
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_screen.c99
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_screen.h39
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_span.c219
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_state.c888
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_tex.c548
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_tex.h28
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_texmem.c582
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_texstate.c300
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_tris.c850
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_tris.h11
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_tritmp.h958
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_vb.c339
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_vb.h39
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_xmesa.c341
-rw-r--r--src/mesa/drivers/dri/s3v/s3virgetri.h383
-rw-r--r--src/mesa/drivers/dri/savage/Makefile1
-rw-r--r--src/mesa/drivers/dri/sis/Makefile1
-rw-r--r--src/mesa/drivers/dri/swrast/Makefile1
-rw-r--r--src/mesa/drivers/dri/tdfx/Makefile2
-rw-r--r--src/mesa/drivers/dri/trident/Makefile26
-rw-r--r--src/mesa/drivers/dri/trident/trident_context.c465
-rw-r--r--src/mesa/drivers/dri/trident/trident_context.h242
-rw-r--r--src/mesa/drivers/dri/trident/trident_dd.c110
-rw-r--r--src/mesa/drivers/dri/trident/trident_dri.h28
-rw-r--r--src/mesa/drivers/dri/trident/trident_lock.h11
-rw-r--r--src/mesa/drivers/dri/trident/trident_state.c548
-rw-r--r--src/mesa/drivers/dri/trident/trident_tris.c1125
-rw-r--r--src/mesa/drivers/dri/trident/trident_vb.c434
-rw-r--r--src/mesa/drivers/dri/unichrome/Makefile1
-rw-r--r--src/mesa/main/context.c39
-rw-r--r--src/mesa/main/context.h8
-rw-r--r--src/mesa/main/dd.h7
-rw-r--r--src/mesa/main/debug.c110
-rw-r--r--src/mesa/main/debug.h6
-rw-r--r--src/mesa/main/imports.c15
-rw-r--r--src/mesa/main/light.c2
-rw-r--r--src/mesa/main/mtypes.h17
-rw-r--r--src/mesa/main/shaders.c24
-rw-r--r--src/mesa/main/texobj.c2
-rw-r--r--src/mesa/main/texstate.c7
-rw-r--r--src/mesa/shader/lex.yy.c1863
-rw-r--r--src/mesa/shader/prog_print.c3
-rw-r--r--src/mesa/shader/program_lexer.l9
-rw-r--r--src/mesa/shader/program_parse.tab.c2301
-rw-r--r--src/mesa/shader/program_parse.tab.h191
-rw-r--r--src/mesa/shader/shader_api.c27
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c16
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c19
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c16
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c3
-rw-r--r--src/mesa/tnl/t_context.h1
-rw-r--r--src/mesa/tnl/t_vb_cliptmp.h103
-rw-r--r--src/mesa/tnl/t_vb_program.c15
-rw-r--r--src/mesa/tnl/t_vb_vertex.c31
-rw-r--r--src/mesa/vbo/vbo_exec_api.c22
-rw-r--r--src/mesa/vbo/vbo_exec_array.c78
254 files changed, 7207 insertions, 16324 deletions
diff --git a/Makefile b/Makefile
index 413a1b4372e..7f073fd516c 100644
--- a/Makefile
+++ b/Makefile
@@ -505,9 +505,11 @@ rm_depend:
touch $$dep ; \
done
-lib_gz:
- rm -f configs/current ; \
- rm -f configs/autoconf ; \
+rm_config:
+ rm -f configs/current
+ rm -f configs/autoconf
+
+lib_gz: rm_config
cd .. ; \
tar -cf $(LIB_NAME).tar $(LIB_FILES) ; \
gzip $(LIB_NAME).tar ; \
@@ -525,9 +527,7 @@ glut_gz:
gzip $(GLUT_NAME).tar ; \
mv $(GLUT_NAME).tar.gz $(DIRECTORY)
-lib_bz2:
- rm -f configs/current ; \
- rm -f configs/autoconf ; \
+lib_bz2: rm_config
cd .. ; \
tar -cf $(LIB_NAME).tar $(LIB_FILES) ; \
bzip2 $(LIB_NAME).tar ; \
@@ -545,9 +545,7 @@ glut_bz2:
bzip2 $(GLUT_NAME).tar ; \
mv $(GLUT_NAME).tar.bz2 $(DIRECTORY)
-lib_zip:
- rm -f configs/current ; \
- rm -f configs/autoconf ; \
+lib_zip: rm_config
rm -f $(LIB_NAME).zip ; \
cd .. ; \
zip -qr $(LIB_NAME).zip $(LIB_FILES) ; \
@@ -576,5 +574,7 @@ md5:
@-md5sum $(GLUT_NAME).tar.bz2
@-md5sum $(GLUT_NAME).zip
-.PHONY: tarballs rm_depend lib_gz demo_gz glut_gz lib_bz2 demo_bz2 \
- glut_bz2 lib_zip demo_zip glut_zip md5
+.PHONY: tarballs rm_depend rm_config md5 \
+ lib_gz demo_gz glut_gz \
+ lib_bz2 demo_bz2 glut_bz2 \
+ lib_zip demo_zip glut_zip
diff --git a/configs/linux-dri b/configs/linux-dri
index 0998ba8549d..6c3c0ab9211 100644
--- a/configs/linux-dri
+++ b/configs/linux-dri
@@ -63,5 +63,5 @@ GALLIUM_WINSYS_DIRS = drm
GALLIUM_WINSYS_DRM_DIRS = intel
GALLIUM_STATE_TRACKERS_DIRS = egl
-DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
- savage sis tdfx trident unichrome ffb swrast
+DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon \
+ savage sis tdfx unichrome ffb swrast
diff --git a/configs/linux-dri-debug b/configs/linux-dri-debug
index c3a458459d8..0dbf428830a 100644
--- a/configs/linux-dri-debug
+++ b/configs/linux-dri-debug
@@ -11,6 +11,6 @@ ARCH_FLAGS = -DDEBUG
#DRI_DIRS = i915tex i915
#DRI_DIRS = i965
#DRI_DIRS = radeon r200 r300
-#DRI_DIRS = unichrome sis trident
+#DRI_DIRS = unichrome sis
#DRI_DIRS = i810 mga r128 tdfx
diff --git a/configs/linux-dri-xcb b/configs/linux-dri-xcb
index e9c15a82e42..827fb973308 100644
--- a/configs/linux-dri-xcb
+++ b/configs/linux-dri-xcb
@@ -68,5 +68,5 @@ WINDOW_SYSTEM=dri
# gamma are missing because they have not been converted to use the new
# interface.
-DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon s3v \
- savage sis tdfx trident unichrome ffb
+DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon \
+ savage sis tdfx unichrome ffb
diff --git a/configure.ac b/configure.ac
index 2a67bd62b25..910c0b1a4b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -230,6 +230,8 @@ else
LIB_EXTENSION='dylib' ;;
cygwin* )
LIB_EXTENSION='dll' ;;
+ aix* )
+ LIB_EXTENSION='a' ;;
* )
LIB_EXTENSION='so' ;;
esac
@@ -766,8 +768,8 @@ if test "$mesa_driver" = dri; then
# default drivers
if test "x$DRI_DIRS" = "xyes"; then
- DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon s3v \
- savage sis tdfx trident unichrome ffb swrast"
+ DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
+ savage sis tdfx unichrome ffb swrast"
fi
DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
@@ -1150,9 +1152,9 @@ yes)
fi
if test "$tracker" = xorg; then
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
- HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71"
+ HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
HAVE_XEXTPROTO_71="no")
- fi
+ fi
done
GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
;;
diff --git a/docs/envvars.html b/docs/envvars.html
index 6d7a321da9f..b2c0e01ee32 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -28,6 +28,7 @@ Setting this variable automatically sets the MESA_TEX_PROG variable as well.
<li>MESA_EXTENSION_OVERRIDE - can be used to enable/disable extensions.
A value such as "GL_EXT_foo -GL_EXT_bar" will enable the GL_EXT_foo extension
and disable the GL_EXT_bar extension.
+<li>MESA_GLSL - <a href="shading.html#envvars">shading language options</a>
</ul>
<p>
diff --git a/docs/relnotes-7.6.1.html b/docs/relnotes-7.6.1.html
index 47a906f1f4b..9d28a5b2b5a 100644
--- a/docs/relnotes-7.6.1.html
+++ b/docs/relnotes-7.6.1.html
@@ -44,6 +44,7 @@ tbd
<li>r300: Work around an issue with very large fragment programs on R500.
<li>Fake glXQueryDrawable() didn't return good values (bug 24320)
<li>Fixed AUX buffer breakage (bug 24426).
+<li>Fixed locale-dependent float parsing bug in GLSL compiler (bug 24531)
</ul>
</body>
diff --git a/docs/shading.html b/docs/shading.html
index 77c86be3aa6..bd02335a803 100644
--- a/docs/shading.html
+++ b/docs/shading.html
@@ -39,7 +39,8 @@ Contents
<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:
+list of keywords to control some aspects of the GLSL compiler and shader
+execution. These are generally used for debugging.
</p>
<ul>
<li>dump - print GLSL shader code to stdout at link time
@@ -49,6 +50,12 @@ list of keywords to control some aspects of the GLSL compiler:
<li>nopt - disable compiler optimizations
<li>opt - force compiler optimizations
<li>uniform - print message to stdout when glUniform is called
+<li>nopvert - force vertex shaders to be a simple shader that just transforms
+ the vertex position with ftransform() and passes through the color and
+ texcoord[0] attributes.
+<li>nopfrag - force fragment shader to be a simple shader that passes
+ through the color attribute.
+<li>useprog - log glUseProgram calls to stderr
</ul>
<p>
Example: export MESA_GLSL=dump,nopt
diff --git a/progs/Makefile b/progs/Makefile
index c99f4eebcc1..3700707dfb1 100644
--- a/progs/Makefile
+++ b/progs/Makefile
@@ -15,18 +15,22 @@ message:
subdirs:
- @for dir in $(SUBDIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir && $(MAKE)) || exit 1 ; \
- fi \
- done
+ @if test -n "$(SUBDIRS)" ; then \
+ for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE)) || exit 1 ; \
+ fi \
+ done \
+ fi
# Dummy install target
install:
clean:
- -@for dir in $(SUBDIRS) tests ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir && $(MAKE) clean) ; \
- fi \
- done
+ -@if test -n "$(SUBDIRS)" ; then \
+ for dir in $(SUBDIRS) tests ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE) clean) ; \
+ fi \
+ done \
+ fi
diff --git a/progs/demos/fbo_firecube.c b/progs/demos/fbo_firecube.c
index 4e42924a09e..b3f7e00e5af 100644
--- a/progs/demos/fbo_firecube.c
+++ b/progs/demos/fbo_firecube.c
@@ -938,7 +938,14 @@ reshape(int width, int height)
static void
init_fbotexture()
{
+ static const GLenum depthFormats[] = {
+ GL_DEPTH_COMPONENT,
+ GL_DEPTH_COMPONENT16,
+ GL_DEPTH_COMPONENT32
+ };
+ static int numDepthFormats = sizeof(depthFormats) / sizeof(depthFormats[0]);
GLint i;
+ GLenum stat;
/* gen framebuffer id, delete it, do some assertions, just for testing */
glGenFramebuffersEXT(1, &MyFB);
@@ -969,18 +976,31 @@ init_fbotexture()
/* make depth renderbuffer */
glGenRenderbuffersEXT(1, &DepthRB);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB);
- glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
- TexWidth, TexHeight);
- CheckError(__LINE__);
+ /* we may have to try several formats */
+ for (i = 0; i < numDepthFormats; i++) {
+ glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, depthFormats[i],
+ TexWidth, TexHeight);
+ CheckError(__LINE__);
+
+ glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
+ GL_RENDERBUFFER_EXT, DepthRB);
+ CheckError(__LINE__);
+ stat = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+ if (stat == GL_FRAMEBUFFER_COMPLETE_EXT) {
+ break;
+ }
+ }
+
+ if (stat != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ fprintf(stderr, "Error: unable to get usable FBO combination!\n");
+ exit(1);
+ }
+
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
- GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i);
+ GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i);
CheckError(__LINE__);
printf("Depth renderbuffer size = %d bits\n", i);
- /* attach DepthRB to MyFB */
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, DepthRB);
- CheckError(__LINE__);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
/*
diff --git a/progs/egl/eglgears.c b/progs/egl/eglgears.c
index 0eee9ecf4da..052d0f9e25d 100644
--- a/progs/egl/eglgears.c
+++ b/progs/egl/eglgears.c
@@ -274,10 +274,10 @@ draw(void)
static void
reshape(int width, int height)
{
- glViewport(0, 0, (GLint) width, (GLint) height);
-
GLfloat h = (GLfloat) height / (GLfloat) width;
+ glViewport(0, 0, (GLint) width, (GLint) height);
+
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
@@ -333,6 +333,8 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
double st = current_time();
double ct = st;
int frames = 0;
+ GLfloat seconds, fps;
+
while (ct - st < ttr)
{
double tt = current_time();
@@ -352,8 +354,8 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
frames++;
}
- GLfloat seconds = ct - st;
- GLfloat fps = frames / seconds;
+ seconds = ct - st;
+ fps = frames / seconds;
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
}
diff --git a/progs/egl/egltri.c b/progs/egl/egltri.c
index 79f6702007e..9bbc3cddaf1 100644
--- a/progs/egl/egltri.c
+++ b/progs/egl/egltri.c
@@ -127,6 +127,7 @@ static void run(EGLDisplay dpy, EGLSurface surf, int ttr)
double st = current_time();
double ct = st;
int frames = 0;
+ GLfloat seconds, fps;
while (ct - st < ttr)
{
@@ -139,8 +140,8 @@ static void run(EGLDisplay dpy, EGLSurface surf, int ttr)
frames++;
}
- GLfloat seconds = ct - st;
- GLfloat fps = frames / seconds;
+ seconds = ct - st;
+ fps = frames / seconds;
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
}
diff --git a/progs/egl/peglgears.c b/progs/egl/peglgears.c
index 1ddb691677f..212d1acf692 100644
--- a/progs/egl/peglgears.c
+++ b/progs/egl/peglgears.c
@@ -274,10 +274,10 @@ draw(void)
static void
reshape(int width, int height)
{
- glViewport(0, 0, (GLint) width, (GLint) height);
-
GLfloat h = (GLfloat) height / (GLfloat) width;
+ glViewport(0, 0, (GLint) width, (GLint) height);
+
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
@@ -333,6 +333,8 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
double st = current_time();
double ct = st;
int frames = 0;
+ GLfloat seconds, fps;
+
while (ct - st < ttr)
{
double tt = current_time();
@@ -352,8 +354,8 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
frames++;
}
- GLfloat seconds = ct - st;
- GLfloat fps = frames / seconds;
+ seconds = ct - st;
+ fps = frames / seconds;
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
}
diff --git a/progs/egl/xeglgears.c b/progs/egl/xeglgears.c
index 72ed0052832..614a6256037 100644
--- a/progs/egl/xeglgears.c
+++ b/progs/egl/xeglgears.c
@@ -95,9 +95,6 @@ static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
-static GLboolean fullscreen = GL_FALSE; /* Create a single fullscreen window */
-
-
/*
*
* Draw a gear wheel. You'll probably want to call this function when
@@ -327,122 +324,235 @@ init(void)
}
-/*
- * Create an RGB, double-buffered X window.
- * Return the window and context handles.
- */
-static void
-make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
- const char *name,
- int x, int y, int width, int height,
- Window *winRet,
- EGLContext *ctxRet,
- EGLSurface *surfRet)
-{
- static const EGLint attribs[] = {
- EGL_RED_SIZE, 1,
- EGL_GREEN_SIZE, 1,
- EGL_BLUE_SIZE, 1,
- /*EGL_DOUBLEBUFFER,*/
- EGL_DEPTH_SIZE, 1,
- EGL_NONE
- };
+struct egl_manager {
+ EGLNativeDisplayType xdpy;
+ EGLNativeWindowType xwin;
+ EGLNativePixmapType xpix;
- int scrnum;
- XSetWindowAttributes attr;
- unsigned long mask;
- Window root;
- Window win;
- XVisualInfo *visInfo, visTemplate;
- int num_visuals;
+ EGLDisplay dpy;
+ EGLConfig conf;
EGLContext ctx;
- EGLConfig config;
- EGLint num_configs, vid;
- scrnum = DefaultScreen( x_dpy );
- root = RootWindow( x_dpy, scrnum );
+ EGLSurface win;
+ EGLSurface pix;
+ EGLSurface pbuf;
- if (fullscreen) {
- x = 0; y = 0;
- width = DisplayWidth( x_dpy, scrnum );
- height = DisplayHeight( x_dpy, scrnum );
+ EGLBoolean verbose;
+ EGLint major, minor;
+};
+
+static struct egl_manager *
+egl_manager_new(EGLNativeDisplayType xdpy, const EGLint *attrib_list,
+ EGLBoolean verbose)
+{
+ struct egl_manager *eman;
+ const char *ver;
+ EGLint num_conf;
+
+ eman = calloc(1, sizeof(*eman));
+ if (!eman)
+ return NULL;
+
+ eman->verbose = verbose;
+ eman->xdpy = xdpy;
+
+ eman->dpy = eglGetDisplay(eman->xdpy);
+ if (eman->dpy == EGL_NO_DISPLAY) {
+ printf("eglGetDisplay() failed\n");
+ free(eman);
+ return NULL;
}
- if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
- printf("Error: couldn't get an EGL visual config\n");
- exit(1);
+ if (!eglInitialize(eman->dpy, &eman->major, &eman->minor)) {
+ printf("eglInitialize() failed\n");
+ free(eman);
+ return NULL;
}
- if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
- printf("Error: eglGetConfigAttrib() failed\n");
- exit(1);
+ ver = eglQueryString(eman->dpy, EGL_VERSION);
+ printf("EGL_VERSION = %s\n", ver);
+
+ if (!eglChooseConfig(eman->dpy, attrib_list, &eman->conf, 1, &num_conf) ||
+ !num_conf) {
+ printf("eglChooseConfig() failed\n");
+ eglTerminate(eman->dpy);
+ free(eman);
+ return NULL;
}
- /* The X window visual must match the EGL config */
- visTemplate.visualid = vid;
- visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
- if (!visInfo) {
- printf("Error: couldn't get X visual\n");
- exit(1);
+ eman->ctx = eglCreateContext(eman->dpy, eman->conf, EGL_NO_CONTEXT, NULL);
+ if (eman->ctx == EGL_NO_CONTEXT) {
+ printf("eglCreateContext() failed\n");
+ eglTerminate(eman->dpy);
+ free(eman);
+ return NULL;
+ }
+
+ return eman;
+}
+
+static EGLBoolean
+egl_manager_create_window(struct egl_manager *eman, const char *name,
+ EGLint w, EGLint h, EGLBoolean need_surface,
+ EGLBoolean fullscreen, const EGLint *attrib_list)
+{
+ XVisualInfo vinfo_template, *vinfo = NULL;
+ EGLint val, num_vinfo;
+ Window root;
+ XSetWindowAttributes attrs;
+ unsigned long mask;
+ EGLint x = 0, y = 0;
+
+ if (!eglGetConfigAttrib(eman->dpy, eman->conf,
+ EGL_NATIVE_VISUAL_ID, &val)) {
+ printf("eglGetConfigAttrib() failed\n");
+ return EGL_FALSE;
+ }
+ if (val) {
+ vinfo_template.visualid = (VisualID) val;
+ vinfo = XGetVisualInfo(eman->xdpy, VisualIDMask, &vinfo_template, &num_vinfo);
+ }
+ /* try harder if window surface is not needed */
+ if (!vinfo && !need_surface &&
+ eglGetConfigAttrib(eman->dpy, eman->conf, EGL_BUFFER_SIZE, &val)) {
+ if (val == 32)
+ val = 24;
+ vinfo_template.depth = val;
+ vinfo = XGetVisualInfo(eman->xdpy, VisualDepthMask, &vinfo_template, &num_vinfo);
+ }
+
+ if (!vinfo) {
+ printf("XGetVisualInfo() failed\n");
+ return EGL_FALSE;
+ }
+
+ root = DefaultRootWindow(eman->xdpy);
+ if (fullscreen) {
+ x = y = 0;
+ w = DisplayWidth(eman->xdpy, DefaultScreen(eman->xdpy));
+ h = DisplayHeight(eman->xdpy, DefaultScreen(eman->xdpy));
}
/* window attributes */
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
- attr.override_redirect = fullscreen;
+ attrs.background_pixel = 0;
+ attrs.border_pixel = 0;
+ attrs.colormap = XCreateColormap(eman->xdpy, root, vinfo->visual, AllocNone);
+ attrs.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
+ attrs.override_redirect = fullscreen;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
- win = XCreateWindow( x_dpy, root, 0, 0, width, height,
- 0, visInfo->depth, InputOutput,
- visInfo->visual, mask, &attr );
+ eman->xwin = XCreateWindow(eman->xdpy, root, x, y, w, h,
+ 0, vinfo->depth, InputOutput,
+ vinfo->visual, mask, &attrs);
+ XFree(vinfo);
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
- sizehints.width = width;
- sizehints.height = height;
+ sizehints.width = w;
+ sizehints.height = h;
sizehints.flags = USSize | USPosition;
- XSetNormalHints(x_dpy, win, &sizehints);
- XSetStandardProperties(x_dpy, win, name, name,
- None, (char **)NULL, 0, &sizehints);
+ XSetNormalHints(eman->xdpy, eman->xwin, &sizehints);
+ XSetStandardProperties(eman->xdpy, eman->xwin, name, name,
+ None, (char **)NULL, 0, &sizehints);
}
- eglBindAPI(EGL_OPENGL_API);
+ if (need_surface) {
+ eman->win = eglCreateWindowSurface(eman->dpy, eman->conf,
+ eman->xwin, attrib_list);
+ if (eman->win == EGL_NO_SURFACE) {
+ printf("eglCreateWindowSurface() failed\n");
+ XDestroyWindow(eman->xdpy, eman->xwin);
+ eman->xwin = None;
+ return EGL_FALSE;
+ }
+ }
+
+ XMapWindow(eman->xdpy, eman->xwin);
+
+ return EGL_TRUE;
+}
- ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
- if (!ctx) {
- printf("Error: glXCreateContext failed\n");
- exit(1);
+static EGLBoolean
+egl_manager_create_pixmap(struct egl_manager *eman, EGLNativeWindowType xwin,
+ EGLBoolean need_surface, const EGLint *attrib_list)
+{
+ XWindowAttributes attrs;
+
+ if (!XGetWindowAttributes(eman->xdpy, xwin, &attrs)) {
+ printf("XGetWindowAttributes() failed\n");
+ return EGL_FALSE;
+ }
+
+ eman->xpix = XCreatePixmap(eman->xdpy, xwin,
+ attrs.width, attrs.height, attrs.depth);
+
+ if (need_surface) {
+ eman->pix = eglCreatePixmapSurface(eman->dpy, eman->conf,
+ eman->xpix, attrib_list);
+ if (eman->pix == EGL_NO_SURFACE) {
+ printf("eglCreatePixmapSurface() failed\n");
+ XFreePixmap(eman->xdpy, eman->xpix);
+ eman->xpix = None;
+ return EGL_FALSE;
+ }
}
- *surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
+ return EGL_TRUE;
+}
- XFree(visInfo);
+static EGLBoolean
+egl_manager_create_pbuffer(struct egl_manager *eman, const EGLint *attrib_list)
+{
+ eman->pbuf = eglCreatePbufferSurface(eman->dpy, eman->conf, attrib_list);
+ if (eman->pbuf == EGL_NO_SURFACE) {
+ printf("eglCreatePbufferSurface() failed\n");
+ return EGL_FALSE;
+ }
- *winRet = win;
- *ctxRet = ctx;
+ return EGL_TRUE;
}
+static void
+egl_manager_destroy(struct egl_manager *eman)
+{
+ eglMakeCurrent(eman->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ eglTerminate(eman->dpy);
+
+ if (eman->xwin != None)
+ XDestroyWindow(eman->xdpy, eman->xwin);
+ if (eman->xpix != None)
+ XFreePixmap(eman->xdpy, eman->xpix);
+
+ free(eman);
+}
static void
-event_loop(Display *dpy, Window win,
- EGLDisplay egl_dpy, EGLSurface egl_surf)
+event_loop(struct egl_manager *eman, EGLint surface_type, EGLint w, EGLint h)
{
+ GC gc = XCreateGC(eman->xdpy, eman->xwin, 0, NULL);
+ EGLint orig_w = w, orig_h = h;
+
+ if (surface_type == EGL_PBUFFER_BIT)
+ printf("there will be no screen update if "
+ "eglCopyBuffers() is not implemented\n");
+
while (1) {
- while (XPending(dpy) > 0) {
+ while (XPending(eman->xdpy) > 0) {
XEvent event;
- XNextEvent(dpy, &event);
+ XNextEvent(eman->xdpy, &event);
switch (event.type) {
- case Expose:
+ case Expose:
/* we'll redraw below */
- break;
- case ConfigureNotify:
- reshape(event.xconfigure.width, event.xconfigure.height);
- break;
+ break;
+ case ConfigureNotify:
+ w = event.xconfigure.width;
+ h = event.xconfigure.height;
+ if (surface_type == EGL_WINDOW_BIT)
+ reshape(w, h);
+ break;
case KeyPress:
{
char buffer[10];
@@ -476,6 +586,7 @@ event_loop(Display *dpy, Window win,
static int frames = 0;
static double tRot0 = -1.0, tRate0 = -1.0;
double dt, t = current_time();
+ int x, y;
if (tRot0 < 0.0)
tRot0 = t;
dt = t - tRot0;
@@ -487,7 +598,25 @@ event_loop(Display *dpy, Window win,
angle -= 3600.0;
draw();
- eglSwapBuffers(egl_dpy, egl_surf);
+ switch (surface_type) {
+ case EGL_WINDOW_BIT:
+ eglSwapBuffers(eman->dpy, eman->win);
+ break;
+ case EGL_PBUFFER_BIT:
+ eglWaitClient();
+ if (!eglCopyBuffers(eman->xdpy, eman->pbuf, eman->xpix))
+ break;
+ /* fall through */
+ case EGL_PIXMAP_BIT:
+ eglWaitClient();
+ for (x = 0; x < w; x += orig_w) {
+ for (y = 0; y < h; y += orig_h) {
+ XCopyArea(eman->xdpy, eman->xpix, eman->xwin, gc,
+ 0, 0, orig_w, orig_h, x, y);
+ }
+ }
+ break;
+ }
frames++;
@@ -503,6 +632,8 @@ event_loop(Display *dpy, Window win,
}
}
}
+
+ XFreeGC(eman->xdpy, gc);
}
@@ -513,6 +644,8 @@ usage(void)
printf(" -display <displayname> set the display to run on\n");
printf(" -fullscreen run in fullscreen mode\n");
printf(" -info display OpenGL renderer info\n");
+ printf(" -pixmap use pixmap surface\n");
+ printf(" -pbuffer use pbuffer surface\n");
}
@@ -521,15 +654,23 @@ main(int argc, char *argv[])
{
const int winWidth = 300, winHeight = 300;
Display *x_dpy;
- Window win;
- EGLSurface egl_surf;
- EGLContext egl_ctx;
- EGLDisplay egl_dpy;
char *dpyName = NULL;
+ struct egl_manager *eman;
+ EGLint attribs[] = {
+ EGL_SURFACE_TYPE, 0, /* filled later */
+ EGL_RED_SIZE, 1,
+ EGL_GREEN_SIZE, 1,
+ EGL_BLUE_SIZE, 1,
+ EGL_DEPTH_SIZE, 1,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
+ EGL_NONE
+ };
+ char win_title[] = "xeglgears (window/pixmap/pbuffer)";
+ EGLint surface_type = EGL_WINDOW_BIT;
GLboolean printInfo = GL_FALSE;
- EGLint egl_major, egl_minor;
+ GLboolean fullscreen = GL_FALSE;
+ EGLBoolean ret;
int i;
- const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
@@ -542,12 +683,21 @@ main(int argc, char *argv[])
else if (strcmp(argv[i], "-fullscreen") == 0) {
fullscreen = GL_TRUE;
}
+ else if (strcmp(argv[i], "-pixmap") == 0) {
+ surface_type = EGL_PIXMAP_BIT;
+ }
+ else if (strcmp(argv[i], "-pbuffer") == 0) {
+ surface_type = EGL_PBUFFER_BIT;
+ }
else {
usage();
return -1;
}
}
+ /* set surface type */
+ attribs[1] = surface_type;
+
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
@@ -555,26 +705,60 @@ main(int argc, char *argv[])
return -1;
}
- egl_dpy = eglGetDisplay(x_dpy);
- if (!egl_dpy) {
- printf("Error: eglGetDisplay() failed\n");
- return -1;
- }
+ eglBindAPI(EGL_OPENGL_API);
- if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
- printf("Error: eglInitialize() failed\n");
+ eman = egl_manager_new(x_dpy, attribs, printInfo);
+ if (!eman) {
+ XCloseDisplay(x_dpy);
return -1;
}
- s = eglQueryString(egl_dpy, EGL_VERSION);
- printf("EGL_VERSION = %s\n", s);
-
- make_x_window(x_dpy, egl_dpy,
- "glxgears", 0, 0, winWidth, winHeight,
- &win, &egl_ctx, &egl_surf);
+ snprintf(win_title, sizeof(win_title), "xeglgears (%s)",
+ (surface_type == EGL_WINDOW_BIT) ? "window" :
+ (surface_type == EGL_PIXMAP_BIT) ? "pixmap" : "pbuffer");
+
+ /* create surface(s) */
+ switch (surface_type) {
+ case EGL_WINDOW_BIT:
+ ret = egl_manager_create_window(eman, win_title, winWidth, winHeight,
+ EGL_TRUE, fullscreen, NULL);
+ if (ret)
+ ret = eglMakeCurrent(eman->dpy, eman->win, eman->win, eman->ctx);
+ break;
+ case EGL_PIXMAP_BIT:
+ ret = (egl_manager_create_window(eman, win_title, winWidth, winHeight,
+ EGL_FALSE, fullscreen, NULL) &&
+ egl_manager_create_pixmap(eman, eman->xwin,
+ EGL_TRUE, NULL));
+ if (ret)
+ ret = eglMakeCurrent(eman->dpy, eman->pix, eman->pix, eman->ctx);
+ break;
+ case EGL_PBUFFER_BIT:
+ {
+ EGLint pbuf_attribs[] = {
+ EGL_WIDTH, winWidth,
+ EGL_HEIGHT, winHeight,
+ EGL_NONE
+ };
+ ret = (egl_manager_create_window(eman, win_title, winWidth, winHeight,
+ EGL_FALSE, fullscreen, NULL) &&
+ egl_manager_create_pixmap(eman, eman->xwin,
+ EGL_FALSE, NULL) &&
+ egl_manager_create_pbuffer(eman, pbuf_attribs));
+ if (ret)
+ ret = eglMakeCurrent(eman->dpy, eman->pbuf, eman->pbuf, eman->ctx);
+ }
+ break;
+ default:
+ ret = EGL_FALSE;
+ break;
+ }
- XMapWindow(x_dpy, win);
- eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx);
+ if (!ret) {
+ egl_manager_destroy(eman);
+ XCloseDisplay(x_dpy);
+ return -1;
+ }
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
@@ -590,18 +774,13 @@ main(int argc, char *argv[])
*/
reshape(winWidth, winHeight);
- event_loop(x_dpy, win, egl_dpy, egl_surf);
+ event_loop(eman, surface_type, winWidth, winHeight);
glDeleteLists(gear1, 1);
glDeleteLists(gear2, 1);
glDeleteLists(gear3, 1);
- eglDestroyContext(egl_dpy, egl_ctx);
- eglDestroySurface(egl_dpy, egl_surf);
- eglTerminate(egl_dpy);
-
-
- XDestroyWindow(x_dpy, win);
+ egl_manager_destroy(eman);
XCloseDisplay(x_dpy);
return 0;
diff --git a/progs/tests/arraytexture.c b/progs/tests/arraytexture.c
index 6c0484df0de..28252a354bf 100644
--- a/progs/tests/arraytexture.c
+++ b/progs/tests/arraytexture.c
@@ -77,10 +77,6 @@ static GLfloat texZ = 0.0;
static GLfloat texZ_dir = 0.01;
static GLint num_layers;
-static PFNGLBINDPROGRAMARBPROC bind_program;
-static PFNGLPROGRAMSTRINGARBPROC program_string;
-static PFNGLGENPROGRAMSARBPROC gen_programs;
-
static void
PrintString(const char *s)
@@ -125,13 +121,13 @@ static void Display(void)
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0);
+ glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
glColor3f(1,1,1);
glRasterPos3f(-0.9, -0.9, 0.0);
sprintf(str, "Texture Z coordinate = %4.1f", texZ);
PrintString(str);
- (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 1);
+ glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 1);
GL_CHECK_ERROR();
glEnable(GL_TEXTURE_2D_ARRAY_EXT);
GL_CHECK_ERROR();
@@ -159,7 +155,7 @@ static void Display(void)
glDisable(GL_TEXTURE_2D_ARRAY_EXT);
GL_CHECK_ERROR();
- (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0);
+ glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
GL_CHECK_ERROR();
glutSwapBuffers();
@@ -226,8 +222,8 @@ compile_fragment_program(GLuint id, const char *prog)
int err;
err = glGetError();
- (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, id);
- (*program_string)(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
+ glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, id);
+ glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog), (const GLubyte *) prog);
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
@@ -264,11 +260,6 @@ static void Init(void)
require_extension("GL_MESA_texture_array");
require_extension("GL_SGIS_generate_mipmap");
- bind_program = glutGetProcAddress("glBindProgramARB");
- program_string = glutGetProcAddress("glProgramStringARB");
- gen_programs = glutGetProcAddress("glGenProgramsARB");
-
-
for (num_layers = 0; textures[num_layers] != NULL; num_layers++)
/* empty */ ;
diff --git a/progs/tests/invert.c b/progs/tests/invert.c
index 63099fbd221..3bc97a460b6 100644
--- a/progs/tests/invert.c
+++ b/progs/tests/invert.c
@@ -128,7 +128,7 @@ static void Init( void )
{
const char * const ver_string = (const char * const)
glGetString( GL_VERSION );
- const float ver = strtof( ver_string, NULL );
+ const float ver = strtod( ver_string, NULL );
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
diff --git a/progs/tests/prog_parameter.c b/progs/tests/prog_parameter.c
index 6dd956c4023..28e3b537acd 100644
--- a/progs/tests/prog_parameter.c
+++ b/progs/tests/prog_parameter.c
@@ -116,7 +116,7 @@ static int set_parameter_batch( GLsizei count, GLfloat * param,
for ( i = 0 ; i < (4 * count) ; i++ ) {
- param[i] = (GLfloat) random() / (GLfloat) random();
+ param[i] = (GLfloat) rand() / (GLfloat) rand();
}
/* Try using the "classic" interface.
@@ -153,7 +153,7 @@ static int set_parameter_batch( GLsizei count, GLfloat * param,
for ( i = 0 ; i < (4 * count) ; i++ ) {
- param[i] = (GLfloat) random() / (GLfloat) random();
+ param[i] = (GLfloat) rand() / (GLfloat) rand();
}
printf("Testing glProgram%sParameters4fvEXT (count = %u)...\n", name, count);
diff --git a/progs/trivial/tri-query.c b/progs/trivial/tri-query.c
index 85e39df2dfa..94956a86f33 100644
--- a/progs/trivial/tri-query.c
+++ b/progs/trivial/tri-query.c
@@ -39,6 +39,11 @@ GLenum doubleBuffer;
static void Init(void)
{
+ if (!glutExtensionSupported("GL_ARB_occlusion_query")) {
+ fprintf(stderr, "Sorry, this program requires GL_ARB_occlusion_query\n");
+ exit(1);
+ }
+
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));
diff --git a/progs/xdemos/glsync.c b/progs/xdemos/glsync.c
index 34167d339f3..da87306cf2a 100644
--- a/progs/xdemos/glsync.c
+++ b/progs/xdemos/glsync.c
@@ -95,7 +95,7 @@ enum sync_type {
static void usage(char *name)
{
printf("usage: %s [-w <width>] [-h <height>] [-s<sync method>] "
- "[-vc]\n", name);
+ "[-v]\n", name);
printf("\t-s<sync method>:\n");
printf("\t\tn: none\n");
printf("\t\ts: SGI video sync extension\n");
diff --git a/scons/gallium.py b/scons/gallium.py
index 38782ac7266..34877b2f8b3 100644
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -263,7 +263,10 @@ def generate(env):
if msvc and env['toolchain'] != 'winddk':
cppdefines += [
'VC_EXTRALEAN',
+ '_CRT_SECURE_NO_WARNINGS',
'_CRT_SECURE_NO_DEPRECATE',
+ '_SCL_SECURE_NO_WARNINGS',
+ '_SCL_SECURE_NO_DEPRECATE',
]
if debug:
cppdefines += ['_DEBUG']
@@ -343,10 +346,18 @@ def generate(env):
ccflags += [
'-m32',
#'-march=pentium4',
- '-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
- '-mstackrealign', # ensure stack is aligned -- do not enabled -msse without it!
#'-mfpmath=sse',
]
+ if platform != 'windows':
+ # XXX: -mstackrealign causes stack corruption on MinGW. Ditto
+ # for -mincoming-stack-boundary=2. Still enable it on other
+ # platforms for now, but we can't rely on it for cross platform
+ # code. We have to use __attribute__((force_align_arg_pointer))
+ # instead.
+ ccflags += [
+ '-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
+ '-mstackrealign', # ensure stack is aligned
+ ]
if env['machine'] == 'x86_64':
ccflags += ['-m64']
# See also:
diff --git a/scons/llvm.py b/scons/llvm.py
index d3293bb404f..73e9310f71b 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -29,6 +29,7 @@ Tool-specific initialization for LLVM
import os
import os.path
+import sys
import SCons.Errors
import SCons.Util
@@ -39,7 +40,7 @@ def generate(env):
llvm_dir = os.environ['LLVM']
except KeyError:
# Do nothing -- use the system headers/libs
- pass
+ llvm_dir = None
else:
if not os.path.isdir(llvm_dir):
raise SCons.Errors.InternalError, "Specified LLVM directory not found"
@@ -57,7 +58,47 @@ def generate(env):
env.PrependENVPath('PATH', llvm_bin_dir)
- if env.Detect('llvm-config'):
+ if env['msvc']:
+ # XXX: There is no llvm-config on Windows, so assume a standard layout
+ if llvm_dir is not None:
+ env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
+ env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
+ env.Prepend(LIBS = [
+ 'LLVMBitWriter',
+ 'LLVMCore',
+ 'LLVMSupport',
+ 'LLVMSystem',
+ 'LLVMSupport',
+ 'LLVMSystem',
+ 'LLVMCore',
+ 'LLVMCodeGen',
+ 'LLVMSelectionDAG',
+ 'LLVMAsmPrinter',
+ 'LLVMBitReader',
+ 'LLVMBitWriter',
+ 'LLVMTransformUtils',
+ 'LLVMInstrumentation',
+ 'LLVMScalarOpts',
+ 'LLVMipo',
+ 'LLVMHello',
+ 'LLVMLinker',
+ 'LLVMAnalysis',
+ 'LLVMipa',
+ 'LLVMX86CodeGen',
+ 'LLVMX86AsmPrinter',
+ 'LLVMExecutionEngine',
+ 'LLVMInterpreter',
+ 'LLVMJIT',
+ 'LLVMTarget',
+ 'LLVMAsmParser',
+ 'LLVMDebugger',
+ 'LLVMArchive',
+ 'imagehlp',
+ 'psapi',
+ ])
+ env['LLVM_VERSION'] = '2.5'
+ return
+ elif env.Detect('llvm-config'):
version = env.backtick('llvm-config --version').rstrip()
try:
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index 4685f600e29..96292b0e9e8 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -33,23 +33,12 @@
* Authors: Alan Hourihane <alanh@tungstengraphics.com>
*/
-/*
- * TODO:
- *
- * test eglBind/ReleaseTexImage
- */
-
-
-#include <assert.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include "dlfcn.h"
+#include <stdlib.h>
+#include <string.h>
#include <X11/Xlib.h>
-#include <GL/gl.h>
-#include "glxclient.h"
+#include <GL/glx.h>
+#include "eglconfigutil.h"
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldisplay.h"
@@ -58,46 +47,19 @@
#include "egllog.h"
#include "eglsurface.h"
-#include <GL/gl.h>
-
#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-static const EGLint all_apis = (EGL_OPENGL_ES_BIT
- | EGL_OPENGL_ES2_BIT
- | EGL_OPENVG_BIT
- /* | EGL_OPENGL_BIT */); /* can't do */
+#ifndef GLX_VERSION_1_4
+#error "GL/glx.h must be equal to or greater than GLX 1.4"
+#endif
+
+/*
+ * report OpenGL ES bits because apps usually forget to specify
+ * EGL_RENDERABLE_TYPE when choosing configs
+ */
+#define GLX_EGL_APIS (EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT)
-struct visual_attribs
-{
- /* X visual attribs */
- int id;
- int klass;
- int depth;
- int redMask, greenMask, blueMask;
- int colormapSize;
- int bitsPerRGB;
-
- /* GL visual attribs */
- int supportsGL;
- int transparentType;
- int transparentRedValue;
- int transparentGreenValue;
- int transparentBlueValue;
- int transparentAlphaValue;
- int transparentIndexValue;
- int bufferSize;
- int level;
- int render_type;
- int doubleBuffer;
- int stereo;
- int auxBuffers;
- int redSize, greenSize, blueSize, alphaSize;
- int depthSize;
- int stencilSize;
- int accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize;
- int numSamples, numMultisample;
- int visualCaveat;
-};
/** subclass of _EGLDriver */
struct GLX_egl_driver
@@ -114,6 +76,21 @@ struct GLX_egl_display
GLXFBConfig *fbconfigs;
int glx_maj, glx_min;
+
+ const char *extensions;
+ EGLBoolean have_1_3;
+ EGLBoolean have_make_current_read;
+ EGLBoolean have_fbconfig;
+ EGLBoolean have_pbuffer;
+
+ /* GLX_SGIX_pbuffer */
+ PFNGLXCREATEGLXPBUFFERSGIXPROC glXCreateGLXPbufferSGIX;
+ PFNGLXDESTROYGLXPBUFFERSGIXPROC glXDestroyGLXPbufferSGIX;
+
+ /* workaround quirks of different GLX implementations */
+ EGLBoolean single_buffered_quirk;
+ EGLBoolean glx_window_quirk;
+
};
@@ -131,7 +108,8 @@ struct GLX_egl_surface
{
_EGLSurface Base; /**< base class */
- GLXDrawable drawable;
+ Drawable drawable;
+ GLXDrawable glx_drawable;
};
@@ -139,6 +117,7 @@ struct GLX_egl_surface
struct GLX_egl_config
{
_EGLConfig Base; /**< base class */
+ EGLBoolean double_buffered;
int index;
};
@@ -173,288 +152,369 @@ GLX_egl_config_index(_EGLConfig *conf)
return ((struct GLX_egl_config *) conf)->index;
}
-static GLboolean
-get_visual_attribs(Display *dpy, XVisualInfo *vInfo,
- struct visual_attribs *attribs)
-{
- const char *ext = glXQueryExtensionsString(dpy, vInfo->screen);
- int rgba;
- memset(attribs, 0, sizeof(struct visual_attribs));
+#define MAP_ATTRIB(attr, memb) \
+ { attr, offsetof(__GLcontextModes, memb) }
+
+
+static const struct {
+ int attr;
+ int offset;
+} fbconfig_attributes[] = {
+ /* table 3.1 of GLX 1.4 */
+ MAP_ATTRIB(GLX_FBCONFIG_ID, fbconfigID),
+ MAP_ATTRIB(GLX_BUFFER_SIZE, rgbBits),
+ MAP_ATTRIB(GLX_LEVEL, level),
+ MAP_ATTRIB(GLX_DOUBLEBUFFER, doubleBufferMode),
+ MAP_ATTRIB(GLX_STEREO, stereoMode),
+ MAP_ATTRIB(GLX_AUX_BUFFERS, numAuxBuffers),
+ MAP_ATTRIB(GLX_RED_SIZE, redBits),
+ MAP_ATTRIB(GLX_GREEN_SIZE, greenBits),
+ MAP_ATTRIB(GLX_BLUE_SIZE, blueBits),
+ MAP_ATTRIB(GLX_ALPHA_SIZE, alphaBits),
+ MAP_ATTRIB(GLX_DEPTH_SIZE, depthBits),
+ MAP_ATTRIB(GLX_STENCIL_SIZE, stencilBits),
+ MAP_ATTRIB(GLX_ACCUM_RED_SIZE, accumRedBits),
+ MAP_ATTRIB(GLX_ACCUM_GREEN_SIZE, accumGreenBits),
+ MAP_ATTRIB(GLX_ACCUM_BLUE_SIZE, accumBlueBits),
+ MAP_ATTRIB(GLX_ACCUM_ALPHA_SIZE, accumAlphaBits),
+ MAP_ATTRIB(GLX_SAMPLE_BUFFERS, sampleBuffers),
+ MAP_ATTRIB(GLX_SAMPLES, samples),
+ MAP_ATTRIB(GLX_RENDER_TYPE, renderType),
+ MAP_ATTRIB(GLX_DRAWABLE_TYPE, drawableType),
+ MAP_ATTRIB(GLX_X_RENDERABLE, xRenderable),
+ MAP_ATTRIB(GLX_X_VISUAL_TYPE, visualType),
+ MAP_ATTRIB(GLX_CONFIG_CAVEAT, visualRating),
+ MAP_ATTRIB(GLX_TRANSPARENT_TYPE, transparentPixel),
+ MAP_ATTRIB(GLX_TRANSPARENT_INDEX_VALUE, transparentIndex),
+ MAP_ATTRIB(GLX_TRANSPARENT_RED_VALUE, transparentRed),
+ MAP_ATTRIB(GLX_TRANSPARENT_GREEN_VALUE, transparentGreen),
+ MAP_ATTRIB(GLX_TRANSPARENT_BLUE_VALUE, transparentBlue),
+ MAP_ATTRIB(GLX_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
+ MAP_ATTRIB(GLX_MAX_PBUFFER_WIDTH, maxPbufferWidth),
+ MAP_ATTRIB(GLX_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
+ MAP_ATTRIB(GLX_MAX_PBUFFER_PIXELS, maxPbufferPixels),
+ MAP_ATTRIB(GLX_VISUAL_ID, visualID),
+};
- attribs->id = vInfo->visualid;
-#if defined(__cplusplus) || defined(c_plusplus)
- attribs->klass = vInfo->c_class;
-#else
- attribs->klass = vInfo->class;
-#endif
- attribs->depth = vInfo->depth;
- attribs->redMask = vInfo->red_mask;
- attribs->greenMask = vInfo->green_mask;
- attribs->blueMask = vInfo->blue_mask;
- attribs->colormapSize = vInfo->colormap_size;
- attribs->bitsPerRGB = vInfo->bits_per_rgb;
-
- if (glXGetConfig(dpy, vInfo, GLX_USE_GL, &attribs->supportsGL) != 0 ||
- !attribs->supportsGL)
- return GL_FALSE;
- glXGetConfig(dpy, vInfo, GLX_BUFFER_SIZE, &attribs->bufferSize);
- glXGetConfig(dpy, vInfo, GLX_LEVEL, &attribs->level);
- glXGetConfig(dpy, vInfo, GLX_RGBA, &rgba);
- if (!rgba)
- return GL_FALSE;
- attribs->render_type = GLX_RGBA_BIT;
-
- glXGetConfig(dpy, vInfo, GLX_DOUBLEBUFFER, &attribs->doubleBuffer);
- if (!attribs->doubleBuffer)
- return GL_FALSE;
-
- glXGetConfig(dpy, vInfo, GLX_STEREO, &attribs->stereo);
- glXGetConfig(dpy, vInfo, GLX_AUX_BUFFERS, &attribs->auxBuffers);
- glXGetConfig(dpy, vInfo, GLX_RED_SIZE, &attribs->redSize);
- glXGetConfig(dpy, vInfo, GLX_GREEN_SIZE, &attribs->greenSize);
- glXGetConfig(dpy, vInfo, GLX_BLUE_SIZE, &attribs->blueSize);
- glXGetConfig(dpy, vInfo, GLX_ALPHA_SIZE, &attribs->alphaSize);
- glXGetConfig(dpy, vInfo, GLX_DEPTH_SIZE, &attribs->depthSize);
- glXGetConfig(dpy, vInfo, GLX_STENCIL_SIZE, &attribs->stencilSize);
- glXGetConfig(dpy, vInfo, GLX_ACCUM_RED_SIZE, &attribs->accumRedSize);
- glXGetConfig(dpy, vInfo, GLX_ACCUM_GREEN_SIZE, &attribs->accumGreenSize);
- glXGetConfig(dpy, vInfo, GLX_ACCUM_BLUE_SIZE, &attribs->accumBlueSize);
- glXGetConfig(dpy, vInfo, GLX_ACCUM_ALPHA_SIZE, &attribs->accumAlphaSize);
-
- /* get transparent pixel stuff */
- glXGetConfig(dpy, vInfo,GLX_TRANSPARENT_TYPE, &attribs->transparentType);
- if (attribs->transparentType == GLX_TRANSPARENT_RGB) {
- glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_RED_VALUE, &attribs->transparentRedValue);
- glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_GREEN_VALUE, &attribs->transparentGreenValue);
- glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_BLUE_VALUE, &attribs->transparentBlueValue);
- glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_ALPHA_VALUE, &attribs->transparentAlphaValue);
- }
- else if (attribs->transparentType == GLX_TRANSPARENT_INDEX) {
- glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_INDEX_VALUE, &attribs->transparentIndexValue);
- }
-
- /* multisample attribs */
-#ifdef GLX_ARB_multisample
- if (ext && strstr(ext, "GLX_ARB_multisample")) {
- glXGetConfig(dpy, vInfo, GLX_SAMPLE_BUFFERS_ARB, &attribs->numMultisample);
- glXGetConfig(dpy, vInfo, GLX_SAMPLES_ARB, &attribs->numSamples);
- }
-#endif
- else {
- attribs->numSamples = 0;
- attribs->numMultisample = 0;
- }
-#if defined(GLX_EXT_visual_rating)
- if (ext && strstr(ext, "GLX_EXT_visual_rating")) {
- glXGetConfig(dpy, vInfo, GLX_VISUAL_CAVEAT_EXT, &attribs->visualCaveat);
- }
- else {
- attribs->visualCaveat = GLX_NONE_EXT;
+static EGLBoolean
+convert_fbconfig(Display *dpy, GLXFBConfig fbconfig,
+ struct GLX_egl_config *GLX_conf)
+{
+ __GLcontextModes mode;
+ int err = 0, attr, val, i;
+
+ memset(&mode, 0, sizeof(mode));
+
+ for (i = 0; i < ARRAY_SIZE(fbconfig_attributes); i++) {
+ int offset = fbconfig_attributes[i].offset;
+ attr = fbconfig_attributes[i].attr;
+ err = glXGetFBConfigAttrib(dpy, fbconfig, attr, &val);
+ if (err) {
+ if (err == GLX_BAD_ATTRIBUTE) {
+ err = 0;
+ continue;
+ }
+ break;
+ }
+ *((int *) ((char *) &mode + offset)) = val;
}
-#else
- attribs->visualCaveat = 0;
-#endif
-
- return GL_TRUE;
-}
+ if (err)
+ return EGL_FALSE;
-#ifdef GLX_VERSION_1_3
+ /* must have rgba bit */
+ if (!(mode.renderType & GLX_RGBA_BIT))
+ return EGL_FALSE;
-static int
-glx_token_to_visual_class(int visual_type)
-{
- switch (visual_type) {
- case GLX_TRUE_COLOR:
- return TrueColor;
- case GLX_DIRECT_COLOR:
- return DirectColor;
- case GLX_PSEUDO_COLOR:
- return PseudoColor;
- case GLX_STATIC_COLOR:
- return StaticColor;
- case GLX_GRAY_SCALE:
- return GrayScale;
- case GLX_STATIC_GRAY:
- return StaticGray;
- case GLX_NONE:
- default:
- return None;
+ /* pixmap and pbuffer surfaces must be single-buffered in EGL */
+ if (mode.doubleBufferMode) {
+ mode.drawableType &= ~(GLX_PIXMAP_BIT | GLX_PBUFFER_BIT);
+ if (!mode.drawableType)
+ return EGL_FALSE;
}
+
+ mode.rgbMode = GL_TRUE;
+ mode.haveAccumBuffer = (mode.accumRedBits +
+ mode.accumGreenBits +
+ mode.accumBlueBits +
+ mode.accumAlphaBits > 0);
+ mode.haveDepthBuffer = (mode.depthBits > 0);
+ mode.haveStencilBuffer = (mode.stencilBits > 0);
+
+ GLX_conf->double_buffered = (mode.doubleBufferMode != 0);
+ return _eglConfigFromContextModesRec(&GLX_conf->Base, &mode,
+ GLX_EGL_APIS, GLX_EGL_APIS);
}
-static int
-get_fbconfig_attribs(Display *dpy, GLXFBConfig fbconfig,
- struct visual_attribs *attribs)
-{
- int visual_type;
- int fbconfig_id;
- memset(attribs, 0, sizeof(struct visual_attribs));
+static const struct {
+ int attr;
+ int offset;
+} visual_attributes[] = {
+ /* table 3.7 of GLX 1.4 */
+ /* no GLX_USE_GL */
+ MAP_ATTRIB(GLX_BUFFER_SIZE, rgbBits),
+ MAP_ATTRIB(GLX_LEVEL, level),
+ MAP_ATTRIB(GLX_RGBA, rgbMode),
+ MAP_ATTRIB(GLX_DOUBLEBUFFER, doubleBufferMode),
+ MAP_ATTRIB(GLX_STEREO, stereoMode),
+ MAP_ATTRIB(GLX_AUX_BUFFERS, numAuxBuffers),
+ MAP_ATTRIB(GLX_RED_SIZE, redBits),
+ MAP_ATTRIB(GLX_GREEN_SIZE, greenBits),
+ MAP_ATTRIB(GLX_BLUE_SIZE, blueBits),
+ MAP_ATTRIB(GLX_ALPHA_SIZE, alphaBits),
+ MAP_ATTRIB(GLX_DEPTH_SIZE, depthBits),
+ MAP_ATTRIB(GLX_STENCIL_SIZE, stencilBits),
+ MAP_ATTRIB(GLX_ACCUM_RED_SIZE, accumRedBits),
+ MAP_ATTRIB(GLX_ACCUM_GREEN_SIZE, accumGreenBits),
+ MAP_ATTRIB(GLX_ACCUM_BLUE_SIZE, accumBlueBits),
+ MAP_ATTRIB(GLX_ACCUM_ALPHA_SIZE, accumAlphaBits),
+ MAP_ATTRIB(GLX_SAMPLE_BUFFERS, sampleBuffers),
+ MAP_ATTRIB(GLX_SAMPLES, samples),
+ MAP_ATTRIB(GLX_FBCONFIG_ID, fbconfigID),
+ /* GLX_EXT_visual_rating */
+ MAP_ATTRIB(GLX_VISUAL_CAVEAT_EXT, visualRating),
+};
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_FBCONFIG_ID, &fbconfig_id);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_VISUAL_ID, &attribs->id);
+static int
+get_visual_type(const XVisualInfo *vis)
+{
+ int klass;
-#if 0
- attribs->depth = vInfo->depth;
- attribs->redMask = vInfo->red_mask;
- attribs->greenMask = vInfo->green_mask;
- attribs->blueMask = vInfo->blue_mask;
- attribs->colormapSize = vInfo->colormap_size;
- attribs->bitsPerRGB = vInfo->bits_per_rgb;
+#if defined(__cplusplus) || defined(c_plusplus)
+ klass = vis->c_class;
+#else
+ klass = vis->class;
#endif
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_X_VISUAL_TYPE, &visual_type);
- attribs->klass = glx_token_to_visual_class(visual_type);
+ switch (klass) {
+ case TrueColor:
+ return GLX_TRUE_COLOR;
+ case DirectColor:
+ return GLX_DIRECT_COLOR;
+ case PseudoColor:
+ return GLX_PSEUDO_COLOR;
+ case StaticColor:
+ return GLX_STATIC_COLOR;
+ case GrayScale:
+ return GLX_GRAY_SCALE;
+ case StaticGray:
+ return GLX_STATIC_GRAY;
+ default:
+ return GLX_NONE;
+ }
+}
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_BUFFER_SIZE, &attribs->bufferSize);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_LEVEL, &attribs->level);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, &attribs->render_type);
- if (!(attribs->render_type & GLX_RGBA_BIT))
- return 0;
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_DOUBLEBUFFER, &attribs->doubleBuffer);
- if (!attribs->doubleBuffer)
- return 0;
+static EGLBoolean
+convert_visual(Display *dpy, XVisualInfo *vinfo,
+ struct GLX_egl_config *GLX_conf)
+{
+ __GLcontextModes mode;
+ int err, attr, val, i;
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_STEREO, &attribs->stereo);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_AUX_BUFFERS, &attribs->auxBuffers);
+ /* the visual must support OpenGL */
+ err = glXGetConfig(dpy, vinfo, GLX_USE_GL, &val);
+ if (err || !val)
+ return EGL_FALSE;
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_RED_SIZE, &attribs->redSize);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_GREEN_SIZE, &attribs->greenSize);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_BLUE_SIZE, &attribs->blueSize);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_ALPHA_SIZE, &attribs->alphaSize);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_DEPTH_SIZE, &attribs->depthSize);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_STENCIL_SIZE, &attribs->stencilSize);
+ memset(&mode, 0, sizeof(mode));
+
+ for (i = 0; i < ARRAY_SIZE(visual_attributes); i++) {
+ int offset = visual_attributes[i].offset;
+ attr = visual_attributes[i].attr;
+ err = glXGetConfig(dpy, vinfo, attr, &val);
+ if (err) {
+ if (err == GLX_BAD_ATTRIBUTE) {
+ err = 0;
+ continue;
+ }
+ break;
+ }
+ *((int *) ((char *) &mode + offset)) = val;
+ }
+ if (err)
+ return EGL_FALSE;
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_RED_SIZE, &attribs->accumRedSize);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_GREEN_SIZE, &attribs->accumGreenSize);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_BLUE_SIZE, &attribs->accumBlueSize);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_ALPHA_SIZE, &attribs->accumAlphaSize);
+ /* must be RGB mode */
+ if (!mode.rgbMode)
+ return EGL_FALSE;
- /* get transparent pixel stuff */
- glXGetFBConfigAttrib(dpy, fbconfig,GLX_TRANSPARENT_TYPE, &attribs->transparentType);
- if (attribs->transparentType == GLX_TRANSPARENT_RGB) {
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_RED_VALUE, &attribs->transparentRedValue);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_GREEN_VALUE, &attribs->transparentGreenValue);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_BLUE_VALUE, &attribs->transparentBlueValue);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_ALPHA_VALUE, &attribs->transparentAlphaValue);
- }
- else if (attribs->transparentType == GLX_TRANSPARENT_INDEX) {
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_INDEX_VALUE, &attribs->transparentIndexValue);
- }
+ mode.visualID = vinfo->visualid;
+ mode.visualType = get_visual_type(vinfo);
+ mode.redMask = vinfo->red_mask;
+ mode.greenMask = vinfo->green_mask;
+ mode.blueMask = vinfo->blue_mask;
+
+ mode.drawableType = GLX_WINDOW_BIT;
+ /* pixmap surfaces must be single-buffered in EGL */
+ if (!mode.doubleBufferMode)
+ mode.drawableType |= GLX_PIXMAP_BIT;
+
+ mode.renderType = GLX_RGBA_BIT;
+ mode.xRenderable = GL_TRUE;
+ mode.haveAccumBuffer = (mode.accumRedBits +
+ mode.accumGreenBits +
+ mode.accumBlueBits +
+ mode.accumAlphaBits > 0);
+ mode.haveDepthBuffer = (mode.depthBits > 0);
+ mode.haveStencilBuffer = (mode.stencilBits > 0);
+
+ GLX_conf->double_buffered = (mode.doubleBufferMode != 0);
+ return _eglConfigFromContextModesRec(&GLX_conf->Base, &mode,
+ GLX_EGL_APIS, GLX_EGL_APIS);
+}
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_SAMPLE_BUFFERS, &attribs->numMultisample);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_SAMPLES, &attribs->numSamples);
- glXGetFBConfigAttrib(dpy, fbconfig, GLX_CONFIG_CAVEAT, &attribs->visualCaveat);
+static void
+fix_config(struct GLX_egl_display *GLX_dpy, struct GLX_egl_config *GLX_conf)
+{
+ _EGLConfig *conf = &GLX_conf->Base;
+ EGLint surface_type, r, g, b, a;
+
+ surface_type = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE);
+ if (!GLX_conf->double_buffered && GLX_dpy->single_buffered_quirk) {
+ /* some GLX impls do not like single-buffered window surface */
+ surface_type &= ~EGL_WINDOW_BIT;
+ /* pbuffer bit is usually not set */
+ if (GLX_dpy->have_pbuffer)
+ surface_type |= EGL_PBUFFER_BIT;
+ SET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE, surface_type);
+ }
- if (attribs->id == 0) {
- attribs->id = fbconfig_id;
- return EGL_PBUFFER_BIT | EGL_PIXMAP_BIT;
+ /* no visual attribs unless window bit is set */
+ if (!(surface_type & EGL_WINDOW_BIT)) {
+ SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID, 0);
+ SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, EGL_NONE);
}
- return EGL_WINDOW_BIT;
+ /* make sure buffer size is set correctly */
+ r = GET_CONFIG_ATTRIB(conf, EGL_RED_SIZE);
+ g = GET_CONFIG_ATTRIB(conf, EGL_GREEN_SIZE);
+ b = GET_CONFIG_ATTRIB(conf, EGL_BLUE_SIZE);
+ a = GET_CONFIG_ATTRIB(conf, EGL_ALPHA_SIZE);
+ SET_CONFIG_ATTRIB(conf, EGL_BUFFER_SIZE, r + g + b + a);
}
-#endif
static EGLBoolean
-create_configs(_EGLDisplay *disp, struct GLX_egl_display *GLX_dpy)
+create_configs(_EGLDisplay *dpy, struct GLX_egl_display *GLX_dpy,
+ EGLint screen)
{
- XVisualInfo theTemplate;
- int numVisuals;
- long mask;
- int i;
- struct visual_attribs attribs;
+ EGLint num_configs = 0, i;
+ EGLint id = 1;
- GLX_dpy->fbconfigs = NULL;
-
-#ifdef GLX_VERSION_1_3
- /* get list of all fbconfigs on this screen */
- GLX_dpy->fbconfigs = glXGetFBConfigs(GLX_dpy->dpy, DefaultScreen(GLX_dpy->dpy), &numVisuals);
+ if (GLX_dpy->have_fbconfig) {
+ GLX_dpy->fbconfigs = glXGetFBConfigs(GLX_dpy->dpy, screen, &num_configs);
+ }
+ else {
+ XVisualInfo vinfo_template;
+ long mask;
- if (numVisuals == 0) {
- GLX_dpy->fbconfigs = NULL;
- goto xvisual;
+ vinfo_template.screen = screen;
+ mask = VisualScreenMask;
+ GLX_dpy->visuals = XGetVisualInfo(GLX_dpy->dpy, mask, &vinfo_template,
+ &num_configs);
}
- for (i = 0; i < numVisuals; i++) {
- struct GLX_egl_config *config;
- int bit;
+ if (!num_configs)
+ return EGL_FALSE;
- bit = get_fbconfig_attribs(GLX_dpy->dpy, GLX_dpy->fbconfigs[i], &attribs);
- if (!bit)
+ for (i = 0; i < num_configs; i++) {
+ struct GLX_egl_config *GLX_conf, template;
+ EGLBoolean ok;
+
+ memset(&template, 0, sizeof(template));
+ _eglInitConfig(&template.Base, id);
+ if (GLX_dpy->have_fbconfig)
+ ok = convert_fbconfig(GLX_dpy->dpy, GLX_dpy->fbconfigs[i], &template);
+ else
+ ok = convert_visual(GLX_dpy->dpy, &GLX_dpy->visuals[i], &template);
+ if (!ok)
+ continue;
+
+ fix_config(GLX_dpy, &template);
+ if (!_eglValidateConfig(&template.Base, EGL_FALSE)) {
+ _eglLog(_EGL_DEBUG, "GLX: failed to validate config %d", i);
continue;
+ }
- config = CALLOC_STRUCT(GLX_egl_config);
-
- config->index = i;
- _eglInitConfig(&config->Base, (i+1));
- SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, attribs.id);
- SET_CONFIG_ATTRIB(&config->Base, EGL_BUFFER_SIZE, attribs.bufferSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_RED_SIZE, attribs.redSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_GREEN_SIZE, attribs.greenSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_BLUE_SIZE, attribs.blueSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_ALPHA_SIZE, attribs.alphaSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_DEPTH_SIZE, attribs.depthSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_STENCIL_SIZE, attribs.stencilSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLES, attribs.numSamples);
- SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLE_BUFFERS, attribs.numMultisample);
- SET_CONFIG_ATTRIB(&config->Base, EGL_CONFORMANT, all_apis);
- SET_CONFIG_ATTRIB(&config->Base, EGL_RENDERABLE_TYPE, all_apis);
- SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE, bit);
-
- /* XXX possibly other things to init... */
+ GLX_conf = CALLOC_STRUCT(GLX_egl_config);
+ if (GLX_conf) {
+ memcpy(GLX_conf, &template, sizeof(template));
+ GLX_conf->index = i;
- _eglAddConfig(disp, &config->Base);
+ _eglAddConfig(dpy, &GLX_conf->Base);
+ id++;
+ }
}
- goto end;
-#endif
-
-xvisual:
- /* get list of all visuals on this screen */
- theTemplate.screen = DefaultScreen(GLX_dpy->dpy);
- mask = VisualScreenMask;
- GLX_dpy->visuals = XGetVisualInfo(GLX_dpy->dpy, mask, &theTemplate, &numVisuals);
+ return EGL_TRUE;
+}
- for (i = 0; i < numVisuals; i++) {
- struct GLX_egl_config *config;
- if (!get_visual_attribs(GLX_dpy->dpy, &GLX_dpy->visuals[i], &attribs))
- continue;
+static void
+check_extensions(struct GLX_egl_display *GLX_dpy, EGLint screen)
+{
+ GLX_dpy->extensions =
+ glXQueryExtensionsString(GLX_dpy->dpy, screen);
+ if (GLX_dpy->extensions) {
+ /* glXGetProcAddress is assumed */
+
+ if (strstr(GLX_dpy->extensions, "GLX_SGI_make_current_read")) {
+ /* GLX 1.3 entry points are used */
+ GLX_dpy->have_make_current_read = EGL_TRUE;
+ }
- config = CALLOC_STRUCT(GLX_egl_config);
+ if (strstr(GLX_dpy->extensions, "GLX_SGIX_fbconfig")) {
+ /* GLX 1.3 entry points are used */
+ GLX_dpy->have_fbconfig = EGL_TRUE;
+ }
- config->index = i;
- _eglInitConfig(&config->Base, (i+1));
- SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, attribs.id);
- SET_CONFIG_ATTRIB(&config->Base, EGL_BUFFER_SIZE, attribs.bufferSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_RED_SIZE, attribs.redSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_GREEN_SIZE, attribs.greenSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_BLUE_SIZE, attribs.blueSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_ALPHA_SIZE, attribs.alphaSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_DEPTH_SIZE, attribs.depthSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_STENCIL_SIZE, attribs.stencilSize);
- SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLES, attribs.numSamples);
- SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLE_BUFFERS, attribs.numMultisample);
- SET_CONFIG_ATTRIB(&config->Base, EGL_CONFORMANT, all_apis);
- SET_CONFIG_ATTRIB(&config->Base, EGL_RENDERABLE_TYPE, all_apis);
- SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE,
- (EGL_WINDOW_BIT /*| EGL_PBUFFER_BIT | EGL_PIXMAP_BIT*/));
+ if (strstr(GLX_dpy->extensions, "GLX_SGIX_pbuffer")) {
+ GLX_dpy->glXCreateGLXPbufferSGIX = (PFNGLXCREATEGLXPBUFFERSGIXPROC)
+ glXGetProcAddress((const GLubyte *) "glXCreateGLXPbufferSGIX");
+ GLX_dpy->glXDestroyGLXPbufferSGIX = (PFNGLXDESTROYGLXPBUFFERSGIXPROC)
+ glXGetProcAddress((const GLubyte *) "glXDestroyGLXPbufferSGIX");
- /* XXX possibly other things to init... */
+ if (GLX_dpy->glXCreateGLXPbufferSGIX &&
+ GLX_dpy->glXDestroyGLXPbufferSGIX &&
+ GLX_dpy->have_fbconfig)
+ GLX_dpy->have_pbuffer = EGL_TRUE;
+ }
+ }
- _eglAddConfig(disp, &config->Base);
+ if (GLX_dpy->glx_maj == 1 && GLX_dpy->glx_min >= 3) {
+ GLX_dpy->have_1_3 = EGL_TRUE;
+ GLX_dpy->have_make_current_read = EGL_TRUE;
+ GLX_dpy->have_fbconfig = EGL_TRUE;
+ GLX_dpy->have_pbuffer = EGL_TRUE;
}
+}
-end:
- return EGL_TRUE;
+
+static void
+check_quirks(struct GLX_egl_display *GLX_dpy, EGLint screen)
+{
+ const char *vendor;
+
+ GLX_dpy->single_buffered_quirk = EGL_TRUE;
+ GLX_dpy->glx_window_quirk = EGL_TRUE;
+
+ vendor = glXGetClientString(GLX_dpy->dpy, GLX_VENDOR);
+ if (vendor && strstr(vendor, "NVIDIA")) {
+ vendor = glXQueryServerString(GLX_dpy->dpy, screen, GLX_VENDOR);
+ if (vendor && strstr(vendor, "NVIDIA")) {
+ _eglLog(_EGL_DEBUG, "disable quirks");
+ GLX_dpy->single_buffered_quirk = EGL_FALSE;
+ GLX_dpy->glx_window_quirk = EGL_FALSE;
+ }
+ }
}
+
/**
* Called via eglInitialize(), GLX_drv->API.Initialize().
*/
@@ -478,17 +538,33 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
}
}
- disp->DriverData = (void *) GLX_dpy;
- disp->ClientAPIsMask = all_apis;
+ if (!glXQueryVersion(GLX_dpy->dpy, &GLX_dpy->glx_maj, &GLX_dpy->glx_min)) {
+ _eglLog(_EGL_WARNING, "GLX: glXQueryVersion failed");
+ if (!disp->NativeDisplay)
+ XCloseDisplay(GLX_dpy->dpy);
+ free(GLX_dpy);
+ return EGL_FALSE;
+ }
- glXQueryVersion(GLX_dpy->dpy, &GLX_dpy->glx_maj, &GLX_dpy->glx_min);
+ check_extensions(GLX_dpy, DefaultScreen(GLX_dpy->dpy));
+ check_quirks(GLX_dpy, DefaultScreen(GLX_dpy->dpy));
+
+ create_configs(disp, GLX_dpy, DefaultScreen(GLX_dpy->dpy));
+ if (!disp->NumConfigs) {
+ _eglLog(_EGL_WARNING, "GLX: failed to create any config");
+ if (!disp->NativeDisplay)
+ XCloseDisplay(GLX_dpy->dpy);
+ free(GLX_dpy);
+ return EGL_FALSE;
+ }
+
+ disp->DriverData = (void *) GLX_dpy;
+ disp->ClientAPIsMask = GLX_EGL_APIS;
/* we're supporting EGL 1.4 */
*major = 1;
*minor = 4;
- create_configs(disp, GLX_dpy);
-
return EGL_TRUE;
}
@@ -539,8 +615,7 @@ GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
return NULL;
}
-#ifdef GLX_VERSION_1_3
- if (GLX_dpy->fbconfigs)
+ if (GLX_dpy->have_fbconfig)
GLX_ctx->context =
glXCreateNewContext(GLX_dpy->dpy,
GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
@@ -548,7 +623,6 @@ GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
GLX_ctx_shared ? GLX_ctx_shared->context : NULL,
GL_TRUE);
else
-#endif
GLX_ctx->context =
glXCreateContext(GLX_dpy->dpy,
&GLX_dpy->visuals[GLX_egl_config_index(conf)],
@@ -559,15 +633,6 @@ GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
return NULL;
}
-#if 1
- /* (maybe?) need to have a direct rendering context */
- if (!glXIsDirect(GLX_dpy->dpy, GLX_ctx->context)) {
- glXDestroyContext(GLX_dpy->dpy, GLX_ctx->context);
- free(GLX_ctx);
- return NULL;
- }
-#endif
-
return &GLX_ctx->Base;
}
@@ -589,17 +654,14 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
if (!_eglMakeCurrent(drv, disp, dsurf, rsurf, ctx))
return EGL_FALSE;
- ddraw = (GLX_dsurf) ? GLX_dsurf->drawable : None;
- rdraw = (GLX_rsurf) ? GLX_rsurf->drawable : None;
+ ddraw = (GLX_dsurf) ? GLX_dsurf->glx_drawable : None;
+ rdraw = (GLX_rsurf) ? GLX_rsurf->glx_drawable : None;
cctx = (GLX_ctx) ? GLX_ctx->context : NULL;
-#ifdef GLX_VERSION_1_3
- if (glXMakeContextCurrent(GLX_dpy->dpy, ddraw, rdraw, cctx))
- return EGL_TRUE;
-#endif
-
- if (ddraw == rdraw && glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx))
- return EGL_TRUE;
+ if (GLX_dpy->have_make_current_read)
+ return glXMakeContextCurrent(GLX_dpy->dpy, ddraw, rdraw, cctx);
+ else if (ddraw == rdraw)
+ return glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx);
return EGL_FALSE;
}
@@ -642,6 +704,20 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
}
GLX_surf->drawable = window;
+
+ if (GLX_dpy->have_1_3 && !GLX_dpy->glx_window_quirk)
+ GLX_surf->glx_drawable =
+ glXCreateWindow(GLX_dpy->dpy,
+ GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
+ GLX_surf->drawable, NULL);
+ else
+ GLX_surf->glx_drawable = GLX_surf->drawable;
+
+ if (!GLX_surf->glx_drawable) {
+ free(GLX_surf);
+ return NULL;
+ }
+
get_drawable_size(GLX_dpy->dpy, window, &width, &height);
GLX_surf->Base.Width = width;
GLX_surf->Base.Height = height;
@@ -649,18 +725,13 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
return &GLX_surf->Base;
}
-#ifdef GLX_VERSION_1_3
static _EGLSurface *
GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
NativePixmapType pixmap, const EGLint *attrib_list)
{
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_surf;
- int i;
-
- /* GLX must >= 1.3 */
- if (!(GLX_dpy->glx_maj == 1 && GLX_dpy->glx_min >= 3))
- return NULL;
+ uint width, height;
GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
if (!GLX_surf) {
@@ -674,25 +745,39 @@ GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
return NULL;
}
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs at this time */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePixmapSurface");
- free(GLX_surf);
- return NULL;
+ GLX_surf->drawable = pixmap;
+
+ if (GLX_dpy->have_1_3) {
+ GLX_surf->glx_drawable =
+ glXCreatePixmap(GLX_dpy->dpy,
+ GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
+ GLX_surf->drawable, NULL);
+ }
+ else if (GLX_dpy->have_fbconfig) {
+ GLXFBConfig fbconfig = GLX_dpy->fbconfigs[GLX_egl_config_index(conf)];
+ XVisualInfo *vinfo = glXGetVisualFromFBConfig(GLX_dpy->dpy, fbconfig);
+ if (vinfo) {
+ GLX_surf->glx_drawable =
+ glXCreateGLXPixmap(GLX_dpy->dpy, vinfo, GLX_surf->drawable);
+ XFree(vinfo);
}
}
+ else {
+ GLX_surf->glx_drawable =
+ glXCreateGLXPixmap(GLX_dpy->dpy,
+ &GLX_dpy->visuals[GLX_egl_config_index(conf)],
+ GLX_surf->drawable);
+ }
- GLX_surf->drawable =
- glXCreatePixmap(GLX_dpy->dpy,
- GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
- pixmap, NULL);
- if (!GLX_surf->drawable) {
+ if (!GLX_surf->glx_drawable) {
free(GLX_surf);
return NULL;
}
+ get_drawable_size(GLX_dpy->dpy, pixmap, &width, &height);
+ GLX_surf->Base.Width = width;
+ GLX_surf->Base.Height = height;
+
return &GLX_surf->Base;
}
@@ -703,11 +788,7 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp,
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_surf;
int attribs[5];
- int i = 0, j = 0;
-
- /* GLX must >= 1.3 */
- if (!(GLX_dpy->glx_maj == 1 && GLX_dpy->glx_min >= 3))
- return NULL;
+ int i;
GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
if (!GLX_surf) {
@@ -721,33 +802,44 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp,
return NULL;
}
- while(attrib_list[i] != EGL_NONE) {
- switch (attrib_list[i]) {
- case EGL_WIDTH:
- attribs[j++] = GLX_PBUFFER_WIDTH;
- attribs[j++] = attrib_list[i+1];
- break;
- case EGL_HEIGHT:
- attribs[j++] = GLX_PBUFFER_HEIGHT;
- attribs[j++] = attrib_list[i+1];
- break;
+ i = 0;
+ attribs[i] = None;
+
+ GLX_surf->drawable = None;
+
+ if (GLX_dpy->have_1_3) {
+ /* put geometry in attribs */
+ if (GLX_surf->Base.Width) {
+ attribs[i++] = GLX_PBUFFER_WIDTH;
+ attribs[i++] = GLX_surf->Base.Width;
+ }
+ if (GLX_surf->Base.Height) {
+ attribs[i++] = GLX_PBUFFER_HEIGHT;
+ attribs[i++] = GLX_surf->Base.Height;
}
- i++;
+ attribs[i] = None;
+
+ GLX_surf->glx_drawable =
+ glXCreatePbuffer(GLX_dpy->dpy,
+ GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
+ attribs);
+ }
+ else if (GLX_dpy->have_pbuffer) {
+ GLX_surf->glx_drawable = GLX_dpy->glXCreateGLXPbufferSGIX(
+ GLX_dpy->dpy,
+ GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
+ GLX_surf->Base.Width,
+ GLX_surf->Base.Height,
+ attribs);
}
- attribs[j++] = 0;
- GLX_surf->drawable =
- glXCreatePbuffer(GLX_dpy->dpy,
- GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
- attribs);
- if (!GLX_surf->drawable) {
+ if (!GLX_surf->glx_drawable) {
free(GLX_surf);
return NULL;
}
return &GLX_surf->Base;
}
-#endif
static EGLBoolean
GLX_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
@@ -755,15 +847,35 @@ GLX_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
if (!_eglIsSurfaceBound(surf)) {
struct GLX_egl_surface *GLX_surf = GLX_egl_surface(surf);
- switch (surf->Type) {
- case EGL_PBUFFER_BIT:
- glXDestroyPbuffer(GLX_dpy->dpy, GLX_surf->drawable);
- break;
- case EGL_PIXMAP_BIT:
- glXDestroyPixmap(GLX_dpy->dpy, GLX_surf->drawable);
- break;
- default:
- break;
+
+ if (GLX_dpy->have_1_3) {
+ switch (surf->Type) {
+ case EGL_WINDOW_BIT:
+ if (!GLX_dpy->glx_window_quirk)
+ glXDestroyWindow(GLX_dpy->dpy, GLX_surf->glx_drawable);
+ break;
+ case EGL_PBUFFER_BIT:
+ glXDestroyPbuffer(GLX_dpy->dpy, GLX_surf->glx_drawable);
+ break;
+ case EGL_PIXMAP_BIT:
+ glXDestroyPixmap(GLX_dpy->dpy, GLX_surf->glx_drawable);
+ break;
+ default:
+ break;
+ }
+ }
+ else {
+ switch (surf->Type) {
+ case EGL_PBUFFER_BIT:
+ GLX_dpy->glXDestroyGLXPbufferSGIX(GLX_dpy->dpy,
+ GLX_surf->glx_drawable);
+ break;
+ case EGL_PIXMAP_BIT:
+ glXDestroyGLXPixmap(GLX_dpy->dpy, GLX_surf->glx_drawable);
+ break;
+ default:
+ break;
+ }
}
free(surf);
}
@@ -773,44 +885,12 @@ GLX_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
static EGLBoolean
-GLX_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
- EGLint buffer)
-{
- struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
- struct GLX_egl_surface *GLX_surf = GLX_egl_surface(surf);
-
- /* buffer ?? */
- glXBindTexImageEXT(GLX_dpy->dpy, GLX_surf->drawable,
- GLX_FRONT_LEFT_EXT, NULL);
-
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-GLX_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
- EGLint buffer)
-{
- struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
- struct GLX_egl_surface *GLX_surf = GLX_egl_surface(surf);
-
- /* buffer ?? */
- glXReleaseTexImageEXT(GLX_dpy->dpy, GLX_surf->drawable,
- GLX_FRONT_LEFT_EXT);
-
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
GLX_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
{
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_surf = GLX_egl_surface(draw);
- _eglLog(_EGL_DEBUG, "GLX: EGL SwapBuffers 0x%x",draw);
-
- glXSwapBuffers(GLX_dpy->dpy, GLX_surf->drawable);
+ glXSwapBuffers(GLX_dpy->dpy, GLX_surf->glx_drawable);
return EGL_TRUE;
}
@@ -821,23 +901,24 @@ GLX_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
static _EGLProc
GLX_eglGetProcAddress(const char *procname)
{
- /* This is a bit of a hack to get at the gallium/Mesa state tracker
- * function st_get_proc_address(). This will probably change at
- * some point.
- */
- _EGLProc (*get_proc_addr)(const char *procname);
- _EGLProc proc_addr;
- get_proc_addr = dlsym(NULL, "st_get_proc_address");
- if (get_proc_addr)
- return get_proc_addr(procname);
-
- proc_addr = glXGetProcAddress((const GLubyte *)procname);
- if (proc_addr)
- return proc_addr;
-
- return (_EGLProc)dlsym(NULL, procname);
+ return (_EGLProc) glXGetProcAddress((const GLubyte *) procname);
}
+static EGLBoolean
+GLX_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
+{
+ glXWaitGL();
+ return EGL_TRUE;
+}
+
+static EGLBoolean
+GLX_eglWaitNative(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine)
+{
+ if (engine != EGL_CORE_NATIVE_ENGINE)
+ return _eglError(EGL_BAD_PARAMETER, "eglWaitNative");
+ glXWaitX();
+ return EGL_TRUE;
+}
static void
GLX_Unload(_EGLDriver *drv)
@@ -865,15 +946,13 @@ _eglMain(const char *args)
GLX_drv->Base.API.CreateContext = GLX_eglCreateContext;
GLX_drv->Base.API.MakeCurrent = GLX_eglMakeCurrent;
GLX_drv->Base.API.CreateWindowSurface = GLX_eglCreateWindowSurface;
-#ifdef GLX_VERSION_1_3
GLX_drv->Base.API.CreatePixmapSurface = GLX_eglCreatePixmapSurface;
GLX_drv->Base.API.CreatePbufferSurface = GLX_eglCreatePbufferSurface;
-#endif
GLX_drv->Base.API.DestroySurface = GLX_eglDestroySurface;
- GLX_drv->Base.API.BindTexImage = GLX_eglBindTexImage;
- GLX_drv->Base.API.ReleaseTexImage = GLX_eglReleaseTexImage;
GLX_drv->Base.API.SwapBuffers = GLX_eglSwapBuffers;
GLX_drv->Base.API.GetProcAddress = GLX_eglGetProcAddress;
+ GLX_drv->Base.API.WaitClient = GLX_eglWaitClient;
+ GLX_drv->Base.API.WaitNative = GLX_eglWaitNative;
GLX_drv->Base.Name = "GLX";
GLX_drv->Base.Unload = GLX_Unload;
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index d86ef9ce562..14cc5fa6137 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -9,12 +9,36 @@
* heterogeneous hardware devices in the future.
*
* The EGLDisplay, EGLConfig, EGLContext and EGLSurface types are
- * opaque handles implemented with 32-bit unsigned integers.
- * It's up to the driver function or fallback function to look up the
- * handle and get an object.
- * By using opaque handles, we leave open the possibility of having
- * indirect rendering in the future, like GLX.
+ * opaque handles. Internal objects are linked to a display to
+ * create the handles.
*
+ * For each public API entry point, the opaque handles are looked up
+ * before being dispatched to the drivers. When it fails to look up
+ * a handle, one of
+ *
+ * EGL_BAD_DISPLAY
+ * EGL_BAD_CONFIG
+ * EGL_BAD_CONTEXT
+ * EGL_BAD_SURFACE
+ * EGL_BAD_SCREEN_MESA
+ * EGL_BAD_MODE_MESA
+ *
+ * is generated and the driver function is not called. An
+ * uninitialized EGLDisplay has no driver associated with it. When
+ * such display is detected,
+ *
+ * EGL_NOT_INITIALIZED
+ *
+ * is generated.
+ *
+ * Some of the entry points use current display, context, or surface
+ * implicitly. For such entry points, the implicit objects are also
+ * checked before calling the driver function. Other than the
+ * errors listed above,
+ *
+ * EGL_BAD_CURRENT_SURFACE
+ *
+ * may also be generated.
*
* Notes on naming conventions:
*
@@ -496,15 +520,31 @@ eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
EGLBoolean EGLAPIENTRY
eglSwapInterval(EGLDisplay dpy, EGLint interval)
{
+ _EGLContext *ctx = _eglGetCurrentContext();
+ _EGLSurface *surf;
_EGL_DECLARE_DD(dpy);
- return drv->API.SwapInterval(drv, disp, interval);
+
+ if (!ctx || !_eglIsContextLinked(ctx) || ctx->Display != disp)
+ return _eglError(EGL_BAD_CONTEXT, __FUNCTION__);
+
+ surf = ctx->DrawSurface;
+ if (!_eglIsSurfaceLinked(surf))
+ return _eglError(EGL_BAD_SURFACE, __FUNCTION__);
+
+ return drv->API.SwapInterval(drv, disp, surf, interval);
}
EGLBoolean EGLAPIENTRY
eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
{
+ _EGLContext *ctx = _eglGetCurrentContext();
_EGL_DECLARE_DD_AND_SURFACE(dpy, surface);
+
+ /* surface must be bound to current context in EGL 1.4 */
+ if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface)
+ return _eglError(EGL_BAD_SURFACE, __FUNCTION__);
+
return drv->API.SwapBuffers(drv, disp, surf);
}
@@ -518,32 +558,66 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target)
EGLBoolean EGLAPIENTRY
-eglWaitGL(void)
+eglWaitClient(void)
{
- _EGLDisplay *disp = _eglGetCurrentDisplay();
+ _EGLContext *ctx = _eglGetCurrentContext();
+ _EGLDisplay *disp;
_EGLDriver *drv;
- if (!disp)
+ if (!ctx)
return EGL_TRUE;
+ /* let bad current context imply bad current surface */
+ if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface))
+ return _eglError(EGL_BAD_CURRENT_SURFACE, __FUNCTION__);
- /* a current display is always initialized */
+ /* a valid current context implies an initialized current display */
+ disp = ctx->Display;
drv = disp->Driver;
+ assert(drv);
- return drv->API.WaitGL(drv, disp);
+ return drv->API.WaitClient(drv, disp, ctx);
+}
+
+
+EGLBoolean EGLAPIENTRY
+eglWaitGL(void)
+{
+#ifdef EGL_VERSION_1_2
+ _EGLThreadInfo *t = _eglGetCurrentThread();
+ EGLint api_index = t->CurrentAPIIndex;
+ EGLint es_index = _eglConvertApiToIndex(EGL_OPENGL_ES_API);
+ EGLBoolean ret;
+
+ if (api_index != es_index && _eglIsCurrentThreadDummy())
+ return _eglError(EGL_BAD_ALLOC, "eglWaitGL");
+
+ t->CurrentAPIIndex = es_index;
+ ret = eglWaitClient();
+ t->CurrentAPIIndex = api_index;
+ return ret;
+#else
+ return eglWaitClient();
+#endif
}
EGLBoolean EGLAPIENTRY
eglWaitNative(EGLint engine)
{
- _EGLDisplay *disp = _eglGetCurrentDisplay();
+ _EGLContext *ctx = _eglGetCurrentContext();
+ _EGLDisplay *disp;
_EGLDriver *drv;
- if (!disp)
+ if (!ctx)
return EGL_TRUE;
+ /* let bad current context imply bad current surface */
+ if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface))
+ return _eglError(EGL_BAD_CURRENT_SURFACE, __FUNCTION__);
- /* a current display is always initialized */
+ /* a valid current context implies an initialized current display */
+ disp = ctx->Display;
drv = disp->Driver;
+ assert(drv);
return drv->API.WaitNative(drv, disp, engine);
}
@@ -568,8 +642,26 @@ eglGetCurrentContext(void)
EGLSurface EGLAPIENTRY
eglGetCurrentSurface(EGLint readdraw)
{
- _EGLSurface *s = _eglGetCurrentSurface(readdraw);
- return _eglGetSurfaceHandle(s);
+ _EGLContext *ctx = _eglGetCurrentContext();
+ _EGLSurface *surf;
+
+ if (!ctx)
+ return EGL_NO_SURFACE;
+
+ switch (readdraw) {
+ case EGL_DRAW:
+ surf = ctx->DrawSurface;
+ break;
+ case EGL_READ:
+ surf = ctx->ReadSurface;
+ break;
+ default:
+ _eglError(EGL_BAD_PARAMETER, __FUNCTION__);
+ surf = NULL;
+ break;
+ }
+
+ return _eglGetSurfaceHandle(surf);
}
@@ -900,20 +992,4 @@ eglReleaseThread(void)
}
-EGLBoolean
-eglWaitClient(void)
-{
- _EGLDisplay *disp = _eglGetCurrentDisplay();
- _EGLDriver *drv;
-
- if (!disp)
- return EGL_TRUE;
-
- /* a current display is always initialized */
- drv = disp->Driver;
-
- return drv->API.WaitClient(drv, disp);
-}
-
-
#endif /* EGL_VERSION_1_2 */
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
index 6081e588928..aa0abe3eb6b 100644
--- a/src/egl/main/eglapi.h
+++ b/src/egl/main/eglapi.h
@@ -35,13 +35,13 @@ typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurf
typedef EGLBoolean (*SurfaceAttrib_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint attribute, EGLint value);
typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer);
typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer);
-typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint interval);
+typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval);
typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw);
typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, NativePixmapType target);
/* misc funcs */
typedef const char *(*QueryString_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name);
-typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, _EGLDisplay *dpy);
+typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);
typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine);
typedef _EGLProc (*GetProcAddress_t)(const char *procname);
@@ -65,7 +65,6 @@ typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy,
#ifdef EGL_VERSION_1_2
-typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, _EGLDisplay *dpy);
typedef _EGLSurface *(*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum buftype, EGLClientBuffer buffer, _EGLConfig *config, const EGLint *attrib_list);
#endif /* EGL_VERSION_1_2 */
@@ -101,7 +100,7 @@ struct _egl_api
CopyBuffers_t CopyBuffers;
QueryString_t QueryString;
- WaitGL_t WaitGL;
+ WaitClient_t WaitClient;
WaitNative_t WaitNative;
GetProcAddress_t GetProcAddress;
@@ -120,7 +119,6 @@ struct _egl_api
QueryModeStringMESA_t QueryModeStringMESA;
#ifdef EGL_VERSION_1_2
- WaitClient_t WaitClient;
CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
#endif
};
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 2c8d1c4055b..31d69a77080 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -82,18 +82,17 @@ _eglAddConfig(_EGLDisplay *dpy, _EGLConfig *conf)
EGLBoolean
_eglCheckConfigHandle(EGLConfig config, _EGLDisplay *dpy)
{
- _EGLConfig *conf = NULL;
+ EGLint num_configs = (dpy) ? dpy->NumConfigs : 0;
EGLint i;
- for (i = 0; dpy && i < dpy->NumConfigs; i++) {
- conf = dpy->Configs[i];
+ for (i = 0; i < num_configs; i++) {
+ _EGLConfig *conf = dpy->Configs[i];
if (conf == (_EGLConfig *) config) {
assert(conf->Display == dpy);
break;
}
}
-
- return (conf != NULL);
+ return (i < num_configs);
}
diff --git a/src/egl/main/eglconfigutil.c b/src/egl/main/eglconfigutil.c
index a5fcdcd2876..36e94f0d2de 100644
--- a/src/egl/main/eglconfigutil.c
+++ b/src/egl/main/eglconfigutil.c
@@ -102,7 +102,12 @@ _eglConfigFromContextModesRec(_EGLConfig *conf, const __GLcontextModes *m,
SET_CONFIG_ATTRIB(conf, EGL_NATIVE_RENDERABLE, m->xRenderable);
SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID, m->visualID);
- SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, m->visualType);
+
+ if (m->visualType != GLX_NONE)
+ SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, m->visualType);
+ else
+ SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, EGL_NONE);
+
SET_CONFIG_ATTRIB(conf, EGL_RENDERABLE_TYPE, renderable_type);
SET_CONFIG_ATTRIB(conf, EGL_SAMPLE_BUFFERS, m->sampleBuffers);
SET_CONFIG_ATTRIB(conf, EGL_SAMPLES, m->samples);
diff --git a/src/egl/main/eglconfigutil.h b/src/egl/main/eglconfigutil.h
index ad850798908..8c923ee206a 100644
--- a/src/egl/main/eglconfigutil.h
+++ b/src/egl/main/eglconfigutil.h
@@ -2,7 +2,7 @@
#define EGLCONFIGUTIL_INCLUDED
-#include "GLES/gl.h"
+#include "GL/gl.h"
#include "GL/internal/glcore.h"
#include "eglconfig.h"
diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c
index ca7a0771681..df506151b58 100644
--- a/src/egl/main/eglcurrent.c
+++ b/src/egl/main/eglcurrent.c
@@ -16,7 +16,7 @@ static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER;
#ifdef GLX_USE_TLS
-static __thread const _EGLThreadInfo *_egl_TSD;
+static __thread const _EGLThreadInfo *_egl_TSD
__attribute__ ((tls_model("initial-exec")));
static INLINE void _eglSetTSD(const _EGLThreadInfo *t)
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 0c76c799738..018b06d3bea 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -408,7 +408,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
drv->API.CopyBuffers = _eglCopyBuffers;
drv->API.QueryString = _eglQueryString;
- drv->API.WaitGL = _eglWaitGL;
+ drv->API.WaitClient = _eglWaitClient;
drv->API.WaitNative = _eglWaitNative;
#ifdef EGL_MESA_screen_surface
diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index b37213faf10..e66913320b2 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -108,11 +108,12 @@ _eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name)
EGLBoolean
-_eglWaitGL(_EGLDriver *drv, _EGLDisplay *dpy)
+_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
{
/* just a placeholder */
(void) drv;
(void) dpy;
+ (void) ctx;
return EGL_TRUE;
}
diff --git a/src/egl/main/eglmisc.h b/src/egl/main/eglmisc.h
index a15c839be2b..829d4cde792 100644
--- a/src/egl/main/eglmisc.h
+++ b/src/egl/main/eglmisc.h
@@ -37,7 +37,7 @@ _eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name);
extern EGLBoolean
-_eglWaitGL(_EGLDriver *drv, _EGLDisplay *dpy);
+_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);
extern EGLBoolean
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index e7a1a8329e1..940a1b760cf 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -15,6 +15,22 @@
#include "eglsurface.h"
+static void
+_eglClampSwapInterval(_EGLSurface *surf, EGLint interval)
+{
+ EGLint bound = GET_CONFIG_ATTRIB(surf->Config, EGL_MAX_SWAP_INTERVAL);
+ if (interval >= bound) {
+ interval = bound;
+ }
+ else {
+ bound = GET_CONFIG_ATTRIB(surf->Config, EGL_MIN_SWAP_INTERVAL);
+ if (interval < bound)
+ interval = bound;
+ }
+ surf->SwapInterval = interval;
+}
+
+
/**
* Do error check on parameters and initialize the given _EGLSurface object.
* \return EGL_TRUE if no errors, EGL_FALSE otherwise.
@@ -194,7 +210,9 @@ _eglInitSurface(_EGLDriver *drv, _EGLSurface *surf, EGLint type,
surf->TextureTarget = texTarget;
surf->MipmapTexture = mipmapTex;
surf->MipmapLevel = 0;
- surf->SwapInterval = 0;
+ /* the default swap interval is 1 */
+ _eglClampSwapInterval(surf, 1);
+
#ifdef EGL_VERSION_1_2
surf->SwapBehavior = EGL_BUFFER_DESTROYED; /* XXX ok? */
surf->HorizontalResolution = EGL_UNKNOWN; /* set by caller */
@@ -466,11 +484,10 @@ _eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
EGLBoolean
-_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, EGLint interval)
+_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+ EGLint interval)
{
- _EGLSurface *surf = _eglGetCurrentSurface(EGL_DRAW);
- if (surf)
- surf->SwapInterval = interval;
+ _eglClampSwapInterval(surf, interval);
return EGL_TRUE;
}
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
index f6d44b5922e..b75fa9c3686 100644
--- a/src/egl/main/eglsurface.h
+++ b/src/egl/main/eglsurface.h
@@ -86,7 +86,7 @@ _eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint
extern EGLBoolean
-_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, EGLint interval);
+_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval);
#ifdef EGL_VERSION_1_2
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index fb00c3abe8b..50386425995 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -46,6 +46,7 @@
#include "util/u_memory.h"
#include "util/u_simple_shaders.h"
#include "util/u_surface.h"
+#include "util/u_rect.h"
#include "cso_cache/cso_context.h"
@@ -301,7 +302,8 @@ util_blit_pixels_writemask(struct blit_state *ctx,
* no overlapping.
* Filter mode should not matter since there's no stretching.
*/
- if (dst->format == src->format &&
+ if (pipe->surface_copy &&
+ dst->format == src->format &&
srcX0 < srcX1 &&
dstX0 < dstX1 &&
srcY0 < srcY1 &&
@@ -365,10 +367,17 @@ util_blit_pixels_writemask(struct blit_state *ctx,
PIPE_BUFFER_USAGE_GPU_WRITE);
/* load temp texture */
- pipe->surface_copy(pipe,
- texSurf, 0, 0, /* dest */
- src, srcLeft, srcTop, /* src */
- srcW, srcH); /* size */
+ if (pipe->surface_copy) {
+ pipe->surface_copy(pipe,
+ texSurf, 0, 0, /* dest */
+ src, srcLeft, srcTop, /* src */
+ srcW, srcH); /* size */
+ } else {
+ util_surface_copy(pipe, FALSE,
+ texSurf, 0, 0, /* dest */
+ src, srcLeft, srcTop, /* src */
+ srcW, srcH); /* size */
+ }
/* free the surface, update the texture if necessary.
*/
diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h
index 7c16b32cf9f..1e65a035aed 100644
--- a/src/gallium/auxiliary/util/u_clear.h
+++ b/src/gallium/auxiliary/util/u_clear.h
@@ -32,6 +32,7 @@
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "util/u_pack_color.h"
+#include "util/u_rect.h"
/**
@@ -48,13 +49,22 @@ util_clear(struct pipe_context *pipe,
unsigned color;
util_pack_color(rgba, ps->format, &color);
- pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
+ if (pipe->surface_fill) {
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
+ } else {
+ util_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));
+ if (pipe->surface_fill) {
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height,
+ util_pack_z_stencil(ps->format, depth, stencil));
+ } else {
+ util_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_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c
index ded361ce704..c93e0db23c3 100644
--- a/src/gallium/auxiliary/util/u_cpu_detect.c
+++ b/src/gallium/auxiliary/util/u_cpu_detect.c
@@ -131,7 +131,7 @@ win32_sig_handler_sse(EXCEPTION_POINTERS* ep)
#if defined(PIPE_ARCH_PPC) && !defined(PIPE_OS_DARWIN)
-static sigjmp_buf __lv_powerpc_jmpbuf;
+static jmp_buf __lv_powerpc_jmpbuf;
static volatile sig_atomic_t __lv_powerpc_canjump = 0;
static void
@@ -143,9 +143,11 @@ sigill_handler(int sig)
}
__lv_powerpc_canjump = 0;
- siglongjmp(__lv_powerpc_jmpbuf, 1);
+ longjmp(__lv_powerpc_jmpbuf, 1);
}
+#endif
+#if defined(PIPE_ARCH_PPC)
static void
check_os_altivec_support(void)
{
@@ -166,7 +168,7 @@ check_os_altivec_support(void)
/* no Darwin, do it the brute-force way */
/* this is borrowed from the libmpeg2 library */
signal(SIGILL, sigill_handler);
- if (sigsetjmp(__lv_powerpc_jmpbuf, 1)) {
+ if (setjmp(__lv_powerpc_jmpbuf)) {
signal(SIGILL, SIG_DFL);
} else {
__lv_powerpc_canjump = 1;
@@ -180,9 +182,9 @@ check_os_altivec_support(void)
signal(SIGILL, SIG_DFL);
util_cpu_caps.has_altivec = 1;
}
-#endif
+#endif /* PIPE_OS_DARWIN */
}
-#endif
+#endif /* PIPE_ARCH_PPC */
/* If we're running on a processor that can do SSE, let's see if we
* are allowed to or not. This will catch 2.4.0 or later kernels that
@@ -190,6 +192,7 @@ check_os_altivec_support(void)
* and RedHat patched 2.2 kernels that have broken exception handling
* support for user space apps that do SSE.
*/
+#if defined(PIPE_ARCH_X86) || defined (PIPE_ARCH_X86_64)
static void
check_os_katmai_support(void)
{
@@ -370,6 +373,7 @@ cpuid(uint32_t ax, uint32_t *p)
return ret;
}
+#endif /* X86 or X86_64 */
void
util_cpu_detect(void)
@@ -390,19 +394,26 @@ util_cpu_detect(void)
util_cpu_caps.arch = UTIL_CPU_ARCH_SPARC;
#elif defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
util_cpu_caps.arch = UTIL_CPU_ARCH_X86;
+ util_cpu_caps.little_endian = 1;
#elif defined(PIPE_ARCH_PPC)
util_cpu_caps.arch = UTIL_CPU_ARCH_POWERPC;
+ util_cpu_caps.little_endian = 0;
#else
util_cpu_caps.arch = UTIL_CPU_ARCH_UNKNOWN;
#endif
/* Count the number of CPUs in system */
-#if !defined(PIPE_OS_WINDOWS) && !defined(PIPE_OS_UNKNOWN) && defined(_SC_NPROCESSORS_ONLN)
+#if defined(PIPE_OS_WINDOWS)
+ {
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ util_cpu_caps.nr_cpus = system_info.dwNumberOfProcessors;
+ }
+#elif defined(PIPE_OS_UNIX) && defined(_SC_NPROCESSORS_ONLN)
util_cpu_caps.nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
if (util_cpu_caps.nr_cpus == -1)
util_cpu_caps.nr_cpus = 1;
-
-#elif defined(PIPE_OS_NETBSD) || defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_OPENBSD)
+#elif defined(PIPE_OS_BSD)
{
int mib[2], ncpu;
int len;
@@ -469,7 +480,6 @@ util_cpu_detect(void)
util_cpu_caps.cacheline = regs2[2] & 0xFF;
}
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_NETBSD) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_OPENBSD)
if (util_cpu_caps.has_sse)
check_os_katmai_support();
@@ -477,13 +487,8 @@ util_cpu_detect(void)
util_cpu_caps.has_sse2 = 0;
util_cpu_caps.has_sse3 = 0;
util_cpu_caps.has_ssse3 = 0;
+ util_cpu_caps.has_sse4_1 = 0;
}
-#else
- util_cpu_caps.has_sse = 0;
- util_cpu_caps.has_sse2 = 0;
- util_cpu_caps.has_sse3 = 0;
- util_cpu_caps.has_ssse3 = 0;
-#endif
}
#endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */
diff --git a/src/gallium/auxiliary/util/u_cpu_detect.h b/src/gallium/auxiliary/util/u_cpu_detect.h
index 7ea0121c07f..4b3dc39c342 100644
--- a/src/gallium/auxiliary/util/u_cpu_detect.h
+++ b/src/gallium/auxiliary/util/u_cpu_detect.h
@@ -54,6 +54,8 @@ struct util_cpu_caps {
int x86_cpu_type;
unsigned cacheline;
+ unsigned little_endian:1;
+
unsigned has_tsc:1;
unsigned has_mmx:1;
unsigned has_mmx2:1;
diff --git a/src/gallium/auxiliary/util/u_hash_table.c b/src/gallium/auxiliary/util/u_hash_table.c
index 8c2a8f454cc..5604e3ac374 100644
--- a/src/gallium/auxiliary/util/u_hash_table.c
+++ b/src/gallium/auxiliary/util/u_hash_table.c
@@ -47,7 +47,7 @@
#include "util/u_hash_table.h"
-struct hash_table
+struct util_hash_table
{
struct cso_hash *cso;
@@ -61,27 +61,27 @@ struct hash_table
};
-struct hash_table_item
+struct util_hash_table_item
{
void *key;
void *value;
};
-static INLINE struct hash_table_item *
-hash_table_item(struct cso_hash_iter iter)
+static INLINE struct util_hash_table_item *
+util_hash_table_item(struct cso_hash_iter iter)
{
- return (struct hash_table_item *)cso_hash_iter_data(iter);
+ return (struct util_hash_table_item *)cso_hash_iter_data(iter);
}
-struct hash_table *
-hash_table_create(unsigned (*hash)(void *key),
- int (*compare)(void *key1, void *key2))
+struct util_hash_table *
+util_hash_table_create(unsigned (*hash)(void *key),
+ int (*compare)(void *key1, void *key2))
{
- struct hash_table *ht;
+ struct util_hash_table *ht;
- ht = MALLOC_STRUCT(hash_table);
+ ht = MALLOC_STRUCT(util_hash_table);
if(!ht)
return NULL;
@@ -99,16 +99,16 @@ hash_table_create(unsigned (*hash)(void *key),
static INLINE struct cso_hash_iter
-hash_table_find_iter(struct hash_table *ht,
- void *key,
- unsigned key_hash)
+util_hash_table_find_iter(struct util_hash_table *ht,
+ void *key,
+ unsigned key_hash)
{
struct cso_hash_iter iter;
- struct hash_table_item *item;
+ struct util_hash_table_item *item;
iter = cso_hash_find(ht->cso, key_hash);
while (!cso_hash_iter_is_null(iter)) {
- item = (struct hash_table_item *)cso_hash_iter_data(iter);
+ item = (struct util_hash_table_item *)cso_hash_iter_data(iter);
if (!ht->compare(item->key, key))
break;
iter = cso_hash_iter_next(iter);
@@ -118,17 +118,17 @@ hash_table_find_iter(struct hash_table *ht,
}
-static INLINE struct hash_table_item *
-hash_table_find_item(struct hash_table *ht,
- void *key,
- unsigned key_hash)
+static INLINE struct util_hash_table_item *
+util_hash_table_find_item(struct util_hash_table *ht,
+ void *key,
+ unsigned key_hash)
{
struct cso_hash_iter iter;
- struct hash_table_item *item;
+ struct util_hash_table_item *item;
iter = cso_hash_find(ht->cso, key_hash);
while (!cso_hash_iter_is_null(iter)) {
- item = (struct hash_table_item *)cso_hash_iter_data(iter);
+ item = (struct util_hash_table_item *)cso_hash_iter_data(iter);
if (!ht->compare(item->key, key))
return item;
iter = cso_hash_iter_next(iter);
@@ -139,12 +139,12 @@ hash_table_find_item(struct hash_table *ht,
enum pipe_error
-hash_table_set(struct hash_table *ht,
- void *key,
- void *value)
+util_hash_table_set(struct util_hash_table *ht,
+ void *key,
+ void *value)
{
unsigned key_hash;
- struct hash_table_item *item;
+ struct util_hash_table_item *item;
struct cso_hash_iter iter;
assert(ht);
@@ -153,14 +153,14 @@ hash_table_set(struct hash_table *ht,
key_hash = ht->hash(key);
- item = hash_table_find_item(ht, key, key_hash);
+ item = util_hash_table_find_item(ht, key, key_hash);
if(item) {
/* TODO: key/value destruction? */
item->value = value;
return PIPE_OK;
}
- item = MALLOC_STRUCT(hash_table_item);
+ item = MALLOC_STRUCT(util_hash_table_item);
if(!item)
return PIPE_ERROR_OUT_OF_MEMORY;
@@ -178,11 +178,11 @@ hash_table_set(struct hash_table *ht,
void *
-hash_table_get(struct hash_table *ht,
- void *key)
+util_hash_table_get(struct util_hash_table *ht,
+ void *key)
{
unsigned key_hash;
- struct hash_table_item *item;
+ struct util_hash_table_item *item;
assert(ht);
if (!ht)
@@ -190,7 +190,7 @@ hash_table_get(struct hash_table *ht,
key_hash = ht->hash(key);
- item = hash_table_find_item(ht, key, key_hash);
+ item = util_hash_table_find_item(ht, key, key_hash);
if(!item)
return NULL;
@@ -199,12 +199,12 @@ hash_table_get(struct hash_table *ht,
void
-hash_table_remove(struct hash_table *ht,
- void *key)
+util_hash_table_remove(struct util_hash_table *ht,
+ void *key)
{
unsigned key_hash;
struct cso_hash_iter iter;
- struct hash_table_item *item;
+ struct util_hash_table_item *item;
assert(ht);
if (!ht)
@@ -212,11 +212,11 @@ hash_table_remove(struct hash_table *ht,
key_hash = ht->hash(key);
- iter = hash_table_find_iter(ht, key, key_hash);
+ iter = util_hash_table_find_iter(ht, key, key_hash);
if(cso_hash_iter_is_null(iter))
return;
- item = hash_table_item(iter);
+ item = util_hash_table_item(iter);
assert(item);
FREE(item);
@@ -225,10 +225,10 @@ hash_table_remove(struct hash_table *ht,
void
-hash_table_clear(struct hash_table *ht)
+util_hash_table_clear(struct util_hash_table *ht)
{
struct cso_hash_iter iter;
- struct hash_table_item *item;
+ struct util_hash_table_item *item;
assert(ht);
if (!ht)
@@ -236,7 +236,7 @@ hash_table_clear(struct hash_table *ht)
iter = cso_hash_first_node(ht->cso);
while (!cso_hash_iter_is_null(iter)) {
- item = (struct hash_table_item *)cso_hash_take(ht->cso, cso_hash_iter_key(iter));
+ item = (struct util_hash_table_item *)cso_hash_take(ht->cso, cso_hash_iter_key(iter));
FREE(item);
iter = cso_hash_first_node(ht->cso);
}
@@ -244,12 +244,13 @@ hash_table_clear(struct hash_table *ht)
enum pipe_error
-hash_table_foreach(struct hash_table *ht,
- enum pipe_error (*callback)(void *key, void *value, void *data),
- void *data)
+util_hash_table_foreach(struct util_hash_table *ht,
+ enum pipe_error (*callback)
+ (void *key, void *value, void *data),
+ void *data)
{
struct cso_hash_iter iter;
- struct hash_table_item *item;
+ struct util_hash_table_item *item;
enum pipe_error result;
assert(ht);
@@ -258,7 +259,7 @@ hash_table_foreach(struct hash_table *ht,
iter = cso_hash_first_node(ht->cso);
while (!cso_hash_iter_is_null(iter)) {
- item = (struct hash_table_item *)cso_hash_iter_data(iter);
+ item = (struct util_hash_table_item *)cso_hash_iter_data(iter);
result = callback(item->key, item->value, data);
if(result != PIPE_OK)
return result;
@@ -270,10 +271,10 @@ hash_table_foreach(struct hash_table *ht,
void
-hash_table_destroy(struct hash_table *ht)
+util_hash_table_destroy(struct util_hash_table *ht)
{
struct cso_hash_iter iter;
- struct hash_table_item *item;
+ struct util_hash_table_item *item;
assert(ht);
if (!ht)
@@ -281,7 +282,7 @@ hash_table_destroy(struct hash_table *ht)
iter = cso_hash_first_node(ht->cso);
while (!cso_hash_iter_is_null(iter)) {
- item = (struct hash_table_item *)cso_hash_iter_data(iter);
+ item = (struct util_hash_table_item *)cso_hash_iter_data(iter);
FREE(item);
iter = cso_hash_iter_next(iter);
}
diff --git a/src/gallium/auxiliary/util/u_hash_table.h b/src/gallium/auxiliary/util/u_hash_table.h
index feee881582e..258a31aec8a 100644
--- a/src/gallium/auxiliary/util/u_hash_table.h
+++ b/src/gallium/auxiliary/util/u_hash_table.h
@@ -46,7 +46,7 @@ extern "C" {
/**
* Generic purpose hash table.
*/
-struct hash_table;
+struct util_hash_table;
/**
@@ -55,37 +55,38 @@ struct hash_table;
* @param hash hash function
* @param compare should return 0 for two equal keys.
*/
-struct hash_table *
-hash_table_create(unsigned (*hash)(void *key),
- int (*compare)(void *key1, void *key2));
+struct util_hash_table *
+util_hash_table_create(unsigned (*hash)(void *key),
+ int (*compare)(void *key1, void *key2));
enum pipe_error
-hash_table_set(struct hash_table *ht,
- void *key,
- void *value);
+util_hash_table_set(struct util_hash_table *ht,
+ void *key,
+ void *value);
void *
-hash_table_get(struct hash_table *ht,
- void *key);
+util_hash_table_get(struct util_hash_table *ht,
+ void *key);
void
-hash_table_remove(struct hash_table *ht,
- void *key);
+util_hash_table_remove(struct util_hash_table *ht,
+ void *key);
void
-hash_table_clear(struct hash_table *ht);
+util_hash_table_clear(struct util_hash_table *ht);
enum pipe_error
-hash_table_foreach(struct hash_table *ht,
- enum pipe_error (*callback)(void *key, void *value, void *data),
- void *data);
+util_hash_table_foreach(struct util_hash_table *ht,
+ enum pipe_error (*callback)
+ (void *key, void *value, void *data),
+ void *data);
void
-hash_table_destroy(struct hash_table *ht);
+util_hash_table_destroy(struct util_hash_table *ht);
#ifdef __cplusplus
diff --git a/src/gallium/auxiliary/util/u_keymap.c b/src/gallium/auxiliary/util/u_keymap.c
index 508a2ee0634..f856395ca92 100644
--- a/src/gallium/auxiliary/util/u_keymap.c
+++ b/src/gallium/auxiliary/util/u_keymap.c
@@ -28,7 +28,7 @@
/**
* Key lookup/associative container.
*
- * Like Jose's u_hash_table, based on CSO cache code for now.
+ * Like Jose's util_hash_table, based on CSO cache code for now.
*
* Author: Brian Paul
*/
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fp.c b/src/gallium/drivers/cell/ppu/cell_gen_fp.c
index 312621fd534..b6b2f885af5 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fp.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fp.c
@@ -674,7 +674,7 @@ emit_MAD(struct codegen *gen, const struct tgsi_full_instruction *inst)
* Emit linear interpolate. See emit_ADD for comments.
*/
static boolean
-emit_LERP(struct codegen *gen, const struct tgsi_full_instruction *inst)
+emit_LRP(struct codegen *gen, const struct tgsi_full_instruction *inst)
{
int ch, s1_reg[4], s2_reg[4], s3_reg[4], d_reg[4], tmp_reg[4];
@@ -1766,7 +1766,7 @@ emit_instruction(struct codegen *gen,
return emit_binop(gen, inst);
case TGSI_OPCODE_MAD:
return emit_MAD(gen, inst);
- case TGSI_OPCODE_LERP:
+ case TGSI_OPCODE_LRP:
return emit_LRP(gen, inst);
case TGSI_OPCODE_DP3:
return emit_DP3(gen, inst);
diff --git a/src/gallium/drivers/i915/i915_debug.c b/src/gallium/drivers/i915/i915_debug.c
index ce92d1af9a7..e6640e587b4 100644
--- a/src/gallium/drivers/i915/i915_debug.c
+++ b/src/gallium/drivers/i915/i915_debug.c
@@ -880,7 +880,7 @@ i915_dump_batchbuffer( struct intel_batchbuffer *batch )
return;
}
- debug_printf( "\n\nBATCH: (%d)\n", bytes / 4);
+ debug_printf( "\n\nBATCH: (%d)\n", (int)bytes / 4);
while (!done &&
stream.offset < bytes)
diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c
index 89504ced276..1fe5cda9563 100644
--- a/src/gallium/drivers/i915/i915_fpc_translate.c
+++ b/src/gallium/drivers/i915/i915_fpc_translate.c
@@ -127,7 +127,7 @@ i915_program_error(struct i915_fp_compile *p, const char *msg, ...)
va_start( args, msg );
util_vsnprintf( buffer, sizeof(buffer), msg, args );
va_end( args );
- debug_printf(buffer);
+ debug_printf("%s", buffer);
debug_printf("\n");
p->error = 1;
diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile
index 21aff1967a1..b96ee23a993 100644
--- a/src/gallium/drivers/llvmpipe/Makefile
+++ b/src/gallium/drivers/llvmpipe/Makefile
@@ -21,6 +21,7 @@ C_SOURCES = \
lp_bld_interp.c \
lp_bld_intr.c \
lp_bld_logic.c \
+ lp_bld_pack.c \
lp_bld_sample_soa.c \
lp_bld_swizzle.c \
lp_bld_struct.c \
diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript
index 13cd465838a..403e4daa436 100644
--- a/src/gallium/drivers/llvmpipe/SConscript
+++ b/src/gallium/drivers/llvmpipe/SConscript
@@ -33,6 +33,7 @@ llvmpipe = env.ConvenienceLibrary(
'lp_bld_format_soa.c',
'lp_bld_interp.c',
'lp_bld_intr.c',
+ 'lp_bld_pack.c',
'lp_bld_sample_soa.c',
'lp_bld_struct.c',
'lp_bld_logic.c',
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c
index d27ef0de041..83ca06acf86 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c
@@ -54,6 +54,7 @@
#include "lp_bld_const.h"
#include "lp_bld_intr.h"
#include "lp_bld_logic.h"
+#include "lp_bld_pack.h"
#include "lp_bld_debug.h"
#include "lp_bld_arit.h"
@@ -280,45 +281,6 @@ lp_build_sub(struct lp_build_context *bld,
/**
- * Build shuffle vectors that match PUNPCKLxx and PUNPCKHxx instructions.
- */
-static LLVMValueRef
-lp_build_unpack_shuffle(unsigned n, unsigned lo_hi)
-{
- LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
- unsigned i, j;
-
- assert(n <= LP_MAX_VECTOR_LENGTH);
- assert(lo_hi < 2);
-
- for(i = 0, j = lo_hi*n/2; i < n; i += 2, ++j) {
- elems[i + 0] = LLVMConstInt(LLVMInt32Type(), 0 + j, 0);
- elems[i + 1] = LLVMConstInt(LLVMInt32Type(), n + j, 0);
- }
-
- return LLVMConstVector(elems, n);
-}
-
-
-/**
- * Build constant int vector of width 'n' and value 'c'.
- */
-static LLVMValueRef
-lp_build_const_vec(LLVMTypeRef type, unsigned n, long long c)
-{
- LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
- unsigned i;
-
- assert(n <= LP_MAX_VECTOR_LENGTH);
-
- for(i = 0; i < n; ++i)
- elems[i] = LLVMConstInt(type, c, 0);
-
- return LLVMConstVector(elems, n);
-}
-
-
-/**
* Normalized 8bit multiplication.
*
* - alpha plus one
@@ -361,33 +323,30 @@ lp_build_const_vec(LLVMTypeRef type, unsigned n, long long c)
*/
static LLVMValueRef
lp_build_mul_u8n(LLVMBuilderRef builder,
+ struct lp_type i16_type,
LLVMValueRef a, LLVMValueRef b)
{
- static LLVMValueRef c01 = NULL;
- static LLVMValueRef c08 = NULL;
- static LLVMValueRef c80 = NULL;
+ LLVMValueRef c8;
LLVMValueRef ab;
- if(!c01) c01 = lp_build_const_vec(LLVMInt16Type(), 8, 0x01);
- if(!c08) c08 = lp_build_const_vec(LLVMInt16Type(), 8, 0x08);
- if(!c80) c80 = lp_build_const_vec(LLVMInt16Type(), 8, 0x80);
+ c8 = lp_build_int_const_scalar(i16_type, 8);
#if 0
/* a*b/255 ~= (a*(b + 1)) >> 256 */
- b = LLVMBuildAdd(builder, b, c01, "");
+ b = LLVMBuildAdd(builder, b, lp_build_int_const_scalar(i16_type, 1), "");
ab = LLVMBuildMul(builder, a, b, "");
#else
- /* t/255 ~= (t + (t >> 8) + 0x80) >> 8 */
+ /* ab/255 ~= (ab + (ab >> 8) + 0x80) >> 8 */
ab = LLVMBuildMul(builder, a, b, "");
- ab = LLVMBuildAdd(builder, ab, LLVMBuildLShr(builder, ab, c08, ""), "");
- ab = LLVMBuildAdd(builder, ab, c80, "");
+ ab = LLVMBuildAdd(builder, ab, LLVMBuildLShr(builder, ab, c8, ""), "");
+ ab = LLVMBuildAdd(builder, ab, lp_build_int_const_scalar(i16_type, 0x80), "");
#endif
- ab = LLVMBuildLShr(builder, ab, c08, "");
+ ab = LLVMBuildLShr(builder, ab, c8, "");
return ab;
}
@@ -415,39 +374,18 @@ lp_build_mul(struct lp_build_context *bld,
return bld->undef;
if(!type.floating && !type.fixed && type.norm) {
- if(util_cpu_caps.has_sse2 && type.width == 8 && type.length == 16) {
- LLVMTypeRef i16x8 = LLVMVectorType(LLVMInt16Type(), 8);
- LLVMTypeRef i8x16 = LLVMVectorType(LLVMInt8Type(), 16);
- static LLVMValueRef ml = NULL;
- static LLVMValueRef mh = NULL;
- LLVMValueRef al, ah, bl, bh;
- LLVMValueRef abl, abh;
- LLVMValueRef ab;
-
- if(!ml) ml = lp_build_unpack_shuffle(16, 0);
- if(!mh) mh = lp_build_unpack_shuffle(16, 1);
+ if(type.width == 8) {
+ struct lp_type i16_type = lp_wider_type(type);
+ LLVMValueRef al, ah, bl, bh, abl, abh, ab;
- /* PUNPCKLBW, PUNPCKHBW */
- al = LLVMBuildShuffleVector(bld->builder, a, bld->zero, ml, "");
- bl = LLVMBuildShuffleVector(bld->builder, b, bld->zero, ml, "");
- ah = LLVMBuildShuffleVector(bld->builder, a, bld->zero, mh, "");
- bh = LLVMBuildShuffleVector(bld->builder, b, bld->zero, mh, "");
-
- /* NOP */
- al = LLVMBuildBitCast(bld->builder, al, i16x8, "");
- bl = LLVMBuildBitCast(bld->builder, bl, i16x8, "");
- ah = LLVMBuildBitCast(bld->builder, ah, i16x8, "");
- bh = LLVMBuildBitCast(bld->builder, bh, i16x8, "");
+ lp_build_unpack2(bld->builder, type, i16_type, a, &al, &ah);
+ lp_build_unpack2(bld->builder, type, i16_type, b, &bl, &bh);
/* PMULLW, PSRLW, PADDW */
- abl = lp_build_mul_u8n(bld->builder, al, bl);
- abh = lp_build_mul_u8n(bld->builder, ah, bh);
-
- /* PACKUSWB */
- ab = lp_build_intrinsic_binary(bld->builder, "llvm.x86.sse2.packuswb.128" , i16x8, abl, abh);
+ abl = lp_build_mul_u8n(bld->builder, i16_type, al, bl);
+ abh = lp_build_mul_u8n(bld->builder, i16_type, ah, bh);
- /* NOP */
- ab = LLVMBuildBitCast(bld->builder, ab, i8x16, "");
+ ab = lp_build_pack2(bld->builder, i16_type, type, abl, abh);
return ab;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.h b/src/gallium/drivers/llvmpipe/lp_bld_arit.h
index 095a8e1cabe..4e568c055e2 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_arit.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.h
@@ -40,7 +40,7 @@
#include <llvm-c/Core.h>
-struct lp_type type;
+struct lp_type;
struct lp_build_context;
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_const.h b/src/gallium/drivers/llvmpipe/lp_bld_const.h
index ffb302f7366..cb8e1c7b006 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_const.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_const.h
@@ -42,7 +42,7 @@
#include <pipe/p_compiler.h>
-struct lp_type type;
+struct lp_type;
unsigned
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_conv.c b/src/gallium/drivers/llvmpipe/lp_bld_conv.c
index 20c8710214b..99352094379 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_conv.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_conv.c
@@ -69,6 +69,7 @@
#include "lp_bld_const.h"
#include "lp_bld_intr.h"
#include "lp_bld_arit.h"
+#include "lp_bld_pack.h"
#include "lp_bld_conv.h"
@@ -199,241 +200,6 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
/**
- * Build shuffle vectors that match PUNPCKLxx and PUNPCKHxx instructions.
- */
-static LLVMValueRef
-lp_build_const_unpack_shuffle(unsigned n, unsigned lo_hi)
-{
- LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
- unsigned i, j;
-
- assert(n <= LP_MAX_VECTOR_LENGTH);
- assert(lo_hi < 2);
-
- /* TODO: cache results in a static table */
-
- for(i = 0, j = lo_hi*n/2; i < n; i += 2, ++j) {
- elems[i + 0] = LLVMConstInt(LLVMInt32Type(), 0 + j, 0);
- elems[i + 1] = LLVMConstInt(LLVMInt32Type(), n + j, 0);
- }
-
- return LLVMConstVector(elems, n);
-}
-
-
-/**
- * Build shuffle vectors that match PACKxx instructions.
- */
-static LLVMValueRef
-lp_build_const_pack_shuffle(unsigned n)
-{
- LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
- unsigned i;
-
- assert(n <= LP_MAX_VECTOR_LENGTH);
-
- /* TODO: cache results in a static table */
-
- for(i = 0; i < n; ++i)
- elems[i] = LLVMConstInt(LLVMInt32Type(), 2*i, 0);
-
- return LLVMConstVector(elems, n);
-}
-
-
-/**
- * Expand the bit width.
- *
- * This will only change the number of bits the values are represented, not the
- * values themselves.
- */
-static void
-lp_build_expand(LLVMBuilderRef builder,
- struct lp_type src_type,
- struct lp_type dst_type,
- LLVMValueRef src,
- LLVMValueRef *dst, unsigned num_dsts)
-{
- unsigned num_tmps;
- unsigned i;
-
- /* Register width must remain constant */
- assert(src_type.width * src_type.length == dst_type.width * dst_type.length);
-
- /* We must not loose or gain channels. Only precision */
- assert(src_type.length == dst_type.length * num_dsts);
-
- num_tmps = 1;
- dst[0] = src;
-
- while(src_type.width < dst_type.width) {
- struct lp_type new_type = src_type;
- LLVMTypeRef new_vec_type;
-
- new_type.width *= 2;
- new_type.length /= 2;
- new_vec_type = lp_build_vec_type(new_type);
-
- for(i = num_tmps; i--; ) {
- LLVMValueRef zero;
- LLVMValueRef shuffle_lo;
- LLVMValueRef shuffle_hi;
- LLVMValueRef lo;
- LLVMValueRef hi;
-
- zero = lp_build_zero(src_type);
- shuffle_lo = lp_build_const_unpack_shuffle(src_type.length, 0);
- shuffle_hi = lp_build_const_unpack_shuffle(src_type.length, 1);
-
- /* PUNPCKLBW, PUNPCKHBW */
- lo = LLVMBuildShuffleVector(builder, dst[i], zero, shuffle_lo, "");
- hi = LLVMBuildShuffleVector(builder, dst[i], zero, shuffle_hi, "");
-
- dst[2*i + 0] = LLVMBuildBitCast(builder, lo, new_vec_type, "");
- dst[2*i + 1] = LLVMBuildBitCast(builder, hi, new_vec_type, "");
- }
-
- src_type = new_type;
-
- num_tmps *= 2;
- }
-
- assert(num_tmps == num_dsts);
-}
-
-
-/**
- * Non-interleaved pack.
- *
- * This will move values as
- *
- * lo = __ l0 __ l1 __ l2 __.. __ ln
- * hi = __ h0 __ h1 __ h2 __.. __ hn
- * res = l0 l1 l2 .. ln h0 h1 h2 .. hn
- *
- * TODO: handle saturation consistently.
- */
-static LLVMValueRef
-lp_build_pack2(LLVMBuilderRef builder,
- struct lp_type src_type,
- struct lp_type dst_type,
- boolean clamped,
- LLVMValueRef lo,
- LLVMValueRef hi)
-{
- LLVMTypeRef src_vec_type = lp_build_vec_type(src_type);
- LLVMTypeRef dst_vec_type = lp_build_vec_type(dst_type);
- LLVMValueRef shuffle;
- LLVMValueRef res;
-
- /* Register width must remain constant */
- assert(src_type.width * src_type.length == dst_type.width * dst_type.length);
-
- /* We must not loose or gain channels. Only precision */
- assert(src_type.length * 2 == dst_type.length);
-
- assert(!src_type.floating);
- assert(!dst_type.floating);
-
- if(util_cpu_caps.has_sse2 && src_type.width * src_type.length == 128) {
- /* All X86 non-interleaved pack instructions all take signed inputs and
- * saturate them, so saturate beforehand. */
- if(!src_type.sign && !clamped) {
- struct lp_build_context bld;
- unsigned dst_bits = dst_type.sign ? dst_type.width - 1 : dst_type.width;
- LLVMValueRef dst_max = lp_build_int_const_scalar(src_type, ((unsigned long long)1 << dst_bits) - 1);
- lp_build_context_init(&bld, builder, src_type);
- lo = lp_build_min(&bld, lo, dst_max);
- hi = lp_build_min(&bld, hi, dst_max);
- }
-
- switch(src_type.width) {
- case 32:
- if(dst_type.sign || !util_cpu_caps.has_sse4_1)
- res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", src_vec_type, lo, hi);
- else
- /* PACKUSDW is the only instrinsic with a consistent signature */
- return lp_build_intrinsic_binary(builder, "llvm.x86.sse41.packusdw", dst_vec_type, lo, hi);
- break;
-
- case 16:
- if(dst_type.sign)
- res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packsswb.128", src_vec_type, lo, hi);
- else
- res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", src_vec_type, lo, hi);
- break;
-
- default:
- assert(0);
- return LLVMGetUndef(dst_vec_type);
- break;
- }
-
- res = LLVMBuildBitCast(builder, res, dst_vec_type, "");
- return res;
- }
-
- lo = LLVMBuildBitCast(builder, lo, dst_vec_type, "");
- hi = LLVMBuildBitCast(builder, hi, dst_vec_type, "");
-
- shuffle = lp_build_const_pack_shuffle(dst_type.length);
-
- res = LLVMBuildShuffleVector(builder, lo, hi, shuffle, "");
-
- return res;
-}
-
-
-/**
- * Truncate the bit width.
- *
- * TODO: Handle saturation consistently.
- */
-static LLVMValueRef
-lp_build_pack(LLVMBuilderRef builder,
- struct lp_type src_type,
- struct lp_type dst_type,
- boolean clamped,
- const LLVMValueRef *src, unsigned num_srcs)
-{
- LLVMValueRef tmp[LP_MAX_VECTOR_LENGTH];
- unsigned i;
-
- /* Register width must remain constant */
- assert(src_type.width * src_type.length == dst_type.width * dst_type.length);
-
- /* We must not loose or gain channels. Only precision */
- assert(src_type.length * num_srcs == dst_type.length);
-
- for(i = 0; i < num_srcs; ++i)
- tmp[i] = src[i];
-
- while(src_type.width > dst_type.width) {
- struct lp_type new_type = src_type;
-
- new_type.width /= 2;
- new_type.length *= 2;
-
- /* Take in consideration the sign changes only in the last step */
- if(new_type.width == dst_type.width)
- new_type.sign = dst_type.sign;
-
- num_srcs /= 2;
-
- for(i = 0; i < num_srcs; ++i)
- tmp[i] = lp_build_pack2(builder, src_type, new_type, clamped,
- tmp[2*i + 0], tmp[2*i + 1]);
-
- src_type = new_type;
- }
-
- assert(num_srcs == 1);
-
- return tmp[0];
-}
-
-
-/**
* Generic type conversion.
*
* TODO: Take a precision argument, or even better, add a new precision member
@@ -572,7 +338,7 @@ lp_build_conv(LLVMBuilderRef builder,
if(tmp_type.width < dst_type.width) {
assert(num_tmps == 1);
- lp_build_expand(builder, tmp_type, dst_type, tmp[0], tmp, num_dsts);
+ lp_build_unpack(builder, tmp_type, dst_type, tmp[0], tmp, num_dsts);
tmp_type.width = dst_type.width;
tmp_type.length = dst_type.length;
num_tmps = num_dsts;
@@ -692,7 +458,7 @@ lp_build_conv_mask(LLVMBuilderRef builder,
}
else if(src_type.width < dst_type.width) {
assert(num_srcs == 1);
- lp_build_expand(builder, src_type, dst_type, src[0], dst, num_dsts);
+ lp_build_unpack(builder, src_type, dst_type, src[0], dst, num_dsts);
}
else {
assert(num_srcs == num_dsts);
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_conv.h b/src/gallium/drivers/llvmpipe/lp_bld_conv.h
index ca378804d2a..948e68fae4f 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_conv.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_conv.h
@@ -40,7 +40,7 @@
#include <llvm-c/Core.h>
-struct lp_type type;
+struct lp_type;
LLVMValueRef
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_logic.h b/src/gallium/drivers/llvmpipe/lp_bld_logic.h
index a4ee7723b5f..d67500ef707 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_logic.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_logic.h
@@ -42,7 +42,7 @@
#include "pipe/p_defines.h" /* For PIPE_FUNC_xxx */
-struct lp_type type;
+struct lp_type;
struct lp_build_context;
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_pack.c b/src/gallium/drivers/llvmpipe/lp_bld_pack.c
new file mode 100644
index 00000000000..fe82fda0392
--- /dev/null
+++ b/src/gallium/drivers/llvmpipe/lp_bld_pack.c
@@ -0,0 +1,419 @@
+/**************************************************************************
+ *
+ * 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
+ * Helper functions for packing/unpacking.
+ *
+ * Pack/unpacking is necessary for conversion between types of different
+ * bit width.
+ *
+ * They are also commonly used when an computation needs higher
+ * precision for the intermediate values. For example, if one needs the
+ * function:
+ *
+ * c = compute(a, b);
+ *
+ * to use more precision for intermediate results then one should implement it
+ * as:
+ *
+ * LLVMValueRef
+ * compute(LLVMBuilderRef builder struct lp_type type, LLVMValueRef a, LLVMValueRef b)
+ * {
+ * struct lp_type wide_type = lp_wider_type(type);
+ * LLVMValueRef al, ah, bl, bh, cl, ch, c;
+ *
+ * lp_build_unpack2(builder, type, wide_type, a, &al, &ah);
+ * lp_build_unpack2(builder, type, wide_type, b, &bl, &bh);
+ *
+ * cl = compute_half(al, bl);
+ * ch = compute_half(ah, bh);
+ *
+ * c = lp_build_pack2(bld->builder, wide_type, type, cl, ch);
+ *
+ * return c;
+ * }
+ *
+ * where compute_half() would do the computation for half the elements with
+ * twice the precision.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+
+#include "util/u_debug.h"
+#include "util/u_math.h"
+#include "util/u_cpu_detect.h"
+
+#include "lp_bld_type.h"
+#include "lp_bld_const.h"
+#include "lp_bld_intr.h"
+#include "lp_bld_arit.h"
+#include "lp_bld_pack.h"
+
+
+/**
+ * Build shuffle vectors that match PUNPCKLxx and PUNPCKHxx instructions.
+ */
+static LLVMValueRef
+lp_build_const_unpack_shuffle(unsigned n, unsigned lo_hi)
+{
+ LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
+ unsigned i, j;
+
+ assert(n <= LP_MAX_VECTOR_LENGTH);
+ assert(lo_hi < 2);
+
+ /* TODO: cache results in a static table */
+
+ for(i = 0, j = lo_hi*n/2; i < n; i += 2, ++j) {
+ elems[i + 0] = LLVMConstInt(LLVMInt32Type(), 0 + j, 0);
+ elems[i + 1] = LLVMConstInt(LLVMInt32Type(), n + j, 0);
+ }
+
+ return LLVMConstVector(elems, n);
+}
+
+
+/**
+ * Build shuffle vectors that match PACKxx instructions.
+ */
+static LLVMValueRef
+lp_build_const_pack_shuffle(unsigned n)
+{
+ LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
+ unsigned i;
+
+ assert(n <= LP_MAX_VECTOR_LENGTH);
+
+ /* TODO: cache results in a static table */
+
+ for(i = 0; i < n; ++i)
+ elems[i] = LLVMConstInt(LLVMInt32Type(), 2*i, 0);
+
+ return LLVMConstVector(elems, n);
+}
+
+
+/**
+ * Interleave vector elements.
+ *
+ * Matches the PUNPCKLxx and PUNPCKHxx SSE instructions.
+ */
+LLVMValueRef
+lp_build_interleave2(LLVMBuilderRef builder,
+ struct lp_type type,
+ LLVMValueRef a,
+ LLVMValueRef b,
+ unsigned lo_hi)
+{
+ LLVMValueRef shuffle;
+
+ shuffle = lp_build_const_unpack_shuffle(type.length, lo_hi);
+
+ return LLVMBuildShuffleVector(builder, a, b, shuffle, "");
+}
+
+
+/**
+ * Double the bit width.
+ *
+ * This will only change the number of bits the values are represented, not the
+ * values themselves.
+ */
+void
+lp_build_unpack2(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ LLVMValueRef src,
+ LLVMValueRef *dst_lo,
+ LLVMValueRef *dst_hi)
+{
+ LLVMValueRef msb;
+ LLVMTypeRef dst_vec_type;
+
+ assert(!src_type.floating);
+ assert(!dst_type.floating);
+ assert(dst_type.sign == src_type.sign);
+ assert(dst_type.width == src_type.width * 2);
+ assert(dst_type.length * 2 == src_type.length);
+
+ if(src_type.sign) {
+ /* Replicate the sign bit in the most significant bits */
+ msb = LLVMBuildAShr(builder, src, lp_build_int_const_scalar(src_type, src_type.width - 1), "");
+ }
+ else
+ /* Most significant bits always zero */
+ msb = lp_build_zero(src_type);
+
+ /* Interleave bits */
+ if(util_cpu_caps.little_endian) {
+ *dst_lo = lp_build_interleave2(builder, src_type, src, msb, 0);
+ *dst_hi = lp_build_interleave2(builder, src_type, src, msb, 1);
+ }
+ else {
+ *dst_lo = lp_build_interleave2(builder, src_type, msb, src, 0);
+ *dst_hi = lp_build_interleave2(builder, src_type, msb, src, 1);
+ }
+
+ /* Cast the result into the new type (twice as wide) */
+
+ dst_vec_type = lp_build_vec_type(dst_type);
+
+ *dst_lo = LLVMBuildBitCast(builder, *dst_lo, dst_vec_type, "");
+ *dst_hi = LLVMBuildBitCast(builder, *dst_hi, dst_vec_type, "");
+}
+
+
+/**
+ * Expand the bit width.
+ *
+ * This will only change the number of bits the values are represented, not the
+ * values themselves.
+ */
+void
+lp_build_unpack(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ LLVMValueRef src,
+ LLVMValueRef *dst, unsigned num_dsts)
+{
+ unsigned num_tmps;
+ unsigned i;
+
+ /* Register width must remain constant */
+ assert(src_type.width * src_type.length == dst_type.width * dst_type.length);
+
+ /* We must not loose or gain channels. Only precision */
+ assert(src_type.length == dst_type.length * num_dsts);
+
+ num_tmps = 1;
+ dst[0] = src;
+
+ while(src_type.width < dst_type.width) {
+ struct lp_type tmp_type = src_type;
+
+ tmp_type.width *= 2;
+ tmp_type.length /= 2;
+
+ for(i = num_tmps; i--; ) {
+ lp_build_unpack2(builder, src_type, tmp_type, dst[i], &dst[2*i + 0], &dst[2*i + 1]);
+ }
+
+ src_type = tmp_type;
+
+ num_tmps *= 2;
+ }
+
+ assert(num_tmps == num_dsts);
+}
+
+
+/**
+ * Non-interleaved pack.
+ *
+ * This will move values as
+ *
+ * lo = __ l0 __ l1 __ l2 __.. __ ln
+ * hi = __ h0 __ h1 __ h2 __.. __ hn
+ * res = l0 l1 l2 .. ln h0 h1 h2 .. hn
+ *
+ * This will only change the number of bits the values are represented, not the
+ * values themselves.
+ *
+ * It is assumed the values are already clamped into the destination type range.
+ * Values outside that range will produce undefined results. Use
+ * lp_build_packs2 instead.
+ */
+LLVMValueRef
+lp_build_pack2(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ LLVMValueRef lo,
+ LLVMValueRef hi)
+{
+ LLVMTypeRef src_vec_type = lp_build_vec_type(src_type);
+ LLVMTypeRef dst_vec_type = lp_build_vec_type(dst_type);
+ LLVMValueRef shuffle;
+ LLVMValueRef res;
+
+ dst_vec_type = lp_build_vec_type(dst_type);
+
+ assert(!src_type.floating);
+ assert(!dst_type.floating);
+ assert(src_type.width == dst_type.width * 2);
+ assert(src_type.length * 2 == dst_type.length);
+
+ if(util_cpu_caps.has_sse2 && src_type.width * src_type.length == 128) {
+ switch(src_type.width) {
+ case 32:
+ if(dst_type.sign) {
+ res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", src_vec_type, lo, hi);
+ }
+ else {
+ if (util_cpu_caps.has_sse4_1) {
+ /* PACKUSDW is the only instrinsic with a consistent signature */
+ return lp_build_intrinsic_binary(builder, "llvm.x86.sse41.packusdw", dst_vec_type, lo, hi);
+ }
+ else {
+ assert(0);
+ return LLVMGetUndef(dst_vec_type);
+ }
+ }
+ break;
+
+ case 16:
+ if(dst_type.sign)
+ res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packsswb.128", src_vec_type, lo, hi);
+ else
+ res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", src_vec_type, lo, hi);
+ break;
+
+ default:
+ assert(0);
+ return LLVMGetUndef(dst_vec_type);
+ break;
+ }
+
+ res = LLVMBuildBitCast(builder, res, dst_vec_type, "");
+ return res;
+ }
+
+ lo = LLVMBuildBitCast(builder, lo, dst_vec_type, "");
+ hi = LLVMBuildBitCast(builder, hi, dst_vec_type, "");
+
+ shuffle = lp_build_const_pack_shuffle(dst_type.length);
+
+ res = LLVMBuildShuffleVector(builder, lo, hi, shuffle, "");
+
+ return res;
+}
+
+
+
+/**
+ * Non-interleaved pack and saturate.
+ *
+ * Same as lp_build_pack2 but will saturate values so that they fit into the
+ * destination type.
+ */
+LLVMValueRef
+lp_build_packs2(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ LLVMValueRef lo,
+ LLVMValueRef hi)
+{
+ boolean clamp;
+
+ assert(!src_type.floating);
+ assert(!dst_type.floating);
+ assert(src_type.sign == dst_type.sign);
+ assert(src_type.width == dst_type.width * 2);
+ assert(src_type.length * 2 == dst_type.length);
+
+ clamp = TRUE;
+
+ /* All X86 SSE non-interleaved pack instructions take signed inputs and
+ * saturate them, so no need to clamp for those cases. */
+ if(util_cpu_caps.has_sse2 &&
+ src_type.width * src_type.length == 128 &&
+ src_type.sign)
+ clamp = FALSE;
+
+ if(clamp) {
+ struct lp_build_context bld;
+ unsigned dst_bits = dst_type.sign ? dst_type.width - 1 : dst_type.width;
+ LLVMValueRef dst_max = lp_build_int_const_scalar(src_type, ((unsigned long long)1 << dst_bits) - 1);
+ lp_build_context_init(&bld, builder, src_type);
+ lo = lp_build_min(&bld, lo, dst_max);
+ hi = lp_build_min(&bld, hi, dst_max);
+ /* FIXME: What about lower bound? */
+ }
+
+ return lp_build_pack2(builder, src_type, dst_type, lo, hi);
+}
+
+
+/**
+ * Truncate the bit width.
+ *
+ * TODO: Handle saturation consistently.
+ */
+LLVMValueRef
+lp_build_pack(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ boolean clamped,
+ const LLVMValueRef *src, unsigned num_srcs)
+{
+ LLVMValueRef (*pack2)(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ LLVMValueRef lo,
+ LLVMValueRef hi);
+ LLVMValueRef tmp[LP_MAX_VECTOR_LENGTH];
+ unsigned i;
+
+
+ /* Register width must remain constant */
+ assert(src_type.width * src_type.length == dst_type.width * dst_type.length);
+
+ /* We must not loose or gain channels. Only precision */
+ assert(src_type.length * num_srcs == dst_type.length);
+
+ if(clamped)
+ pack2 = &lp_build_pack2;
+ else
+ pack2 = &lp_build_packs2;
+
+ for(i = 0; i < num_srcs; ++i)
+ tmp[i] = src[i];
+
+ while(src_type.width > dst_type.width) {
+ struct lp_type tmp_type = src_type;
+
+ tmp_type.width /= 2;
+ tmp_type.length *= 2;
+
+ /* Take in consideration the sign changes only in the last step */
+ if(tmp_type.width == dst_type.width)
+ tmp_type.sign = dst_type.sign;
+
+ num_srcs /= 2;
+
+ for(i = 0; i < num_srcs; ++i)
+ tmp[i] = pack2(builder, src_type, tmp_type, tmp[2*i + 0], tmp[2*i + 1]);
+
+ src_type = tmp_type;
+ }
+
+ assert(num_srcs == 1);
+
+ return tmp[0];
+}
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_pack.h b/src/gallium/drivers/llvmpipe/lp_bld_pack.h
new file mode 100644
index 00000000000..fb2a34984a4
--- /dev/null
+++ b/src/gallium/drivers/llvmpipe/lp_bld_pack.h
@@ -0,0 +1,95 @@
+/**************************************************************************
+ *
+ * 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
+ * Helper functions for packing/unpacking conversions.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+
+#ifndef LP_BLD_PACK_H
+#define LP_BLD_PACK_H
+
+
+#include <llvm-c/Core.h>
+
+
+struct lp_type;
+
+
+LLVMValueRef
+lp_build_interleave2(LLVMBuilderRef builder,
+ struct lp_type type,
+ LLVMValueRef a,
+ LLVMValueRef b,
+ unsigned lo_hi);
+
+
+void
+lp_build_unpack2(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ LLVMValueRef src,
+ LLVMValueRef *dst_lo,
+ LLVMValueRef *dst_hi);
+
+
+void
+lp_build_unpack(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ LLVMValueRef src,
+ LLVMValueRef *dst, unsigned num_dsts);
+
+
+LLVMValueRef
+lp_build_packs2(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ LLVMValueRef lo,
+ LLVMValueRef hi);
+
+
+LLVMValueRef
+lp_build_pack2(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ LLVMValueRef lo,
+ LLVMValueRef hi);
+
+
+LLVMValueRef
+lp_build_pack(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ boolean clamped,
+ const LLVMValueRef *src, unsigned num_srcs);
+
+
+#endif /* !LP_BLD_PACK_H */
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h
index 1f6da804488..b9472127a63 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h
@@ -40,7 +40,7 @@
#include <llvm-c/Core.h>
-struct lp_type type;
+struct lp_type;
struct lp_build_context;
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_type.c b/src/gallium/drivers/llvmpipe/lp_bld_type.c
index 606243d6c5a..1320a267214 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_type.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_type.c
@@ -160,12 +160,31 @@ lp_build_int_vec_type(struct lp_type type)
struct lp_type
lp_int_type(struct lp_type type)
{
- struct lp_type int_type;
+ struct lp_type res_type;
- memset(&int_type, 0, sizeof int_type);
- int_type.width = type.width;
- int_type.length = type.length;
- return int_type;
+ memset(&res_type, 0, sizeof res_type);
+ res_type.width = type.width;
+ res_type.length = type.length;
+
+ return res_type;
+}
+
+
+/**
+ * Return the type with twice the bit width (hence half the number of elements).
+ */
+struct lp_type
+lp_wider_type(struct lp_type type)
+{
+ struct lp_type res_type;
+
+ memcpy(&res_type, &type, sizeof res_type);
+ res_type.width *= 2;
+ res_type.length /= 2;
+
+ assert(res_type.length);
+
+ return res_type;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_type.h b/src/gallium/drivers/llvmpipe/lp_bld_type.h
index ee5ca3483c1..46c298fa206 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_type.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_type.h
@@ -166,6 +166,10 @@ struct lp_type
lp_int_type(struct lp_type type);
+struct lp_type
+lp_wider_type(struct lp_type type);
+
+
void
lp_build_context_init(struct lp_build_context *bld,
LLVMBuilderRef builder,
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 60107214df5..c43b3da4508 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -115,6 +115,7 @@ struct setup_context {
/**
* Execute fragment shader for the four fragments in the quad.
*/
+ALIGN_STACK
static void
shade_quads(struct llvmpipe_context *llvmpipe,
struct quad_header *quads[],
@@ -277,11 +278,13 @@ clip_emit_quad( struct setup_context *setup, struct quad_header *quad )
* until we codegenerate single-quad variants of the fragment pipeline
* we need this hack. */
const unsigned nr_quads = TILE_VECTOR_HEIGHT*TILE_VECTOR_WIDTH/QUAD_SIZE;
- struct quad_header quads[nr_quads];
- struct quad_header *quad_ptrs[nr_quads];
+ struct quad_header quads[4];
+ struct quad_header *quad_ptrs[4];
int x0 = block_x(quad->input.x0);
unsigned i;
+ assert(nr_quads == 4);
+
for(i = 0; i < nr_quads; ++i) {
int x = x0 + 2*i;
if(x == quad->input.x0)
diff --git a/src/gallium/drivers/llvmpipe/lp_test.h b/src/gallium/drivers/llvmpipe/lp_test.h
index a88e110c663..39d80726e65 100644
--- a/src/gallium/drivers/llvmpipe/lp_test.h
+++ b/src/gallium/drivers/llvmpipe/lp_test.h
@@ -56,6 +56,9 @@
#include "lp_bld_type.h"
+#define LP_TEST_NUM_SAMPLES 32
+
+
void
write_tsv_header(FILE *fp);
@@ -68,17 +71,28 @@ boolean
test_all(unsigned verbose, FILE *fp);
+#if defined(PIPE_CC_MSVC)
+
+unsigned __int64 __rdtsc();
+#pragma intrinsic(__rdtsc)
+#define rdtsc() __rdtsc()
+
+#elif defined(PIPE_CC_GCC) && (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64))
+
static INLINE uint64_t
rdtsc(void)
{
-#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
uint32_t hi, lo;
__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
return ((uint64_t)lo) | (((uint64_t)hi) << 32);
+}
+
#else
- return 0;
+
+#define rdtsc() 0
+
#endif
-}
+
float
diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c
index 94b661dcba4..e3af81cffb0 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_blend.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c
@@ -477,8 +477,8 @@ test_one(unsigned verbose,
char *error = NULL;
blend_test_ptr_t blend_test_ptr;
boolean success;
- const unsigned n = 32;
- int64_t cycles[n];
+ const unsigned n = LP_TEST_NUM_SAMPLES;
+ int64_t cycles[LP_TEST_NUM_SAMPLES];
double cycles_avg = 0.0;
unsigned i, j;
diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c
index 9dcf58e5dcd..ac2a6d05e32 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_conv.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c
@@ -156,8 +156,8 @@ test_one(unsigned verbose,
char *error = NULL;
conv_test_ptr_t conv_test_ptr;
boolean success;
- const unsigned n = 32;
- int64_t cycles[n];
+ const unsigned n = LP_TEST_NUM_SAMPLES;
+ int64_t cycles[LP_TEST_NUM_SAMPLES];
double cycles_avg = 0.0;
unsigned num_srcs;
unsigned num_dsts;
diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c
index ab80c0143f9..5dc8297fe90 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_format.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_format.c
@@ -35,6 +35,7 @@
#include <llvm-c/Target.h>
#include <llvm-c/Transforms/Scalar.h>
+#include "util/u_cpu_detect.h"
#include "util/u_format.h"
#include "lp_bld_format.h"
@@ -263,6 +264,8 @@ int main(int argc, char **argv)
LLVMInitializeNativeTarget();
#endif
+ util_cpu_detect();
+
for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i)
if(!test_format(&test_cases[i]))
ret = 1;
diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c
index f07fa256f16..d4767ff52ba 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_main.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_main.c
@@ -34,6 +34,8 @@
*/
+#include "util/u_cpu_detect.h"
+
#include "lp_bld_const.h"
#include "lp_test.h"
@@ -370,6 +372,8 @@ int main(int argc, char **argv)
LLVMInitializeNativeTarget();
#endif
+ util_cpu_detect();
+
if(fp) {
/* Warm up the caches */
test_some(0, NULL, 100);
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 08f0950d475..a00f2495dfc 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -66,16 +66,24 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
pf_get_block(lpt->base.format, &lpt->base.block);
for (level = 0; level <= pt->last_level; level++) {
+ unsigned nblocksx, nblocksy;
+
pt->width[level] = width;
pt->height[level] = height;
pt->depth[level] = depth;
pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height);
- lpt->stride[level] = align(pt->nblocksx[level]*pt->block.size, 16);
+ pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height);
+
+ /* Allocate storage for whole quads. This is particularly important
+ * for depth surfaces, which are currently stored in a swizzled format. */
+ nblocksx = pf_get_nblocksx(&pt->block, align(width, 2));
+ nblocksy = pf_get_nblocksy(&pt->block, align(height, 2));
+
+ lpt->stride[level] = align(nblocksx*pt->block.size, 16);
lpt->level_offset[level] = buffer_size;
- buffer_size += (pt->nblocksy[level] *
+ buffer_size += (nblocksy *
((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) *
lpt->stride[level]);
diff --git a/src/gallium/drivers/nouveau/Makefile b/src/gallium/drivers/nouveau/Makefile
index dbe8a6e7bf5..0cb66041d50 100644
--- a/src/gallium/drivers/nouveau/Makefile
+++ b/src/gallium/drivers/nouveau/Makefile
@@ -3,6 +3,7 @@ include $(TOP)/configs/current
LIBNAME = nouveau
-C_SOURCES = nouveau_screen.c
+C_SOURCES = nouveau_screen.c \
+ nouveau_context.c
include ../../Makefile.template
diff --git a/src/gallium/drivers/nouveau/nouveau_context.c b/src/gallium/drivers/nouveau/nouveau_context.c
new file mode 100644
index 00000000000..23443869e68
--- /dev/null
+++ b/src/gallium/drivers/nouveau/nouveau_context.c
@@ -0,0 +1,41 @@
+#include <pipe/p_defines.h>
+#include <pipe/p_context.h>
+
+#include "nouveau/nouveau_screen.h"
+#include "nouveau/nouveau_context.h"
+
+#include "nouveau/nouveau_bo.h"
+
+static unsigned int
+nouveau_reference_flags(struct nouveau_bo *bo)
+{
+ uint32_t bo_flags;
+ int flags = 0;
+
+ bo_flags = nouveau_bo_pending(bo);
+ if (bo_flags & NOUVEAU_BO_RD)
+ flags |= PIPE_REFERENCED_FOR_READ;
+ if (bo_flags & NOUVEAU_BO_WR)
+ flags |= PIPE_REFERENCED_FOR_WRITE;
+
+ return flags;
+}
+
+unsigned int
+nouveau_is_texture_referenced(struct pipe_context *pipe,
+ struct pipe_texture *pt,
+ unsigned face, unsigned level)
+{
+ struct nouveau_miptree *mt = nouveau_miptree(pt);
+
+ return nouveau_reference_flags(mt->bo);
+}
+
+unsigned int
+nouveau_is_buffer_referenced(struct pipe_context *pipe, struct pipe_buffer *pb)
+{
+ struct nouveau_bo *bo = nouveau_bo(pb);
+
+ return nouveau_reference_flags(bo);
+}
+
diff --git a/src/gallium/drivers/nouveau/nouveau_context.h b/src/gallium/drivers/nouveau/nouveau_context.h
new file mode 100644
index 00000000000..6a28d40da7b
--- /dev/null
+++ b/src/gallium/drivers/nouveau/nouveau_context.h
@@ -0,0 +1,11 @@
+#ifndef __NOUVEAU_CONTEXT_H__
+#define __NOUVEAU_CONTEXT_H__
+
+unsigned int
+nouveau_is_texture_referenced(struct pipe_context *, struct pipe_texture *,
+ unsigned face, unsigned level);
+
+unsigned int
+nouveau_is_buffer_referenced(struct pipe_context *, struct pipe_buffer *);
+
+#endif
diff --git a/src/gallium/drivers/nv04/nv04_context.c b/src/gallium/drivers/nv04/nv04_context.c
index 17166c9f51d..10d984ace9b 100644
--- a/src/gallium/drivers/nv04/nv04_context.c
+++ b/src/gallium/drivers/nv04/nv04_context.c
@@ -64,30 +64,6 @@ nv04_init_hwctx(struct nv04_context *nv04)
return TRUE;
}
-static unsigned int
-nv04_is_texture_referenced( struct pipe_context *pipe,
- struct pipe_texture *texture,
- unsigned face, unsigned level)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
-static unsigned int
-nv04_is_buffer_referenced( struct pipe_context *pipe,
- struct pipe_buffer *buf)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
-
struct pipe_context *
nv04_create(struct pipe_screen *pscreen, unsigned pctx_id)
{
@@ -113,8 +89,8 @@ nv04_create(struct pipe_screen *pscreen, unsigned pctx_id)
nv04->pipe.clear = nv04_clear;
nv04->pipe.flush = nv04_flush;
- nv04->pipe.is_texture_referenced = nv04_is_texture_referenced;
- nv04->pipe.is_buffer_referenced = nv04_is_buffer_referenced;
+ nv04->pipe.is_texture_referenced = nouveau_is_texture_referenced;
+ nv04->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
nv04_init_surface_functions(nv04);
nv04_init_state_functions(nv04);
diff --git a/src/gallium/drivers/nv04/nv04_context.h b/src/gallium/drivers/nv04/nv04_context.h
index 2842b2c90db..55326c787a8 100644
--- a/src/gallium/drivers/nv04/nv04_context.h
+++ b/src/gallium/drivers/nv04/nv04_context.h
@@ -13,6 +13,7 @@
#include "nouveau/nouveau_winsys.h"
#include "nouveau/nouveau_gldefs.h"
+#include "nouveau/nouveau_context.h"
#define NOUVEAU_PUSH_CONTEXT(ctx) \
struct nv04_screen *ctx = nv04->screen
diff --git a/src/gallium/drivers/nv10/nv10_context.c b/src/gallium/drivers/nv10/nv10_context.c
index a127b134ecd..933176fc32a 100644
--- a/src/gallium/drivers/nv10/nv10_context.c
+++ b/src/gallium/drivers/nv10/nv10_context.c
@@ -257,29 +257,6 @@ nv10_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield)
{
}
-static unsigned int
-nv10_is_texture_referenced( struct pipe_context *pipe,
- struct pipe_texture *texture,
- unsigned face, unsigned level)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
-static unsigned int
-nv10_is_buffer_referenced( struct pipe_context *pipe,
- struct pipe_buffer *buf)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
struct pipe_context *
nv10_create(struct pipe_screen *pscreen, unsigned pctx_id)
{
@@ -305,8 +282,8 @@ nv10_create(struct pipe_screen *pscreen, unsigned pctx_id)
nv10->pipe.clear = nv10_clear;
nv10->pipe.flush = nv10_flush;
- nv10->pipe.is_texture_referenced = nv10_is_texture_referenced;
- nv10->pipe.is_buffer_referenced = nv10_is_buffer_referenced;
+ nv10->pipe.is_texture_referenced = nouveau_is_texture_referenced;
+ nv10->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
nv10_init_surface_functions(nv10);
nv10_init_state_functions(nv10);
diff --git a/src/gallium/drivers/nv10/nv10_context.h b/src/gallium/drivers/nv10/nv10_context.h
index f1e003c9537..36a6aa7a74e 100644
--- a/src/gallium/drivers/nv10/nv10_context.h
+++ b/src/gallium/drivers/nv10/nv10_context.h
@@ -13,6 +13,7 @@
#include "nouveau/nouveau_winsys.h"
#include "nouveau/nouveau_gldefs.h"
+#include "nouveau/nouveau_context.h"
#define NOUVEAU_PUSH_CONTEXT(ctx) \
struct nv10_screen *ctx = nv10->screen
diff --git a/src/gallium/drivers/nv20/nv20_context.c b/src/gallium/drivers/nv20/nv20_context.c
index b32d0d83ba0..9a48739661b 100644
--- a/src/gallium/drivers/nv20/nv20_context.c
+++ b/src/gallium/drivers/nv20/nv20_context.c
@@ -380,30 +380,6 @@ nv20_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield)
{
}
-
-static unsigned int
-nv20_is_texture_referenced( struct pipe_context *pipe,
- struct pipe_texture *texture,
- unsigned face, unsigned level)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
-static unsigned int
-nv20_is_buffer_referenced( struct pipe_context *pipe,
- struct pipe_buffer *buf)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
struct pipe_context *
nv20_create(struct pipe_screen *pscreen, unsigned pctx_id)
{
@@ -429,8 +405,8 @@ nv20_create(struct pipe_screen *pscreen, unsigned pctx_id)
nv20->pipe.clear = nv20_clear;
nv20->pipe.flush = nv20_flush;
- nv20->pipe.is_texture_referenced = nv20_is_texture_referenced;
- nv20->pipe.is_buffer_referenced = nv20_is_buffer_referenced;
+ nv20->pipe.is_texture_referenced = nouveau_is_texture_referenced;
+ nv20->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
nv20_init_surface_functions(nv20);
nv20_init_state_functions(nv20);
diff --git a/src/gallium/drivers/nv20/nv20_context.h b/src/gallium/drivers/nv20/nv20_context.h
index fc932f1f90e..a4eaa956608 100644
--- a/src/gallium/drivers/nv20/nv20_context.h
+++ b/src/gallium/drivers/nv20/nv20_context.h
@@ -13,6 +13,7 @@
#include "nouveau/nouveau_winsys.h"
#include "nouveau/nouveau_gldefs.h"
+#include "nouveau/nouveau_context.h"
#define NOUVEAU_PUSH_CONTEXT(ctx) \
struct nv20_screen *ctx = nv20->screen
diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c
index f827bdc78b1..d8300fd69f6 100644
--- a/src/gallium/drivers/nv30/nv30_context.c
+++ b/src/gallium/drivers/nv30/nv30_context.c
@@ -10,7 +10,7 @@ nv30_flush(struct pipe_context *pipe, unsigned flags,
struct pipe_fence_handle **fence)
{
struct nv30_context *nv30 = nv30_context(pipe);
-
+
if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
BEGIN_RING(rankine, 0x1fd8, 1);
OUT_RING (2);
@@ -31,29 +31,6 @@ nv30_destroy(struct pipe_context *pipe)
FREE(nv30);
}
-static unsigned int
-nv30_is_texture_referenced( struct pipe_context *pipe,
- struct pipe_texture *texture,
- unsigned face, unsigned level)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
-static unsigned int
-nv30_is_buffer_referenced( struct pipe_context *pipe,
- struct pipe_buffer *buf)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
struct pipe_context *
nv30_create(struct pipe_screen *pscreen, unsigned pctx_id)
{
@@ -78,8 +55,8 @@ nv30_create(struct pipe_screen *pscreen, unsigned pctx_id)
nv30->pipe.clear = nv30_clear;
nv30->pipe.flush = nv30_flush;
- nv30->pipe.is_texture_referenced = nv30_is_texture_referenced;
- nv30->pipe.is_buffer_referenced = nv30_is_buffer_referenced;
+ nv30->pipe.is_texture_referenced = nouveau_is_texture_referenced;
+ nv30->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
nv30_init_query_functions(nv30);
nv30_init_surface_functions(nv30);
@@ -95,4 +72,3 @@ nv30_create(struct pipe_screen *pscreen, unsigned pctx_id)
return &nv30->pipe;
}
-
diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h
index 4229c0a0e14..8d49366dfcb 100644
--- a/src/gallium/drivers/nv30/nv30_context.h
+++ b/src/gallium/drivers/nv30/nv30_context.h
@@ -13,6 +13,7 @@
#include "nouveau/nouveau_winsys.h"
#include "nouveau/nouveau_gldefs.h"
+#include "nouveau/nouveau_context.h"
#define NOUVEAU_PUSH_CONTEXT(ctx) \
struct nv30_screen *ctx = nv30->screen
diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nv30/nv30_fragtex.c
index 822e1d8defe..f5f17d40714 100644
--- a/src/gallium/drivers/nv30/nv30_fragtex.c
+++ b/src/gallium/drivers/nv30/nv30_fragtex.c
@@ -30,7 +30,7 @@ nv30_texture_formats[] = {
_(I8_UNORM , L8 , S1, S1, S1, S1, X, X, X, X),
_(A8L8_UNORM , A8L8 , S1, S1, S1, S1, X, X, X, Y),
// _(Z16_UNORM , Z16 , S1, S1, S1, ONE, X, X, X, X),
-// _(Z24S8_UNORM , Z24 , S1, S1, S1, ONE, X, X, X, X),
+ _(Z24S8_UNORM , A8R8G8B8, S1, S1, S1, ONE, X, X, X, X),
_(DXT1_RGB , DXT1 , S1, S1, S1, ONE, X, Y, Z, W),
_(DXT1_RGBA , DXT1 , S1, S1, S1, S1, X, Y, Z, W),
_(DXT3_RGBA , DXT3 , S1, S1, S1, S1, X, Y, Z, W),
@@ -69,13 +69,13 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit)
tf = nv30_fragtex_format(pt->format);
if (!tf)
- assert(0);
+ return NULL;
txf = tf->format;
txf |= ((pt->last_level>0) ? NV34TCL_TX_FORMAT_MIPMAP : 0);
- txf |= log2i(pt->width[0]) << 20;
- txf |= log2i(pt->height[0]) << 24;
- txf |= log2i(pt->depth[0]) << 28;
+ txf |= log2i(pt->width[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT;
+ txf |= log2i(pt->height[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT;
+ txf |= log2i(pt->depth[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT;
txf |= NV34TCL_TX_FORMAT_NO_BORDER | 0x10000;
switch (pt->target) {
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index 41af38450b5..bb40e1803d1 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -10,6 +10,22 @@
#define NV34TCL_CHIPSET_3X_MASK 0x00000010
#define NV35TCL_CHIPSET_3X_MASK 0x000001e0
+/* FIXME: It seems I should not include directly ../../winsys/drm/nouveau/drm/nouveau_drm_api.h
+ * to get the pointer to the context front buffer, so I copied nouveau_winsys here.
+ * nv30_screen_surface_format_supported() can then use it to enforce creating fbo
+ * with same number of bits everywhere.
+ */
+struct nouveau_winsys {
+ struct pipe_winsys base;
+
+ struct pipe_screen *pscreen;
+
+ unsigned nr_pctx;
+ struct pipe_context **pctx;
+
+ struct pipe_surface *front;
+};
+
static int
nv30_screen_get_param(struct pipe_screen *pscreen, int param)
{
@@ -83,21 +99,18 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen,
enum pipe_texture_target target,
unsigned tex_usage, unsigned geom_flags)
{
+ struct pipe_surface *front = ((struct nouveau_winsys *) pscreen->winsys)->front;
+
if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
- switch (format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- case PIPE_FORMAT_R5G6B5_UNORM:
- return TRUE;
- default:
- break;
- }
+ return (format == front->format);
} else
if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) {
switch (format) {
case PIPE_FORMAT_Z24S8_UNORM:
case PIPE_FORMAT_Z24X8_UNORM:
+ return (front->format == PIPE_FORMAT_A8R8G8B8_UNORM);
case PIPE_FORMAT_Z16_UNORM:
- return TRUE;
+ return (front->format == PIPE_FORMAT_R5G6B5_UNORM);
default:
break;
}
diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c
index 2729dcec7cc..f90681b0f97 100644
--- a/src/gallium/drivers/nv30/nv30_state_fb.c
+++ b/src/gallium/drivers/nv30/nv30_state_fb.c
@@ -8,15 +8,15 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
struct nouveau_channel *chan = nv30->screen->base.channel;
struct nouveau_grobj *rankine = nv30->screen->rankine;
struct nv04_surface *rt[2], *zeta = NULL;
- uint32_t rt_enable, rt_format;
- int i, colour_format = 0, zeta_format = 0;
+ uint32_t rt_enable = 0, rt_format = 0;
+ int i, colour_format = 0, zeta_format = 0, depth_only = 0;
struct nouveau_stateobj *so = so_new(64, 10);
unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
unsigned w = fb->width;
unsigned h = fb->height;
struct nv30_miptree *nv30mt;
+ int colour_bits = 32, zeta_bits = 32;
- rt_enable = 0;
for (i = 0; i < fb->nr_cbufs; i++) {
if (colour_format) {
assert(colour_format == fb->cbufs[i]->format);
@@ -35,17 +35,35 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
zeta = (struct nv04_surface *)fb->zsbuf;
}
- if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
- assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
- for (i = 1; i < fb->nr_cbufs; i++)
- assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
+ if (rt_enable & (NV34TCL_RT_ENABLE_COLOR0|NV34TCL_RT_ENABLE_COLOR1)) {
+ /* Render to at least a colour buffer */
+ if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
+ assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
+ for (i = 1; i < fb->nr_cbufs; i++)
+ assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
- rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
- (log2i(rt[0]->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) |
- (log2i(rt[0]->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT);
+ rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
+ (log2i(rt[0]->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) |
+ (log2i(rt[0]->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT);
+ }
+ else
+ rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR;
+ } else if (fb->zsbuf) {
+ depth_only = 1;
+
+ /* Render to depth buffer only */
+ if (!(zeta->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
+ assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
+
+ rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
+ (log2i(zeta->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) |
+ (log2i(zeta->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT);
+ }
+ else
+ rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR;
+ } else {
+ return FALSE;
}
- else
- rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR;
switch (colour_format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
@@ -54,6 +72,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
break;
case PIPE_FORMAT_R5G6B5_UNORM:
rt_format |= NV34TCL_RT_FORMAT_COLOR_R5G6B5;
+ colour_bits = 16;
break;
default:
assert(0);
@@ -62,6 +81,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
switch (zeta_format) {
case PIPE_FORMAT_Z16_UNORM:
rt_format |= NV34TCL_RT_FORMAT_ZETA_Z16;
+ zeta_bits = 16;
break;
case PIPE_FORMAT_Z24S8_UNORM:
case PIPE_FORMAT_Z24X8_UNORM:
@@ -72,21 +92,27 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
assert(0);
}
- if (rt_enable & NV34TCL_RT_ENABLE_COLOR0) {
- uint32_t pitch = rt[0]->pitch;
+ if (colour_bits != zeta_bits) {
+ return FALSE;
+ }
+
+ if (depth_only || (rt_enable & NV34TCL_RT_ENABLE_COLOR0)) {
+ struct nv04_surface *rt0 = (depth_only ? zeta : rt[0]);
+ uint32_t pitch = rt0->pitch;
+
if (zeta) {
pitch |= (zeta->pitch << 16);
} else {
pitch |= (pitch << 16);
}
- nv30mt = (struct nv30_miptree *)rt[0]->base.texture;
+ nv30mt = (struct nv30_miptree *) rt0->base.texture;
so_method(so, rankine, NV34TCL_DMA_COLOR0, 1);
so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR,
chan->vram->handle, chan->gart->handle);
so_method(so, rankine, NV34TCL_COLOR0_PITCH, 2);
so_data (so, pitch);
- so_reloc (so, nouveau_bo(nv30mt->buffer), rt[0]->base.offset,
+ so_reloc (so, nouveau_bo(nv30mt->buffer), rt0->base.offset,
rt_flags | NOUVEAU_BO_LOW, 0, 0);
}
diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c
index 8eba6a43ef9..7f008274a4e 100644
--- a/src/gallium/drivers/nv40/nv40_context.c
+++ b/src/gallium/drivers/nv40/nv40_context.c
@@ -10,7 +10,7 @@ nv40_flush(struct pipe_context *pipe, unsigned flags,
struct pipe_fence_handle **fence)
{
struct nv40_context *nv40 = nv40_context(pipe);
-
+
if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
BEGIN_RING(curie, 0x1fd8, 1);
OUT_RING (2);
@@ -31,29 +31,6 @@ nv40_destroy(struct pipe_context *pipe)
FREE(nv40);
}
-static unsigned int
-nv40_is_texture_referenced( struct pipe_context *pipe,
- struct pipe_texture *texture,
- unsigned face, unsigned level)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
-static unsigned int
-nv40_is_buffer_referenced( struct pipe_context *pipe,
- struct pipe_buffer *buf)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
struct pipe_context *
nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
{
@@ -78,8 +55,8 @@ nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
nv40->pipe.clear = nv40_clear;
nv40->pipe.flush = nv40_flush;
- nv40->pipe.is_texture_referenced = nv40_is_texture_referenced;
- nv40->pipe.is_buffer_referenced = nv40_is_buffer_referenced;
+ nv40->pipe.is_texture_referenced = nouveau_is_texture_referenced;
+ nv40->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
nv40_init_query_functions(nv40);
nv40_init_surface_functions(nv40);
@@ -95,4 +72,3 @@ nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
return &nv40->pipe;
}
-
diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h
index 97bc83292d4..a3d594167aa 100644
--- a/src/gallium/drivers/nv40/nv40_context.h
+++ b/src/gallium/drivers/nv40/nv40_context.h
@@ -13,6 +13,7 @@
#include "nouveau/nouveau_winsys.h"
#include "nouveau/nouveau_gldefs.h"
+#include "nouveau/nouveau_context.h"
#define NOUVEAU_PUSH_CONTEXT(ctx) \
struct nv40_screen *ctx = nv40->screen
diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c
index fca078b174a..219e7a78623 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -33,13 +33,6 @@ nv50_flush(struct pipe_context *pipe, unsigned flags,
{
struct nv50_context *nv50 = nv50_context(pipe);
struct nouveau_channel *chan = nv50->screen->base.channel;
- struct nouveau_grobj *eng2d = nv50->screen->eng2d;
-
- /* We need this in the ddx for reliable composite, not sure what we're
- * actually flushing. We generate all our own flushes with flags = 0. */
- WAIT_RING(chan, 2);
- BEGIN_RING(chan, eng2d, 0x0110, 1);
- OUT_RING (chan, 0);
if (flags & PIPE_FLUSH_FRAME)
FIRE_RING(chan);
@@ -60,29 +53,6 @@ nv50_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield)
{
}
-static unsigned int
-nv50_is_texture_referenced( struct pipe_context *pipe,
- struct pipe_texture *texture,
- unsigned face, unsigned level)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
-static unsigned int
-nv50_is_buffer_referenced( struct pipe_context *pipe,
- struct pipe_buffer *buf)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
struct pipe_context *
nv50_create(struct pipe_screen *pscreen, unsigned pctx_id)
{
@@ -108,8 +78,8 @@ nv50_create(struct pipe_screen *pscreen, unsigned pctx_id)
nv50->pipe.flush = nv50_flush;
- nv50->pipe.is_texture_referenced = nv50_is_texture_referenced;
- nv50->pipe.is_buffer_referenced = nv50_is_buffer_referenced;
+ nv50->pipe.is_texture_referenced = nouveau_is_texture_referenced;
+ nv50->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
screen->base.channel->user_private = nv50;
screen->base.channel->flush_notify = nv50_state_flush_notify;
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index 4608854d711..33667e8765c 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -14,6 +14,7 @@
#include "nouveau/nouveau_winsys.h"
#include "nouveau/nouveau_gldefs.h"
#include "nouveau/nouveau_stateobj.h"
+#include "nouveau/nouveau_context.h"
#include "nv50_screen.h"
#include "nv50_program.h"
@@ -120,6 +121,7 @@ struct nv50_state {
struct nouveau_stateobj *vtxfmt;
struct nouveau_stateobj *vtxbuf;
struct nouveau_stateobj *vtxattr;
+ unsigned vtxelt_nr;
};
struct nv50_context {
@@ -152,6 +154,8 @@ struct nv50_context {
unsigned sampler_nr;
struct nv50_miptree *miptree[PIPE_MAX_SAMPLERS];
unsigned miptree_nr;
+
+ uint16_t vbo_fifo;
};
static INLINE struct nv50_context *
@@ -198,6 +202,11 @@ extern void nv50_program_destroy(struct nv50_context *nv50, struct nv50_program
extern boolean nv50_state_validate(struct nv50_context *nv50);
extern void nv50_state_flush_notify(struct nouveau_channel *chan);
+extern void nv50_so_init_sifc(struct nv50_context *nv50,
+ struct nouveau_stateobj *so,
+ struct nouveau_bo *bo, unsigned reloc,
+ unsigned size);
+
/* nv50_tex.c */
extern void nv50_tex_validate(struct nv50_context *);
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 576d075318f..c7145bb9beb 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -32,6 +32,7 @@
#include "nv50_context.h"
#define NV50_SU_MAX_TEMP 64
+#define NV50_SU_MAX_ADDR 7
//#define NV50_PROGRAM_DUMP
/* ARL - gallium craps itself on progs/vp/arl.txt
@@ -79,7 +80,8 @@ struct nv50_reg {
P_ATTR,
P_RESULT,
P_CONST,
- P_IMMD
+ P_IMMD,
+ P_ADDR
} type;
int index;
@@ -99,6 +101,7 @@ struct nv50_pc {
/* hw resources */
struct nv50_reg *r_temp[NV50_SU_MAX_TEMP];
+ struct nv50_reg r_addr[NV50_SU_MAX_ADDR];
/* tgsi resources */
struct nv50_reg *temp;
@@ -112,6 +115,8 @@ struct nv50_pc {
struct nv50_reg *immd;
float *immd_buf;
int immd_nr;
+ struct nv50_reg **addr;
+ int addr_nr;
struct nv50_reg *temp_temp[16];
unsigned temp_temp_nr;
@@ -159,6 +164,17 @@ popcnt4(uint32_t val)
}
static void
+terminate_mbb(struct nv50_pc *pc)
+{
+ int i;
+
+ /* remove records of temporary address register values */
+ for (i = 0; i < NV50_SU_MAX_ADDR; ++i)
+ if (pc->r_addr[i].index < 0)
+ pc->r_addr[i].rhw = -1;
+}
+
+static void
alloc_reg(struct nv50_pc *pc, struct nv50_reg *reg)
{
int i = 0;
@@ -454,9 +470,68 @@ set_immd(struct nv50_pc *pc, struct nv50_reg *imm, struct nv50_program_exec *e)
e->inst[1] |= (val >> 6) << 2;
}
+static void
+emit_set_addr(struct nv50_pc *pc, struct nv50_reg *dst, unsigned val)
+{
+ struct nv50_program_exec *e = exec(pc);
+
+ assert(val <= 0xffff);
+ e->inst[0] = 0xd0000000 | ((val & 0xffff) << 9);
+ e->inst[1] = 0x20000000;
+ e->inst[0] |= dst->hw << 2;
+ set_long(pc, e);
+
+ emit(pc, e);
+}
+
+static struct nv50_reg *
+alloc_addr(struct nv50_pc *pc, struct nv50_reg *ref)
+{
+ int i;
+ struct nv50_reg *a = NULL;
+
+ if (!ref) {
+ for (i = 0; i < NV50_SU_MAX_ADDR; ++i) {
+ if (pc->r_addr[i].index >= 0)
+ continue;
+ if (pc->r_addr[i].rhw >= 0 &&
+ pc->r_addr[i].acc == pc->insn_cur)
+ continue;
+
+ pc->r_addr[i].rhw = -1;
+ pc->r_addr[i].index = i;
+ return &pc->r_addr[i];
+ }
+ assert(0);
+ return NULL;
+ }
+
+ for (i = NV50_SU_MAX_ADDR - 1; i >= 0; --i) {
+ if (pc->r_addr[i].index >= 0) /* occupied for TGSI */
+ continue;
+ if (pc->r_addr[i].rhw < 0) { /* unused */
+ a = &pc->r_addr[i];
+ continue;
+ }
+ if (!a && pc->r_addr[i].acc != pc->insn_cur)
+ a = &pc->r_addr[i];
+
+ if (ref->hw - pc->r_addr[i].rhw < 128) {
+ /* alloc'd & suitable */
+ pc->r_addr[i].acc = pc->insn_cur;
+ return &pc->r_addr[i];
+ }
+ }
+ assert(a);
+ emit_set_addr(pc, a, ref->hw * 4);
+
+ a->rhw = ref->hw % 128;
+ a->acc = pc->insn_cur;
+ return a;
+}
#define INTERP_LINEAR 0
-#define INTERP_FLAT 1
+#define INTERP_FLAT 1
#define INTERP_PERSPECTIVE 2
#define INTERP_CENTROID 4
@@ -488,6 +563,16 @@ emit_interp(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *iv,
emit(pc, e);
}
+static INLINE void
+set_addr(struct nv50_program_exec *e, struct nv50_reg *a)
+{
+ assert(!(e->inst[0] & 0x0c000000));
+ assert(!(e->inst[1] & 0x00000004));
+
+ e->inst[0] |= (a->hw & 3) << 26;
+ e->inst[1] |= (a->hw >> 2) << 2;
+}
+
static void
set_data(struct nv50_pc *pc, struct nv50_reg *src, unsigned m, unsigned s,
struct nv50_program_exec *e)
@@ -498,6 +583,14 @@ set_data(struct nv50_pc *pc, struct nv50_reg *src, unsigned m, unsigned s,
e->param.shift = s;
e->param.mask = m << (s % 32);
+ if (src->hw > 127)
+ set_addr(e, alloc_addr(pc, src));
+ else
+ if (src->acc < 0) {
+ assert(src->type == P_CONST);
+ set_addr(e, pc->addr[src->index]);
+ }
+
e->inst[1] |= (((src->type == P_IMMD) ? 0 : 1) << 22);
}
@@ -506,11 +599,13 @@ emit_mov(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
{
struct nv50_program_exec *e = exec(pc);
- e->inst[0] |= 0x10000000;
+ e->inst[0] = 0x10000000;
+ if (!pc->allow32)
+ set_long(pc, e);
set_dst(pc, dst, e);
- if (pc->allow32 && dst->type != P_RESULT && src->type == P_IMMD) {
+ if (!is_long(e) && src->type == P_IMMD) {
set_immd(pc, src, e);
/*XXX: 32-bit, but steals part of "half" reg space - need to
* catch and handle this case if/when we do half-regs
@@ -630,7 +725,7 @@ set_src_1(struct nv50_pc *pc, struct nv50_reg *src, struct nv50_program_exec *e)
}
alloc_reg(pc, src);
- e->inst[0] |= (src->hw << 16);
+ e->inst[0] |= ((src->hw & 127) << 16);
}
static void
@@ -658,7 +753,7 @@ set_src_2(struct nv50_pc *pc, struct nv50_reg *src, struct nv50_program_exec *e)
}
alloc_reg(pc, src);
- e->inst[1] |= (src->hw << 14);
+ e->inst[1] |= ((src->hw & 127) << 14);
}
static void
@@ -721,6 +816,22 @@ emit_add(struct nv50_pc *pc, struct nv50_reg *dst,
}
static void
+emit_arl(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src,
+ uint8_t s)
+{
+ struct nv50_program_exec *e = exec(pc);
+
+ set_long(pc, e);
+ e->inst[1] |= 0xc0000000;
+
+ e->inst[0] |= dst->hw << 2;
+ e->inst[0] |= s << 16; /* shift left */
+ set_src_0_restricted(pc, src, e);
+
+ emit(pc, e);
+}
+
+static void
emit_minmax(struct nv50_pc *pc, unsigned sub, struct nv50_reg *dst,
struct nv50_reg *src0, struct nv50_reg *src1)
{
@@ -837,7 +948,7 @@ emit_precossin(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
#define CVTOP_SAT 0x08
#define CVTOP_ABS 0x10
-/* 0x04 == 32 bit */
+/* 0x04 == 32 bit dst */
/* 0x40 == dst is float */
/* 0x80 == src is float */
#define CVT_F32_F32 0xc4
@@ -858,7 +969,7 @@ emit_cvt(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src,
set_long(pc, e);
e->inst[0] |= 0xa0000000;
- e->inst[1] |= 0x00004000;
+ e->inst[1] |= 0x00004000; /* 32 bit src */
e->inst[1] |= (cvn << 16);
e->inst[1] |= (fmt << 24);
set_src_0(pc, src, e);
@@ -1037,20 +1148,10 @@ emit_lit(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask,
FREE(one);
}
-static void
+static INLINE void
emit_neg(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
{
- struct nv50_program_exec *e = exec(pc);
-
- set_long(pc, e);
- e->inst[0] |= 0xa0000000; /* delta */
- e->inst[1] |= (7 << 29); /* delta */
- e->inst[1] |= 0x04000000; /* negate arg0? probably not */
- e->inst[1] |= (1 << 14); /* src .f32 */
- set_dst(pc, dst, e);
- set_src_0(pc, src, e);
-
- emit(pc, e);
+ emit_cvt(pc, dst, src, -1, CVTOP_RN, CVT_F32_F32 | CVT_NEG);
}
static void
@@ -1058,22 +1159,18 @@ emit_kil(struct nv50_pc *pc, struct nv50_reg *src)
{
struct nv50_program_exec *e;
const int r_pred = 1;
+ unsigned cvn = CVT_F32_F32;
- /* Sets predicate reg ? */
- e = exec(pc);
- e->inst[0] = 0xa00001fd;
- e->inst[1] = 0xc4014788;
- set_src_0(pc, src, e);
- set_pred_wr(pc, 1, r_pred, e);
if (src->neg)
- e->inst[1] |= 0x20000000;
- emit(pc, e);
+ cvn |= CVT_NEG;
+ /* write predicate reg */
+ emit_cvt(pc, NULL, src, r_pred, CVTOP_RN, cvn);
- /* This is probably KILP */
+ /* conditional discard */
e = exec(pc);
- e->inst[0] = 0x000001fe;
+ e->inst[0] = 0x00000002;
set_long(pc, e);
- set_pred(pc, 1 /* LT? */, r_pred, e);
+ set_pred(pc, 0x1 /* LT */, r_pred, e);
emit(pc, e);
}
@@ -1219,6 +1316,43 @@ emit_nop(struct nv50_pc *pc)
}
static void
+emit_ddx(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
+{
+ struct nv50_program_exec *e = exec(pc);
+
+ assert(src->type == P_TEMP);
+
+ e->inst[0] = 0xc0140000;
+ e->inst[1] = 0x89800000;
+ set_long(pc, e);
+ set_dst(pc, dst, e);
+ set_src_0(pc, src, e);
+ set_src_2(pc, src, e);
+
+ emit(pc, e);
+}
+
+static void
+emit_ddy(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
+{
+ struct nv50_program_exec *e = exec(pc);
+
+ assert(src->type == P_TEMP);
+
+ if (!src->neg) /* ! double negation */
+ emit_neg(pc, src, src);
+
+ e->inst[0] = 0xc0150000;
+ e->inst[1] = 0x8a400000;
+ set_long(pc, e);
+ set_dst(pc, dst, e);
+ set_src_0(pc, src, e);
+ set_src_2(pc, src, e);
+
+ emit(pc, e);
+}
+
+static void
convert_to_long(struct nv50_pc *pc, struct nv50_program_exec *e)
{
unsigned q = 0, m = ~0;
@@ -1266,10 +1400,14 @@ convert_to_long(struct nv50_pc *pc, struct nv50_program_exec *e)
e->inst[1] |= q;
}
+/* Some operations support an optional negation flag. */
static boolean
negate_supported(const struct tgsi_full_instruction *insn, int i)
{
+ int s;
+
switch (insn->Instruction.Opcode) {
+ case TGSI_OPCODE_DDY:
case TGSI_OPCODE_DP3:
case TGSI_OPCODE_DP4:
case TGSI_OPCODE_MUL:
@@ -1277,12 +1415,29 @@ negate_supported(const struct tgsi_full_instruction *insn, int i)
case TGSI_OPCODE_ADD:
case TGSI_OPCODE_SUB:
case TGSI_OPCODE_MAD:
- return TRUE;
+ break;
case TGSI_OPCODE_POW:
- return (i == 1) ? TRUE : FALSE;
+ if (i == 1)
+ break;
+ return FALSE;
default:
return FALSE;
}
+
+ /* Watch out for possible multiple uses of an nv50_reg, we
+ * can't use nv50_reg::neg in these cases.
+ */
+ for (s = 0; s < insn->Instruction.NumSrcRegs; ++s) {
+ if (s == i)
+ continue;
+ if ((insn->FullSrcRegisters[s].SrcRegister.Index ==
+ insn->FullSrcRegisters[i].SrcRegister.Index) &&
+ (insn->FullSrcRegisters[s].SrcRegister.File ==
+ insn->FullSrcRegisters[i].SrcRegister.File))
+ return FALSE;
+ }
+
+ return TRUE;
}
/* Return a read mask for source registers deduced from opcode & write mask. */
@@ -1357,6 +1512,16 @@ tgsi_dst(struct nv50_pc *pc, int c, const struct tgsi_full_dst_register *dst)
return &pc->temp[dst->DstRegister.Index * 4 + c];
case TGSI_FILE_OUTPUT:
return &pc->result[dst->DstRegister.Index * 4 + c];
+ case TGSI_FILE_ADDRESS:
+ {
+ struct nv50_reg *r = pc->addr[dst->DstRegister.Index * 4 + c];
+ if (!r) {
+ r = alloc_addr(pc, NULL);
+ pc->addr[dst->DstRegister.Index * 4 + c] = r;
+ }
+ assert(r);
+ return r;
+ }
case TGSI_FILE_NULL:
return NULL;
default:
@@ -1372,7 +1537,10 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src,
{
struct nv50_reg *r = NULL;
struct nv50_reg *temp;
- unsigned sgn, c;
+ unsigned sgn, c, swz;
+
+ if (src->SrcRegister.File != TGSI_FILE_CONSTANT)
+ assert(!src->SrcRegister.Indirect);
sgn = tgsi_util_get_full_src_register_sign_mode(src, chan);
@@ -1390,13 +1558,29 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src,
r = &pc->temp[src->SrcRegister.Index * 4 + c];
break;
case TGSI_FILE_CONSTANT:
- r = &pc->param[src->SrcRegister.Index * 4 + c];
+ if (!src->SrcRegister.Indirect) {
+ r = &pc->param[src->SrcRegister.Index * 4 + c];
+ break;
+ }
+ /* Indicate indirection by setting r->acc < 0 and
+ * use the index field to select the address reg.
+ */
+ r = MALLOC_STRUCT(nv50_reg);
+ swz = tgsi_util_get_src_register_swizzle(
+ &src->SrcRegisterInd, 0);
+ ctor_reg(r, P_CONST,
+ src->SrcRegisterInd.Index * 4 + swz, c);
+ r->acc = -1;
break;
case TGSI_FILE_IMMEDIATE:
r = &pc->immd[src->SrcRegister.Index * 4 + c];
break;
case TGSI_FILE_SAMPLER:
break;
+ case TGSI_FILE_ADDRESS:
+ r = pc->addr[src->SrcRegister.Index * 4 + c];
+ assert(r);
+ break;
default:
assert(0);
break;
@@ -1632,8 +1816,15 @@ nv50_program_tx_insn(struct nv50_pc *pc,
emit_add(pc, dst[c], src[0][c], src[1][c]);
}
break;
+ case TGSI_OPCODE_ARL:
+ assert(src[0][0]);
+ temp = temp_temp(pc);
+ emit_cvt(pc, temp, src[0][0], -1, CVTOP_FLOOR, CVT_S32_F32);
+ emit_arl(pc, dst[0], temp, 4);
+ break;
case TGSI_OPCODE_BGNLOOP:
pc->loop_pos[pc->loop_lvl++] = pc->p->exec_size;
+ terminate_mbb(pc);
break;
case TGSI_OPCODE_BRK:
emit_branch(pc, -1, 0, NULL);
@@ -1648,6 +1839,18 @@ nv50_program_tx_insn(struct nv50_pc *pc,
CVTOP_CEIL, CVT_F32_F32 | CVT_RI);
}
break;
+ case TGSI_OPCODE_CMP:
+ pc->allow32 = FALSE;
+ for (c = 0; c < 4; c++) {
+ if (!(mask & (1 << c)))
+ continue;
+ emit_cvt(pc, NULL, src[0][c], 1, CVTOP_RN, CVT_F32_F32);
+ emit_mov(pc, dst[c], src[1][c]);
+ set_pred(pc, 0x1, 1, pc->p->exec_tail); /* @SF */
+ emit_mov(pc, dst[c], src[2][c]);
+ set_pred(pc, 0x6, 1, pc->p->exec_tail); /* @NSF */
+ }
+ break;
case TGSI_OPCODE_COS:
if (mask & 8) {
emit_precossin(pc, temp, src[0][3]);
@@ -1660,6 +1863,20 @@ nv50_program_tx_insn(struct nv50_pc *pc,
emit_precossin(pc, temp, src[0][0]);
emit_flop(pc, 5, brdc, temp);
break;
+ case TGSI_OPCODE_DDX:
+ for (c = 0; c < 4; c++) {
+ if (!(mask & (1 << c)))
+ continue;
+ emit_ddx(pc, dst[c], src[0][c]);
+ }
+ break;
+ case TGSI_OPCODE_DDY:
+ for (c = 0; c < 4; c++) {
+ if (!(mask & (1 << c)))
+ continue;
+ emit_ddy(pc, dst[c], src[0][c]);
+ }
+ break;
case TGSI_OPCODE_DP3:
emit_mul(pc, temp, src[0][0], src[1][0]);
emit_mad(pc, temp, src[0][1], src[1][1], temp);
@@ -1691,6 +1908,7 @@ nv50_program_tx_insn(struct nv50_pc *pc,
emit_branch(pc, -1, 0, NULL);
pc->if_insn[--pc->if_lvl]->param.index = pc->p->exec_size;
pc->if_insn[pc->if_lvl++] = pc->p->exec_tail;
+ terminate_mbb(pc);
break;
case TGSI_OPCODE_ENDIF:
pc->if_insn[--pc->if_lvl]->param.index = pc->p->exec_size;
@@ -1703,6 +1921,7 @@ nv50_program_tx_insn(struct nv50_pc *pc,
pc->br_join[pc->if_lvl]->param.index = pc->p->exec_size;
pc->br_join[pc->if_lvl] = NULL;
}
+ terminate_mbb(pc);
/* emit a NOP as join point, we could set it on the next
* one, but would have to make sure it is long and !immd
*/
@@ -1713,6 +1932,7 @@ nv50_program_tx_insn(struct nv50_pc *pc,
emit_branch(pc, -1, 0, NULL);
pc->p->exec_tail->param.index = pc->loop_pos[--pc->loop_lvl];
pc->br_loop[pc->loop_lvl]->param.index = pc->p->exec_size;
+ terminate_mbb(pc);
break;
case TGSI_OPCODE_EX2:
emit_preex2(pc, temp, src[0][0]);
@@ -1740,6 +1960,7 @@ nv50_program_tx_insn(struct nv50_pc *pc,
set_pred_wr(pc, 1, 0, pc->if_cond);
emit_branch(pc, 0, 2, &pc->br_join[pc->if_lvl]);
pc->if_insn[pc->if_lvl++] = pc->p->exec_tail;
+ terminate_mbb(pc);
break;
case TGSI_OPCODE_KIL:
emit_kil(pc, src[0][0]);
@@ -1914,8 +2135,12 @@ nv50_program_tx_insn(struct nv50_pc *pc,
for (c = 0; c < 4; c++) {
if (!src[i][c])
continue;
+ src[i][c]->neg = 0;
if (src[i][c]->index == -1 && src[i][c]->type == P_IMMD)
FREE(src[i][c]);
+ else
+ if (src[i][c]->acc < 0 && src[i][c]->type == P_CONST)
+ FREE(src[i][c]); /* indirect constant */
}
}
@@ -2259,8 +2484,8 @@ nv50_program_tx_prep(struct nv50_pc *pc)
pc->interp_mode[i] = mode;
}
break;
+ case TGSI_FILE_ADDRESS:
case TGSI_FILE_CONSTANT:
- break;
case TGSI_FILE_SAMPLER:
break;
default:
@@ -2454,6 +2679,8 @@ ctor_nv50_pc(struct nv50_pc *pc, struct nv50_program *p)
pc->attr_nr = p->info.file_max[TGSI_FILE_INPUT] + 1;
pc->result_nr = p->info.file_max[TGSI_FILE_OUTPUT] + 1;
pc->param_nr = p->info.file_max[TGSI_FILE_CONSTANT] + 1;
+ pc->addr_nr = p->info.file_max[TGSI_FILE_ADDRESS] + 1;
+ assert(pc->addr_nr <= 2);
p->cfg.high_temp = 4;
@@ -2522,6 +2749,14 @@ ctor_nv50_pc(struct nv50_pc *pc, struct nv50_program *p)
ctor_reg(&pc->param[rid], P_CONST, i, rid);
}
+ if (pc->addr_nr) {
+ pc->addr = CALLOC(pc->addr_nr * 4, sizeof(struct nv50_reg *));
+ if (!pc->addr)
+ return FALSE;
+ }
+ for (i = 0; i < NV50_SU_MAX_ADDR; ++i)
+ ctor_reg(&pc->r_addr[i], P_ADDR, -1, i + 1);
+
return TRUE;
}
@@ -2701,7 +2936,7 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p)
p->immd_nr, NV50_CB_PMISC);
}
- assert(p->param_nr <= 128);
+ assert(p->param_nr <= 512);
if (p->param_nr) {
unsigned cb;
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index dd7baecba7c..63dce0f4c22 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -218,7 +218,16 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
tesla_class = NV54TCL;
break;
case 0xa0:
- tesla_class = NVA0TCL;
+ switch (chipset) {
+ case 0xa0:
+ case 0xaa:
+ case 0xac:
+ tesla_class = NVA0TCL;
+ break;
+ default:
+ tesla_class = 0x8597;
+ break;
+ }
break;
default:
NOUVEAU_ERR("Not a known NV50 chipset: NV%02x\n", chipset);
@@ -226,12 +235,6 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
return NULL;
}
- if (tesla_class == 0) {
- NOUVEAU_ERR("Unknown G8x chipset: NV%02x\n", chipset);
- nv50_screen_destroy(pscreen);
- return NULL;
- }
-
ret = nouveau_grobj_alloc(chan, 0xbeef5097, tesla_class,
&screen->tesla);
if (ret) {
@@ -301,7 +304,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
so_data (so, 8);
/* constant buffers for immediates and VP/FP parameters */
- ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 128*4*4,
+ ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, (32 * 4) * 4,
&screen->constbuf_misc[0]);
if (ret) {
nv50_screen_destroy(pscreen);
@@ -309,7 +312,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
}
for (i = 0; i < 2; i++) {
- ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 128*4*4,
+ ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, (128 * 4) * 4,
&screen->constbuf_parm[i]);
if (ret) {
nv50_screen_destroy(pscreen);
@@ -318,8 +321,8 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
}
if (nouveau_resource_init(&screen->immd_heap[0], 0, 128) ||
- nouveau_resource_init(&screen->parm_heap[0], 0, 128) ||
- nouveau_resource_init(&screen->parm_heap[1], 0, 128))
+ nouveau_resource_init(&screen->parm_heap[0], 0, 512) ||
+ nouveau_resource_init(&screen->parm_heap[1], 0, 512))
{
NOUVEAU_ERR("Error initialising constant buffers.\n");
nv50_screen_destroy(pscreen);
@@ -340,7 +343,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
so_reloc (so, screen->constbuf_misc[0], 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_PMISC << 16) | 0x00000800);
+ so_data (so, (NV50_CB_PMISC << 16) | 0x00000200);
so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
so_data (so, 0x00000001 | (NV50_CB_PMISC << 12));
so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
@@ -364,48 +367,31 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
so_data (so, 0x00000131 | (NV50_CB_PFP << 12));
- /* Texture sampler/image unit setup - we abuse the constant buffer
- * upload mechanism for the moment to upload data to the tex config
- * blocks. At some point we *may* want to go the NVIDIA way of doing
- * things?
- */
- ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 32*8*4, &screen->tic);
+ ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 64*8*4, &screen->tic);
if (ret) {
nv50_screen_destroy(pscreen);
return NULL;
}
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_TIC << 16) | 0x0800);
so_method(so, screen->tesla, NV50TCL_TIC_ADDRESS_HIGH, 3);
so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 0x00000800);
+ so_data (so, 0x000007ff);
- ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 32*8*4, &screen->tsc);
+ ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 64*8*4, &screen->tsc);
if (ret) {
nv50_screen_destroy(pscreen);
return NULL;
}
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_TSC << 16) | 0x0800);
so_method(so, screen->tesla, NV50TCL_TSC_ADDRESS_HIGH, 3);
so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 0x00000800);
+ so_data (so, 0x00000000);
/* Vertex array limits - max them out */
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 81fa3e34c59..ffaa5e29d1c 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -146,6 +146,7 @@ nv50_sampler_state_create(struct pipe_context *pipe,
(wrap_mode(cso->wrap_r) << 6));
switch (cso->mag_img_filter) {
+ case PIPE_TEX_FILTER_ANISO:
case PIPE_TEX_FILTER_LINEAR:
tsc[1] |= NV50TSC_1_1_MAGF_LINEAR;
break;
@@ -156,6 +157,7 @@ nv50_sampler_state_create(struct pipe_context *pipe,
}
switch (cso->min_img_filter) {
+ case PIPE_TEX_FILTER_ANISO:
case PIPE_TEX_FILTER_LINEAR:
tsc[1] |= NV50TSC_1_1_MINF_LINEAR;
break;
@@ -183,21 +185,15 @@ nv50_sampler_state_create(struct pipe_context *pipe,
else
if (cso->max_anisotropy >= 12.0)
tsc[0] |= (6 << 20);
- else
- if (cso->max_anisotropy >= 10.0)
- tsc[0] |= (5 << 20);
- else
- if (cso->max_anisotropy >= 8.0)
- tsc[0] |= (4 << 20);
- else
- if (cso->max_anisotropy >= 6.0)
- tsc[0] |= (3 << 20);
- else
- if (cso->max_anisotropy >= 4.0)
- tsc[0] |= (2 << 20);
- else
- if (cso->max_anisotropy >= 2.0)
- tsc[0] |= (1 << 20);
+ else {
+ tsc[0] |= (int)(cso->max_anisotropy * 0.5f) << 20;
+
+ if (cso->max_anisotropy >= 4.0)
+ tsc[1] |= NV50TSC_1_1_UNKN_ANISO_35;
+ else
+ if (cso->max_anisotropy >= 2.0)
+ tsc[1] |= NV50TSC_1_1_UNKN_ANISO_15;
+ }
if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
tsc[0] |= (1 << 8);
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index fd276203710..012911f41bd 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -222,6 +222,9 @@ nv50_state_flush_notify(struct nouveau_channel *chan)
{
struct nv50_context *nv50 = chan->user_private;
+ if (nv50->state.tic_upload && !(nv50->dirty & NV50_NEW_TEXTURE))
+ so_emit(chan, nv50->state.tic_upload);
+
so_emit_reloc_markers(chan, nv50->state.fb);
so_emit_reloc_markers(chan, nv50->state.vertprog);
so_emit_reloc_markers(chan, nv50->state.fragprog);
@@ -233,6 +236,7 @@ boolean
nv50_state_validate(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nouveau_grobj *eng2d = nv50->screen->eng2d;
struct nouveau_stateobj *so;
unsigned i;
@@ -354,18 +358,25 @@ scissor_uptodate:
viewport_uptodate:
if (nv50->dirty & NV50_NEW_SAMPLER) {
- int i;
+ unsigned i;
+
+ so = so_new(nv50->sampler_nr * 9 + 23 + 4, 2);
+
+ nv50_so_init_sifc(nv50, so, nv50->screen->tsc, NOUVEAU_BO_VRAM,
+ nv50->sampler_nr * 8 * 4);
- so = so_new(nv50->sampler_nr * 9 + 2, 0);
- so_method(so, tesla, NV50TCL_CB_ADDR, 1);
- so_data (so, NV50_CB_TSC);
for (i = 0; i < nv50->sampler_nr; i++) {
if (!nv50->sampler[i])
continue;
-
- so_method(so, tesla, NV50TCL_CB_DATA(0) | (2<<29), 8);
+ so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), 8);
so_datap (so, nv50->sampler[i]->tsc, 8);
}
+
+ so_method(so, tesla, 0x1440, 1); /* sync SIFC */
+ so_data (so, 0);
+ so_method(so, tesla, 0x1334, 1); /* flush TSC */
+ so_data (so, 0);
+
so_ref(so, &nv50->state.tsc_upload);
so_ref(NULL, &so);
}
@@ -383,3 +394,33 @@ viewport_uptodate:
return TRUE;
}
+void nv50_so_init_sifc(struct nv50_context *nv50,
+ struct nouveau_stateobj *so,
+ struct nouveau_bo *bo, unsigned reloc, unsigned size)
+{
+ struct nouveau_grobj *eng2d = nv50->screen->eng2d;
+
+ so_method(so, eng2d, NV50_2D_DST_FORMAT, 2);
+ so_data (so, NV50_2D_DST_FORMAT_R8_UNORM);
+ so_data (so, 1);
+ so_method(so, eng2d, NV50_2D_DST_PITCH, 5);
+ so_data (so, 262144);
+ so_data (so, 65536);
+ so_data (so, 1);
+ so_reloc (so, bo, 0, reloc | NOUVEAU_BO_WR | NOUVEAU_BO_HIGH, 0, 0);
+ so_reloc (so, bo, 0, reloc | NOUVEAU_BO_WR | NOUVEAU_BO_LOW, 0, 0);
+ so_method(so, eng2d, NV50_2D_SIFC_UNK0800, 2);
+ so_data (so, 0);
+ so_data (so, NV50_2D_SIFC_FORMAT_R8_UNORM);
+ so_method(so, eng2d, NV50_2D_SIFC_WIDTH, 10);
+ so_data (so, size);
+ so_data (so, 1);
+ so_data (so, 0);
+ so_data (so, 1);
+ so_data (so, 0);
+ so_data (so, 1);
+ so_data (so, 0);
+ so_data (so, 0);
+ so_data (so, 0);
+ so_data (so, 0);
+}
diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c
index 72d33150af1..e12a6ad648b 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -25,106 +25,60 @@
#include "nouveau/nouveau_stateobj.h"
+#define _(pf, tt, r, g, b, a, tf) \
+{ \
+ PIPE_FORMAT_##pf, \
+ NV50TIC_0_0_MAPR_##r | NV50TIC_0_0_TYPER_##tt | \
+ NV50TIC_0_0_MAPG_##g | NV50TIC_0_0_TYPEG_##tt | \
+ NV50TIC_0_0_MAPB_##b | NV50TIC_0_0_TYPEB_##tt | \
+ NV50TIC_0_0_MAPA_##a | NV50TIC_0_0_TYPEA_##tt | \
+ NV50TIC_0_0_FMT_##tf \
+}
+
+struct nv50_texture_format {
+ enum pipe_format pf;
+ uint32_t hw;
+};
+
+#define NV50_TEX_FORMAT_LIST_SIZE \
+ (sizeof(nv50_tex_format_list) / sizeof(struct nv50_texture_format))
+
+static const struct nv50_texture_format nv50_tex_format_list[] =
+{
+ _(A8R8G8B8_UNORM, UNORM, C2, C1, C0, C3, 8_8_8_8),
+ _(X8R8G8B8_UNORM, UNORM, C2, C1, C0, ONE, 8_8_8_8),
+ _(A1R5G5B5_UNORM, UNORM, C2, C1, C0, C3, 1_5_5_5),
+ _(A4R4G4B4_UNORM, UNORM, C2, C1, C0, C3, 4_4_4_4),
+
+ _(R5G6B5_UNORM, UNORM, C2, C1, C0, ONE, 5_6_5),
+
+ _(L8_UNORM, UNORM, C0, C0, C0, ONE, 8),
+ _(A8_UNORM, UNORM, ZERO, ZERO, ZERO, C0, 8),
+ _(I8_UNORM, UNORM, C0, C0, C0, C0, 8),
+
+ _(A8L8_UNORM, UNORM, C0, C0, C0, C1, 8_8),
+
+ _(DXT1_RGB, UNORM, C0, C1, C2, ONE, DXT1),
+ _(DXT1_RGBA, UNORM, C0, C1, C2, C3, DXT1),
+ _(DXT3_RGBA, UNORM, C0, C1, C2, C3, DXT3),
+ _(DXT5_RGBA, UNORM, C0, C1, C2, C3, DXT5)
+};
+
+#undef _
+
static int
nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so,
struct nv50_miptree *mt, int unit)
{
- switch (mt->base.base.format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_8_8_8_8);
- break;
- case PIPE_FORMAT_X8R8G8B8_UNORM:
- so_data(so, NV50TIC_0_0_MAPA_ONE | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_8_8_8_8);
- break;
- case PIPE_FORMAT_A1R5G5B5_UNORM:
- so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_1_5_5_5);
- break;
- case PIPE_FORMAT_A4R4G4B4_UNORM:
- so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_4_4_4_4);
- break;
- case PIPE_FORMAT_R5G6B5_UNORM:
- so_data(so, NV50TIC_0_0_MAPA_ONE | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_5_6_5);
- break;
- case PIPE_FORMAT_L8_UNORM:
- so_data(so, NV50TIC_0_0_MAPA_ONE | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C0 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_8);
- break;
- case PIPE_FORMAT_A8_UNORM:
- so_data(so, NV50TIC_0_0_MAPA_C0 | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_ZERO | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_ZERO | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_8);
- break;
- case PIPE_FORMAT_I8_UNORM:
- so_data(so, NV50TIC_0_0_MAPA_C0 | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C0 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_8);
- break;
- case PIPE_FORMAT_A8L8_UNORM:
- so_data(so, NV50TIC_0_0_MAPA_C1 | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C0 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_8_8);
- break;
- case PIPE_FORMAT_DXT1_RGB:
- so_data(so, NV50TIC_0_0_MAPA_ONE | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_DXT1);
- break;
- case PIPE_FORMAT_DXT1_RGBA:
- so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_DXT1);
- break;
- case PIPE_FORMAT_DXT3_RGBA:
- so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_DXT3);
- break;
- case PIPE_FORMAT_DXT5_RGBA:
- so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM |
- NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
- NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
- NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM |
- NV50TIC_0_0_FMT_DXT5);
- break;
- default:
- return 1;
- }
+ unsigned i;
+ for (i = 0; i < NV50_TEX_FORMAT_LIST_SIZE; i++)
+ if (nv50_tex_format_list[i].pf == mt->base.base.format)
+ break;
+ if (i == NV50_TEX_FORMAT_LIST_SIZE)
+ return 1;
+
+ so_data (so, nv50_tex_format_list[i].hw);
so_reloc(so, mt->base.bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW |
NOUVEAU_BO_RD, 0, 0);
if (nv50->sampler[unit]->normalized)
@@ -144,23 +98,24 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so,
void
nv50_tex_validate(struct nv50_context *nv50)
{
+ struct nouveau_grobj *eng2d = nv50->screen->eng2d;
struct nouveau_grobj *tesla = nv50->screen->tesla;
struct nouveau_stateobj *so;
- int unit, push;
+ unsigned i, unit, push;
+
+ push = MAX2(nv50->miptree_nr, nv50->state.miptree_nr) * 2 + 23 + 6;
+ so = so_new(nv50->miptree_nr * 9 + push, nv50->miptree_nr + 2);
- push = nv50->miptree_nr * 9 + 2;
- push += MAX2(nv50->miptree_nr, nv50->state.miptree_nr) * 2;
+ nv50_so_init_sifc(nv50, so, nv50->screen->tic, NOUVEAU_BO_VRAM,
+ nv50->miptree_nr * 8 * 4);
- so = so_new(push, nv50->miptree_nr * 2);
- so_method(so, tesla, NV50TCL_CB_ADDR, 1);
- so_data (so, NV50_CB_TIC);
- for (unit = 0; unit < nv50->miptree_nr; unit++) {
+ for (i = 0, unit = 0; unit < nv50->miptree_nr; ++unit) {
struct nv50_miptree *mt = nv50->miptree[unit];
if (!mt)
continue;
- so_method(so, tesla, NV50TCL_CB_DATA(0) | 0x40000000, 8);
+ so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), 8);
if (nv50_tex_construct(nv50, so, mt, unit)) {
NOUVEAU_ERR("failed tex validate\n");
so_ref(NULL, &so);
@@ -168,17 +123,25 @@ nv50_tex_validate(struct nv50_context *nv50)
}
so_method(so, tesla, NV50TCL_SET_SAMPLER_TEX, 1);
- so_data (so, (unit << NV50TCL_SET_SAMPLER_TEX_TIC_SHIFT) |
- (unit << NV50TCL_SET_SAMPLER_TEX_SAMPLER_SHIFT) |
- NV50TCL_SET_SAMPLER_TEX_VALID);
+ so_data (so, (i++ << NV50TCL_SET_SAMPLER_TEX_TIC_SHIFT) |
+ (unit << NV50TCL_SET_SAMPLER_TEX_SAMPLER_SHIFT) |
+ NV50TCL_SET_SAMPLER_TEX_VALID);
}
for (; unit < nv50->state.miptree_nr; unit++) {
so_method(so, tesla, NV50TCL_SET_SAMPLER_TEX, 1);
so_data (so,
- (unit << NV50TCL_SET_SAMPLER_TEX_SAMPLER_SHIFT) | 0);
+ (unit << NV50TCL_SET_SAMPLER_TEX_SAMPLER_SHIFT) | 0);
}
+ /* not sure if the following really do what I think: */
+ so_method(so, tesla, 0x1440, 1); /* sync SIFC */
+ so_data (so, 0);
+ so_method(so, tesla, 0x1330, 1); /* flush TIC */
+ so_data (so, 0);
+ so_method(so, tesla, 0x1338, 1); /* flush texture caches */
+ so_data (so, 0x20);
+
so_ref(so, &nv50->state.tic_upload);
so_ref(NULL, &so);
nv50->state.miptree_nr = nv50->miptree_nr;
diff --git a/src/gallium/drivers/nv50/nv50_texture.h b/src/gallium/drivers/nv50/nv50_texture.h
index 207fb039f70..13f74c11c6b 100644
--- a/src/gallium/drivers/nv50/nv50_texture.h
+++ b/src/gallium/drivers/nv50/nv50_texture.h
@@ -133,6 +133,8 @@
#define NV50TSC_1_1_MIPF_NEAREST 0x00000080
#define NV50TSC_1_1_MIPF_LINEAR 0x000000c0
#define NV50TSC_1_1_LOD_BIAS_MASK 0x01fff000
+#define NV50TSC_1_1_UNKN_ANISO_15 0x10000000
+#define NV50TSC_1_1_UNKN_ANISO_35 0x18000000
#define NV50TSC_1_2_MIN_LOD_MASK 0x00000f00
#define NV50TSC_1_2_MAX_LOD_MASK 0x00f00000
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index eeed148c7b9..db54380241f 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -26,6 +26,18 @@
#include "nv50_context.h"
+static boolean
+nv50_push_elements_u08(struct nv50_context *, uint8_t *, unsigned);
+
+static boolean
+nv50_push_elements_u16(struct nv50_context *, uint16_t *, unsigned);
+
+static boolean
+nv50_push_elements_u32(struct nv50_context *, uint32_t *, unsigned);
+
+static boolean
+nv50_push_arrays(struct nv50_context *, unsigned, unsigned);
+
static INLINE unsigned
nv50_prim(unsigned mode)
{
@@ -132,6 +144,7 @@ nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start,
struct nv50_context *nv50 = nv50_context(pipe);
struct nouveau_channel *chan = nv50->screen->tesla->channel;
struct nouveau_grobj *tesla = nv50->screen->tesla;
+ boolean ret;
nv50_state_validate(nv50);
@@ -139,24 +152,25 @@ nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start,
OUT_RING (chan, 0);
BEGIN_RING(chan, tesla, 0x142c, 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, tesla, 0x1440, 1);
- OUT_RING (chan, 0);
- BEGIN_RING(chan, tesla, 0x1334, 1);
- OUT_RING (chan, 0);
BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
OUT_RING (chan, nv50_prim(mode));
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BUFFER_FIRST, 2);
- OUT_RING (chan, start);
- OUT_RING (chan, count);
+
+ if (nv50->vbo_fifo)
+ ret = nv50_push_arrays(nv50, start, count);
+ else {
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BUFFER_FIRST, 2);
+ OUT_RING (chan, start);
+ OUT_RING (chan, count);
+ ret = TRUE;
+ }
BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
OUT_RING (chan, 0);
- pipe->flush(pipe, 0, NULL);
- return TRUE;
+ return ret;
}
-static INLINE void
+static INLINE boolean
nv50_draw_elements_inline_u08(struct nv50_context *nv50, uint8_t *map,
unsigned start, unsigned count)
{
@@ -165,6 +179,9 @@ nv50_draw_elements_inline_u08(struct nv50_context *nv50, uint8_t *map,
map += start;
+ if (nv50->vbo_fifo)
+ return nv50_push_elements_u08(nv50, map, count);
+
if (count & 1) {
BEGIN_RING(chan, tesla, 0x15e8, 1);
OUT_RING (chan, map[0]);
@@ -183,9 +200,10 @@ nv50_draw_elements_inline_u08(struct nv50_context *nv50, uint8_t *map,
count -= nr;
map += nr;
}
+ return TRUE;
}
-static INLINE void
+static INLINE boolean
nv50_draw_elements_inline_u16(struct nv50_context *nv50, uint16_t *map,
unsigned start, unsigned count)
{
@@ -194,6 +212,9 @@ nv50_draw_elements_inline_u16(struct nv50_context *nv50, uint16_t *map,
map += start;
+ if (nv50->vbo_fifo)
+ return nv50_push_elements_u16(nv50, map, count);
+
if (count & 1) {
BEGIN_RING(chan, tesla, 0x15e8, 1);
OUT_RING (chan, map[0]);
@@ -212,9 +233,10 @@ nv50_draw_elements_inline_u16(struct nv50_context *nv50, uint16_t *map,
count -= nr;
map += nr;
}
+ return TRUE;
}
-static INLINE void
+static INLINE boolean
nv50_draw_elements_inline_u32(struct nv50_context *nv50, uint32_t *map,
unsigned start, unsigned count)
{
@@ -223,6 +245,9 @@ nv50_draw_elements_inline_u32(struct nv50_context *nv50, uint32_t *map,
map += start;
+ if (nv50->vbo_fifo)
+ return nv50_push_elements_u32(nv50, map, count);
+
while (count) {
unsigned nr = count > 2047 ? 2047 : count;
@@ -232,6 +257,7 @@ nv50_draw_elements_inline_u32(struct nv50_context *nv50, uint32_t *map,
count -= nr;
map += nr;
}
+ return TRUE;
}
boolean
@@ -244,6 +270,7 @@ nv50_draw_elements(struct pipe_context *pipe,
struct nouveau_grobj *tesla = nv50->screen->tesla;
struct pipe_screen *pscreen = pipe->screen;
void *map;
+ boolean ret;
map = pipe_buffer_map(pscreen, indexBuffer, PIPE_BUFFER_USAGE_CPU_READ);
@@ -258,23 +285,25 @@ nv50_draw_elements(struct pipe_context *pipe,
OUT_RING (chan, nv50_prim(mode));
switch (indexSize) {
case 1:
- nv50_draw_elements_inline_u08(nv50, map, start, count);
+ ret = nv50_draw_elements_inline_u08(nv50, map, start, count);
break;
case 2:
- nv50_draw_elements_inline_u16(nv50, map, start, count);
+ ret = nv50_draw_elements_inline_u16(nv50, map, start, count);
break;
case 4:
- nv50_draw_elements_inline_u32(nv50, map, start, count);
+ ret = nv50_draw_elements_inline_u32(nv50, map, start, count);
break;
default:
assert(0);
+ ret = FALSE;
+ break;
}
BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
OUT_RING (chan, 0);
pipe_buffer_unmap(pscreen, indexBuffer);
- pipe->flush(pipe, 0, NULL);
- return TRUE;
+
+ return ret;
}
static INLINE boolean
@@ -341,17 +370,24 @@ nv50_vbo_validate(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
struct nouveau_stateobj *vtxbuf, *vtxfmt, *vtxattr;
- unsigned i;
+ unsigned i, n_ve;
/* don't validate if Gallium took away our buffers */
if (nv50->vtxbuf_nr == 0)
return;
+ nv50->vbo_fifo = 0;
+
+ for (i = 0; i < nv50->vtxbuf_nr; ++i)
+ if (nv50->vtxbuf[i].stride &&
+ !(nv50->vtxbuf[i].buffer->usage & PIPE_BUFFER_USAGE_VERTEX))
+ nv50->vbo_fifo = 0xffff;
+
+ n_ve = MAX2(nv50->vtxelt_nr, nv50->state.vtxelt_nr);
vtxattr = NULL;
- vtxbuf = so_new(nv50->vtxelt_nr * 7, nv50->vtxelt_nr * 4);
- vtxfmt = so_new(nv50->vtxelt_nr + 1, 0);
- so_method(vtxfmt, tesla, NV50TCL_VERTEX_ARRAY_ATTRIB(0),
- nv50->vtxelt_nr);
+ vtxbuf = so_new(n_ve * 7, nv50->vtxelt_nr * 4);
+ vtxfmt = so_new(n_ve + 1, 0);
+ so_method(vtxfmt, tesla, NV50TCL_VERTEX_ARRAY_ATTRIB(0), n_ve);
for (i = 0; i < nv50->vtxelt_nr; i++) {
struct pipe_vertex_element *ve = &nv50->vtxelt[i];
@@ -367,10 +403,19 @@ nv50_vbo_validate(struct nv50_context *nv50)
so_method(vtxbuf, tesla,
NV50TCL_VERTEX_ARRAY_FORMAT(i), 1);
so_data (vtxbuf, 0);
+
+ nv50->vbo_fifo &= ~(1 << i);
continue;
}
so_data(vtxfmt, hw | i);
+ if (nv50->vbo_fifo) {
+ so_method(vtxbuf, tesla,
+ NV50TCL_VERTEX_ARRAY_FORMAT(i), 1);
+ so_data (vtxbuf, 0);
+ continue;
+ }
+
so_method(vtxbuf, tesla, NV50TCL_VERTEX_ARRAY_FORMAT(i), 3);
so_data (vtxbuf, 0x20000000 | vb->stride);
so_reloc (vtxbuf, bo, vb->buffer_offset +
@@ -389,6 +434,13 @@ nv50_vbo_validate(struct nv50_context *nv50)
NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD |
NOUVEAU_BO_LOW, 0, 0);
}
+ for (; i < n_ve; ++i) {
+ so_data (vtxfmt, 0x7e080010);
+
+ so_method(vtxbuf, tesla, NV50TCL_VERTEX_ARRAY_FORMAT(i), 1);
+ so_data (vtxbuf, 0);
+ }
+ nv50->state.vtxelt_nr = nv50->vtxelt_nr;
so_ref (vtxfmt, &nv50->state.vtxfmt);
so_ref (vtxbuf, &nv50->state.vtxbuf);
@@ -398,3 +450,320 @@ nv50_vbo_validate(struct nv50_context *nv50)
so_ref (NULL, &vtxattr);
}
+typedef void (*pfn_push)(struct nouveau_channel *, void *);
+
+struct nv50_vbo_emitctx
+{
+ pfn_push push[16];
+ void *map[16];
+ unsigned stride[16];
+ unsigned nr_ve;
+ unsigned vtx_dwords;
+ unsigned vtx_max;
+};
+
+static INLINE void
+emit_vtx_next(struct nouveau_channel *chan, struct nv50_vbo_emitctx *emit)
+{
+ unsigned i;
+
+ for (i = 0; i < emit->nr_ve; ++i) {
+ emit->push[i](chan, emit->map[i]);
+ emit->map[i] += emit->stride[i];
+ }
+}
+
+static INLINE void
+emit_vtx(struct nouveau_channel *chan, struct nv50_vbo_emitctx *emit,
+ uint32_t vi)
+{
+ unsigned i;
+
+ for (i = 0; i < emit->nr_ve; ++i)
+ emit->push[i](chan, emit->map[i] + emit->stride[i] * vi);
+}
+
+static INLINE boolean
+nv50_map_vbufs(struct nv50_context *nv50)
+{
+ int i;
+
+ for (i = 0; i < nv50->vtxbuf_nr; ++i) {
+ struct pipe_vertex_buffer *vb = &nv50->vtxbuf[i];
+ unsigned size, delta;
+
+ if (nouveau_bo(vb->buffer)->map)
+ continue;
+
+ size = vb->stride * (vb->max_index + 1);
+ delta = vb->buffer_offset;
+
+ if (!size)
+ size = vb->buffer->size - vb->buffer_offset;
+
+ if (nouveau_bo_map_range(nouveau_bo(vb->buffer),
+ delta, size, NOUVEAU_BO_RD))
+ break;
+ }
+
+ if (i == nv50->vtxbuf_nr)
+ return TRUE;
+ for (; i >= 0; --i)
+ nouveau_bo_unmap(nouveau_bo(nv50->vtxbuf[i].buffer));
+ return FALSE;
+}
+
+static INLINE void
+nv50_unmap_vbufs(struct nv50_context *nv50)
+{
+ unsigned i;
+
+ for (i = 0; i < nv50->vtxbuf_nr; ++i)
+ if (nouveau_bo(nv50->vtxbuf[i].buffer)->map)
+ nouveau_bo_unmap(nouveau_bo(nv50->vtxbuf[i].buffer));
+}
+
+static void
+emit_b32_1(struct nouveau_channel *chan, void *data)
+{
+ uint32_t *v = data;
+
+ OUT_RING(chan, v[0]);
+}
+
+static void
+emit_b32_2(struct nouveau_channel *chan, void *data)
+{
+ uint32_t *v = data;
+
+ OUT_RING(chan, v[0]);
+ OUT_RING(chan, v[1]);
+}
+
+static void
+emit_b32_3(struct nouveau_channel *chan, void *data)
+{
+ uint32_t *v = data;
+
+ OUT_RING(chan, v[0]);
+ OUT_RING(chan, v[1]);
+ OUT_RING(chan, v[2]);
+}
+
+static void
+emit_b32_4(struct nouveau_channel *chan, void *data)
+{
+ uint32_t *v = data;
+
+ OUT_RING(chan, v[0]);
+ OUT_RING(chan, v[1]);
+ OUT_RING(chan, v[2]);
+ OUT_RING(chan, v[3]);
+}
+
+static void
+emit_b16_1(struct nouveau_channel *chan, void *data)
+{
+ uint16_t *v = data;
+
+ OUT_RING(chan, v[0]);
+}
+
+static void
+emit_b16_3(struct nouveau_channel *chan, void *data)
+{
+ uint16_t *v = data;
+
+ OUT_RING(chan, (v[1] << 16) | v[0]);
+ OUT_RING(chan, v[2]);
+}
+
+static void
+emit_b08_1(struct nouveau_channel *chan, void *data)
+{
+ uint8_t *v = data;
+
+ OUT_RING(chan, v[0]);
+}
+
+static void
+emit_b08_3(struct nouveau_channel *chan, void *data)
+{
+ uint8_t *v = data;
+
+ OUT_RING(chan, (v[2] << 16) | (v[1] << 8) | v[0]);
+}
+
+static boolean
+emit_prepare(struct nv50_context *nv50, struct nv50_vbo_emitctx *emit,
+ unsigned start)
+{
+ unsigned i;
+
+ if (nv50_map_vbufs(nv50) == FALSE)
+ return FALSE;
+
+ emit->nr_ve = 0;
+ emit->vtx_dwords = 0;
+
+ for (i = 0; i < nv50->vtxelt_nr; ++i) {
+ struct pipe_vertex_element *ve;
+ struct pipe_vertex_buffer *vb;
+ unsigned n, type, size;
+
+ ve = &nv50->vtxelt[i];
+ vb = &nv50->vtxbuf[ve->vertex_buffer_index];
+ if (!(nv50->vbo_fifo & (1 << i)))
+ continue;
+ n = emit->nr_ve++;
+
+ emit->stride[n] = vb->stride;
+ emit->map[n] = nouveau_bo(vb->buffer)->map +
+ (start * vb->stride + ve->src_offset);
+
+ type = pf_type(ve->src_format);
+ size = pf_size_x(ve->src_format) << pf_exp2(ve->src_format);
+
+ assert(ve->nr_components > 0 && ve->nr_components <= 4);
+
+ /* It shouldn't be necessary to push the implicit 1s
+ * for case 3 and size 8 cases 1, 2, 3.
+ */
+ switch (size) {
+ default:
+ NOUVEAU_ERR("unsupported vtxelt size: %u\n", size);
+ return FALSE;
+ case 32:
+ switch (ve->nr_components) {
+ case 1: emit->push[n] = emit_b32_1; break;
+ case 2: emit->push[n] = emit_b32_2; break;
+ case 3: emit->push[n] = emit_b32_3; break;
+ case 4: emit->push[n] = emit_b32_4; break;
+ }
+ emit->vtx_dwords += ve->nr_components;
+ break;
+ case 16:
+ switch (ve->nr_components) {
+ case 1: emit->push[n] = emit_b16_1; break;
+ case 2: emit->push[n] = emit_b32_1; break;
+ case 3: emit->push[n] = emit_b16_3; break;
+ case 4: emit->push[n] = emit_b32_2; break;
+ }
+ emit->vtx_dwords += (ve->nr_components + 1) >> 1;
+ break;
+ case 8:
+ switch (ve->nr_components) {
+ case 1: emit->push[n] = emit_b08_1; break;
+ case 2: emit->push[n] = emit_b16_1; break;
+ case 3: emit->push[n] = emit_b08_3; break;
+ case 4: emit->push[n] = emit_b32_1; break;
+ }
+ emit->vtx_dwords += 1;
+ break;
+ }
+ }
+
+ emit->vtx_max = 512 / emit->vtx_dwords;
+
+ return TRUE;
+}
+
+static boolean
+nv50_push_arrays(struct nv50_context *nv50, unsigned start, unsigned count)
+{
+ struct nouveau_channel *chan = nv50->screen->base.channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nv50_vbo_emitctx emit;
+
+ if (emit_prepare(nv50, &emit, start) == FALSE)
+ return FALSE;
+
+ while (count) {
+ unsigned i, dw, nr = MIN2(count, emit.vtx_max);
+ dw = nr * emit.vtx_dwords;
+
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_DATA | 0x40000000, dw);
+ for (i = 0; i < nr; ++i)
+ emit_vtx_next(chan, &emit);
+
+ count -= nr;
+ }
+ nv50_unmap_vbufs(nv50);
+
+ return TRUE;
+}
+
+static boolean
+nv50_push_elements_u32(struct nv50_context *nv50, uint32_t *map, unsigned count)
+{
+ struct nouveau_channel *chan = nv50->screen->base.channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nv50_vbo_emitctx emit;
+
+ if (emit_prepare(nv50, &emit, 0) == FALSE)
+ return FALSE;
+
+ while (count) {
+ unsigned i, dw, nr = MIN2(count, emit.vtx_max);
+ dw = nr * emit.vtx_dwords;
+
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_DATA | 0x40000000, dw);
+ for (i = 0; i < nr; ++i)
+ emit_vtx(chan, &emit, *map++);
+
+ count -= nr;
+ }
+ nv50_unmap_vbufs(nv50);
+
+ return TRUE;
+}
+
+static boolean
+nv50_push_elements_u16(struct nv50_context *nv50, uint16_t *map, unsigned count)
+{
+ struct nouveau_channel *chan = nv50->screen->base.channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nv50_vbo_emitctx emit;
+
+ if (emit_prepare(nv50, &emit, 0) == FALSE)
+ return FALSE;
+
+ while (count) {
+ unsigned i, dw, nr = MIN2(count, emit.vtx_max);
+ dw = nr * emit.vtx_dwords;
+
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_DATA | 0x40000000, dw);
+ for (i = 0; i < nr; ++i)
+ emit_vtx(chan, &emit, *map++);
+
+ count -= nr;
+ }
+ nv50_unmap_vbufs(nv50);
+
+ return TRUE;
+}
+
+static boolean
+nv50_push_elements_u08(struct nv50_context *nv50, uint8_t *map, unsigned count)
+{
+ struct nouveau_channel *chan = nv50->screen->base.channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nv50_vbo_emitctx emit;
+
+ if (emit_prepare(nv50, &emit, 0) == FALSE)
+ return FALSE;
+
+ while (count) {
+ unsigned i, dw, nr = MIN2(count, emit.vtx_max);
+ dw = nr * emit.vtx_dwords;
+
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_DATA | 0x40000000, dw);
+ for (i = 0; i < nr; ++i)
+ emit_vtx(chan, &emit, *map++);
+
+ count -= nr;
+ }
+ nv50_unmap_vbufs(nv50);
+
+ return TRUE;
+}
diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile
index 69e4724790a..f73d80de882 100644
--- a/src/gallium/drivers/r300/Makefile
+++ b/src/gallium/drivers/r300/Makefile
@@ -4,8 +4,6 @@ include $(TOP)/configs/current
LIBNAME = r300
C_SOURCES = \
- r3xx_fs.c \
- r5xx_fs.c \
r300_chipset.c \
r300_clear.c \
r300_context.c \
@@ -20,7 +18,6 @@ C_SOURCES = \
r300_state_derived.c \
r300_state_invariant.c \
r300_vs.c \
- r300_surface.c \
r300_texture.c \
r300_tgsi_to_rc.c
diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c
index d138866d33c..51fdb82ff34 100644
--- a/src/gallium/drivers/r300/r300_chipset.c
+++ b/src/gallium/drivers/r300/r300_chipset.c
@@ -21,6 +21,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "r300_chipset.h"
+
#include "util/u_debug.h"
/* r300_chipset: A file all to itself for deducing the various properties of
@@ -31,7 +32,7 @@ void r300_parse_chipset(struct r300_capabilities* caps)
{
/* Reasonable defaults */
caps->num_vert_fpus = 4;
- caps->has_tcl = getenv("RADEON_NO_TCL") ? FALSE : TRUE;
+ caps->has_tcl = debug_get_bool_option("RADEON_NO_TCL", FALSE) ? FALSE : TRUE;
caps->is_r500 = FALSE;
caps->high_second_pipe = FALSE;
diff --git a/src/gallium/drivers/r300/r300_chipset.h b/src/gallium/drivers/r300/r300_chipset.h
index 322d4a57e41..0633a8b8a72 100644
--- a/src/gallium/drivers/r300/r300_chipset.h
+++ b/src/gallium/drivers/r300/r300_chipset.h
@@ -33,9 +33,11 @@ struct r300_capabilities {
/* Chipset family */
int family;
/* The number of vertex floating-point units */
- int num_vert_fpus;
+ unsigned num_vert_fpus;
/* The number of fragment pipes */
- int num_frag_pipes;
+ unsigned num_frag_pipes;
+ /* The number of z pipes */
+ unsigned num_z_pipes;
/* Whether or not TCL is physically present */
boolean has_tcl;
/* Whether or not this is an RV515 or newer; R500s have many differences
diff --git a/src/gallium/drivers/r300/r300_clear.c b/src/gallium/drivers/r300/r300_clear.c
index 8b9cb819ae6..02d6d504fc0 100644
--- a/src/gallium/drivers/r300/r300_clear.c
+++ b/src/gallium/drivers/r300/r300_clear.c
@@ -21,6 +21,9 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "r300_clear.h"
+#include "r300_context.h"
+
+#include "util/u_clear.h"
/* Clears currently bound buffers. */
void r300_clear(struct pipe_context* pipe,
diff --git a/src/gallium/drivers/r300/r300_clear.h b/src/gallium/drivers/r300/r300_clear.h
index cd5900565e8..b8fcdf273c7 100644
--- a/src/gallium/drivers/r300/r300_clear.h
+++ b/src/gallium/drivers/r300/r300_clear.h
@@ -23,9 +23,7 @@
#ifndef R300_CLEAR_H
#define R300_CLEAR_H
-#include "util/u_clear.h"
-
-#include "r300_context.h"
+struct pipe_context;
void r300_clear(struct pipe_context* pipe,
unsigned buffers,
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 9cc455135db..c34fbb11235 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -20,90 +20,52 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#include "r300_context.h"
+#include "draw/draw_context.h"
-#include "r300_flush.h"
-#include "r300_state_invariant.h"
+#include "pipe/p_inlines.h"
-static boolean r300_draw_range_elements(struct pipe_context* pipe,
- struct pipe_buffer* indexBuffer,
- unsigned indexSize,
- unsigned minIndex,
- unsigned maxIndex,
- unsigned mode,
- unsigned start,
- unsigned count)
-{
- struct r300_context* r300 = r300_context(pipe);
- int i;
-
- for (i = 0; i < r300->vertex_buffer_count; i++) {
- void* buf = pipe_buffer_map(pipe->screen,
- r300->vertex_buffers[i].buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_vertex_buffer(r300->draw, i, buf);
- }
-
- if (indexBuffer) {
- void* indices = pipe_buffer_map(pipe->screen, indexBuffer,
- PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_element_buffer_range(r300->draw, indexSize,
- minIndex, maxIndex, indices);
- } else {
- draw_set_mapped_element_buffer(r300->draw, 0, NULL);
- }
+#include "tgsi/tgsi_scan.h"
- draw_set_mapped_constant_buffer(r300->draw,
- r300->shader_constants[PIPE_SHADER_VERTEX].constants,
- r300->shader_constants[PIPE_SHADER_VERTEX].count *
- (sizeof(float) * 4));
+#include "util/u_hash_table.h"
+#include "util/u_memory.h"
+#include "util/u_simple_list.h"
- draw_arrays(r300->draw, mode, start, count);
-
- for (i = 0; i < r300->vertex_buffer_count; i++) {
- pipe_buffer_unmap(pipe->screen, r300->vertex_buffers[i].buffer);
- draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
- }
-
- if (indexBuffer) {
- pipe_buffer_unmap(pipe->screen, indexBuffer);
- draw_set_mapped_element_buffer_range(r300->draw, 0, start,
- start + count - 1, NULL);
- }
-
- return TRUE;
-}
+#include "r300_clear.h"
+#include "r300_context.h"
+#include "r300_flush.h"
+#include "r300_query.h"
+#include "r300_render.h"
+#include "r300_screen.h"
+#include "r300_state_derived.h"
+#include "r300_state_invariant.h"
+#include "r300_winsys.h"
-static boolean r300_draw_elements(struct pipe_context* pipe,
- struct pipe_buffer* indexBuffer,
- unsigned indexSize, unsigned mode,
- unsigned start, unsigned count)
+static enum pipe_error r300_clear_hash_table(void* key, void* value,
+ void* data)
{
- return r300_draw_range_elements(pipe, indexBuffer, indexSize, 0, ~0,
- mode, start, count);
+ FREE(key);
+ FREE(value);
+ return PIPE_OK;
}
-static boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
- unsigned start, unsigned count)
+static void r300_destroy_context(struct pipe_context* context)
{
- return r300_draw_elements(pipe, NULL, 0, mode, start, count);
-}
-
-static void r300_destroy_context(struct pipe_context* context) {
struct r300_context* r300 = r300_context(context);
struct r300_query* query, * temp;
+ util_hash_table_foreach(r300->shader_hash_table, r300_clear_hash_table,
+ NULL);
+ util_hash_table_destroy(r300->shader_hash_table);
+
draw_destroy(r300->draw);
/* Free the OQ BO. */
context->screen->buffer_destroy(r300->oqbo);
/* If there are any queries pending or not destroyed, remove them now. */
- if (r300->query_list) {
- foreach_s(query, temp, r300->query_list) {
- remove_from_list(query);
- FREE(query);
- }
+ foreach_s(query, temp, &r300->query_list) {
+ remove_from_list(query);
+ FREE(query);
}
FREE(r300->blend_color_state);
@@ -136,6 +98,13 @@ r300_is_buffer_referenced( struct pipe_context *pipe,
return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
}
+static void r300_flush_cb(void *data)
+{
+ struct r300_context* const cs_context_copy = data;
+
+ cs_context_copy->context.flush(&cs_context_copy->context, 0, NULL);
+}
+
struct pipe_context* r300_create_context(struct pipe_screen* screen,
struct r300_winsys* r300_winsys)
{
@@ -147,7 +116,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->winsys = r300_winsys;
r300->context.winsys = (struct pipe_winsys*)r300_winsys;
- r300->context.screen = r300_screen(screen);
+ r300->context.screen = screen;
r300_init_debug(r300);
@@ -157,11 +126,14 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->context.draw_arrays = r300_draw_arrays;
r300->context.draw_elements = r300_draw_elements;
- r300->context.draw_range_elements = r300_draw_range_elements;
+ r300->context.draw_range_elements = r300_swtcl_draw_range_elements;
r300->context.is_texture_referenced = r300_is_texture_referenced;
r300->context.is_buffer_referenced = r300_is_buffer_referenced;
+ r300->shader_hash_table = util_hash_table_create(r300_shader_key_hash,
+ r300_shader_key_compare);
+
r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state);
r300->rs_block = CALLOC_STRUCT(r300_rs_block);
r300->scissor_state = CALLOC_STRUCT(r300_scissor_state);
@@ -185,13 +157,15 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300_init_query_functions(r300);
- r300_init_surface_functions(r300);
+ /* r300_init_surface_functions(r300); */
r300_init_state_functions(r300);
r300_emit_invariant_state(r300);
+
+ r300->winsys->set_flush_cb(r300->winsys, r300_flush_cb, r300);
r300->dirty_state = R300_NEW_KITCHEN_SINK;
r300->dirty_hw++;
-
+ make_empty_list(&r300->query_list);
return &r300->context;
}
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 086633f732d..30b80fa9db8 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -23,21 +23,10 @@
#ifndef R300_CONTEXT_H
#define R300_CONTEXT_H
-#include "draw/draw_context.h"
#include "draw/draw_vertex.h"
#include "pipe/p_context.h"
-#include "tgsi/tgsi_scan.h"
-
-#include "util/u_memory.h"
-#include "util/u_simple_list.h"
-
-#include "r300_clear.h"
-#include "r300_query.h"
-#include "r300_screen.h"
-#include "r300_winsys.h"
-
struct r300_fragment_shader;
struct r300_vertex_shader;
@@ -62,7 +51,6 @@ struct r300_dsa_state {
uint32_t z_buffer_control; /* R300_ZB_CNTL: 0x4f00 */
uint32_t z_stencil_control; /* R300_ZB_ZSTENCILCNTL: 0x4f04 */
uint32_t stencil_ref_mask; /* R300_ZB_STENCILREFMASK: 0x4f08 */
- uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */
uint32_t stencil_ref_bf; /* R500_ZB_STENCILREFMASK_BF: 0x4fd4 */
};
@@ -124,6 +112,10 @@ struct r300_viewport_state {
uint32_t vte_control; /* R300_VAP_VTE_CNTL: 0x20b0 */
};
+struct r300_ztop_state {
+ uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */
+};
+
#define R300_NEW_BLEND 0x00000001
#define R300_NEW_BLEND_COLOR 0x00000002
#define R300_NEW_CLIP 0x00000004
@@ -141,7 +133,8 @@ struct r300_viewport_state {
#define R300_NEW_VERTEX_FORMAT 0x04000000
#define R300_NEW_VERTEX_SHADER 0x08000000
#define R300_NEW_VIEWPORT 0x10000000
-#define R300_NEW_KITCHEN_SINK 0x1fffffff
+#define R300_NEW_QUERY 0x20000000
+#define R300_NEW_KITCHEN_SINK 0x3fffffff
/* The next several objects are not pure Radeon state; they inherit from
* various Gallium classes. */
@@ -172,6 +165,10 @@ struct r300_query {
unsigned int count;
/* The offset of this query into the query buffer, in bytes. */
unsigned offset;
+ /* if we've flushed the query */
+ boolean flushed;
+ /* if begin has been emitted */
+ boolean begin_emitted;
/* Linked list members. */
struct r300_query* prev;
struct r300_query* next;
@@ -237,7 +234,14 @@ struct r300_context {
/* Occlusion query buffer. */
struct pipe_buffer* oqbo;
/* Query list. */
- struct r300_query* query_list;
+ struct r300_query *query_current;
+ struct r300_query query_list;
+
+ /* Shader hash table. Used to store vertex formatting information, which
+ * depends on the combination of both currently loaded shaders. */
+ struct util_hash_table* shader_hash_table;
+ /* Vertex formatting information. */
+ struct r300_vertex_format* vertex_info;
/* Various CSO state objects. */
/* Blend state. */
@@ -269,12 +273,16 @@ struct r300_context {
/* Vertex buffers for Gallium. */
struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
int vertex_buffer_count;
- /* Vertex information. */
- struct r300_vertex_format vertex_info;
+ /* Vertex elements for Gallium. */
+ struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS];
+ int vertex_element_count;
/* Vertex shader. */
struct r300_vertex_shader* vs;
/* Viewport state. */
struct r300_viewport_state* viewport_state;
+ /* ZTOP state. */
+ struct r300_ztop_state ztop_state;
+
/* Bitmask of dirty state objects. */
uint32_t dirty_state;
/* Flag indicating whether or not the HW is dirty. */
@@ -312,9 +320,8 @@ void r300_init_surface_functions(struct r300_context* r300);
#define DBG_VP 0x0000004
#define DBG_CS 0x0000008
#define DBG_DRAW 0x0000010
-#define DBG_SURF 0x0000020
-#define DBG_TEX 0x0000040
-#define DBG_FALL 0x0000080
+#define DBG_TEX 0x0000020
+#define DBG_FALL 0x0000040
/*@}*/
static INLINE boolean DBG_ON(struct r300_context * ctx, unsigned flags)
diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c
index bfd4ab018a5..421253ca722 100644
--- a/src/gallium/drivers/r300/r300_debug.c
+++ b/src/gallium/drivers/r300/r300_debug.c
@@ -37,7 +37,6 @@ static struct debug_option debug_options[] = {
{ "vp", DBG_VP, "Vertex program handling" },
{ "cs", DBG_CS, "Command submissions" },
{ "draw", DBG_DRAW, "Draw and emit" },
- { "surf", DBG_SURF, "Surface drawing" },
{ "tex", DBG_TEX, "Textures" },
{ "fall", DBG_FALL, "Fallbacks" },
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 570b4c5ef7f..258c38fefdc 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -22,10 +22,15 @@
/* r300_emit: Functions for emitting state. */
-#include "r300_emit.h"
+#include "util/u_math.h"
+#include "r300_context.h"
+#include "r300_cs.h"
+#include "r300_emit.h"
#include "r300_fs.h"
+#include "r300_screen.h"
#include "r300_state_derived.h"
+#include "r300_state_inlines.h"
#include "r300_vs.h"
void r300_emit_blend_state(struct r300_context* r300,
@@ -106,7 +111,7 @@ void r300_emit_dsa_state(struct r300_context* r300,
OUT_CS(dsa->z_buffer_control);
OUT_CS(dsa->z_stencil_control);
OUT_CS(dsa->stencil_ref_mask);
- OUT_CS_REG(R300_ZB_ZTOP, dsa->z_buffer_top);
+ OUT_CS_REG(R300_ZB_ZTOP, r300->ztop_state.z_buffer_top);
if (r300screen->caps->is_r500) {
/* OUT_CS_REG(R500_ZB_STENCILREFMASK_BF, dsa->stencil_ref_bf); */
}
@@ -320,31 +325,37 @@ void r300_emit_fb_state(struct r300_context* r300,
END_CS;
}
-void r300_emit_query_begin(struct r300_context* r300,
- struct r300_query* query)
+static void r300_emit_query_start(struct r300_context *r300)
{
+ struct r300_capabilities *caps = r300_screen(r300->context.screen)->caps;
+ struct r300_query *query = r300->query_current;
CS_LOCALS(r300);
+ if (!query)
+ return;
+
/* XXX This will almost certainly not return good results
* for overlapping queries. */
- BEGIN_CS(2);
+ BEGIN_CS(4);
+ if (caps->family == CHIP_FAMILY_RV530) {
+ OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
+ } else {
+ OUT_CS_REG(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_ALL);
+ }
OUT_CS_REG(R300_ZB_ZPASS_DATA, 0);
END_CS;
+ query->begin_emitted = TRUE;
}
-void r300_emit_query_end(struct r300_context* r300,
- struct r300_query* query)
+
+static void r300_emit_query_finish(struct r300_context *r300,
+ struct r300_query *query)
{
struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
CS_LOCALS(r300);
- if (!r300->winsys->add_buffer(r300->winsys, r300->oqbo,
- 0, RADEON_GEM_DOMAIN_GTT)) {
- debug_printf("r300: There wasn't room for the OQ buffer!?"
- " Oh noes!\n");
- }
-
assert(caps->num_frag_pipes);
+
BEGIN_CS(6 * caps->num_frag_pipes + 2);
/* I'm not so sure I like this switch, but it's hard to be elegant
* when there's so many special cases...
@@ -381,7 +392,7 @@ void r300_emit_query_end(struct r300_context* r300,
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
OUT_CS_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 0),
0, RADEON_GEM_DOMAIN_GTT, 0);
- break;
+ break;
default:
debug_printf("r300: Implementation error: Chipset reports %d"
" pixel pipes!\n", caps->num_frag_pipes);
@@ -391,7 +402,55 @@ void r300_emit_query_end(struct r300_context* r300,
/* And, finally, reset it to normal... */
OUT_CS_REG(R300_SU_REG_DEST, 0xF);
END_CS;
+}
+static void rv530_emit_query_single(struct r300_context *r300,
+ struct r300_query *query)
+{
+ CS_LOCALS(r300);
+
+ BEGIN_CS(8);
+ OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
+ OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
+ OUT_CS_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
+ END_CS;
+}
+
+static void rv530_emit_query_double(struct r300_context *r300,
+ struct r300_query *query)
+{
+ CS_LOCALS(r300);
+
+ BEGIN_CS(14);
+ OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
+ OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
+ OUT_CS_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_1);
+ OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
+ OUT_CS_RELOC(r300->oqbo, query->offset + sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
+ END_CS;
+}
+
+void r300_emit_query_end(struct r300_context* r300)
+{
+ struct r300_capabilities *caps = r300_screen(r300->context.screen)->caps;
+ struct r300_query *query = r300->query_current;
+
+ if (!query)
+ return;
+
+ if (query->begin_emitted == FALSE)
+ return;
+
+ if (caps->family == CHIP_FAMILY_RV530) {
+ if (caps->num_z_pipes == 2)
+ rv530_emit_query_double(r300, query);
+ else
+ rv530_emit_query_single(r300, query);
+ } else
+ r300_emit_query_finish(r300, query);
}
void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs)
@@ -475,7 +534,8 @@ void r300_emit_texture(struct r300_context* r300,
CS_LOCALS(r300);
BEGIN_CS(16);
- OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), sampler->filter0);
+ OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), sampler->filter0 |
+ (offset << 28));
OUT_CS_REG(R300_TX_FILTER1_0 + (offset * 4), sampler->filter1);
OUT_CS_REG(R300_TX_BORDER_COLOR_0 + (offset * 4), sampler->border_color);
@@ -494,7 +554,7 @@ void r300_emit_vertex_buffer(struct r300_context* r300)
DBG(r300, DBG_DRAW, "r300: Preparing vertex buffer %p for render, "
"vertex size %d\n", r300->vbo,
- r300->vertex_info.vinfo.size);
+ r300->vertex_info->vinfo.size);
/* Set the pointer to our vertex buffer. The emitted values are this:
* PACKET3 [3D_LOAD_VBPNTR]
* COUNT [1]
@@ -505,8 +565,8 @@ void r300_emit_vertex_buffer(struct r300_context* r300)
BEGIN_CS(7);
OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, 3);
OUT_CS(1);
- OUT_CS(r300->vertex_info.vinfo.size |
- (r300->vertex_info.vinfo.size << 8));
+ OUT_CS(r300->vertex_info->vinfo.size |
+ (r300->vertex_info->vinfo.size << 8));
OUT_CS(r300->vbo_offset);
OUT_CS_RELOC(r300->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
END_CS;
@@ -518,30 +578,30 @@ void r300_emit_vertex_format_state(struct r300_context* r300)
CS_LOCALS(r300);
BEGIN_CS(26);
- OUT_CS_REG(R300_VAP_VTX_SIZE, r300->vertex_info.vinfo.size);
+ OUT_CS_REG(R300_VAP_VTX_SIZE, r300->vertex_info->vinfo.size);
OUT_CS_REG_SEQ(R300_VAP_VTX_STATE_CNTL, 2);
- OUT_CS(r300->vertex_info.vinfo.hwfmt[0]);
- OUT_CS(r300->vertex_info.vinfo.hwfmt[1]);
+ OUT_CS(r300->vertex_info->vinfo.hwfmt[0]);
+ OUT_CS(r300->vertex_info->vinfo.hwfmt[1]);
OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2);
- OUT_CS(r300->vertex_info.vinfo.hwfmt[2]);
- OUT_CS(r300->vertex_info.vinfo.hwfmt[3]);
+ OUT_CS(r300->vertex_info->vinfo.hwfmt[2]);
+ OUT_CS(r300->vertex_info->vinfo.hwfmt[3]);
/* for (i = 0; i < 4; i++) {
* debug_printf("hwfmt%d: 0x%08x\n", i,
- * r300->vertex_info.vinfo.hwfmt[i]);
+ * r300->vertex_info->vinfo.hwfmt[i]);
* } */
OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0, 8);
for (i = 0; i < 8; i++) {
- OUT_CS(r300->vertex_info.vap_prog_stream_cntl[i]);
+ OUT_CS(r300->vertex_info->vap_prog_stream_cntl[i]);
/* debug_printf("prog_stream_cntl%d: 0x%08x\n", i,
- * r300->vertex_info.vap_prog_stream_cntl[i]); */
+ * r300->vertex_info->vap_prog_stream_cntl[i]); */
}
OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_EXT_0, 8);
for (i = 0; i < 8; i++) {
- OUT_CS(r300->vertex_info.vap_prog_stream_cntl_ext[i]);
+ OUT_CS(r300->vertex_info->vap_prog_stream_cntl_ext[i]);
/* debug_printf("prog_stream_cntl_ext%d: 0x%08x\n", i,
- * r300->vertex_info.vap_prog_stream_cntl_ext[i]); */
+ * r300->vertex_info->vap_prog_stream_cntl_ext[i]); */
}
END_CS;
}
@@ -658,6 +718,9 @@ void r300_emit_dirty_state(struct r300_context* r300)
r300_update_derived_state(r300);
+ /* Clean out BOs. */
+ r300->winsys->reset_bos(r300->winsys);
+
/* XXX check size */
validate:
/* Color buffers... */
@@ -683,7 +746,8 @@ validate:
/* ...textures... */
for (i = 0; i < r300->texture_count; i++) {
tex = r300->textures[i];
- assert(tex && tex->buffer && "texture is marked, but NULL!");
+ if (!tex)
+ continue;
if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
r300->context.flush(&r300->context, 0, NULL);
@@ -717,6 +781,11 @@ validate:
goto validate;
}
+ if (r300->dirty_state & R300_NEW_QUERY) {
+ r300_emit_query_start(r300);
+ r300->dirty_state &= ~R300_NEW_QUERY;
+ }
+
if (r300->dirty_state & R300_NEW_BLEND) {
r300_emit_blend_state(r300, r300->blend_state);
r300->dirty_state &= ~R300_NEW_BLEND;
@@ -770,12 +839,13 @@ validate:
if (r300->dirty_state &
(R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES)) {
for (i = 0; i < MIN2(r300->sampler_count, r300->texture_count); i++) {
- if (r300->dirty_state &
- ((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i))) {
- r300_emit_texture(r300,
- r300->sampler_states[i],
- r300->textures[i],
- i);
+ if (r300->dirty_state &
+ ((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i))) {
+ if (r300->textures[i])
+ r300_emit_texture(r300,
+ r300->sampler_states[i],
+ r300->textures[i],
+ i);
r300->dirty_state &=
~((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i));
dirty_tex++;
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index c4002b8e5d0..02ac5bebbd9 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -23,13 +23,6 @@
#ifndef R300_EMIT_H
#define R300_EMIT_H
-#include "util/u_math.h"
-
-#include "r300_context.h"
-#include "r300_cs.h"
-#include "r300_screen.h"
-#include "r300_state_inlines.h"
-
struct rX00_fragment_program_code;
struct r300_vertex_program_code;
@@ -58,8 +51,8 @@ void r300_emit_fb_state(struct r300_context* r300,
void r300_emit_query_begin(struct r300_context* r300,
struct r300_query* query);
-void r300_emit_query_end(struct r300_context* r300,
- struct r300_query* query);
+
+void r300_emit_query_end(struct r300_context* r300);
void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs);
diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
index 0dff1c6f4fb..14a08241fc4 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -20,29 +20,48 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "draw/draw_context.h"
+#include "draw/draw_private.h"
+
+#include "util/u_simple_list.h"
+
+#include "r300_context.h"
+#include "r300_cs.h"
+#include "r300_emit.h"
#include "r300_flush.h"
+#include "r300_state_invariant.h"
static void r300_flush(struct pipe_context* pipe,
unsigned flags,
struct pipe_fence_handle** fence)
{
- struct r300_context* r300 = r300_context(pipe);
- CS_LOCALS(r300);
+ struct r300_context *r300 = r300_context(pipe);
+ struct r300_query *query;
+ CS_LOCALS(r300);
/* We probably need to flush Draw, but we may have been called from
- * within Draw. This feels kludgy, but it might be the best thing. */
- if (!r300->draw->flushing) {
+ * within Draw. This feels kludgy, but it might be the best thing.
+ *
+ * Of course, the best thing is to kill Draw with fire. :3 */
+ if (r300->draw && !r300->draw->flushing) {
draw_flush(r300->draw);
}
+ r300_emit_query_end(r300);
+
if (r300->dirty_hw) {
FLUSH_CS;
r300_emit_invariant_state(r300);
r300->dirty_state = R300_NEW_KITCHEN_SINK;
r300->dirty_hw = 0;
}
+ /* reset flushed query */
+ foreach(query, &r300->query_list) {
+ query->flushed = TRUE;
+ }
}
+
void r300_init_flush_functions(struct r300_context* r300)
{
r300->context.flush = r300_flush;
diff --git a/src/gallium/drivers/r300/r300_flush.h b/src/gallium/drivers/r300/r300_flush.h
index 9a83d89daab..0e9e6106bb7 100644
--- a/src/gallium/drivers/r300/r300_flush.h
+++ b/src/gallium/drivers/r300/r300_flush.h
@@ -23,13 +23,6 @@
#ifndef R300_FLUSH_H
#define R300_FLUSH_H
-#include "draw/draw_private.h"
-
-#include "pipe/p_context.h"
-
-#include "r300_context.h"
-#include "r300_cs.h"
-
void r300_init_flush_functions(struct r300_context* r300);
#endif /* R300_FLUSH_H */
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c
index 546ad545a53..29ddc84c411 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -21,10 +21,14 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#include "r300_fs.h"
+#include "tgsi/tgsi_dump.h"
+#include "r300_context.h"
+#include "r300_screen.h"
+#include "r300_fs.h"
#include "r300_tgsi_to_rc.h"
+#include "radeon_code.h"
#include "radeon_compiler.h"
static void find_output_registers(struct r300_fragment_program_compiler * compiler,
@@ -126,14 +130,9 @@ void r300_translate_fragment_shader(struct r300_context* r300,
/* Invoke the compiler */
r3xx_compile_fragment_program(&compiler);
if (compiler.Base.Error) {
- /* Todo: Fallback to software rendering gracefully? */
- fprintf(stderr, "r300 FP: Compiler error: %s\n", compiler.Base.ErrorMsg);
-
- if (compiler.is_r500) {
- memcpy(compiler.code, &r5xx_passthrough_fragment_shader, sizeof(r5xx_passthrough_fragment_shader));
- } else {
- memcpy(compiler.code, &r3xx_passthrough_fragment_shader, sizeof(r3xx_passthrough_fragment_shader));
- }
+ /* XXX failover maybe? */
+ DBG(r300, DBG_FP, "r300: Error compiling fragment program: %s\n",
+ compiler.Base.ErrorMsg);
}
/* And, finally... */
diff --git a/src/gallium/drivers/r300/r300_fs.h b/src/gallium/drivers/r300/r300_fs.h
index 967e9f697e9..e831c30301b 100644
--- a/src/gallium/drivers/r300/r300_fs.h
+++ b/src/gallium/drivers/r300/r300_fs.h
@@ -24,11 +24,9 @@
#ifndef R300_FS_H
#define R300_FS_H
-#include "tgsi/tgsi_dump.h"
+#include "pipe/p_state.h"
-#include "r300_context.h"
-#include "r3xx_fs.h"
-#include "r5xx_fs.h"
+#include "tgsi/tgsi_scan.h"
#include "radeon_code.h"
@@ -48,4 +46,10 @@ struct r300_fragment_shader {
void r300_translate_fragment_shader(struct r300_context* r300,
struct r300_fragment_shader* fs);
+static inline boolean r300_fragment_shader_writes_depth(struct r300_fragment_shader *fs)
+{
+ if (!fs)
+ return FALSE;
+ return (fs->code.writes_depth) ? TRUE : FALSE;
+}
#endif /* R300_FS_H */
diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
index 2880d34877f..007f11efae6 100644
--- a/src/gallium/drivers/r300/r300_query.c
+++ b/src/gallium/drivers/r300/r300_query.c
@@ -20,17 +20,23 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#include "r300_query.h"
+#include "util/u_memory.h"
+#include "util/u_simple_list.h"
+#include "r300_context.h"
+#include "r300_screen.h"
+#include "r300_cs.h"
#include "r300_emit.h"
+#include "r300_query.h"
+#include "r300_reg.h"
-static struct pipe_query* r300_create_query(struct pipe_context* pipe,
+static struct pipe_query *r300_create_query(struct pipe_context *pipe,
unsigned query_type)
{
- struct r300_context* r300 = r300_context(pipe);
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
- unsigned query_size = r300screen->caps->num_frag_pipes * 4;
- struct r300_query* q, * qptr;
+ struct r300_context *r300 = r300_context(pipe);
+ struct r300_screen *r300screen = r300_screen(r300->context.screen);
+ unsigned query_size;
+ struct r300_query *q, *qptr;
q = CALLOC_STRUCT(r300_query);
@@ -39,13 +45,16 @@ static struct pipe_query* r300_create_query(struct pipe_context* pipe,
q->active = FALSE;
- if (!r300->query_list) {
- r300->query_list = q;
- } else if (!is_empty_list(r300->query_list)) {
- qptr = last_elem(r300->query_list);
+ if (r300screen->caps->family == CHIP_FAMILY_RV530)
+ query_size = r300screen->caps->num_z_pipes * sizeof(uint32_t);
+ else
+ query_size = r300screen->caps->num_frag_pipes * sizeof(uint32_t);
+
+ if (!is_empty_list(&r300->query_list)) {
+ qptr = last_elem(&r300->query_list);
q->offset = qptr->offset + query_size;
- insert_at_tail(r300->query_list, q);
}
+ insert_at_tail(&r300->query_list, q);
/* XXX */
if (q->offset >= 4096) {
@@ -71,24 +80,26 @@ static void r300_begin_query(struct pipe_context* pipe,
struct r300_context* r300 = r300_context(pipe);
struct r300_query* q = (struct r300_query*)query;
+ assert(r300->query_current == NULL);
+
map = pipe->screen->buffer_map(pipe->screen, r300->oqbo,
PIPE_BUFFER_USAGE_CPU_WRITE);
map += q->offset / 4;
- *map = ~0;
+ *map = ~0U;
pipe->screen->buffer_unmap(pipe->screen, r300->oqbo);
- r300_emit_dirty_state(r300);
- r300_emit_query_begin(r300, q);
+ q->flushed = FALSE;
+ r300->query_current = q;
+ r300->dirty_state |= R300_NEW_QUERY;
}
static void r300_end_query(struct pipe_context* pipe,
- struct pipe_query* query)
+ struct pipe_query* query)
{
struct r300_context* r300 = r300_context(pipe);
- struct r300_query* q = (struct r300_query*)query;
- r300_emit_dirty_state(r300);
- r300_emit_query_end(r300, q);
+ r300_emit_query_end(r300);
+ r300->query_current = NULL;
}
static boolean r300_get_query_result(struct pipe_context* pipe,
@@ -98,28 +109,30 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
struct r300_screen* r300screen = r300_screen(r300->context.screen);
- struct r300_query* q = (struct r300_query*)query;
+ struct r300_query *q = (struct r300_query*)query;
unsigned flags = PIPE_BUFFER_USAGE_CPU_READ;
uint32_t* map;
- uint32_t temp;
+ uint32_t temp = 0;
unsigned i;
- if (wait) {
+ if (q->flushed == FALSE)
pipe->flush(pipe, 0, NULL);
- } else {
+ if (!wait) {
flags |= PIPE_BUFFER_USAGE_DONTBLOCK;
}
map = pipe->screen->buffer_map(pipe->screen, r300->oqbo, flags);
+ if (!map)
+ return FALSE;
map += q->offset / 4;
for (i = 0; i < r300screen->caps->num_frag_pipes; i++) {
- if (*map == ~0) {
+ if (*map == ~0U) {
/* Looks like our results aren't ready yet. */
if (wait) {
debug_printf("r300: Despite waiting, OQ results haven't"
" come in yet.\n");
}
- temp = ~0;
+ temp = ~0U;
break;
}
temp += *map;
@@ -127,7 +140,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
}
pipe->screen->buffer_unmap(pipe->screen, r300->oqbo);
- if (temp == ~0) {
+ if (temp == ~0U) {
/* Our results haven't been written yet... */
return FALSE;
}
diff --git a/src/gallium/drivers/r300/r300_query.h b/src/gallium/drivers/r300/r300_query.h
index 4f50e8f8440..48876da3123 100644
--- a/src/gallium/drivers/r300/r300_query.h
+++ b/src/gallium/drivers/r300/r300_query.h
@@ -23,10 +23,6 @@
#ifndef R300_QUERY_H
#define R300_QUERY_H
-#include "r300_context.h"
-#include "r300_cs.h"
-#include "r300_reg.h"
-
struct r300_context;
static INLINE struct r300_query* r300_query(struct pipe_query* q)
diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
index 3abff5db622..e920b2a5e77 100644
--- a/src/gallium/drivers/r300/r300_reg.h
+++ b/src/gallium/drivers/r300/r300_reg.h
@@ -348,6 +348,27 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_WRITE_ENA_W 8
# define R300_SWIZZLE1_SHIFT 16
+# define R300_VAP_SWIZZLE_X001 \
+ ((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | \
+ (R300_SWIZZLE_SELECT_FP_ZERO << R300_SWIZZLE_SELECT_Y_SHIFT) | \
+ (R300_SWIZZLE_SELECT_FP_ZERO << R300_SWIZZLE_SELECT_Z_SHIFT) | \
+ (R300_SWIZZLE_SELECT_FP_ONE << R300_SWIZZLE_SELECT_W_SHIFT) | \
+ (0xf << R300_WRITE_ENA_SHIFT))
+
+# define R300_VAP_SWIZZLE_XY01 \
+ ((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | \
+ (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | \
+ (R300_SWIZZLE_SELECT_FP_ZERO << R300_SWIZZLE_SELECT_Z_SHIFT) | \
+ (R300_SWIZZLE_SELECT_FP_ONE << R300_SWIZZLE_SELECT_W_SHIFT) | \
+ (0xf << R300_WRITE_ENA_SHIFT))
+
+# define R300_VAP_SWIZZLE_XYZ1 \
+ ((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | \
+ (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | \
+ (R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_SHIFT) | \
+ (R300_SWIZZLE_SELECT_FP_ONE << R300_SWIZZLE_SELECT_W_SHIFT) | \
+ (0xf << R300_WRITE_ENA_SHIFT))
+
# define R300_VAP_SWIZZLE_XYZW \
((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | \
(R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | \
@@ -1172,6 +1193,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* SU Depth Offset value */
#define R300_SU_DEPTH_OFFSET 0x42c4
+#define R300_SU_REG_DEST 0x42c8
+# define R300_RASTER_PIPE_SELECT_0 (1 << 0)
+# define R300_RASTER_PIPE_SELECT_1 (1 << 1)
+# define R300_RASTER_PIPE_SELECT_2 (1 << 2)
+# define R300_RASTER_PIPE_SELECT_3 (1 << 3)
+# define R300_RASTER_PIPE_SELECT_ALL 0xf
+
/* BEGIN: Rasterization / Interpolators - many guesses */
@@ -2095,6 +2123,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R500_FG_ALPHA_VALUE 0x4be0
# define R500_FG_ALPHA_VALUE_MASK 0x0000ffff
+#define RV530_FG_ZBREG_DEST 0x4be8
+# define RV530_FG_ZBREG_DEST_PIPE_SELECT_0 (1 << 0)
+# define RV530_FG_ZBREG_DEST_PIPE_SELECT_1 (1 << 1)
+# define RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL (3 << 0)
/* gap */
/* Fragment program parameters in 7.16 floating point */
@@ -3313,10 +3345,6 @@ enum {
#define R200_3D_DRAW_IMMD_2 0xC0003500
-/* XXX Oh look, stuff not brought over from docs yet */
-
-#define R300_SU_REG_DEST 0x42C8
-
#endif /* _R300_REG_H */
/* *INDENT-ON* */
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index ca44e0f6615..6e2bcc62dac 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -20,19 +20,214 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#include "draw/draw_pipe.h"
+#include "draw/draw_context.h"
#include "draw/draw_vbuf.h"
+
+#include "pipe/p_inlines.h"
+
#include "util/u_memory.h"
#include "r300_cs.h"
#include "r300_context.h"
#include "r300_emit.h"
#include "r300_reg.h"
+#include "r300_render.h"
#include "r300_state_derived.h"
/* r300_render: Vertex and index buffer primitive emission. */
#define R300_MAX_VBO_SIZE (1024 * 1024)
+static uint32_t r300_translate_primitive(unsigned prim)
+{
+ switch (prim) {
+ case PIPE_PRIM_POINTS:
+ return R300_VAP_VF_CNTL__PRIM_POINTS;
+ case PIPE_PRIM_LINES:
+ return R300_VAP_VF_CNTL__PRIM_LINES;
+ case PIPE_PRIM_LINE_LOOP:
+ return R300_VAP_VF_CNTL__PRIM_LINE_LOOP;
+ case PIPE_PRIM_LINE_STRIP:
+ return R300_VAP_VF_CNTL__PRIM_LINE_STRIP;
+ case PIPE_PRIM_TRIANGLES:
+ return R300_VAP_VF_CNTL__PRIM_TRIANGLES;
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ return R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP;
+ case PIPE_PRIM_TRIANGLE_FAN:
+ return R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN;
+ case PIPE_PRIM_QUADS:
+ return R300_VAP_VF_CNTL__PRIM_QUADS;
+ case PIPE_PRIM_QUAD_STRIP:
+ return R300_VAP_VF_CNTL__PRIM_QUAD_STRIP;
+ case PIPE_PRIM_POLYGON:
+ return R300_VAP_VF_CNTL__PRIM_POLYGON;
+ default:
+ return 0;
+ }
+}
+
+/* This is the fast-path drawing & emission for HW TCL. */
+boolean r300_draw_range_elements(struct pipe_context* pipe,
+ struct pipe_buffer* indexBuffer,
+ unsigned indexSize,
+ unsigned minIndex,
+ unsigned maxIndex,
+ unsigned mode,
+ unsigned start,
+ unsigned count)
+{
+ struct r300_context* r300 = r300_context(pipe);
+ CS_LOCALS(r300);
+ uint32_t prim = r300_translate_primitive(mode);
+ struct pipe_vertex_buffer* aos = r300->vertex_buffers;
+ unsigned aos_count = r300->vertex_buffer_count;
+ short* indices;
+ unsigned packet_size;
+ unsigned i;
+ bool invalid = FALSE;
+
+validate:
+ for (i = 0; i < aos_count; i++) {
+ if (!r300->winsys->add_buffer(r300->winsys, aos[i].buffer,
+ RADEON_GEM_DOMAIN_GTT, 0)) {
+ pipe->flush(pipe, 0, NULL);
+ goto validate;
+ }
+ }
+ if (!r300->winsys->validate(r300->winsys)) {
+ pipe->flush(pipe, 0, NULL);
+ if (invalid) {
+ /* Well, hell. */
+ debug_printf("r300: Stuck in validation loop, gonna quit now.");
+ exit(1);
+ }
+ invalid = TRUE;
+ goto validate;
+ }
+
+ r300_emit_dirty_state(r300);
+
+ packet_size = (aos_count >> 1) * 3 + (aos_count & 1) * 2;
+
+ BEGIN_CS(3 + packet_size + (aos_count * 2));
+ OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size);
+ OUT_CS(aos_count);
+ for (i = 0; i < aos_count - 1; i += 2) {
+ OUT_CS(aos[i].stride |
+ (aos[i].stride << 8) |
+ (aos[i + 1].stride << 16) |
+ (aos[i + 1].stride << 24));
+ OUT_CS(aos[i].buffer_offset + start * 4 * aos[i].stride);
+ OUT_CS(aos[i + 1].buffer_offset + start * 4 * aos[i + 1].stride);
+ }
+ if (aos_count & 1) {
+ OUT_CS(aos[i].stride | (aos[i].stride << 8));
+ OUT_CS(aos[i].buffer_offset + start * 4 * aos[i].stride);
+ }
+ for (i = 0; i < aos_count; i++) {
+ OUT_CS_RELOC(aos[i].buffer, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
+ }
+ END_CS;
+
+ if (indexBuffer) {
+ indices = (short*)pipe_buffer_map(pipe->screen, indexBuffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
+
+ /* Set the starting point. */
+ indices += start;
+
+ BEGIN_CS(2 + (count+1)/2);
+ OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, (count + 1)/2);
+ OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | prim);
+ for (i = 0; i < count - 1; i += 2) {
+ OUT_CS(indices[i + 1] << 16 | indices[i]);
+ }
+ if (count % 2) {
+ OUT_CS(indices[count - 1]);
+ }
+ END_CS;
+ } else {
+ BEGIN_CS(2);
+ OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0);
+ OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) |
+ prim);
+ END_CS;
+ }
+
+ return TRUE;
+}
+
+/* Simple helpers for context setup. Should probably be moved to util. */
+boolean r300_draw_elements(struct pipe_context* pipe,
+ struct pipe_buffer* indexBuffer,
+ unsigned indexSize, unsigned mode,
+ unsigned start, unsigned count)
+{
+ return pipe->draw_range_elements(pipe, indexBuffer, indexSize, 0, ~0,
+ mode, start, count);
+}
+
+boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
+ unsigned start, unsigned count)
+{
+ return pipe->draw_elements(pipe, NULL, 0, mode, start, count);
+}
+
+/****************************************************************************
+ * The rest of this file is for SW TCL rendering only. Please be polite and *
+ * keep these functions separated so that they are easier to locate. ~C. *
+ ***************************************************************************/
+
+/* Draw-based drawing for SW TCL chipsets. */
+boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe,
+ struct pipe_buffer* indexBuffer,
+ unsigned indexSize,
+ unsigned minIndex,
+ unsigned maxIndex,
+ unsigned mode,
+ unsigned start,
+ unsigned count)
+{
+ struct r300_context* r300 = r300_context(pipe);
+ int i;
+
+ for (i = 0; i < r300->vertex_buffer_count; i++) {
+ void* buf = pipe_buffer_map(pipe->screen,
+ r300->vertex_buffers[i].buffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
+ draw_set_mapped_vertex_buffer(r300->draw, i, buf);
+ }
+
+ if (indexBuffer) {
+ void* indices = pipe_buffer_map(pipe->screen, indexBuffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
+ draw_set_mapped_element_buffer_range(r300->draw, indexSize,
+ minIndex, maxIndex, indices);
+ } else {
+ draw_set_mapped_element_buffer(r300->draw, 0, NULL);
+ }
+
+ draw_set_mapped_constant_buffer(r300->draw,
+ r300->shader_constants[PIPE_SHADER_VERTEX].constants,
+ r300->shader_constants[PIPE_SHADER_VERTEX].count *
+ (sizeof(float) * 4));
+
+ draw_arrays(r300->draw, mode, start, count);
+
+ for (i = 0; i < r300->vertex_buffer_count; i++) {
+ pipe_buffer_unmap(pipe->screen, r300->vertex_buffers[i].buffer);
+ draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
+ }
+
+ if (indexBuffer) {
+ pipe_buffer_unmap(pipe->screen, indexBuffer);
+ draw_set_mapped_element_buffer_range(r300->draw, 0, start,
+ start + count - 1, NULL);
+ }
+
+ return TRUE;
+}
+
+/* Object for rendering using Draw. */
struct r300_render {
/* Parent class */
struct vbuf_render base;
@@ -67,7 +262,7 @@ r300_render_get_vertex_info(struct vbuf_render* render)
r300_update_derived_state(r300);
- return &r300->vertex_info.vinfo;
+ return &r300->vertex_info->vinfo;
}
static boolean r300_render_allocate_vertices(struct vbuf_render* render,
@@ -127,7 +322,6 @@ static void r300_render_unmap_vertices(struct vbuf_render* render,
static void r300_render_release_vertices(struct vbuf_render* render)
{
struct r300_render* r300render = r300_render(render);
- struct r300_context* r300 = r300render->r300;
r300render->vbo_offset += r300render->vbo_max_used;
r300render->vbo_max_used = 0;
@@ -137,56 +331,13 @@ static boolean r300_render_set_primitive(struct vbuf_render* render,
unsigned prim)
{
struct r300_render* r300render = r300_render(render);
- r300render->prim = prim;
- switch (prim) {
- case PIPE_PRIM_POINTS:
- r300render->hwprim = R300_VAP_VF_CNTL__PRIM_POINTS;
- break;
- case PIPE_PRIM_LINES:
- r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINES;
- break;
- case PIPE_PRIM_LINE_LOOP:
- r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINE_LOOP;
- break;
- case PIPE_PRIM_LINE_STRIP:
- r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINE_STRIP;
- break;
- case PIPE_PRIM_TRIANGLES:
- r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLES;
- break;
- case PIPE_PRIM_TRIANGLE_STRIP:
- r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP;
- break;
- case PIPE_PRIM_TRIANGLE_FAN:
- r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN;
- break;
- case PIPE_PRIM_QUADS:
- r300render->hwprim = R300_VAP_VF_CNTL__PRIM_QUADS;
- break;
- case PIPE_PRIM_QUAD_STRIP:
- r300render->hwprim = R300_VAP_VF_CNTL__PRIM_QUAD_STRIP;
- break;
- case PIPE_PRIM_POLYGON:
- r300render->hwprim = R300_VAP_VF_CNTL__PRIM_POLYGON;
- break;
- default:
- return FALSE;
- break;
- }
+ r300render->prim = prim;
+ r300render->hwprim = r300_translate_primitive(prim);
return TRUE;
}
-static void r300_prepare_render(struct r300_render* render, unsigned count)
-{
- struct r300_context* r300 = render->r300;
-
- CS_LOCALS(r300);
-
- r300_emit_dirty_state(r300);
-}
-
static void r300_render_draw_arrays(struct vbuf_render* render,
unsigned start,
unsigned count)
@@ -196,7 +347,7 @@ static void r300_render_draw_arrays(struct vbuf_render* render,
CS_LOCALS(r300);
- r300_prepare_render(r300render, count);
+ r300_emit_dirty_state(r300);
DBG(r300, DBG_DRAW, "r300: Doing vbuf render, count %d\n", count);
@@ -213,15 +364,11 @@ static void r300_render_draw(struct vbuf_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;
- void* index_map;
int i;
- uint32_t index;
CS_LOCALS(r300);
- r300_prepare_render(r300render, count);
+ r300_emit_dirty_state(r300);
BEGIN_CS(2 + (count+1)/2);
OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, (count+1)/2);
diff --git a/src/gallium/drivers/r300/r300_render.h b/src/gallium/drivers/r300/r300_render.h
new file mode 100644
index 00000000000..3d8f47ba75f
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_render.h
@@ -0,0 +1,52 @@
+/*
+ * 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_RENDER_H
+#define R300_RENDER_H
+
+boolean r300_draw_range_elements(struct pipe_context* pipe,
+ struct pipe_buffer* indexBuffer,
+ unsigned indexSize,
+ unsigned minIndex,
+ unsigned maxIndex,
+ unsigned mode,
+ unsigned start,
+ unsigned count);
+
+boolean r300_draw_elements(struct pipe_context* pipe,
+ struct pipe_buffer* indexBuffer,
+ unsigned indexSize, unsigned mode,
+ unsigned start, unsigned count);
+
+boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
+ unsigned start, unsigned count);
+
+boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe,
+ struct pipe_buffer* indexBuffer,
+ unsigned indexSize,
+ unsigned minIndex,
+ unsigned maxIndex,
+ unsigned mode,
+ unsigned start,
+ unsigned count);
+
+#endif /* R300_RENDER_H */
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 7d154576e04..1d9f91d0f73 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -20,7 +20,14 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "pipe/p_inlines.h"
+#include "util/u_memory.h"
+#include "util/u_simple_screen.h"
+
+#include "r300_context.h"
#include "r300_screen.h"
+#include "r300_texture.h"
+#include "r300_winsys.h"
/* Return the identifier behind whom the brave coders responsible for this
* amalgamation of code, sweat, and duct tape, routinely obscure their names.
@@ -73,13 +80,10 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
struct r300_screen* r300screen = r300_screen(pscreen);
switch (param) {
- /* XXX cases marked "IN THEORY" are possible on the hardware,
- * but haven't been implemented yet. */
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
/* XXX I'm told this goes up to 16 */
return 8;
case PIPE_CAP_NPOT_TEXTURES:
- /* IN THEORY */
return 0;
case PIPE_CAP_TWO_SIDED_STENCIL:
if (r300screen->caps->is_r500) {
@@ -88,16 +92,26 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
return 0;
}
case PIPE_CAP_GLSL:
- if (r300screen->caps->is_r500) {
- return 1;
- } else {
- return 0;
- }
+ /* I'll be frank. This is a lie.
+ *
+ * We don't truly support GLSL on any of this driver's chipsets.
+ * To be fair, no chipset supports the full GLSL specification
+ * to the best of our knowledge, but some of the less esoteric
+ * features are still missing here.
+ *
+ * Rather than cripple ourselves intentionally, I'm going to set
+ * this flag, and as Gallium's interface continues to change, I
+ * hope that this single monolithic GLSL enable can slowly get
+ * split down into many different pieces and the state tracker
+ * will handle fallbacks transparently, like it should.
+ *
+ * ~ C.
+ */
+ return 1;
case PIPE_CAP_ANISOTROPIC_FILTER:
return 1;
case PIPE_CAP_POINT_SPRITE:
- /* IN THEORY */
- return 0;
+ return 1;
case PIPE_CAP_MAX_RENDER_TARGETS:
return 4;
case PIPE_CAP_OCCLUSION_QUERY:
@@ -138,10 +152,8 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
return 1;
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
- /* XXX guessing (what a terrible guess) */
- return 2;
+ return 0;
case PIPE_CAP_TGSI_CONT_SUPPORTED:
- /* XXX */
return 0;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
@@ -222,6 +234,7 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage,
/* Z buffer or texture */
case PIPE_FORMAT_Z16_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
/* Z buffer with stencil or texture */
case PIPE_FORMAT_Z24S8_UNORM:
retval = usage &
@@ -231,7 +244,7 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage,
/* Definitely unsupported formats. */
/* Non-usable Z buffer/stencil formats. */
- case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z32_UNORM:
case PIPE_FORMAT_S8Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
debug_printf("r300: Note: Got unsupported format: %s in %s\n",
@@ -241,7 +254,6 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage,
/* XXX These don't even exist
case PIPE_FORMAT_A32R32G32B32:
case PIPE_FORMAT_A16R16G16B16: */
- /* XXX Insert YUV422 packed VYUY and YVYU here */
/* XXX What the deuce is UV88? (r3xx accel page 14)
debug_printf("r300: Warning: Got unimplemented format: %s in %s\n",
pf_name(format), __FUNCTION__);
@@ -310,7 +322,7 @@ r300_get_tex_transfer(struct pipe_screen *screen,
{
struct r300_texture *tex = (struct r300_texture *)texture;
struct r300_transfer *trans;
- unsigned offset; /* in bytes */
+ unsigned offset = 0; /* in bytes */
/* XXX Add support for these things */
if (texture->target == PIPE_TEXTURE_CUBE) {
@@ -395,6 +407,7 @@ struct pipe_screen* r300_create_screen(struct r300_winsys* r300_winsys)
caps->pci_id = r300_winsys->pci_id;
caps->num_frag_pipes = r300_winsys->gb_pipes;
+ caps->num_z_pipes = r300_winsys->z_pipes;
r300_parse_chipset(caps);
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index 2a0e41fbc3b..41df31f670f 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -23,14 +23,9 @@
#ifndef R300_SCREEN_H
#define R300_SCREEN_H
-#include "pipe/p_inlines.h"
#include "pipe/p_screen.h"
-#include "util/u_memory.h"
-#include "util/u_simple_screen.h"
#include "r300_chipset.h"
-#include "r300_texture.h"
-#include "r300_winsys.h"
struct r300_screen {
/* Parent class */
diff --git a/src/gallium/drivers/r300/r300_shader_inlines.h b/src/gallium/drivers/r300/r300_shader_inlines.h
deleted file mode 100644
index a04f45b03e2..00000000000
--- a/src/gallium/drivers/r300/r300_shader_inlines.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
- * Joakim Sindholt <opensource@zhasha.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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_SHADER_INLINES_H
-#define R300_SHADER_INLINES_H
-
-/* TGSI constants. TGSI is like XML: If it can't solve your problems, you're
- * not using enough of it. */
-static const struct tgsi_full_src_register 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,
-};
-
-static const struct tgsi_full_src_register r300_constant_one = {
- .SrcRegister.Extended = TRUE,
- .SrcRegister.File = TGSI_FILE_NULL,
- .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ONE,
- .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ONE,
- .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ONE,
- .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ONE,
-};
-
-#endif /* R300_SHADER_INLINES_H */
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 3cef285dee8..a3e1bc621a5 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -20,8 +20,10 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#include "util/u_debug.h"
+#include "draw/draw_context.h"
+
#include "util/u_math.h"
+#include "util/u_memory.h"
#include "util/u_pack_color.h"
#include "tgsi/tgsi_parse.h"
@@ -31,6 +33,7 @@
#include "r300_context.h"
#include "r300_reg.h"
+#include "r300_screen.h"
#include "r300_state_inlines.h"
#include "r300_fs.h"
#include "r300_vs.h"
@@ -247,9 +250,6 @@ static void*
R300_FG_ALPHA_FUNC_ENABLE;
dsa->alpha_reference = CLAMP(state->alpha.ref_value * 1023.0f,
0, 1023);
- } else {
- /* XXX need to fix this to be dynamically set
- dsa->z_buffer_top = R300_ZTOP_ENABLE; */
}
return (void*)dsa;
@@ -332,7 +332,7 @@ static void r300_delete_fs_state(struct pipe_context* pipe, void* shader)
{
struct r300_fragment_shader* fs = (struct r300_fragment_shader*)shader;
rc_constants_destroy(&fs->code.constants);
- FREE(fs->state.tokens);
+ FREE((void*)fs->state.tokens);
FREE(shader);
}
@@ -700,7 +700,7 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
rc_constants_destroy(&vs->code.constants);
draw_delete_vertex_shader(r300->draw, vs->draw);
- FREE(vs->state.tokens);
+ FREE((void*)vs->state.tokens);
FREE(shader);
} else {
draw_delete_vertex_shader(r300->draw,
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 02b7ab91076..7d000e9e2da 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -20,15 +20,47 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#include "r300_state_derived.h"
+#include "draw/draw_context.h"
+
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "r300_context.h"
#include "r300_fs.h"
+#include "r300_screen.h"
+#include "r300_state_derived.h"
#include "r300_state_inlines.h"
#include "r300_vs.h"
/* r300_state_derived: Various bits of state which are dependent upon
* currently bound CSO data. */
+struct r300_shader_key {
+ struct r300_vertex_shader* vs;
+ struct r300_fragment_shader* fs;
+};
+
+struct r300_shader_derived_value {
+ struct r300_vertex_format* vformat;
+ struct r300_rs_block* rs_block;
+};
+
+unsigned r300_shader_key_hash(void* key) {
+ struct r300_shader_key* shader_key = (struct r300_shader_key*)key;
+ unsigned vs = (unsigned)shader_key->vs;
+ unsigned fs = (unsigned)shader_key->fs;
+
+ return (vs << 16) | (fs & 0xffff);
+}
+
+int r300_shader_key_compare(void* key1, void* key2) {
+ struct r300_shader_key* shader_key1 = (struct r300_shader_key*)key1;
+ struct r300_shader_key* shader_key2 = (struct r300_shader_key*)key2;
+
+ return (shader_key1->vs == shader_key2->vs) &&
+ (shader_key1->fs == shader_key2->fs);
+}
+
/* Set up the vs_tab and routes. */
static void r300_vs_tab_routes(struct r300_context* r300,
struct r300_vertex_format* vformat)
@@ -192,8 +224,9 @@ static void r300_vertex_psc(struct r300_context* r300,
struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct vertex_info* vinfo = &vformat->vinfo;
int* tab = vformat->vs_tab;
- uint32_t temp;
- int i, attrib_count;
+ uint16_t type, swizzle;
+ enum pipe_format format;
+ unsigned i, attrib_count;
/* Vertex shaders have no semantics on their inputs,
* so PSC should just route stuff based on their info,
@@ -214,64 +247,43 @@ static void r300_vertex_psc(struct r300_context* r300,
}
for (i = 0; i < attrib_count; i++) {
- /* Make sure we have a proper destination for our attribute */
+ /* Make sure we have a proper destination for our attribute. */
assert(tab[i] != -1);
- /* Add the attribute to the PSC table. */
- temp = r300screen->caps->has_tcl ?
- R300_DATA_TYPE_FLOAT_4 :
- translate_vertex_data_type(vinfo->attrib[i].emit);
- temp |= tab[i] << R300_DST_VEC_LOC_SHIFT;
+ format = draw_translate_vinfo_format(vinfo->attrib[i].emit);
+ /* Obtain the type of data in this attribute. */
+ type = r300_translate_vertex_data_type(format) |
+ tab[i] << R300_DST_VEC_LOC_SHIFT;
+
+ /* Obtain the swizzle for this attribute. Note that the default
+ * swizzle in the hardware is not XYZW! */
+ swizzle = r300_translate_vertex_data_swizzle(format);
+
+ /* Add the attribute to the PSC table. */
if (i & 1) {
- vformat->vap_prog_stream_cntl[i >> 1] &= 0x0000ffff;
- vformat->vap_prog_stream_cntl[i >> 1] |= temp << 16;
+ vformat->vap_prog_stream_cntl[i >> 1] |= type << 16;
- vformat->vap_prog_stream_cntl_ext[i >> 1] |=
- (R300_VAP_SWIZZLE_XYZW << 16);
+ vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16;
} else {
- vformat->vap_prog_stream_cntl[i >> 1] &= 0xffff0000;
- vformat->vap_prog_stream_cntl[i >> 1] |= temp << 0;
+ vformat->vap_prog_stream_cntl[i >> 1] |= type << 0;
- vformat->vap_prog_stream_cntl_ext[i >> 1] |=
- (R300_VAP_SWIZZLE_XYZW << 0);
+ vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 0;
}
}
/* Set the last vector in the PSC. */
- i--;
+ if (i) {
+ i -= 1;
+ }
vformat->vap_prog_stream_cntl[i >> 1] |=
(R300_LAST_VEC << (i & 1 ? 16 : 0));
}
-/* Update the vertex format. */
-static void r300_update_vertex_format(struct r300_context* r300)
-{
- struct r300_vertex_format vformat;
- int i;
-
- memset(&vformat, 0, sizeof(struct r300_vertex_format));
- for (i = 0; i < 16; i++) {
- vformat.vs_tab[i] = -1;
- vformat.fs_tab[i] = -1;
- }
-
- r300_vs_tab_routes(r300, &vformat);
-
- r300_vertex_psc(r300, &vformat);
-
- if (memcmp(&r300->vertex_info, &vformat,
- sizeof(struct r300_vertex_format))) {
- memcpy(&r300->vertex_info, &vformat,
- sizeof(struct r300_vertex_format));
- r300->dirty_state |= R300_NEW_VERTEX_FORMAT;
- }
-}
-
/* Set up the mappings from GB to US, for RS block. */
-static void r300_update_fs_tab(struct r300_context* r300)
+static void r300_update_fs_tab(struct r300_context* r300,
+ struct r300_vertex_format* vformat)
{
- struct r300_vertex_format* vformat = &r300->vertex_info;
struct tgsi_shader_info* info = &r300->fs->info;
int i, cols = 0, texs = 0, cols_emitted = 0;
int* tab = vformat->fs_tab;
@@ -333,18 +345,15 @@ static void r300_update_fs_tab(struct r300_context* r300)
/* Set up the RS block. This is the part of the chipset that actually does
* the rasterization of vertices into fragments. This is also the part of the
* chipset that locks up if any part of it is even slightly wrong. */
-static void r300_update_rs_block(struct r300_context* r300)
+static void r300_update_rs_block(struct r300_context* r300,
+ struct r300_rs_block* rs)
{
- struct r300_rs_block* rs = r300->rs_block;
struct tgsi_shader_info* info = &r300->fs->info;
- int* tab = r300->vertex_info.fs_tab;
int col_count = 0, fp_offset = 0, i, tex_count = 0;
int rs_tex_comp = 0;
- memset(rs, 0, sizeof(struct r300_rs_block));
if (r300_screen(r300->context.screen)->caps->is_r500) {
for (i = 0; i < info->num_inputs; i++) {
- assert(tab[i] != -1);
switch (info->input_semantic_name[i]) {
case TGSI_SEMANTIC_COLOR:
rs->ip[col_count] |=
@@ -385,7 +394,6 @@ static void r300_update_rs_block(struct r300_context* r300)
}
} else {
for (i = 0; i < info->num_inputs; i++) {
- assert(tab[i] != -1);
switch (info->input_semantic_name[i]) {
case TGSI_SEMANTIC_COLOR:
rs->ip[col_count] |=
@@ -444,15 +452,104 @@ static void r300_update_rs_block(struct r300_context* r300)
rs->inst_count = MAX2(MAX2(col_count - 1, tex_count - 1), 0);
}
+/* Update the vertex format. */
+static void r300_update_derived_shader_state(struct r300_context* r300)
+{
+ struct r300_shader_key* key;
+ struct r300_vertex_format* vformat;
+ struct r300_rs_block* rs_block;
+ struct r300_shader_derived_value* value;
+ int i;
+
+ /*
+ key = CALLOC_STRUCT(r300_shader_key);
+ key->vs = r300->vs;
+ key->fs = r300->fs;
+
+ value = (struct r300_shader_derived_value*)
+ util_hash_table_get(r300->shader_hash_table, (void*)key);
+ if (value) {
+ //vformat = value->vformat;
+ rs_block = value->rs_block;
+
+ FREE(key);
+ } else {
+ rs_block = CALLOC_STRUCT(r300_rs_block);
+ value = CALLOC_STRUCT(r300_shader_derived_value);
+
+ r300_update_rs_block(r300, rs_block);
+
+ //value->vformat = vformat;
+ value->rs_block = rs_block;
+ util_hash_table_set(r300->shader_hash_table,
+ (void*)key, (void*)value);
+ } */
+
+ /* XXX This will be refactored ASAP. */
+ vformat = CALLOC_STRUCT(r300_vertex_format);
+ rs_block = CALLOC_STRUCT(r300_rs_block);
+
+ for (i = 0; i < 16; i++) {
+ vformat->vs_tab[i] = -1;
+ vformat->fs_tab[i] = -1;
+ }
+
+ r300_vs_tab_routes(r300, vformat);
+ r300_vertex_psc(r300, vformat);
+ r300_update_fs_tab(r300, vformat);
+
+ r300_update_rs_block(r300, rs_block);
+
+ FREE(r300->vertex_info);
+ FREE(r300->rs_block);
+
+ r300->vertex_info = vformat;
+ r300->rs_block = rs_block;
+ r300->dirty_state |= (R300_NEW_VERTEX_FORMAT | R300_NEW_RS_BLOCK);
+}
+
+static void r300_update_ztop(struct r300_context* r300)
+{
+ r300->ztop_state.z_buffer_top = R300_ZTOP_ENABLE;
+
+ /* This is important enough that I felt it warranted a comment.
+ *
+ * According to the docs, these are the conditions where ZTOP must be
+ * disabled:
+ * 1) Alpha testing enabled
+ * 2) Texture kill instructions in fragment shader
+ * 3) Chroma key culling enabled
+ * 4) W-buffering enabled
+ *
+ * The docs claim that for the first three cases, if no ZS writes happen,
+ * then ZTOP can be used.
+ *
+ * Additionally, the following conditions require disabled ZTOP:
+ * ~) Depth writes in fragment shader
+ * ~) Outstanding occlusion queries
+ *
+ * ~C.
+ */
+ if (r300->dsa_state->alpha_function) {
+ r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE;
+ } else if (r300->fs->info.uses_kill) {
+ r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE;
+ } else if (r300_fragment_shader_writes_depth(r300->fs)) {
+ r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE;
+ } else if (r300->query_current) {
+ r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE;
+ }
+}
+
void r300_update_derived_state(struct r300_context* r300)
{
if (r300->dirty_state &
- (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) {
- r300_update_vertex_format(r300);
+ (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) {
+ r300_update_derived_shader_state(r300);
}
- if (r300->dirty_state & R300_NEW_VERTEX_FORMAT) {
- r300_update_fs_tab(r300);
- r300_update_rs_block(r300);
+ if (r300->dirty_state &
+ (R300_NEW_DSA | R300_NEW_FRAGMENT_SHADER | R300_NEW_QUERY)) {
+ r300_update_ztop(r300);
}
}
diff --git a/src/gallium/drivers/r300/r300_state_derived.h b/src/gallium/drivers/r300/r300_state_derived.h
index 71a4a47b003..05ad535e2de 100644
--- a/src/gallium/drivers/r300/r300_state_derived.h
+++ b/src/gallium/drivers/r300/r300_state_derived.h
@@ -25,6 +25,10 @@
struct r300_context;
+unsigned r300_shader_key_hash(void* key);
+
+int r300_shader_key_compare(void* key1, void* key2);
+
void r300_update_derived_state(struct r300_context* r300);
#endif /* R300_STATE_DERIVED_H */
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
index d7b57e1b227..ec11a41253f 100644
--- a/src/gallium/drivers/r300/r300_state_inlines.h
+++ b/src/gallium/drivers/r300/r300_state_inlines.h
@@ -24,6 +24,8 @@
#ifndef R300_STATE_INLINES_H
#define R300_STATE_INLINES_H
+#include "draw/draw_vertex.h"
+
#include "pipe/p_format.h"
#include "r300_reg.h"
@@ -51,6 +53,7 @@ static INLINE uint32_t r300_translate_blend_function(int blend_func)
return R300_COMB_FCN_MAX;
default:
debug_printf("r300: Unknown blend function %d\n", blend_func);
+ assert(0);
break;
}
return 0;
@@ -98,6 +101,7 @@ static INLINE uint32_t r300_translate_blend_factor(int blend_fact)
case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: */
default:
debug_printf("r300: Unknown blend factor %d\n", blend_fact);
+ assert(0);
break;
}
return 0;
@@ -127,6 +131,7 @@ static INLINE uint32_t r300_translate_depth_stencil_function(int zs_func)
default:
debug_printf("r300: Unknown depth/stencil function %d\n",
zs_func);
+ assert(0);
break;
}
return 0;
@@ -153,6 +158,7 @@ static INLINE uint32_t r300_translate_stencil_op(int s_op)
return R300_ZS_INVERT;
default:
debug_printf("r300: Unknown stencil op %d", s_op);
+ assert(0);
break;
}
return 0;
@@ -179,6 +185,7 @@ static INLINE uint32_t r300_translate_alpha_function(int alpha_func)
return R300_FG_ALPHA_FUNC_ALWAYS;
default:
debug_printf("r300: Unknown alpha function %d", alpha_func);
+ assert(0);
break;
}
return 0;
@@ -207,6 +214,7 @@ static INLINE uint32_t r300_translate_wrap(int wrap)
return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
default:
debug_printf("r300: Unknown texture wrap %d", wrap);
+ assert(0);
return 0;
}
}
@@ -226,6 +234,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip)
break;
default:
debug_printf("r300: Unknown texture filter %d\n", min);
+ assert(0);
break;
}
switch (mag) {
@@ -240,6 +249,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip)
break;
default:
debug_printf("r300: Unknown texture filter %d\n", mag);
+ assert(0);
break;
}
switch (mip) {
@@ -254,6 +264,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip)
break;
default:
debug_printf("r300: Unknown texture filter %d\n", mip);
+ assert(0);
break;
}
@@ -277,6 +288,8 @@ static INLINE uint32_t r300_anisotropy(float max_aniso)
/* Buffer formats. */
+/* Colorbuffer formats. This is the unswizzled format of the RB3D block's
+ * output. For the swizzling of the targets, check the shader's format. */
static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
{
switch (format) {
@@ -311,17 +324,21 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
debug_printf("r300: Implementation error: "
"Got unsupported color format %s in %s\n",
pf_name(format), __FUNCTION__);
+ assert(0);
break;
}
return 0;
}
+/* Depthbuffer and stencilbuffer. Thankfully, we only support two flavors. */
static INLINE uint32_t r300_translate_zsformat(enum pipe_format format)
{
switch (format) {
/* 16-bit depth, no stencil */
case PIPE_FORMAT_Z16_UNORM:
return R300_DEPTHFORMAT_16BIT_INT_Z;
+ /* 24-bit depth, ignored stencil */
+ case PIPE_FORMAT_Z24X8_UNORM:
/* 24-bit depth, 8-bit stencil */
case PIPE_FORMAT_Z24S8_UNORM:
return R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL;
@@ -329,18 +346,22 @@ static INLINE uint32_t r300_translate_zsformat(enum pipe_format format)
debug_printf("r300: Implementation error: "
"Got unsupported ZS format %s in %s\n",
pf_name(format), __FUNCTION__);
+ assert(0);
break;
}
return 0;
}
-/* Translate pipe_format into US_OUT_FMT.
+/* Shader output formats. This is essentially the swizzle from the shader
+ * to the RB3D block.
+ *
* Note that formats are stored from C3 to C0. */
static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format)
{
switch (format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
case PIPE_FORMAT_X8R8G8B8_UNORM:
+ /* XXX */
case PIPE_FORMAT_Z24S8_UNORM:
return R300_US_OUT_FMT_C4_8 |
R300_C0_SEL_B | R300_C1_SEL_G |
@@ -354,6 +375,7 @@ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format)
debug_printf("r300: Implementation error: "
"Got unsupported output format %s in %s\n",
pf_name(format), __FUNCTION__);
+ assert(0);
return R300_US_OUT_FMT_UNUSED;
}
return 0;
@@ -380,31 +402,57 @@ static INLINE uint32_t r300_translate_gb_pipes(int pipe_count)
return 0;
}
-static INLINE uint32_t translate_vertex_data_type(int type) {
- switch (type) {
- case EMIT_1F:
- case EMIT_1F_PSIZE:
+/* Translate pipe_formats into PSC vertex types. */
+static INLINE uint16_t
+r300_translate_vertex_data_type(enum pipe_format format) {
+ switch (format) {
+ case PIPE_FORMAT_R32_FLOAT:
return R300_DATA_TYPE_FLOAT_1;
break;
- case EMIT_2F:
+ case PIPE_FORMAT_R32G32_FLOAT:
return R300_DATA_TYPE_FLOAT_2;
break;
- case EMIT_3F:
+ case PIPE_FORMAT_R32G32B32_FLOAT:
return R300_DATA_TYPE_FLOAT_3;
break;
- case EMIT_4F:
+ case PIPE_FORMAT_R32G32B32A32_FLOAT:
return R300_DATA_TYPE_FLOAT_4;
break;
- case EMIT_4UB:
- return R300_DATA_TYPE_BYTE;
+ case PIPE_FORMAT_R8G8B8A8_UNORM:
+ return R300_DATA_TYPE_BYTE |
+ R300_NORMALIZE;
break;
default:
debug_printf("r300: Implementation error: "
- "Bad vertex data type!\n");
+ "Bad vertex data format %s!\n", pf_name(format));
assert(0);
break;
}
+ return 0;
+}
+static INLINE uint16_t
+r300_translate_vertex_data_swizzle(enum pipe_format format) {
+ switch (format) {
+ case PIPE_FORMAT_R32_FLOAT:
+ return R300_VAP_SWIZZLE_X001;
+ break;
+ case PIPE_FORMAT_R32G32_FLOAT:
+ return R300_VAP_SWIZZLE_XY01;
+ break;
+ case PIPE_FORMAT_R32G32B32_FLOAT:
+ return R300_VAP_SWIZZLE_XYZ1;
+ break;
+ case PIPE_FORMAT_R32G32B32A32_FLOAT:
+ case PIPE_FORMAT_R8G8B8A8_UNORM:
+ return R300_VAP_SWIZZLE_XYZW;
+ break;
+ default:
+ debug_printf("r300: Implementation error: "
+ "Bad vertex data format %s!\n", pf_name(format));
+ assert(0);
+ break;
+ }
return 0;
}
diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c
index 3865730d635..4865f160581 100644
--- a/src/gallium/drivers/r300/r300_state_invariant.c
+++ b/src/gallium/drivers/r300/r300_state_invariant.c
@@ -21,9 +21,12 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "r300_context.h"
+#include "r300_cs.h"
+#include "r300_reg.h"
+#include "r300_screen.h"
#include "r300_state_invariant.h"
-
struct pipe_viewport_state r300_viewport_identity = {
.scale = {1.0, 1.0, 1.0, 1.0},
.translate = {0.0, 0.0, 0.0, 0.0},
diff --git a/src/gallium/drivers/r300/r300_state_invariant.h b/src/gallium/drivers/r300/r300_state_invariant.h
index 5bea6779fe5..05cff0d6dfe 100644
--- a/src/gallium/drivers/r300/r300_state_invariant.h
+++ b/src/gallium/drivers/r300/r300_state_invariant.h
@@ -23,11 +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"
-#include "r300_state_inlines.h"
+struct r300_context;
void r300_emit_invariant_state(struct r300_context* r300);
diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c
deleted file mode 100644
index d72e734ff0c..00000000000
--- a/src/gallium/drivers/r300/r300_surface.c
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
- * Joakim Sindholt <opensource@zhasha.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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_surface.h"
-
-static void r300_surface_setup(struct r300_context* r300,
- struct r300_texture* dest,
- unsigned x, unsigned y,
- unsigned w, unsigned h)
-{
- struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
- unsigned pixpitch = r300_texture_get_stride(dest, 0) / dest->tex.block.size;
- CS_LOCALS(r300);
-
- r300_emit_blend_state(r300, &blend_clear_state);
- r300_emit_blend_color_state(r300, &blend_color_clear_state);
- r300_emit_dsa_state(r300, &dsa_clear_state);
- r300_emit_rs_state(r300, &rs_clear_state);
-
- BEGIN_CS(26);
-
- /* Viewport setup */
- OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
- OUT_CS_32F((float)w);
- OUT_CS_32F((float)x);
- OUT_CS_32F((float)h);
- OUT_CS_32F((float)y);
- OUT_CS_32F(1.0);
- OUT_CS_32F(0.0);
-
- OUT_CS_REG(R300_VAP_VTE_CNTL, R300_VPORT_X_SCALE_ENA |
- R300_VPORT_X_OFFSET_ENA |
- R300_VPORT_Y_SCALE_ENA |
- R300_VPORT_Y_OFFSET_ENA |
- R300_VTX_XY_FMT | R300_VTX_Z_FMT);
-
- /* Pixel scissors. */
- OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2);
- if (caps->is_r500) {
- OUT_CS((x << R300_SCISSORS_X_SHIFT) | (y << R300_SCISSORS_Y_SHIFT));
- OUT_CS(((w - 1) << R300_SCISSORS_X_SHIFT) | ((h - 1) << R300_SCISSORS_Y_SHIFT));
- } else {
- /* Non-R500 chipsets have an offset of 1440 in their scissors. */
- OUT_CS(((x + 1440) << R300_SCISSORS_X_SHIFT) |
- ((y + 1440) << R300_SCISSORS_Y_SHIFT));
- OUT_CS((((w - 1) + 1440) << R300_SCISSORS_X_SHIFT) |
- (((h - 1) + 1440) << R300_SCISSORS_Y_SHIFT));
- }
-
- /* Flush colorbuffer and blend caches. */
- OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT,
- R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D |
- R300_RB3D_DSTCACHE_CTLSTAT_DC_FINISH_SIGNAL);
- OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT,
- R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
- R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
-
- /* Setup colorbuffer. */
- OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0, 1);
- OUT_CS_RELOC(dest->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
- OUT_CS_REG_SEQ(R300_RB3D_COLORPITCH0, 1);
- OUT_CS_RELOC(dest->buffer, pixpitch |
- r300_translate_colorformat(dest->tex.format), 0,
- RADEON_GEM_DOMAIN_VRAM, 0);
- OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0xf);
-
- END_CS;
-}
-
-/* Provides pipe_context's "surface_fill". Commonly used for clearing
- * buffers. */
-static void r300_surface_fill(struct pipe_context* pipe,
- struct pipe_surface* dest,
- unsigned x, unsigned y,
- unsigned w, unsigned h,
- unsigned color)
-{
- int i;
- float r, g, b, a, depth;
- struct r300_context* r300 = r300_context(pipe);
- struct r300_capabilities* caps = r300_screen(pipe->screen)->caps;
- struct r300_texture* tex = (struct r300_texture*)dest->texture;
- unsigned pixpitch = r300_texture_get_stride(tex, 0) / tex->tex.block.size;
- boolean invalid = FALSE;
- 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;
- DBG(r300, DBG_SURF, "r300: Filling surface %p at (%d,%d),"
- " dimensions %dx%d (pixel pitch %d), color 0x%x\n",
- dest, x, y, w, h, pixpitch, color);
-
- /* Fallback? */
- if (!pipe->screen->is_format_supported(pipe->screen, dest->format,
- PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
-fallback:
- DBG(r300, DBG_SURF | DBG_FALL,
- "r300: Falling back on surface clear...\n");
- util_surface_fill(pipe, dest, x, y, w, h, color);
- return;
- }
-
- /* Make sure our target BO is okay. */
-validate:
- if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
- 0, RADEON_GEM_DOMAIN_VRAM)) {
- r300->context.flush(&r300->context, 0, NULL);
- goto validate;
- }
- if (!r300->winsys->validate(r300->winsys)) {
- r300->context.flush(&r300->context, 0, NULL);
- if (invalid) {
- DBG(r300, DBG_SURF | DBG_FALL, "r300: Stuck in validation loop.");
- goto fallback;
- }
- invalid = TRUE;
- goto validate;
- }
-
- r300_surface_setup(r300, tex, x, y, w, h);
-
- /* Vertex shader setup */
- if (caps->has_tcl) {
- r300_emit_vertex_program_code(r300, &r300_passthrough_vertex_shader, 0);
- } else {
- BEGIN_CS(4);
- OUT_CS_REG(R300_VAP_CNTL_STATUS,
-#ifdef PIPE_ARCH_BIG_ENDIAN
- R300_VC_32BIT_SWAP |
-#endif
- 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_program_code(r300, &r5xx_passthrough_fragment_shader, 0);
- r300_emit_rs_block_state(r300, &r5xx_rs_block_clear_state);
- } else {
- r300_emit_fragment_program_code(r300, &r3xx_passthrough_fragment_shader, 0);
- r300_emit_rs_block_state(r300, &r3xx_rs_block_clear_state);
- }
-
- BEGIN_CS(26);
-
- /* 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);
-
- /* The size of the point we're about to draw, in sixths of pixels */
- OUT_CS_REG(R300_GA_POINT_SIZE,
- ((h * 6) & R300_POINTSIZE_Y_MASK) |
- ((w * 6) << R300_POINTSIZE_X_SHIFT));
-
- /* Vertex size. */
- OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
-
- /* 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));
- /* Position */
- OUT_CS_32F(0.5);
- OUT_CS_32F(0.5);
- 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(a);
-
- OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA);
-
- END_CS;
-
- r300->dirty_hw++;
-}
-
-static void r300_surface_copy(struct pipe_context* pipe,
- struct pipe_surface* dest,
- unsigned destx, unsigned desty,
- struct pipe_surface* src,
- unsigned srcx, unsigned srcy,
- unsigned w, unsigned h)
-{
- struct r300_context* r300 = r300_context(pipe);
- 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 = r300_texture_get_stride(srctex, 0) / srctex->tex.block.size;
- boolean invalid = FALSE;
- float fsrcx = srcx, fsrcy = srcy, fdestx = destx, fdesty = desty;
- CS_LOCALS(r300);
-
- DBG(r300, DBG_SURF, "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->buffer == desttex->buffer) &&
- ((destx < srcx + w) || (srcx < destx + w)) &&
- ((desty < srcy + h) || (srcy < desty + h))) {
- goto fallback;
- }
-
- if (!pipe->screen->is_format_supported(pipe->screen, src->format,
- PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, 0) ||
- !pipe->screen->is_format_supported(pipe->screen, dest->format,
- PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
-fallback:
- DBG(r300, DBG_SURF | DBG_FALL, "r300: Falling back on surface_copy\n");
- util_surface_copy(pipe, FALSE, dest, destx, desty, src,
- srcx, srcy, w, h);
- return;
- }
-
- /* Add our target BOs to the list. */
-validate:
- if (!r300->winsys->add_buffer(r300->winsys, srctex->buffer,
- RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
- r300->context.flush(&r300->context, 0, NULL);
- goto validate;
- }
- if (!r300->winsys->add_buffer(r300->winsys, desttex->buffer,
- 0, RADEON_GEM_DOMAIN_VRAM)) {
- r300->context.flush(&r300->context, 0, NULL);
- goto validate;
- }
- if (!r300->winsys->validate(r300->winsys)) {
- r300->context.flush(&r300->context, 0, NULL);
- if (invalid) {
- DBG(r300, DBG_SURF | DBG_FALL, "r300: Stuck in validation loop.");
- goto fallback;
- }
- invalid = TRUE;
- goto validate;
- }
-
- r300_surface_setup(r300, desttex, destx, desty, w, h);
-
- /* Setup the texture. */
- r300_emit_texture(r300, &r300_sampler_copy_state, srctex, 0);
-
- /* Flush and enable. */
- r300_flush_textures(r300);
-
- /* Vertex shader setup */
- if (caps->has_tcl) {
- r300_emit_vertex_program_code(r300, &r300_passthrough_vertex_shader, 0);
- } else {
- BEGIN_CS(4);
- OUT_CS_REG(R300_VAP_CNTL_STATUS,
-#ifdef PIPE_ARCH_BIG_ENDIAN
- R300_VC_32BIT_SWAP |
-#endif
- 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_program_code(r300, &r5xx_texture_fragment_shader, 0);
- r300_emit_rs_block_state(r300, &r5xx_rs_block_copy_state);
- } else {
- r300_emit_fragment_program_code(r300, &r3xx_texture_fragment_shader, 0);
- r300_emit_rs_block_state(r300, &r3xx_rs_block_copy_state);
- }
-
- BEGIN_CS(30);
- /* 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);
-
- /* Vertex size. */
- OUT_CS_REG(R300_VAP_VTX_SIZE, 0x4);
-
- /* Packet3 with our texcoords */
- OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 16);
- OUT_CS(R300_PRIM_TYPE_QUADS | R300_PRIM_WALK_RING |
- (4 << R300_PRIM_NUM_VERTICES_SHIFT));
- /* (x , y ) */
- OUT_CS_32F(fdestx / dest->width);
- OUT_CS_32F(fdesty / dest->height);
- OUT_CS_32F(fsrcx / src->width);
- OUT_CS_32F(fsrcy / src->height);
- /* (x , y + h) */
- OUT_CS_32F(fdestx / dest->width);
- OUT_CS_32F((fdesty + h) / dest->height);
- OUT_CS_32F(fsrcx / src->width);
- OUT_CS_32F((fsrcy + h) / src->height);
- /* (x + w, y + h) */
- OUT_CS_32F((fdestx + w) / dest->width);
- OUT_CS_32F((fdesty + h) / dest->height);
- OUT_CS_32F((fsrcx + w) / src->width);
- OUT_CS_32F((fsrcy + h) / src->height);
- /* (x + w, y ) */
- OUT_CS_32F((fdestx + w) / dest->width);
- OUT_CS_32F(fdesty / dest->height);
- OUT_CS_32F((fsrcx + w) / src->width);
- OUT_CS_32F(fsrcy / src->height);
-
- OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA);
-
- END_CS;
-
- r300->dirty_hw++;
-}
-
-void r300_init_surface_functions(struct r300_context* r300)
-{
- r300->context.surface_fill = r300_surface_fill;
- r300->context.surface_copy = r300_surface_copy;
-}
diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h
deleted file mode 100644
index f9e98b2ec9c..00000000000
--- a/src/gallium/drivers/r300/r300_surface.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#ifndef R300_SURFACE_H
-#define R300_SURFACE_H
-
-#include "pipe/p_context.h"
-#include "pipe/p_screen.h"
-
-#include "util/u_rect.h"
-
-#include "r300_context.h"
-#include "r300_cs.h"
-#include "r300_emit.h"
-#include "r300_fs.h"
-#include "r300_vs.h"
-#include "r300_state_inlines.h"
-
-static struct r300_blend_state blend_clear_state = {
- .blend_control = 0x0,
- .alpha_blend_control = 0x0,
- .rop = 0x0,
- .dither = 0x0,
-};
-
-static struct r300_blend_color_state blend_color_clear_state = {
- .blend_color = 0x0,
- .blend_color_red_alpha = 0x0,
- .blend_color_green_blue = 0x0,
-};
-
-static struct r300_dsa_state dsa_clear_state = {
- .alpha_function = 0x0,
- .alpha_reference = 0x0,
- .z_buffer_control = 0x0,
- .z_stencil_control = 0x0,
- .stencil_ref_mask = R300_STENCILWRITEMASK_MASK,
- .z_buffer_top = R300_ZTOP_ENABLE,
- .stencil_ref_bf = 0x0,
-};
-
-static struct r300_rs_state rs_clear_state = {
- .point_minmax = 0x36000006,
- .line_control = 0x00030006,
- .depth_scale_front = 0x0,
- .depth_offset_front = 0x0,
- .depth_scale_back = 0x0,
- .depth_offset_back = 0x0,
- .polygon_offset_enable = 0x0,
- .cull_mode = 0x0,
- .line_stipple_config = 0x3BAAAAAB,
- .line_stipple_value = 0x0,
- .color_control = R300_SHADE_MODEL_FLAT,
-};
-
-static struct r300_rs_block r3xx_rs_block_clear_state = {
- .ip[0] = R500_RS_SEL_S(R300_RS_SEL_C0) |
- R500_RS_SEL_T(R300_RS_SEL_C0) |
- R500_RS_SEL_R(R300_RS_SEL_C0) |
- R500_RS_SEL_Q(R300_RS_SEL_K1),
- .inst[0] = R300_RS_INST_COL_CN_WRITE,
- .count = R300_IT_COUNT(0) | R300_IC_COUNT(1) | R300_HIRES_EN,
- .inst_count = 0,
-};
-
-static struct r300_rs_block r5xx_rs_block_clear_state = {
- .ip[0] = R500_RS_SEL_S(R500_RS_IP_PTR_K0) |
- R500_RS_SEL_T(R500_RS_IP_PTR_K0) |
- R500_RS_SEL_R(R500_RS_IP_PTR_K0) |
- R500_RS_SEL_Q(R500_RS_IP_PTR_K1),
- .inst[0] = R500_RS_INST_COL_CN_WRITE,
- .count = R300_IT_COUNT(0) | R300_IC_COUNT(1) | R300_HIRES_EN,
- .inst_count = 0,
-};
-
-/* The following state is used for surface_copy only. */
-
-static struct r300_rs_block r3xx_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(0),
-};
-
-static struct r300_rs_block r5xx_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(0),
-};
-
-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 7ea4c33fa9a..3c8ff24e17d 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -20,6 +20,12 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "pipe/p_screen.h"
+
+#include "util/u_math.h"
+#include "util/u_memory.h"
+
+#include "r300_context.h"
#include "r300_texture.h"
static void r300_setup_texture_state(struct r300_texture* tex)
@@ -36,16 +42,16 @@ static void r300_setup_texture_state(struct r300_texture* tex)
/* XXX */
state->format1 = r300_translate_texformat(pt->format);
if (pt->target == PIPE_TEXTURE_CUBE) {
- state->format1 |= R300_TX_FORMAT_CUBIC_MAP;
+ state->format1 |= R300_TX_FORMAT_CUBIC_MAP;
}
if (pt->target == PIPE_TEXTURE_3D) {
- state->format1 |= R300_TX_FORMAT_3D;
+ state->format1 |= R300_TX_FORMAT_3D;
}
state->format2 = (r300_texture_get_stride(tex, 0) / pt->block.size) - 1;
- /* Assume (somewhat foolishly) that oversized textures will
- * not be permitted by the state tracker. */
+ /* Don't worry about accidentally setting this bit on non-r500;
+ * the kernel should catch it. */
if (pt->width[0] > 2048) {
state->format2 |= R500_TXWIDTH_BIT11;
}
@@ -67,7 +73,8 @@ unsigned r300_texture_get_stride(struct r300_texture* tex, unsigned level)
return tex->stride_override;
if (level > tex->tex.last_level) {
- debug_printf("%s: level (%u) > last_level (%u)\n", __FUNCTION__, level, tex->tex.last_level);
+ debug_printf("%s: level (%u) > last_level (%u)\n", __FUNCTION__,
+ level, tex->tex.last_level);
return 0;
}
@@ -90,11 +97,6 @@ static void r300_setup_miptree(struct r300_texture* tex)
base->nblocksx[i] = pf_get_nblocksx(&base->block, base->width[i]);
base->nblocksy[i] = pf_get_nblocksy(&base->block, base->height[i]);
- /* Radeons enjoy things in multiples of 64.
- *
- * XXX
- * POT, uncompressed, unmippmapped textures can be aligned to 32,
- * instead of 64. */
stride = r300_texture_get_stride(tex, i);
size = stride * base->nblocksy[i] * base->depth[i];
@@ -189,9 +191,7 @@ static struct pipe_texture*
{
struct r300_texture* tex;
- /* XXX we should start doing mips now... */
if (base->target != PIPE_TEXTURE_2D ||
- base->last_level != 0 ||
base->depth[0] != 1) {
return NULL;
}
@@ -207,7 +207,6 @@ static struct pipe_texture*
tex->stride_override = *stride;
- /* XXX */
r300_setup_texture_state(tex);
pipe_buffer_reference(&tex->buffer, buffer);
diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h
index 992dad77ab4..55d1a0ac5cf 100644
--- a/src/gallium/drivers/r300/r300_texture.h
+++ b/src/gallium/drivers/r300/r300_texture.h
@@ -23,11 +23,8 @@
#ifndef R300_TEXTURE_H
#define R300_TEXTURE_H
-#include "pipe/p_screen.h"
#include "pipe/p_video_state.h"
-#include "util/u_math.h"
-#include "r300_context.h"
#include "r300_reg.h"
struct r300_texture;
@@ -83,6 +80,7 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format)
R300_TX_FORMAT_YUV_TO_RGB;
/* W24_FP */
case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP);
default:
debug_printf("r300: Implementation error: "
diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c
index 8460cfaf518..eca85879a7f 100644
--- a/src/gallium/drivers/r300/r300_vs.c
+++ b/src/gallium/drivers/r300/r300_vs.c
@@ -146,89 +146,3 @@ void r300_translate_vertex_shader(struct r300_context* r300,
rc_destroy(&compiler.Base);
vs->translated = TRUE;
}
-
-
-/* XXX get these to r300_reg */
-#define R300_PVS_DST_OPCODE(x) ((x) << 0)
-# define R300_VE_DOT_PRODUCT 1
-# define R300_VE_MULTIPLY 2
-# define R300_VE_ADD 3
-# define R300_VE_MAXIMUM 7
-# define R300_VE_SET_LESS_THAN 10
-#define R300_PVS_DST_MATH_INST (1 << 6)
-# define R300_ME_RECIP_DX 6
-#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)
-#define R300_PVS_MODIFIER_X (1 << 25)
-#define R300_PVS_MODIFIER_Y (1 << 26)
-#define R300_PVS_MODIFIER_Z (1 << 27)
-#define R300_PVS_MODIFIER_W (1 << 28)
-#define R300_PVS_NEGATE_XYZW \
- (R300_PVS_MODIFIER_X | R300_PVS_MODIFIER_Y | \
- R300_PVS_MODIFIER_Z | R300_PVS_MODIFIER_W)
-
-struct r300_vertex_program_code r300_passthrough_vertex_shader = {
- .length = 8, /* two instructions */
-
- /* MOV out[0], in[0] */
- .body.d[0] = 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,
- .body.d[1] = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
- R300_PVS_SRC_OFFSET(0) | R300_PVS_SRC_SWIZZLE_XYZW,
- .body.d[2] = R300_PVS_SRC_SWIZZLE_ZERO,
- .body.d[3] = 0x0,
-
- /* MOV out[1], in[1] */
- .body.d[4] = R300_PVS_DST_OPCODE(R300_VE_ADD) |
- R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
- R300_PVS_DST_OFFSET(1) | R300_PVS_DST_WE_XYZW,
- .body.d[5] = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
- R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW,
- .body.d[6] = R300_PVS_SRC_SWIZZLE_ZERO,
- .body.d[7] = 0x0,
-
- .inputs[0] = 0,
- .inputs[1] = 1,
- .outputs[0] = 0,
- .outputs[1] = 1,
-
- .InputsRead = 3,
- .OutputsWritten = 3
-};
-
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index f18ad75a47d..864a6146b22 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -48,6 +48,9 @@ struct r300_winsys {
/* GB pipe count */
uint32_t gb_pipes;
+ /* Z pipe count (rv530 only) */
+ uint32_t z_pipes;
+
/* GART size. */
uint32_t gart_size;
@@ -92,6 +95,12 @@ struct r300_winsys {
/* Flush the CS. */
void (*flush_cs)(struct r300_winsys* winsys);
+
+ /* winsys flush - callback from winsys when flush required */
+ void (*set_flush_cb)(struct r300_winsys *winsys,
+ void (*flush_cb)(void *), void *data);
+
+ void (*reset_bos)(struct r300_winsys *winsys);
};
struct pipe_context* r300_create_context(struct pipe_screen* screen,
diff --git a/src/gallium/drivers/r300/r3xx_fs.c b/src/gallium/drivers/r300/r3xx_fs.c
deleted file mode 100644
index c1c1194d58e..00000000000
--- a/src/gallium/drivers/r300/r3xx_fs.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
- * Joakim Sindholt <opensource@zhasha.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 "r3xx_fs.h"
-
-#include "r300_reg.h"
-
-struct rX00_fragment_program_code r3xx_passthrough_fragment_shader = {
- .code.r300.alu.length = 1,
- .code.r300.tex.length = 0,
-
- .code.r300.config = 0,
- .code.r300.pixsize = 0,
- .code.r300.code_offset = 0,
- .code.r300.code_addr[3] = R300_RGBA_OUT,
-
- .code.r300.alu.inst[0].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,
- .code.r300.alu.inst[0].rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) |
- R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ,
- .code.r300.alu.inst[0].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,
- .code.r300.alu.inst[0].alpha_addr = R300_ALPHA_ADDR0(0) |
- R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT,
-};
-
-struct rX00_fragment_program_code r3xx_texture_fragment_shader = {
- .code.r300.alu.length = 1,
- .code.r300.tex.length = 1,
-
- .code.r300.config = R300_PFS_CNTL_FIRST_NODE_HAS_TEX,
- .code.r300.pixsize = 0,
- .code.r300.code_offset = 0,
- .code.r300.code_addr[3] = R300_RGBA_OUT,
-
- .code.r300.tex.inst[0] = R300_TEX_OP_LD << R300_TEX_INST_SHIFT,
-
- .code.r300.alu.inst[0].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,
- .code.r300.alu.inst[0].rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) |
- R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ,
- .code.r300.alu.inst[0].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,
- .code.r300.alu.inst[0].alpha_addr = R300_ALPHA_ADDR0(0) |
- R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT,
-};
diff --git a/src/gallium/drivers/r300/r3xx_fs.h b/src/gallium/drivers/r300/r3xx_fs.h
deleted file mode 100644
index 51cd245724d..00000000000
--- a/src/gallium/drivers/r300/r3xx_fs.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
- * Joakim Sindholt <opensource@zhasha.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 R3XX_FS_H
-#define R3XX_FS_H
-
-#include "radeon_code.h"
-
-struct rX00_fragment_program_code r3xx_passthrough_fragment_shader;
-struct rX00_fragment_program_code r3xx_texture_fragment_shader;
-
-#endif /* R3XX_FS_H */
diff --git a/src/gallium/drivers/r300/r5xx_fs.c b/src/gallium/drivers/r300/r5xx_fs.c
deleted file mode 100644
index f072deab0d9..00000000000
--- a/src/gallium/drivers/r300/r5xx_fs.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
- * Joakim Sindholt <opensource@zhasha.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 "r5xx_fs.h"
-
-#include "r300_reg.h"
-
-/* XXX this all should find its way back to r300_reg */
-/* Swizzle tools */
-#define R500_SWIZZLE_ZERO 4
-#define R500_SWIZZLE_HALF 5
-#define R500_SWIZZLE_ONE 6
-#define R500_SWIZ_RGB_ZERO ((4 << 0) | (4 << 3) | (4 << 6))
-#define R500_SWIZ_RGB_ONE ((6 << 0) | (6 << 3) | (6 << 6))
-#define R500_SWIZ_RGB_RGB ((0 << 0) | (1 << 3) | (2 << 6))
-#define R500_SWIZ_MOD_NEG 1
-#define R500_SWIZ_MOD_ABS 2
-#define R500_SWIZ_MOD_NEG_ABS 3
-/* Swizzles for inst2 */
-#define R500_SWIZ_TEX_STRQ(x) ((x) << 8)
-#define R500_SWIZ_TEX_RGBA(x) ((x) << 24)
-/* Swizzles for inst3 */
-#define R500_SWIZ_RGB_A(x) ((x) << 2)
-#define R500_SWIZ_RGB_B(x) ((x) << 15)
-/* Swizzles for inst4 */
-#define R500_SWIZ_ALPHA_A(x) ((x) << 14)
-#define R500_SWIZ_ALPHA_B(x) ((x) << 21)
-/* Swizzle for inst5 */
-#define R500_SWIZ_RGBA_C(x) ((x) << 14)
-#define R500_SWIZ_ALPHA_C(x) ((x) << 27)
-/* Writemasks */
-#define R500_TEX_WMASK(x) ((x) << 11)
-#define R500_ALU_WMASK(x) ((x) << 11)
-#define R500_ALU_OMASK(x) ((x) << 15)
-#define R500_W_OMASK (1 << 31)
-
-struct rX00_fragment_program_code r5xx_passthrough_fragment_shader = {
- .code.r500.max_temp_idx = 0,
- .code.r500.inst_end = 0,
-
- .code.r500.inst[0].inst0 = R500_INST_TYPE_OUT |
- R500_INST_TEX_SEM_WAIT | R500_INST_LAST |
- R500_INST_RGB_OMASK_RGB | R500_INST_ALPHA_OMASK |
- R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP,
- .code.r500.inst[0].inst1 =
- R500_RGB_ADDR0(0) | R500_RGB_ADDR1(0) | R500_RGB_ADDR1_CONST |
- R500_RGB_ADDR2(0) | R500_RGB_ADDR2_CONST,
- .code.r500.inst[0].inst2 =
- R500_ALPHA_ADDR0(0) | R500_ALPHA_ADDR1(0) | R500_ALPHA_ADDR1_CONST |
- R500_ALPHA_ADDR2(0) | R500_ALPHA_ADDR2_CONST,
- .code.r500.inst[0].inst3 =
- R500_ALU_RGB_SEL_A_SRC0 | R500_ALU_RGB_R_SWIZ_A_R |
- R500_ALU_RGB_G_SWIZ_A_G | R500_ALU_RGB_B_SWIZ_A_B |
- R500_ALU_RGB_SEL_B_SRC0 | R500_ALU_RGB_R_SWIZ_B_R |
- R500_ALU_RGB_B_SWIZ_B_G | R500_ALU_RGB_G_SWIZ_B_B,
- .code.r500.inst[0].inst4 =
- R500_ALPHA_OP_CMP | R500_ALPHA_SWIZ_A_A | R500_ALPHA_SWIZ_B_A,
- .code.r500.inst[0].inst5 =
- R500_ALU_RGBA_OP_CMP | R500_ALU_RGBA_R_SWIZ_0 |
- R500_ALU_RGBA_G_SWIZ_0 | R500_ALU_RGBA_B_SWIZ_0 |
- R500_ALU_RGBA_A_SWIZ_0,
-};
-
-struct rX00_fragment_program_code r5xx_texture_fragment_shader = {
- .code.r500.max_temp_idx = 0,
- .code.r500.inst_end = 1,
-
- .code.r500.inst[0].inst0 = R500_INST_TYPE_TEX |
- R500_INST_TEX_SEM_WAIT |
- R500_INST_RGB_WMASK_RGB | R500_INST_ALPHA_WMASK |
- R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP,
- .code.r500.inst[0].inst1 = R500_TEX_ID(0) | R500_TEX_INST_LD |
- R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED,
- .code.r500.inst[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,
- .code.r500.inst[0].inst3 = 0x0,
- .code.r500.inst[0].inst4 = 0x0,
- .code.r500.inst[0].inst5 = 0x0,
-
- .code.r500.inst[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,
- .code.r500.inst[1].inst1 =
- R500_RGB_ADDR0(0) | R500_RGB_ADDR1(0) | R500_RGB_ADDR1_CONST |
- R500_RGB_ADDR2(0) | R500_RGB_ADDR2_CONST,
- .code.r500.inst[1].inst2 =
- R500_ALPHA_ADDR0(0) | R500_ALPHA_ADDR1(0) | R500_ALPHA_ADDR1_CONST |
- R500_ALPHA_ADDR2(0) | R500_ALPHA_ADDR2_CONST,
- .code.r500.inst[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,
- .code.r500.inst[1].inst4 =
- R500_ALPHA_OP_CMP | R500_ALPHA_SWIZ_A_A | R500_ALPHA_SWIZ_B_A,
- .code.r500.inst[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,
-};
diff --git a/src/gallium/drivers/r300/r5xx_fs.h b/src/gallium/drivers/r300/r5xx_fs.h
deleted file mode 100644
index a4addde32b2..00000000000
--- a/src/gallium/drivers/r300/r5xx_fs.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
- * Joakim Sindholt <opensource@zhasha.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 R5XX_FS_H
-#define R5XX_FS_H
-
-#include "radeon_code.h"
-
-struct rX00_fragment_program_code r5xx_passthrough_fragment_shader;
-struct rX00_fragment_program_code r5xx_texture_fragment_shader;
-
-#endif /* R5XX_FS_H */
diff --git a/src/gallium/drivers/trace/tr_drm.c b/src/gallium/drivers/trace/tr_drm.c
index 781ca5d3bc0..48d1c4051cc 100644
--- a/src/gallium/drivers/trace/tr_drm.c
+++ b/src/gallium/drivers/trace/tr_drm.c
@@ -150,7 +150,9 @@ trace_drm_destroy(struct drm_api *_api)
{
struct trace_drm_api *tr_api = trace_drm_api(_api);
struct drm_api *api = tr_api->api;
- api->destroy(api);
+
+ if (api->destroy)
+ api->destroy(api);
free(tr_api);
}
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index ab605c7fc87..7da9bd3866b 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -366,7 +366,8 @@ trace_screen_get_tex_transfer(struct pipe_screen *_screen,
trace_dump_call_end();
- result = trace_transfer_create(tr_tex, result);
+ if (result)
+ result = trace_transfer_create(tr_tex, result);
return result;
}
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index c13cffceb0a..c36286f9bee 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -167,11 +167,17 @@ typedef unsigned char boolean;
#define ALIGN16_ASSIGN(NAME) NAME##___aligned
#define ALIGN16_ATTRIB __attribute__(( aligned( 16 ) ))
#define ALIGN8_ATTRIB __attribute__(( aligned( 8 ) ))
+#if __GNUC__ > 4 || (__GNUC__ == 4 &&__GNUC_MINOR__>1)
+#define ALIGN_STACK __attribute__((force_align_arg_pointer))
+#else
+#define ALIGN_STACK
+#endif
#else
#define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME##___unaligned[SIZE + 1]
#define ALIGN16_ASSIGN(NAME) align16(NAME##___unaligned)
#define ALIGN16_ATTRIB
#define ALIGN8_ATTRIB
+#define ALIGN_STACK
#endif
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 39620a71980..5569001e601 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -189,6 +189,9 @@ struct pipe_context {
/**
* Surface functions
+ *
+ * The pipe driver is allowed to set these functions to NULL, and in that
+ * case, they will not be available.
*/
/*@{*/
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index c67cc8dacb6..5625ff53cfd 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -45,6 +45,7 @@
#include "state_tracker/st_cb_fbo.h"
#include "util/u_memory.h"
+#include "util/u_rect.h"
static struct pipe_surface *
dri_surface_from_handle(struct drm_api *api,
@@ -541,12 +542,21 @@ dri1_swap_copy(struct dri_context *ctx,
cur = dPriv->pClipRects;
for (i = 0; i < dPriv->numClipRects; ++i) {
- if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox))
- pipe->surface_copy(pipe, dst, clip.x1, clip.y1,
- src,
- (int)clip.x1 - dPriv->x,
- (int)clip.y1 - dPriv->y,
- clip.x2 - clip.x1, clip.y2 - clip.y1);
+ if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox)) {
+ if (pipe->surface_copy) {
+ pipe->surface_copy(pipe, dst, clip.x1, clip.y1,
+ src,
+ (int)clip.x1 - dPriv->x,
+ (int)clip.y1 - dPriv->y,
+ clip.x2 - clip.x1, clip.y2 - clip.y1);
+ } else {
+ util_surface_copy(pipe, FALSE, dst, clip.x1, clip.y1,
+ src,
+ (int)clip.x1 - dPriv->x,
+ (int)clip.y1 - dPriv->y,
+ clip.x2 - clip.x1, clip.y2 - clip.y1);
+ }
+ }
}
}
diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c
index f39a305531e..800d462e322 100644
--- a/src/gallium/state_trackers/dri/dri_extensions.c
+++ b/src/gallium/state_trackers/dri/dri_extensions.c
@@ -37,6 +37,7 @@
#define need_GL_ARB_multisample
#define need_GL_ARB_occlusion_query
#define need_GL_ARB_point_parameters
+#define need_GL_ARB_provoking_vertex
#define need_GL_ARB_shader_objects
#define need_GL_ARB_texture_compression
#define need_GL_ARB_vertex_array_object
@@ -52,6 +53,7 @@
#define need_GL_EXT_fog_coord
#define need_GL_EXT_framebuffer_object
#define need_GL_EXT_multi_draw_arrays
+#define need_GL_EXT_provoking_vertex
#define need_GL_EXT_secondary_color
#define need_GL_APPLE_vertex_array_object
#define need_GL_NV_vertex_program
@@ -69,6 +71,7 @@ const struct dri_extension card_extensions[] = {
{"GL_ARB_multitexture", NULL},
{"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
{"GL_ARB_pixel_buffer_object", NULL},
+ {"GL_ARB_provoking_vertex", GL_ARB_provoking_vertex_functions},
{"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
{"GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
{"GL_ARB_shading_language_120", GL_VERSION_2_1_functions },
@@ -97,6 +100,7 @@ const struct dri_extension card_extensions[] = {
{"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
{"GL_EXT_packed_depth_stencil", NULL},
{"GL_EXT_pixel_buffer_object", NULL},
+ {"GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions},
{"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
{"GL_EXT_stencil_wrap", NULL},
{"GL_EXT_texture_edge_clamp", NULL},
diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c
index 7911a8834e0..71c013756d3 100644
--- a/src/gallium/state_trackers/egl/egl_surface.c
+++ b/src/gallium/state_trackers/egl/egl_surface.c
@@ -12,6 +12,8 @@
#include "state_tracker/drm_api.h"
+#include "util/u_rect.h"
+
/*
* Util functions
*/
@@ -360,12 +362,21 @@ drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw)
st_notify_swapbuffers(surf->stfb);
if (ctx && surf->screen) {
- ctx->pipe->surface_copy(ctx->pipe,
- surf->screen->surface,
- 0, 0,
- back_surf,
- 0, 0,
- surf->w, surf->h);
+ if (ctx->pipe->surface_copy) {
+ ctx->pipe->surface_copy(ctx->pipe,
+ surf->screen->surface,
+ 0, 0,
+ back_surf,
+ 0, 0,
+ surf->w, surf->h);
+ } else {
+ util_surface_copy(ctx->pipe, FALSE,
+ surf->screen->surface,
+ 0, 0,
+ back_surf,
+ 0, 0,
+ surf->w, surf->h);
+ }
ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
#ifdef DRM_MODE_FEATURE_DIRTYFB
diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
index f7c5f2f0cdf..396c88aa3d2 100644
--- a/src/gallium/state_trackers/vega/renderer.c
+++ b/src/gallium/state_trackers/vega/renderer.c
@@ -37,6 +37,7 @@
#include "util/u_draw_quad.h"
#include "util/u_simple_shaders.h"
#include "util/u_memory.h"
+#include "util/u_rect.h"
#include "cso_cache/cso_context.h"
@@ -457,10 +458,17 @@ void renderer_copy_surface(struct renderer *ctx,
PIPE_BUFFER_USAGE_GPU_WRITE);
/* load temp texture */
- pipe->surface_copy(pipe,
- texSurf, 0, 0, /* dest */
- src, srcLeft, srcTop, /* src */
- srcW, srcH); /* size */
+ if (pipe->surface_copy) {
+ pipe->surface_copy(pipe,
+ texSurf, 0, 0, /* dest */
+ src, srcLeft, srcTop, /* src */
+ srcW, srcH); /* size */
+ } else {
+ util_surface_copy(pipe, FALSE,
+ texSurf, 0, 0, /* dest */
+ src, srcLeft, srcTop, /* src */
+ srcW, srcH); /* size */
+ }
/* free the surface, update the texture if necessary.*/
screen->tex_surface_destroy(texSurf);
diff --git a/src/gallium/state_trackers/vega/vg_tracker.c b/src/gallium/state_trackers/vega/vg_tracker.c
index 56cc60aebe1..c4da01e52cc 100644
--- a/src/gallium/state_trackers/vega/vg_tracker.c
+++ b/src/gallium/state_trackers/vega/vg_tracker.c
@@ -235,13 +235,23 @@ static void setup_new_alpha_mask(struct vg_context *ctx,
old_texture,
0, 0, 0,
PIPE_BUFFER_USAGE_GPU_READ);
- pipe->surface_copy(pipe,
- surface,
- 0, 0,
- old_surface,
- 0, 0,
- MIN2(old_surface->width, width),
- MIN2(old_surface->height, height));
+ if (pipe->surface_copy) {
+ pipe->surface_copy(pipe,
+ surface,
+ 0, 0,
+ old_surface,
+ 0, 0,
+ MIN2(old_surface->width, width),
+ MIN2(old_surface->height, height));
+ } else {
+ util_surface_copy(pipe, FALSE,
+ surface,
+ 0, 0,
+ old_surface,
+ 0, 0,
+ MIN2(old_surface->width, width),
+ MIN2(old_surface->height, height));
+ }
if (surface)
pipe_surface_reference(&surface, NULL);
if (old_surface)
diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile
index 030bac5fff2..22c107370e8 100644
--- a/src/gallium/state_trackers/xorg/Makefile
+++ b/src/gallium/state_trackers/xorg/Makefile
@@ -5,7 +5,8 @@ LIBNAME = xorgtracker
LIBRARY_INCLUDES = \
-DHAVE_CONFIG_H \
- -DHAVE_XEXTPROTO_71=1 \
+ $(shell pkg-config xextproto --atleast-version=7.0.99.1 \
+ && echo "-DHAVE_XEXTPROTO_71") \
$(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/auxiliary \
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index 6871625605f..e039bb12b6d 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -9,37 +9,47 @@
#include "pipe/p_inlines.h"
+/*XXX also in Xrender.h but the including it here breaks compilition */
+#define XFixedToDouble(f) (((double) (f)) / 65536.)
+
struct xorg_composite_blend {
- int op:8;
+ int op : 8;
- unsigned rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */
- unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */
+ unsigned alpha_dst : 4;
+ unsigned alpha_src : 4;
- unsigned rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */
- unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */
+ unsigned rgb_src : 8; /**< PIPE_BLENDFACTOR_x */
+ unsigned rgb_dst : 8; /**< PIPE_BLENDFACTOR_x */
};
#define BLEND_OP_OVER 3
static const struct xorg_composite_blend xorg_blends[] = {
{ PictOpClear,
- PIPE_BLENDFACTOR_CONST_COLOR, PIPE_BLENDFACTOR_CONST_ALPHA,
- PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO },
-
+ 0, 0, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO},
{ PictOpSrc,
- PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE,
- PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO },
-
+ 0, 0, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ZERO},
{ PictOpDst,
- PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO,
- PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE },
-
+ 0, 0, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ONE},
{ PictOpOver,
- PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE,
- PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA },
-
+ 0, 1, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_INV_SRC_ALPHA},
{ PictOpOverReverse,
- PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE,
- PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA },
+ 1, 0, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ONE},
+ { PictOpIn,
+ 1, 0, PIPE_BLENDFACTOR_DST_ALPHA, PIPE_BLENDFACTOR_ZERO},
+ { PictOpInReverse,
+ 0, 1, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_SRC_ALPHA},
+ { PictOpOut,
+ 1, 0, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ZERO},
+ { PictOpOutReverse,
+ 0, 1, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_INV_SRC_ALPHA},
+ { PictOpAtop,
+ 1, 1, PIPE_BLENDFACTOR_DST_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA},
+ { PictOpAtopReverse,
+ 1, 1, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_SRC_ALPHA},
+ { PictOpXor,
+ 1, 1, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA},
+ { PictOpAdd,
+ 0, 0, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE},
};
@@ -58,40 +68,48 @@ pixel_to_float4(Pixel pixel, float *color)
color[3] = ((float)a) / 255.;
}
-struct acceleration_info {
- int op : 16;
- int with_mask : 1;
- int component_alpha : 1;
-};
-static const struct acceleration_info accelerated_ops[] = {
- {PictOpClear, 1, 0},
- {PictOpSrc, 1, 0},
- {PictOpDst, 1, 0},
- {PictOpOver, 1, 0},
- {PictOpOverReverse, 1, 0},
- {PictOpIn, 1, 0},
- {PictOpInReverse, 1, 0},
- {PictOpOut, 1, 0},
- {PictOpOutReverse, 1, 0},
- {PictOpAtop, 1, 0},
- {PictOpAtopReverse, 1, 0},
- {PictOpXor, 1, 0},
- {PictOpAdd, 1, 0},
- {PictOpSaturate, 1, 0},
-};
-
-static struct xorg_composite_blend
-blend_for_op(int op)
+static boolean
+blend_for_op(struct xorg_composite_blend *blend,
+ int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture)
{
const int num_blends =
sizeof(xorg_blends)/sizeof(struct xorg_composite_blend);
int i;
+ boolean supported = FALSE;
+
+ /* our default in case something goes wrong */
+ *blend = xorg_blends[BLEND_OP_OVER];
for (i = 0; i < num_blends; ++i) {
- if (xorg_blends[i].op == op)
- return xorg_blends[i];
+ if (xorg_blends[i].op == op) {
+ *blend = xorg_blends[i];
+ supported = TRUE;
+ }
}
- return xorg_blends[BLEND_OP_OVER];
+
+ /* If there's no dst alpha channel, adjust the blend op so that we'll treat
+ * it as always 1. */
+ if (pDstPicture &&
+ PICT_FORMAT_A(pDstPicture->format) == 0 && blend->alpha_dst) {
+ if (blend->rgb_src == PIPE_BLENDFACTOR_DST_ALPHA)
+ blend->rgb_src = PIPE_BLENDFACTOR_ONE;
+ else if (blend->rgb_src == PIPE_BLENDFACTOR_INV_DST_ALPHA)
+ blend->rgb_src = PIPE_BLENDFACTOR_ZERO;
+ }
+
+ /* If the source alpha is being used, then we should only be in a case where
+ * the source blend factor is 0, and the source blend value is the mask
+ * channels multiplied by the source picture's alpha. */
+ if (pMaskPicture && pMaskPicture->componentAlpha &&
+ PICT_FORMAT_RGB(pMaskPicture->format) && blend->alpha_src) {
+ if (blend->rgb_dst == PIPE_BLENDFACTOR_SRC_ALPHA) {
+ blend->rgb_dst = PIPE_BLENDFACTOR_SRC_COLOR;
+ } else if (blend->rgb_dst == PIPE_BLENDFACTOR_INV_SRC_ALPHA) {
+ blend->rgb_dst = PIPE_BLENDFACTOR_INV_SRC_COLOR;
+ }
+ }
+ return supported;
}
static INLINE int
@@ -112,6 +130,43 @@ render_repeat_to_gallium(int mode)
return PIPE_TEX_WRAP_REPEAT;
}
+static INLINE boolean
+render_filter_to_gallium(int xrender_filter, int *out_filter)
+{
+
+ switch (xrender_filter) {
+ case PictFilterNearest:
+ *out_filter = PIPE_TEX_FILTER_NEAREST;
+ break;
+ case PictFilterBilinear:
+ *out_filter = PIPE_TEX_FILTER_LINEAR;
+ break;
+ case PictFilterFast:
+ *out_filter = PIPE_TEX_FILTER_NEAREST;
+ break;
+ case PictFilterGood:
+ *out_filter = PIPE_TEX_FILTER_LINEAR;
+ break;
+ case PictFilterBest:
+ *out_filter = PIPE_TEX_FILTER_LINEAR;
+ break;
+ default:
+ debug_printf("Unkown xrender filter");
+ *out_filter = PIPE_TEX_FILTER_NEAREST;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static boolean is_filter_accelerated(PicturePtr pic)
+{
+ int filter;
+ if (pic && !render_filter_to_gallium(pic->filter, &filter))
+ return FALSE;
+ return TRUE;
+}
+
boolean xorg_composite_accelerated(int op,
PicturePtr pSrcPicture,
PicturePtr pMaskPicture,
@@ -120,51 +175,53 @@ boolean xorg_composite_accelerated(int op,
ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
- unsigned i;
- unsigned accel_ops_count =
- sizeof(accelerated_ops)/sizeof(struct acceleration_info);
+ struct xorg_composite_blend blend;
+
+ if (!is_filter_accelerated(pSrcPicture) ||
+ !is_filter_accelerated(pMaskPicture)) {
+ XORG_FALLBACK("Unsupported Xrender filter");
+ }
if (pSrcPicture->pSourcePict) {
if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill)
- XORG_FALLBACK("gradients not enabled (haven't been well tested)");
+ XORG_FALLBACK("Gradients not enabled (haven't been well tested)");
}
- for (i = 0; i < accel_ops_count; ++i) {
- if (op == accelerated_ops[i].op) {
- /* Check for unsupported component alpha */
- if ((pSrcPicture->componentAlpha &&
- !accelerated_ops[i].component_alpha) ||
- (pMaskPicture &&
- (!accelerated_ops[i].with_mask ||
- (pMaskPicture->componentAlpha &&
- !accelerated_ops[i].component_alpha))))
- XORG_FALLBACK("component alpha unsupported");
- return TRUE;
+ if (blend_for_op(&blend, op,
+ pSrcPicture, pMaskPicture, pDstPicture)) {
+ /* Check for component alpha */
+ if (pMaskPicture && pMaskPicture->componentAlpha &&
+ PICT_FORMAT_RGB(pMaskPicture->format)) {
+ if (blend.alpha_src && blend.rgb_src != PIPE_BLENDFACTOR_ZERO) {
+ XORG_FALLBACK("Component alpha not supported with source "
+ "alpha and source value blending. (op=%d)",
+ op);
+ }
}
+ return TRUE;
}
- XORG_FALLBACK("unsupported operation");
+ XORG_FALLBACK("Unsupported composition operation = %d", op);
}
static void
bind_blend_state(struct exa_context *exa, int op,
- PicturePtr pSrcPicture, PicturePtr pMaskPicture)
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture)
{
struct xorg_composite_blend blend_opt;
struct pipe_blend_state blend;
- blend_opt = blend_for_op(op);
+ blend_for_op(&blend_opt, op, pSrcPicture, pMaskPicture, pDstPicture);
memset(&blend, 0, sizeof(struct pipe_blend_state));
blend.blend_enable = 1;
- blend.colormask |= PIPE_MASK_R;
- blend.colormask |= PIPE_MASK_G;
- blend.colormask |= PIPE_MASK_B;
- blend.colormask |= PIPE_MASK_A;
+ blend.colormask |= PIPE_MASK_RGBA;
- blend.rgb_src_factor = blend_opt.rgb_src_factor;
- blend.alpha_src_factor = blend_opt.alpha_src_factor;
- blend.rgb_dst_factor = blend_opt.rgb_dst_factor;
- blend.alpha_dst_factor = blend_opt.alpha_dst_factor;
+ blend.rgb_src_factor = blend_opt.rgb_src;
+ blend.alpha_src_factor = blend_opt.rgb_src;
+ blend.rgb_dst_factor = blend_opt.rgb_dst;
+ blend.alpha_dst_factor = blend_opt.rgb_dst;
cso_set_blend(exa->renderer->cso, &blend);
}
@@ -200,6 +257,8 @@ bind_shaders(struct exa_context *exa, int op,
if (pMaskPicture) {
vs_traits |= VS_MASK;
fs_traits |= FS_MASK;
+ if (pMaskPicture->componentAlpha)
+ fs_traits |= FS_COMPONENT_ALPHA;
}
shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits);
@@ -207,7 +266,6 @@ bind_shaders(struct exa_context *exa, int op,
cso_set_fragment_shader_handle(exa->renderer->cso, shader.fs);
}
-
static void
bind_samplers(struct exa_context *exa, int op,
PicturePtr pSrcPicture, PicturePtr pMaskPicture,
@@ -233,10 +291,15 @@ bind_samplers(struct exa_context *exa, int op,
if (pSrcPicture && pSrc) {
unsigned src_wrap = render_repeat_to_gallium(
pSrcPicture->repeatType);
+ int filter;
+
+ render_filter_to_gallium(pSrcPicture->filter, &filter);
+
src_sampler.wrap_s = src_wrap;
src_sampler.wrap_t = src_wrap;
- src_sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST;
- src_sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST;
+ src_sampler.min_img_filter = filter;
+ src_sampler.mag_img_filter = filter;
+ src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
src_sampler.normalized_coords = 1;
samplers[0] = &src_sampler;
exa->bound_textures[0] = pSrc->tex;
@@ -246,10 +309,15 @@ bind_samplers(struct exa_context *exa, int op,
if (pMaskPicture && pMask) {
unsigned mask_wrap = render_repeat_to_gallium(
pMaskPicture->repeatType);
+ int filter;
+
+ render_filter_to_gallium(pMaskPicture->filter, &filter);
+
mask_sampler.wrap_s = mask_wrap;
mask_sampler.wrap_t = mask_wrap;
- mask_sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST;
- mask_sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST;
+ mask_sampler.min_img_filter = filter;
+ mask_sampler.mag_img_filter = filter;
+ src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
mask_sampler.normalized_coords = 1;
samplers[1] = &mask_sampler;
exa->bound_textures[1] = pMask->tex;
@@ -297,6 +365,44 @@ setup_constant_buffers(struct exa_context *exa, struct exa_pixmap_priv *pDst)
setup_fs_constant_buffer(exa);
}
+static INLINE boolean matrix_from_pict_transform(PictTransform *trans, float *matrix)
+{
+ if (!trans)
+ return FALSE;
+
+ matrix[0] = XFixedToDouble(trans->matrix[0][0]);
+ matrix[1] = XFixedToDouble(trans->matrix[0][1]);
+ matrix[2] = XFixedToDouble(trans->matrix[0][2]);
+
+ matrix[3] = XFixedToDouble(trans->matrix[1][0]);
+ matrix[4] = XFixedToDouble(trans->matrix[1][1]);
+ matrix[5] = XFixedToDouble(trans->matrix[1][2]);
+
+ matrix[6] = XFixedToDouble(trans->matrix[2][0]);
+ matrix[7] = XFixedToDouble(trans->matrix[2][1]);
+ matrix[8] = XFixedToDouble(trans->matrix[2][2]);
+
+ return TRUE;
+}
+
+static void
+setup_transforms(struct exa_context *exa,
+ PicturePtr pSrcPicture, PicturePtr pMaskPicture)
+{
+ PictTransform *src_t = NULL;
+ PictTransform *mask_t = NULL;
+
+ if (pSrcPicture)
+ src_t = pSrcPicture->transform;
+ if (pMaskPicture)
+ mask_t = pMaskPicture->transform;
+
+ exa->transform.has_src =
+ matrix_from_pict_transform(src_t, exa->transform.src);
+ exa->transform.has_mask =
+ matrix_from_pict_transform(mask_t, exa->transform.mask);
+}
+
boolean xorg_composite_bind_state(struct exa_context *exa,
int op,
PicturePtr pSrcPicture,
@@ -308,13 +414,15 @@ boolean xorg_composite_bind_state(struct exa_context *exa,
{
renderer_bind_framebuffer(exa->renderer, pDst);
renderer_bind_viewport(exa->renderer, pDst);
- bind_blend_state(exa, op, pSrcPicture, pMaskPicture);
+ bind_blend_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture);
renderer_bind_rasterizer(exa->renderer);
bind_shaders(exa, op, pSrcPicture, pMaskPicture);
bind_samplers(exa, op, pSrcPicture, pMaskPicture,
pDstPicture, pSrc, pMask, pDst);
setup_constant_buffers(exa, pDst);
+ setup_transforms(exa, pSrcPicture, pMaskPicture);
+
return TRUE;
}
@@ -329,10 +437,19 @@ void xorg_composite(struct exa_context *exa,
exa->solid_color);
} else {
int pos[6] = {srcX, srcY, maskX, maskY, dstX, dstY};
+ float *src_matrix = NULL;
+ float *mask_matrix = NULL;
+
+ if (exa->transform.has_src)
+ src_matrix = exa->transform.src;
+ if (exa->transform.has_mask)
+ mask_matrix = exa->transform.mask;
+
renderer_draw_textures(exa->renderer,
pos, width, height,
exa->bound_textures,
- exa->num_bound_samplers);
+ exa->num_bound_samplers,
+ src_matrix, mask_matrix);
}
}
@@ -346,8 +463,6 @@ boolean xorg_solid_bind_state(struct exa_context *exa,
pixel_to_float4(fg, exa->solid_color);
exa->has_solid_color = TRUE;
- exa->solid_color[3] = 1.f;
-
#if 0
debug_printf("Color Pixel=(%d, %d, %d, %d), RGBA=(%f, %f, %f, %f)\n",
(fg >> 24) & 0xff, (fg >> 16) & 0xff,
@@ -362,7 +477,7 @@ boolean xorg_solid_bind_state(struct exa_context *exa,
renderer_bind_framebuffer(exa->renderer, pixmap);
renderer_bind_viewport(exa->renderer, pixmap);
renderer_bind_rasterizer(exa->renderer);
- bind_blend_state(exa, PictOpSrc, NULL, NULL);
+ bind_blend_state(exa, PictOpSrc, NULL, NULL, NULL);
setup_constant_buffers(exa, pixmap);
shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits);
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index 95973586da8..85b9162d4cf 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -43,10 +43,10 @@
#include "xf86Modes.h"
#ifdef HAVE_XEXTPROTO_71
-#include "X11/extensions/dpmsconst.h"
+#include <X11/extensions/dpmsconst.h>
#else
#define DPMS_SERVER
-#include "X11/extensions/dpmsconst.h"
+#include <X11/extensions/dpms.h>
#endif
#include "pipe/p_inlines.h"
@@ -64,8 +64,6 @@ struct crtc_private
static void
crtc_dpms(xf86CrtcPtr crtc, int mode)
{
- //ScrnInfoPtr pScrn = crtc->scrn;
-
switch (mode) {
case DPMSModeOn:
case DPMSModeStandby:
@@ -77,44 +75,29 @@ crtc_dpms(xf86CrtcPtr crtc, int mode)
}
static Bool
-crtc_lock(xf86CrtcPtr crtc)
-{
- return FALSE;
-}
-
-static void
-crtc_unlock(xf86CrtcPtr crtc)
-{
-}
-
-static void
-crtc_prepare(xf86CrtcPtr crtc)
-{
-}
-
-static void
-crtc_commit(xf86CrtcPtr crtc)
-{
-}
-
-static Bool
-crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode,
- DisplayModePtr adjusted_mode)
-{
- return TRUE;
-}
-
-static void
-crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
- DisplayModePtr adjusted_mode, int x, int y)
+crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
+ Rotation rotation, int x, int y)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
modesettingPtr ms = modesettingPTR(crtc->scrn);
- xf86OutputPtr output = config->output[config->compat_output];
- drmModeConnectorPtr drm_connector = output->driver_private;
+ xf86OutputPtr output = NULL;
+ drmModeConnectorPtr drm_connector;
struct crtc_private *crtcp = crtc->driver_private;
drmModeCrtcPtr drm_crtc = crtcp->drm_crtc;
drmModeModeInfo drm_mode;
+ int i, ret;
+
+ for (i = 0; i < config->num_output; output = NULL, i++) {
+ output = config->output[i];
+
+ if (output->crtc == crtc)
+ break;
+ }
+
+ if (!output)
+ return FALSE;
+
+ drm_connector = output->driver_private;
drm_mode.clock = mode->Clock;
drm_mode.hdisplay = mode->HDisplay;
@@ -133,17 +116,19 @@ crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
xf86SetModeDefaultName(mode);
strncpy(drm_mode.name, mode->name, DRM_DISPLAY_MODE_LEN);
- drmModeSetCrtc(ms->fd, drm_crtc->crtc_id, ms->fb_id, x, y,
- &drm_connector->connector_id, 1, &drm_mode);
-}
+ ret = drmModeSetCrtc(ms->fd, drm_crtc->crtc_id, ms->fb_id, x, y,
+ &drm_connector->connector_id, 1, &drm_mode);
-#if 0
-static void
-crtc_load_lut(xf86CrtcPtr crtc)
-{
- //ScrnInfoPtr pScrn = crtc->scrn;
+ if (ret)
+ return FALSE;
+
+ crtc->x = x;
+ crtc->y = y;
+ crtc->mode = *mode;
+ crtc->rotation = rotation;
+
+ return TRUE;
}
-#endif
static void
crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, CARD16 * blue,
@@ -154,37 +139,37 @@ crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, CARD16 * blue,
static void *
crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
{
- //ScrnInfoPtr pScrn = crtc->scrn;
-
return NULL;
}
static PixmapPtr
crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
{
- //ScrnInfoPtr pScrn = crtc->scrn;
-
return NULL;
}
static void
crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
{
- //ScrnInfoPtr pScrn = crtc->scrn;
}
+/*
+ * Cursor functions
+ */
+
static void
-crtc_destroy(xf86CrtcPtr crtc)
+crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg)
{
- struct crtc_private *crtcp = crtc->driver_private;
+}
- if (crtcp->cursor_tex)
- pipe_texture_reference(&crtcp->cursor_tex, NULL);
+static void
+crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
+{
+ modesettingPtr ms = modesettingPTR(crtc->scrn);
+ struct crtc_private *crtcp = crtc->driver_private;
- drmModeFreeCrtc(crtcp->drm_crtc);
- xfree(crtcp);
+ drmModeMoveCursor(ms->fd, crtcp->drm_crtc->crtc_id, x, y);
}
-
static void
crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
{
@@ -230,15 +215,6 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
}
static void
-crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
-{
- modesettingPtr ms = modesettingPTR(crtc->scrn);
- struct crtc_private *crtcp = crtc->driver_private;
-
- drmModeMoveCursor(ms->fd, crtcp->drm_crtc->crtc_id, x, y);
-}
-
-static void
crtc_show_cursor(xf86CrtcPtr crtc)
{
modesettingPtr ms = modesettingPTR(crtc->scrn);
@@ -258,29 +234,6 @@ crtc_hide_cursor(xf86CrtcPtr crtc)
drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, 0, 0, 0);
}
-static const xf86CrtcFuncsRec crtc_funcs = {
- .dpms = crtc_dpms,
- .save = NULL,
- .restore = NULL,
- .lock = crtc_lock,
- .unlock = crtc_unlock,
- .mode_fixup = crtc_mode_fixup,
- .prepare = crtc_prepare,
- .mode_set = crtc_mode_set,
- .commit = crtc_commit,
- .gamma_set = crtc_gamma_set,
- .shadow_create = crtc_shadow_create,
- .shadow_allocate = crtc_shadow_allocate,
- .shadow_destroy = crtc_shadow_destroy,
- .set_cursor_position = crtc_set_cursor_position,
- .show_cursor = crtc_show_cursor,
- .hide_cursor = crtc_hide_cursor,
- .load_cursor_image = NULL, /* lets convert to argb only */
- .set_cursor_colors = NULL, /* using argb only */
- .load_cursor_argb = crtc_load_cursor_argb,
- .destroy = crtc_destroy,
-};
-
void
crtc_cursor_destroy(xf86CrtcPtr crtc)
{
@@ -291,6 +244,40 @@ crtc_cursor_destroy(xf86CrtcPtr crtc)
}
}
+/*
+ * Misc functions
+ */
+
+static void
+crtc_destroy(xf86CrtcPtr crtc)
+{
+ struct crtc_private *crtcp = crtc->driver_private;
+
+ if (crtcp->cursor_tex)
+ pipe_texture_reference(&crtcp->cursor_tex, NULL);
+
+ drmModeFreeCrtc(crtcp->drm_crtc);
+ xfree(crtcp);
+}
+
+static const xf86CrtcFuncsRec crtc_funcs = {
+ .dpms = crtc_dpms,
+ .set_mode_major = crtc_set_mode_major,
+
+ .set_cursor_colors = crtc_set_cursor_colors,
+ .set_cursor_position = crtc_set_cursor_position,
+ .show_cursor = crtc_show_cursor,
+ .hide_cursor = crtc_hide_cursor,
+ .load_cursor_argb = crtc_load_cursor_argb,
+
+ .shadow_create = crtc_shadow_create,
+ .shadow_allocate = crtc_shadow_allocate,
+ .shadow_destroy = crtc_shadow_destroy,
+
+ .gamma_set = crtc_gamma_set,
+ .destroy = crtc_destroy,
+};
+
void
crtc_init(ScrnInfoPtr pScrn)
{
@@ -309,6 +296,7 @@ crtc_init(ScrnInfoPtr pScrn)
for (c = 0; c < res->count_crtcs; c++) {
drm_crtc = drmModeGetCrtc(ms->fd, res->crtcs[c]);
+
if (!drm_crtc)
continue;
@@ -325,7 +313,6 @@ crtc_init(ScrnInfoPtr pScrn)
crtcp->drm_crtc = drm_crtc;
crtc->driver_private = crtcp;
-
}
out:
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index ab6c3d75580..847647c1e4d 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -144,20 +144,22 @@ static Bool
CreateFrontBuffer(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
- ScreenPtr pScreen = pScrn->pScreen;
- PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen);
unsigned handle, stride;
+ struct pipe_texture *tex;
ms->noEvict = TRUE;
- xorg_exa_set_displayed_usage(rootPixmap);
- pScreen->ModifyPixmapHeader(rootPixmap,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->depth, pScrn->bitsPerPixel,
- pScrn->displayWidth * pScrn->bitsPerPixel / 8,
- NULL);
- ms->noEvict = FALSE;
- handle = xorg_exa_get_pixmap_handle(rootPixmap, &stride);
+ tex = xorg_exa_create_root_texture(pScrn, pScrn->virtualX, pScrn->virtualY,
+ pScrn->depth, pScrn->bitsPerPixel);
+
+ if (!tex)
+ return FALSE;
+
+ if (!ms->api->local_handle_from_texture(ms->api, ms->screen,
+ tex,
+ &stride,
+ &handle))
+ return FALSE;
drmModeAddFB(ms->fd,
pScrn->virtualX,
@@ -166,12 +168,39 @@ CreateFrontBuffer(ScrnInfoPtr pScrn)
pScrn->bitsPerPixel,
stride,
handle,
- &ms->fb_id);
+ &ms->fb_id);
pScrn->frameX0 = 0;
pScrn->frameY0 = 0;
AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ pipe_texture_reference(&ms->root_texture, tex);
+ pipe_texture_reference(&tex, NULL);
+ return TRUE;
+}
+
+static Bool
+BindTextureToRoot(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+ ScreenPtr pScreen = pScrn->pScreen;
+ struct pipe_texture *check;
+ PixmapPtr rootPixmap;
+
+ rootPixmap = pScreen->GetScreenPixmap(pScreen);
+
+ xorg_exa_set_displayed_usage(rootPixmap);
+ xorg_exa_set_shared_usage(rootPixmap);
+ xorg_exa_set_texture(rootPixmap, ms->root_texture);
+ if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, NULL))
+ FatalError("Couldn't adjust screen pixmap\n");
+
+ check = xorg_exa_get_texture(rootPixmap);
+ if (ms->root_texture != check)
+ FatalError("Created new root texture\n");
+
+ pipe_texture_reference(&check, NULL);
+
return TRUE;
}
@@ -179,10 +208,9 @@ static Bool
crtc_resize(ScrnInfoPtr pScrn, int width, int height)
{
modesettingPtr ms = modesettingPTR(pScrn);
- //ScreenPtr pScreen = pScrn->pScreen;
- //PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen);
- //Bool fbAccessDisabled;
- //CARD8 *fbstart;
+ unsigned handle, stride;
+ PixmapPtr rootPixmap;
+ ScreenPtr pScreen = pScrn->pScreen;
if (width == pScrn->virtualX && height == pScrn->virtualY)
return TRUE;
@@ -192,13 +220,40 @@ crtc_resize(ScrnInfoPtr pScrn, int width, int height)
pScrn->virtualX = width;
pScrn->virtualY = height;
+ /*
+ * Remove the old framebuffer & texture.
+ */
+ drmModeRmFB(ms->fd, ms->fb_id);
+ pipe_texture_reference(&ms->root_texture, NULL);
+
+
+ rootPixmap = pScreen->GetScreenPixmap(pScreen);
+ if (!pScreen->ModifyPixmapHeader(rootPixmap, width, height, -1, -1, -1, NULL))
+ return FALSE;
+
+ /* takes one ref */
+ ms->root_texture = xorg_exa_get_texture(rootPixmap);
+
+ if (!ms->api->local_handle_from_texture(ms->api, ms->screen,
+ ms->root_texture,
+ &stride,
+ &handle))
+ FatalError("Could not get handle and stride from texture\n");
+
+ drmModeAddFB(ms->fd,
+ pScrn->virtualX,
+ pScrn->virtualY,
+ pScrn->depth,
+ pScrn->bitsPerPixel,
+ stride,
+ handle,
+ &ms->fb_id);
+
/* HW dependent - FIXME */
pScrn->displayWidth = pScrn->virtualX;
- drmModeRmFB(ms->fd, ms->fb_id);
-
/* now create new frontbuffer */
- return CreateFrontBuffer(pScrn);
+ return CreateFrontBuffer(pScrn) && BindTextureToRoot(pScrn);
}
static const xf86CrtcConfigFuncsRec crtc_config_funcs = {
@@ -206,6 +261,37 @@ static const xf86CrtcConfigFuncsRec crtc_config_funcs = {
};
static Bool
+InitDRM(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ /* deal with server regeneration */
+ if (ms->fd < 0) {
+ char *BusID;
+
+ BusID = xalloc(64);
+ sprintf(BusID, "PCI:%d:%d:%d",
+ ((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
+ ms->PciInfo->dev, ms->PciInfo->func
+ );
+
+ ms->fd = drmOpen(NULL, BusID);
+
+ if (ms->fd < 0)
+ return FALSE;
+ }
+
+ if (!ms->api) {
+ ms->api = drm_api_create();
+
+ if (!ms->api)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static Bool
PreInit(ScrnInfoPtr pScrn, int flags)
{
xf86CrtcConfigPtr xf86_config;
@@ -213,7 +299,6 @@ PreInit(ScrnInfoPtr pScrn, int flags)
rgb defaultWeight = { 0, 0, 0 };
EntityInfoPtr pEnt;
EntPtr msEnt = NULL;
- char *BusID;
int max_width, max_height;
if (pScrn->numEntities != 1)
@@ -262,16 +347,9 @@ PreInit(ScrnInfoPtr pScrn, int flags)
}
}
- BusID = xalloc(64);
- sprintf(BusID, "PCI:%d:%d:%d",
- ((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
- ms->PciInfo->dev, ms->PciInfo->func
- );
-
- ms->api = drm_api_create();
- ms->fd = drmOpen(NULL, BusID);
-
- if (ms->fd < 0)
+ ms->fd = -1;
+ ms->api = NULL;
+ if (!InitDRM(pScrn))
return FALSE;
pScrn->monitor = pScrn->confScreen->monitor;
@@ -429,7 +507,6 @@ CreateScreenResources(ScreenPtr pScreen)
modesettingPtr ms = modesettingPTR(pScrn);
PixmapPtr rootPixmap;
Bool ret;
- unsigned handle, stride;
ms->noEvict = TRUE;
@@ -437,29 +514,14 @@ CreateScreenResources(ScreenPtr pScreen)
ret = pScreen->CreateScreenResources(pScreen);
pScreen->CreateScreenResources = CreateScreenResources;
- rootPixmap = pScreen->GetScreenPixmap(pScreen);
-
- xorg_exa_set_displayed_usage(rootPixmap);
- xorg_exa_set_shared_usage(rootPixmap);
- if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, NULL))
- FatalError("Couldn't adjust screen pixmap\n");
+ BindTextureToRoot(pScrn);
ms->noEvict = FALSE;
- handle = xorg_exa_get_pixmap_handle(rootPixmap, &stride);
-
- drmModeAddFB(ms->fd,
- pScrn->virtualX,
- pScrn->virtualY,
- pScrn->depth,
- pScrn->bitsPerPixel,
- stride,
- handle,
- &ms->fb_id);
-
AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
#ifdef DRM_MODE_FEATURE_DIRTYFB
+ rootPixmap = pScreen->GetScreenPixmap(pScreen);
ms->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE,
pScreen, rootPixmap);
@@ -472,6 +534,8 @@ CreateScreenResources(ScreenPtr pScreen)
"Failed to create screen damage record\n");
return FALSE;
}
+#else
+ (void)rootPixmap;
#endif
return ret;
@@ -484,21 +548,8 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
modesettingPtr ms = modesettingPTR(pScrn);
VisualPtr visual;
- /* deal with server regeneration */
- if (ms->fd < 0) {
- char *BusID;
-
- BusID = xalloc(64);
- sprintf(BusID, "PCI:%d:%d:%d",
- ((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
- ms->PciInfo->dev, ms->PciInfo->func
- );
-
- ms->fd = drmOpen(NULL, BusID);
-
- if (ms->fd < 0)
- return FALSE;
- }
+ if (!InitDRM(pScrn))
+ return FALSE;
if (!ms->screen) {
ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL);
@@ -610,8 +661,8 @@ AdjustFrame(int scrnIndex, int x, int y, int flags)
xf86CrtcPtr crtc = output->crtc;
if (crtc && crtc->enabled) {
- crtc->funcs->mode_set(crtc, pScrn->currentMode, pScrn->currentMode, x,
- y);
+ crtc->funcs->set_mode_major(crtc, pScrn->currentMode,
+ RR_Rotate_0, x, y);
crtc->x = output->initial_x + x;
crtc->y = output->initial_y + y;
}
@@ -684,8 +735,11 @@ EnterVT(int scrnIndex, int flags)
SaveHWState(pScrn);
}
- if (!flags) /* signals startup as we'll do this in CreateScreenResources */
- CreateFrontBuffer(pScrn);
+ if (!CreateFrontBuffer(pScrn))
+ return FALSE;
+
+ if (!flags && !BindTextureToRoot(pScrn))
+ return FALSE;
if (!xf86SetDesiredModes(pScrn))
return FALSE;
@@ -725,10 +779,12 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen)
}
#endif
+ pipe_texture_reference(&ms->root_texture, NULL);
+
if (ms->exa)
xorg_exa_close(pScrn);
- if (ms->api->destroy)
+ if (ms->api && ms->api->destroy)
ms->api->destroy(ms->api);
ms->api = NULL;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index af76d6690f5..b83d97bdb62 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -47,7 +47,7 @@
#define DEBUG_PRINT 0
#define DEBUG_SOLID 0
-#define DISABLE_ACCEL 0
+#define ACCEL_ENABLED TRUE
/*
* Helper functions
@@ -92,6 +92,8 @@ xorg_exa_common_done(struct exa_context *exa)
{
exa->copy.src = NULL;
exa->copy.dst = NULL;
+ exa->transform.has_src = FALSE;
+ exa->transform.has_mask = FALSE;
exa->has_solid_color = FALSE;
exa->num_bound_samplers = 0;
}
@@ -103,12 +105,21 @@ xorg_exa_common_done(struct exa_context *exa)
static void
ExaWaitMarker(ScreenPtr pScreen, int marker)
{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ modesettingPtr ms = modesettingPTR(pScrn);
+ struct exa_context *exa = ms->exa;
+
+#if 0
+ xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, NULL);
+#else
+ xorg_exa_finish(exa);
+#endif
}
static int
ExaMarkSync(ScreenPtr pScreen)
{
- return 1;
+ return 1;
}
static Bool
@@ -256,11 +267,6 @@ ExaDone(PixmapPtr pPixmap)
if (!priv)
return;
-#if 1
- xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, NULL);
-#else
- xorg_exa_finish(exa);
-#endif
xorg_exa_common_done(exa);
}
@@ -307,11 +313,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
fg = 0xffff0000;
#endif
-#if DISABLE_ACCEL
- return FALSE;
-#else
- return xorg_solid_bind_state(exa, priv, fg);
-#endif
+ return ACCEL_ENABLED && xorg_solid_bind_state(exa, priv, fg);
}
static void
@@ -409,11 +411,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
exa->copy.src = src_priv;
exa->copy.dst = priv;
-#if DISABLE_ACCEL
- return FALSE;
-#else
- return TRUE;
-#endif
+ return ACCEL_ENABLED;
}
static void
@@ -448,7 +446,8 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
struct exa_pixmap_priv *priv;
#if DEBUG_PRINT
- debug_printf("ExaPrepareComposite\n");
+ debug_printf("ExaPrepareComposite(%d, src=0x%p, mask=0x%p, dst=0x%p)\n",
+ op, pSrcPicture, pMaskPicture, pDstPicture);
#endif
if (!exa->pipe)
XORG_FALLBACK("accle not enabled");
@@ -484,16 +483,12 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
XORG_FALLBACK("pMask format: %s", pf_name(priv->tex->format));
}
-#if DISABLE_ACCEL
- (void) exa;
- return FALSE;
-#else
- return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture,
+ return ACCEL_ENABLED &&
+ xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture,
pDstPicture,
pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL,
pMask ? exaGetPixmapDriverPrivate(pMask) : NULL,
exaGetPixmapDriverPrivate(pDst));
-#endif
}
static void
@@ -526,10 +521,7 @@ ExaCheckComposite(int op,
debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n",
op, pSrcPicture, pMaskPicture, pDstPicture, accelerated);
#endif
-#if DISABLE_ACCEL
- accelerated = FALSE;
-#endif
- return accelerated;
+ return ACCEL_ENABLED && accelerated;
}
static void *
@@ -693,9 +685,15 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
dst_surf = exa->scrn->get_tex_surface(
exa->scrn, texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE);
src_surf = xorg_gpu_surface(exa->pipe->screen, priv);
- exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf,
- 0, 0, min(width, texture->width[0]),
- min(height, texture->height[0]));
+ if (exa->pipe->surface_copy) {
+ exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf,
+ 0, 0, min(width, texture->width[0]),
+ min(height, texture->height[0]));
+ } else {
+ util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf,
+ 0, 0, min(width, texture->width[0]),
+ min(height, texture->height[0]));
+ }
exa->scrn->tex_surface_destroy(dst_surf);
exa->scrn->tex_surface_destroy(src_surf);
}
@@ -717,6 +715,50 @@ xorg_exa_get_texture(PixmapPtr pPixmap)
return tex;
}
+Bool
+xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex)
+{
+ struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
+
+ int mask = PIPE_TEXTURE_USAGE_PRIMARY | PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+
+ if (!priv)
+ return FALSE;
+
+ if (pPixmap->drawable.width != tex->width[0] ||
+ pPixmap->drawable.height != tex->height[0])
+ return FALSE;
+
+ pipe_texture_reference(&priv->tex, tex);
+ priv->tex_flags = tex->tex_usage & mask;
+
+ return TRUE;
+}
+
+struct pipe_texture *
+xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
+ int width, int height,
+ int depth, int bitsPerPixel)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+ struct exa_context *exa = ms->exa;
+ struct pipe_texture template;
+
+ memset(&template, 0, sizeof(template));
+ template.target = PIPE_TEXTURE_2D;
+ exa_get_pipe_format(depth, &template.format, &bitsPerPixel);
+ pf_get_block(template.format, &template.block);
+ template.width[0] = width;
+ template.height[0] = height;
+ template.depth[0] = 1;
+ template.last_level = 0;
+ template.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
+ template.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
+ template.tex_usage |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+
+ return exa->scrn->texture_create(exa->scrn, &template);
+}
+
void
xorg_exa_close(ScrnInfoPtr pScrn)
{
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h
index 292f964cec6..45f88d94048 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.h
+++ b/src/gallium/state_trackers/xorg/xorg_exa.h
@@ -24,6 +24,14 @@ struct exa_context
float solid_color[4];
boolean has_solid_color;
+ /* float[9] projective matrix bound to pictures */
+ struct {
+ float src[9];
+ float mask[9];
+ boolean has_src;
+ boolean has_mask;
+ } transform;
+
struct {
struct exa_pixmap_priv *src;
struct exa_pixmap_priv *dst;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
index 8c9b674b4b6..041f4f96dc8 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
@@ -50,36 +50,20 @@ struct xorg_shaders {
struct cso_hash *fs_hash;
};
-static const char over_op[] =
- "SUB TEMP[3], CONST[0].wwww, TEMP[1].wwww\n"
- "MAD TEMP[3], TEMP[0], TEMP[3], TEMP[0]\n";
-
-
-static INLINE void
-create_preamble(struct ureg_program *ureg)
-{
-}
-
-
static INLINE void
src_in_mask(struct ureg_program *ureg,
struct ureg_dst dst,
struct ureg_src src,
- struct ureg_src mask)
+ struct ureg_src mask,
+ boolean component_alpha)
{
-#if 0
- /* MUL dst, src, mask.a */
- ureg_MUL(ureg, dst, src,
- ureg_scalar(mask, TGSI_SWIZZLE_W));
-#else
- /* MOV dst, src */
- /* MUL dst.a, src.a, mask.a */
- ureg_MOV(ureg, dst, src);
- ureg_MUL(ureg,
- ureg_writemask(dst, TGSI_WRITEMASK_W),
- ureg_scalar(src, TGSI_SWIZZLE_W),
- ureg_scalar(mask, TGSI_SWIZZLE_W));
-#endif
+ if (component_alpha) {
+ ureg_MUL(ureg, dst, src, mask);
+ }
+ else {
+ ureg_MUL(ureg, dst, src,
+ ureg_scalar(mask, TGSI_SWIZZLE_W));
+ }
}
static struct ureg_src
@@ -305,6 +289,7 @@ create_fs(struct pipe_context *pipe,
boolean is_solid = fs_traits & FS_SOLID_FILL;
boolean is_lingrad = fs_traits & FS_LINGRAD_FILL;
boolean is_radgrad = fs_traits & FS_RADGRAD_FILL;
+ boolean is_comp_alpha = fs_traits & FS_COMPONENT_ALPHA;
ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT);
if (ureg == NULL)
@@ -401,7 +386,7 @@ create_fs(struct pipe_context *pipe,
ureg_TEX(ureg, mask,
TGSI_TEXTURE_2D, mask_pos, mask_sampler);
/* src IN mask */
- src_in_mask(ureg, out, ureg_src(src), ureg_src(mask));
+ src_in_mask(ureg, out, ureg_src(src), ureg_src(mask), is_comp_alpha);
ureg_release_temporary(ureg, mask);
}
diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h
index 33c272070b8..c290d44e8fc 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h
+++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h
@@ -23,7 +23,8 @@ enum xorg_fs_traits {
FS_RADGRAD_FILL = 1 << 4,
FS_FILL = (FS_SOLID_FILL |
FS_LINGRAD_FILL |
- FS_RADGRAD_FILL)
+ FS_RADGRAD_FILL),
+ FS_COMPONENT_ALPHA = 1 << 5
};
struct xorg_shader {
diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c
index 26f45f8d645..bfeddc5e114 100644
--- a/src/gallium/state_trackers/xorg/xorg_output.c
+++ b/src/gallium/state_trackers/xorg/xorg_output.c
@@ -56,66 +56,29 @@
static char *connector_enum_list[] = {
"Unknown",
"VGA",
- "DVI-I",
- "DVI-D",
- "DVI-A",
+ "DVI",
+ "DVI",
+ "DVI",
"Composite",
"SVIDEO",
"LVDS",
- "Component",
- "9-pin DIN",
- "DisplayPort",
- "HDMI Type A",
- "HDMI Type B",
+ "CTV",
+ "DIN",
+ "DP",
+ "HDMI",
+ "HDMI",
};
static void
-dpms(xf86OutputPtr output, int mode)
-{
-}
-
-static void
-save(xf86OutputPtr output)
-{
-}
-
-static void
-restore(xf86OutputPtr output)
-{
-}
-
-static int
-mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
-{
- return MODE_OK;
-}
-
-static Bool
-mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
- DisplayModePtr adjusted_mode)
-{
- return TRUE;
-}
-
-static void
-prepare(xf86OutputPtr output)
-{
- dpms(output, DPMSModeOff);
-}
-
-static void
-mode_set(xf86OutputPtr output, DisplayModePtr mode,
- DisplayModePtr adjusted_mode)
+create_resources(xf86OutputPtr output)
{
+#ifdef RANDR_12_INTERFACE
+#endif /* RANDR_12_INTERFACE */
}
static void
-commit(xf86OutputPtr output)
+dpms(xf86OutputPtr output, int mode)
{
- dpms(output, DPMSModeOn);
-
- if (output->scrn->pScreen != NULL)
- xf86_reload_cursors(output->scrn->pScreen);
}
static xf86OutputStatus
@@ -171,17 +134,10 @@ get_modes(xf86OutputPtr output)
return modes;
}
-static void
-destroy(xf86OutputPtr output)
-{
- drmModeFreeConnector(output->driver_private);
-}
-
-static void
-create_resources(xf86OutputPtr output)
+static int
+mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
{
-#ifdef RANDR_12_INTERFACE
-#endif /* RANDR_12_INTERFACE */
+ return MODE_OK;
}
#ifdef RANDR_12_INTERFACE
@@ -200,36 +156,26 @@ get_property(xf86OutputPtr output, Atom property)
}
#endif /* RANDR_13_INTERFACE */
-#ifdef RANDR_GET_CRTC_INTERFACE
-static xf86CrtcPtr
-get_crtc(xf86OutputPtr output)
+static void
+destroy(xf86OutputPtr output)
{
- return NULL;
+ drmModeFreeConnector(output->driver_private);
}
-#endif
static const xf86OutputFuncsRec output_funcs = {
.create_resources = create_resources,
- .dpms = dpms,
- .save = save,
- .restore = restore,
- .mode_valid = mode_valid,
- .mode_fixup = mode_fixup,
- .prepare = prepare,
- .mode_set = mode_set,
- .commit = commit,
- .detect = detect,
- .get_modes = get_modes,
#ifdef RANDR_12_INTERFACE
.set_property = set_property,
#endif
#ifdef RANDR_13_INTERFACE
.get_property = get_property,
#endif
+ .dpms = dpms,
+ .detect = detect,
+
+ .get_modes = get_modes,
+ .mode_valid = mode_valid,
.destroy = destroy,
-#ifdef RANDR_GET_CRTC_INTERFACE
- .get_crtc = get_crtc,
-#endif
};
void
@@ -240,7 +186,7 @@ output_init(ScrnInfoPtr pScrn)
drmModeResPtr res;
drmModeConnectorPtr drm_connector = NULL;
drmModeEncoderPtr drm_encoder = NULL;
- char *name;
+ char name[32];
int c, v, p;
res = drmModeGetResources(ms->fd);
@@ -273,7 +219,10 @@ output_init(ScrnInfoPtr pScrn)
(void)v;
#endif
- name = connector_enum_list[drm_connector->connector_type];
+ snprintf(name, 32, "%s%d",
+ connector_enum_list[drm_connector->connector_type],
+ drm_connector->connector_type_id);
+
output = xf86OutputCreate(pScrn, &output_funcs, name);
if (!output)
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 1eecf7d2b97..393f3fac3ed 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -7,14 +7,43 @@
#include "util/u_draw_quad.h"
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "util/u_rect.h"
#include "pipe/p_inlines.h"
+#include <math.h>
+
enum AxisOrientation {
Y0_BOTTOM,
Y0_TOP
};
+#define floatsEqual(x, y) (fabs(x - y) <= 0.00001f * MIN2(fabs(x), fabs(y)))
+#define floatIsZero(x) (floatsEqual((x) + 1, 1))
+
+static INLINE boolean is_affine(float *matrix)
+{
+ return floatIsZero(matrix[2]) && floatIsZero(matrix[5])
+ && floatsEqual(matrix[8], 1);
+}
+static INLINE void map_point(float *mat, float x, float y,
+ float *out_x, float *out_y)
+{
+ if (!mat) {
+ *out_x = x;
+ *out_y = y;
+ return;
+ }
+
+ *out_x = mat[0]*x + mat[3]*y + mat[6];
+ *out_y = mat[1]*x + mat[4]*y + mat[7];
+ if (!is_affine(mat)) {
+ float w = 1/(mat[2]*x + mat[5]*y + mat[8]);
+ *out_x *= w;
+ *out_y *= w;
+ }
+}
+
static void
renderer_init_state(struct xorg_renderer *r)
{
@@ -59,23 +88,38 @@ static struct pipe_buffer *
setup_vertex_data1(struct xorg_renderer *r,
int srcX, int srcY, int dstX, int dstY,
int width, int height,
- struct pipe_texture *src)
+ struct pipe_texture *src, float *src_matrix)
{
- float s0, t0, s1, t1;
+ float s0, t0, s1, t1, stmp, ttmp;
s0 = srcX / src->width[0];
s1 = srcX + width / src->width[0];
t0 = srcY / src->height[0];
t1 = srcY + height / src->height[0];
- /* 1st vertex */
- setup_vertex1(r->vertices2[0], dstX, dstY, s0, t0);
- /* 2nd vertex */
- setup_vertex1(r->vertices2[1], dstX + width, dstY, s1, t0);
- /* 3rd vertex */
- setup_vertex1(r->vertices2[2], dstX + width, dstY + height, s1, t1);
- /* 4th vertex */
- setup_vertex1(r->vertices2[3], dstX, dstY + height, s0, t1);
+ if (src_matrix) {
+ /* 1st vertex */
+ map_point(src_matrix, s0, t0, &stmp, &ttmp);
+ setup_vertex1(r->vertices2[0], dstX, dstY, stmp, ttmp);
+ /* 2nd vertex */
+ map_point(src_matrix, s1, t0, &stmp, &ttmp);
+ setup_vertex1(r->vertices2[1], dstX + width, dstY, stmp, ttmp);
+ /* 3rd vertex */
+ map_point(src_matrix, s1, t1, &stmp, &ttmp);
+ setup_vertex1(r->vertices2[2], dstX + width, dstY + height, stmp, ttmp);
+ /* 4th vertex */
+ map_point(src_matrix, s0, t1, &stmp, &ttmp);
+ setup_vertex1(r->vertices2[3], dstX, dstY + height, stmp, ttmp);
+ } else {
+ /* 1st vertex */
+ setup_vertex1(r->vertices2[0], dstX, dstY, s0, t0);
+ /* 2nd vertex */
+ setup_vertex1(r->vertices2[1], dstX + width, dstY, s1, t0);
+ /* 3rd vertex */
+ setup_vertex1(r->vertices2[2], dstX + width, dstY + height, s1, t1);
+ /* 4th vertex */
+ setup_vertex1(r->vertices2[3], dstX, dstY + height, s0, t1);
+ }
return pipe_user_buffer_create(r->pipe->screen,
r->vertices2,
@@ -127,9 +171,11 @@ setup_vertex_data2(struct xorg_renderer *r,
int srcX, int srcY, int maskX, int maskY,
int dstX, int dstY, int width, int height,
struct pipe_texture *src,
- struct pipe_texture *mask)
+ struct pipe_texture *mask,
+ float *src_matrix, float *mask_matrix)
{
float st0[4], st1[4];
+ float pt0[2], pt1[2];
st0[0] = srcX / src->width[0];
st0[1] = srcY / src->height[0];
@@ -141,18 +187,49 @@ setup_vertex_data2(struct xorg_renderer *r,
st1[2] = maskX + width / mask->width[0];
st1[3] = maskY + height / mask->height[0];
- /* 1st vertex */
- setup_vertex2(r->vertices3[0], dstX, dstY,
- st0[0], st0[1], st1[0], st1[1]);
- /* 2nd vertex */
- setup_vertex2(r->vertices3[1], dstX + width, dstY,
- st0[2], st0[1], st1[2], st1[1]);
- /* 3rd vertex */
- setup_vertex2(r->vertices3[2], dstX + width, dstY + height,
- st0[2], st0[3], st1[2], st1[3]);
- /* 4th vertex */
- setup_vertex2(r->vertices3[3], dstX, dstY + height,
- st0[0], st0[3], st1[0], st1[3]);
+ if (src_matrix || mask_matrix) {
+ /* 1st vertex */
+ map_point(src_matrix, st0[0], st0[1],
+ pt0 + 0, pt0 + 1);
+ map_point(mask_matrix, st1[0], st1[1],
+ pt1 + 0, pt1 + 1);
+ setup_vertex2(r->vertices3[0], dstX, dstY,
+ pt0[0], pt0[1], pt1[0], pt1[1]);
+ /* 2nd vertex */
+ map_point(src_matrix, st0[2], st0[1],
+ pt0 + 0, pt0 + 1);
+ map_point(mask_matrix, st1[2], st1[1],
+ pt1 + 0, pt1 + 1);
+ setup_vertex2(r->vertices3[1], dstX + width, dstY,
+ pt0[0], pt0[1], pt1[0], pt1[1]);
+ /* 3rd vertex */
+ map_point(src_matrix, st0[2], st0[3],
+ pt0 + 0, pt0 + 1);
+ map_point(mask_matrix, st1[2], st1[3],
+ pt1 + 0, pt1 + 1);
+ setup_vertex2(r->vertices3[2], dstX + width, dstY + height,
+ pt0[0], pt0[1], pt1[0], pt1[1]);
+ /* 4th vertex */
+ map_point(src_matrix, st0[0], st0[3],
+ pt0 + 0, pt0 + 1);
+ map_point(mask_matrix, st1[0], st1[3],
+ pt1 + 0, pt1 + 1);
+ setup_vertex2(r->vertices3[3], dstX, dstY + height,
+ pt0[0], pt0[1], pt1[0], pt1[1]);
+ } else {
+ /* 1st vertex */
+ setup_vertex2(r->vertices3[0], dstX, dstY,
+ st0[0], st0[1], st1[0], st1[1]);
+ /* 2nd vertex */
+ setup_vertex2(r->vertices3[1], dstX + width, dstY,
+ st0[2], st0[1], st1[2], st1[1]);
+ /* 3rd vertex */
+ setup_vertex2(r->vertices3[2], dstX + width, dstY + height,
+ st0[2], st0[3], st1[2], st1[3]);
+ /* 4th vertex */
+ setup_vertex2(r->vertices3[3], dstX, dstY + height,
+ st0[0], st0[3], st1[0], st1[3]);
+ }
return pipe_user_buffer_create(r->pipe->screen,
r->vertices3,
@@ -206,13 +283,15 @@ void renderer_destroy(struct xorg_renderer *r)
if (fsbuf && fsbuf->buffer)
pipe_buffer_reference(&fsbuf->buffer, NULL);
+ if (r->shaders) {
+ xorg_shaders_destroy(r->shaders);
+ r->shaders = NULL;
+ }
+
if (r->cso) {
cso_release_all(r->cso);
cso_destroy_context(r->cso);
- }
-
- if (r->shaders) {
- xorg_shaders_destroy(r->shaders);
+ r->cso = NULL;
}
}
@@ -586,11 +665,19 @@ create_sampler_texture(struct xorg_renderer *r,
screen, src, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ);
struct pipe_surface *ps_tex = screen->get_tex_surface(
screen, pt, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE );
- pipe->surface_copy(pipe,
- ps_tex, /* dest */
- 0, 0, /* destx/y */
- ps_read,
- 0, 0, src->width[0], src->height[0]);
+ if (pipe->surface_copy) {
+ pipe->surface_copy(pipe,
+ ps_tex, /* dest */
+ 0, 0, /* destx/y */
+ ps_read,
+ 0, 0, src->width[0], src->height[0]);
+ } else {
+ util_surface_copy(pipe, FALSE,
+ ps_tex, /* dest */
+ 0, 0, /* destx/y */
+ ps_read,
+ 0, 0, src->width[0], src->height[0]);
+ }
pipe_surface_reference(&ps_read, NULL);
pipe_surface_reference(&ps_tex, NULL);
}
@@ -681,6 +768,9 @@ void renderer_draw_solid_rect(struct xorg_renderer *r,
struct pipe_context *pipe = r->pipe;
struct pipe_buffer *buf = 0;
+ /*
+ debug_printf("solid rect[(%d, %d), (%d, %d)], rgba[%f, %f, %f, %f]\n",
+ x0, y0, x1, y1, color[0], color[1], color[2], color[3]);*/
/* 1st vertex */
setup_vertex0(r->vertices2[0], x0, y0, color);
/* 2nd vertex */
@@ -709,7 +799,8 @@ void renderer_draw_textures(struct xorg_renderer *r,
int *pos,
int width, int height,
struct pipe_texture **textures,
- int num_textures)
+ int num_textures,
+ float *src_matrix, float *mask_matrix)
{
struct pipe_context *pipe = r->pipe;
struct pipe_buffer *buf = 0;
@@ -720,7 +811,7 @@ void renderer_draw_textures(struct xorg_renderer *r,
pos[0], pos[1], /* src */
pos[4], pos[5], /* dst */
width, height,
- textures[0]);
+ textures[0], src_matrix);
break;
case 2:
buf = setup_vertex_data2(r,
@@ -728,7 +819,8 @@ void renderer_draw_textures(struct xorg_renderer *r,
pos[2], pos[3], /* mask */
pos[4], pos[5], /* dst */
width, height,
- textures[0], textures[1]);
+ textures[0], textures[1],
+ src_matrix, mask_matrix);
break;
default:
debug_assert(!"Unsupported number of textures");
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h
index b6296d5fd6b..3e37c9aa930 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.h
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.h
@@ -47,7 +47,9 @@ void renderer_draw_textures(struct xorg_renderer *r,
int *pos,
int width, int height,
struct pipe_texture **textures,
- int num_textures);
+ int num_textures,
+ float *src_matrix,
+ float *mask_matrix);
#endif
diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
index 24e1a4928ee..6130cf6621f 100644
--- a/src/gallium/state_trackers/xorg/xorg_tracker.h
+++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
@@ -92,6 +92,7 @@ typedef struct _modesettingRec
struct pipe_context *ctx;
boolean d_depth_bits_last;
boolean ds_depth_bits_last;
+ struct pipe_texture *root_texture;
/* exa */
struct exa_context *exa;
@@ -121,6 +122,14 @@ xorg_exa_set_displayed_usage(PixmapPtr pPixmap);
int
xorg_exa_set_shared_usage(PixmapPtr pPixmap);
+Bool
+xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex);
+
+struct pipe_texture *
+xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
+ int width, int height,
+ int depth, int bpp);
+
void *
xorg_exa_init(ScrnInfoPtr pScrn);
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
index caab33de1cc..69f14e54f26 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
@@ -38,7 +38,7 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api,
{
struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB);
- if (getenv("RADEON_SOFTPIPE")) {
+ if (debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) {
return softpipe_create_screen((struct pipe_winsys*)winsys);
} else {
struct r300_winsys* r300 = radeon_create_r300_winsys(drmFB, winsys);
@@ -51,7 +51,7 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api,
struct pipe_context* radeon_create_context(struct drm_api* api,
struct pipe_screen* screen)
{
- if (getenv("RADEON_SOFTPIPE")) {
+ if (debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) {
return radeon_create_softpipe(screen->winsys);
} else {
return r300_create_context(screen,
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.h b/src/gallium/winsys/drm/radeon/core/radeon_drm.h
index 88a5c82b284..9a789ec1a45 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.h
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.h
@@ -37,6 +37,7 @@
#include "pipe/p_screen.h"
#include "trace/tr_drm.h"
+#include "util/u_debug.h"
#include "util/u_memory.h"
#include "state_tracker/drm_api.h"
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index d2d84f1a8f0..7ea5d1fb4e7 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -22,6 +22,17 @@
#include "radeon_r300.h"
+static void radeon_r300_set_flush_cb(struct r300_winsys *winsys,
+ void (*flush_cb)(void *),
+ void *data)
+{
+ struct radeon_winsys_priv* priv =
+ (struct radeon_winsys_priv*)winsys->radeon_winsys;
+
+ radeon_cs_space_set_flush(priv->cs, flush_cb,
+ data);
+}
+
static boolean radeon_r300_add_buffer(struct r300_winsys* winsys,
struct pipe_buffer* pbuffer,
uint32_t rd,
@@ -95,6 +106,13 @@ static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys,
}
}
+static void radeon_r300_reset_bos(struct r300_winsys *winsys)
+{
+ struct radeon_winsys_priv* priv =
+ (struct radeon_winsys_priv*)winsys->radeon_winsys;
+ radeon_cs_space_reset_bos(priv->cs);
+}
+
static void radeon_r300_end_cs(struct r300_winsys* winsys,
const char* file,
const char* function,
@@ -119,9 +137,6 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys)
radeon_cs_print(priv->cs, stderr);
}
- /* Clean out BOs. */
- radeon_cs_space_reset_bos(priv->cs);
-
/* Reset CS.
* Someday, when we care about performance, we should really find a way
* to rotate between two or three CS objects so that the GPU can be
@@ -149,6 +164,16 @@ static void do_ioctls(struct r300_winsys* winsys, int fd)
}
winsys->gb_pipes = target;
+ /* get Z pipes */
+ info.request = RADEON_INFO_NUM_Z_PIPES;
+ retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
+ if (retval) {
+ fprintf(stderr, "%s: Failed to get GB pipe count, "
+ "error number %d\n", __FUNCTION__, retval);
+ exit(1);
+ }
+ winsys->z_pipes = target;
+
/* Then, get PCI ID */
info.request = RADEON_INFO_DEVICE_ID;
retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
@@ -203,6 +228,8 @@ radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys)
winsys->write_cs_reloc = radeon_r300_write_cs_reloc;
winsys->end_cs = radeon_r300_end_cs;
winsys->flush_cs = radeon_r300_flush_cs;
+ winsys->reset_bos = radeon_r300_reset_bos;
+ winsys->set_flush_cb = radeon_r300_set_flush_cb;
memcpy(winsys, old_winsys, sizeof(struct radeon_winsys));
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index cd4aede74e4..c63116bab77 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -540,6 +540,16 @@ DestroyContext(Display * dpy, GLXContext gc)
imported = gc->imported;
gc->xid = None;
+ if (gc->currentDpy) {
+ /* This context is bound to some thread. According to the man page,
+ * we should not actually delete the context until it's unbound.
+ * Note that we set gc->xid = None above. In MakeContextCurrent()
+ * we check for that and delete the context there.
+ */
+ __glXUnlock();
+ return;
+ }
+
#ifdef GLX_DIRECT_RENDERING
/* Destroy the direct rendering context */
if (gc->driContext) {
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index a9bfe905680..ad457645962 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -125,7 +125,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->UnmapTexture = NULL;
driver->TextureMemCpy = _mesa_memcpy;
driver->IsTextureResident = NULL;
- driver->PrioritizeTexture = NULL;
driver->ActiveTexture = NULL;
driver->UpdateTexturePalette = NULL;
@@ -183,7 +182,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->TexGen = NULL;
driver->TexEnv = NULL;
driver->TexParameter = NULL;
- driver->TextureMatrix = NULL;
driver->Viewport = NULL;
/* vertex arrays */
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 21458a7c737..b38f22e130e 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1346,8 +1346,6 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
/* create vertex array buffer */
_mesa_GenBuffersARB(1, &clear->VBO);
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, clear->VBO);
- _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
- NULL, GL_DYNAMIC_DRAW_ARB);
/* setup vertex arrays */
_mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
@@ -1423,7 +1421,8 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
}
/* upload new vertex data */
- _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
+ _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts,
+ GL_DYNAMIC_DRAW_ARB);
}
/* draw quad */
@@ -2118,7 +2117,6 @@ _mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target,
_mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- printf("Can't render\n");
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template
index 18dbeba24a8..1ce9315530c 100644
--- a/src/mesa/drivers/dri/Makefile.template
+++ b/src/mesa/drivers/dri/Makefile.template
@@ -60,18 +60,36 @@ SHARED_INCLUDES = \
##### TARGETS #####
-default: symlinks depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
+default: symlinks subdirs depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
-$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
+$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) Makefile \
+ $(TOP)/src/mesa/drivers/dri/Makefile.template
$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
+ $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) \
+ $(DRI_LIB_DEPS)
$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
$(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)
+# If the Makefile defined SUBDIRS, run make in each
+.PHONY: subdirs
+subdirs:
+ @if test -n "$(SUBDIRS)" ; then \
+ for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE)) || exit 1; \
+ fi \
+ done \
+ fi
+
+
+.PHONY: symlinks
+symlinks:
+
+
depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
@ echo "running $(MKDEP)"
@ rm -f depend
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h
index cf55286b30f..5ae28cb53a0 100644
--- a/src/mesa/drivers/dri/common/drirenderbuffer.h
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.h
@@ -56,7 +56,7 @@ typedef struct {
* A handy flag to know if this is the back color buffer.
*
* \note
- * This is currently only used by s3v and tdfx.
+ * This is currently only used by tdfx.
*/
GLboolean backBuffer;
} driRenderbuffer;
diff --git a/src/mesa/drivers/dri/fb/Makefile b/src/mesa/drivers/dri/fb/Makefile
index 309f50b95f8..cf9b3a85563 100644
--- a/src/mesa/drivers/dri/fb/Makefile
+++ b/src/mesa/drivers/dri/fb/Makefile
@@ -25,5 +25,3 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
-
diff --git a/src/mesa/drivers/dri/ffb/Makefile b/src/mesa/drivers/dri/ffb/Makefile
index cb73238c030..e9da8f9066e 100644
--- a/src/mesa/drivers/dri/ffb/Makefile
+++ b/src/mesa/drivers/dri/ffb/Makefile
@@ -33,4 +33,3 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/gamma/Makefile b/src/mesa/drivers/dri/gamma/Makefile
index 250d3ac0891..09df1578fc7 100644
--- a/src/mesa/drivers/dri/gamma/Makefile
+++ b/src/mesa/drivers/dri/gamma/Makefile
@@ -32,4 +32,3 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/i810/Makefile b/src/mesa/drivers/dri/i810/Makefile
index a7825b49b44..3874faee518 100644
--- a/src/mesa/drivers/dri/i810/Makefile
+++ b/src/mesa/drivers/dri/i810/Makefile
@@ -29,4 +29,3 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile
index 393312e7328..37f15aa7671 100644
--- a/src/mesa/drivers/dri/i915/Makefile
+++ b/src/mesa/drivers/dri/i915/Makefile
@@ -72,4 +72,3 @@ intel_decode.o: ../intel/intel_decode.c
intel_tex_layout.o: ../intel/intel_tex_layout.c
-symlinks:
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
index 0641e6df9d7..c3cbba8404d 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -1196,12 +1196,16 @@ getFallbackString(GLuint bit)
+/**
+ * Enable/disable a fallback flag.
+ * \param bit one of INTEL_FALLBACK_x flags.
+ */
void
-intelFallback(struct intel_context *intel, GLuint bit, GLboolean mode)
+intelFallback(struct intel_context *intel, GLbitfield bit, GLboolean mode)
{
GLcontext *ctx = &intel->ctx;
TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = intel->Fallback;
+ const GLbitfield oldfallback = intel->Fallback;
if (mode) {
intel->Fallback |= bit;
diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile
index 57dcc915869..7a55333e896 100644
--- a/src/mesa/drivers/dri/i965/Makefile
+++ b/src/mesa/drivers/dri/i965/Makefile
@@ -100,6 +100,5 @@ DRI_LIB_DEPS += -ldrm_intel
include ../Makefile.template
-symlinks:
intel_decode.o: ../intel/intel_decode.c
intel_tex_layout.o: ../intel/intel_tex_layout.c
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index fa3e32c7ff1..01b6a4a168c 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -115,7 +115,9 @@
* Handles blending and (presumably) depth and stencil testing.
*/
-#define BRW_FALLBACK_TEXTURE 0x1
+
+#define BRW_FALLBACK_DRAW (INTEL_FALLBACK_DRIVER << 0)
+
#define BRW_MAX_CURBE (32*16)
struct brw_context;
@@ -454,7 +456,6 @@ struct brw_context
GLuint primitive;
GLboolean emit_state_always;
- GLboolean tmp_fallback;
GLboolean no_batch_wrap;
struct {
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 765ae5a2fe5..375afadcbea 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -375,9 +375,10 @@ static void brw_prepare_vertices(struct brw_context *brw)
* isn't an issue at this point.
*/
if (brw->vb.nr_enabled >= BRW_VEP_MAX) {
- intel->Fallback = 1;
+ FALLBACK(intel, BRW_FALLBACK_DRAW, GL_TRUE);
return;
}
+ FALLBACK(intel, BRW_FALLBACK_DRAW, GL_FALSE);
for (i = 0; i < brw->vb.nr_enabled; i++) {
struct brw_vertex_element *input = brw->vb.enabled[i];
@@ -427,9 +428,10 @@ static void brw_prepare_vertices(struct brw_context *brw)
/* Position array not properly enabled:
*/
if (input->glarray->StrideB == 0) {
- intel->Fallback = 1;
+ FALLBACK(intel, BRW_FALLBACK_DRAW, GL_TRUE);
return;
}
+ FALLBACK(intel, BRW_FALLBACK_DRAW, GL_FALSE);
interleave = input->glarray->StrideB;
ptr = input->glarray->Ptr;
@@ -539,12 +541,12 @@ static void brw_emit_vertices(struct brw_context *brw)
if (input->stride) {
OUT_RELOC(input->bo,
I915_GEM_DOMAIN_VERTEX, 0,
- input->offset + input->stride * input->count);
+ input->offset + input->stride * input->count - 1);
} else {
assert(input->count == 1);
OUT_RELOC(input->bo,
I915_GEM_DOMAIN_VERTEX, 0,
- input->offset + input->element_size);
+ input->offset + input->element_size - 1);
}
} else
OUT_BATCH(input->stride ? input->count : 0);
@@ -726,7 +728,7 @@ static void brw_emit_index_buffer(struct brw_context *brw)
brw->ib.offset);
OUT_RELOC(brw->ib.bo,
I915_GEM_DOMAIN_VERTEX, 0,
- brw->ib.offset + brw->ib.size);
+ brw->ib.offset + brw->ib.size - 1);
OUT_BATCH( 0 );
ADVANCE_BATCH();
}
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
index 9a619fbd5cf..d4899aab7fa 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
@@ -157,7 +157,7 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
#define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d)
#define OUT_RELOC(buf, read_domains, write_domain, delta) do { \
- assert((unsigned) (delta) <= buf->size); \
+ assert((unsigned) (delta) < buf->size); \
intel_batchbuffer_emit_reloc(intel->batch, buf, \
read_domains, write_domain, delta); \
} while (0)
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 934f7aa1873..15f4bc6f69d 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -830,7 +830,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
_vbo_DestroyContext(&intel->ctx);
_swrast_DestroyContext(&intel->ctx);
- intel->Fallback = 0; /* don't call _swrast_Flush later */
+ intel->Fallback = 0x0; /* don't call _swrast_Flush later */
intel_batchbuffer_free(intel->batch);
intel->batch = NULL;
@@ -935,10 +935,23 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
__DRIdrawablePrivate * driReadPriv)
{
__DRIscreenPrivate *psp = driDrawPriv->driScreenPriv;
+ struct intel_context *intel;
+ GET_CURRENT_CONTEXT(curCtx);
+
+ if (driContextPriv)
+ intel = (struct intel_context *) driContextPriv->driverPrivate;
+ else
+ intel = NULL;
+
+ /* According to the glXMakeCurrent() man page: "Pending commands to
+ * the previous context, if any, are flushed before it is released."
+ * But only flush if we're actually changing contexts.
+ */
+ if (intel_context(curCtx) && intel_context(curCtx) != intel) {
+ _mesa_flush(curCtx);
+ }
if (driContextPriv) {
- struct intel_context *intel =
- (struct intel_context *) driContextPriv->driverPrivate;
struct intel_framebuffer *intel_fb =
(struct intel_framebuffer *) driDrawPriv->driverPrivate;
GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index b104096912c..2778cc0136d 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -61,6 +61,10 @@ typedef void (*intel_line_func) (struct intel_context *, intelVertex *,
intelVertex *);
typedef void (*intel_point_func) (struct intel_context *, intelVertex *);
+/**
+ * Bits for intel->Fallback field
+ */
+/*@{*/
#define INTEL_FALLBACK_DRAW_BUFFER 0x1
#define INTEL_FALLBACK_READ_BUFFER 0x2
#define INTEL_FALLBACK_DEPTH_BUFFER 0x4
@@ -68,8 +72,10 @@ typedef void (*intel_point_func) (struct intel_context *, intelVertex *);
#define INTEL_FALLBACK_USER 0x10
#define INTEL_FALLBACK_RENDERMODE 0x20
#define INTEL_FALLBACK_TEXTURE 0x40
+#define INTEL_FALLBACK_DRIVER 0x1000 /**< first for drivers */
+/*@}*/
-extern void intelFallback(struct intel_context *intel, GLuint bit,
+extern void intelFallback(struct intel_context *intel, GLbitfield bit,
GLboolean mode);
#define FALLBACK( intel, bit, mode ) intelFallback( intel, bit, mode )
@@ -171,7 +177,7 @@ struct intel_context
struct dri_metaops meta;
GLint refcount;
- GLuint Fallback;
+ GLbitfield Fallback; /**< mask of INTEL_FALLBACK_x bits */
GLuint NewGLState;
dri_bufmgr *bufmgr;
diff --git a/src/mesa/drivers/dri/intel/intel_syncobj.c b/src/mesa/drivers/dri/intel/intel_syncobj.c
index 1286fe929bc..0d7889d3c25 100644
--- a/src/mesa/drivers/dri/intel/intel_syncobj.c
+++ b/src/mesa/drivers/dri/intel/intel_syncobj.c
@@ -114,7 +114,7 @@ static void intel_check_sync(GLcontext *ctx, struct gl_sync_object *s)
{
struct intel_sync_object *sync = (struct intel_sync_object *)s;
- if (sync->bo && drm_intel_bo_busy(sync->bo)) {
+ if (sync->bo && !drm_intel_bo_busy(sync->bo)) {
drm_intel_bo_unreference(sync->bo);
sync->bo = NULL;
s->StatusFlag = 1;
diff --git a/src/mesa/drivers/dri/mach64/Makefile b/src/mesa/drivers/dri/mach64/Makefile
index 7246d51f5d7..a8f463e9fd0 100644
--- a/src/mesa/drivers/dri/mach64/Makefile
+++ b/src/mesa/drivers/dri/mach64/Makefile
@@ -30,4 +30,3 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c
index 225d23179e1..5a22c93bd2b 100644
--- a/src/mesa/drivers/dri/mach64/mach64_tex.c
+++ b/src/mesa/drivers/dri/mach64/mach64_tex.c
@@ -567,7 +567,6 @@ void mach64InitTextureFuncs( struct dd_function_table *functions )
functions->UpdateTexturePalette = NULL;
functions->ActiveTexture = NULL;
- functions->PrioritizeTexture = NULL;
driInitTextureFormats();
}
diff --git a/src/mesa/drivers/dri/mga/Makefile b/src/mesa/drivers/dri/mga/Makefile
index a871064c629..0cc329fb22d 100644
--- a/src/mesa/drivers/dri/mga/Makefile
+++ b/src/mesa/drivers/dri/mga/Makefile
@@ -31,4 +31,3 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/r128/Makefile b/src/mesa/drivers/dri/r128/Makefile
index 796dfbc5167..52c5a38a705 100644
--- a/src/mesa/drivers/dri/r128/Makefile
+++ b/src/mesa/drivers/dri/r128/Makefile
@@ -29,4 +29,3 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/r200/Makefile b/src/mesa/drivers/dri/r200/Makefile
index fbce70c37bc..776f1e3f3f7 100644
--- a/src/mesa/drivers/dri/r200/Makefile
+++ b/src/mesa/drivers/dri/r200/Makefile
@@ -66,4 +66,3 @@ include ../Makefile.template
#INCLUDES += -I../radeon/server
-symlinks:
diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile
index c64f940623f..cb0f715fa07 100644
--- a/src/mesa/drivers/dri/r300/Makefile
+++ b/src/mesa/drivers/dri/r300/Makefile
@@ -69,16 +69,12 @@ DRIVER_DEFINES = -DRADEON_R300
DRI_LIB_DEPS += $(RADEON_LDFLAGS)
-PIPE_DRIVERS = compiler/libr300compiler.a
+SUBDIRS = compiler
-##### TARGETS #####
+EXTRA_MODULES = compiler/libr300compiler.a
-include ../Makefile.template
-symlinks:
+##### TARGETS #####
-# Mark the archive phony so that we always check for recompilation
-.PHONY : compiler/libr300compiler.a
+include ../Makefile.template
-compiler/libr300compiler.a:
- cd compiler && $(MAKE)
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index f030451b282..65cabccdc1e 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -225,10 +225,10 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t)
if (t->image_override && t->bo)
return;
- t->pp_txsize = (((firstImage->Width - 1) << R300_TX_WIDTHMASK_SHIFT)
- | ((firstImage->Height - 1) << R300_TX_HEIGHTMASK_SHIFT)
- | ((firstImage->DepthLog2) << R300_TX_DEPTHMASK_SHIFT)
- | ((t->mt->lastLevel - t->mt->firstLevel) << R300_TX_MAX_MIP_LEVEL_SHIFT));
+ t->pp_txsize = (((R300_TX_WIDTHMASK_MASK & ((firstImage->Width - 1) << R300_TX_WIDTHMASK_SHIFT)))
+ | ((R300_TX_HEIGHTMASK_MASK & ((firstImage->Height - 1) << R300_TX_HEIGHTMASK_SHIFT)))
+ | ((R300_TX_DEPTHMASK_MASK & ((firstImage->DepthLog2) << R300_TX_DEPTHMASK_SHIFT)))
+ | ((R300_TX_MAX_MIP_LEVEL_MASK & ((t->mt->lastLevel - t->mt->firstLevel) << R300_TX_MAX_MIP_LEVEL_SHIFT))));
t->tile_bits = 0;
@@ -248,8 +248,12 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t)
if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
if (firstImage->Width > 2048)
t->pp_txpitch |= R500_TXWIDTH_BIT11;
+ else
+ t->pp_txpitch &= ~R500_TXWIDTH_BIT11;
if (firstImage->Height > 2048)
t->pp_txpitch |= R500_TXHEIGHT_BIT11;
+ else
+ t->pp_txpitch &= ~R500_TXHEIGHT_BIT11;
}
}
@@ -479,16 +483,20 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
break;
}
pitch_val--;
- t->pp_txsize = ((rb->base.Width - 1) << R300_TX_WIDTHMASK_SHIFT) |
- ((rb->base.Height - 1) << R300_TX_HEIGHTMASK_SHIFT);
+ t->pp_txsize = (((R300_TX_WIDTHMASK_MASK & ((rb->base.Width - 1) << R300_TX_WIDTHMASK_SHIFT)))
+ | ((R300_TX_HEIGHTMASK_MASK & ((rb->base.Height - 1) << R300_TX_HEIGHTMASK_SHIFT))));
t->pp_txsize |= R300_TX_SIZE_TXPITCH_EN;
t->pp_txpitch |= pitch_val;
if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
if (rb->base.Width > 2048)
t->pp_txpitch |= R500_TXWIDTH_BIT11;
+ else
+ t->pp_txpitch &= ~R500_TXWIDTH_BIT11;
if (rb->base.Height > 2048)
t->pp_txpitch |= R500_TXHEIGHT_BIT11;
+ else
+ t->pp_txpitch &= ~R500_TXHEIGHT_BIT11;
}
t->validated = GL_TRUE;
_mesa_unlock_texture(radeon->glCtx, texObj);
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 43629d643bc..c2f96af2c12 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -62,12 +62,6 @@ static int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_progra
}
}
- if (vp->code.constants.Count * 4 > VSF_MAX_FRAGMENT_LENGTH) {
- /* Should have checked this earlier... */
- fprintf(stderr, "%s:Params exhausted\n", __FUNCTION__);
- _mesa_exit(-1);
- }
-
for(i = 0; i < vp->code.constants.Count; ++i) {
const float * src = 0;
const struct rc_constant * constant = &vp->code.constants.Constants[i];
@@ -281,6 +275,11 @@ static struct r300_vertex_program *build_program(GLcontext *ctx,
}
r3xx_compile_vertex_program(&compiler);
+
+ if (vp->code.constants.Count > ctx->Const.VertexProgram.MaxParameters) {
+ rc_error(&compiler.Base, "Program exceeds constant buffer size limit\n");
+ }
+
vp->error = compiler.Base.Error;
vp->Base->Base.InputsRead = vp->code.InputsRead;
@@ -334,7 +333,6 @@ struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx)
#define bump_vpu_count(ptr, new_count) do { \
drm_r300_cmd_header_t* _p=((drm_r300_cmd_header_t*)(ptr)); \
int _nc=(new_count)/4; \
- assert(_nc < 256); \
if(_nc>_p->vpu.count)_p->vpu.count=_nc; \
} while(0)
diff --git a/src/mesa/drivers/dri/r600/Makefile b/src/mesa/drivers/dri/r600/Makefile
index 7d5a7b1ab6f..9b7c42042e6 100644
--- a/src/mesa/drivers/dri/r600/Makefile
+++ b/src/mesa/drivers/dri/r600/Makefile
@@ -76,4 +76,3 @@ DRI_LIB_DEPS += $(RADEON_LDFLAGS)
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.c b/src/mesa/drivers/dri/r600/r600_cmdbuf.c
index 3cfe03a45f7..d27a3245a39 100644
--- a/src/mesa/drivers/dri/r600/r600_cmdbuf.c
+++ b/src/mesa/drivers/dri/r600/r600_cmdbuf.c
@@ -254,7 +254,7 @@ static int r600_cs_process_relocs(struct radeon_cs *cs,
relocs = (struct r600_cs_reloc_legacy *)cs->relocs;
restart:
for (i = 0; i < cs->crelocs; i++) {
- uint32_t soffset, eoffset, asicoffset;
+ uint32_t soffset, eoffset;
r = radeon_bo_legacy_validate(relocs[i].base.bo,
&soffset, &eoffset);
@@ -262,24 +262,12 @@ restart:
goto restart;
}
if (r) {
- fprintf(stderr, "validated %p [0x%08X, 0x%08X]\n",
+ fprintf(stderr, "invalid bo(%p) [0x%08X, 0x%08X]\n",
relocs[i].base.bo, soffset, eoffset);
return r;
}
- asicoffset = soffset;
for (j = 0; j < relocs[i].cindices; j++) {
- if (asicoffset >= eoffset) {
- /* radeon_bo_debug(relocs[i].base.bo, 12); */
- fprintf(stderr, "validated %p [0x%08X, 0x%08X]\n",
- relocs[i].base.bo, soffset, eoffset);
- fprintf(stderr, "above end: %p 0x%08X 0x%08X\n",
- relocs[i].base.bo,
- cs->packets[relocs[i].indices[j]],
- eoffset);
- exit(0);
- return -EINVAL;
- }
/* pkt3 nop header in ib chunk */
cs->packets[relocs[i].reloc_indices[j]] = 0xC0001000;
/* reloc index in ib chunk */
@@ -287,7 +275,7 @@ restart:
}
/* asic offset in reloc chunk */ /* see alex drm r600_nomm_relocate */
- reloc_chunk[offset_dw] = asicoffset;
+ reloc_chunk[offset_dw] = soffset;
reloc_chunk[offset_dw + 3] = 0;
offset_dw += 4;
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index 969144ba123..ba0d450cbb2 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -131,6 +131,7 @@ const struct dri_extension card_extensions[] = {
{"GL_EXT_texture_lod_bias", NULL},
{"GL_EXT_texture_mirror_clamp", NULL},
{"GL_EXT_texture_rectangle", NULL},
+ {"GL_EXT_vertex_array_bgra", NULL},
{"GL_EXT_texture_sRGB", NULL},
{"GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions},
{"GL_ATI_texture_env_combine3", NULL},
diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c
index 7d7e77d355b..ba1371bf95a 100644
--- a/src/mesa/drivers/dri/r600/r600_texstate.c
+++ b/src/mesa/drivers/dri/r600/r600_texstate.c
@@ -764,7 +764,9 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
struct gl_texture_object *tObj =
_mesa_lookup_texture(rmesa->radeon.glCtx, texname);
radeonTexObjPtr t = radeon_tex_obj(tObj);
- uint32_t pitch_val, size;
+ int firstlevel = t->mt ? t->mt->firstLevel : 0;
+ const struct gl_texture_image *firstImage;
+ uint32_t pitch_val, size, row_align, bpp;
if (!tObj)
return;
@@ -774,7 +776,13 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
if (!offset)
return;
- size = pitch;//h * w * (depth / 8);
+ bpp = depth / 8;
+ if (bpp == 3)
+ bpp = 4;
+
+ firstImage = t->base.Image[0][firstlevel];
+ row_align = rmesa->radeon.texture_row_align - 1;
+ size = ((firstImage->Width * bpp + row_align) & ~row_align) * firstImage->Height;
if (t->bo) {
radeon_bo_unref(t->bo);
t->bo = NULL;
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index ed597c027b5..917318c02ab 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -355,6 +355,7 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm)
return 2;
case SQ_OP2_INST_MOV:
+ case SQ_OP2_INST_MOVA_FLOOR:
case SQ_OP2_INST_FRACT:
case SQ_OP2_INST_FLOOR:
case SQ_OP2_INST_EXP_IEEE:
@@ -1307,8 +1308,10 @@ GLboolean tex_src(r700_AssemblerBase *pAsm)
case PROGRAM_INPUT:
switch (pILInst->SrcReg[0].Index)
{
+ case FRAG_ATTRIB_WPOS:
case FRAG_ATTRIB_COL0:
case FRAG_ATTRIB_COL1:
+ case FRAG_ATTRIB_FOGC:
case FRAG_ATTRIB_TEX0:
case FRAG_ATTRIB_TEX1:
case FRAG_ATTRIB_TEX2:
@@ -1321,7 +1324,16 @@ GLboolean tex_src(r700_AssemblerBase *pAsm)
pAsm->S[0].src.reg =
pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index];
pAsm->S[0].src.rtype = SRC_REG_INPUT;
- break;
+ break;
+ case FRAG_ATTRIB_FACE:
+ fprintf(stderr, "FRAG_ATTRIB_FACE unsupported\n");
+ break;
+ case FRAG_ATTRIB_PNTC:
+ fprintf(stderr, "FRAG_ATTRIB_PNTC unsupported\n");
+ break;
+ case FRAG_ATTRIB_VAR0:
+ fprintf(stderr, "FRAG_ATTRIB_VAR0 unsupported\n");
+ break;
}
break;
}
@@ -2180,7 +2192,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm)
}
//other bits
- alu_instruction_ptr->m_Word0.f.index_mode = SQ_INDEX_LOOP;
+ alu_instruction_ptr->m_Word0.f.index_mode = SQ_INDEX_AR_X;
if( (is_single_scalar_operation == GL_TRUE)
|| (GL_TRUE == bSplitInst) )
@@ -2514,6 +2526,35 @@ GLboolean assemble_ADD(r700_AssemblerBase *pAsm)
return GL_TRUE;
}
+GLboolean assemble_ARL(r700_AssemblerBase *pAsm)
+{ /* TODO: ar values dont' persist between clauses */
+ if( GL_FALSE == checkop1(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->D.dst.opcode = SQ_OP2_INST_MOVA_FLOOR;
+ setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+ pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+ pAsm->D.dst.reg = 0;
+ pAsm->D.dst.writex = 0;
+ pAsm->D.dst.writey = 0;
+ pAsm->D.dst.writez = 0;
+ pAsm->D.dst.writew = 0;
+
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
GLboolean assemble_BAD(char *opcode_str)
{
radeon_error("Not yet implemented instruction (%s)\n", opcode_str);
@@ -3928,8 +3969,7 @@ GLboolean AssembleInstr(GLuint uiNumberInsts,
break;
case OPCODE_ARL:
- radeon_error("Not yet implemented instruction OPCODE_ARL \n");
- //if ( GL_FALSE == assemble_BAD("ARL") )
+ if ( GL_FALSE == assemble_ARL(pR700AsmCode) )
return GL_FALSE;
break;
case OPCODE_ARR:
@@ -4274,6 +4314,7 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode,
GLbitfield OutputsWritten)
{
unsigned int unBit;
+ GLuint export_count = 0;
if(pR700AsmCode->depth_export_register_number >= 0)
{
@@ -4295,6 +4336,7 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode,
{
return GL_FALSE;
}
+ export_count++;
}
unBit = 1 << FRAG_RESULT_DEPTH;
if(OutputsWritten & unBit)
@@ -4308,8 +4350,15 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode,
{
return GL_FALSE;
}
+ export_count++;
}
-
+ /* Need to export something, otherwise we'll hang
+ * results are undefined anyway */
+ if(export_count == 0)
+ {
+ Process_Export(pR700AsmCode, SQ_EXPORT_PIXEL, 0, 1, 0, GL_FALSE);
+ }
+
if(pR700AsmCode->cf_last_export_ptr != NULL)
{
pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE;
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index 0d4283e4bad..8cbca066e95 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -470,6 +470,7 @@ GLboolean next_ins(r700_AssemblerBase *pAsm);
GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode);
GLboolean assemble_ABS(r700_AssemblerBase *pAsm);
GLboolean assemble_ADD(r700_AssemblerBase *pAsm);
+GLboolean assemble_ARL(r700_AssemblerBase *pAsm);
GLboolean assemble_BAD(char *opcode_str);
GLboolean assemble_CMP(r700_AssemblerBase *pAsm);
GLboolean assemble_COS(r700_AssemblerBase *pAsm);
diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c
index 62a1ea1a22a..0f549ead9cc 100644
--- a/src/mesa/drivers/dri/r600/r700_fragprog.c
+++ b/src/mesa/drivers/dri/r600/r700_fragprog.c
@@ -135,15 +135,19 @@ GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp,
{
GLuint i, j;
GLint * puiTEMPwrites;
+ GLint * puiTEMPreads;
struct prog_instruction * pILInst;
InstDeps *pInstDeps;
struct prog_instruction * texcoord_DepInst;
GLint nDepInstID;
puiTEMPwrites = (GLint*) MALLOC(sizeof(GLuint)*mesa_fp->Base.NumTemporaries);
+ puiTEMPreads = (GLint*) MALLOC(sizeof(GLuint)*mesa_fp->Base.NumTemporaries);
+
for(i=0; i<mesa_fp->Base.NumTemporaries; i++)
{
puiTEMPwrites[i] = -1;
+ puiTEMPreads[i] = -1;
}
pInstDeps = (InstDeps*)MALLOC(sizeof(InstDeps)*mesa_fp->Base.NumInstructions);
@@ -167,6 +171,11 @@ GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp,
{
//Set dep.
pInstDeps[i].nSrcDeps[j] = puiTEMPwrites[pILInst->SrcReg[j].Index];
+ //Set first read
+ if(puiTEMPreads[pILInst->SrcReg[j].Index] < 0 )
+ {
+ puiTEMPreads[pILInst->SrcReg[j].Index] = i;
+ }
}
else
{
@@ -177,8 +186,6 @@ GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp,
fp->r700AsmCode.pInstDeps = pInstDeps;
- FREE(puiTEMPwrites);
-
//Find dep for tex inst
for(i=0; i<mesa_fp->Base.NumInstructions; i++)
{
@@ -203,9 +210,25 @@ GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp,
{ //... other deps?
}
}
+ // make sure that we dont overwrite src used earlier
+ nDepInstID = puiTEMPreads[pILInst->DstReg.Index];
+ if(nDepInstID < i)
+ {
+ pInstDeps[i].nDstDep = puiTEMPreads[pILInst->DstReg.Index];
+ texcoord_DepInst = &(mesa_fp->Base.Instructions[nDepInstID]);
+ if(GL_TRUE == IsAlu(texcoord_DepInst->Opcode) )
+ {
+ pInstDeps[nDepInstID].nDstDep = i;
+ }
+
+ }
+
}
}
+ FREE(puiTEMPwrites);
+ FREE(puiTEMPreads);
+
return GL_TRUE;
}
@@ -251,7 +274,15 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
number_of_colors_exported--;
}
- fp->r700Shader.exportMode = number_of_colors_exported << 1 | z_enabled;
+ /* illegal to set this to 0 */
+ if(number_of_colors_exported || z_enabled)
+ {
+ fp->r700Shader.exportMode = number_of_colors_exported << 1 | z_enabled;
+ }
+ else
+ {
+ fp->r700Shader.exportMode = (1 << 1);
+ }
fp->translated = GL_TRUE;
diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile
index b1efc72872f..ae2e695bfcc 100644
--- a/src/mesa/drivers/dri/radeon/Makefile
+++ b/src/mesa/drivers/dri/radeon/Makefile
@@ -55,4 +55,3 @@ X86_SOURCES =
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
index 3e7547d2f9d..ce60a2f7eae 100644
--- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
@@ -710,6 +710,10 @@ int radeon_bo_legacy_validate(struct radeon_bo *bo,
bo, bo->size, bo_legacy->map_count);
return -EINVAL;
}
+ if(bo->size == 0) {
+ fprintf(stderr, "bo(%p) has size 0.\n", bo);
+ return -EINVAL;
+ }
if (bo_legacy->static_bo || bo_legacy->validated) {
*soffset = bo_legacy->offset;
*eoffset = bo_legacy->offset + bo->size;
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index 7ac53ec0ca3..0ae906a6cea 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -445,7 +445,6 @@ restart:
goto restart;
}
- rrb->pitch = texImage->Width * rrb->cpp;
rrb->base.InternalFormat = rrb->base._ActualFormat;
rrb->base.Width = texImage->Width;
rrb->base.Height = texImage->Height;
@@ -555,8 +554,10 @@ radeon_render_texture(GLcontext * ctx,
imageOffset += offsets[att->Zoffset];
}
- /* store that offset in the region */
+ /* store that offset in the region, along with the correct pitch for
+ * the image we are rendering to */
rrb->draw_offset = imageOffset;
+ rrb->pitch = radeon_image->mt->levels[att->TextureLevel].rowstride;
/* update drawing region, etc */
radeon_draw_buffer(ctx, fb);
diff --git a/src/mesa/drivers/dri/s3v/Makefile b/src/mesa/drivers/dri/s3v/Makefile
deleted file mode 100644
index 9bd79731548..00000000000
--- a/src/mesa/drivers/dri/s3v/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-# src/mesa/drivers/dri/s3v/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = s3v_dri.so
-
-# Doesn't exist yet.
-#MINIGLX_SOURCES = server/savage_dri.c
-
-DRIVER_SOURCES = \
- s3v_context.c \
- s3v_dd.c \
- s3v_inithw.c \
- s3v_lock.c \
- s3v_render.c \
- s3v_screen.c \
- s3v_span.c \
- s3v_state.c \
- s3v_tex.c \
- s3v_texmem.c \
- s3v_texstate.c \
- s3v_tris.c \
- s3v_vb.c \
- s3v_xmesa.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-
-include ../Makefile.template
-
-symlinks:
diff --git a/src/mesa/drivers/dri/s3v/s3v_common.h b/src/mesa/drivers/dri/s3v/s3v_common.h
deleted file mode 100644
index b66cdf1df08..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_common.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-/* WARNING: If you change any of these defines, make sure to change
- * the kernel include file as well (s3v_drm.h)
- */
-
-#ifndef _XF86DRI_S3V_H_
-#define _XF86DRI_S3V_H_
-
-#ifndef _S3V_DEFINES_
-#define _S3V_DEFINES_
-#define S3V_USE_BATCH 1
-
-/* #define S3V_BUF_4K 1 */
-
-#ifdef S3V_BUF_4K
-#define S3V_DMA_BUF_ORDER 12
-#define S3V_DMA_BUF_NR 256
-#else
-#define S3V_DMA_BUF_ORDER 16 /* -much- better */
-#define S3V_DMA_BUF_NR 16
-#endif
-/* on s3virge you can only choose between *
- * 4k (2^12) and 64k (2^16) dma bufs */
-#define S3V_DMA_BUF_SZ (1<<S3V_DMA_BUF_ORDER)
-
-#define S3V_NR_SAREA_CLIPRECTS 8
-
-/* Each region is a minimum of 16k (64*64@4bpp)
- * and there are at most 40 of them.
- */
-#define S3V_NR_TEX_REGIONS 64 /* was 40 */
-#define S3V_LOG_TEX_GRANULARITY 16 /* was 4 */
-/* 40 * (2 ^ 4) = 640k, that's all we have for tex on 4mb gfx card */
-/* FIXME: will it work with card with less than 4mb? */
-/* FIXME: we should set this at run time */
-
-#endif /* _S3V_DEFINES */
-
-/*
- * WARNING: If you change any of these defines, make sure to change
- * the kernel include file as well (gamma_drm.h)
- */
-
-/* Driver specific DRM command indices
- * NOTE: these are not OS specific, but they are driver specific
- */
-#define DRM_S3V_INIT_DMA 0x00
-#define DRM_S3V_CLEANUP_DMA 0x01
-
-typedef struct _drmS3VInit {
- enum {
- S3V_INIT_DMA = 0x01,
- S3V_CLEANUP_DMA = 0x02
- } func;
-
- unsigned int pcimode; /* bool: 1=pci 0=agp */
-
- unsigned int mmio_offset;
- unsigned int buffers_offset;
- unsigned int sarea_priv_offset;
-
- unsigned int front_offset;
- unsigned int front_width;
- unsigned int front_height;
- unsigned int front_pitch;
-
- unsigned int back_offset;
- unsigned int back_width;
- unsigned int back_height;
- unsigned int back_pitch;
-
- unsigned int depth_offset;
- unsigned int depth_width;
- unsigned int depth_height;
- unsigned int depth_pitch;
-
- unsigned int texture_offset;
-} drmS3VInit;
-
-#endif
diff --git a/src/mesa/drivers/dri/s3v/s3v_context.c b/src/mesa/drivers/dri/s3v/s3v_context.c
deleted file mode 100644
index 0a3bf7258d1..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_context.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "vbo/vbo.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "main/context.h"
-#include "main/simple_list.h"
-#include "main/matrix.h"
-#include "main/extensions.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-#include "main/simple_list.h"
-#include "main/mm.h"
-
-#include "drivers/common/driverfuncs.h"
-#include "s3v_vb.h"
-#include "s3v_tris.h"
-
-#if 0
-extern const struct tnl_pipeline_stage _s3v_render_stage;
-
-static const struct tnl_pipeline_stage *s3v_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- /* REMOVE: point attenuation stage */
-#if 1
- &_s3v_render_stage, /* ADD: unclipped rastersetup-to-dma */
-#endif
- &_tnl_render_stage,
- 0,
-};
-#endif
-
-GLboolean s3vCreateContext(const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- s3vContextPtr vmesa;
- s3vScreenPtr s3vScrn;
- S3VSAREAPtr saPriv=(S3VSAREAPtr)(((char*)sPriv->pSAREA) +
- sizeof(drm_sarea_t));
- struct dd_function_table functions;
-
- DEBUG_WHERE(("*** s3vCreateContext ***\n"));
-
- vmesa = (s3vContextPtr) CALLOC( sizeof(*vmesa) );
- if ( !vmesa ) return GL_FALSE;
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((s3vContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
-
- _mesa_init_driver_functions(&functions);
-
- vmesa->glCtx = _mesa_create_context(glVisual, shareCtx, &functions,
- (void *)vmesa);
- if (!vmesa->glCtx) {
- FREE(vmesa);
- return GL_FALSE;
- }
-
- vmesa->driContext = driContextPriv;
- vmesa->driScreen = sPriv;
- vmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */
-
- vmesa->hHWContext = driContextPriv->hHWContext;
- vmesa->driHwLock = (drmLock *)&sPriv->pSAREA->lock;
- vmesa->driFd = sPriv->fd;
- vmesa->sarea = saPriv;
-
- s3vScrn = vmesa->s3vScreen = (s3vScreenPtr)(sPriv->private);
-
- ctx = vmesa->glCtx;
-
- ctx->Const.MaxTextureLevels = 11; /* it is (11-1) -> 1024 * 1024 FIXME */
-
- ctx->Const.MaxTextureUnits = 1; /* FIXME: or 2 ? */
-
- /* No wide points.
- */
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
- /* No wide lines.
- */
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 1.0;
- ctx->Const.MaxLineWidthAA = 1.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- ctx->Const.MaxDrawBuffers = 1;
-
- vmesa->texHeap = mmInit( 0, vmesa->s3vScreen->textureSize );
- DEBUG(("vmesa->s3vScreen->textureSize = 0x%x\n",
- vmesa->s3vScreen->textureSize));
-
- /* NOTE */
- /* mmInit(offset, size); */
-
- /* allocates a structure like this:
-
- struct mem_block_t {
- struct mem_block_t *next;
- struct mem_block_t *heap;
- int ofs,size;
- int align;
- int free:1;
- int reserved:1;
- };
-
- */
-
- make_empty_list(&vmesa->TexObjList);
- make_empty_list(&vmesa->SwappedOut);
-
- vmesa->CurrentTexObj[0] = 0;
- vmesa->CurrentTexObj[1] = 0; /* FIXME */
-
- vmesa->RenderIndex = ~0;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _vbo_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
-#if 0
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, s3v_pipeline );
-#endif
- /* Configure swrast to match hardware characteristics:
- */
-#if 0
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-#endif
- vmesa->_3d_mode = 0;
-
- /* 3D lines / gouraud tris */
- vmesa->CMD = ( AUTO_EXEC_ON | HW_CLIP_ON | DEST_COL_1555
- | FOG_OFF | ALPHA_OFF | Z_OFF | Z_UPDATE_OFF
- | Z_LESS | TEX_WRAP_ON | TEX_MODULATE | LINEAR
- | TEX_COL_ARGB1555 | CMD_3D );
-
- vmesa->_alpha[0] = vmesa->_alpha[1] = ALPHA_OFF;
- vmesa->alpha_cmd = vmesa->_alpha[0];
- vmesa->_tri[0] = DO_GOURAUD_TRI;
- vmesa->_tri[1] = DO_TEX_LIT_TRI;
- vmesa->prim_cmd = vmesa->_tri[0];
-
- /* printf("first vmesa->CMD = 0x%x\n", vmesa->CMD); */
-
- vmesa->TexOffset = vmesa->s3vScreen->texOffset;
-
- s3vInitVB( ctx );
- s3vInitExtensions( ctx );
- s3vInitDriverFuncs( ctx );
- s3vInitStateFuncs( ctx );
- s3vInitSpanFuncs( ctx );
- s3vInitTextureFuncs( ctx );
- s3vInitTriFuncs( ctx );
- s3vInitState( vmesa );
-
- driContextPriv->driverPrivate = (void *)vmesa;
-
- /* HACK */
- vmesa->bufSize = S3V_DMA_BUF_SZ;
-
- DEBUG(("vmesa->bufSize = %i\n", vmesa->bufSize));
- DEBUG(("vmesa->bufCount = %i\n", vmesa->bufCount));
-
-
- /* dma init */
- DEBUG_BUFS(("GET_FIRST_DMA\n"));
-
- vmesa->_bufNum = 0;
-
- GET_FIRST_DMA(vmesa->driFd, vmesa->hHWContext,
- 1, &(vmesa->bufIndex[0]), &(vmesa->bufSize),
- &vmesa->_buf[0], &vmesa->bufCount, s3vScrn);
-
- GET_FIRST_DMA(vmesa->driFd, vmesa->hHWContext,
- 1, &(vmesa->bufIndex[1]), &(vmesa->bufSize),
- &vmesa->_buf[1], &vmesa->bufCount, s3vScrn);
-
- vmesa->buf = vmesa->_buf[vmesa->_bufNum];
-
-/*
- vmesa->CMD = (AUTO_EXEC_ON | HW_CLIP_ON | DEST_COL_1555
- | FOG_OFF | ALPHA_OFF | Z_OFF | Z_UPDATE_OFF
- | DO_GOURAUD_TRI | CMD_3D);
-
- vmesa->TexOffset = vmesa->s3vScreen->texOffset;
-*/
-
-/* ... but we should support only 15 bit in virge (out of 8/15/24)... */
-
- DEBUG(("glVisual->depthBits = %i\n", glVisual->depthBits));
-
- switch (glVisual->depthBits) {
- case 8:
- break;
-
- case 15:
- case 16:
- vmesa->depth_scale = 1.0f / 0xffff;
- break;
- case 24:
- vmesa->depth_scale = 1.0f / 0xffffff;
- break;
- default:
- break;
- }
-
- vmesa->cull_zero = 0.0f;
-
- vmesa->DepthSize = glVisual->depthBits;
- vmesa->Flags = S3V_FRONT_BUFFER;
- vmesa->Flags |= (glVisual->doubleBufferMode ? S3V_BACK_BUFFER : 0);
- vmesa->Flags |= (vmesa->DepthSize > 0 ? S3V_DEPTH_BUFFER : 0);
-
- vmesa->EnabledFlags = S3V_FRONT_BUFFER;
- vmesa->EnabledFlags |= (glVisual->doubleBufferMode ? S3V_BACK_BUFFER : 0);
-
-
- if (vmesa->Flags & S3V_BACK_BUFFER) {
- vmesa->readOffset = vmesa->drawOffset = vmesa->s3vScreen->backOffset;
- } else {
- vmesa->readOffset = vmesa->drawOffset = 0;
- }
-
- s3vInitHW( vmesa );
-
- driContextPriv->driverPrivate = (void *)vmesa;
-
- return GL_TRUE;
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_context.h b/src/mesa/drivers/dri/s3v/s3v_context.h
deleted file mode 100644
index 671ba90d781..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_context.h
+++ /dev/null
@@ -1,443 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_CONTEXT_H_
-#define _S3V_CONTEXT_H_
-
-#include "dri_util.h"
-
-#include "s3v_dri.h"
-#include "s3v_regs.h"
-#include "s3v_macros.h"
-#include "s3v_screen.h"
-#include "main/colormac.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-#include "drm.h"
-#include "main/mm.h"
-#include "drirenderbuffer.h"
-
-/* Flags for context */
-#define S3V_FRONT_BUFFER 0x00000001
-#define S3V_BACK_BUFFER 0x00000002
-#define S3V_DEPTH_BUFFER 0x00000004
-
- /* FIXME: check */
-#define S3V_MAX_TEXTURE_SIZE 2048
-
-/* These are the minimum requirements and should probably be increased */
-#define MAX_MODELVIEW_STACK 16
-#define MAX_PROJECTION_STACK 2
-#define MAX_TEXTURE_STACK 2
-
-extern void s3vDDUpdateHWState(GLcontext *ctx);
-extern s3vScreenPtr s3vCreateScreen(__DRIscreenPrivate *sPriv);
-extern void s3vDestroyScreen(__DRIscreenPrivate *sPriv);
-extern GLboolean s3vCreateContext(const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-#define S3V_UPLOAD_ALL 0xffffffff
-/* #define S3V_UPLOAD_CLIPRECTS 0x00000002 */
-#define S3V_UPLOAD_ALPHA 0x00000004
-#define S3V_UPLOAD_BLEND 0x00000008
-#define S3V_UPLOAD_DEPTH 0x00000010
-#define S3V_UPLOAD_VIEWPORT 0x00000020
-#define S3V_UPLOAD_SHADE 0x00000040
-#define S3V_UPLOAD_CLIP 0x00000080
-#define S3V_UPLOAD_MASKS 0x00000100
-#define S3V_UPLOAD_WINDOW 0x00000200 /* defunct */
-#define S3V_UPLOAD_GEOMETRY 0x00000400
-#define S3V_UPLOAD_POLYGON 0x00000800
-#define S3V_UPLOAD_DITHER 0x00001000
-#define S3V_UPLOAD_LOGICOP 0x00002000
-#define S3V_UPLOAD_FOG 0x00004000
-#define S3V_UPLOAD_LIGHT 0x00008000
-#define S3V_UPLOAD_CONTEXT 0x00010000
-#define S3V_UPLOAD_TEX0 0x00020000
-#define S3V_UPLOAD_STIPPLE 0x00040000
-#define S3V_UPLOAD_TRANSFORM 0x00080000
-#define S3V_UPLOAD_LINEMODE 0x00100000
-#define S3V_UPLOAD_POINTMODE 0x00200000
-#define S3V_UPLOAD_TRIMODE 0x00400000
-
-#define S3V_NEW_CLIP 0x00000001
-#define S3V_NEW_WINDOW 0x00000002
-#define S3V_NEW_CONTEXT 0x00000004
-#define S3V_NEW_TEXTURE 0x00000008 /* defunct */
-#define S3V_NEW_ALPHA 0x00000010
-#define S3V_NEW_DEPTH 0x00000020
-#define S3V_NEW_MASKS 0x00000040
-#define S3V_NEW_POLYGON 0x00000080
-#define S3V_NEW_CULL 0x00000100
-#define S3V_NEW_LOGICOP 0x00000200
-#define S3V_NEW_FOG 0x00000400
-#define S3V_NEW_LIGHT 0x00000800
-#define S3V_NEW_STIPPLE 0x00001000
-#define S3V_NEW_ALL 0xffffffff
-
-#define S3V_FALLBACK_TRI 0x00000001
-#define S3V_FALLBACK_TEXTURE 0x00000002
-
-struct s3v_context;
-typedef struct s3v_context s3vContextRec;
-typedef struct s3v_context *s3vContextPtr;
-typedef struct s3v_texture_object_t *s3vTextureObjectPtr;
-
-#define VALID_S3V_TEXTURE_OBJECT(tobj) (tobj)
-
-#define S3V_TEX_MAXLEVELS 12
-
-/* For shared texture space managment, these texture objects may also
- * be used as proxies for regions of texture memory containing other
- * client's textures. Such proxy textures (not to be confused with GL
- * proxy textures) are subject to the same LRU aging we use for our
- * own private textures, and thus we have a mechanism where we can
- * fairly decide between kicking out our own textures and those of
- * other clients.
- *
- * Non-local texture objects have a valid MemBlock to describe the
- * region managed by the other client, and can be identified by
- * 't->globj == 0'
- */
-struct s3v_texture_object_t {
- struct s3v_texture_object_t *next, *prev;
-
- GLuint age;
- struct gl_texture_object *globj;
-
- int Pitch;
- int Height;
- int WidthLog2;
- int texelBytes;
- int totalSize;
- int bound;
-
- struct mem_block *MemBlock;
- GLuint BufAddr;
-
- GLuint min_level;
- GLuint max_level;
- GLuint dirty_images;
-
- GLint firstLevel, lastLevel; /* upload tObj->Image[first .. lastLevel] */
-
- struct {
- const struct gl_texture_image *image;
- int offset; /* into BufAddr */
- int height;
- int internalFormat;
- } image[S3V_TEX_MAXLEVELS];
-
- GLuint TextureCMD;
-
- GLuint TextureColorMode;
- GLuint TextureFilterMode;
- GLuint TextureBorderColor;
- GLuint TextureWrap;
- GLuint TextureMipSize;
-
- GLuint TextureBaseAddr[S3V_TEX_MAXLEVELS];
- GLuint TextureFormat;
- GLuint TextureReadMode;
-};
-
-#define S3V_NO_PALETTE 0x0
-#define S3V_USE_PALETTE 0x1
-#define S3V_UPDATE_PALETTE 0x2
-#define S3V_FALLBACK_PALETTE 0x4
-
-void s3vUpdateTextureState( GLcontext *ctx );
-
-void s3vDestroyTexObj( s3vContextPtr vmesa, s3vTextureObjectPtr t);
-void s3vUploadTexImages( s3vContextPtr vmesa, s3vTextureObjectPtr t );
-
-void s3vResetGlobalLRU( s3vContextPtr vmesa );
-void s3vTexturesGone( s3vContextPtr vmesa,
- GLuint start, GLuint end,
- GLuint in_use );
-
-void s3vEmitHwState( s3vContextPtr vmesa );
-void s3vGetLock( s3vContextPtr vmesa, GLuint flags );
-void s3vInitExtensions( GLcontext *ctx );
-void s3vInitDriverFuncs( GLcontext *ctx );
-void s3vSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-void s3vInitState( s3vContextPtr vmesa );
-void s3vInitHW( s3vContextPtr vmesa );
-void s3vInitStateFuncs( GLcontext *ctx );
-void s3vInitTextureFuncs( GLcontext *ctx );
-void s3vInitTriFuncs( GLcontext *ctx );
-
-void s3vUpdateWindow( GLcontext *ctx );
-void s3vUpdateViewportOffset( GLcontext *ctx );
-
-void s3vPrintLocalLRU( s3vContextPtr vmesa );
-void s3vPrintGlobalLRU( s3vContextPtr vmesa );
-
-extern void s3vFallback( s3vContextPtr vmesa, GLuint bit, GLboolean mode );
-#define FALLBACK( imesa, bit, mode ) s3vFallback( imesa, bit, mode )
-
-/* Use the templated vertex formats. Only one of these is used in s3v.
- */
-#define TAG(x) s3v##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*s3v_quad_func)( s3vContextPtr,
- const s3vVertex *,
- const s3vVertex *,
- const s3vVertex *,
- const s3vVertex * );
-typedef void (*s3v_tri_func)( s3vContextPtr,
- const s3vVertex *,
- const s3vVertex *,
- const s3vVertex * );
-typedef void (*s3v_line_func)( s3vContextPtr,
- const s3vVertex *,
- const s3vVertex * );
-typedef void (*s3v_point_func)( s3vContextPtr,
- const s3vVertex * );
-
-
-/* static void s3v_lines_emit(GLcontext *ctx, GLuint start, GLuint end); */
-typedef void (*emit_func)( GLcontext *, GLuint, GLuint);
-
-struct s3v_context {
- GLcontext *glCtx; /* Mesa context */
-
- __DRIcontextPrivate *driContext;
- __DRIscreenPrivate *driScreen;
- __DRIdrawablePrivate *driDrawable;
-
- GLuint new_gl_state;
- GLuint new_state;
- GLuint dirty;
-
- S3VSAREAPtr sarea;
-
- /* Temporaries for translating away float colors
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- /* Mirrors of some DRI state
- */
-
- drm_context_t hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- GLuint numClipRects; /* Cliprects for the draw buffer */
- drm_clip_rect_t *pClipRects;
-
- GLuint* buf; /* FIXME */
- GLuint* _buf[2];
- int _bufNum;
- int bufIndex[2];
- int bufSize;
- int bufCount;
-
- s3vScreenPtr s3vScreen; /* Screen private DRI data */
-
- int drawOffset;
- int readOffset;
-
- s3v_point_func draw_point;
- s3v_line_func draw_line;
- s3v_tri_func draw_tri;
- s3v_quad_func draw_quad;
-
- GLuint Fallback;
- GLuint RenderIndex;
- GLuint SetupNewInputs;
- GLuint SetupIndex;
-
- GLuint vertex_format;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- char *verts;
-
- GLfloat hw_viewport[16];
- GLuint hw_primitive;
- GLenum render_primitive;
-
- GLfloat depth_scale;
-
- s3vTextureObjectPtr CurrentTexObj[2];
- struct s3v_texture_object_t TexObjList;
- struct s3v_texture_object_t SwappedOut;
- GLenum TexEnvImageFmt[2];
-
- struct mem_block *texHeap;
-
- int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
- int lastStamp;
-
- /* max was here: don't touch */
-
- unsigned int S3V_REG[S3V_REGS_NUM];
-
- GLuint texMode;
- GLuint alphaMode;
- GLuint lightMode;
-
- GLuint SrcBase;
- GLuint DestBase;
- GLuint DestBlit;
- GLuint ScissorLR;
- GLuint ScissorTB;
- GLuint ScissorWH; /* SubScissorWH */ /* RectWH */
- GLuint FrontStride;
- GLuint BackStride;
- GLuint SrcStride;
- GLuint DestStride;
- GLuint SrcXY;
- GLuint DestXY;
-
- GLuint ClearColor;
- GLuint Color;
- GLuint DitherMode;
- GLuint ClearDepth;
-
- GLuint TextureBorderColor;
- GLuint TexOffset;
- GLuint TexStride;
-
- GLuint CMD;
- GLuint prim_cmd;
- GLuint _tri[2]; /* 0 = gouraud; 1 = tex (lit or unlit) */
- GLuint alpha_cmd; /* actual alpha cmd */
- GLuint _alpha[2];
- GLuint _alpha_tex; /* tex alpha type */
- /* (3d_mode) 0 = 3d line/gourad tri; 1 = 3d tex tri */
- GLuint _3d_mode;
-
- GLfloat backface_sign;
- GLfloat cull_zero;
-
- int restore_primitive;
-
-/* *** 2check *** */
-
- GLuint FogMode;
- GLuint AreaStippleMode;
- GLuint LBReadFormat;
- GLuint LBWriteFormat;
- GLuint LineMode;
- GLuint PointMode;
- GLuint TriangleMode;
- GLuint AntialiasMode;
- GLfloat ViewportScaleX;
- GLfloat ViewportScaleY;
- GLfloat ViewportScaleZ;
- GLfloat ViewportOffsetX;
- GLfloat ViewportOffsetY;
- GLfloat ViewportOffsetZ;
- int MatrixMode;
- int DepthMode;
- int TransformMode;
- int LBReadMode;
- int FBReadMode;
- int FBWindowBase;
- int LBWindowBase;
- int ColorDDAMode;
- int GeometryMode;
- int AlphaTestMode;
- int AlphaBlendMode;
- int AB_FBReadMode;
- int AB_FBReadMode_Save;
- int DeltaMode;
- int ColorMaterialMode;
- int FBHardwareWriteMask;
- int MaterialMode;
- int NormalizeMode;
- int LightingMode;
- int Light0Mode;
- int Light1Mode;
- int Light2Mode;
- int Light3Mode;
- int Light4Mode;
- int Light5Mode;
- int Light6Mode;
- int Light7Mode;
- int Light8Mode;
- int Light9Mode;
- int Light10Mode;
- int Light11Mode;
- int Light12Mode;
- int Light13Mode;
- int Light14Mode;
- int Light15Mode;
- int LogicalOpMode;
- int ScissorMode;
- int ScissorMaxXY;
- int ScissorMinXY;
- int Window; /* GID part probably should be in draw priv */
- int WindowOrigin;
- int x, y, w, h; /* Probably should be in drawable priv */
- int FrameCount; /* Probably should be in drawable priv */
- int NotClipped; /* Probably should be in drawable priv */
- int WindowChanged; /* Probably should be in drawabl... */
- int Flags;
- int EnabledFlags;
- int DepthSize;
- int Begin;
- GLenum ErrorValue;
- int Texture1DEnabled;
- int Texture2DEnabled;
-
- float ModelView[16];
- float Proj[16];
- float ModelViewProj[16];
- float Texture[16];
-
- float ModelViewStack[(MAX_MODELVIEW_STACK-1)*16];
- int ModelViewCount;
- float ProjStack[(MAX_PROJECTION_STACK-1)*16];
- int ProjCount;
- float TextureStack[(MAX_TEXTURE_STACK-1)*16];
- int TextureCount;
-};
-
-#define S3VIRGEPACKCOLOR555( r, g, b, a ) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define S3VIRGEPACKCOLOR565( r, g, b ) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define S3VIRGEPACKCOLOR888( r, g, b ) \
- (((r) << 16) | ((g) << 8) | (b))
-
-#define S3VIRGEPACKCOLOR8888( r, g, b, a ) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define S3VIRGEPACKCOLOR4444( r, g, b, a ) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-static INLINE GLuint s3vPackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- unsigned int ret;
- DEBUG(("cpp = %i, r=0x%x, g=0x%x, b=0x%x, a=0x%x\n", cpp, r, g, b, a));
-
- switch ( cpp ) {
- case 2:
- ret = S3VIRGEPACKCOLOR555( r, g, b, a );
- DEBUG(("ret = 0x%x\n", ret));
- return ret;
- case 4:
- return PACK_COLOR_8888( a, r, g, b );
- default:
- return 0;
- }
-}
-
-#define S3V_CONTEXT(ctx) ((s3vContextPtr)(ctx->DriverCtx))
-
-#endif /* _S3V_CONTEXT_H_ */
diff --git a/src/mesa/drivers/dri/s3v/s3v_dd.c b/src/mesa/drivers/dri/s3v/s3v_dd.c
deleted file mode 100644
index e340116f5e1..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_dd.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-#include "s3v_vb.h"
-#include "s3v_lock.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-
-#include "main/context.h"
-#include "main/framebuffer.h"
-#include "swrast/swrast.h"
-
-#define S3V_DATE "20020207"
-
-
-/* Return the width and height of the current color buffer.
- */
-static void s3vDDGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
-/* S3VHW_LOCK( vmesa ); */
- *width = vmesa->driDrawable->w;
- *height = vmesa->driDrawable->h;
-/* S3VHW_UNLOCK( vmesa ); */
-}
-
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *s3vDDGetString( GLcontext *ctx, GLenum name )
-{
- static char buffer[128];
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"Max Lingua (ladybug)";
-
- case GL_RENDERER:
- sprintf( buffer, "Mesa DRI S3 Virge " S3V_DATE );
-
- /* Append any CPU-specific information.
- */
-#ifdef USE_X86_ASM
- if ( _mesa_x86_cpu_features ) {
- strncat( buffer, " x86", 4 );
-
-}
-#ifdef USE_MMX_ASM
- if ( cpu_has_mmx ) {
- strncat( buffer, "/MMX", 4 );
- }
-#endif
-#ifdef USE_3DNOW_ASM
- if ( cpu_has_3dnow ) {
- strncat( buffer, "/3DNow!", 7 );
- }
-#endif
-#ifdef USE_SSE_ASM
- if ( cpu_has_xmm ) {
- strncat( buffer, "/SSE", 4 );
- }
-#endif
-#endif
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-/* Enable the extensions supported by this driver.
- */
-void s3vInitExtensions( GLcontext *ctx )
-{
- /* None... */
-}
-
-/* Initialize the driver's misc functions.
- */
-void s3vInitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = s3vDDGetBufferSize;
- ctx->Driver.GetString = s3vDDGetString;
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_dri.h b/src/mesa/drivers/dri/s3v/s3v_dri.h
deleted file mode 100644
index 339c579f7f7..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_dri.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_DRI
-#define _S3V_DRI
-
-#include "s3v_common.h"
-
-#define S3V_MAX_DRAWABLES (S3V_DMA_BUF_NR/2) /* 32 */ /* 256 */ /* FIXME */
-
-typedef struct
-{
- int deviceID;
- int width;
- int height;
- int mem;
- int cpp;
- int bitsPerPixel;
-
- int fbOffset;
- int fbStride;
-
- int logTextureGranularity;
- int textureOffset;
-
- drm_handle_t regs;
- drmSize regsSize;
-
- unsigned int sarea_priv_offset;
-/*
- drmAddress regsMap;
-
- drmSize textureSize;
- drm_handle_t textures;
-*/
-
-#if 0
- drm_handle_t agp_buffers;
- drmSize agp_buf_size;
-#endif
-
-/*
- drmBufMapPtr drmBufs;
- int irq;
- unsigned int sarea_priv_offset;
-*/
-
-/* FIXME: cleanup ! */
-
- drmSize registerSize; /* == S3V_MMIO_REGSIZE */
- drm_handle_t registerHandle;
-
- drmSize pciSize;
- drm_handle_t pciMemHandle;
-
- drmSize frontSize; /* == videoRambytes */
-/* drm_handle_t frontHandle; */
- unsigned long frontOffset; /* == fbOffset */
- int frontPitch;
-/* unsigned char *front; */
-
- unsigned int bufferSize; /* size of depth/back buffer */
-
- drmSize backSize;
-/* drm_handle_t backHandle; */
- unsigned long backOffset;
- int backPitch;
-/* unsigned char *back; */
-
- drmSize depthSize;
-/* drm_handle_t depthHandle; */
- unsigned long depthOffset;
- int depthPitch;
-/* unsigned char *depth; */
-
- drmSize texSize;
-/* drm_handle_t texHandle; */
- unsigned long texOffset;
- int texPitch;
-/* unsigned char *tex; */
-
- drmSize dmaBufSize; /* Size of buffers (in bytes) */
- drm_handle_t dmaBufHandle; /* Handle from drmAddMap */
- unsigned long dmaBufOffset; /* Offset/Start */
- int dmaBufPitch; /* Pitch */
- unsigned char *dmaBuf; /* Map */
- int bufNumBufs; /* Number of buffers */
- drmBufMapPtr buffers; /* Buffer map */
-
-} S3VDRIRec, *S3VDRIPtr;
-
-/* WARNING: Do not change the SAREA structure without changing the kernel
- * as well */
-
-typedef struct {
- unsigned char next, prev; /* indices to form a circular LRU */
- unsigned char in_use; /* owned by a client, or free? */
- int age; /* tracked by clients to update local LRU's */
-} S3VTexRegionRec, *S3VTexRegionPtr;
-
-typedef struct {
- unsigned int nbox;
- drm_clip_rect_t boxes[S3V_NR_SAREA_CLIPRECTS];
-
- /* Maintain an LRU of contiguous regions of texture space. If
- * you think you own a region of texture memory, and it has an
- * age different to the one you set, then you are mistaken and
- * it has been stolen by another client. If global texAge
- * hasn't changed, there is no need to walk the list.
- *
- * These regions can be used as a proxy for the fine-grained
- * texture information of other clients - by maintaining them
- * in the same lru which is used to age their own textures,
- * clients have an approximate lru for the whole of global
- * texture space, and can make informed decisions as to which
- * areas to kick out. There is no need to choose whether to
- * kick out your own texture or someone else's - simply eject
- * them all in LRU order.
- */
- S3VTexRegionRec texList[S3V_NR_TEX_REGIONS+1]; /* Last elt is sentinal */
-
- int texAge; /* last time texture was uploaded */
-
- int last_enqueue; /* last time a buffer was enqueued */
- int last_dispatch; /* age of the most recently dispatched buffer */
- int last_quiescent; /* */
-
- int ctxOwner; /* last context to upload state */
-} S3VSAREARec, *S3VSAREAPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} S3VConfigPrivRec, *S3VConfigPrivPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} S3VDRIContextRec, *S3VDRIContextPtr;
-
-
-#endif
diff --git a/src/mesa/drivers/dri/s3v/s3v_inithw.c b/src/mesa/drivers/dri/s3v/s3v_inithw.c
deleted file mode 100644
index bdc9effb799..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_inithw.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include <sys/ioctl.h>
-
-#include "s3v_context.h"
-
-void s3vInitHW( s3vContextPtr vmesa )
-{
- int i;
- static short _reset = 1;
-
- DEBUG(("vmesa->driDrawable = %p\n", vmesa->driDrawable));
- DEBUG(("stride = %i\n",
- vmesa->driScreen->fbWidth*vmesa->s3vScreen->cpp));
- DEBUG(("frontOffset = 0x%x\n", vmesa->s3vScreen->frontOffset));
- DEBUG(("backOffset = 0x%x\n", vmesa->s3vScreen->backOffset));
- DEBUG(("depthOffset = 0x%x\n", vmesa->s3vScreen->depthOffset));
- DEBUG(("textureOffset = 0x%x\n", vmesa->s3vScreen->texOffset));
-
-/* if (_reset) { */
-/* ioctl(vmesa->driFd, 0x4a); */
- ioctl(vmesa->driFd, 0x41); /* reset */
- _reset = 0;
-/* ioctl(vmesa->driFd, 0x4c); */
-/* } */
-
- /* FIXME */
- switch (vmesa->s3vScreen->cpp) {
- case 2:
- break;
- case 4:
- break;
- }
-
- /* FIXME for stencil, gid, etc */
- switch (vmesa->DepthSize) {
- case 15:
- case 16:
- break;
- case 24:
- break;
- case 32:
- break;
- }
-
- vmesa->FogMode = 1;
- vmesa->ClearDepth = 0xffff;
- vmesa->x = 0;
- vmesa->y = 0;
- vmesa->w = 0;
- vmesa->h = 0;
- vmesa->FrameCount = 0;
- vmesa->MatrixMode = GL_MODELVIEW;
- vmesa->ModelViewCount = 0;
- vmesa->ProjCount = 0;
- vmesa->TextureCount = 0;
-
-
- /* FIXME: do we need the following? */
-
- for (i = 0; i < 16; i++)
- if (i % 5 == 0)
- vmesa->ModelView[i] =
- vmesa->Proj[i] =
- vmesa->ModelViewProj[i] =
- vmesa->Texture[i] = 1.0;
- else
- vmesa->ModelView[i] =
- vmesa->Proj[i] =
- vmesa->ModelViewProj[i] =
- vmesa->Texture[i] = 0.0;
-
- vmesa->LBWindowBase = vmesa->driScreen->fbWidth *
- (vmesa->driScreen->fbHeight - 1);
- vmesa->FBWindowBase = vmesa->driScreen->fbWidth *
- (vmesa->driScreen->fbHeight - 1);
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_lock.c b/src/mesa/drivers/dri/s3v/s3v_lock.c
deleted file mode 100644
index 52bb87ecec9..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_lock.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-
-#if DEBUG_LOCKING
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-#endif
-
-
-/* Update the hardware state. This is called if another context has
- * grabbed the hardware lock, which includes the X server. This
- * function also updates the driver's window state after the X server
- * moves, resizes or restacks a window -- the change will be reflected
- * in the drawable position and clip rects. Since the X server grabs
- * the hardware lock when it changes the window state, this routine will
- * automatically be called after such a change.
- */
-void s3vGetLock( s3vContextPtr vmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-/* __DRIscreenPrivate *sPriv = vmesa->driScreen; */
-
- printf("s3vGetLock <- ***\n");
-
- drmGetLock( vmesa->driFd, vmesa->hHWContext, flags );
-
- /* The window might have moved, so we might need to get new clip
- * rects.
- *
- * NOTE: This releases and regrabs the hw lock to allow the X server
- * to respond to the DRI protocol request for new drawable info.
- * Since the hardware state depends on having the latest drawable
- * clip rects, all state checking must be done _after_ this call.
- */
- /* DRI_VALIDATE_DRAWABLE_INFO( vmesa->display, sPriv, dPriv ); */
-
- if ( vmesa->lastStamp != dPriv->lastStamp ) {
- vmesa->lastStamp = dPriv->lastStamp;
- vmesa->new_state |= S3V_NEW_WINDOW | S3V_NEW_CLIP;
- }
-
- vmesa->numClipRects = dPriv->numClipRects;
- vmesa->pClipRects = dPriv->pClipRects;
-
-#if 0
- vmesa->dirty = ~0;
-
- if ( sarea->ctxOwner != vmesa->hHWContext ) {
- sarea->ctxOwner = vmesa->hHWContext;
- vmesa->dirty = S3V_UPLOAD_ALL;
- }
-
- for ( i = 0 ; i < vmesa->lastTexHeap ; i++ ) {
- if ( sarea->texAge[i] != vmesa->lastTexAge[i] ) {
- s3vAgeTextures( vmesa, i );
- }
- }
-#endif
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_lock.h b/src/mesa/drivers/dri/s3v/s3v_lock.h
deleted file mode 100644
index c39d24a38ac..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_lock.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef __S3V_LOCK_H__
-#define __S3V_LOCK_H__
-
-#include <sys/ioctl.h>
-
-extern void s3vGetLock( s3vContextPtr vmesa, GLuint flags );
-
-/* Turn DEBUG_LOCKING on to find locking conflicts.
- */
-#define DEBUG_LOCKING 0
-
-#if DEBUG_LOCKING
-extern char *prevLockFile;
-extern int prevLockLine;
-
-#define DEBUG_LOCK() \
- do { \
- prevLockFile = (__FILE__); \
- prevLockLine = (__LINE__); \
- } while (0)
-
-#define DEBUG_RESET() \
- do { \
- prevLockFile = 0; \
- prevLockLine = 0; \
- } while (0)
-
-#define DEBUG_CHECK_LOCK() \
- do { \
- if ( prevLockFile ) { \
- fprintf( stderr, \
- "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
- prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
- exit(1); \
- } \
- } while (0)
-
-#else
-
-#define DEBUG_LOCK()
-#define DEBUG_RESET()
-#define DEBUG_CHECK_LOCK()
-
-#endif
-
-/*
- * !!! We may want to separate locks from locks with validation. This
- * could be used to improve performance for those things commands that
- * do not do any drawing !!!
- */
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( vmesa ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( vmesa->driHwLock, vmesa->hHWContext, \
- (DRM_LOCK_HELD | vmesa->hHWContext), __ret ); \
- if ( __ret ) \
- s3vGetLock( vmesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware.
- */
-#define UNLOCK_HARDWARE( vmesa ) \
- do { \
- DRM_UNLOCK( vmesa->driFd, \
- vmesa->driHwLock, \
- vmesa->hHWContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-#define S3VHW_LOCK( vmesa ) \
- DRM_UNLOCK(vmesa->driFd, vmesa->driHwLock, vmesa->hHWContext); \
- DRM_SPINLOCK(&vmesa->driScreen->pSAREA->drawable_lock, \
- vmesa->driScreen->drawLockID); \
- /* VALIDATE_DRAWABLE_INFO_NO_LOCK(vmesa); */
-
-#define S3VHW_UNLOCK( vmesa ) \
- DRM_SPINUNLOCK(&vmesa->driScreen->pSAREA->drawable_lock, \
- vmesa->driScreen->drawLockID); \
- /* VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(vmesa); */
-
-#define S3V_SIMPLE_LOCK( vmesa ) \
- ioctl(vmesa->driFd, 0x4a)
-
-#define S3V_SIMPLE_FLUSH_LOCK( vmesa ) \
- ioctl(vmesa->driFd, 0x4b)
-
-#define S3V_SIMPLE_UNLOCK( vmesa ) \
- ioctl(vmesa->driFd, 0x4c)
-
-#endif /* __S3V_LOCK_H__ */
diff --git a/src/mesa/drivers/dri/s3v/s3v_macros.h b/src/mesa/drivers/dri/s3v/s3v_macros.h
deleted file mode 100644
index 7e9b4529df4..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_macros.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_MACROS_H_
-#define _S3V_MACROS_H_
-
-/**************/
-/* DRI macros */
-/**************/
-
-#define GENERIC_DEBUG 0
-#define FLOW_DEBUG 0
-#define DMABUFS_DEBUG 0
-
-/* Note: The argument to DEBUG*() _must_ be enclosed in parenthesis */
-
-#if (GENERIC_DEBUG || FLOW_DEBUG || DMABUFS_DEBUG)
-#include <stdio.h>
-#endif
-
-#undef DEBUG
-#if GENERIC_DEBUG
-#define DEBUG(str) printf str
-#else
-#define DEBUG(str)
-#endif
-
-#if FLOW_DEBUG
-#define DEBUG_WHERE(str) printf str
-#else
-#define DEBUG_WHERE(str)
-#endif
-
-#if DMABUFS_DEBUG
-#define DEBUG_BUFS(str) printf str
-#else
-#define DEBUG_BUFS(str)
-#endif
-
-
-#if 0
-#define S3V_DMA_SEND_FLAGS DRM_DMA_PRIORITY
-#define S3V_DMA_SEND_FLAGS DRM_DMA_BLOCK
-#else
-#define S3V_DMA_SEND_FLAGS 0
-#endif
-
-#if 0
-#define S3V_DMA_GET_FLAGS \
- (DRM_DMA_SMALLER_OK | DRM_DMA_LARGER_OK | DRM_DMA_WAIT)
-#else
-#define S3V_DMA_GET_FLAGS DRM_DMA_WAIT
-#endif
-
-
-#define DMAOUT_CHECK(reg,len) \
-do { \
- DEBUG(("DMAOUT_CHECK: reg = 0x%x\n", S3V_##reg##_REG)); \
- DEBUG_BUFS(("DMAOUT_CHECK (was): ")); \
- DEBUG_BUFS(("vmesa->bufCount=%i of vmesa->bufSize=%i\n", \
- vmesa->bufCount, vmesa->bufSize)); \
- /* FIXME: > or >= */ \
- if (vmesa->bufCount+(len+1) >= vmesa->bufSize) \
- DMAFLUSH(); \
-\
- vmesa->bufCount += (len+1); \
- DEBUG_BUFS(("DMAOUT_CHECK (is): vmesa->bufCount=%i len=%i, reg=%x\n", \
- vmesa->bufCount, len, S3V_##reg##_REG)); \
- DMAOUT( ((len & 0xffff) | ((S3V_##reg##_REG & 0xfffc) << 14)) ); \
-} while (0)
-
-#define DMAOUT(val) \
-do { \
- *(vmesa->buf++)=val; \
- DEBUG_BUFS(("DMAOUT: val=0x%x\n", (unsigned int)val)); \
-} while(0)
-
-#define DMAFINISH() \
-do { \
- /* NOTE: it does nothing - it just prints some summary infos */ \
- DEBUG(("DMAFINISH: vmesa->bufCount=%i\n", vmesa->bufCount)); \
- DEBUG(("buf: index=%i; addr=%p\n", vmesa->bufIndex[vmesa->_bufNum], \
- vmesa->s3vScreen->bufs->list[vmesa->bufIndex[vmesa->_bufNum]].address)); \
-} while(0)
-
-#define DMAFLUSH() \
-do { \
- if (vmesa->bufCount) { \
- SEND_DMA(vmesa->driFd, vmesa->hHWContext, 1, \
- &vmesa->bufIndex[vmesa->_bufNum], &vmesa->bufCount); \
-/*
- GET_DMA(vmesa->driFd, vmesa->hHWContext, 1, \
- &vmesa->bufIndex, &vmesa->bufSize); \
-*/ \
- vmesa->_bufNum = !(vmesa->_bufNum); \
- vmesa->buf = vmesa->_buf[vmesa->_bufNum]; \
-/*
- vmesa->buf = \
- vmesa->s3vScreen->bufs->list[vmesa->bufIndex].address; \
-*/ \
- vmesa->bufCount = 0; \
- } \
-} while (0)
-
-#define CMDCHANGE() \
-do { \
- DMAOUT_CHECK(3DTRI_CMDSET, 1); /* FIXME: TRI/LINE */ \
- DMAOUT(vmesa->CMD); \
- DMAFINISH(); \
-} while (0)
-
-#ifdef DONT_SEND_DMA
-#define GET_DMA(fd, hHWCtx, n, idx, size)
-#define SEND_DMA(fd, hHWCtx,n, idx, cnt)
-#else
-#define GET_DMA(fd, hHWCtx, n, idx, size) \
-do { \
- drmDMAReq dma; \
- int retcode, i; \
-\
- DEBUG(("GET_DMA: ")); \
- DEBUG(("req_count=%i; req_list[#0]=%i; req_size[#0]=%i\n", \
- n, (idx)[n-1], (size)[n-1])); \
-\
- dma.context = (hHWCtx); \
- dma.send_count = 0; \
- dma.send_list = NULL; \
- dma.send_sizes = NULL; \
- dma.flags = S3V_DMA_GET_FLAGS; \
- dma.request_count = (n); \
- dma.request_size = S3V_DMA_BUF_SZ; \
- dma.request_list = (idx); \
- dma.request_sizes = (size); \
-\
- do { \
- if ((retcode = drmDMA((fd), &dma))) { \
- DEBUG_BUFS(("drmDMA (get) returned %d\n", retcode)); \
- } \
-} while (!(dma).granted_count); \
-\
- for (i = 0; i < (n); i++) { \
- DEBUG(("Got buffer %i (index #%i)\n", (idx)[i], i)); \
- DEBUG(("of %i bytes (%i words) size\n", \
- (size)[i], (size)[i] >>2)); \
- /* Convert from bytes to words */ \
- (size)[i] >>= 2; \
- } \
-} while (0)
-
-#define SEND_DMA(fd, hHWCtx, n, idx, cnt) \
-do { \
- drmDMAReq dma; \
- int retcode, i; \
-\
- DEBUG(("SEND_DMA: ")); \
- DEBUG(("send_count=%i; send_list[#0]=%i; send_sizes[#0]=%i\n", \
- n, (idx)[n-1], (cnt)[n-1])); \
-\
- for (i = 0; i < (n); i++) { \
- /* Convert from words to bytes */ \
- (cnt)[i] <<= 2; \
- } \
-\
- dma.context = (hHWCtx); \
- dma.send_count = (n); \
- dma.send_list = (idx); \
- dma.send_sizes = (cnt); \
- dma.flags = S3V_DMA_SEND_FLAGS; \
- dma.request_count = 0; \
- dma.request_size = 0; \
- dma.request_list = NULL; \
- dma.request_sizes = NULL; \
-\
- if ((retcode = drmDMA((fd), &dma))) { \
- DEBUG_BUFS(("drmDMA (send) returned %d\n", retcode)); \
- } \
-\
- for (i = 0; i < (n); i++) { \
- DEBUG(("Sent buffer %i (index #%i)\n", (idx)[i], i)); \
- DEBUG(("of %i bytes (%i words) size\n", \
- (cnt)[i], (cnt)[i] >>2)); \
- (cnt)[i] = 0; \
- } \
-} while (0)
-#endif /* DONT_SEND_DMA */
-
-#define GET_FIRST_DMA(fd, hHWCtx, n, idx, size, buf, cnt, vPriv) \
-do { \
- int i; \
- DEBUG_BUFS(("GET_FIRST_DMA\n")); \
- DEBUG_BUFS(("n=%i idx=%i size=%i\n", n, *idx, *size)); \
- DEBUG_BUFS(("going to GET_DMA\n")); \
- GET_DMA(fd, hHWCtx, n, idx, size); \
- DEBUG_BUFS(("coming from GET_DMA\n")); \
- DEBUG_BUFS(("n=%i idx=%i size=%i\n", n, (idx)[0], (size)[0])); \
- for (i = 0; i < (n); i++) { \
- DEBUG_BUFS(("buf #%i @%p\n", \
- i, (vPriv)->bufs->list[(idx)[i]].address)); \
- (buf)[i] = (vPriv)->bufs->list[(idx)[i]].address; \
- (cnt)[i] = 0; \
- } \
- DEBUG(("GOING HOME\n")); \
-} while (0)
-
-/**************************/
-/* generic, global macros */
-/**************************/
-
-#define CALC_LOG2(l2,s) \
-do { \
- int __s = s; \
- l2 = 0; \
- while (__s > 1) { ++l2; __s >>= 1; } \
-} while (0)
-
-#define PrimType_Null 0x00000000
-#define PrimType_Points 0x10000000
-#define PrimType_Lines 0x20000000
-#define PrimType_LineLoop 0x30000000
-#define PrimType_LineStrip 0x40000000
-#define PrimType_Triangles 0x50000000
-#define PrimType_TriangleStrip 0x60000000
-#define PrimType_TriangleFan 0x70000000
-#define PrimType_Quads 0x80000000
-#define PrimType_QuadStrip 0x90000000
-#define PrimType_Polygon 0xa0000000
-#define PrimType_Mask 0xf0000000
-
-#endif /* _S3V_MACROS_H_ */
diff --git a/src/mesa/drivers/dri/s3v/s3v_regs.h b/src/mesa/drivers/dri/s3v/s3v_regs.h
deleted file mode 100644
index 26a7c54af5c..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_regs.h
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_REG_H
-#define _S3V_REG_H
-
-#define S3V_REGS_NUM 256
-
-/************
- * DMA REGS *
- ************/
-
-#define S3V_DMA_ID 0
-#define S3V_DMA_REG 0x8590
-#define S3V_DMA_WRITEP_ID 1
-#define S3V_DMA_WRITEP_REG 0x8594
-#define S3V_DMA_READP_ID 2
-#define S3V_DMA_READP_REG 0x8598
-#define S3V_DMA_ENABLE_ID 3
-#define S3V_DMA_ENABLE_REG 0x859C
-#define S3V_DMA_UPDATE_ID 4
-#define S3V_DMA_UPDATE_REG 0x10000
-
-/***************
- * STATUS REGS *
- ***************/
-
-#define S3V_STAT_ID 10
-#define S3V_STAT_REG 0x8504
-#define S3V_STAT_VSYNC_ID 11
-#define S3V_STAT_VSYNC_REG 0x8505
-#define S3V_STAT_3D_DONE_ID 12
-#define S3V_STAT_3D_DONE_REG 0x8506
-#define S3V_STAT_FIFO_OVER_ID 13
-#define S3V_STAT_FIFO_OVER_REG 0x8508
-#define S3V_STAT_FIFO_EMPTY_ID 14
-#define S3V_STAT_FIFO_EMPTY_REG 0x850C
-#define S3V_STAT_HDMA_DONE_ID 15
-#define S3V_STAT_HDMA_DONE_REG 0x8514
-#define S3V_STAT_CDMA_DONE_ID 16
-#define S3V_STAT_CDMA_DONE_REG 0x8524
-#define S3V_STAT_3D_FIFO_EMPTY_ID 17
-#define S3V_STAT_3D_FIFO_EMPTY_REG 0x8544
-#define S3V_STAT_LPB_ID 18
-#define S3V_STAT_LPB_REG 0x8584
-#define S3V_STAT_3D_BUSY_ID 19
-#define S3V_STAT_3D_BUSY_REG 0x8704
-
-/***********
- * 2D REGS *
- ***********/
-
-#define S3V_BITBLT_ID 30
-#define S3V_BITBLT_REG 0xA400
-#define S3V_BITBLT_SRC_BASE_ID 31
-#define S3V_BITBLT_SRC_BASE_REG 0xA4D4
-#define S3V_BITBLT_DEST_BASE_ID 32
-#define S3V_BITBLT_DEST_BASE_REG 0xA4D8
-#define S3V_BITBLT_CLIP_L_R_ID 33
-#define S3V_BITBLT_CLIP_L_R_REG 0xA4DC
-#define S3V_BITBLT_CLIP_T_B_ID 34
-#define S3V_BITBLT_CLIP_T_B_REG 0xA4E0
-#define S3V_BITBLT_DEST_SRC_STRIDE_ID 35
-#define S3V_BITBLT_DEST_SRC_STRIDE_REG 0xA4E4
-#define S3V_BITBLT_MONO_PAT0_ID 36
-#define S3V_BITBLT_MONO_PAT0_REG 0xA4E8
-#define S3V_BITBLT_MONO_PAT1_ID 37
-#define S3V_BITBLT_MONO_PAT1_REG 0xA4EC
-#define S3V_BITBLT_PAT_BG_COLOR_ID 38
-#define S3V_BITBLT_PAT_BG_COLOR_REG 0xA4F0
-#define S3V_BITBLT_PAT_FG_COLOR_ID 39
-#define S3V_BITBLT_PAT_FG_COLOR_REG 0xA4F4
-#define S3V_BITBLT_CMDSET_ID 40
-#define S3V_BITBLT_CMDSET_REG 0xA500
-#define S3V_BITBLT_WIDTH_HEIGHT_ID 41
-#define S3V_BITBLT_WIDTH_HEIGHT_REG 0xA504
-#define S3V_BITBLT_SRC_X_Y_ID 42
-#define S3V_BITBLT_SRC_X_Y_REG 0xA508
-#define S3V_BITBLT_DEST_X_Y_ID 43
-#define S3V_BITBLT_DEST_X_Y_REG 0xA50C
-#define S3V_2DLINE_ID 44
-#define S3V_2DLINE_REG 0xA800
-#define S3V_2DPOLY_ID 45
-#define S3V_2DPOLY_REG 0xAC00
-
-/***************
- * 3DLINE REGS *
- ***************/
-/* base regs */
-#define S3V_3DLINE_ID 50
-#define S3V_3DLINE_REG 0xB000
-#define S3V_3DLINE_Z_BASE_ID 51
-#define S3V_3DLINE_Z_BASE_REG 0xB0D4
-#define S3V_3DLINE_SRC_BASE_ID 52 /* it is the same reg */
-#define S3V_3DLINE_SRC_BASE_REG 0xB0D4
-#define S3V_3DLINE_DEST_BASE_ID 53
-#define S3V_3DLINE_DEST_BASE_REG 0xB0D8
-#define S3V_3DLINE_CLIP_L_R_ID 54
-#define S3V_3DLINE_CLIP_L_R_REG 0xB0DC
-#define S3V_3DLINE_CLIP_T_B_ID 55
-#define S3V_3DLINE_CLIP_T_B_REG 0xB0E0
-#define S3V_3DLINE_DEST_SRC_STRIDE_ID 56
-#define S3V_3DLINE_DEST_SRC_STRIDE_REG 0xB0E4
-#define S3V_3DLINE_Z_STRIDE_ID 57
-#define S3V_3DLINE_Z_STRIDE_REG 0xB0E8
-#define S3V_3DLINE_TEX_BASE_ID 58
-#define S3V_3DLINE_TEX_BASE_REG 0xB0EC
-#define S3V_3DLINE_TEX_B_COLOR_ID 59
-#define S3V_3DLINE_TEX_B_COLOR_REG 0xB0F0
-#define S3V_3DLINE_FOG_COLOR_ID 60
-#define S3V_3DLINE_FOG_COLOR_REG 0xB0F4
-#define S3V_3DLINE_COLOR0_ID 61
-#define S3V_3DLINE_COLOR0_REG 0xB0F8
-#define S3V_3DLINE_COLOR1_ID 62
-#define S3V_3DLINE_COLOR1_REG 0xB0FC
-#define S3V_3DLINE_CMDSET_ID 63
-#define S3V_3DLINE_CMDSET_REG 0xB100 /* special */
-/* tex regs */
-/* FIXME: shouldn't it be a 1D tex for lines? */
-#define S3V_3DLINE_BASEV_ID 64
-#define S3V_3DLINE_BASEV_REG 0xB104
-#define S3V_3DLINE_BASEU_ID 65
-#define S3V_3DLINE_BASEU_REG 0xB108
-#define S3V_3DLINE_WXD_ID 66
-#define S3V_3DLINE_WXD_REG 0xB10C
-#define S3V_3DLINE_WYD_ID 67
-#define S3V_3DLINE_WYD_REG 0xB110
-#define S3V_3DLINE_WSTART_ID 68
-#define S3V_3DLINE_WSTART_REG 0xB114
-#define S3V_3DLINE_DXD_ID 69
-#define S3V_3DLINE_DXD_REG 0xB118
-#define S3V_3DLINE_VXD_ID 70
-#define S3V_3DLINE_VXD_REG 0xB11C
-#define S3V_3DLINE_UXD_ID 71
-#define S3V_3DLINE_UXD_REG 0xB120
-#define S3V_3DLINE_DYD_ID 72
-#define S3V_3DLINE_DYD_REG 0xB124
-#define S3V_3DLINE_VYD_ID 73
-#define S3V_3DLINE_VYD_REG 0xB128
-#define S3V_3DLINE_UYD_ID 74
-#define S3V_3DLINE_UYD_REG 0xB12C
-#define S3V_3DLINE_DSTART_ID 75
-#define S3V_3DLINE_DSTART_REG 0xB130
-#define S3V_3DLINE_VSTART_ID 76
-#define S3V_3DLINE_VSTART_REG 0xB134
-#define S3V_3DLINE_USTART_ID 77
-#define S3V_3DLINE_USTART_REG 0xB138
-/* gourad regs */
-#define S3V_3DLINE_GBD_ID 78
-#define S3V_3DLINE_GBD_REG 0xB144
-#define S3V_3DLINE_ARD_ID 79
-#define S3V_3DLINE_ARD_REG 0xB148
-#define S3V_3DLINE_GS_BS_ID 80
-#define S3V_3DLINE_GS_BS_REG 0xB14C
-#define S3V_3DLINE_AS_RS_ID 81
-#define S3V_3DLINE_AS_RS_REG 0xB150
-/* vertex regs */
-#define S3V_3DLINE_DZ_ID 82
-#define S3V_3DLINE_DZ_REG 0xB158
-#define S3V_3DLINE_ZSTART_ID 83
-#define S3V_3DLINE_ZSTART_REG 0xB15C
-#define S3V_3DLINE_XEND0_END1_ID 84
-#define S3V_3DLINE_XEND0_END1_REG 0xB16C
-#define S3V_3DLINE_DX_ID 85
-#define S3V_3DLINE_DX_REG 0xB170
-#define S3V_3DLINE_XSTART_ID 86
-#define S3V_3DLINE_XSTART_REG 0xB174
-#define S3V_3DLINE_YSTART_ID 87
-#define S3V_3DLINE_YSTART_REG 0xB178
-#define S3V_3DLINE_YCNT_ID 88
-#define S3V_3DLINE_YCNT_REG 0xB17C
-
-/**************
- * 3DTRI REGS *
- **************/
-/* base regs */
-#define S3V_3DTRI_ID 100
-#define S3V_3DTRI_REG 0xB400
-#define S3V_3DTRI_Z_BASE_ID 101
-#define S3V_3DTRI_Z_BASE_REG 0xB4D4
-#define S3V_3DTRI_SRC_BASE_ID 102 /* it is the same reg */
-#define S3V_3DTRI_SRC_BASE_REG 0xB4D4
-#define S3V_3DTRI_DEST_BASE_ID 103
-#define S3V_3DTRI_DEST_BASE_REG 0xB4D8
-#define S3V_3DTRI_CLIP_L_R_ID 104
-#define S3V_3DTRI_CLIP_L_R_REG 0xB4DC
-#define S3V_3DTRI_CLIP_T_B_ID 105
-#define S3V_3DTRI_CLIP_T_B_REG 0xB4E0
-#define S3V_3DTRI_DEST_SRC_STRIDE_ID 106
-#define S3V_3DTRI_DEST_SRC_STRIDE_REG 0xB4E4
-#define S3V_3DTRI_Z_STRIDE_ID 107
-#define S3V_3DTRI_Z_STRIDE_REG 0xB4E8
-#define S3V_3DTRI_TEX_BASE_ID 108
-#define S3V_3DTRI_TEX_BASE_REG 0xB4EC
-#define S3V_3DTRI_TEX_B_COLOR_ID 109
-#define S3V_3DTRI_TEX_B_COLOR_REG 0xB4F0
-#define S3V_3DTRI_FOG_COLOR_ID 110
-#define S3V_3DTRI_FOG_COLOR_REG 0xB4F4
-#define S3V_3DTRI_COLOR0_ID 111
-#define S3V_3DTRI_COLOR0_REG 0xB4F8
-#define S3V_3DTRI_COLOR1_ID 112
-#define S3V_3DTRI_COLOR1_REG 0xB4FC
-#define S3V_3DTRI_CMDSET_ID 113 /* special */
-#define S3V_3DTRI_CMDSET_REG 0xB500
-/* tex regs */
-#define S3V_3DTRI_BASEV_ID 114
-#define S3V_3DTRI_BASEV_REG 0xB504
-#define S3V_3DTRI_BASEU_ID 115
-#define S3V_3DTRI_BASEU_REG 0xB508
-#define S3V_3DTRI_WXD_ID 116
-#define S3V_3DTRI_WXD_REG 0xB50C
-#define S3V_3DTRI_WYD_ID 117
-#define S3V_3DTRI_WYD_REG 0xB510
-#define S3V_3DTRI_WSTART_ID 118
-#define S3V_3DTRI_WSTART_REG 0xB514
-#define S3V_3DTRI_DXD_ID 119
-#define S3V_3DTRI_DXD_REG 0xB518
-#define S3V_3DTRI_VXD_ID 120
-#define S3V_3DTRI_VXD_REG 0xB51C
-#define S3V_3DTRI_UXD_ID 121
-#define S3V_3DTRI_UXD_REG 0xB520
-#define S3V_3DTRI_DYD_ID 122
-#define S3V_3DTRI_DYD_REG 0xB524
-#define S3V_3DTRI_VYD_ID 123
-#define S3V_3DTRI_VYD_REG 0xB528
-#define S3V_3DTRI_UYD_ID 124
-#define S3V_3DTRI_UYD_REG 0xB52C
-#define S3V_3DTRI_DSTART_ID 125
-#define S3V_3DTRI_DSTART_REG 0xB530
-#define S3V_3DTRI_VSTART_ID 126
-#define S3V_3DTRI_VSTART_REG 0xB534
-#define S3V_3DTRI_USTART_ID 127
-#define S3V_3DTRI_USTART_REG 0xB538
-/* gourad regs */
-#define S3V_3DTRI_GBX_ID 128
-#define S3V_3DTRI_GBX_REG 0xB53C
-#define S3V_3DTRI_ARX_ID 129
-#define S3V_3DTRI_ARX_REG 0xB540
-#define S3V_3DTRI_GBY_ID 130
-#define S3V_3DTRI_GBY_REG 0xB544
-#define S3V_3DTRI_ARY_ID 131
-#define S3V_3DTRI_ARY_REG 0xB548
-#define S3V_3DTRI_GS_BS_ID 132
-#define S3V_3DTRI_GS_BS_REG 0xB54C
-#define S3V_3DTRI_AS_RS_ID 133
-#define S3V_3DTRI_AS_RS_REG 0xB550
-/* vertex regs */
-#define S3V_3DTRI_ZXD_ID 134
-#define S3V_3DTRI_ZXD_REG 0xB554
-#define S3V_3DTRI_ZYD_ID 135
-#define S3V_3DTRI_ZYD_REG 0xB558
-#define S3V_3DTRI_ZSTART_ID 136
-#define S3V_3DTRI_ZSTART_REG 0xB55C
-#define S3V_3DTRI_TXDELTA12_ID 137
-#define S3V_3DTRI_TXDELTA12_REG 0xB560
-#define S3V_3DTRI_TXEND12_ID 138
-#define S3V_3DTRI_TXEND12_REG 0xB564
-#define S3V_3DTRI_TXDELTA01_ID 139
-#define S3V_3DTRI_TXDELTA01_REG 0xB568
-#define S3V_3DTRI_TXEND01_ID 140
-#define S3V_3DTRI_TXEND01_REG 0xB56C
-#define S3V_3DTRI_TXDELTA02_ID 141
-#define S3V_3DTRI_TXDELTA02_REG 0xB570
-#define S3V_3DTRI_TXSTART02_ID 142
-#define S3V_3DTRI_TXSTART02_REG 0xB574
-#define S3V_3DTRI_TYS_ID 143
-#define S3V_3DTRI_TYS_REG 0xB578
-#define S3V_3DTRI_TY01_Y12_ID 144
-#define S3V_3DTRI_TY01_Y12_REG 0xB57C
-
-/* COMMANDS (to 0xB100 [lines] or 0xB500 [tris]) */
-
-/* Auto execute */
-#define AUTO_EXEC_MASK 0x00000001
-#define AUTO_EXEC_OFF (0x0)
-#define AUTO_EXEC_ON (0x1)
-/* HW clipping */
-#define HW_CLIP_MASK 0x00000002
-#define HW_CLIP_OFF (0x0 << 1)
-#define HW_CLIP_ON (0x1 << 1)
-/* Destination color */
-#define DEST_COL_MASK 0x0000001c
-#define DEST_COL_PAL (0x0 << 2) /* 8 bpp - palettized */
-#define DEST_COL_1555 (0x1 << 2) /* 16 bpp - ZRGB */
-#define DEST_COL_888 (0x2 << 2) /* 24 bpp - RGB */
-/* Texture color */
-#define TEX_COL_MASK 0x000000e0
-#define TEX_COL_ARGB8888 (0x0 << 5) /* 32 bpp - ARGB */
-#define TEX_COL_ARGB4444 (0x1 << 5) /* 16 bpp - ARGB */
-#define TEX_COL_ARGB1555 (0x2 << 5) /* 16 bpp - ARGB */
-#define TEX_COL_ALPHA4 (0x3 << 5) /* 8 bpp - ALPHA4 */
-#define TEX_COL_BLEND4_LOW (0x4 << 5) /* 4 bpp - BLEND4 low nibble */
-#define TEX_COL_BLEND4_HIGH (0x5 << 5) /* 4 bpp - BLEND4 high nibble */
-#define TEX_COL_PAL (0x6 << 5) /* 8 bpp - palettized */
-#define TEX_COL_YUV (0x7 << 5) /* 16 bpp - YUV */
-/* Mipmap level */
-#define MIP_MASK 0x00000f00
-#define MIPMAP_LEVEL(s) (s << 8) /* 8 -> 11 bits */
-/* Texture filtering */
-#define TEX_FILTER_MASK 0x00007000
-#define MIP_NEAREST (0x0 << 12)
-#define LINEAR_MIP_NEAREST (0x1 << 12)
-#define MIP_LINEAR (0x2 << 12)
-#define LINEAR_MIP_LINEAR (0x3 << 12)
-#define NEAREST (0x4 << 12)
-#define FAST_BILINEAR (0x5 << 12)
-#define LINEAR (0x6 << 12)
-/* Texture blending */
-#define TEX_BLEND_MAKS 0x00018000
-#define TEX_REFLECT (0x0 << 15)
-#define TEX_MODULATE (0x1 << 15)
-#define TEX_DECAL (0x2 << 15)
-/* Fog */
-#define FOG_MASK 0x00020000
-#define FOG_OFF (0x0 << 17)
-#define FOG_ON (0x1 << 17)
-/* Alpha blending */
-#define ALPHA_BLEND_MASK 0x000c0000
-#define ALPHA_OFF (0x0 << 18) | (0x0 << 19)
-#define ALPHA_TEX (0x2 << 18)
-#define ALPHA_SRC (0x3 << 18)
-/* Depth compare mode */
-#define Z_MODE_MASK 0x00700000
-#define Z_NEVER (0x0 << 20)
-#define Z_GREATER (0x1 << 20)
-#define Z_EQUAL (0x2 << 20)
-#define Z_GEQUAL (0x3 << 20)
-#define Z_LESS (0x4 << 20)
-#define Z_NOTEQUAL (0x5 << 20)
-#define Z_LEQUAL (0x6 << 20)
-#define Z_ALWAYS (0x7 << 20)
-/* Depth update */
-#define Z_UPDATE_MASK 0x00800000
-#define Z_UPDATE_OFF (0x0 << 23) /* disable z update */
-#define Z_UPDATE_ON (0x1 << 23)
-/* Depth buffering mode */
-#define Z_BUFFER_MASK 0x03000000
-#define Z_BUFFER (0x0 << 24) | (0x0 << 25)
-#define Z_MUX_BUF (0x1 << 24) | (0x0 << 25)
-#define Z_MUX_DRAW (0x2 << 24)
-#define Z_OFF (0x3 << 24) /* no z buffering */
-/* Texture wrapping */
-#define TEX_WRAP_MASK 0x04000000
-#define TEX_WRAP_OFF (0x0 << 26)
-#define TEX_WRAP_ON (0x1 << 26)
-/* 3d command */
-#define DO_MASK 0x78000000
-#define DO_GOURAUD_TRI (0x0 << 27)
-#define DO_TEX_LIT_TRI_OLD (0x1 << 27)
-#define DO_TEX_UNLIT_TRI_OLD (0x2 << 27)
-#define DO_TEX_LIT_TRI (0x5 << 27)
-#define DO_TEX_UNLIT_TRI (0x6 << 27)
-#define DO_3D_LINE (0x8 << 27)
-#define DO_NOP (0xf << 27) /* turn on autoexec */
-/* status */
-#define CMD_MASK 0x80000000
-#define CMD_2D (0x0 << 31) /* execute a 2d cmd */
-#define CMD_3D (0x1 << 31) /* execute a 3d cmd */
-
-/* global masks */
-#define TEX_MASK ( TEX_COL_MASK | TEX_WRAP_MASK | MIP_MASK \
- | TEX_FILTER_MASK | TEX_BLEND_MAKS \
- | TEX_WRAP_MASK )
-#define Z_MASK ( Z_MODE_MASK | Z_UPDATE_MASK | Z_BUFFER_MASK )
-
-#endif /* _S3V_REG_H */
diff --git a/src/mesa/drivers/dri/s3v/s3v_render.c b/src/mesa/drivers/dri/s3v/s3v_render.c
deleted file mode 100644
index 5023f3c4641..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_render.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-
-#include "tnl/t_context.h"
-
-#include "s3v_context.h"
-#include "s3v_tris.h"
-#include "s3v_vb.h"
-
-
-#define HAVE_POINTS 0
-#define HAVE_LINES 0
-#define HAVE_LINE_STRIPS 0
-#define HAVE_TRIANGLES 0
-#define HAVE_TRI_STRIPS 0
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 0
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-#define HAVE_POLYGONS 0
-
-#define HAVE_ELTS 0
-
-#if 0
-static void VERT_FALLBACK( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-/* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */
- int _flags;
-
- DEBUG(("VERT_FALLBACK: flags & PRIM_MODE_MASK = %i\n",
- flags & PRIM_MODE_MASK));
- DEBUG(("VERT_FALLBACK: flags=%i PRIM_MODE_MASK=%i\n",
- flags, PRIM_MODE_MASK));
-#if 0
- tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
-#endif
- tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
-
- _flags = flags & PRIM_MODE_MASK;
-
- tnl->Driver.Render.PrimTabVerts[_flags]( ctx, start, count, flags );
- S3V_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS;
-}
-#endif
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- PrimType_Points,
- PrimType_Lines,
- PrimType_LineLoop,
- PrimType_LineStrip,
- PrimType_Triangles,
- PrimType_TriangleStrip,
- PrimType_TriangleFan,
- PrimType_Quads,
- PrimType_QuadStrip,
- PrimType_Polygon
-};
-
-static INLINE void s3vStartPrimitive( s3vContextPtr vmesa, GLenum prim )
-{
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-
- int _hw_prim = hw_prim[prim];
-
- DEBUG(("s3vStartPrimitive (new #%i) ", prim));
-
- if (_hw_prim != vmesa->restore_primitive) {
-
- if (prim == 4) { /* TRI */
- DEBUG(("switching to tri\n"));
- vmesa->prim_cmd = vmesa->_tri[vmesa->_3d_mode];
- vmesa->alpha_cmd = vmesa->_alpha[vmesa->_3d_mode];
- DMAOUT_CHECK(3DTRI_Z_BASE, 12);
- } else if (prim == 1) { /* LINE */
- DEBUG(("switching to line\n"));
- vmesa->prim_cmd = DO_3D_LINE;
- vmesa->alpha_cmd = vmesa->_alpha[0];
- DMAOUT_CHECK(3DLINE_Z_BASE, 12);
- } else {
- DEBUG(("Never mind the bollocks!\n"));
- }
-
- DMAOUT(vmesa->s3vScreen->depthOffset & 0x003FFFF8);
- DMAOUT(vmesa->DestBase);
- /* DMAOUT(vmesa->ScissorLR); */
- /* DMAOUT(vmesa->ScissorTB); */
- DMAOUT( (0 << 16) | (dPriv->w-1) );
- DMAOUT( (0 << 16) | (dPriv->h-1) );
- DMAOUT( (vmesa->SrcStride << 16) | vmesa->TexStride );
- DMAOUT(vmesa->SrcStride);
- DMAOUT(vmesa->TexOffset);
- DMAOUT(vmesa->TextureBorderColor);
- DMAOUT(0); /* FOG */
- DMAOUT(0);
- DMAOUT(0);
- DMAOUT(vmesa->CMD | vmesa->prim_cmd | vmesa->alpha_cmd);
- DMAFINISH();
- }
-
- vmesa->restore_primitive = _hw_prim;
-}
-
-static INLINE void s3vEndPrimitive( s3vContextPtr vmesa )
-{
-/* GLcontext *ctx = vmesa->glCtx; */
- DEBUG(("s3vEndPrimitive\n"));
-}
-
-#define LOCAL_VARS s3vContextPtr vmesa = S3V_CONTEXT(ctx)
-#define INIT( prim ) s3vStartPrimitive( vmesa, prim )
-#define FINISH s3vEndPrimitive( vmesa )
-#define NEW_PRIMITIVE() (void) vmesa
-#define NEW_BUFFER() (void) vmesa
-#define FIRE_VERTICES() (void) vmesa
-#define GET_CURRENT_VB_MAX_VERTS() \
- (vmesa->bufSize - vmesa->bufCount) / 2
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- S3V_DMA_BUF_SZ / 2
-/* XXX */
-#define ALLOC_VERTS(nr) NULL
-#define EMIT_VERTS(ctx, start, count, buf) NULL
-#define FLUSH() s3vEndPrimitive( vmesa )
-
-#define TAG(x) s3v_##x
-
-#include "tnl_dd/t_dd_dmatmp.h"
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-static GLboolean s3v_run_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
- tnl_render_func *tab;
-
- DEBUG(("s3v_run_render\n"));
-
- /* FIXME: hw clip */
- if (VB->ClipOrMask || vmesa->RenderIndex != 0) {
- DEBUG(("*** CLIPPED in render ***\n"));
-#if 1
- return GL_TRUE; /* don't handle clipping here */
-#endif
- }
-
-
- /* We don't do elts */
- if (VB->Elts)
- return GL_TRUE;
-
- tab = TAG(render_tab_verts);
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++ )
- {
- GLuint prim = _tnl_translate_prim(&VB->Primitive[i]);
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- DEBUG(("s3v_run_render (loop=%i) (lenght=%i)\n", i, length));
-
- if (length) {
- tnl->Driver.Render.BuildVertices( ctx, start,
- start+length, ~0 /*stage->inputs*/); /* XXX */
- tnl->Driver.Render.PrimTabVerts[prim & PRIM_MODE_MASK]
- ( ctx, start, start + length, prim );
- vmesa->SetupNewInputs = VERT_BIT_POS;
- }
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-
-const struct tnl_pipeline_stage _s3v_render_stage =
-{
- "s3v render",
- NULL,
- NULL,
- NULL,
- NULL,
- s3v_run_render /* run */
-};
diff --git a/src/mesa/drivers/dri/s3v/s3v_screen.c b/src/mesa/drivers/dri/s3v/s3v_screen.c
deleted file mode 100644
index f1810597e6f..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_screen.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-#include "s3v_vb.h"
-#include "s3v_dri.h"
-
-s3vScreenPtr s3vCreateScreen( __DRIscreenPrivate *sPriv )
-{
- s3vScreenPtr s3vScreen;
- S3VDRIPtr vDRIPriv = (S3VDRIPtr)sPriv->pDevPriv;
-
-/* int i; */
-
- DEBUG(("s3vCreateScreen\n"));
- DEBUG(("sPriv->pDevPriv at %p\n", sPriv->pDevPriv));
- DEBUG(("size = %i\n", sizeof(*vDRIPriv)));
-
- if (sPriv->devPrivSize != sizeof(S3VDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(S3VDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- s3vScreen = (s3vScreenPtr) CALLOC( sizeof(*s3vScreen) );
- if ( !s3vScreen ) return NULL;
-
- s3vScreen->regionCount = 4; /* Magic number. Can we fix this? */
-
- s3vScreen->regions = _mesa_malloc(s3vScreen->regionCount *
- sizeof(s3vRegion));
- DEBUG(("sPriv->fd = %i\nvDRIPriv->dmaBufHandle = %x\n",
- sPriv->fd, vDRIPriv->dmaBufHandle));
-
- DEBUG(("vDRIPriv->dmaBufSize=%i\nvDRIPriv->dmaBuf=%p\n",
- vDRIPriv->dmaBufSize, vDRIPriv->dmaBuf));
-
-
- /* Get the list of dma buffers */
- s3vScreen->bufs = drmMapBufs(sPriv->fd);
-
- if (!s3vScreen->bufs) {
- DEBUG(("Helter/skelter with drmMapBufs\n"));
- return GL_FALSE;
- }
-
- s3vScreen->textureSize = vDRIPriv->texSize;
- s3vScreen->logTextureGranularity = vDRIPriv->logTextureGranularity;
- s3vScreen->cpp = vDRIPriv->cpp;
- s3vScreen->frontOffset = vDRIPriv->frontOffset;
- s3vScreen->frontPitch = vDRIPriv->frontPitch;
- s3vScreen->backOffset = vDRIPriv->backOffset;
- s3vScreen->backPitch = vDRIPriv->frontPitch; /* FIXME: check */
- s3vScreen->depthOffset = vDRIPriv->depthOffset;
- s3vScreen->depthPitch = vDRIPriv->frontPitch;
- s3vScreen->texOffset = vDRIPriv->texOffset;
-
- s3vScreen->driScreen = sPriv;
-
- DEBUG(("vDRIPriv->width =%i; vDRIPriv->deviceID =%x\n", vDRIPriv->width,
- vDRIPriv->deviceID));
- DEBUG(("vDRIPriv->mem =%i\n", vDRIPriv->mem));
- DEBUG(("vDRIPriv->fbOffset =%i\n", vDRIPriv->fbOffset));
- DEBUG((" ps3vDRI->fbStride =%i\n", vDRIPriv->fbStride));
- DEBUG(("s3vScreen->cpp = %i\n", s3vScreen->cpp));
- DEBUG(("s3vScreen->backOffset = %x\n", s3vScreen->backOffset));
- DEBUG(("s3vScreen->depthOffset = %x\n", s3vScreen->depthOffset));
- DEBUG(("s3vScreen->texOffset = %x\n", s3vScreen->texOffset));
- DEBUG(("I will return from s3vCreateScreen now\n"));
-
- DEBUG(("s3vScreen->bufs = 0x%x\n", s3vScreen->bufs));
- return s3vScreen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-void s3vDestroyScreen( __DRIscreenPrivate *sPriv )
-{
- s3vScreenPtr s3vScreen = (s3vScreenPtr)sPriv->private;
-
- DEBUG(("s3vDestroyScreen\n"));
-
- /* First, unmap the dma buffers */
-/*
- drmUnmapBufs( s3vScreen->bufs );
-*/
- /* Next, unmap all the regions */
-/* while (s3vScreen->regionCount > 0) {
-
- (void)drmUnmap(s3vScreen->regions[s3vScreen->regionCount].map,
- s3vScreen->regions[s3vScreen->regionCount].size);
- s3vScreen->regionCount--;
-
- }
- FREE(s3vScreen->regions); */
- if (s3vScreen)
- FREE(s3vScreen);
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_screen.h b/src/mesa/drivers/dri/s3v/s3v_screen.h
deleted file mode 100644
index c49bc8587da..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_screen.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "main/mtypes.h"
-
-typedef struct _s3vRegion {
- drm_handle_t handle;
- drmSize size;
- drmAddress map;
-} s3vRegion, *s3vRegionPtr;
-
-typedef struct {
-
- int regionCount; /* Count of register regions */
- s3vRegion *regions; /* Vector of mapped region info */
-
- drmBufMapPtr bufs; /* Map of DMA buffers */
-
- __DRIscreenPrivate *driScreen; /* Back pointer to DRI screen */
-
- int cpp;
- int frontPitch;
- int frontOffset;
-
- int backPitch;
- int backOffset;
- int backX;
- int backY;
-
- int depthOffset;
- int depthPitch;
-
- int texOffset;
- int textureOffset;
- int textureSize;
- int logTextureGranularity;
-} s3vScreenRec, *s3vScreenPtr;
-
diff --git a/src/mesa/drivers/dri/s3v/s3v_span.c b/src/mesa/drivers/dri/s3v/s3v_span.c
deleted file mode 100644
index f9f7c0d1eee..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_span.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-#include "s3v_lock.h"
-
-#include "swrast/swrast.h"
-
-#define _SPANLOCK 1
-#define DBG 0
-
-#define LOCAL_VARS \
- s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
- __DRIscreenPrivate *sPriv = vmesa->driScreen; \
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
- driRenderbuffer *drb = (driRenderbuffer *) rb; \
- GLuint cpp = drb->cpp; \
- GLuint pitch = ( (drb->backBuffer) ? \
- ((dPriv->w+31)&~31) * cpp \
- : sPriv->fbWidth * cpp); \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + drb->offset \
- + (drb->backBuffer ? 0 : dPriv->x * cpp + dPriv->y * pitch));\
- GLuint p; \
- (void) p
-
-/* FIXME! Depth/Stencil read/writes don't work ! */
-#define LOCAL_DEPTH_VARS \
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
- __DRIscreenPrivate *sPriv = vmesa->driScreen; \
- driRenderbuffer *drb = (driRenderbuffer *) rb; \
- GLuint pitch = drb->pitch; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + drb->offset); \
- (void) pitch
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define Y_FLIP( _y ) (height - _y - 1)
-
-#if _SPANLOCK /* OK, we lock */
-
-#define HW_LOCK() \
- s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
- (void) vmesa; \
- DMAFLUSH(); \
- S3V_SIMPLE_FLUSH_LOCK(vmesa);
-#define HW_UNLOCK() S3V_SIMPLE_UNLOCK(vmesa);
-
-#else /* plz, don't lock */
-
-#define HW_LOCK() \
- s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
- (void) vmesa; \
- DMAFLUSH();
-#define HW_UNLOCK()
-
-#endif
-
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define INIT_MONO_PIXEL(p, color) \
- p = S3VIRGEPACKCOLOR555( color[0], color[1], color[2], color[3] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
-do { \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 7) | \
- (((int)g & 0xf8) << 2) | \
- (((int)b & 0xf8) >> 3)); \
- DEBUG(("buf=0x%x drawOffset=0x%x dPriv->x=%i drb->cpp=%i dPriv->y=%i pitch=%i\n", \
- sPriv->pFB, vmesa->drawOffset, dPriv->x, drb->cpp, dPriv->y, pitch)); \
- DEBUG(("dPriv->w = %i\n", dPriv->w)); \
-} while(0)
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \
- rgba[0] = (p >> 7) & 0xf8; \
- rgba[1] = (p >> 2) & 0xf8; \
- rgba[2] = (p << 3) & 0xf8; \
- rgba[3] = 0xff; /*
- if ( rgba[0] & 0x08 ) rgba[0] |= 0x07; \
- if ( rgba[1] & 0x04 ) rgba[1] |= 0x03; \
- if ( rgba[2] & 0x08 ) rgba[2] |= 0x07; */ \
- } while (0)
-
-#define TAG(x) s3v##x##_RGB555
-#include "spantmp.h"
-
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_8888( color[3], color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16) | \
- (a << 24) )
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = (p >> 24) & 0xff; \
-} while (0)
-
-#define TAG(x) s3v##x##_ARGB8888
-#include "spantmp.h"
-
-
-/* 16 bit depthbuffer functions.
- */
-#define VALUE_TYPE GLushort
-
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + _x*2 + _y*dPriv->w*2) = d
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + _x*2 + _y*dPriv->w*2);
-
-#define TAG(x) s3v##x##_z16
-#include "depthtmp.h"
-
-
-
-
-/* 32 bit depthbuffer functions.
- */
-#if 0
-#define VALUE_TYPE GLuint
-
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch);
-
-#define TAG(x) s3v##x##_32
-#include "depthtmp.h"
-#endif
-
-
-/* 24/8 bit interleaved depth/stencil functions
- */
-#if 0
-#define VALUE_TYPE GLuint
-
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
- tmp &= 0xff; \
- tmp |= (d) & 0xffffff00; \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
-}
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) & ~0xff
-
-
-#define TAG(x) s3v##x##_24_8
-#include "depthtmp.h"
-
-#define WRITE_STENCIL( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
- tmp &= 0xffffff00; \
- tmp |= d & 0xff; \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
-}
-
-#define READ_STENCIL( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xff
-
-#define TAG(x) s3v##x##_24_8
-#include "stenciltmp.h"
-
-#endif
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-s3vSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- s3vInitPointers_RGB555(&drb->Base);
- }
- else {
- s3vInitPointers_ARGB8888(&drb->Base);
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- s3vInitDepthPointers_z16(&drb->Base);
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- /* not done yet */
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- /* not done yet */
- }
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_state.c b/src/mesa/drivers/dri/s3v/s3v_state.c
deleted file mode 100644
index 561f42c705f..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_state.c
+++ /dev/null
@@ -1,888 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-#include "s3v_macros.h"
-#include "s3v_dri.h"
-#include "main/macros.h"
-#include "main/colormac.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "vbo/vbo.h"
-#include "tnl/tnl.h"
-
-/* #define DEBUG(str) printf str */
-#define ENABLELIGHTING 0
-
-
-/* =============================================================
- * Alpha blending
- */
-
-static void s3vUpdateAlphaMode( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- uint32_t cmd = vmesa->CMD;
- cmd &= ~ALPHA_BLEND_MASK;
-
- if ( ctx->Color.BlendEnabled ) {
- DEBUG(("ctx->Color.AlphaEnabled = 1"));
- vmesa->_alpha[0] = ALPHA_SRC;
- vmesa->_alpha[1] = vmesa->_alpha_tex; /* FIXME: not all tex modes
- support alpha */
- } else {
- DEBUG(("ctx->Color.AlphaEnabled = 0"));
- vmesa->_alpha[0] = vmesa->_alpha[1] = ALPHA_OFF;
- }
-#if 1
- if ((cmd & DO_MASK) & DO_3D_LINE) { /* we are drawing 3d lines */
- /* which don't support tex */
- cmd |= vmesa->_alpha[0];
- } else {
- cmd |= vmesa->_alpha[vmesa->_3d_mode];
- }
-
- vmesa->CMD = cmd; /* FIXME: enough? */
-#else
- vmesa->restore_primitive = -1;
-#endif
-
-}
-
-static void s3vDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- DEBUG(("s3vDDAlphaFunc\n"));
-
- vmesa->new_state |= S3V_NEW_ALPHA;
-}
-
-static void s3vDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- DEBUG(("s3vDDBlendFunc\n"));
-
- vmesa->new_state |= S3V_NEW_ALPHA;
-}
-
-/* ================================================================
- * Buffer clear
- */
-
-static void s3vDDClear( GLcontext *ctx, GLbitfield mask )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- unsigned int _stride;
- GLint cx = ctx->DrawBuffer->_Xmin;
- GLint cy = ctx->DrawBuffer->_Ymin;
- GLint cw = ctx->DrawBuffer->_Xmax - cx;
- GLint ch = ctx->DrawBuffer->_Ymax - cy;
-
- /* XXX FIX ME: the cx,cy,cw,ch vars are currently ignored! */
-
- vmesa->restore_primitive = -1;
-
- /* Update and emit any new state. We need to do this here to catch
- * changes to the masks.
- * FIXME: Just update the masks?
- */
-
- if ( vmesa->new_state )
- s3vDDUpdateHWState( ctx );
-
-/* s3vUpdateMasks( ctx ); */
-/* s3vUpdateClipping( ctx ); */
-/* s3vEmitHwState( vmesa ); */
-
-
-#if 1 /* soft (0)/hw (1)*/
-
- DEBUG(("*** s3vDDClear ***\n"));
-
- DMAOUT_CHECK(BITBLT_SRC_BASE, 15);
- DMAOUT(vmesa->SrcBase);
- DMAOUT(vmesa->DestBlit);
- DMAOUT( vmesa->ScissorLR );
- DMAOUT( vmesa->ScissorTB );
- DMAOUT( (vmesa->SrcStride << 16) | vmesa->SrcStride ); /* FIXME: unify */
- DMAOUT( (~(0)) ); /* masks */
- DMAOUT( (~(0)) );
- DMAOUT(0);
- DMAOUT(vmesa->ClearColor);
- DMAOUT(0);
- DMAOUT(0);
- /* FIXME */
- DMAOUT(0x16000122 | 0x5 | (0xF0 << 17)); /* black magic to me */
- DMAOUT(vmesa->ScissorWH);
- DMAOUT(vmesa->SrcXY);
- DMAOUT(vmesa->DestXY);
- DMAFINISH();
-
- if (mask & BUFFER_BIT_DEPTH) { /* depth */
- DEBUG(("BUFFER_BIT_DEPTH\n"));
-
- _stride = ((cw+31)&~31) * 2; /* XXX cw or Buffer->Width??? */
-
- DMAOUT_CHECK(BITBLT_SRC_BASE, 15);
- DMAOUT(0);
- DMAOUT(vmesa->s3vScreen->depthOffset);
- DMAOUT( (0 << 16) | cw );
- DMAOUT( (0 << 16) | ch );
- DMAOUT( (vmesa->SrcStride << 16) | vmesa->DestStride );
- DMAOUT( (~(0)) ); /* masks */
- DMAOUT( (~(0)) );
- DMAOUT(0);
- DMAOUT(vmesa->ClearDepth); /* 0x7FFF */
- /* FIXME */
- DMAOUT(0);
- DMAOUT(0);
- DMAOUT(0x16000122 | 0x5 | (0xF0 << 17));
- DMAOUT( ((cw-1) << 16) | (ch-1) );
- DMAOUT(0);
- DMAOUT( (0 << 16) | 0 );
- DMAFINISH();
-
- DEBUG(("vmesa->ClearDepth = 0x%x\n", vmesa->ClearDepth));
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- if (!vmesa->NotClipped) {
- DEBUG(("vmesa->NotClipped\n")); /* yes */
- }
-
- if (!(vmesa->EnabledFlags & S3V_BACK_BUFFER)) {
- DEBUG(("!S3V_BACK_BUFFER -> flush\n"));
- DMAFLUSH();
- }
-/*
- if ( mask )
- DEBUG(("still masked ;3(\n")); */ /* yes */
-#else
- _swrast_Clear( ctx, mask );
-#endif
-}
-
-/* =============================================================
- * Depth testing
- */
-
-static void s3vUpdateZMode( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- uint32_t cmd = vmesa->CMD;
-
- DEBUG(("Depth.Test = %i\n", ctx->Depth.Test));
- DEBUG(("CMD was = 0x%x ", cmd));
-
-/* printf("depth --- CMD was = 0x%x \n", cmd); */
-
- cmd &= ~Z_MASK; /* 0xfc0fffff; */
- /* Z_BUFFER */ /* 000 mode */ /* Z_UPDATE_OFF */
-
- if (!ctx->Depth.Test)
- cmd |= Z_OFF;
-
- if ( ctx->Depth.Mask )
- cmd |= Z_UPDATE_ON;
-
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- cmd |= Z_NEVER;
- break;
- case GL_ALWAYS:
- cmd |= Z_ALWAYS;
- break;
- case GL_LESS:
- cmd |= Z_LESS;
- break;
- case GL_LEQUAL:
- cmd |= Z_LEQUAL;
- break;
- case GL_EQUAL:
- cmd |= Z_EQUAL;
- break;
- case GL_GEQUAL:
- cmd |= Z_GEQUAL;
- break;
- case GL_GREATER:
- cmd |= Z_GREATER;
- break;
- case GL_NOTEQUAL:
- cmd |= Z_NOTEQUAL;
- break;
- }
-
- DEBUG(("CMD is 0x%x\n", cmd));
-
- vmesa->dirty |= S3V_UPLOAD_DEPTH;
- vmesa->CMD = cmd;
-}
-
-static void s3vDDDepthFunc( GLcontext *ctx, GLenum func )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
-/* FLUSH_BATCH( vmesa ); */
- DEBUG(("s3vDDDepthFunc\n"));
- vmesa->new_state |= S3V_NEW_DEPTH;
-}
-
-static void s3vDDDepthMask( GLcontext *ctx, GLboolean flag )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- /* FLUSH_BATCH( vmesa ); */
- DEBUG(("s3vDDDepthMask\n"));
- vmesa->new_state |= S3V_NEW_DEPTH;
-}
-
-static void s3vDDClearDepth( GLcontext *ctx, GLclampd d )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- switch ( vmesa->DepthSize ) {
- case 15:
- case 16:
- vmesa->ClearDepth = d * 0x0000ffff; /* 65536 */
- DEBUG(("GLclampd d = %f\n", d));
- DEBUG(("ctx->Depth.Clear = %f\n", ctx->Depth.Clear));
- DEBUG(("(They should be the same)\n"));
- break;
- case 24:
- vmesa->ClearDepth = d * 0x00ffffff;
- break;
- case 32:
- vmesa->ClearDepth = d * 0xffffffff;
- break;
- }
-}
-
-static void s3vDDFinish( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- DMAFLUSH();
-}
-
-static void s3vDDFlush( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- DMAFLUSH();
-}
-
-/* =============================================================
- * Fog
- */
-
-static void s3vUpdateFogAttrib( GLcontext *ctx )
-{
-/* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */
-
- if (ctx->Fog.Enabled) {
- } else {
- }
-
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- break;
- case GL_EXP:
- break;
- case GL_EXP2:
- break;
- }
-}
-
-static void s3vDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- vmesa->new_state |= S3V_NEW_FOG;
-}
-
-/* =============================================================
- * Lines
- */
-static void s3vDDLineWidth( GLcontext *ctx, GLfloat width )
-{
- /* FIXME: on virge you only have one size of 3d lines *
- * if we wanted more, we should start using tris instead *
- * but virge has problem with some tris when all of the *
- * vertices stay on a line */
-}
-
-/* =============================================================
- * Points
- */
-static void s3vDDPointSize( GLcontext *ctx, GLfloat size )
-{
- /* FIXME: we use 3d line to fake points. So same limitations
- * as above apply */
-}
-
-/* =============================================================
- * Polygon
- */
-
-static void s3vUpdatePolygon( GLcontext *ctx )
-{
- /* FIXME: I don't think we could do much here */
-
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- vmesa->dirty |= S3V_UPLOAD_POLYGON;
-}
-
-/* =============================================================
- * Clipping
- */
-
-static void s3vUpdateClipping( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-
- int x0,y0,x1,y1;
-
- DEBUG((">>> s3vUpdateClipping <<<\n"));
-/*
- if ( vmesa->driDrawable ) {
- DEBUG(("s3vUpdateClipping\n"));
-*/
- if (vmesa->EnabledFlags & S3V_BACK_BUFFER) {
- DEBUG(("S3V_BACK_BUFFER\n"));
-
- x0 = 0;
- y0 = 0;
- x1 = dPriv->w - 1;
- y1 = dPriv->h - 1;
-
- vmesa->SrcBase = 0;
- vmesa->DestBase = vmesa->s3vScreen->backOffset;
- vmesa->DestBlit = vmesa->DestBase;
- vmesa->ScissorLR = ( (0 << 16) | (dPriv->w-1) );
- vmesa->ScissorTB = ( (0 << 16) | (dPriv->h-1) );
-/*
- vmesa->ScissorLR = ( (x0 << 16) | x1 );
- vmesa->ScissorTB = ( (y0 << 16) | y1 );
-*/
- vmesa->SrcStride = ( ((dPriv->w+31)&~31) * vmesa->s3vScreen->cpp );
- vmesa->DestStride = vmesa->driScreen->fbWidth*vmesa->s3vScreen->cpp;
- vmesa->ScissorWH = ( (dPriv->w << 16) | dPriv->h );
- vmesa->SrcXY = 0;
-/* vmesa->DestXY = ( (dPriv->x << 16) | dPriv->y ); */
- vmesa->DestXY = ( (0 << 16) | 0 );
- } else {
- DEBUG(("S3V_FRONT_BUFFER\n"));
-
- x0 = dPriv->x;
- y0 = dPriv->y;
- x1 = x0 + dPriv->w - 1;
- y1 = y0 + dPriv->h - 1;
-
- vmesa->SrcBase = 0;
- vmesa->DestBase = 0;
- vmesa->ScissorLR = ( (x0 << 16) | x1 );
- vmesa->ScissorTB = ( (y0 << 16) | y1 );
- vmesa->DestStride = vmesa->driScreen->fbWidth*vmesa->s3vScreen->cpp;
- vmesa->SrcStride = vmesa->DestStride;
- vmesa->DestBase = (y0 * vmesa->DestStride)
- + x0*vmesa->s3vScreen->cpp;
- vmesa->DestBlit = 0;
- vmesa->ScissorWH = ( (x1 << 16) | y1 );
- vmesa->SrcXY = 0;
- vmesa->DestXY = ( (0 << 16) | 0 );
-/* vmesa->DestXY = ( (dPriv->x << 16) | dPriv->y ); */
- }
-
- DEBUG(("x0=%i y0=%i x1=%i y1=%i\n", x0, y0, x1, y1));
- DEBUG(("stride=%i rectWH=0x%x\n\n", vmesa->DestStride, vmesa->ScissorWH));
-
- /* FIXME: how could we use the following info? */
- /* if (ctx->Scissor.Enabled) {} */
-
- vmesa->dirty |= S3V_UPLOAD_CLIP;
-/* } */
-}
-
-static void s3vDDScissor( GLcontext *ctx,
- GLint x, GLint y, GLsizei w, GLsizei h )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- DEBUG((">>> s3vDDScissor <<<"));
- /* FLUSH_BATCH( vmesa ); */
- vmesa->new_state |= S3V_NEW_CLIP;
-}
-
-/* =============================================================
- * Culling
- */
-
-static void s3vUpdateCull( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- GLfloat backface_sign = 1;
-
- DEBUG(("s3vUpdateCull\n"));
- /* FIXME: GL_FRONT_AND_BACK */
-
- switch ( ctx->Polygon.CullFaceMode ) {
- case GL_BACK:
- if (ctx->Polygon.FrontFace == GL_CCW)
- backface_sign = -1;
- break;
-
- case GL_FRONT:
- if (ctx->Polygon.FrontFace != GL_CCW)
- backface_sign = -1;
- break;
-
- default:
- break;
- }
-
- vmesa->backface_sign = backface_sign;
- vmesa->dirty |= S3V_UPLOAD_GEOMETRY;
-}
-
-
-static void s3vDDCullFace( GLcontext *ctx, GLenum mode )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- /* FLUSH_BATCH( vmesa ); */
- vmesa->new_state |= S3V_NEW_CULL;
-}
-
-static void s3vDDFrontFace( GLcontext *ctx, GLenum mode )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- /* FLUSH_BATCH( vmesa ); */
- vmesa->new_state |= S3V_NEW_CULL;
-}
-
-/* =============================================================
- * Masks
- */
-
-static void s3vUpdateMasks( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- GLuint mask = s3vPackColor( vmesa->s3vScreen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] );
-
- if (vmesa->s3vScreen->cpp == 2) mask |= mask << 16;
-
- /* FIXME: can we do something in virge? */
-}
-/*
-static void s3vDDColorMask( GLcontext *ctx, GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- FLUSH_BATCH( vmesa );
- vmesa->new_state |= S3V_NEW_MASKS;
-}
-*/
-/* =============================================================
- * Rendering attributes
- */
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void s3vDDClearColor( GLcontext *ctx, const GLfloat color[4])
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- DEBUG(("*** s3vDDClearColor\n"));
-
- vmesa->ClearColor = s3vPackColor( 2, /* vmesa->s3vScreen->cpp, */
- color[0], color[1], color[2], color[3] );
-
-#if 0
- if (vmesa->s3vScreen->cpp == 2) vmesa->ClearColor |= vmesa->ClearColor<<16;
-#endif
-}
-
-static void s3vDDSetDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- int found = GL_TRUE;
-
- DEBUG(("*** s3vDDSetDrawBuffer ***\n"));
-
- /* FLUSH_BATCH( vmesa ); */
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- vmesa->drawOffset = vmesa->s3vScreen->frontOffset;
- break;
- case GL_BACK_LEFT:
- vmesa->drawOffset = vmesa->s3vScreen->backOffset;
- /* vmesa->driScreen->fbHeight *
- * vmesa->driScreen->fbWidth *
- * vmesa->s3vScreen->cpp; */
- break;
- default:
- found = GL_FALSE;
- break;
- }
-
- DEBUG(("vmesa->drawOffset = 0x%x\n", vmesa->drawOffset));
-/* return GL_TRUE; */
-}
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-void s3vUpdateWindow( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset =
- vmesa->driScreen->fbHeight - (GLfloat)dPriv->y - dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat sx = v[MAT_SX];
- GLfloat tx = v[MAT_TX] + xoffset;
- GLfloat sy = v[MAT_SY];
- GLfloat ty = v[MAT_TY] + yoffset;
- GLfloat sz = v[MAT_SZ] * vmesa->depth_scale;
- GLfloat tz = v[MAT_TZ] * vmesa->depth_scale;
-
- vmesa->dirty |= S3V_UPLOAD_VIEWPORT;
-
- vmesa->ViewportScaleX = sx;
- vmesa->ViewportScaleY = sy;
- vmesa->ViewportScaleZ = sz;
- vmesa->ViewportOffsetX = tx;
- vmesa->ViewportOffsetY = ty;
- vmesa->ViewportOffsetZ = tz;
-}
-
-
-/*
-static void s3vDDViewport( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- s3vUpdateWindow( ctx );
-}
-
-static void s3vDDDepthRange( GLcontext *ctx, GLclampd nearval,
- GLclampd farval )
-{
- s3vUpdateWindow( ctx );
-}
-*/
-void s3vUpdateViewportOffset( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset =
- vmesa->driScreen->fbHeight - (GLfloat)dPriv->y - dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat tx = v[MAT_TX] + xoffset;
- GLfloat ty = v[MAT_TY] + yoffset;
-
- DEBUG(("*** s3vUpdateViewportOffset ***\n"));
-
- if ( vmesa->ViewportOffsetX != tx ||
- vmesa->ViewportOffsetY != ty )
- {
- vmesa->ViewportOffsetX = tx;
- vmesa->ViewportOffsetY = ty;
-
- vmesa->new_state |= S3V_NEW_WINDOW;
- }
-
-/* vmesa->new_state |= S3V_NEW_CLIP; */
-}
-
-/* =============================================================
- * State enable/disable
- */
-
-static void s3vDDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- switch ( cap ) {
- case GL_ALPHA_TEST:
- case GL_BLEND:
- vmesa->new_state |= S3V_NEW_ALPHA;
- DEBUG(("s3vDDEnable: GL_BLEND\n"));
- break;
-
- case GL_CULL_FACE:
- vmesa->new_state |= S3V_NEW_CULL;
- DEBUG(("s3vDDEnable: GL_CULL_FACE\n"));
- break;
-
- case GL_DEPTH_TEST:
- vmesa->new_state |= S3V_NEW_DEPTH;
- DEBUG(("s3vDDEnable: GL_DEPTH\n"));
- break;
-#if 0
- case GL_FOG:
- vmesa->new_state |= S3V_NEW_FOG;
- break;
-#endif
-
- case GL_SCISSOR_TEST:
- vmesa->new_state |= S3V_NEW_CLIP;
- break;
-
- case GL_TEXTURE_2D:
- DEBUG(("*** GL_TEXTURE_2D: %i\n", state));
- vmesa->_3d_mode = state;
- vmesa->restore_primitive = -1;
- break;
-
- default:
- return;
- }
-}
-
-/* =============================================================
- * State initialization, management
- */
-
-
-/*
- * Load the current context's state into the hardware.
- *
- * NOTE: Be VERY careful about ensuring the context state is marked for
- * upload, the only place it shouldn't be uploaded is when the setup
- * state has changed in ReducedPrimitiveChange as this comes right after
- * a state update.
- *
- * Blits of any type should always upload the context and masks after
- * they are done.
- */
-void s3vEmitHwState( s3vContextPtr vmesa )
-{
- if (!vmesa->driDrawable) return;
- if (!vmesa->dirty) return;
-
- DEBUG(("**********************\n"));
- DEBUG(("*** s3vEmitHwState ***\n"));
- DEBUG(("**********************\n"));
-
- if (vmesa->dirty & S3V_UPLOAD_VIEWPORT) {
- vmesa->dirty &= ~S3V_UPLOAD_VIEWPORT;
- DEBUG(("S3V_UPLOAD_VIEWPORT\n"));
- }
-
- if ( (vmesa->dirty & S3V_UPLOAD_POINTMODE) ||
- (vmesa->dirty & S3V_UPLOAD_LINEMODE) ||
- (vmesa->dirty & S3V_UPLOAD_TRIMODE) ) {
-
- }
-
- if (vmesa->dirty & S3V_UPLOAD_POINTMODE) {
- vmesa->dirty &= ~S3V_UPLOAD_POINTMODE;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_LINEMODE) {
- vmesa->dirty &= ~S3V_UPLOAD_LINEMODE;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_TRIMODE) {
- vmesa->dirty &= ~S3V_UPLOAD_TRIMODE;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_FOG) {
- GLchan c[3], col;
- UNCLAMPED_FLOAT_TO_RGB_CHAN( c, vmesa->glCtx->Fog.Color );
- DEBUG(("uploading ** FOG **\n"));
- col = s3vPackColor(2, c[0], c[1], c[2], 0);
- vmesa->dirty &= ~S3V_UPLOAD_FOG;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_DITHER) {
- vmesa->dirty &= ~S3V_UPLOAD_DITHER;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_LOGICOP) {
- vmesa->dirty &= ~S3V_UPLOAD_LOGICOP;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_CLIP) {
- vmesa->dirty &= ~S3V_UPLOAD_CLIP;
- DEBUG(("S3V_UPLOAD_CLIP\n"));
- DEBUG(("vmesa->ScissorLR: %i\n", vmesa->ScissorLR));
- DEBUG(("vmesa->ScissorTB: %i\n", vmesa->ScissorTB));
- }
-
- if (vmesa->dirty & S3V_UPLOAD_MASKS) {
- vmesa->dirty &= ~S3V_UPLOAD_MASKS;
- DEBUG(("S3V_UPLOAD_BLEND\n"));
- }
-
- if (vmesa->dirty & S3V_UPLOAD_ALPHA) {
- vmesa->dirty &= ~S3V_UPLOAD_ALPHA;
- DEBUG(("S3V_UPLOAD_ALPHA\n"));
- }
-
- if (vmesa->dirty & S3V_UPLOAD_SHADE) {
- vmesa->dirty &= ~S3V_UPLOAD_SHADE;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_POLYGON) {
- vmesa->dirty &= ~S3V_UPLOAD_POLYGON;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_DEPTH) {
- vmesa->dirty &= ~S3V_UPLOAD_DEPTH;
- DEBUG(("S3V_UPLOAD_DEPTH: DepthMode = 0x%x08\n", vmesa->DepthMode));
- }
-
- if (vmesa->dirty & S3V_UPLOAD_GEOMETRY) {
- vmesa->dirty &= ~S3V_UPLOAD_GEOMETRY;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_TRANSFORM) {
- vmesa->dirty &= ~S3V_UPLOAD_TRANSFORM;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_TEX0) {
- s3vTextureObjectPtr curTex = vmesa->CurrentTexObj[0];
- vmesa->dirty &= ~S3V_UPLOAD_TEX0;
- DEBUG(("S3V_UPLOAD_TEX0\n"));
- if (curTex) {
- DEBUG(("S3V_UPLOAD_TEX0: curTex\n"));
- } else {
- DEBUG(("S3V_UPLOAD_TEX0: !curTex\n"));
- }
- }
-}
-
-void s3vDDUpdateHWState( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- int new_state = vmesa->new_state;
-
- /* s3vUpdateClipping( ctx ); */
-
- if ( new_state )
- {
-
- vmesa->new_state = 0;
-
- /* Update the various parts of the context's state.
- */
- if ( new_state & S3V_NEW_ALPHA )
- s3vUpdateAlphaMode( ctx );
-
- if ( new_state & S3V_NEW_DEPTH )
- s3vUpdateZMode( ctx );
-
- if ( new_state & S3V_NEW_FOG )
- s3vUpdateFogAttrib( ctx );
-
- if ( new_state & S3V_NEW_CLIP )
- {
- DEBUG(("---> going to s3vUpdateClipping\n"));
- s3vUpdateClipping( ctx );
- }
-
- if ( new_state & S3V_NEW_POLYGON )
- s3vUpdatePolygon( ctx );
-
- if ( new_state & S3V_NEW_CULL )
- s3vUpdateCull( ctx );
-
- if ( new_state & S3V_NEW_MASKS )
- s3vUpdateMasks( ctx );
-
- if ( new_state & S3V_NEW_WINDOW )
- s3vUpdateWindow( ctx );
-/*
- if ( new_state & S3_NEW_TEXTURE )
- s3vUpdateTextureState( ctx );
-*/
- CMDCHANGE();
- }
-
- /* HACK ! */
- s3vEmitHwState( vmesa );
-}
-
-
-static void s3vDDUpdateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- S3V_CONTEXT(ctx)->new_gl_state |= new_state;
-}
-
-
-/* Initialize the context's hardware state.
- */
-void s3vInitState( s3vContextPtr vmesa )
-{
- vmesa->new_state = 0;
-}
-
-/* Initialize the driver's state functions.
- */
-void s3vInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = s3vDDUpdateState;
-
- ctx->Driver.Clear = s3vDDClear;
- ctx->Driver.ClearIndex = NULL;
- ctx->Driver.ClearColor = s3vDDClearColor;
- ctx->Driver.DrawBuffer = s3vDDSetDrawBuffer;
- ctx->Driver.ReadBuffer = NULL; /* XXX */
-
- ctx->Driver.IndexMask = NULL;
- ctx->Driver.ColorMask = NULL; /* s3vDDColorMask; */ /* FIXME */
-
- ctx->Driver.AlphaFunc = s3vDDAlphaFunc; /* FIXME */
-#if 0
- ctx->Driver.BlendEquation = NULL; /* s3vDDBlendEquation; */
- ctx->Driver.BlendFunc = s3vDDBlendFunc; /* FIXME */
-#endif
- ctx->Driver.BlendFuncSeparate = NULL; /* s3vDDBlendFuncSeparate; */
- ctx->Driver.ClearDepth = s3vDDClearDepth;
- ctx->Driver.CullFace = s3vDDCullFace;
- ctx->Driver.FrontFace = s3vDDFrontFace;
- ctx->Driver.DepthFunc = s3vDDDepthFunc; /* FIXME */
- ctx->Driver.DepthMask = s3vDDDepthMask; /* FIXME */
- ctx->Driver.DepthRange = NULL; /* s3vDDDepthRange; */
- ctx->Driver.Enable = s3vDDEnable; /* FIXME */
- ctx->Driver.Finish = s3vDDFinish;
- ctx->Driver.Flush = s3vDDFlush;
-#if 1
- ctx->Driver.Fogfv = NULL; /* s3vDDFogfv; */
-#endif
- ctx->Driver.Hint = NULL;
- ctx->Driver.LineWidth = NULL; /* s3vDDLineWidth; */
- ctx->Driver.LineStipple = NULL; /* s3vDDLineStipple; */
-#if ENABLELIGHTING
- ctx->Driver.Lightfv = NULL; /* s3vDDLightfv; */
-
- ctx->Driver.LightModelfv = NULL; /* s3vDDLightModelfv; */
-#endif
- ctx->Driver.LogicOpcode = NULL; /* s3vDDLogicalOpcode; */
- ctx->Driver.PointSize = NULL; /* s3vDDPointSize; */
- ctx->Driver.PolygonMode = NULL; /* s3vDDPolygonMode; */
- ctx->Driver.PolygonStipple = NULL; /* s3vDDPolygonStipple; */
- ctx->Driver.Scissor = s3vDDScissor; /* ScissorLR / ScissorTB */
- ctx->Driver.ShadeModel = NULL; /* s3vDDShadeModel; */
- ctx->Driver.Viewport = NULL; /* s3vDDViewport; */
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_tex.c b/src/mesa/drivers/dri/s3v/s3v_tex.c
deleted file mode 100644
index ec1182f34f7..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_tex.c
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/simple_list.h"
-#include "main/enums.h"
-#include "main/mm.h"
-#include "main/texstore.h"
-#include "main/texformat.h"
-#include "main/teximage.h"
-#include "swrast/swrast.h"
-
-#include "s3v_context.h"
-#include "s3v_tex.h"
-
-
-extern void s3vSwapOutTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t);
-extern void s3vDestroyTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t);
-
-/*
-static GLuint s3vComputeLodBias(GLfloat bias)
-{
-#if TEX_DEBUG_ON
- DEBUG_TEX(("*** s3vComputeLodBias ***\n"));
-#endif
- return bias;
-}
-*/
-
-static void s3vSetTexWrapping(s3vContextPtr vmesa,
- s3vTextureObjectPtr t,
- GLenum wraps, GLenum wrapt)
-{
- GLuint t0 = t->TextureCMD;
- GLuint cmd = vmesa->CMD;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vSetTexWrapping: #%i ***\n", ++times));
-#endif
-
-
- t0 &= ~TEX_WRAP_MASK;
- cmd &= ~TEX_WRAP_MASK;
-
- if ((wraps != GL_CLAMP) || (wrapt != GL_CLAMP)) {
- DEBUG(("TEX_WRAP_ON\n"));
- t0 |= TEX_WRAP_ON;
- cmd |= TEX_WRAP_ON;
- }
-
- cmd |= TEX_WRAP_ON; /* FIXME: broken if off */
- t->TextureCMD = t0;
- vmesa->CMD = cmd;
-}
-
-
-static void s3vSetTexFilter(s3vContextPtr vmesa,
- s3vTextureObjectPtr t,
- GLenum minf, GLenum magf)
-{
- GLuint t0 = t->TextureCMD;
- GLuint cmd = vmesa->CMD;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vSetTexFilter: #%i ***\n", ++times));
-#endif
-
- t0 &= ~TEX_FILTER_MASK;
- cmd &= ~TEX_FILTER_MASK;
-
- switch (minf) {
- case GL_NEAREST:
- DEBUG(("GL_NEAREST\n"));
- t0 |= NEAREST;
- cmd |= NEAREST;
- break;
- case GL_LINEAR:
- DEBUG(("GL_LINEAR\n"));
- t0 |= LINEAR;
- cmd |= LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- DEBUG(("GL_MIPMAP_NEAREST\n"));
- t0 |= MIP_NEAREST;
- cmd |= MIP_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- DEBUG(("GL_LINEAR_MIPMAP_NEAREST\n"));
- t0 |= LINEAR_MIP_NEAREST;
- cmd |= LINEAR_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- DEBUG(("GL_NEAREST_MIPMAP_LINEAR\n"));
- t0 |= MIP_LINEAR;
- cmd |= MIP_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- DEBUG(("GL_LINEAR_MIPMAP_LINEAR\n"));
- t0 |= LINEAR_MIP_LINEAR;
- cmd |= LINEAR_MIP_LINEAR;
- break;
- default:
- break;
- }
- /* FIXME: bilinear? */
-
-#if 0
- switch (magf) {
- case GL_NEAREST:
- break;
- case GL_LINEAR:
- break;
- default:
- break;
- }
-#endif
-
- t->TextureCMD = t0;
-
- DEBUG(("CMD was = 0x%x\n", vmesa->CMD));
- DEBUG(("CMD is = 0x%x\n", cmd));
-
- vmesa->CMD = cmd;
- /* CMDCHANGE(); */
-}
-
-
-static void s3vSetTexBorderColor(s3vContextPtr vmesa,
- s3vTextureObjectPtr t,
- const GLfloat color[4])
-{
- GLubyte c[4];
- CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vSetTexBorderColor: #%i ***\n", ++times));
-#endif
-
- /*FIXME: it should depend on tex col format */
- /* switch(t0 ... t->TextureColorMode) */
-
- /* case TEX_COL_ARGB1555: */
- t->TextureBorderColor = S3VIRGEPACKCOLOR555(c[0], c[1], c[2], c[3]);
-
- DEBUG(("TextureBorderColor = 0x%x\n", t->TextureBorderColor));
-
- vmesa->TextureBorderColor = t->TextureBorderColor;
-}
-
-static void s3vTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexParameter: #%i ***\n", ++times));
-#endif
-
- if (!t) return;
-
- /* Can't do the update now as we don't know whether to flush
- * vertices or not. Setting vmesa->new_state means that
- * s3vUpdateTextureState() will be called before any triangles are
- * rendered. If a statechange has occurred, it will be detected at
- * that point, and buffered vertices flushed.
- */
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- s3vSetTexFilter( vmesa, t, tObj->MinFilter, tObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- s3vSetTexWrapping( vmesa, t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- s3vSetTexBorderColor( vmesa, t, tObj->BorderColor );
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative for Virge. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- s3vSwapOutTexObj( vmesa, t );
- break;
-
- default:
- return;
- }
-
- if (t == vmesa->CurrentTexObj[0])
- vmesa->dirty |= S3V_UPLOAD_TEX0;
-
-#if 0
- if (t == vmesa->CurrentTexObj[1]) {
- vmesa->dirty |= S3V_UPLOAD_TEX1;
- }
-#endif
-}
-
-
-static void s3vTexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- GLuint unit = ctx->Texture.CurrentUnit;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexEnv: #%i ***\n", ++times));
-#endif
-
- /* Only one env color. Need a fallback if env colors are different
- * and texture setup references env color in both units.
- */
- switch (pname) {
- case GL_TEXTURE_ENV_COLOR: {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLfloat *fc = texUnit->EnvColor;
- GLuint r, g, b, a, col;
- CLAMPED_FLOAT_TO_UBYTE(r, fc[0]);
- CLAMPED_FLOAT_TO_UBYTE(g, fc[1]);
- CLAMPED_FLOAT_TO_UBYTE(b, fc[2]);
- CLAMPED_FLOAT_TO_UBYTE(a, fc[3]);
-
- col = ((a << 24) |
- (r << 16) |
- (g << 8) |
- (b << 0));
-
- break;
- }
- case GL_TEXTURE_ENV_MODE:
- vmesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */
- break;
- case GL_TEXTURE_LOD_BIAS_EXT: {
-/*
- struct gl_texture_object *tObj =
- ctx->Texture.Unit[unit]._Current;
-
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData;
-*/
- break;
- }
- default:
- break;
- }
-}
-
-static void s3vTexImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *pack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexImage1D: #%i ***\n", ++times));
-#endif
-
-#if 1
- if (t) {
-#if _TEXFLUSH
- DMAFLUSH();
-#endif
- s3vSwapOutTexObj( vmesa, t );
-/*
- s3vDestroyTexObj( vmesa, t );
- texObj->DriverData = 0;
-*/
- }
-#endif
- _mesa_store_teximage1d( ctx, target, level, internalFormat,
- width, border, format, type,
- pixels, pack, texObj, texImage );
-}
-
-static void s3vTexSubImage1D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *pack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexSubImage1D: #%i ***\n", ++times));
-#endif
-
-#if 1
- if (t) {
-#if _TEXFLUSH
- DMAFLUSH();
-#endif
- s3vSwapOutTexObj( vmesa, t );
-/*
- s3vDestroyTexObj( vmesa, t );
- texObj->DriverData = 0;
-*/
- }
-#endif
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, pack, texObj,
- texImage);
-}
-
-static void s3vTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData;
-
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexImage2D: #%i ***\n", ++times));
-#endif
-
-#if 1
- if (t) {
-#if _TEXFLUSH
- DMAFLUSH();
-#endif
- s3vSwapOutTexObj( vmesa, t );
-/*
- s3vDestroyTexObj( vmesa, t );
- texObj->DriverData = 0;
-*/
- }
-#endif
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
-}
-
-static void s3vTexSubImage2D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexSubImage2D: #%i ***\n", ++times));
-#endif
-
-#if 1
- if (t) {
-#if _TEXFLUSH
- DMAFLUSH();
-#endif
- s3vSwapOutTexObj( vmesa, t );
-/*
- s3vDestroyTexObj( vmesa, t );
- texObj->DriverData = 0;
-*/
- }
-#endif
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-}
-
-
-static void s3vBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData;
- GLuint cmd = vmesa->CMD;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vBindTexture: #%i ***\n", ++times));
-#endif
-
- if (!t) {
-/*
- GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias;
-*/
- t = CALLOC_STRUCT(s3v_texture_object_t);
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->globj = tObj;
-#if 0
- if (target == GL_TEXTURE_2D) {
- } else
- if (target == GL_TEXTURE_1D) {
- }
-
-#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- t->TextureFormat = (TF_LittleEndian |
-#else
- t->TextureFormat = (TF_BigEndian |
-#endif
-#endif
- t->dirty_images = ~0;
-
- tObj->DriverData = t;
- make_empty_list( t );
-#if 0
- s3vSetTexWrapping( vmesa, t, tObj->WrapS, tObj->WrapT );
- s3vSetTexFilter( vmesa, t, tObj->MinFilter, tObj->MagFilter );
- s3vSetTexBorderColor( vmesa, t, tObj->BorderColor );
-#endif
- }
-
- cmd = vmesa->CMD & ~MIP_MASK;
- vmesa->dirty |= S3V_UPLOAD_TEX0;
- vmesa->TexOffset = t->TextureBaseAddr[tObj->BaseLevel];
- vmesa->TexStride = t->Pitch;
- cmd |= MIPMAP_LEVEL(t->WidthLog2);
- vmesa->CMD = cmd;
- vmesa->restore_primitive = -1;
-#if 0
- printf("t->TextureBaseAddr[0] = 0x%x\n", t->TextureBaseAddr[0]);
- printf("t->TextureBaseAddr[1] = 0x%x\n", t->TextureBaseAddr[1]);
- printf("t->TextureBaseAddr[2] = 0x%x\n", t->TextureBaseAddr[2]);
-#endif
-}
-
-
-static void s3vDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vDeleteTexture: #%i ***\n", ++times));
-#endif
-
- if (t) {
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
-
-#if _TEXFLUSH
- if (vmesa) {
- DMAFLUSH();
- }
-#endif
-
- s3vDestroyTexObj( vmesa, t );
- tObj->DriverData = 0;
-
- }
-}
-
-static GLboolean s3vIsTextureResident( GLcontext *ctx,
- struct gl_texture_object *tObj )
-{
- s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vIsTextureResident: #%i ***\n", ++times));
-#endif
-
- return (t && t->MemBlock);
-}
-
-static void s3vInitTextureObjects( GLcontext *ctx )
-{
- /* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */
- struct gl_texture_object *texObj;
- GLuint tmp = ctx->Texture.CurrentUnit;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vInitTextureObjects: #%i ***\n", ++times));
-#endif
-
-#if 1
- ctx->Texture.CurrentUnit = 0;
-
- texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_1D_INDEX];
- s3vBindTexture( ctx, GL_TEXTURE_1D, texObj );
-
- texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];
- s3vBindTexture( ctx, GL_TEXTURE_2D, texObj );
-#endif
-
-#if 0
- ctx->Texture.CurrentUnit = 1;
-
- texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_1D_INDEX];
- s3vBindTexture( ctx, GL_TEXTURE_1D, texObj );
-
- texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_2D_INDEX];
- s3vBindTexture( ctx, GL_TEXTURE_2D, texObj );
-#endif
-
- ctx->Texture.CurrentUnit = tmp;
-}
-
-
-void s3vInitTextureFuncs( GLcontext *ctx )
-{
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vInitTextureFuncs: #%i ***\n", ++times));
-#endif
-
- ctx->Driver.TexEnv = s3vTexEnv;
- ctx->Driver.TexImage2D = s3vTexImage2D;
- ctx->Driver.TexSubImage2D = s3vTexSubImage2D;
- ctx->Driver.BindTexture = s3vBindTexture;
- ctx->Driver.DeleteTexture = s3vDeleteTexture;
- ctx->Driver.TexParameter = s3vTexParameter;
- ctx->Driver.UpdateTexturePalette = 0;
- ctx->Driver.IsTextureResident = s3vIsTextureResident;
-
- s3vInitTextureObjects( ctx );
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_tex.h b/src/mesa/drivers/dri/s3v/s3v_tex.h
deleted file mode 100644
index a823fe24531..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_tex.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_TEX_H
-#define _S3V_TEX_H
-
-#define TEX_DEBUG_ON 0
-
-extern void s3vUpdateTexLRU( s3vContextPtr vmesa, s3vTextureObjectPtr t );
-
-#if TEX_DEBUG_ON
-#define DEBUG_TEX(str) printf str
-#else
-#define DEBUG_TEX(str) /* str */
-#endif
-
-#define _TEXFLUSH 1 /* flush before uploading */
-#define _TEXLOCK 1 /* lock before writing new texures to card mem */
- /* if you turn it on you will gain stability and image
- quality, but you will loose performance (~10%) */
-#define _TEXFALLBACK 0 /* fallback to software for -big- textures (slow) */
- /* turning this off, you will lose some tex (e.g. mountains
- on tuxracer) but you will increase average playability */
-
-#define _TEXALIGN 0x00000007
-
-#endif
diff --git a/src/mesa/drivers/dri/s3v/s3v_texmem.c b/src/mesa/drivers/dri/s3v/s3v_texmem.c
deleted file mode 100644
index 705d105f55f..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_texmem.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "main/glheader.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-#include "main/simple_list.h"
-#include "main/enums.h"
-
-#include "main/mm.h"
-#include "s3v_context.h"
-#include "s3v_lock.h"
-#include "s3v_tex.h"
-
-void s3vSwapOutTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t);
-void s3vUpdateTexLRU( s3vContextPtr vmesa, s3vTextureObjectPtr t );
-
-
-void s3vDestroyTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t)
-{
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vDestroyTexObj: #%i ***\n", ++times));
-#endif
-
- if (!t) return;
-
-/* FIXME: useful? */
-#if _TEXFLUSH
- if (vmesa)
- DMAFLUSH();
-#endif
-
- /* This is sad - need to sync *in case* we upload a texture
- * to this newly free memory...
- */
- if (t->MemBlock) {
- mmFreeMem(t->MemBlock);
- t->MemBlock = 0;
-
- if (vmesa && t->age > vmesa->dirtyAge)
- vmesa->dirtyAge = t->age;
- }
-
- if (t->globj)
- t->globj->DriverData = NULL;
-
- if (vmesa) {
- if (vmesa->CurrentTexObj[0] == t) {
- vmesa->CurrentTexObj[0] = 0;
- vmesa->dirty &= ~S3V_UPLOAD_TEX0;
- }
-
-#if 0
- if (vmesa->CurrentTexObj[1] == t) {
- vmesa->CurrentTexObj[1] = 0;
- vmesa->dirty &= ~S3V_UPLOAD_TEX1;
- }
-#endif
- }
-
- remove_from_list(t);
- FREE(t);
-}
-
-
-void s3vSwapOutTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t)
-{
-/* int i; */
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vSwapOutTexObj: #%i ***\n", ++times));
-#endif
-
- if (t->MemBlock) {
-
- mmFreeMem(t->MemBlock);
- t->MemBlock = 0;
-
- if (t->age > vmesa->dirtyAge)
- vmesa->dirtyAge = t->age;
-
- t->dirty_images = ~0;
- move_to_tail(&(vmesa->SwappedOut), t);
- }
-}
-
-
-/* Upload an image from mesa's internal copy.
- */
-
-static void s3vUploadTexLevel( s3vContextPtr vmesa, s3vTextureObjectPtr t,
- int level )
-{
- __DRIscreenPrivate *sPriv = vmesa->driScreen;
- const struct gl_texture_image *image = t->image[level].image;
- int i,j;
- int l2d;
- /* int offset = 0; */
- int words;
- GLuint* dest;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
-#endif
- if ( !image ) return;
- if (image->Data == 0) return;
-
- DEBUG_TEX(("*** s3vUploadTexLevel: #%i ***\n", ++times));
- DEBUG_TEX(("level = %i\n", level));
-
- l2d = 5; /* 32bits per texel == 1<<5 */
-/*
- if (level == 0)
- ;
-*/
- DEBUG_TEX(("t->image[%i].offset = 0x%x\n",
- level, t->image[level].offset));
-
- t->TextureBaseAddr[level] = (GLuint)(t->BufAddr + t->image[level].offset
- + _TEXALIGN) & (GLuint)(~_TEXALIGN);
- dest = (GLuint*)(sPriv->pFB + t->TextureBaseAddr[level]);
-
- DEBUG_TEX(("sPriv->pFB = 0x%x\n", sPriv->pFB));
- DEBUG_TEX(("dest = 0x%x\n", dest));
- DEBUG_TEX(("dest - sPriv->pFB = 0x%x\n", ((int)dest - (int)sPriv->pFB)));
-
- /* NOTE: we implicitly suppose t->texelBytes == 2 */
-
- words = (image->Width * image->Height) >> 1;
-
- DEBUG_TEX(("\n\n"));
-
- switch (t->image[level].internalFormat) {
- case GL_RGB:
- case 3:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_RGB:\n"));
-/*
- if (level == 0)
- ;
-*/
- /* The UGLY way, and SLOW : use DMA FIXME ! */
-
- for (i = 0; i < words; i++) {
- unsigned int data;
- /* data = PACK_COLOR_565(src[0],src[1],src[2]); */
- data = S3VIRGEPACKCOLOR555(src[0],src[1],src[2],255)
- |(S3VIRGEPACKCOLOR555(src[3],src[4],src[5],255)<<16);
-
- *dest++ = data;
- /* src += 3; */
- src +=6;
- }
- }
- break;
-
- case GL_RGBA:
- case 4:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_RGBA:\n"));
-/*
- if (level == 0)
- ;
-*/
- for (i = 0; i < words; i++) {
- unsigned int data;
-
- /* data = PACK_COLOR_8888(src[0],src[1],src[2],src[3]); */
- data = S3VIRGEPACKCOLOR4444(src[0], src[1],src[2], src[3])
- | (S3VIRGEPACKCOLOR4444(src[4], src[5], src[6], src[7]) << 16);
-
- *dest++ = data;
- /* src += 4; */
- src += 8;
- }
- }
- break;
-
- case GL_LUMINANCE:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_LUMINANCE:\n"));
-/*
- if (level == 0)
- ;
-*/
- for (i = 0; i < words; i++) {
- unsigned int data;
-
- /* data = PACK_COLOR_888(src[0],src[0],src[0]); */
- data = S3VIRGEPACKCOLOR4444(src[0],src[0],src[0],src[0])
- | (S3VIRGEPACKCOLOR4444(src[1],src[1],src[1],src[1]) << 16);
-
- *dest++ = data;
- /* src ++; */
- src +=2;
- }
- }
- break;
-
- case GL_INTENSITY:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_INTENSITY:\n"));
-/*
- if (level == 0)
- ;
-*/
- for (i = 0; i < words; i++) {
- unsigned int data;
-
- /* data = PACK_COLOR_8888(src[0],src[0],src[0],src[0]); */
- data = S3VIRGEPACKCOLOR4444(src[0],src[0],src[0],src[0])
- | (S3VIRGEPACKCOLOR4444(src[1],src[1],src[1],src[1]) << 16);
-
- *dest++ = data;
- /* src ++; */
- src += 2;
- }
- }
- break;
-
- case GL_LUMINANCE_ALPHA:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_LUMINANCE_ALPHA:\n"));
-/*
- if (level == 0)
- ;
-*/
- for (i = 0; i < words; i++) {
- unsigned int data;
-
- /* data = PACK_COLOR_8888(src[0],src[0],src[0],src[1]); */
- data = S3VIRGEPACKCOLOR4444(src[0],src[0],src[0],src[1])
- | (S3VIRGEPACKCOLOR4444(src[2],src[2],src[2],src[3]) << 16);
-
- *dest++ = data;
- /* src += 2; */
- src += 4;
- }
- }
- break;
-
- case GL_ALPHA:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_ALPHA:\n"));
-/*
- if (level == 0)
- ;
-*/
- for (i = 0; i < words; i++) {
- unsigned int data;
-
- /* data = PACK_COLOR_8888(255,255,255,src[0]); */
- data = S3VIRGEPACKCOLOR4444(255,255,255,src[0])
- | (S3VIRGEPACKCOLOR4444(255,255,255,src[1]) << 16);
-
- *dest++ = data;
- /* src += 1; */
- src += 2;
- }
- }
- break;
-
- /* TODO: Translate color indices *now*:
- */
- case GL_COLOR_INDEX:
- {
-
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[level].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_COLOR_INDEX:\n"));
-
- for (j = 0 ; j < image->Height ; j++, dst += t->Pitch) {
- for (i = 0 ; i < image->Width ; i++) {
- dst[i] = src[0];
- src += 1;
- }
- }
- }
- break;
-
- default:
- fprintf(stderr, "Not supported texture format %s\n",
- _mesa_lookup_enum_by_nr(image->_BaseFormat));
- }
-
- DEBUG_TEX(("words = %i\n\n", words));
-}
-
-void s3vPrintLocalLRU( s3vContextPtr vmesa )
-{
- s3vTextureObjectPtr t;
- int sz = 1 << (vmesa->s3vScreen->logTextureGranularity);
-
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vPrintLocalLRU: #%i ***\n", ++times));
-#endif
-
- foreach( t, &vmesa->TexObjList ) {
- if (!t->globj)
- fprintf(stderr, "Placeholder %d at %x sz %x\n",
- t->MemBlock->ofs / sz,
- t->MemBlock->ofs,
- t->MemBlock->size);
- else
- fprintf(stderr, "Texture at %x sz %x\n",
- t->MemBlock->ofs,
- t->MemBlock->size);
-
- }
-}
-
-void s3vPrintGlobalLRU( s3vContextPtr vmesa )
-{
- int i, j;
- S3VTexRegionPtr list = vmesa->sarea->texList;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vPrintGlobalLRU: #%i ***\n", ++times));
-#endif
-
- for (i = 0, j = S3V_NR_TEX_REGIONS ; i < S3V_NR_TEX_REGIONS ; i++) {
- fprintf(stderr, "list[%d] age %d next %d prev %d\n",
- j, list[j].age, list[j].next, list[j].prev);
- j = list[j].next;
- if (j == S3V_NR_TEX_REGIONS) break;
- }
-
- if (j != S3V_NR_TEX_REGIONS)
- fprintf(stderr, "Loop detected in global LRU\n");
-}
-
-
-void s3vResetGlobalLRU( s3vContextPtr vmesa )
-{
- S3VTexRegionPtr list = vmesa->sarea->texList;
- int sz = 1 << vmesa->s3vScreen->logTextureGranularity;
- int i;
-
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vResetGlobalLRU: #%i ***\n", ++times));
-#endif
-
- /* (Re)initialize the global circular LRU list. The last element
- * in the array (S3V_NR_TEX_REGIONS) is the sentinal. Keeping it
- * at the end of the array allows it to be addressed rationally
- * when looking up objects at a particular location in texture
- * memory.
- */
- for (i = 0 ; (i+1) * sz <= vmesa->s3vScreen->textureSize ; i++) {
- list[i].prev = i-1;
- list[i].next = i+1;
- list[i].age = 0;
- }
-
- i--;
- list[0].prev = S3V_NR_TEX_REGIONS;
- list[i].prev = i-1;
- list[i].next = S3V_NR_TEX_REGIONS;
- list[S3V_NR_TEX_REGIONS].prev = i;
- list[S3V_NR_TEX_REGIONS].next = 0;
- vmesa->sarea->texAge = 0;
-}
-
-
-void s3vUpdateTexLRU( s3vContextPtr vmesa, s3vTextureObjectPtr t )
-{
-/*
- int i;
- int logsz = vmesa->s3vScreen->logTextureGranularity;
- int start = t->MemBlock->ofs >> logsz;
- int end = (t->MemBlock->ofs + t->MemBlock->size - 1) >> logsz;
- S3VTexRegionPtr list = vmesa->sarea->texList;
-*/
-
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vUpdateTexLRU: #%i ***\n", ++times));
-#endif
-
- vmesa->texAge = ++vmesa->sarea->texAge;
-
- /* Update our local LRU
- */
- move_to_head( &(vmesa->TexObjList), t );
-
- /* Update the global LRU
- */
-#if 0
- for (i = start ; i <= end ; i++) {
-
- list[i].in_use = 1;
- list[i].age = vmesa->texAge;
-
- /* remove_from_list(i)
- */
- list[(unsigned)list[i].next].prev = list[i].prev;
- list[(unsigned)list[i].prev].next = list[i].next;
-
- /* insert_at_head(list, i)
- */
- list[i].prev = S3V_NR_TEX_REGIONS;
- list[i].next = list[S3V_NR_TEX_REGIONS].next;
- list[(unsigned)list[S3V_NR_TEX_REGIONS].next].prev = i;
- list[S3V_NR_TEX_REGIONS].next = i;
- }
-#endif
-}
-
-
-/* Called for every shared texture region which has increased in age
- * since we last held the lock.
- *
- * Figures out which of our textures have been ejected by other clients,
- * and pushes a placeholder texture onto the LRU list to represent
- * the other client's textures.
- */
-void s3vTexturesGone( s3vContextPtr vmesa,
- GLuint offset,
- GLuint size,
- GLuint in_use )
-{
- s3vTextureObjectPtr t, tmp;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexturesGone: #%i ***\n", ++times));
-#endif
-
- foreach_s ( t, tmp, &vmesa->TexObjList ) {
-
- if (t->MemBlock->ofs >= offset + size ||
- t->MemBlock->ofs + t->MemBlock->size <= offset)
- continue;
-
- /* It overlaps - kick it off. Need to hold onto the currently bound
- * objects, however.
- */
- s3vSwapOutTexObj( vmesa, t );
- }
-
- if (in_use) {
- t = (s3vTextureObjectPtr) calloc(1,sizeof(*t));
- if (!t) return;
-
- t->MemBlock = mmAllocMem( vmesa->texHeap, size, 0, offset);
- insert_at_head( &vmesa->TexObjList, t );
- }
-
- /* Reload any lost textures referenced by current vertex buffer.
- */
-#if 0
- if (vmesa->vertex_buffer) {
- int i, j;
-
- fprintf(stderr, "\n\nreload tex\n");
-
- for (i = 0 ; i < vmesa->statenr ; i++) {
- for (j = 0 ; j < 2 ; j++) {
- s3vTextureObjectPtr t = vmesa->state_tex[j][i];
- if (t) {
- if (t->MemBlock == 0)
- s3vUploadTexImages( vmesa, t );
- }
- }
- }
-
- /* Hard to do this with the lock held:
- */
- /* S3V_FIREVERTICES( vmesa ); */
- }
-#endif
-}
-
-
-/* This is called with the lock held. May have to eject our own and/or
- * other client's texture objects to make room for the upload.
- */
-void s3vUploadTexImages( s3vContextPtr vmesa, s3vTextureObjectPtr t )
-{
- int i;
- int ofs;
- int numLevels;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- static unsigned int try=0;
-
- DEBUG_TEX(("*** s3vUploadTexImages: #%i ***\n", ++times));
- DEBUG_TEX(("vmesa->texHeap = 0x%x; t->totalSize = %i\n",
- (unsigned int)vmesa->texHeap, t->totalSize));
-#endif
-
- /* Do we need to eject LRU texture objects?
- */
- if (!t->MemBlock) {
-
- while (1)
- {
- /* int try = 0; */
- DEBUG_TEX(("trying to alloc mem for tex (try %i)\n", ++try));
-
- t->MemBlock = mmAllocMem( vmesa->texHeap, t->totalSize, 12, 0 );
-
- if (t->MemBlock)
- break;
-
- if (vmesa->TexObjList.prev == vmesa->CurrentTexObj[0]) {
-/* || vmesa->TexObjList.prev == vmesa->CurrentTexObj[1]) {
- fprintf(stderr, "Hit bound texture in upload\n");
- s3vPrintLocalLRU( vmesa ); */
- return;
- }
-
- if (vmesa->TexObjList.prev == &(vmesa->TexObjList)) {
-/* fprintf(stderr, "Failed to upload texture, sz %d\n",
- t->totalSize);
- mmDumpMemInfo( vmesa->texHeap ); */
- return;
- }
-
- DEBUG_TEX(("swapping out: %p\n", vmesa->TexObjList.prev));
- s3vSwapOutTexObj( vmesa, vmesa->TexObjList.prev );
- }
-
- ofs = t->MemBlock->ofs;
-
- t->BufAddr = vmesa->s3vScreen->texOffset + ofs;
-
- DEBUG_TEX(("ofs = 0x%x\n", ofs));
- DEBUG_TEX(("t->BufAddr = 0x%x\n", t->BufAddr));
-
-/* FIXME: check if we need it */
-#if 0
- if (t == vmesa->CurrentTexObj[0]) {
- vmesa->dirty |= S3V_UPLOAD_TEX0;
- vmesa->restore_primitive = -1;
- }
-#endif
-
-#if 0
- if (t == vmesa->CurrentTexObj[1])
- vmesa->dirty |= S3V_UPLOAD_TEX1;
-#endif
-
- s3vUpdateTexLRU( vmesa, t );
- }
-
-#if 0
- if (vmesa->dirtyAge >= GET_DISPATCH_AGE(vmesa))
- s3vWaitAgeLocked( vmesa, vmesa->dirtyAge );
-#endif
-
-#if _TEXLOCK
- S3V_SIMPLE_FLUSH_LOCK(vmesa);
-#endif
- numLevels = t->lastLevel - t->firstLevel + 1;
- for (i = 0 ; i < numLevels ; i++)
- if (t->dirty_images & (1<<i))
- s3vUploadTexLevel( vmesa, t, i );
-
- t->dirty_images = 0;
-#if _TEXLOCK
- S3V_SIMPLE_UNLOCK(vmesa);
-#endif
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_texstate.c b/src/mesa/drivers/dri/s3v/s3v_texstate.c
deleted file mode 100644
index 455bae6301d..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_texstate.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "main/glheader.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-#include "main/simple_list.h"
-#include "main/enums.h"
-
-#include "main/mm.h"
-#include "s3v_context.h"
-#include "s3v_tex.h"
-
-
-static void s3vSetTexImages( s3vContextPtr vmesa,
- struct gl_texture_object *tObj )
-{
- GLuint height, width, pitch, i, /*textureFormat,*/ log_pitch;
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- GLint firstLevel, lastLevel, numLevels;
- GLint log2Width, log2Height;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vSetTexImages: #%i ***\n", ++times));
-#endif
-
- t->texelBytes = 2; /* FIXME: always 2 ? */
-
- /* Compute which mipmap levels we really want to send to the hardware.
- * This depends on the base image size, GL_TEXTURE_MIN_LOD,
- * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL.
- * Yes, this looks overly complicated, but it's all needed.
- */
- if (tObj->MinFilter == GL_LINEAR || tObj->MinFilter == GL_NEAREST) {
- firstLevel = lastLevel = tObj->BaseLevel;
- }
- else {
- firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5);
- firstLevel = MAX2(firstLevel, tObj->BaseLevel);
- lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5);
- lastLevel = MAX2(lastLevel, tObj->BaseLevel);
- lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2);
- lastLevel = MIN2(lastLevel, tObj->MaxLevel);
- lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
- }
-
- /* save these values */
- t->firstLevel = firstLevel;
- t->lastLevel = lastLevel;
-
- numLevels = lastLevel - firstLevel + 1;
-
- log2Width = tObj->Image[0][firstLevel]->WidthLog2;
- log2Height = tObj->Image[0][firstLevel]->HeightLog2;
-
-
- /* Figure out the amount of memory required to hold all the mipmap
- * levels. Choose the smallest pitch to accomodate the largest
- * mipmap:
- */
- width = tObj->Image[0][firstLevel]->Width * t->texelBytes;
- for (pitch = 32, log_pitch=2 ; pitch < width ; pitch *= 2 )
- log_pitch++;
-
- /* All images must be loaded at this pitch. Count the number of
- * lines required:
- */
- for ( height = i = 0 ; i < numLevels ; i++ ) {
- t->image[i].image = tObj->Image[0][firstLevel + i];
- t->image[i].offset = height * pitch;
- t->image[i].internalFormat = baseImage->_BaseFormat;
- height += t->image[i].image->Height;
- t->TextureBaseAddr[i] = (t->BufAddr + t->image[i].offset +
- _TEXALIGN) & (GLuint)(~_TEXALIGN);
- }
-
- t->Pitch = pitch;
- t->WidthLog2 = log2Width;
- t->totalSize = height*pitch;
- t->max_level = i-1;
- vmesa->dirty |= S3V_UPLOAD_TEX0 /* | S3V_UPLOAD_TEX1*/;
- vmesa->restore_primitive = -1;
- DEBUG(("<><>pitch = TexStride = %i\n", pitch));
- DEBUG(("log2Width = %i\n", log2Width));
-
- s3vUploadTexImages( vmesa, t );
-}
-
-static void s3vUpdateTexEnv( GLcontext *ctx, GLuint unit )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = texUnit->_Current;
- const GLuint format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat;
-/*
- s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData;
- GLuint tc;
-*/
- GLuint alpha = 0;
- GLuint cmd = vmesa->CMD;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vUpdateTexEnv: %i ***\n", ++times));
-#endif
-
- cmd &= ~TEX_COL_MASK;
- cmd &= ~TEX_BLEND_MAKS;
-/* cmd &= ~ALPHA_BLEND_MASK; */
-
- DEBUG(("format = "));
-
- switch (format) {
- case GL_RGB:
- DEBUG_TEX(("GL_RGB\n"));
- cmd |= TEX_COL_ARGB1555;
- break;
- case GL_LUMINANCE:
- DEBUG_TEX(("GL_LUMINANCE\n"));
- cmd |= TEX_COL_ARGB4444;
- alpha = 1; /* FIXME: check */
- break;
- case GL_ALPHA:
- DEBUG_TEX(("GL_ALPHA\n"));
- cmd |= TEX_COL_ARGB4444;
- alpha = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- DEBUG_TEX(("GL_LUMINANCE_ALPHA\n"));
- cmd |= TEX_COL_ARGB4444;
- alpha = 1;
- break;
- case GL_INTENSITY:
- DEBUG_TEX(("GL_INTENSITY\n"));
- cmd |= TEX_COL_ARGB4444;
- alpha = 1;
- break;
- case GL_RGBA:
- DEBUG_TEX(("GL_RGBA\n"));
- cmd |= TEX_COL_ARGB4444;
- alpha = 1;
- break;
- case GL_COLOR_INDEX:
- DEBUG_TEX(("GL_COLOR_INDEX\n"));
- cmd |= TEX_COL_PAL;
- break;
- }
-
- DEBUG_TEX(("EnvMode = "));
-
- switch (texUnit->EnvMode) {
- case GL_REPLACE:
- DEBUG_TEX(("GL_REPLACE\n"));
- cmd |= TEX_REFLECT; /* FIXME */
- vmesa->_tri[1] = DO_TEX_UNLIT_TRI; /* FIXME: white tri hack */
- vmesa->_alpha_tex = ALPHA_TEX /* * alpha */;
- break;
- case GL_MODULATE:
- DEBUG_TEX(("GL_MODULATE\n"));
- cmd |= TEX_MODULATE;
- vmesa->_tri[1] = DO_TEX_LIT_TRI;
-#if 0
- if (alpha)
- vmesa->_alpha_tex = ALPHA_TEX /* * alpha */;
- else
- vmesa->_alpha_tex = ALPHA_SRC /* * alpha */;
-#else
- vmesa->_alpha_tex = ALPHA_TEX ;
-#endif
- break;
- case GL_ADD:
- DEBUG_TEX(("DEBUG_TEX\n"));
- /* do nothing ???*/
- break;
- case GL_DECAL:
- DEBUG_TEX(("GL_DECAL\n"));
- cmd |= TEX_DECAL;
- vmesa->_tri[1] = DO_TEX_LIT_TRI;
- vmesa->_alpha_tex = ALPHA_OFF;
- break;
- case GL_BLEND:
- DEBUG_TEX(("GL_BLEND\n"));
- cmd |= TEX_DECAL;
- vmesa->_tri[1] = DO_TEX_LIT_TRI;
- vmesa->_alpha_tex = ALPHA_OFF; /* FIXME: sure? */
- break;
- default:
- fprintf(stderr, "unknown tex env mode");
- return;
- }
-
- DEBUG_TEX(("\n\n vmesa->CMD was 0x%x\n", vmesa->CMD));
- DEBUG_TEX(( " vmesa->CMD is 0x%x\n\n", cmd ));
-
- vmesa->_alpha[1] = vmesa->_alpha_tex;
- vmesa->CMD = cmd; /* | MIPMAP_LEVEL(8); */
- vmesa->restore_primitive = -1;
-}
-
-static void s3vUpdateTexUnit( GLcontext *ctx, GLuint unit )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint cmd = vmesa->CMD;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vUpdateTexUnit: %i ***\n", ++times));
- DEBUG_TEX(("and vmesa->CMD was 0x%x\n", vmesa->CMD));
-#endif
-
- if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT)
- {
- struct gl_texture_object *tObj = texUnit->_Current;
- s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData;
-
- /* Upload teximages (not pipelined)
- */
- if (t->dirty_images) {
-#if _TEXFLUSH
- DMAFLUSH();
-#endif
- s3vSetTexImages( vmesa, tObj );
- if (!t->MemBlock) {
-#if _TEXFALLBACK
- FALLBACK( vmesa, S3V_FALLBACK_TEXTURE, GL_TRUE );
-#endif
- return;
- }
- }
-
- /* Update state if this is a different texture object to last
- * time.
- */
-#if 1
- if (vmesa->CurrentTexObj[unit] != t) {
- vmesa->dirty |= S3V_UPLOAD_TEX0 /* << unit */;
- vmesa->CurrentTexObj[unit] = t;
- s3vUpdateTexLRU( vmesa, t ); /* done too often */
- }
-#endif
-
- /* Update texture environment if texture object image format or
- * texture environment state has changed.
- */
- if (tObj->Image[0][tObj->BaseLevel]->_BaseFormat !=
- vmesa->TexEnvImageFmt[unit]) {
- vmesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->_BaseFormat;
- s3vUpdateTexEnv( ctx, unit );
- }
-#if 1
- cmd = vmesa->CMD & ~MIP_MASK;
- vmesa->dirty |= S3V_UPLOAD_TEX0 /* << unit */;
- vmesa->CurrentTexObj[unit] = t;
- vmesa->TexOffset = t->TextureBaseAddr[tObj->BaseLevel];
- vmesa->TexStride = t->Pitch;
- cmd |= MIPMAP_LEVEL(t->WidthLog2);
-
- DEBUG_TEX(("\n\n>> vmesa->CMD was 0x%x\n", vmesa->CMD));
- DEBUG_TEX(( ">> vmesa->CMD is 0x%x\n\n", cmd ));
- DEBUG_TEX(("t->WidthLog2 = %i\n", t->WidthLog2));
- DEBUG_TEX(("MIPMAP_LEVEL(t->WidthLog2) = 0x%x\n", MIPMAP_LEVEL(t->WidthLog2)));
-
- vmesa->CMD = cmd;
- vmesa->restore_primitive = -1;
-#endif
- }
- else if (texUnit->_ReallyEnabled) { /* _ReallyEnabled but != TEXTURE0_2D */
-#if _TEXFALLBACK
- FALLBACK( vmesa, S3V_FALLBACK_TEXTURE, GL_TRUE );
-#endif
- }
- else /*if (vmesa->CurrentTexObj[unit])*/ { /* !_ReallyEnabled */
- vmesa->CurrentTexObj[unit] = 0;
- vmesa->TexEnvImageFmt[unit] = 0;
- vmesa->dirty &= ~(S3V_UPLOAD_TEX0<<unit);
- }
-}
-
-
-void s3vUpdateTextureState( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- (void) vmesa;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vUpdateTextureState: #%i ***\n", ++times));
-#endif
-
-#if _TEXFALLBACK
- FALLBACK( vmesa, S3V_FALLBACK_TEXTURE, GL_FALSE );
-#endif
- s3vUpdateTexUnit( ctx, 0 );
-#if 0
- s3vUpdateTexUnit( ctx, 1 );
-#endif
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_tris.c b/src/mesa/drivers/dri/s3v/s3v_tris.c
deleted file mode 100644
index fafd38480c9..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_tris.c
+++ /dev/null
@@ -1,850 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <sys/ioctl.h>
-
-#include "s3v_context.h"
-#include "s3v_vb.h"
-#include "s3v_tris.h"
-
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/macros.h"
-#include "main/colormac.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-
-/***********************************************************************
- * Build hardware rasterization functions *
- ***********************************************************************/
-
-#define DO_TRI 1
-#define HAVE_RGBA 1
-#define HAVE_SPEC 0
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX s3vVertex
-#define TAB rast_tab
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- UNCLAMPED_FLOAT_TO_RGBA_CHAN( v->ub4[4], c); \
-/* *(v->ub4[4]) = c; \ */ \
-} while (0)
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[4] = v1->ui[4]
-/*
-#define VERT_COPY_RGBA1( v0, v1 ) v0->ui[4] = v1->ui[4]
-*/
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[4]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[4] = color[idx]
-
-#define S3V_OFFSET_BIT 0x01
-#define S3V_TWOSIDE_BIT 0x02
-#define S3V_UNFILLED_BIT 0x04
-#define S3V_FALLBACK_BIT 0x08
-#define S3V_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[S3V_MAX_TRIFUNC];
-
-#define S3V_RAST_CULL_BIT 0x01
-#define S3V_RAST_FLAT_BIT 0x02
-#define S3V_RAST_TEX_BIT 0x04
-
-static s3v_point_func s3v_point_tab[0x8];
-static s3v_line_func s3v_line_tab[0x8];
-static s3v_tri_func s3v_tri_tab[0x8];
-static s3v_quad_func s3v_quad_tab[0x8];
-
-#define IND (0)
-#define TAG(x) x
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_CULL_BIT)
-#define TAG(x) x##_cull
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_CULL_BIT|S3V_RAST_FLAT_BIT)
-#define TAG(x) x##_cull_flat
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_TEX_BIT)
-#define TAG(x) x##_tex
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_CULL_BIT|S3V_RAST_TEX_BIT)
-#define TAG(x) x##_cull_tex
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_FLAT_BIT|S3V_RAST_TEX_BIT)
-#define TAG(x) x##_flat_tex
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_CULL_BIT|S3V_RAST_FLAT_BIT|S3V_RAST_TEX_BIT)
-#define TAG(x) x##_cull_flat_tex
-#include "s3v_tritmp.h"
-
-static void init_rast_tab( void )
-{
- DEBUG(("*** init_rast_tab ***\n"));
-
- s3v_init();
- s3v_init_cull();
- s3v_init_flat();
- s3v_init_cull_flat();
- s3v_init_tex();
- s3v_init_cull_tex();
- s3v_init_flat_tex();
- s3v_init_cull_flat_tex();
-}
-
-/***********************************************************************
- * Rasterization fallback helpers *
- ***********************************************************************/
-
-
-/* This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-
-#if 0
-static void
-s3v_fallback_quad( s3vContextPtr vmesa,
- const s3vVertex *v0,
- const s3vVertex *v1,
- const s3vVertex *v2,
- const s3vVertex *v3 )
-{
- GLcontext *ctx = vmesa->glCtx;
- SWvertex v[4];
- s3v_translate_vertex( ctx, v0, &v[0] );
- s3v_translate_vertex( ctx, v1, &v[1] );
- s3v_translate_vertex( ctx, v2, &v[2] );
- s3v_translate_vertex( ctx, v3, &v[3] );
- DEBUG(("s3v_fallback_quad\n"));
-/* _swrast_Quad( ctx, &v[0], &v[1], &v[2], &v[3] ); */
-}
-
-static void
-s3v_fallback_tri( s3vContextPtr vmesa,
- const s3vVertex *v0,
- const s3vVertex *v1,
- const s3vVertex *v2 )
-{
- GLcontext *ctx = vmesa->glCtx;
- SWvertex v[3];
- s3v_translate_vertex( ctx, v0, &v[0] );
- s3v_translate_vertex( ctx, v1, &v[1] );
- s3v_translate_vertex( ctx, v2, &v[2] );
- DEBUG(("s3v_fallback_tri\n"));
-/* _swrast_Triangle( ctx, &v[0], &v[1], &v[2] ); */
-}
-
-static void
-s3v_fallback_line( s3vContextPtr vmesa,
- const s3vVertex *v0,
- const s3vVertex *v1 )
-{
- GLcontext *ctx = vmesa->glCtx;
- SWvertex v[2];
- s3v_translate_vertex( ctx, v0, &v[0] );
- s3v_translate_vertex( ctx, v1, &v[1] );
- DEBUG(("s3v_fallback_line\n"));
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-/*
-static void
-s3v_fallback_point( s3vContextPtr vmesa,
- const s3vVertex *v0 )
-{
- GLcontext *ctx = vmesa->glCtx;
- SWvertex v[1];
- s3v_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-*/
-#endif
-
-/***********************************************************************
- * Choose rasterization functions *
- ***********************************************************************/
-
-#define _S3V_NEW_RASTER_STATE (_NEW_FOG | \
- _NEW_TEXTURE | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_POINT_SMOOTH | \
- _DD_NEW_TRI_STIPPLE | \
- _DD_NEW_LINE_STIPPLE)
-
-#define LINE_FALLBACK (0)
-#define TRI_FALLBACK (0)
-
-static void s3v_nodraw_triangle(GLcontext *ctx, s3vVertex *v0,
- s3vVertex *v1, s3vVertex *v2)
-{
- (void) (ctx && v0 && v1 && v2);
-}
-
-static void s3v_nodraw_quad(GLcontext *ctx,
- s3vVertex *v0, s3vVertex *v1,
- s3vVertex *v2, s3vVertex *v3)
-{
- (void) (ctx && v0 && v1 && v2 && v3);
-}
-
-void s3vChooseRasterState(GLcontext *ctx);
-
-void s3vChooseRasterState(GLcontext *ctx)
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint ind = 0;
-
- DEBUG(("*** s3vChooseRasterState ***\n"));
-
- if (ctx->Polygon.CullFlag) {
- if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) {
- vmesa->draw_tri = (s3v_tri_func)s3v_nodraw_triangle;
- vmesa->draw_quad = (s3v_quad_func)s3v_nodraw_quad;
- return;
- }
- ind |= S3V_RAST_CULL_BIT;
- /* s3v_update_cullsign(ctx); */
- } /* else vmesa->backface_sign = 0; */
-
- if ( flags & DD_FLATSHADE )
- ind |= S3V_RAST_FLAT_BIT;
-
- if ( ctx->Texture.Unit[0]._ReallyEnabled ) {
- ind |= S3V_RAST_TEX_BIT;
- }
-
- DEBUG(("ind = %i\n", ind));
-
- vmesa->draw_line = s3v_line_tab[ind];
- vmesa->draw_tri = s3v_tri_tab[ind];
- vmesa->draw_quad = s3v_quad_tab[ind];
- vmesa->draw_point = s3v_point_tab[ind];
-
-#if 0
- /* Hook in fallbacks for specific primitives. CURRENTLY DISABLED
- */
-
- if (flags & LINE_FALLBACK)
- vmesa->draw_line = s3v_fallback_line;
-
- if (flags & TRI_FALLBACK) {
- DEBUG(("TRI_FALLBACK\n"));
- vmesa->draw_tri = s3v_fallback_tri;
- vmesa->draw_quad = s3v_fallback_quad;
- }
-#endif
-}
-
-
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( v0, v1, v2 ) \
-do { \
- /*
- if (DO_FALLBACK) \
- vmesa->draw_tri( vmesa, v0, v1, v2 ); \
- else */ \
- DEBUG(("TRI: max was here\n")); /* \
- s3v_draw_tex_triangle( vmesa, v0, v1, v2 ); */ \
- vmesa->draw_tri( vmesa, v0, v1, v2 ); \
-} while (0)
-
-#define QUAD( v0, v1, v2, v3 ) \
-do { \
- DEBUG(("QUAD: max was here\n")); \
- vmesa->draw_quad( vmesa, v0, v1, v2, v3 ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- DEBUG(("LINE: max was here\n")); \
- vmesa->draw_line( vmesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- vmesa->draw_point( vmesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-/*
-#define S3V_OFFSET_BIT 0x01
-#define S3V_TWOSIDE_BIT 0x02
-#define S3V_UNFILLED_BIT 0x04
-#define S3V_FALLBACK_BIT 0x08
-#define S3V_MAX_TRIFUNC 0x10
-
-
-static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
-} rast_tab[S3V_MAX_TRIFUNC];
-*/
-
-#define DO_FALLBACK (IND & S3V_FALLBACK_BIT)
-#define DO_OFFSET (IND & S3V_OFFSET_BIT)
-#define DO_UNFILLED (IND & S3V_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & S3V_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 0
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX s3vVertex
-#define TAB rast_tab
-
-#define DEPTH_SCALE 1.0
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (vmesa->verts + (e<<vmesa->vertex_stride_shift))
-
-#if 0
-#define VERT_SET_RGBA( v, c ) \
-do { \
-/* UNCLAMPED_FLOAT_TO_RGBA_CHAN( v->ub4[4], c) */ \
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[4] = v1->ui[4]
-/*
-#define VERT_COPY_RGBA1( v0, v1 ) v0->ui[4] = v1->ui[4]
-*/
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[4]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[4] = color[idx]
-#endif
-
-#define LOCAL_VARS(n) \
- s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
- GLuint color[n]; \
- (void) color;
-
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- PrimType_Points,
- PrimType_Lines,
- PrimType_Lines,
- PrimType_Lines,
- PrimType_Triangles,
- PrimType_Triangles,
- PrimType_Triangles,
- PrimType_Triangles,
- PrimType_Triangles,
- PrimType_Triangles
-};
-
-static void s3vResetLineStipple( GLcontext *ctx );
-static void s3vRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void s3vRenderPrimitive( GLcontext *ctx, GLenum prim );
-/*
-extern static void s3v_lines_emit(GLcontext *ctx, GLuint start, GLuint end);
-extern static void s3v_tris_emit(GLcontext *ctx, GLuint start, GLuint end);
-*/
-#define RASTERIZE(x) if (vmesa->hw_primitive != hw_prim[x]) \
- s3vRasterPrimitive( ctx, hw_prim[x] )
-#define RENDER_PRIMITIVE vmesa->render_primitive
-#define TAG(x) x
-#define IND S3V_FALLBACK_BIT
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_TWOSIDE_BIT|S3V_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_OFFSET_BIT|S3V_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_TWOSIDE_BIT|S3V_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_TWOSIDE_BIT|S3V_OFFSET_BIT|S3V_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_render_tab( void )
-{
- DEBUG(("*** init_render_tab ***\n"));
-
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
-}
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define VERT(x) (s3vVertex *)(s3vverts + (x << shift))
-
-#define RENDER_POINTS( start, count ) \
- DEBUG(("RENDER_POINTS...(ok)\n")); \
- for ( ; start < count ; start++) \
- vmesa->draw_line( vmesa, VERT(start), VERT(start) )
- /* vmesa->draw_point( vmesa, VERT(start) ) */
-
-#define RENDER_LINE( v0, v1 ) \
- /* DEBUG(("RENDER_LINE...(ok)\n")); \ */ \
- vmesa->draw_line( vmesa, VERT(v0), VERT(v1) ); \
- DEBUG(("RENDER_LINE...(ok)\n"))
-
-#define RENDER_TRI( v0, v1, v2 ) \
- DEBUG(("RENDER_TRI...(ok)\n")); \
- vmesa->draw_tri( vmesa, VERT(v0), VERT(v1), VERT(v2) )
-
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- DEBUG(("RENDER_QUAD...(ok)\n")); \
- /* s3v_draw_quad( vmesa, VERT(v0), VERT(v1), VERT(v2),VERT(v3) ) */\
- /* s3v_draw_triangle( vmesa, VERT(v0), VERT(v1), VERT(v2) ); \
- s3v_draw_triangle( vmesa, VERT(v0), VERT(v2), VERT(v3) ) */ \
- vmesa->draw_quad( vmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-
-#define INIT(x) s3vRenderPrimitive( ctx, x );
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
- const GLuint shift = vmesa->vertex_stride_shift; \
- const char *s3vverts = (char *)vmesa->verts; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) stipple;
-#define RESET_STIPPLE if ( stipple ) s3vResetLineStipple( ctx );
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) s3v_##x##_verts
-#include "tnl_dd/t_dd_rendertmp.h"
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void s3vRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint prim = vmesa->render_primitive;
-
- DEBUG(("I AM in: s3vRenderClippedPoly\n"));
-
- /* Render the new vertices as an unclipped polygon.
- */
- if (1)
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]
- ( ctx, 0, n, PRIM_BEGIN|PRIM_END );
-
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive
- */
-#if 1
- if (prim != GL_POLYGON) {
- DEBUG(("and prim != GL_POLYGON\n"));
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
- }
-
-#endif
-}
-
-static void s3vRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- /*tnl->Driver.LineFunc = s3v_line_tab[2];*/ /* _swsetup_Line; */
-
- DEBUG(("I AM in: s3vRenderClippedLine\n"));
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-
-#define _S3V_NEW_RENDERSTATE (_DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET)
-
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-static void s3vChooseRenderState(GLcontext *ctx)
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- DEBUG(("s3vChooseRenderState\n"));
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= S3V_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= S3V_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= S3V_UNFILLED_BIT;
- }
-
- DEBUG(("vmesa->RenderIndex = %i\n", vmesa->RenderIndex));
- DEBUG(("index = %i\n", index));
-
- if (vmesa->RenderIndex != index) {
- vmesa->RenderIndex = index;
-
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (vmesa->RenderIndex == 0)
- tnl->Driver.Render.PrimTabVerts = s3v_render_tab_verts;
- else
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = s3vRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = s3vRenderClippedPoly;
- }
-}
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-
-/* Determine the rasterized primitive when not drawing unfilled
- * polygons.
- *
- * Used only for the default render stage which always decomposes
- * primitives to trianges/lines/points. For the accelerated stage,
- * which renders strips as strips, the equivalent calculations are
- * performed in s3v_render.c.
- */
-
-static void s3vRasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-/* __DRIdrawablePrivate *dPriv = vmesa->driDrawable; */
- GLuint cmd = vmesa->CMD;
-
- unsigned int _hw_prim = hwprim;
-
- DEBUG(("s3vRasterPrimitive: hwprim = 0x%x ", _hw_prim));
-
-/* printf("* vmesa->CMD = 0x%x\n", vmesa->CMD); */
-
- if (vmesa->hw_primitive != _hw_prim)
- {
- DEBUG(("(new one) ***\n"));
- cmd &= ~DO_MASK;
- cmd &= ~ALPHA_BLEND_MASK;
- vmesa->hw_primitive = _hw_prim;
-
- if (_hw_prim == PrimType_Triangles) {
- /* TRI */
- DEBUG(("->switching to tri\n"));
- cmd |= (vmesa->_tri[vmesa->_3d_mode] | vmesa->_alpha[vmesa->_3d_mode]);
- } else if (_hw_prim == PrimType_Lines
- || _hw_prim == PrimType_Points) {
- /* LINE */
- DEBUG(("->switching to line\n"));
- cmd |= (DO_3D_LINE | vmesa->_alpha[0]);
- } else {
- /* ugh? */
- DEBUG(("->switching to your sis'ass\n"));
- }
-
- DEBUG(("\n"));
-
- vmesa->restore_primitive = _hw_prim;
- /* 0xacc16827: good value -> lightened newave!!! */
- vmesa->CMD = cmd;
- CMDCHANGE();
- }
-}
-
-static void s3vRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- GLuint cmd = vmesa->CMD;
-
- unsigned int _hw_prim = hw_prim[prim];
-
- vmesa->render_primitive = prim;
- vmesa->hw_primitive = _hw_prim;
-
- DEBUG(("s3vRenderPrimitive #%i ", prim));
- DEBUG(("_hw_prim = 0x%x\n", _hw_prim));
-
-/* printf(" vmesa->CMD = 0x%x\n", vmesa->CMD); */
-
- if (_hw_prim != vmesa->restore_primitive) {
- DEBUG(("_hw_prim != vmesa->restore_primitive (was 0x%x)\n",
- vmesa->restore_primitive));
-#if 1
- cmd &= ~DO_MASK;
- cmd &= ~ALPHA_BLEND_MASK;
-/*
- printf(" cmd = 0x%x\n", cmd);
- printf(" vmesa->_3d_mode=%i; vmesa->_tri[vmesa->_3d_mode]=0x%x\n",
- vmesa->_3d_mode, vmesa->_tri[vmesa->_3d_mode]);
- printf("vmesa->alpha[0] = 0x%x; vmesa->alpha[1] = 0x%x\n",
- vmesa->_alpha[0], vmesa->_alpha[1]);
-*/
- if (_hw_prim == PrimType_Triangles) { /* TRI */
- DEBUG(("->switching to tri\n"));
- cmd |= (vmesa->_tri[vmesa->_3d_mode] | vmesa->_alpha[vmesa->_3d_mode]);
- DEBUG(("vmesa->TexStride = %i\n", vmesa->TexStride));
- DEBUG(("vmesa->TexOffset = %i\n", vmesa->TexOffset));
- DMAOUT_CHECK(3DTRI_Z_BASE, 12);
- } else { /* LINE */
- DEBUG(("->switching to line\n"));
- cmd |= (DO_3D_LINE | vmesa->_alpha[0]);
- DMAOUT_CHECK(3DLINE_Z_BASE, 12);
- }
-
- DMAOUT(vmesa->s3vScreen->depthOffset & 0x003FFFF8);
- DMAOUT(vmesa->DestBase);
- /* DMAOUT(vmesa->ScissorLR); */
- /* DMAOUT(vmesa->ScissorTB); */
-
- /* NOTE: we need to restore all these values since we
- * are coming back from a vmesa->restore_primitive */
- DMAOUT( (0 << 16) | (dPriv->w-1) );
- DMAOUT( (0 << 16) | (dPriv->h-1) );
- DMAOUT( (vmesa->SrcStride << 16) | vmesa->TexStride );
- DMAOUT(vmesa->SrcStride);
- DMAOUT(vmesa->TexOffset);
- DMAOUT(vmesa->TextureBorderColor);
- DMAOUT(0); /* FOG */
- DMAOUT(0);
- DMAOUT(0);
- DMAOUT(cmd);
- /* 0xacc16827: good value -> lightened newave!!! */
- DMAFINISH();
-
- vmesa->CMD = cmd;
-#endif
- }
-
- DEBUG(("\n"));
-
- vmesa->restore_primitive = _hw_prim;
-}
-
-static void s3vRunPipeline( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- DEBUG(("*** s3vRunPipeline ***\n"));
-
- if ( vmesa->new_state )
- s3vDDUpdateHWState( ctx );
-
- if (vmesa->new_gl_state) {
-
- if (vmesa->new_gl_state & _NEW_TEXTURE) {
- s3vUpdateTextureState( ctx );
- }
-
- if (!vmesa->Fallback) {
- if (vmesa->new_gl_state & _S3V_NEW_VERTEX)
- s3vChooseVertexState( ctx );
-
- if (vmesa->new_gl_state & _S3V_NEW_RASTER_STATE)
- s3vChooseRasterState( ctx );
-
- if (vmesa->new_gl_state & _S3V_NEW_RENDERSTATE)
- s3vChooseRenderState( ctx );
- }
-
- vmesa->new_gl_state = 0;
-
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-static void s3vRenderStart( GLcontext *ctx )
-{
- /* Check for projective texturing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
-
- DEBUG(("s3vRenderStart\n"));
- /* s3vCheckTexSizes( ctx ); */
-}
-
-static void s3vRenderFinish( GLcontext *ctx )
-{
- if (0)
- _swrast_flush( ctx ); /* never needed */
-}
-
-static void s3vResetLineStipple( GLcontext *ctx )
-{
-/* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */
-
- /* Reset the hardware stipple counter.
- */
-/*
- CHECK_DMA_BUFFER(vmesa, 1);
- WRITE(vmesa->buf, UpdateLineStippleCounters, 0);
-*/
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-
-void s3vFallback( s3vContextPtr vmesa, GLuint bit, GLboolean mode )
-{
- GLcontext *ctx = vmesa->glCtx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = vmesa->Fallback;
-
- DEBUG(("*** s3vFallback: "));
-
- if (mode) {
- vmesa->Fallback |= bit;
- if (oldfallback == 0) {
- DEBUG(("oldfallback == 0 ***\n"));
- _swsetup_Wakeup( ctx );
- _tnl_need_projected_coords( ctx, GL_TRUE );
- vmesa->RenderIndex = ~0;
- }
- }
- else {
- DEBUG(("***\n"));
- vmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = s3vRenderStart;
- tnl->Driver.Render.PrimitiveNotify = s3vRenderPrimitive;
- tnl->Driver.Render.Finish = s3vRenderFinish;
- tnl->Driver.Render.BuildVertices = s3vBuildVertices;
- tnl->Driver.Render.ResetLineStipple = s3vResetLineStipple;
- vmesa->new_gl_state |= (_S3V_NEW_RENDERSTATE|
- _S3V_NEW_RASTER_STATE|
- _S3V_NEW_VERTEX);
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void s3vInitTriFuncs( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- init_render_tab();
- firsttime = 0;
- }
-
- vmesa->RenderIndex = ~0;
-
- tnl->Driver.RunPipeline = s3vRunPipeline;
- tnl->Driver.Render.Start = s3vRenderStart;
- tnl->Driver.Render.Finish = s3vRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = s3vRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = s3vResetLineStipple;
-/*
- tnl->Driver.RenderInterp = _swsetup_RenderInterp;
- tnl->Driver.RenderCopyPV = _swsetup_RenderCopyPV;
-*/
- tnl->Driver.Render.BuildVertices = s3vBuildVertices;
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_tris.h b/src/mesa/drivers/dri/s3v/s3v_tris.h
deleted file mode 100644
index 0010a7fe0a7..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_tris.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_TRIS_H
-#define _S3V_TRIS_H
-
-extern void s3vDDTrifuncInit(void);
-extern void s3vDDChooseTriRenderState(GLcontext *);
-
-#endif /* !(_S3V_TRIS_H) */
diff --git a/src/mesa/drivers/dri/s3v/s3v_tritmp.h b/src/mesa/drivers/dri/s3v/s3v_tritmp.h
deleted file mode 100644
index 2321bd414ff..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_tritmp.h
+++ /dev/null
@@ -1,958 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-/**** MACROS start ****/
-
-/* point/line macros */
-
-#define LINE_VERT_VARS \
- SWvertex v[3]; \
- s3vVertex* vvv[2]; \
- int x[3], y[3], z[3]; \
- int idx[3]; \
- int dx01, dy01; \
- int delt02; \
- int deltzy, zstart; \
- int start02, end01; \
- int ystart, y01y12; \
- int i, tmp, tmp2, tmp3; \
- GLfloat ydiff, fy[3]
-#define LINE_VERT_VARS_VOIDS \
- (void) v; (void) vvv; (void) x; (void) y; (void) z; (void) idx; \
- (void) dx01; (void) dy01; (void) delt02; (void) deltzy; \
- (void) zstart; (void) start02; (void) ystart; (void) y01y12; \
- (void) i; (void) tmp; (void) tmp2; (void) tmp3; (void) ydiff; (void) fy
-
-#define LINE_FLAT_VARS \
- int arstart, gbstart; \
- int deltarx, deltgbx, deltary, deltgby; \
- GLubyte *(col)[3]
-#define LINE_FLAT_VARS_VOIDS \
- (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \
- (void) deltary; (void) deltgby; (void) col
-
-#define LINE_GOURAUD_VARS \
- int arstart, gbstart; \
- int deltary, deltgby; \
- int ctmp, ctmp2, ctmp3, ctmp4; \
- GLubyte *(col)[3]
-#define LINE_GOURAUD_VARS_VOIDS \
- (void) arstart; (void) gbstart; (void) deltary; (void) deltgby; \
- (void) ctmp; (void) ctmp2; (void) ctmp3; (void) ctmp4; (void) col
-
-#define SORT_LINE_VERT() \
-do { \
- if(v[0].attrib[FRAG_ATTRIB_WPOS][1] <= v[1].attrib[FRAG_ATTRIB_WPOS][1]) { \
-\
- idx[0] = 0; \
- idx[1] = 1; \
-\
- } else if (v[0].attrib[FRAG_ATTRIB_WPOS][1] > v[1].attrib[FRAG_ATTRIB_WPOS][1]) { \
-\
- idx[0] = 1; \
- idx[1] = 0; \
-\
- } \
-} while(0)
-
-#define SET_LINE_VERT() \
-do { \
- x[0] = (v[idx[0]].attrib[FRAG_ATTRIB_WPOS][0] * 1024.0f * 1024.0f); /* 0x100000 */ \
- y[0] = fy[0] = dPriv->h - v[idx[0]].attrib[FRAG_ATTRIB_WPOS][1]; \
- z[0] = (v[idx[0]].attrib[FRAG_ATTRIB_WPOS][2]) * 1024.0f * 32.0f; /* 0x8000; */ \
-\
- x[1] = (v[idx[1]].attrib[FRAG_ATTRIB_WPOS][0] * 1024.0f * 1024.0f); /* 0x100000 */ \
- y[1] = dPriv->h - v[idx[1]].attrib[FRAG_ATTRIB_WPOS][1]; \
- z[1] = (v[idx[1]].attrib[FRAG_ATTRIB_WPOS][2]) * 1024.0f * 32.0f; /* 0x8000 */ \
-} while(0)
-
-#define SET_LINE_XY() \
-do { \
- tmp = v[idx[0]].attrib[FRAG_ATTRIB_WPOS][0]; \
- tmp2 = v[idx[1]].attrib[FRAG_ATTRIB_WPOS][0]; \
-\
- dx01 = x[0] - x[1]; \
- dy01 = y[0] - y[1]; \
-\
- ydiff = fy[0] - (float)y[0]; \
- ystart = y[0]; \
- y01y12 = dy01 + 1; \
-} while (0)
-
-#define SET_LINE_DIR() \
-do { \
- if (tmp2 > tmp) { \
- y01y12 |= 0x80000000; \
- tmp3 = tmp2-tmp; \
- } else { \
- tmp3 = tmp-tmp2; \
- } \
-\
- end01 = ((tmp << 16) | tmp2); \
-\
- if (dy01) \
- delt02 = -(dx01/dy01); \
- else \
- delt02 = 0; \
-\
- if (dy01 > tmp3) { /* Y MAJ */ \
- /* NOTE: tmp3 always >=0 */ \
- start02 = x[0]; \
- } else if (delt02 >= 0){ /* X MAJ - positive delta */ \
- start02 = x[0] + delt02/2; \
- dy01 = tmp3; /* could be 0 */ \
- } else { /* X MAJ - negative delta */ \
- start02 = x[0] + delt02/2 + ((1 << 20) - 1); \
- dy01 = tmp3; /* could be 0 */ \
- } \
-} while(0)
-
-#define SET_LINE_Z() \
-do { \
- zstart = z[0]; \
-\
- if (dy01) { \
- deltzy = (z[1] - z[0])/dy01; \
- } else { \
- deltzy = 0; /* dy01 = tmp3 = 0 (it's a point)*/ \
- } \
-} while (0)
-
-#define SET_LINE_FLAT_COL() \
-do { \
- col[0] = &(v[idx[0]].color[0]); \
- deltarx = deltary = deltgbx = deltgby = 0; \
- gbstart = (((col[0][1]) << 23) | ((col[0][2]) << 7)); \
- arstart = (((col[0][3]) << 23) | ((col[0][0]) << 7)); \
-} while(0)
-
-#define SET_LINE_GOURAUD_COL() \
-do { \
- col[0] = &(v[idx[0]].color[0]); \
- col[1] = &(v[idx[1]].color[0]); \
-\
- vvv[0] = _v0; \
- vvv[1] = _v1; \
-\
- for (i=0; i<2; i++) { \
- /* FIXME: swapped ! */ \
- col[i][0] = vvv[!idx[i]]->v.color.red; \
- col[i][1] = vvv[!idx[i]]->v.color.green; \
- col[i][2] = vvv[!idx[i]]->v.color.blue; \
- col[i][3] = vvv[!idx[i]]->v.color.alpha; \
- } \
-\
- if (dy01) { \
-\
- ctmp = ((col[0][1] - col[1][1]) << 7) / dy01; \
- ctmp2 = ((col[0][2] - col[1][2]) << 7) / dy01; \
- deltgby = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \
-\
- ctmp3 = ((col[0][3] - col[1][3]) << 7) / dy01; \
- ctmp4 = ((col[0][0] - col[1][0]) << 7) / dy01; \
- deltary = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \
- } else { \
- ctmp = ((col[1][1] - col[0][1]) << 7); \
- ctmp2 = ((col[1][2] - col[0][2]) << 7); \
- deltgby = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \
-\
- ctmp3 = ((col[1][3] - col[0][3]) << 7); \
- ctmp4 = ((col[1][0] - col[0][0]) << 7); \
- deltary = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \
- deltgby = deltary = 0; \
- } \
-\
- idx[0] = 1; /* FIXME: swapped */ \
-\
- gbstart = \
- (((int)((ydiff * ctmp) + (col[idx[0]][1] << 7)) << 16) & 0x7FFF0000) \
- | ((int)((ydiff * ctmp2) + (col[idx[0]][2] << 7)) & 0x7FFF); \
- arstart = \
- (((int)((ydiff * ctmp3) + (col[idx[0]][3] << 7)) << 16) & 0x7FFF0000) \
- | ((int)((ydiff * ctmp4) + (col[idx[0]][0] << 7)) & 0x7FFF); \
-} while(0)
-
-#define SEND_LINE_COL() \
-do { \
- DMAOUT(deltgby); \
- DMAOUT(deltary); \
- DMAOUT(gbstart); \
- DMAOUT(arstart); \
-} while (0)
-
-#define SEND_LINE_VERT() \
-do { \
- DMAOUT(deltzy); \
- DMAOUT(zstart); \
- DMAOUT(0); \
- DMAOUT(0); \
- DMAOUT(0); \
- DMAOUT(end01); \
- DMAOUT(delt02); \
- DMAOUT(start02); \
- DMAOUT(ystart); \
- DMAOUT(y01y12); \
-} while (0)
-
-
-/* tri macros (mostly stolen from utah-glx...) */
-
-#define VERT_VARS \
- SWvertex v[3]; \
- int x[3], y[3], z[3]; \
- int idx[3]; \
- int dx01, dy01; \
- int dx02, dy02; \
- int dx12, dy12; \
- int delt01, delt02, delt12; \
- int deltzx, deltzy, zstart; \
- int start02, end01, end12; \
- int ystart, y01y12; \
- int i, tmp, lr; \
- GLfloat ydiff, fy[3]
-#define VERT_VARS_VOIDS \
- (void) v; (void) x; (void) y; (void) z; (void) idx; (void) dx01; \
- (void) dy01; (void) dx02; (void) dy02; (void) dx12; (void) dy12; \
- (void) delt01; (void) delt02; (void) delt12; (void) deltzx; \
- (void) deltzy; (void) zstart; (void) start02; (void) end01; \
- (void) end12; (void) ystart; (void) y01y12; (void) i; (void) tmp; \
- (void) lr; (void) ydiff; (void) fy
-
-#define GOURAUD_VARS \
- int arstart, gbstart; \
- int deltarx, deltgbx, deltary, deltgby; \
- int ctmp, ctmp2, ctmp3, ctmp4; \
- GLubyte *(col)[3]
-#define GOURAUD_VARS_VOIDS \
- (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \
- (void) deltary; (void) deltgby; (void) ctmp; (void) ctmp2; \
- (void) ctmp3; (void) ctmp4; (void) col
-
-#define FLAT_VARS \
- int arstart, gbstart; \
- int deltarx, deltgbx, deltary, deltgby; \
- GLubyte *(col)[3]
-#define FLAT_VARS_VOIDS \
- (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \
- (void) deltary; (void) deltgby; (void) col
-
-#define TEX_VARS \
- int u0, u1, u2; \
- GLfloat ru0, ru1, ru2; \
- int v0, v1, v2; \
- GLfloat rv0, rv1, rv2; \
- GLfloat w0, w1, w2; \
- GLfloat rw0, rw1, rw2; \
- int baseu, basev; \
- int d0, d1, d2; \
- int deltdx, deltvx, deltux, deltdy, deltvy, deltuy; \
- int deltwx, deltwy; \
- int rbaseu, rbasev; \
- int dstart, ustart, wstart, vstart; \
- static int stmp = 0; \
- s3vTextureObjectPtr t
-#define TEX_VARS_VOIDS \
- (void) u0; (void) u1; (void) u2; (void) ru0; (void) ru1; (void) ru2; \
- (void) v0; (void) v1; (void) v2; (void) rv0; (void) rv1; (void) rv2; \
- (void) w0; (void) w1; (void) w2; (void) rw0; (void) rw1; (void) rw2; \
- (void) baseu; (void) basev; (void) d0; (void) d1; (void) d2; \
- (void) deltdx; (void) deltvx; (void) deltux; (void) deltdy; \
- (void) deltuy; (void) deltwx; (void) deltwy; (void) rbaseu; \
- (void) rbasev; (void) dstart; (void) ustart; (void) wstart; \
- (void) vstart; (void) stmp; (void) t
-
-#define SORT_VERT() \
-do { \
- for (i=0; i<3; i++) \
- fy[i] = v[i].attrib[FRAG_ATTRIB_WPOS][1]; \
-\
- if (fy[1] > fy[0]) { /* (fy[1] > fy[0]) */ \
-\
- if (fy[2] > fy[0]) { \
- idx[0] = 0; \
- if (fy[1] > fy[2]) { \
- idx[1] = 2; \
- idx[2] = 1; \
- } else { \
- idx[1] = 1; \
- idx[2] = 2; \
- } \
- } else { \
- idx[0] = 2; \
- idx[1] = 0; \
- idx[2] = 1; \
- } \
- } else { /* (fy[1] < y[0]) */ \
- if (fy[2] > fy[0]) { \
- idx[0] = 1; \
- idx[1] = 0; \
- idx[2] = 2; \
- } else { \
- idx[2] = 0; \
- if (fy[2] > fy[1]) { \
- idx[0] = 1; \
- idx[1] = 2; \
- } else { \
- idx[0] = 2; \
- idx[1] = 1; \
- } \
- } \
- } \
-} while(0)
-
-#define SET_VERT() \
-do { \
- for (i=0; i<3; i++) \
- { \
- x[i] = ((v[idx[i]].attrib[FRAG_ATTRIB_WPOS][0]) * /* 0x100000*/ 1024.0 * 1024.0); \
- y[i] = fy[i] = (dPriv->h - v[idx[i]].attrib[FRAG_ATTRIB_WPOS][1]); \
- z[i] = ((v[idx[i]].attrib[FRAG_ATTRIB_WPOS][2]) * /* 0x8000 */ 1024.0 * 32.0); \
- } \
-\
- ydiff = fy[0] - (float)y[0]; \
-\
- ystart = y[0]; \
-\
- dx12 = x[2] - x[1]; \
- dy12 = y[1] - y[2]; \
- dx01 = x[1] - x[0]; \
- dy01 = y[0] - y[1]; \
- dx02 = x[2] - x[0]; \
- dy02 = y[0] - y[2]; \
-\
- delt01 = delt02 = delt12 = 0; \
-} while (0)
-
-
-#define SET_XY() \
-do { \
- if (dy01) delt01 = dx01 / dy01; \
- if (dy12) delt12 = dx12 / dy12; \
- delt02 = dx02 / dy02; \
-\
- start02 = x[0] + (ydiff * delt02); \
- end01 = x[0] + (ydiff * delt01); \
- end12 = x[1] + ((fy[1] - (GLfloat)y[1]) * delt12); \
-} while (0)
-
-#define SET_DIR() \
-do { \
- tmp = x[1] - (dy01 * delt02 + x[0]); \
- if (tmp > 0) { \
- lr = 0x80000000; \
- } else { \
- tmp *= -1; \
- lr = 0; \
- } \
- tmp >>= 20; \
-\
- y01y12 = ((((y[0] - y[1]) & 0x7FF) << 16) \
- | ((y[1] - y[2]) & 0x7FF) | lr); \
-} while (0)
-
-#define SET_Z() \
-do { \
- deltzy = (z[2] - z[0]) / dy02; \
- if (tmp) { \
- deltzx = (z[1] - (dy01 * deltzy + z[0])) / tmp; \
- } else { \
- deltzx = 0; \
- } \
- zstart = (deltzy * ydiff) + z[0]; \
-} while (0)
-
-#define SET_FLAT_COL() \
-do { \
- col[0] = &(v[0].color[0]); \
- deltarx = deltary = deltgbx = deltgby = 0; \
- gbstart = (((col[0][1]) << 23) | ((col[0][2]) << 7)); \
- arstart = (((col[0][3]) << 23) | ((col[0][0]) << 7)); \
-} while(0)
-
-#define SET_GOURAUD_COL() \
-do { \
- col[0] = &(v[idx[0]].color[0]); \
- col[1] = &(v[idx[1]].color[0]); \
- col[2] = &(v[idx[2]].color[0]); \
-\
- ctmp = ((col[2][3] - col[0][3]) << 7) / dy02; \
- ctmp2 = ((col[2][0] - col[0][0]) << 7) / dy02; \
- deltary = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \
- ctmp3 = ((col[2][1] - col[0][1]) << 7) / dy02; \
- ctmp4 = ((col[2][2] - col[0][2]) << 7) / dy02; \
- deltgby = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \
- gbstart = \
- (((int)((ydiff * ctmp3) + (col[0][1] << 7)) << 16) & 0x7FFF0000) \
- | ((int)((ydiff * ctmp4) + (col[0][2] << 7)) & 0x7FFF); \
- arstart = \
- (((int)((ydiff * ctmp) + (col[0][3] << 7)) << 16) & 0x7FFF0000) \
- | ((int)((ydiff * ctmp2) + (col[0][0] << 7)) & 0x7FFF); \
- if (tmp) { \
- int ax, rx, gx, bx; \
- ax = ((col[1][3] << 7) - (dy01 * ctmp + (col[0][3] << 7))) / tmp; \
- rx = ((col[1][0] << 7) - (dy01 * ctmp2 + (col[0][0] << 7))) / tmp; \
- gx = ((col[1][1] << 7) - (dy01 * ctmp3 + (col[0][1] << 7))) / tmp; \
- bx = ((col[1][2] << 7) - (dy01 * ctmp4 + (col[0][2] << 7))) / tmp; \
- deltarx = ((ax << 16) & 0xFFFF0000) | (rx & 0xFFFF); \
- deltgbx = ((gx << 16) & 0xFFFF0000) | (bx & 0xFFFF); \
- } else { \
- deltgbx = deltarx = 0; \
- } \
-} while (0)
-
-#define SET_TEX_VERT() \
-do { \
- t = ((s3vTextureObjectPtr) \
- ctx->Texture.Unit[0]._Current->DriverData); \
- deltwx = deltwy = wstart = deltdx = deltdy = dstart = 0; \
-\
- u0 = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] \
- * (GLfloat)(t->image[0].image->Width) * 256.0); \
- u1 = (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] \
- * (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \
- u2 = (v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0] \
- * (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \
- v0 = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] \
- * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
- v1 = (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] \
- * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
- v2 = (v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1] \
- * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
-\
- w0 = (v[idx[0]].attrib[FRAG_ATTRIB_WPOS][3]); \
- w1 = (v[idx[1]].attrib[FRAG_ATTRIB_WPOS][3]); \
- w2 = (v[idx[2]].attrib[FRAG_ATTRIB_WPOS][3]); \
-} while (0)
-
-#define SET_BASEUV() \
-do { \
- if (u0 < u1) { \
- if (u0 < u2) { \
- baseu = u0; \
- } else { \
- baseu = u2; \
- } \
- } else { \
- if (u1 < u2) { \
- baseu = u1; \
- } else { \
- baseu = u2; \
- } \
- } \
-\
- if (v0 < v1) { \
- if (v0 < v2) { \
- basev = v0; \
- } else { \
- basev = v2; \
- } \
- } else { \
- if (v1 < v2) { \
- basev = v1; \
- } else { \
- basev = v2; \
- } \
- } \
-} while (0)
-
-
-#define SET_RW() \
-do { \
- /* GLfloat minW; \
-\
- if (w0 < w1) { \
- if (w0 < w2) { \
- minW = w0; \
- } else { \
- minW = w2; \
- } \
- } else { \
- if (w1 < w2) { \
- minW = w1; \
- } else { \
- minW = w2; \
- } \
- } */ \
-\
- rw0 = (512.0 * w0); \
- rw1 = (512.0 * w1); \
- rw2 = (512.0 * w2); \
-} while (0)
-
-#define SET_D() \
-do { \
- GLfloat sxy, suv; \
- int lev; \
-\
- suv = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] - \
- v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \
- (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] - \
- v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1]) - \
- (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] - \
- v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \
- (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] - \
- v[idx[2]].attrib[FRAG_ATTRIB_TEX0][2]); \
-\
- sxy = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] - \
- v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \
- (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] - \
- v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1]) - \
- (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] - \
- v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \
- (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] - \
- v[idx[2]].attrib[FRAG_ATTRIB_TEX0][2]); \
-\
- if (sxy < 0) sxy *= -1.0; \
- if (suv < 0) suv *= -1.0; \
-\
- lev = *(int*)&suv - *(int *)&sxy; \
- if (lev < 0) \
- lev = 0; \
- else \
- lev >>=23; \
- dstart = (lev << 27); \
-} while (0)
-
-#define SET_UVWD() \
-do { \
- SET_BASEUV(); \
- SET_RW(); \
- SET_D(); \
- ru0 = (((u0 - baseu) * rw0)); \
- ru1 = (((u1 - baseu) * rw1)); \
- ru2 = (((u2 - baseu) * rw2)); \
- rv0 = (((v0 - basev) * rw0)); \
- rv1 = (((v1 - basev) * rw1)); \
- rv2 = (((v2 - basev) * rw2)); \
-\
- while (baseu < 0) { baseu += (t->globj->Image[0][0]->Width << 8); } \
- while (basev < 0) { basev += (t->globj->Image[0][0]->Height << 8); } \
-\
- if (!(baseu & 0xFF)) \
- { baseu = (baseu >> 8); } \
- else \
- { baseu = (baseu >> 8) + 1; } \
-\
- if ((basev & 0x80) || !(basev & 0xFF)) \
- { basev = (basev >> 8); } \
- else \
- { basev = (basev >> 8) - 1; } \
-\
- rbaseu = (baseu) << (16 - t->globj->Image[0][0]->WidthLog2); \
- rbasev = (basev) << (16 - t->globj->Image[0][0]->WidthLog2); \
- deltuy = (((ru2 - ru0) / dy02)); \
- deltvy = (((rv2 - rv0) / dy02)); \
- rw0 *= (1024.0 * 512.0); \
- rw1 *= (1024.0 * 512.0); \
- rw2 *= (1024.0 * 512.0); \
- deltwy = ((rw2 - rw0) / dy02); \
- if (tmp) { \
- deltux = ((ru1 - (dy01 * deltuy + ru0)) / tmp); \
- deltvx = ((rv1 - (dy01 * deltvy + rv0)) / tmp); \
- deltwx = ((rw1 - (dy01 * deltwy + rw0)) / tmp); \
- } else { deltux = deltvx = deltwx = 0; } \
- ustart = (deltuy * ydiff) + (ru0); \
- vstart = (deltvy * ydiff) + (rv0); \
- wstart = (deltwy * ydiff) + (rw0); \
-} while (0)
-
-#define SEND_UVWD() \
-do { \
- DMAOUT((rbasev & 0xFFFF)); \
- DMAOUT((0xa0000000 | (rbaseu & 0xFFFF))); \
- DMAOUT(deltwx); \
- DMAOUT(deltwy); \
- DMAOUT(wstart); \
- DMAOUT(deltdx); \
- DMAOUT(deltvx); \
- DMAOUT(deltux); \
- DMAOUT(deltdy); \
- DMAOUT(deltvy); \
- DMAOUT(deltuy); \
- DMAOUT(dstart); \
- DMAOUT(vstart); \
- DMAOUT(ustart); \
-} while (0)
-
-#define SEND_VERT() \
-do { \
- DMAOUT(deltzx); \
- DMAOUT(deltzy); \
- DMAOUT(zstart); \
- DMAOUT(delt12); \
- DMAOUT(end12); \
- DMAOUT(delt01); \
- DMAOUT(end01); \
- DMAOUT(delt02); \
- DMAOUT(start02); \
- DMAOUT(ystart); \
- DMAOUT(y01y12); \
-} while (0)
-
-#define SEND_COL() \
-do { \
- DMAOUT(deltgbx); \
- DMAOUT(deltarx); \
- DMAOUT(deltgby); \
- DMAOUT(deltary); \
- DMAOUT(gbstart); \
- DMAOUT(arstart); \
-} while (0)
-
-/**** MACROS end ****/
-
-
-
-
-static void TAG(s3v_point)( s3vContextPtr vmesa,
- const s3vVertex *_v0 )
-{
-}
-
-static void TAG(s3v_line)( s3vContextPtr vmesa,
- const s3vVertex *_v0,
- const s3vVertex *_v1 )
-{
- GLcontext *ctx = vmesa->glCtx;
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-
- LINE_VERT_VARS;
-#if (IND & S3V_RAST_FLAT_BIT)
- LINE_FLAT_VARS;
-#else
- LINE_GOURAUD_VARS;
-#endif
-#if (IND & S3V_RAST_CULL_BIT)
- GLfloat cull;
- (void) cull;
-#endif
- LINE_VERT_VARS_VOIDS;
-#if (IND & S3V_RAST_FLAT_BIT)
- LINE_FLAT_VARS_VOIDS;
-#else
- LINE_GOURAUD_VARS_VOIDS;
-#endif
-
- DEBUG(("*** s3v_line: "));
-#if (IND & S3V_RAST_CULL_BIT)
- DEBUG(("cull "));
-#endif
-#if (IND & S3V_RAST_FLAT_BIT)
- DEBUG(("flat "));
-#endif
-
- DEBUG(("***\n"));
-
-#if 0
- s3v_print_vertex(ctx, _v0);
- s3v_print_vertex(ctx, _v1);
-#endif
-
- s3v_translate_vertex( ctx, _v0, &v[0] );
- s3v_translate_vertex( ctx, _v1, &v[1] );
-
-#if (IND & S3V_RAST_CULL_BIT)
- /* FIXME: should we cull lines too? */
-#endif
- (void)v; /* v[0]; v[1]; */
-
- SORT_LINE_VERT();
- SET_LINE_VERT();
-
- SET_LINE_XY();
- SET_LINE_DIR();
- SET_LINE_Z();
-
-#if (IND & S3V_RAST_FLAT_BIT)
- SET_LINE_FLAT_COL();
-#else
- SET_LINE_GOURAUD_COL();
-#endif
-
- DMAOUT_CHECK(3DLINE_GBD, 15);
- SEND_LINE_COL();
- DMAOUT(0);
- SEND_LINE_VERT();
- DMAFINISH();
-}
-
-static void TAG(s3v_triangle)( s3vContextPtr vmesa,
- const s3vVertex *_v0,
- const s3vVertex *_v1,
- const s3vVertex *_v2 )
-{
- GLcontext *ctx = vmesa->glCtx;
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-
- VERT_VARS;
-#if (IND & S3v_RAST_FLAT_BIT)
- FLAT_VARS;
-#else
- GOURAUD_VARS;
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- TEX_VARS;
-#endif
-#if (IND & S3V_RAST_CULL_BIT)
- GLfloat cull;
-#endif
- VERT_VARS_VOIDS;
-#if (IND & S3v_RAST_FLAT_BIT)
- FLAT_VARS_VOIDS;
-#else
- GOURAUD_VARS_VOIDS;
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- TEX_VARS_VOIDS;
-#endif
-
- DEBUG(("*** s3v_triangle: "));
-#if (IND & S3V_RAST_CULL_BIT)
- DEBUG(("cull "));
-#endif
-#if (IND & S3V_RAST_FLAT_BIT)
- DEBUG(("flat "));
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- DEBUG(("tex "));
-#endif
-
-DEBUG(("***\n"));
-
-#if 0
- s3v_print_vertex(ctx, _v0);
- s3v_print_vertex(ctx, _v1);
- s3v_print_vertex(ctx, _v2);
-#endif
-
- s3v_translate_vertex( ctx, _v0, &v[0] );
- s3v_translate_vertex( ctx, _v1, &v[1] );
- s3v_translate_vertex( ctx, _v2, &v[2] );
-
-#if (IND & S3V_RAST_CULL_BIT)
- cull = vmesa->backface_sign *
- ((v[1].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]) * (v[0].attrib[FRAG_ATTRIB_WPOS][1] - v[2].attrib[FRAG_ATTRIB_WPOS][1]) +
- (v[1].attrib[FRAG_ATTRIB_WPOS][1] - v[0].attrib[FRAG_ATTRIB_WPOS][1]) * (v[2].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]));
-
- if (cull < vmesa->cull_zero /* -0.02f */) return;
-#endif
-
- (void)v; /* v[0]; v[1]; v[2]; */
-
- SORT_VERT();
- SET_VERT();
-
- if (dy02 == 0) return;
-
- SET_XY();
- SET_DIR();
- SET_Z();
-
-#if (IND & S3V_RAST_TEX_BIT)
- SET_TEX_VERT();
- SET_UVWD();
-#endif
-
-#if (IND & S3V_RAST_FLAT_BIT)
- SET_FLAT_COL();
-#else
- SET_GOURAUD_COL();
-#endif
-
-#if (IND & S3V_RAST_TEX_BIT)
- DMAOUT_CHECK(3DTRI_BASEV, 31);
- SEND_UVWD();
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#else
- DMAOUT_CHECK(3DTRI_GBX, 17);
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#endif
-}
-
-static void TAG(s3v_quad)( s3vContextPtr vmesa,
- const s3vVertex *_v0,
- const s3vVertex *_v1,
- const s3vVertex *_v2,
- const s3vVertex *_v3 )
-{
- GLcontext *ctx = vmesa->glCtx;
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-
- SWvertex temp_v[4];
- VERT_VARS;
-#if (IND & S3v_RAST_FLAT_BIT)
- FLAT_VARS;
-#else
- GOURAUD_VARS;
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- TEX_VARS;
-#endif
-#if (IND & S3V_RAST_CULL_BIT)
- GLfloat cull;
-#endif
- VERT_VARS_VOIDS;
-#if (IND & S3v_RAST_FLAT_BIT)
- FLAT_VARS_VOIDS;
-#else
- GOURAUD_VARS_VOIDS;
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- TEX_VARS_VOIDS;
-#endif
-
- DEBUG(("*** s3v_quad: "));
-#if (IND & S3V_RAST_CULL_BIT)
- DEBUG(("cull "));
- /* printf(""); */ /* speed trick */
-#endif
-#if (IND & S3V_RAST_FLAT_BIT)
- DEBUG(("flat "));
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- DEBUG(("tex "));
-#endif
-
- DEBUG(("***\n"));
-
-#if 0
- s3v_print_vertex(ctx, _v0);
- s3v_print_vertex(ctx, _v1);
- s3v_print_vertex(ctx, _v2);
- s3v_print_vertex(ctx, _v3);
-#endif
- s3v_translate_vertex( ctx, _v0, &temp_v[0] );
- s3v_translate_vertex( ctx, _v1, &temp_v[1] );
- s3v_translate_vertex( ctx, _v2, &temp_v[2] );
- s3v_translate_vertex( ctx, _v3, &temp_v[3] );
-
- /* FIRST TRI (0,1,2) */
-
- /* ROMEO */
- /* printf(""); */ /* speed trick (a) [turn on if (a) is return]*/
-
- v[0] = temp_v[0];
- v[1] = temp_v[1];
- v[2] = temp_v[2];
-
-#if (IND & S3V_RAST_CULL_BIT)
- cull = vmesa->backface_sign *
- ((v[1].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]) * (v[0].attrib[FRAG_ATTRIB_WPOS][1] - v[2].attrib[FRAG_ATTRIB_WPOS][1]) +
- (v[1].attrib[FRAG_ATTRIB_WPOS][1] - v[0].attrib[FRAG_ATTRIB_WPOS][1]) * (v[2].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]));
-
- if (cull < vmesa->cull_zero /* -0.02f */) goto second; /* return; */ /* (a) */
-#endif
-
-#if 0
- v[0] = temp_v[0];
- v[1] = temp_v[1];
- v[2] = temp_v[2];
-#else
- (void) v;
-#endif
- SORT_VERT();
- SET_VERT();
-
- if (dy02 == 0) goto second;
-
- SET_XY();
- SET_DIR();
- SET_Z();
-
-#if (IND & S3V_RAST_TEX_BIT)
- SET_TEX_VERT();
- SET_UVWD();
-#endif
-
-#if (IND & S3V_RAST_FLAT_BIT)
- SET_FLAT_COL();
-#else
- SET_GOURAUD_COL();
-#endif
-
-#if (IND & S3V_RAST_TEX_BIT)
- DMAOUT_CHECK(3DTRI_BASEV, 31);
- SEND_UVWD();
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#else
- DMAOUT_CHECK(3DTRI_GBX, 17);
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#endif
-
- /* SECOND TRI (0,2,3) */
-
-second:
- v[0] = temp_v[0];
- v[1] = temp_v[2];
- v[2] = temp_v[3];
-
-#if (IND & S3V_RAST_CULL_BIT)
- cull = vmesa->backface_sign *
- ((v[1].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]) * (v[0].attrib[FRAG_ATTRIB_WPOS][1] - v[2].attrib[FRAG_ATTRIB_WPOS][1]) +
- (v[1].attrib[FRAG_ATTRIB_WPOS][1] - v[0].attrib[FRAG_ATTRIB_WPOS][1]) * (v[2].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]));
-
- if (cull < /* -0.02f */ vmesa->cull_zero) return;
-#endif
-
-/* second: */
-
- /* ROMEO */
- /* printf(""); */ /* speed trick */
-
- v[0] = temp_v[0];
- v[1] = temp_v[2];
- v[2] = temp_v[3];
-
- SORT_VERT();
- SET_VERT();
-
- if (dy02 == 0) return;
-
- SET_XY();
- SET_DIR();
- SET_Z();
-
-#if (IND & S3V_RAST_TEX_BIT)
- SET_TEX_VERT();
- SET_UVWD();
-#endif
-
-#if (IND & S3V_RAST_FLAT_BIT)
- SET_FLAT_COL();
-#else
- SET_GOURAUD_COL();
-#endif
-
-#if (IND & S3V_RAST_TEX_BIT)
- DMAOUT_CHECK(3DTRI_BASEV, 31);
- SEND_UVWD();
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#else
- DMAOUT_CHECK(3DTRI_GBX, 17);
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#endif
-}
-
-static void TAG(s3v_init)(void)
-{
- s3v_point_tab[IND] = TAG(s3v_point);
- s3v_line_tab[IND] = TAG(s3v_line);
- s3v_tri_tab[IND] = TAG(s3v_triangle);
- s3v_quad_tab[IND] = TAG(s3v_quad);
-}
-
-#undef IND
-#undef TAG
diff --git a/src/mesa/drivers/dri/s3v/s3v_vb.c b/src/mesa/drivers/dri/s3v/s3v_vb.c
deleted file mode 100644
index 00e375c6c43..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_vb.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/macros.h"
-#include "main/colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/tnl.h"
-
-#include "s3v_context.h"
-#include "s3v_vb.h"
-#include "s3v_tris.h"
-
-#define S3V_XYZW_BIT 0x1
-#define S3V_RGBA_BIT 0x2
-#define S3V_TEX0_BIT 0x4
-#define S3V_PTEX_BIT 0x8
-#define S3V_FOG_BIT 0x10
-#define S3V_MAX_SETUP 0x20
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- tnl_interp_func interp;
- tnl_copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
-} setup_tab[S3V_MAX_SETUP];
-
-
-/* Only one vertex format, atm, so no need to give them names:
- */
-#define TINY_VERTEX_FORMAT 1
-#define NOTEX_VERTEX_FORMAT 0
-#define TEX0_VERTEX_FORMAT 0
-#define TEX1_VERTEX_FORMAT 0
-#define PROJ_TEX1_VERTEX_FORMAT 0
-#define TEX2_VERTEX_FORMAT 0
-#define TEX3_VERTEX_FORMAT 0
-#define PROJ_TEX3_VERTEX_FORMAT 0
-
-#define DO_XYZW (IND & S3V_XYZW_BIT)
-#define DO_RGBA (IND & S3V_RGBA_BIT)
-#define DO_SPEC 0
-#define DO_FOG (IND & S3V_FOG_BIT)
-#define DO_TEX0 (IND & S3V_TEX0_BIT)
-#define DO_TEX1 0
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & S3V_PTEX_BIT)
-
-#define VERTEX s3vVertex
-#define LOCALVARS /* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */
-#define GET_VIEWPORT_MAT() 0 /* vmesa->hw_viewport */
-#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() 0
-#define GET_VERTEX_SIZE() S3V_CONTEXT(ctx)->vertex_size * sizeof(GLuint)
-#define GET_VERTEX_STORE() S3V_CONTEXT(ctx)->verts
-#define GET_VERTEX_STRIDE_SHIFT() S3V_CONTEXT(ctx)->vertex_stride_shift
-#define INVALIDATE_STORED_VERTICES()
-#define GET_UBYTE_COLOR_STORE() &S3V_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &S3V_CONTEXT(ctx)->UbyteSecondaryColor
-
-#define HAVE_HW_VIEWPORT 1 /* FIXME */
-#define HAVE_HW_DIVIDE 1
-#define HAVE_RGBA_COLOR 0 /* we're BGRA */
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 0
-#define HAVE_TEX0_VERTICES 0
-#define HAVE_TEX1_VERTICES 0
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 1
-
-/*
-#define SUBPIXEL_X -.5
-#define SUBPIXEL_Y -.5
-#define UNVIEWPORT_VARS GLfloat h = S3V_CONTEXT(ctx)->driDrawable->h
-#define UNVIEWPORT_X(x) x - SUBPIXEL_X
-#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y
-#define UNVIEWPORT_Z(z) z / vmesa->depth_scale
-*/
-
-#define PTEX_FALLBACK() /* never needed */
-
-#define IMPORT_QUALIFIER
-#define IMPORT_FLOAT_COLORS s3v_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS s3v_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[S3V_CONTEXT(ctx)->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[S3V_CONTEXT(ctx)->SetupIndex].copy_pv
-
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) s3v_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_TEX0_BIT|S3V_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_RGBA_BIT|S3V_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_FOG_BIT|S3V_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_FOG_BIT|S3V_TEX0_BIT|S3V_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_RGBA_BIT | S3V_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_RGBA_BIT | S3V_FOG_BIT | S3V_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-static void init_setup_tab( void )
-{
- init_wg(); /* pos + col */
- init_wgt0(); /* pos + col + tex0 */
- init_wgpt0(); /* pos + col + p-tex0 (?) */
- init_t0(); /* tex0 */
- init_g(); /* col */
- init_gt0(); /* col + tex */
- init_wgf();
- init_wgft0();
- init_wgfpt0();
- init_f();
- init_gf();
- init_gft0();
-}
-
-
-#if 0
-void s3vPrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & S3V_XYZW_BIT) ? " xyzw," : "",
- (flags & S3V_RGBA_BIT) ? " rgba," : "",
- (flags & S3V_SPEC_BIT) ? " spec," : "",
- (flags & S3V_FOG_BIT) ? " fog," : "",
- (flags & S3V_TEX0_BIT) ? " tex-0," : "",
- (flags & S3V_TEX1_BIT) ? " tex-1," : "");
-}
-#endif
-
-
-void s3vCheckTexSizes( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
-
- if (!setup_tab[vmesa->SetupIndex].check_tex_sizes(ctx)) {
-
- vmesa->SetupIndex |= (S3V_PTEX_BIT|S3V_RGBA_BIT);
-
- if (1 || !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[vmesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[vmesa->SetupIndex].copy_pv;
- }
- }
-}
-
-void s3vBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)vmesa->verts +
- (start<<vmesa->vertex_stride_shift));
- GLuint stride = 1<<vmesa->vertex_stride_shift;
-
- DEBUG(("*** s3vBuildVertices ***\n"));
- DEBUG(("vmesa->SetupNewInputs = 0x%x\n", vmesa->SetupNewInputs));
- DEBUG(("vmesa->SetupIndex = 0x%x\n", vmesa->SetupIndex));
-
-#if 1
- setup_tab[vmesa->SetupIndex].emit( ctx, start, count, v, stride );
-#else
- newinputs |= vmesa->SetupNewInputs;
- vmesa->SetupNewInputs = 0;
-
- DEBUG(("newinputs is 0x%x\n", newinputs));
-
- if (!newinputs) {
- DEBUG(("!newinputs\n"));
- return;
- }
-
- if (newinputs & VERT_CLIP) {
- setup_tab[vmesa->SetupIndex].emit( ctx, start, count, v, stride );
- DEBUG(("newinputs & VERT_CLIP\n"));
- return;
- } /* else { */
-/* GLuint ind = 0; */
-
- if (newinputs & VERT_RGBA) {
- DEBUG(("newinputs & VERT_RGBA\n"));
- ind |= S3V_RGBA_BIT;
- }
-
- if (newinputs & VERT_TEX0) {
- DEBUG(("newinputs & VERT_TEX0\n"));
- ind |= S3V_TEX0_BIT;
- }
-
- if (newinputs & VERT_FOG_COORD)
- ind |= S3V_FOG_BIT;
-
- if (vmesa->SetupIndex & S3V_PTEX_BIT)
- ind = ~0;
-
- ind &= vmesa->SetupIndex;
-
- DEBUG(("vmesa->SetupIndex = 0x%x\n", vmesa->SetupIndex));
- DEBUG(("ind = 0x%x\n", ind));
- DEBUG(("ind & vmesa->SetupIndex = 0x%x\n", (ind & vmesa->SetupIndex)));
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
-#endif
-}
-
-void s3vChooseVertexState( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- GLuint ind = S3V_XYZW_BIT | S3V_RGBA_BIT;
-
- /* FIXME: will segv in tnl_dd/t_dd_vbtmp.h (line 196) on some demos */
-/*
- if (ctx->Fog.Enabled)
- ind |= S3V_FOG_BIT;
-*/
-
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- _tnl_need_projected_coords( ctx, GL_FALSE );
- ind |= S3V_TEX0_BIT;
- } else {
- _tnl_need_projected_coords( ctx, GL_TRUE );
- }
-
- vmesa->SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = s3v_interp_extras;
- tnl->Driver.Render.CopyPV = s3v_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-}
-
-
-void s3vInitVB( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- vmesa->verts = (char *)ALIGN_MALLOC(size * 4 * 16, 32);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- vmesa->vertex_stride_shift = 6 /* 4 */; /* FIXME - only one vertex setup */
- }
- }
-}
-
-
-void s3vFreeVB( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- if (vmesa->verts) {
- ALIGN_FREE(vmesa->verts);
- vmesa->verts = 0;
- }
-
- if (vmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE((void *)vmesa->UbyteSecondaryColor.Ptr);
- vmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (vmesa->UbyteColor.Ptr) {
- ALIGN_FREE((void *)vmesa->UbyteColor.Ptr);
- vmesa->UbyteColor.Ptr = 0;
- }
-}
diff --git a/src/mesa/drivers/dri/s3v/s3v_vb.h b/src/mesa/drivers/dri/s3v/s3v_vb.h
deleted file mode 100644
index 0fd54373805..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_vb.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef S3VVB_INC
-#define S3VVB_INC
-
-#include "main/mtypes.h"
-#include "swrast/swrast.h"
-
-#define _S3V_NEW_VERTEX (_NEW_TEXTURE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE)
-
-
-extern void s3vChooseVertexState( GLcontext *ctx );
-extern void s3vCheckTexSizes( GLcontext *ctx );
-extern void s3vBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-
-
-extern void s3v_import_float_colors( GLcontext *ctx );
-extern void s3v_import_float_spec_colors( GLcontext *ctx );
-
-extern void s3v_translate_vertex( GLcontext *ctx,
- const s3vVertex *src,
- SWvertex *dst );
-
-extern void s3vInitVB( GLcontext *ctx );
-extern void s3vFreeVB( GLcontext *ctx );
-
-extern void s3v_print_vertex( GLcontext *ctx, const s3vVertex *v );
-#if 0
-extern void s3vPrintSetupFlags(char *msg, GLuint flags );
-#endif
-
-#endif
diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c
deleted file mode 100644
index 85f14817696..00000000000
--- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-#include "s3v_vb.h"
-#include "s3v_dri.h"
-#include "main/context.h"
-#include "main/matrix.h"
-#include "main/framebuffer.h"
-#include "main/renderbuffer.h"
-#include "main/viewport.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "vbo/vbo.h"
-
-/* #define DEBUG(str) printf str */
-
-static const __DRIconfig **
-s3vInitScreen(__DRIscreen *sPriv)
-{
- sPriv->private = (void *) s3vCreateScreen( sPriv );
-
- if (!sPriv->private) {
- s3vDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return NULL;
-}
-
-static void
-s3vDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- s3vContextPtr vmesa = (s3vContextPtr)driContextPriv->driverPrivate;
-
- if (vmesa) {
- _swsetup_DestroyContext( vmesa->glCtx );
- _tnl_DestroyContext( vmesa->glCtx );
- _vbo_DestroyContext( vmesa->glCtx );
- _swrast_DestroyContext( vmesa->glCtx );
-
- s3vFreeVB( vmesa->glCtx );
-
- /* free the Mesa context */
- vmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(vmesa->glCtx);
-
- _mesa_free(vmesa);
- driContextPriv->driverPrivate = NULL;
- }
-}
-
-
-static GLboolean
-s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- s3vScreenPtr screen = (s3vScreenPtr) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp,
- screen->frontOffset, screen->frontPitch,
- driDrawPriv);
- s3vSetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp,
- screen->backOffset, screen->backPitch,
- driDrawPriv);
- s3vSetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- backRb->backBuffer = GL_TRUE;
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp,
- screen->depthOffset, screen->depthPitch,
- driDrawPriv);
- s3vSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp,
- screen->depthOffset, screen->depthPitch,
- driDrawPriv);
- s3vSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- /* no h/w stencil yet?
- if (mesaVis->stencilBits > 0) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL,
- screen->cpp, screen->depthOffset,
- screen->depthPitch, driDrawPriv);
- s3vSetSpanFunctions(stencilRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
- }
- */
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- GL_FALSE, /* depth */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-s3vDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
-}
-
-static void
-s3vSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
-{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
- __DRIscreenPrivate *sPriv;
- GLcontext *ctx;
- s3vContextPtr vmesa;
- s3vScreenPtr s3vscrn;
-
- vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate;
- sPriv = vmesa->driScreen;
- s3vscrn = vmesa->s3vScreen;
- ctx = vmesa->glCtx;
-
- DEBUG(("*** s3vSwapBuffers ***\n"));
-
-/* DMAFLUSH(); */
-
- _mesa_notifySwapBuffers( ctx );
-
- vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate;
-/* driScrnPriv = vmesa->driScreen; */
-
-/* if (vmesa->EnabledFlags & S3V_BACK_BUFFER) */
-
-/* _mesa_notifySwapBuffers( ctx ); */
-#if 1
-{
- int x0, y0, x1, y1;
-/*
- int nRect = dPriv->numClipRects;
- XF86DRIClipRectPtr pRect = dPriv->pClipRects;
-
- __DRIscreenPrivate *driScrnPriv = vmesa->driScreen;
-*/
-
-/*
- DEBUG(("s3vSwapBuffers: S3V_BACK_BUFFER = 1 - nClip = %i\n", nRect));
-*/
-/* vmesa->drawOffset=vmesa->s3vScreen->backOffset; */
-
- x0 = dPriv->x;
- y0 = dPriv->y;
-
- x1 = x0 + dPriv->w - 1;
- y1 = y0 + dPriv->h - 1;
-
- DMAOUT_CHECK(BITBLT_SRC_BASE, 15);
- DMAOUT(vmesa->s3vScreen->backOffset);
- DMAOUT(0); /* 0xc0000000 */
- DMAOUT( ((x0 << 16) | x1) );
- DMAOUT( ((y0 << 16) | y1) );
- DMAOUT( (vmesa->DestStride << 16) | vmesa->SrcStride );
- DMAOUT( (~(0)) );
- DMAOUT( (~(0)) );
- DMAOUT(0);
- DMAOUT(0);
- /* FIXME */
- DMAOUT(0);
- DMAOUT(0);
- DMAOUT( (0x01 | /* Autoexecute */
- 0x02 | /* clip */
- 0x04 | /* 16 bit */
- 0x20 | /* draw */
- 0x400 | /* word alignment (bit 10=1) */
- (0x2 << 11) | /* offset = 1 byte */
- (0xCC << 17) | /* rop #204 */
- (0x3 << 25)) ); /* l-r, t-b */
- DMAOUT(vmesa->ScissorWH);
- DMAOUT( /* 0 */ vmesa->SrcXY );
- DMAOUT( (dPriv->x << 16) | dPriv->y );
- DMAFINISH();
-
- DMAFLUSH();
-
- vmesa->restore_primitive = -1;
-
-}
-#endif
-}
-
-static GLboolean
-s3vMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- int x1,x2,y1,y2;
- int cx, cy, cw, ch;
- unsigned int src_stride, dest_stride;
- int cl;
-
- s3vContextPtr vmesa;
- __DRIdrawablePrivate *dPriv = driDrawPriv;
- vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate;
-
- DEBUG(("s3vMakeCurrent\n"));
-
- DEBUG(("dPriv->x=%i y=%i w=%i h=%i\n", dPriv->x, dPriv->y,
- dPriv->w, dPriv->h));
-
- if (driContextPriv) {
- GET_CURRENT_CONTEXT(ctx);
- s3vContextPtr oldVirgeCtx = ctx ? S3V_CONTEXT(ctx) : NULL;
- s3vContextPtr newVirgeCtx = (s3vContextPtr) driContextPriv->driverPrivate;
-
- if ( newVirgeCtx != oldVirgeCtx ) {
-
- newVirgeCtx->dirty = ~0;
- cl = 1;
- DEBUG(("newVirgeCtx != oldVirgeCtx\n"));
-/* s3vUpdateClipping(newVirgeCtx->glCtx ); */
- }
-
- if (newVirgeCtx->driDrawable != driDrawPriv) {
- newVirgeCtx->driDrawable = driDrawPriv;
- DEBUG(("driDrawable != driDrawPriv\n"));
- s3vUpdateWindow ( newVirgeCtx->glCtx );
- s3vUpdateViewportOffset( newVirgeCtx->glCtx );
-/* s3vUpdateClipping(newVirgeCtx->glCtx ); */
- }
-/*
- s3vUpdateWindow ( newVirgeCtx->glCtx );
- s3vUpdateViewportOffset( newVirgeCtx->glCtx );
-*/
-
-/*
- _mesa_make_current( newVirgeCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- _mesa_set_viewport(newVirgeCtx->glCtx, 0, 0,
- newVirgeCtx->driDrawable->w,
- newVirgeCtx->driDrawable->h);
-*/
-
-#if 0
- newVirgeCtx->Window &= ~W_GIDMask;
- newVirgeCtx->Window |= (driDrawPriv->index << 5);
- CHECK_DMA_BUFFER(newVirgeCtx,1);
- WRITE(newVirgeCtx->buf, S3VWindow, newVirgeCtx->Window);
-#endif
-
- newVirgeCtx->new_state |= S3V_NEW_WINDOW; /* FIXME */
-
- _mesa_make_current( newVirgeCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- if (!newVirgeCtx->glCtx->Viewport.Width) {
- _mesa_set_viewport(newVirgeCtx->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
-
-/* s3vUpdateClipping(newVirgeCtx->glCtx ); */
- }
-
-/*
- if (cl) {
- s3vUpdateClipping(newVirgeCtx->glCtx );
- cl =0;
- }
-*/
-
- newVirgeCtx->new_state |= S3V_NEW_CLIP;
-
- if (1) {
- cx = dPriv->x;
- cw = dPriv->w;
- cy = dPriv->y;
- ch = dPriv->h;
- }
-
- x1 = y1 = 0;
- x2 = cw-1;
- y2 = ch-1;
-
- /* src_stride = vmesa->s3vScreen->w * vmesa->s3vScreen->cpp;
- dest_stride = ((x2+31)&~31) * vmesa->s3vScreen->cpp; */
- src_stride = vmesa->driScreen->fbWidth * 2;
- dest_stride = ((x2+31)&~31) * 2;
- } else {
- _mesa_make_current( NULL, NULL, NULL );
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-s3vUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-const struct __DriverAPIRec driDriverAPI = {
- .InitScreen = s3vInitScreen,
- .DestroyScreen = s3vDestroyScreen,
- .CreateContext = s3vCreateContext,
- .DestroyContext = s3vDestroyContext,
- .CreateBuffer = s3vCreateBuffer,
- .DestroyBuffer = s3vDestroyBuffer,
- .SwapBuffers = s3vSwapBuffers,
- .MakeCurrent = s3vMakeCurrent,
- .UnbindContext = s3vUnbindContext,
-};
diff --git a/src/mesa/drivers/dri/s3v/s3virgetri.h b/src/mesa/drivers/dri/s3v/s3virgetri.h
deleted file mode 100644
index 5519cfd7416..00000000000
--- a/src/mesa/drivers/dri/s3v/s3virgetri.h
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#define LOCAL_VARS \
- int vert0, vert1, vert2; \
- GLfloat y0, y1, y2, ydiff; \
- int iy0, iy1, iy2; \
- int x0, x1, x2, z0, z1, z2; \
- int dy01, dy02, dy12, dx01, dx02, dx12; \
- int delt02, delt01, delt12, end01, end12, start02; \
- int zstart, arstart, gbstart; \
- int deltzy, deltzx, deltarx, deltgbx, deltary, deltgby; \
- GLubyte (*colours)[4]; \
- GLubyte (*scolours)[4]; \
- static int tp = 0; \
- int tmp, lr
-
-#define LOCAL_TEX_VARS \
- int u0, u1, u2; \
- GLfloat ru0, ru1, ru2; \
- int v0, v1, v2; \
- GLfloat rv0, rv1, rv2; \
- GLfloat w0, w1, w2; \
- GLfloat rw0, rw1, rw2; \
- int baseu, basev; \
- int d0, d1, d2; \
- int deltdx, deltvx, deltux, deltdy, deltvy, deltuy; \
- int deltwx, deltwy; \
- int rbaseu, rbasev; \
- int dstart, ustart, wstart, vstart; \
- static int stmp = 0; \
- s3virgeTextureObject_t *t
-
-#define CULL_BACKFACE() \
- do { \
- GLfloat *w0 = VB->Win.data[e0]; \
- GLfloat *w1 = VB->Win.data[e1]; \
- GLfloat *w2 = VB->Win.data[e2]; \
- float cull; \
- cull = ctx->backface_sign * ((w1[0] - w0[0]) * (w0[1] - w2[1]) + \
- (w1[1] - w0[1]) * (w2[0] - w0[0])); \
- if (cull < 0) \
- return; \
- } while (0)
-
-#define SORT_VERTICES() \
- do { \
- y0 = VB->Win.data[e0][1]; \
- y1 = VB->Win.data[e1][1]; \
- y2 = VB->Win.data[e2][1]; \
- if (y1 > y0) { \
- if (y2 > y0) { \
- vert0 = e0; \
- if (y1 > y2) { vert2 = e1; vert1 = e2; } else { vert2 = e2; vert1 = e1; } \
- } else { vert0 = e2; vert1 = e0; vert2 = e1; } \
- } else { \
- if (y2 > y0) { vert0 = e1; vert1 = e0; vert2 = e2; } else { \
- vert2 = e0; \
- if (y2 > y1) { vert0 = e1; vert1 = e2; } else { vert0 = e2; vert1 = e1; } \
- } \
- } \
- } while (0)
-
-#define SET_VARIABLES() \
- do { \
- iy0 = y0 = ((s3virgeDB->height - (VB->Win.data[vert0][1]))); \
- iy1 = y1 = ((s3virgeDB->height - (VB->Win.data[vert1][1]))); \
- iy2 = y2 = ((s3virgeDB->height - (VB->Win.data[vert2][1]))); \
- if (iy0 == iy2) { return; } \
- ydiff = y0 - (float)iy0; \
- x0 = ((VB->Win.data[vert0][0]) * 1024.0 * 1024.0); \
- x1 = ((VB->Win.data[vert1][0]) * 1024.0 * 1024.0); \
- x2 = ((VB->Win.data[vert2][0]) * 1024.0 * 1024.0); \
- z0 = (VB->Win.data[vert0][2] * 1024.0 * 32.0); \
- z1 = (VB->Win.data[vert1][2] * 1024.0 * 32.0); \
- z2 = (VB->Win.data[vert2][2] * 1024.0 * 32.0); \
- dx12 = x2 - x1; \
- dy12 = iy1 - iy2; \
- dx01 = x1 - x0; \
- dy01 = iy0 - iy1; \
- dx02 = x2 - x0; \
- dy02 = iy0 - iy2; \
- delt12 = delt02 = delt01 = 0; \
- } while (0)
-
-#define SET_TEX_VARIABLES() \
- do { \
- t = ((s3virgeTextureObject_t *)ctx->Texture.Unit[0].Current->DriverData); \
- deltwx = deltwy = wstart = deltdx = deltdy = dstart = 0; \
- u0 = (VB->TexCoordPtr[0]->data[vert0][0] * (GLfloat)(t->tObj->Image[0]->Width) * 256.0); \
- u1 = (VB->TexCoordPtr[0]->data[vert1][0] * (GLfloat)(t->tObj->Image[0]->Width) * 256.0); \
- u2 = (VB->TexCoordPtr[0]->data[vert2][0] * (GLfloat)(t->tObj->Image[0]->Width) * 256.0); \
- v0 = (VB->TexCoordPtr[0]->data[vert0][1] * (GLfloat)(t->tObj->Image[0]->Height) * 256.0); \
- v1 = (VB->TexCoordPtr[0]->data[vert1][1] * (GLfloat)(t->tObj->Image[0]->Height) * 256.0); \
- v2 = (VB->TexCoordPtr[0]->data[vert2][1] * (GLfloat)(t->tObj->Image[0]->Height) * 256.0); \
- w0 = (VB->Win.data[vert0][3]); \
- w1 = (VB->Win.data[vert1][3]); \
- w2 = (VB->Win.data[vert2][3]); \
- } while (0)
-
-#define FLATSHADE_COLORS() \
- do { \
- GLubyte *col = &(colours[pv][0]); \
- deltarx = deltary = deltgbx = deltgby = 0; \
- gbstart = (((col[1]) << 23) | ((col[2]) << 7)); \
- arstart = (((col[3]) << 23) | ((col[0]) << 7)); \
- } while (0)
-
-#define GOURAUD_COLORS() \
- do { \
- int ctmp, ctmp2, ctmp3, ctmp4; \
- GLubyte *col0, *col1, *col2; \
- col0 = &(colours[vert0][0]); \
- col1 = &(colours[vert1][0]); \
- col2 = &(colours[vert2][0]); \
- ctmp = ((col2[3] - col0[3]) << 7) / dy02; \
- ctmp2 = ((col2[0] - col0[0]) << 7) / dy02; \
- deltary = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \
- ctmp3 = ((col2[1] - col0[1]) << 7) / dy02; \
- ctmp4 = ((col2[2] - col0[2]) << 7) / dy02; \
- deltgby = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \
- gbstart = (((int)((ydiff * ctmp3) + (col0[1] << 7)) << 16) & 0x7FFF0000) | \
- ((int)((ydiff * ctmp4) + (col0[2] << 7)) & 0x7FFF); \
- arstart = (((int)((ydiff * ctmp) + (col0[3] << 7)) << 16) & 0x7FFF0000) | \
- ((int)((ydiff * ctmp2) + (col0[0] << 7)) & 0x7FFF); \
- if (tmp) { \
- int ax, rx, gx, bx; \
- ax = ((col1[3] << 7) - (dy01 * ctmp + (col0[3] << 7))) / tmp; \
- rx = ((col1[0] << 7) - (dy01 * ctmp2 + (col0[0] << 7))) / tmp; \
- gx = ((col1[1] << 7) - (dy01 * ctmp3 + (col0[1] << 7))) / tmp; \
- bx = ((col1[2] << 7) - (dy01 * ctmp4 + (col0[2] << 7))) / tmp; \
- deltarx = ((ax << 16) & 0xFFFF0000) | (rx & 0xFFFF); \
- deltgbx = ((gx << 16) & 0xFFFF0000) | (bx & 0xFFFF); \
- } else { \
- deltgbx = deltarx = 0; \
- } \
- } while (0)
-
-#define SET_XY() \
- do { \
- delt02 = dx02 / dy02; \
- if (dy12) delt12 = dx12 / dy12; \
- if (dy01) delt01 = dx01 / dy01; \
- start02 = (ydiff * delt02) + x0; \
- end01 = (ydiff * delt01) + x0; \
- end12 = ((y1 - (GLfloat)iy1) * delt12) + x1; \
- } while (0)
-
-#define SET_DIR() \
- do { \
- tmp = x1 - (dy01 * delt02 + x0); \
- if (tmp > 0) { \
- lr = 0x80000000; \
- } else { \
- tmp *= -1; \
- lr = 0; \
- } \
- tmp >>= 20; \
- } while (0)
-
-#define SET_Z() \
- do { \
- deltzy = (z2 - z0) / dy02; \
- if (tmp) { \
- deltzx = (z1 - (dy01 * deltzy + z0)) / tmp; \
- } else { deltzx = 0; } \
- zstart = (deltzy * ydiff) + z0; \
- } while (0)
-
-#define SET_BASEUV() \
- do { \
- if (u0 < u1) { \
- if (u0 < u2) { \
- baseu = u0; \
- } else { \
- baseu = u2; \
- } \
- } else { \
- if (u1 < u2) { \
- baseu = u1; \
- } else { \
- baseu = u2; \
- } \
- } \
- if (v0 < v1) { \
- if (v0 < v2) { \
- basev = v0; \
- } else { \
- basev = v2; \
- } \
- } else { \
- if (v1 < v2) { \
- basev = v1; \
- } else { \
- basev = v2; \
- } \
- } \
- } while (0)
-
-#define SET_RW() \
- do { \
- /* GLfloat minW; \
- if (w0 < w1) { \
- if (w0 < w2) { \
- minW = w0; \
- } else { \
- minW = w2; \
- } \
- } else { \
- if (w1 < w2) { \
- minW = w1; \
- } else { \
- minW = w2; \
- } \
- } */ \
- rw0 = (512.0 * w0); \
- rw1 = (512.0 * w1); \
- rw2 = (512.0 * w2); \
- } while (0)
-
-
-#define SET_D() \
- do { \
- GLfloat sxy, suv; \
- int lev; \
- suv = (VB->TexCoordPtr[0]->data[vert0][0] - \
- VB->TexCoordPtr[0]->data[vert2][0]) * \
- (VB->TexCoordPtr[0]->data[vert1][1] - \
- VB->TexCoordPtr[0]->data[vert2][1]) - \
- (VB->TexCoordPtr[0]->data[vert1][0] - \
- VB->TexCoordPtr[0]->data[vert2][0]) * \
- (VB->TexCoordPtr[0]->data[vert0][1] - \
- VB->TexCoordPtr[0]->data[vert2][2]); \
- sxy = (VB->Win.data[vert0][0] - \
- VB->Win.data[vert2][0]) * \
- (VB->Win.data[vert1][1] - \
- VB->Win.data[vert2][1]) - \
- (VB->Win.data[vert1][0] - \
- VB->Win.data[vert2][0]) * \
- (VB->Win.data[vert0][1] - \
- VB->Win.data[vert2][2]); \
- if (sxy < 0) sxy *= -1.0; \
- if (suv < 0) suv *= -1.0; \
- lev = *(int*)&suv - *(int *)&sxy; \
- if (lev < 0) \
- lev = 0; \
- else \
- lev >>=23; \
- dstart = (lev << 27); \
- } while (0)
-
-
-
-#define SET_UVWD() \
- do { \
- SET_BASEUV(); \
- SET_RW(); \
- SET_D(); \
- ru0 = (((u0 - baseu) * rw0)); \
- ru1 = (((u1 - baseu) * rw1)); \
- ru2 = (((u2 - baseu) * rw2)); \
- rv0 = (((v0 - basev) * rw0)); \
- rv1 = (((v1 - basev) * rw1)); \
- rv2 = (((v2 - basev) * rw2)); \
- while (baseu < 0) { baseu += (t->tObj->Image[0]->Width << 8); } \
- while (basev < 0) { basev += (t->tObj->Image[0]->Height << 8); } \
- if (!(baseu & 0xFF)) { baseu = (baseu >> 8); } else { baseu = (baseu >> 8) + 1; } \
- if ((basev & 0x80) || !(basev & 0xFF)) { basev = (basev >> 8); } else { basev = (basev >> 8) - 1; } \
- rbaseu = (baseu) << (16 - t->widthLog2); \
- rbasev = (basev) << (16 - t->widthLog2); \
- deltuy = (((ru2 - ru0) / dy02)); \
- deltvy = (((rv2 - rv0) / dy02)); \
- rw0 *= (1024.0 * 512.0); \
- rw1 *= (1024.0 * 512.0); \
- rw2 *= (1024.0 * 512.0); \
- deltwy = ((rw2 - rw0) / dy02); \
- if (tmp) { \
- deltux = ((ru1 - (dy01 * deltuy + ru0)) / tmp); \
- deltvx = ((rv1 - (dy01 * deltvy + rv0)) / tmp); \
- deltwx = ((rw1 - (dy01 * deltwy + rw0)) / tmp); \
- } else { deltux = deltvx = deltwx = 0; } \
- ustart = (deltuy * ydiff) + (ru0); \
- vstart = (deltvy * ydiff) + (rv0); \
- wstart = (deltwy * ydiff) + (rw0); \
- } while (0)
-
-
-#define SEND_COLORS() \
- do { \
- WAITFIFOEMPTY(6); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_GBX), deltgbx); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ARX), deltarx); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_GBY), deltgby); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ARY), deltary); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_GS_BS), gbstart); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_AS_RS), arstart); \
- } while (0)
-
-#define SEND_VERTICES() \
- do { \
- WAITFIFOEMPTY(6); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ZSTART), zstart); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ZXD), deltzx); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ZYD), deltzy); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXDELTA12), delt12); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXEND12), end12); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXDELTA01), delt01); \
- WAITFIFOEMPTY(5); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXEND01), end01); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXDELTA02), delt02); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXSTART02), start02); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TYS), iy0); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TY01_Y12), \
- ((((iy0 - iy1) & 0x7FF) << 16) | \
- ((iy1 - iy2) & 0x7FF) | lr)); \
- } while (0)
-
-#define SEND_UVWD() \
- do { \
- WAITFIFOEMPTY(7); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_BASEV), (rbasev & 0xFFFF)); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_BASEU), (0xa0000000 | (rbaseu & 0xFFFF))); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_WXD), deltwx); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_WYD), deltwy); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_WSTART), wstart); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_DXD), deltdx); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_VXD), deltvx); \
- WAITFIFOEMPTY(7); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_UXD), deltux); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_DYD), deltdy); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_VYD), deltvy); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_UYD), deltuy); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_DSTART), dstart); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_VSTART), vstart); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_USTART), ustart); \
- } while (0)
-
-#define DMA_SEND_UVWD() \
- do { \
- DMAOUT((rbasev & 0xFFFF)); \
- DMAOUT((0xa0000000 | (rbaseu & 0xFFFF))); \
- DMAOUT(deltwx); \
- DMAOUT(deltwy); \
- DMAOUT(wstart); \
- DMAOUT(deltdx); \
- DMAOUT(deltvx); \
- DMAOUT(deltux); \
- DMAOUT(deltdy); \
- DMAOUT(deltvy); \
- DMAOUT(deltuy); \
- DMAOUT(dstart); \
- DMAOUT(vstart); \
- DMAOUT(ustart); \
- } while (0)
-
-
-#define DMA_SEND_COLORS() \
- do { \
- DMAOUT(deltgbx); \
- DMAOUT(deltarx); \
- DMAOUT(deltgby); \
- DMAOUT(deltary); \
- DMAOUT(gbstart); \
- DMAOUT(arstart); \
- } while (0)
-
-#define DMA_SEND_VERTICES() \
- do { \
- DMAOUT(deltzx); \
- DMAOUT(deltzy); \
- DMAOUT(zstart); \
- DMAOUT(delt12); \
- DMAOUT(end12); \
- DMAOUT(delt01); \
- DMAOUT(end01); \
- DMAOUT(delt02); \
- DMAOUT(start02); \
- DMAOUT(iy0); \
- DMAOUT(((((iy0 - iy1) & 0x7FF) << 16) | \
- ((iy1 - iy2) & 0x7FF) | lr)); \
- } while (0)
-
diff --git a/src/mesa/drivers/dri/savage/Makefile b/src/mesa/drivers/dri/savage/Makefile
index 018482f66be..2e5c40802c1 100644
--- a/src/mesa/drivers/dri/savage/Makefile
+++ b/src/mesa/drivers/dri/savage/Makefile
@@ -27,4 +27,3 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/sis/Makefile b/src/mesa/drivers/dri/sis/Makefile
index d2354e67764..ad009fc2398 100644
--- a/src/mesa/drivers/dri/sis/Makefile
+++ b/src/mesa/drivers/dri/sis/Makefile
@@ -34,4 +34,3 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/swrast/Makefile b/src/mesa/drivers/dri/swrast/Makefile
index 5f3a4f2191b..771169c1ff9 100644
--- a/src/mesa/drivers/dri/swrast/Makefile
+++ b/src/mesa/drivers/dri/swrast/Makefile
@@ -21,4 +21,3 @@ SWRAST_COMMON_SOURCES = \
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/tdfx/Makefile b/src/mesa/drivers/dri/tdfx/Makefile
index 092c580feac..b9f25db4fe8 100644
--- a/src/mesa/drivers/dri/tdfx/Makefile
+++ b/src/mesa/drivers/dri/tdfx/Makefile
@@ -32,6 +32,4 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
-
diff --git a/src/mesa/drivers/dri/trident/Makefile b/src/mesa/drivers/dri/trident/Makefile
deleted file mode 100644
index 9ee24c504c1..00000000000
--- a/src/mesa/drivers/dri/trident/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# src/mesa/drivers/dri/trident/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = trident_dri.so
-
-# Not yet
-# MINIGLX_SOURCES = server/trident_dri.c
-
-DRIVER_SOURCES = \
- trident_context.c \
- trident_state.c \
- trident_vb.c \
- trident_dd.c \
- trident_tris.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-include ../Makefile.template
-
-symlinks:
diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c
deleted file mode 100644
index b5126b07ea6..00000000000
--- a/src/mesa/drivers/dri/trident/trident_context.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-#include "trident_dri.h"
-#include "trident_context.h"
-#include "trident_lock.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "vbo/vbo.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "main/context.h"
-#include "main/simple_list.h"
-#include "main/matrix.h"
-#include "main/extensions.h"
-#include "main/framebuffer.h"
-#include "main/renderbuffer.h"
-#include "main/viewport.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-#include "main/simple_list.h"
-#include "main/mm.h"
-#include "drirenderbuffer.h"
-
-#include "drivers/common/driverfuncs.h"
-#include "dri_util.h"
-#include "utils.h"
-
-static const struct tnl_pipeline_stage *trident_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_render_stage,
- 0,
-};
-
-
-static GLboolean
-tridentCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- tridentContextPtr tmesa;
- tridentScreenPtr tridentscrn;
- struct dd_function_table functions;
-#if 0
- drm_trident_sarea_t *saPriv=(drm_trident_sarea_t *)(((char*)sPriv->pSAREA)+
- sizeof(XF86DRISAREARec));
-#endif
-
- tmesa = (tridentContextPtr) CALLOC( sizeof(*tmesa) );
- if ( !tmesa ) return GL_FALSE;
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((tridentContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
-
- _mesa_init_driver_functions(&functions);
-
- tmesa->glCtx =
- _mesa_create_context(glVisual, shareCtx, &functions, (void *)tmesa);
-
- if (!tmesa->glCtx) {
- FREE(tmesa);
- return GL_FALSE;
- }
-
- tmesa->driContext = driContextPriv;
- tmesa->driScreen = sPriv;
- tmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */
-
- tmesa->hHWContext = driContextPriv->hHWContext;
- tmesa->driHwLock = (drmLock *)&sPriv->pSAREA->lock;
- tmesa->driFd = sPriv->fd;
-#if 0
- tmesa->sarea = saPriv;
-#endif
-
- tridentscrn = tmesa->tridentScreen = (tridentScreenPtr)(sPriv->private);
-
- ctx = tmesa->glCtx;
-
- ctx->Const.MaxTextureLevels = 13; /* 4K by 4K? Is that right? */
- ctx->Const.MaxTextureUnits = 1; /* Permedia 3 */
-
- ctx->Const.MinLineWidth = 0.0;
- ctx->Const.MaxLineWidth = 255.0;
-
- ctx->Const.MinLineWidthAA = 0.0;
- ctx->Const.MaxLineWidthAA = 65536.0;
-
- ctx->Const.MinPointSize = 0.0;
- ctx->Const.MaxPointSize = 255.0;
-
- ctx->Const.MinPointSizeAA = 0.5; /* 4x4 quality mode */
- ctx->Const.MaxPointSizeAA = 16.0;
- ctx->Const.PointSizeGranularity = 0.25;
-
- ctx->Const.MaxDrawBuffers = 1;
-
-#if 0
- tmesa->texHeap = mmInit( 0, tmesa->tridentScreen->textureSize );
-
- make_empty_list(&tmesa->TexObjList);
- make_empty_list(&tmesa->SwappedOut);
-
- tmesa->CurrentTexObj[0] = 0;
- tmesa->CurrentTexObj[1] = 0; /* Permedia 3, second texture */
-
- tmesa->RenderIndex = ~0;
-#endif
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _vbo_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, trident_pipeline );
-
- /* Configure swrast to match hardware characteristics:
- */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
- tridentInitVB( ctx );
- tridentDDInitExtensions( ctx );
- tridentDDInitDriverFuncs( ctx );
- tridentDDInitStateFuncs( ctx );
-#if 0
- tridentDDInitSpanFuncs( ctx );
- tridentDDInitTextureFuncs( ctx );
-#endif
- tridentDDInitTriFuncs( ctx );
- tridentDDInitState( tmesa );
-
- driContextPriv->driverPrivate = (void *)tmesa;
-
- UNLOCK_HARDWARE(tmesa);
-
- return GL_TRUE;
-}
-
-static void
-tridentDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- tridentContextPtr tmesa = (tridentContextPtr)driContextPriv->driverPrivate;
-
- if (tmesa) {
- _swsetup_DestroyContext( tmesa->glCtx );
- _tnl_DestroyContext( tmesa->glCtx );
- _vbo_DestroyContext( tmesa->glCtx );
- _swrast_DestroyContext( tmesa->glCtx );
-
- /* free the Mesa context */
- tmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(tmesa->glCtx);
-
- _mesa_free(tmesa);
- driContextPriv->driverPrivate = NULL;
- }
-}
-
-
-static GLboolean
-tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- tridentScreenPtr screen = (tridentScreenPtr) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp,
- screen->frontOffset, screen->frontPitch,
- driDrawPriv);
- /*
- tridentSetSpanFunctions(frontRb, mesaVis);
- */
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp,
- screen->backOffset, screen->backPitch,
- driDrawPriv);
- /*
- tridentSetSpanFunctions(backRb, mesaVis);
- */
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp,
- screen->depthOffset, screen->depthPitch,
- driDrawPriv);
- /*
- tridentSetSpanFunctions(depthRb, mesaVis);
- */
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp,
- screen->depthOffset, screen->depthPitch,
- driDrawPriv);
- /*
- tridentSetSpanFunctions(depthRb, mesaVis);
- */
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- /* no h/w stencil?
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT);
- tridentSetSpanFunctions(stencilRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
- }
- */
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- GL_FALSE, /* depth */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-tridentDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
-}
-
-static void
-tridentSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
-{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
-
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- tridentContextPtr tmesa;
- GLcontext *ctx;
- tmesa = (tridentContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = tmesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- tridentCopyBuffer( dPriv );
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "tridentSwapBuffers: drawable has no context!\n");
- }
-}
-
-static GLboolean
-tridentMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (driContextPriv) {
- GET_CURRENT_CONTEXT(ctx);
- tridentContextPtr oldCtx = ctx ? TRIDENT_CONTEXT(ctx) : NULL;
- tridentContextPtr newCtx = (tridentContextPtr) driContextPriv->driverPrivate;
-
- if ( newCtx != oldCtx ) {
- newCtx->dirty = ~0;
- }
-
- if (newCtx->driDrawable != driDrawPriv) {
- newCtx->driDrawable = driDrawPriv;
-#if 0
- tridentUpdateWindow ( newCtx->glCtx );
- tridentUpdateViewportOffset( newCtx->glCtx );
-#endif
- }
-
- newCtx->drawOffset = newCtx->tridentScreen->backOffset;
- newCtx->drawPitch = newCtx->tridentScreen->backPitch;
-
- _mesa_make_current( newCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- if (!newCtx->glCtx->Viewport.Width) {
- _mesa_set_viewport(newCtx->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
- }
- } else {
- _mesa_make_current( NULL, NULL, NULL );
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-tridentUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-
-static tridentScreenPtr
-tridentCreateScreen( __DRIscreenPrivate *sPriv )
-{
- TRIDENTDRIPtr tDRIPriv = (TRIDENTDRIPtr)sPriv->pDevPriv;
- tridentScreenPtr tridentScreen;
-
- if (sPriv->devPrivSize != sizeof(TRIDENTDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(TRIDENTDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- tridentScreen = (tridentScreenPtr) CALLOC( sizeof(*tridentScreen) );
- if ( !tridentScreen ) return NULL;
-
- tridentScreen->driScreen = sPriv;
-
- tridentScreen->frontOffset = tDRIPriv->frontOffset;
- tridentScreen->backOffset = tDRIPriv->backOffset;
- tridentScreen->depthOffset = tDRIPriv->depthOffset;
- tridentScreen->frontPitch = tDRIPriv->frontPitch;
- tridentScreen->backPitch = tDRIPriv->backPitch;
- tridentScreen->depthPitch = tDRIPriv->depthPitch;
- tridentScreen->width = tDRIPriv->width;
- tridentScreen->height = tDRIPriv->height;
-
-printf("%d %d\n",tridentScreen->width,tridentScreen->height);
-printf("%d %d\n",tridentScreen->frontPitch,tridentScreen->backPitch);
-printf("offset 0x%x 0x%x\n",tridentScreen->backOffset,tridentScreen->depthOffset);
-
- tridentScreen->mmio.handle = tDRIPriv->regs;
- tridentScreen->mmio.size = 0x20000;
-
- if (drmMap(sPriv->fd,
- tridentScreen->mmio.handle, tridentScreen->mmio.size,
- (drmAddressPtr)&tridentScreen->mmio.map)) {
- FREE(tridentScreen);
- return GL_FALSE;
- }
-printf("MAPPED at %p\n", tridentScreen->mmio.map);
-
- return tridentScreen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-static void
-tridentDestroyScreen( __DRIscreenPrivate *sPriv )
-{
- tridentScreenPtr tridentScreen = (tridentScreenPtr)sPriv->private;
-
- FREE(tridentScreen);
-}
-
-static GLboolean
-tridentInitDriver(__DRIscreenPrivate *sPriv)
-{
- sPriv->private = (void *) tridentCreateScreen( sPriv );
-
- if (!sPriv->private) {
- tridentDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-/**
- * This is the driver specific part of the createNewScreen entry point.
- *
- * \todo maybe fold this into intelInitDriver
- *
- * \return the __GLcontextModes supported by this driver
- */
-const __DRIconfig **tridentInitScreen(__DRIscreenPrivate *psp)
-{
- static const __DRIversion ddx_expected = { 4, 0, 0 };
- static const __DRIversion dri_expected = { 3, 1, 0 };
- static const __DRIversion drm_expected = { 1, 0, 0 };
-
- if ( ! driCheckDriDdxDrmVersions2( "Trident",
- &psp->dri_version, & dri_expected,
- &psp->ddx_version, & ddx_expected,
- &psp->drm_version, & drm_expected ) )
- return NULL;
-
- if (!tridentInitDriver(psp))
- return NULL;
-
- /* Wait... what? This driver doesn't report any modes... */
-#if 0
- TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv;
- *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8,
- GL_TRUE );
-#endif
-
- return NULL;
-}
-
-const struct __DriverAPIRec driDriverAPI = {
- tridentInitScreen,
- tridentDestroyScreen,
- tridentCreateContext,
- tridentDestroyContext,
- tridentCreateBuffer,
- tridentDestroyBuffer,
- tridentSwapBuffers,
- tridentMakeCurrent,
- tridentUnbindContext,
-};
diff --git a/src/mesa/drivers/dri/trident/trident_context.h b/src/mesa/drivers/dri/trident/trident_context.h
deleted file mode 100644
index fbbb4a96e78..00000000000
--- a/src/mesa/drivers/dri/trident/trident_context.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-#ifndef _TRIDENT_CONTEXT_H_
-#define _TRIDENT_CONTEXT_H_
-
-#include "dri_util.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-#include "drm.h"
-#include "main/mm.h"
-
-#define SUBPIXEL_X (0.0F)
-#define SUBPIXEL_Y (0.125F)
-
-#define _TRIDENT_NEW_VERTEX (_NEW_TEXTURE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE)
-
-#define TRIDENT_FALLBACK_TEXTURE 0x01
-#define TRIDENT_FALLBACK_DRAW_BUFFER 0x02
-
-#define TRIDENT_NEW_CLIP 0x01
-
-#define TRIDENT_UPLOAD_COMMAND_D 0x00000001
-#define TRIDENT_UPLOAD_CONTEXT 0x04000000
-#define TRIDENT_UPLOAD_CLIPRECTS 0x80000000
-
-#define TAG(x) trident##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-/* these require that base be dword-aligned */
-static INLINE void MMIO_OUT32(unsigned char *base, unsigned int offset,
- unsigned int val)
-{
- unsigned int *addr = (unsigned int *)(base + offset);
- *addr = val;
-}
-
-static INLINE unsigned int MMIO_IN32(unsigned char *base, unsigned int offset)
-{
- unsigned int *addr = (unsigned int *)(base + offset);
- return *addr;
-}
-
-#define MMIO_OUT8(base, offset, val) *((base) + (offset)) = (val)
-#define MMIO_IN8(base, offset) *((base) + (offset))
-
-struct trident_context;
-typedef struct trident_context tridentContextRec;
-typedef struct trident_context *tridentContextPtr;
-
-typedef void (*trident_quad_func)( tridentContextPtr,
- const tridentVertex *,
- const tridentVertex *,
- const tridentVertex *,
- const tridentVertex * );
-typedef void (*trident_tri_func)( tridentContextPtr,
- const tridentVertex *,
- const tridentVertex *,
- const tridentVertex * );
-typedef void (*trident_line_func)( tridentContextPtr,
- const tridentVertex *,
- const tridentVertex * );
-typedef void (*trident_point_func)( tridentContextPtr,
- const tridentVertex * );
-
-typedef struct {
- drm_handle_t handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- unsigned char *map; /* Mapping of the DRM region */
-} tridentRegionRec, *tridentRegionPtr;
-
-typedef struct {
- __DRIscreenPrivate *driScreen; /* Back pointer to DRI screen */
-
- drmBufMapPtr buffers;
-
- unsigned int frontOffset;
- unsigned int frontPitch;
- unsigned int backOffset;
- unsigned int backPitch;
- unsigned int depthOffset;
- unsigned int depthPitch;
- unsigned int width;
- unsigned int height;
- unsigned int cpp;
-
-#if 0
- unsigned int sarea_priv_offset;
-#endif
-
- tridentRegionRec mmio;
-} tridentScreenRec, *tridentScreenPtr;
-
-/**
- * tridentRenderbuffer, derived from Mesa's gl_renderbuffer
- */
-typedef struct {
- struct gl_renderbuffer Base;
- /* XXX per-window info should go here */
- int foo, bar;
-} tridentRenderbuffer;
-
-
-struct trident_context {
- GLcontext *glCtx; /* Mesa context */
-
- __DRIcontextPrivate *driContext;
- __DRIscreenPrivate *driScreen;
- __DRIdrawablePrivate *driDrawable;
-
- GLuint new_gl_state;
- GLuint new_state;
- GLuint dirty;
-
-#if 0
- drm_trident_sarea_t *sarea;
-#endif
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- /* Mirrors of some DRI state
- */
- int lastStamp; /* mirror driDrawable->lastStamp */
-
- drm_context_t hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- tridentScreenPtr tridentScreen; /* Screen private DRI data */
-
- /* Visual, drawable, cliprect and scissor information
- */
- GLenum DrawBuffer;
- GLint drawOffset, drawPitch;
- GLint drawX, drawY; /* origin of drawable in draw buffer */
- GLint readOffset, readPitch;
-
- GLuint numClipRects; /* Cliprects for the draw buffer */
- drm_clip_rect_t *pClipRects;
-
- GLint scissor;
- drm_clip_rect_t ScissorRect; /* Current software scissor */
-
- GLuint Fallback;
- GLuint RenderIndex;
- GLuint SetupNewInputs;
- GLuint SetupIndex;
- GLfloat hw_viewport[16];
- GLfloat depth_scale;
- GLuint vertex_format;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLubyte *verts;
-
- GLint tmu_source[2];
-
- GLuint hw_primitive;
- GLenum render_primitive;
-
- trident_point_func draw_point;
- trident_line_func draw_line;
- trident_tri_func draw_tri;
- trident_quad_func draw_quad;
-
-#if 0
- gammaTextureObjectPtr CurrentTexObj[2];
- struct gamma_texture_object_t TexObjList;
- struct gamma_texture_object_t SwappedOut;
- GLenum TexEnvImageFmt[2];
-
- struct mem_block *texHeap;
-
- int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
- int lastStamp;
-#endif
-
- /* Chip state */
-
- int commandD;
-
- /* Context State */
-
- int ClearColor;
-};
-
-void tridentDDInitExtensions( GLcontext *ctx );
-void tridentDDInitDriverFuncs( GLcontext *ctx );
-void tridentDDInitSpanFuncs( GLcontext *ctx );
-void tridentDDInitState( tridentContextPtr tmesa );
-void tridentInitHW( tridentContextPtr tmesa );
-void tridentDDInitStateFuncs( GLcontext *ctx );
-void tridentDDInitTextureFuncs( GLcontext *ctx );
-void tridentDDInitTriFuncs( GLcontext *ctx );
-
-extern void tridentBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-extern void tridentInitVB( GLcontext *ctx );
-extern void tridentCopyBuffer( const __DRIdrawablePrivate *dPriv );
-extern void tridentFallback( tridentContextPtr tmesa, GLuint bit,
- GLboolean mode );
-extern void tridentCheckTexSizes( GLcontext *ctx );
-extern void tridentChooseVertexState( GLcontext *ctx );
-extern void tridentDDUpdateHWState( GLcontext *ctx );
-extern void tridentUploadHwStateLocked( tridentContextPtr tmesa );
-
-#define TRIDENT_CONTEXT(ctx) ((tridentContextPtr)(ctx->DriverCtx))
-
-#endif /* _TRIDENT_CONTEXT_H_ */
diff --git a/src/mesa/drivers/dri/trident/trident_dd.c b/src/mesa/drivers/dri/trident/trident_dd.c
deleted file mode 100644
index faa40c36a26..00000000000
--- a/src/mesa/drivers/dri/trident/trident_dd.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-#include "trident_context.h"
-#include "trident_lock.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-
-#include "swrast/swrast.h"
-#include "main/context.h"
-#include "main/framebuffer.h"
-
-#define TRIDENT_DATE "20041223"
-
-/* Return the width and height of the current color buffer.
- */
-static void tridentDDGetBufferSize( GLframebuffer *framebuffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
-
- LOCK_HARDWARE(tmesa);
- *width = tmesa->driDrawable->w;
- *height = tmesa->driDrawable->h;
- UNLOCK_HARDWARE(tmesa);
-}
-
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *tridentDDGetString( GLcontext *ctx, GLenum name )
-{
- static char buffer[128];
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"Alan Hourihane";
-
- case GL_RENDERER:
- sprintf( buffer, "Mesa DRI Trident " TRIDENT_DATE );
-
- /* Append any CPU-specific information.
- */
-#ifdef USE_X86_ASM
- if ( _mesa_x86_cpu_features ) {
- strncat( buffer, " x86", 4 );
- }
-#ifdef USE_MMX_ASM
- if ( cpu_has_mmx ) {
- strncat( buffer, "/MMX", 4 );
- }
-#endif
-#ifdef USE_3DNOW_ASM
- if ( cpu_has_3dnow ) {
- strncat( buffer, "/3DNow!", 7 );
- }
-#endif
-#ifdef USE_SSE_ASM
- if ( cpu_has_xmm ) {
- strncat( buffer, "/SSE", 4 );
- }
-#endif
-#endif
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-/* Enable the extensions supported by this driver.
- */
-void tridentDDInitExtensions( GLcontext *ctx )
-{
- /* None... */
-}
-
-/* Initialize the driver's misc functions.
- */
-void tridentDDInitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = tridentDDGetBufferSize;
- ctx->Driver.GetString = tridentDDGetString;
- ctx->Driver.Error = NULL;
-}
diff --git a/src/mesa/drivers/dri/trident/trident_dri.h b/src/mesa/drivers/dri/trident/trident_dri.h
deleted file mode 100644
index c1ce3c46827..00000000000
--- a/src/mesa/drivers/dri/trident/trident_dri.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _TRIDENT_DRI_
-#define _TRIDENT_DRI_
-
-#include "xf86drm.h"
-
-typedef struct {
- drm_handle_t regs;
- drmSize regsSize;
- drmAddress regsMap;
- int deviceID;
- int width;
- int height;
- int mem;
- int frontOffset;
- int frontPitch;
- int backOffset;
- int backPitch;
- int depthOffset;
- int depthPitch;
- int cpp;
-#if 0
- int textureOffset;
- int textureSize;
-#endif
- unsigned int sarea_priv_offset;
-} TRIDENTDRIRec, *TRIDENTDRIPtr;
-
-#endif
diff --git a/src/mesa/drivers/dri/trident/trident_lock.h b/src/mesa/drivers/dri/trident/trident_lock.h
deleted file mode 100644
index ee0819f5caa..00000000000
--- a/src/mesa/drivers/dri/trident/trident_lock.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* XXX tridentGetLock doesn't exist... */
-
-#define LOCK_HARDWARE(tmesa) \
- do { \
- char __ret = 0; \
- DRM_CAS(tmesa->driHwLock, tmesa->hHWContext, \
- DRM_LOCK_HELD | tmesa->hHWContext, __ret); \
- } while (0)
-
-#define UNLOCK_HARDWARE(tmesa) \
- DRM_UNLOCK(tmesa->driFd, tmesa->driHwLock, tmesa->hHWContext)
diff --git a/src/mesa/drivers/dri/trident/trident_state.c b/src/mesa/drivers/dri/trident/trident_state.c
deleted file mode 100644
index e68d3a73c64..00000000000
--- a/src/mesa/drivers/dri/trident/trident_state.c
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-#include "trident_context.h"
-#include "trident_lock.h"
-#include "vbo/vbo.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "main/framebuffer.h"
-
-#define TRIDENTPACKCOLOR332(r, g, b) \
- (((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6))
-
-#define TRIDENTPACKCOLOR1555(r, g, b, a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define TRIDENTPACKCOLOR565(r, g, b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define TRIDENTPACKCOLOR888(r, g, b) \
- (((r) << 16) | ((g) << 8) | (b))
-
-#define TRIDENTPACKCOLOR8888(r, g, b, a) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define TRIDENTPACKCOLOR4444(r, g, b, a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-static INLINE GLuint tridentPackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- switch ( cpp ) {
- case 2:
- return TRIDENTPACKCOLOR565( r, g, b );
- case 4:
- return TRIDENTPACKCOLOR8888( r, g, b, a );
- default:
- return 0;
- }
-}
-
-void tridentUploadHwStateLocked( tridentContextPtr tmesa )
-{
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
-#if 0
- ATISAREAPrivPtr sarea = tmesa->sarea;
- trident_context_regs_t *regs = &(sarea->ContextState);
-#endif
-
- if ( tmesa->dirty & TRIDENT_UPLOAD_COMMAND_D ) {
- MMIO_OUT32(MMIO, 0x00281C, tmesa->commandD );
- tmesa->dirty &= ~TRIDENT_UPLOAD_COMMAND_D;
- }
-
- if ( tmesa->dirty & TRIDENT_UPLOAD_CLIPRECTS ) {
- /* XXX FIX ME ! */
- MMIO_OUT32(MMIO, 0x002C80 , 0x20008000 | tmesa->tridentScreen->height );
- MMIO_OUT32(MMIO, 0x002C84 , 0x20000000 | tmesa->tridentScreen->width );
- tmesa->dirty &= ~TRIDENT_UPLOAD_CLIPRECTS;
- }
-
- tmesa->dirty = 0;
-}
-
-/* Copy the back color buffer to the front color buffer.
- */
-void tridentCopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- unsigned char *MMIO;
- tridentContextPtr tmesa;
- GLint nbox, i;
- int busy;
- drm_clip_rect_t *pbox;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- tmesa = (tridentContextPtr) dPriv->driContextPriv->driverPrivate;
- MMIO = tmesa->tridentScreen->mmio.map;
-
- LOCK_HARDWARE( tmesa );
-
- /* use front buffer cliprects */
- nbox = dPriv->numClipRects;
- pbox = dPriv->pClipRects;
-
- for ( i = 0 ; i < nbox ; i++ ) {
-#if 0
- GLint nr = MIN2( i + MACH64_NR_SAREA_CLIPRECTS , nbox );
- drm_clip_rect_t *b = tmesa->sarea->boxes;
- GLint n = 0;
-
- for ( ; i < nr ; i++ ) {
- *b++ = pbox[i];
- n++;
- }
- tmesa->sarea->nbox = n;
-#endif
-
- MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->frontPitch << 20 | tmesa->tridentScreen->frontOffset>>4);
- MMIO_OUT32(MMIO, 0x2154, tmesa->tridentScreen->backPitch << 20 | tmesa->tridentScreen->backOffset>>4);
- MMIO_OUT8(MMIO, 0x2127, 0xCC); /* Copy Rop */
- MMIO_OUT32(MMIO, 0x2128, 0x4); /* scr2scr */
- MMIO_OUT32(MMIO, 0x2138, (pbox->x1 << 16) | pbox->y1);
- MMIO_OUT32(MMIO, 0x213C, (pbox->x1 << 16) | pbox->y1);
- MMIO_OUT32(MMIO, 0x2140, (pbox->x2 - pbox->x1) << 16 | (pbox->y2 - pbox->y1) );
- MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */
-#define GE_BUSY 0x80
- for (;;) {
- busy = MMIO_IN8(MMIO, 0x2120);
- if ( !(busy & GE_BUSY) )
- break;
- }
- }
-
- UNLOCK_HARDWARE( tmesa );
-
-#if 0
- tmesa->dirty |= (MACH64_UPLOAD_CONTEXT |
- MACH64_UPLOAD_MISC |
- MACH64_UPLOAD_CLIPRECTS);
-#endif
-}
-
-
-static void tridentDDClear( GLcontext *ctx, GLbitfield mask )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- int busy;
- GLuint flags = 0;
- GLint i;
- GLint cx, cy, cw, ch;
-
-#define DRM_TRIDENT_FRONT 0x01
-#define DRM_TRIDENT_BACK 0x02
-#define DRM_TRIDENT_DEPTH 0x04
-
- if ( tmesa->new_state )
- tridentDDUpdateHWState( ctx );
-
- if ( mask & BUFFER_BIT_FRONT_LEFT ) {
- flags |= DRM_TRIDENT_FRONT;
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if ( mask & BUFFER_BIT_BACK_LEFT ) {
- flags |= DRM_TRIDENT_BACK;
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if ( ( mask & BUFFER_BIT_DEPTH ) && ctx->Depth.Mask ) {
- flags |= DRM_TRIDENT_DEPTH;
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- LOCK_HARDWARE(tmesa);
-
- /* get region after locking: */
- cx = ctx->DrawBuffer->_Xmin;
- cy = ctx->DrawBuffer->_Ymin;
- cw = ctx->DrawBuffer->_Xmax - cx;
- ch = ctx->DrawBuffer->_Ymax - cy;
-
- if ( flags ) {
-
- cx += tmesa->drawX;
- cy += tmesa->drawY;
-
- /* HACK!!!
- */
- if ( tmesa->dirty & ~TRIDENT_UPLOAD_CLIPRECTS ) {
- tridentUploadHwStateLocked( tmesa );
- }
-
- for ( i = 0 ; i < tmesa->numClipRects ; i++ ) {
-#if 0
- int nr = MIN2( i + TRIDENT_NR_SAREA_CLIPRECTS, tmesa->numClipRects );
- drm_clip_rect_t *box = tmesa->pClipRects;
- drm_clip_rect_t *b = tmesa->sarea->boxes;
- GLint n = 0;
-
- if ( !all ) {
- for ( ; i < nr ; i++ ) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if ( x < cx ) w -= cx - x, x = cx;
- if ( y < cy ) h -= cy - y, y = cy;
- if ( x + w > cx + cw ) w = cx + cw - x;
- if ( y + h > cy + ch ) h = cy + ch - y;
- if ( w <= 0 ) continue;
- if ( h <= 0 ) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- }
-
- tmesa->sarea->nbox = n;
-#endif
-
-if (flags & DRM_TRIDENT_BACK) {
- MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->backPitch << 20 | tmesa->tridentScreen->backOffset>>4);
- MMIO_OUT8(MMIO, 0x2127, 0xF0); /* Pat Rop */
- MMIO_OUT32(MMIO, 0x2158, tmesa->ClearColor);
- MMIO_OUT32(MMIO, 0x2128, 0x4000); /* solidfill */
- MMIO_OUT32(MMIO, 0x2138, cx << 16 | cy);
- MMIO_OUT32(MMIO, 0x2140, cw << 16 | ch);
- MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */
-#define GE_BUSY 0x80
- for (;;) {
- busy = MMIO_IN8(MMIO, 0x2120);
- if ( !(busy & GE_BUSY) )
- break;
- }
-}
-if (flags & DRM_TRIDENT_DEPTH) {
- MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->depthPitch << 20 | tmesa->tridentScreen->depthOffset>>4);
- MMIO_OUT8(MMIO, 0x2127, 0xF0); /* Pat Rop */
- MMIO_OUT32(MMIO, 0x2158, tmesa->ClearColor);
- MMIO_OUT32(MMIO, 0x2128, 0x4000); /* solidfill */
- MMIO_OUT32(MMIO, 0x2138, cx << 16 | cy);
- MMIO_OUT32(MMIO, 0x2140, cw << 16 | ch);
- MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */
-#define GE_BUSY 0x80
- for (;;) {
- busy = MMIO_IN8(MMIO, 0x2120);
- if ( !(busy & GE_BUSY) )
- break;
- }
-}
- MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->frontPitch << 20 | tmesa->tridentScreen->frontOffset>>4);
-if (flags & DRM_TRIDENT_FRONT) {
- MMIO_OUT8(MMIO, 0x2127, 0xF0); /* Pat Rop */
- MMIO_OUT32(MMIO, 0x2158, tmesa->ClearColor);
- MMIO_OUT32(MMIO, 0x2128, 0x4000); /* solidfill */
- MMIO_OUT32(MMIO, 0x2138, cx << 16 | cy);
- MMIO_OUT32(MMIO, 0x2140, cw << 16 | ch);
- MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */
-#define GE_BUSY 0x80
- for (;;) {
- busy = MMIO_IN8(MMIO, 0x2120);
- if ( !(busy & GE_BUSY) )
- break;
- }
-}
-
- }
-
-#if 0
- tmesa->dirty |= (TRIDENT_UPLOAD_CONTEXT |
- TRIDENT_UPLOAD_MISC |
- TRIDENT_UPLOAD_CLIPRECTS);
-#endif
- }
-
- UNLOCK_HARDWARE(tmesa);
-
- if ( mask )
- _swrast_Clear( ctx, mask );
-}
-
-static void tridentDDShadeModel( GLcontext *ctx, GLenum mode )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- GLuint s = tmesa->commandD;
-
-#define TRIDENT_FLAT_SHADE 0x000000E0
-#define TRIDENT_FLAT_SHADE_VERTEX_C 0x00000060
-#define TRIDENT_FLAT_SHADE_GOURAUD 0x00000080
-
- s &= ~TRIDENT_FLAT_SHADE;
-
- switch ( mode ) {
- case GL_FLAT:
- s |= TRIDENT_FLAT_SHADE_VERTEX_C;
- break;
- case GL_SMOOTH:
- s |= TRIDENT_FLAT_SHADE_GOURAUD;
- break;
- default:
- return;
- }
-
- if ( tmesa->commandD != s ) {
- tmesa->commandD = s;
-
- tmesa->dirty |= TRIDENT_UPLOAD_COMMAND_D;
- }
-}
-
-static void
-tridentCalcViewport( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = tmesa->hw_viewport;
-
- /* See also trident_translate_vertex.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + tmesa->drawX + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + tmesa->driDrawable->h + tmesa->drawY + SUBPIXEL_Y;
-#if 0
- m[MAT_SZ] = v[MAT_SZ] * tmesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * tmesa->depth_scale;
-#else
- m[MAT_SZ] = v[MAT_SZ];
- m[MAT_TZ] = v[MAT_TZ];
-#endif
-
- tmesa->SetupNewInputs = ~0;
-}
-
-static void tridentDDViewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- tridentCalcViewport( ctx );
-}
-
-static void tridentDDDepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- tridentCalcViewport( ctx );
-}
-
-static void
-tridentSetCliprects( tridentContextPtr tmesa, GLenum mode )
-{
- __DRIdrawablePrivate *dPriv = tmesa->driDrawable;
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- if (dPriv->numClipRects == 0) {
- static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
- tmesa->numClipRects = 1;
- tmesa->pClipRects = &zeroareacliprect;
- } else {
- tmesa->numClipRects = dPriv->numClipRects;
- tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pClipRects;
- }
- tmesa->drawX = dPriv->x;
- tmesa->drawY = dPriv->y;
- break;
- case GL_BACK_LEFT:
- if ( dPriv->numBackClipRects == 0 ) {
- if (dPriv->numClipRects == 0) {
- static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
- tmesa->numClipRects = 1;
- tmesa->pClipRects = &zeroareacliprect;
- } else {
- tmesa->numClipRects = dPriv->numClipRects;
- tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pClipRects;
- tmesa->drawX = dPriv->x;
- tmesa->drawY = dPriv->y;
- }
- }
- else {
- tmesa->numClipRects = dPriv->numBackClipRects;
- tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pBackClipRects;
- tmesa->drawX = dPriv->backX;
- tmesa->drawY = dPriv->backY;
- }
- break;
- default:
- return;
- }
-
-#if 0
- tmesa->dirty |= TRIDENT_UPLOAD_CLIPRECTS;
-#endif
-}
-
-#if 0
-static GLboolean tridentDDSetDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- int found = GL_TRUE;
-
- if ( tmesa->DrawBuffer != mode ) {
- tmesa->DrawBuffer = mode;
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- tridentFallback( tmesa, TRIDENT_FALLBACK_DRAW_BUFFER, GL_FALSE );
- tmesa->drawOffset = tmesa->tridentScreen->frontOffset;
- tmesa->drawPitch = tmesa->tridentScreen->frontPitch;
- tridentSetCliprects( tmesa, GL_FRONT_LEFT );
- break;
- case GL_BACK_LEFT:
- tridentFallback( tmesa, TRIDENT_FALLBACK_DRAW_BUFFER, GL_FALSE );
- tmesa->drawOffset = tmesa->tridentScreen->backOffset;
- tmesa->drawPitch = tmesa->tridentScreen->backPitch;
- tridentSetCliprects( tmesa, GL_BACK_LEFT );
- break;
- default:
- tridentFallback( tmesa, TRIDENT_FALLBACK_DRAW_BUFFER, GL_TRUE );
- found = GL_FALSE;
- break;
- }
-
-#if 0
- tmesa->setup.dst_off_pitch = (((tmesa->drawPitch/8) << 22) |
- (tmesa->drawOffset >> 3));
-
- tmesa->dirty |= MACH64_UPLOAD_DST_OFF_PITCH | MACH64_UPLOAD_CONTEXT;
-#endif
-
- }
-
- return found;
-}
-
-static void tridentDDClearColor( GLcontext *ctx,
- const GLchan color[4] )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
-
- tmesa->ClearColor = tridentPackColor( tmesa->tridentScreen->cpp,
- color[0], color[1],
- color[2], color[3] );
-}
-#endif
-
-static void
-tridentDDUpdateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- TRIDENT_CONTEXT(ctx)->new_gl_state |= new_state;
-}
-
-
-/* Initialize the context's hardware state.
- */
-void tridentDDInitState( tridentContextPtr tmesa )
-{
- tmesa->new_state = 0;
-
- switch ( tmesa->glCtx->Visual.depthBits ) {
- case 16:
- tmesa->depth_scale = 1.0 / (GLfloat)0xffff;
- break;
- case 24:
- tmesa->depth_scale = 1.0 / (GLfloat)0xffffff;
- break;
- }
-}
-
-void tridentDDUpdateHWState( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- int new_state = tmesa->new_state;
-
- if ( new_state )
- {
- tmesa->new_state = 0;
-
-#if 0
- /* Update the various parts of the context's state.
- */
- if ( new_state & GAMMA_NEW_ALPHA )
- tridentUpdateAlphaMode( ctx );
-
- if ( new_state & GAMMA_NEW_DEPTH )
- tridentUpdateZMode( ctx );
-
- if ( new_state & GAMMA_NEW_FOG )
- gammaUpdateFogAttrib( ctx );
-
- if ( new_state & GAMMA_NEW_CLIP )
- gammaUpdateClipping( ctx );
-
- if ( new_state & GAMMA_NEW_POLYGON )
- gammaUpdatePolygon( ctx );
-
- if ( new_state & GAMMA_NEW_CULL )
- gammaUpdateCull( ctx );
-
- if ( new_state & GAMMA_NEW_MASKS )
- gammaUpdateMasks( ctx );
-
- if ( new_state & GAMMA_NEW_STIPPLE )
- gammaUpdateStipple( ctx );
-#endif
- }
-
- /* HACK ! */
-
-#if 0
- gammaEmitHwState( tmesa );
-#endif
-}
-
-/* Initialize the driver's state functions.
- */
-void tridentDDInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = tridentDDUpdateState;
-
- ctx->Driver.Clear = tridentDDClear;
- ctx->Driver.DepthRange = tridentDDDepthRange;
- ctx->Driver.ShadeModel = tridentDDShadeModel;
- ctx->Driver.Viewport = tridentDDViewport;
-}
diff --git a/src/mesa/drivers/dri/trident/trident_tris.c b/src/mesa/drivers/dri/trident/trident_tris.c
deleted file mode 100644
index ee85ab482cd..00000000000
--- a/src/mesa/drivers/dri/trident/trident_tris.c
+++ /dev/null
@@ -1,1125 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-
-#include "trident_context.h"
-#include "trident_lock.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-
-static int first = 1;
-
-typedef struct reg {
- int addr;
- int data;
-} RegData;
-
-RegData initRegData[]={
- {0x2804, 0x19980824},
- {0x2F70, 0x46455858},
- {0x2F74, 0x41584998},
- {0x2F00, 0x00000000},
- {0x2F04, 0x80000800},
- {0x2F08, 0x00550200},
- {0x2F40, 0x00000001},
- {0x2F40, 0x00000001},
- {0x2F44, 0x00830097},
- {0x2F48, 0x0087009F},
- {0x2F4C, 0x00BF0003},
- {0x2F50, 0xF00B6C1B},
- {0x2C04, 0x00000000},
- {0x2D00, 0x00000080},
- {0x2D00, 0x00000000},
- {0x2DD4, 0x00100000},
- {0x2DD4, 0x00100010},
- {0x2DD8, 0x00100000},
- {0x2DD8, 0x00100010},
- {0x2C88, 0xFFFFFFFF},
- {0x2C94 , 0xFFFFFFFF},
- {0x281C, 0x00008000},
- {0x2C80, 0x00000000},
- {0x2C80, 0x00000000},
- {0x2C80 , 0x00008000},
- {0x2C00 , 0x00000000},
- {0x2C04 , 0x00000000},
- {0x2C08 , 0x00000000},
- {0x2C0C , 0x00000000},
- {0x2C10 , 0x00000000},
- {0x2C14 , 0x00000000},
- {0x2C18 , 0x00000000},
- {0x2C1C , 0x00000000},
- {0x2C20 , 0x00000000},
- {0x2C24 , 0x00000000},
- {0x2C2C , 0x00000000},
- {0x2C30 , 0x00000000},
- {0x2C34 , 0x00000000},
- {0x2C38 , 0x00000000},
- {0x2C3C , 0x00000000},
- {0x2C40 , 0x00000000},
- {0x2C44 , 0x00000000},
- {0x2C48 , 0x00000000},
- {0x2C4C , 0x00000000},
- {0x2C50 , 0x00000000},
- {0x2C54 , 0x00000000},
- {0x2C58 , 0x00000000},
- {0x2C5C , 0x00000000},
- {0x2C60 , 0x00000000},
- {0x2C64 , 0x00000000},
- {0x2C68 , 0x00000000},
- {0x2C6C , 0x00000000},
- {0x2C70 , 0x00000000},
- {0x2C74 , 0x00000000},
- {0x2C78 , 0x00000000},
- {0x2C7C , 0x00000000},
- {0x2C80 , 0x00008000},
- {0x2C84 , 0x00000000},
- {0x2C88 , 0xFFFFFFFF},
- {0x2C8C , 0x00000000},
- {0x2C90 , 0x00000000},
- {0x2C94 , 0xFFFFFFFF},
- {0x2C98 , 0x00000000},
- {0x2C9C , 0x00000000},
- {0x2CA0 , 0x00000000},
- {0x2CA4 , 0x00000000},
- {0x2CA8 , 0x00000000},
- {0x2CAC , 0x00000000},
- {0x2CB0 , 0x00000000},
- {0x2CB4 , 0x00000000},
- {0x2CB8 , 0x00000000},
- {0x2CBC , 0x00000000},
- {0x2CC0 , 0x00000000},
- {0x2CC4 , 0x00000000},
- {0x2CC8 , 0x00000000},
- {0x2CCC , 0x00000000},
- {0x2CD0 , 0x00000000},
- {0x2CD4 , 0x00000000},
- {0x2CD8 , 0x00000000},
- {0x2CDC , 0x00000000},
- {0x2CE0 , 0x00000000},
- {0x2CE4 , 0x00000000},
- {0x2CE8 , 0x00000000},
- {0x2CEC , 0x00000000},
- {0x2CF0 , 0x00000000},
- {0x2CF4 , 0x00000000},
- {0x2CF8 , 0x00000000},
- {0x2CFC , 0x00000000},
- {0x2D00 , 0x00000000},
- {0x2D04 , 0x00000000},
- {0x2D08 , 0x00000000},
- {0x2D0C , 0x00000000},
- {0x2D10 , 0x00000000},
- {0x2D14 , 0x00000000},
- {0x2D18 , 0x00000000},
- {0x2D1C , 0x00000000},
- {0x2D20 , 0x00000000},
- {0x2D24 , 0x00000000},
- {0x2D28 , 0x00000000},
- {0x2D2C , 0x00000000},
- {0x2D30 , 0x00000000},
- {0x2D34 , 0x00000000},
- {0x2D38 , 0x00000000},
- {0x2D3C , 0x00000000},
- {0x2D40 , 0x00000000},
- {0x2D44 , 0x00000000},
- {0x2D48 , 0x00000000},
- {0x2D4C , 0x00000000},
- {0x2D50 , 0x00000000},
- {0x2D54 , 0x00000000},
- {0x2D58 , 0x00000000},
- {0x2D5C , 0x00000000},
- {0x2D60 , 0x00000000},
- {0x2D64 , 0x00000000},
- {0x2D68 , 0x00000000},
- {0x2D6C , 0x00000000},
- {0x2D70 , 0x00000000},
- {0x2D74 , 0x00000000},
- {0x2D78 , 0x00000000},
- {0x2D7C , 0x00000000},
- {0x2D80 , 0x00000000},
- {0x2D84 , 0x00000000},
- {0x2D88 , 0x00000000},
- {0x2D8C , 0x00000000},
- {0x2D90 , 0x00000000},
- {0x2D94 , 0x00000000},
- {0x2D98 , 0x00000000},
- {0x2D9C , 0x00000000},
- {0x2DA0 , 0x00000000},
- {0x2DA4 , 0x00000000},
- {0x2DA8 , 0x00000000},
- {0x2DAC , 0x00000000},
- {0x2DB0 , 0x00000000},
- {0x2DB4 , 0x00000000},
- {0x2DB8 , 0x00000000},
- {0x2DBC , 0x00000000},
- {0x2DC0 , 0x00000000},
- {0x2DC4 , 0x00000000},
- {0x2DC8 , 0x00000000},
- {0x2DCC , 0x00000000},
- {0x2DD0 , 0x00000000},
- {0x2DD4 , 0x00100010},
- {0x2DD8 , 0x00100010},
- {0x2DDC , 0x00000000},
- {0x2DE0 , 0x00000000},
- {0x2DE4 , 0x00000000},
- {0x2DE8 , 0x00000000},
- {0x2DEC , 0x00000000},
- {0x2DF0 , 0x00000000},
- {0x2DF4 , 0x00000000},
- {0x2DF8 , 0x00000000},
- {0x2DFC , 0x00000000},
- {0x2E00 , 0x00000000},
- {0x2E04 , 0x00000000},
- {0x2E08 , 0x00000000},
- {0x2E0C , 0x00000000},
- {0x2E10 , 0x00000000},
- {0x2E14 , 0x00000000},
- {0x2E18 , 0x00000000},
- {0x2E1C , 0x00000000},
- {0x2E20 , 0x00000000},
- {0x2E24 , 0x00000000},
- {0x2E28 , 0x00000000},
- {0x2E2C , 0x00000000},
- {0x2E30 , 0x00000000},
- {0x2E34 , 0x00000000},
- {0x2E38 , 0x00000000},
- {0x2E3C , 0x00000000},
- {0x2E40 , 0x00000000},
- {0x2E44 , 0x00000000},
- {0x2E48 , 0x00000000},
- {0x2E4C , 0x00000000},
- {0x2E50 , 0x00000000},
- {0x2E54 , 0x00000000},
- {0x2E58 , 0x00000000},
- {0x2E5C , 0x00000000},
- {0x2E60 , 0x00000000},
- {0x2E64 , 0x00000000},
- {0x2E68 , 0x00000000},
- {0x2E6C , 0x00000000},
- {0x2E70 , 0x00000000},
- {0x2E74 , 0x00000000},
- {0x2E78 , 0x00000000},
- {0x2E7C , 0x00000000},
- {0x2E80 , 0x00000000},
- {0x2E84 , 0x00000000},
- {0x2E88 , 0x00000000},
- {0x2E8C , 0x00000000},
- {0x2E90 , 0x00000000},
- {0x2E94 , 0x00000000},
- {0x2E98 , 0x00000000},
- {0x2E9C , 0x00000000},
- {0x2EA0 , 0x00000000},
- {0x2EA4 , 0x00000000},
- {0x2EA8 , 0x00000000},
- {0x2EAC , 0x00000000},
- {0x2EB0 , 0x00000000},
- {0x2EB4 , 0x00000000},
- {0x2EB8 , 0x00000000},
- {0x2EBC , 0x00000000},
- {0x2EC0 , 0x00000000},
- {0x2EC4 , 0x00000000},
- {0x2EC8 , 0x00000000},
- {0x2ECC , 0x00000000},
- {0x2ED0 , 0x00000000},
- {0x2ED4 , 0x00000000},
- {0x2ED8 , 0x00000000},
- {0x2EDC , 0x00000000},
- {0x2EE0 , 0x00000000},
- {0x2EE4 ,0x00000000},
- {0x2EE8 ,0x00000000},
- {0x2EEC , 0x00000000},
- {0x2EF0 , 0x00000000},
- {0x2EF4 , 0x00000000},
- {0x2EF8 , 0x00000000},
- {0x2EFC , 0x00000000},
- /*{0x2F60 , 0x00000000},*/
-};
-
-int initRegDataNum=sizeof(initRegData)/sizeof(RegData);
-
-typedef union {
- unsigned int i;
- float f;
-} dmaBufRec, *dmaBuf;
-
-void Init3D( tridentContextPtr tmesa )
-{
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- int i;
-
- for(i=0;i<initRegDataNum;++i)
- MMIO_OUT32(MMIO, initRegData[i].addr, initRegData[i].data);
-}
-
-int DrawTriangle( tridentContextPtr tmesa)
-{
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- dmaBufRec clr;
-
-printf("DRAW TRI\n");
- Init3D(tmesa);
-
-printf("ENGINE STATUS 0x%x\n",MMIO_IN32(MMIO, 0x2800));
- MMIO_OUT32(MMIO, 0x002800, 0x00000000 );
-#if 0
- MMIO_OUT32(MMIO, 0x002368 , MMIO_IN32(MMIO,0x002368)|1 );
-#endif
-
- MMIO_OUT32(MMIO, 0x002C00 , 0x00000014 );
-#if 0
- MMIO_OUT32(MMIO, 0x002C04 , 0x0A8004C0 );
-#else
- MMIO_OUT32(MMIO, 0x002C04 , 0x0A8000C0 );
-#endif
-
-#if 0
- MMIO_OUT32(MMIO, 0x002C08 , 0x00000000 );
- MMIO_OUT32(MMIO, 0x002C0C , 0xFFCCCCCC );
- MMIO_OUT32(MMIO, 0x002C10 , 0x3F800000 );
- MMIO_OUT32(MMIO, 0x002C14 , 0x3D0D3DCB );
- MMIO_OUT32(MMIO, 0x002C2C , 0x70000000 );
- MMIO_OUT32(MMIO, 0x002C24 , 0x00202C00 );
- MMIO_OUT32(MMIO, 0x002C28 , 0xE0002500 );
- MMIO_OUT32(MMIO, 0x002C30 , 0x00000000 );
- MMIO_OUT32(MMIO, 0x002C34 , 0xE0000000 );
- MMIO_OUT32(MMIO, 0x002C38 , 0x00000000 );
-#endif
-
- MMIO_OUT32(MMIO, 0x002C50 , 0x00000000 );
- MMIO_OUT32(MMIO, 0x002C54 , 0x0C320C80 );
- MMIO_OUT32(MMIO, 0x002C50 , 0x00000000 );
- MMIO_OUT32(MMIO, 0x002C54 , 0x0C320C80 );
- MMIO_OUT32(MMIO, 0x002C80 , 0x20008258 );
- MMIO_OUT32(MMIO, 0x002C84 , 0x20000320 );
- MMIO_OUT32(MMIO, 0x002C94 , 0xFFFFFFFF );
-
-#if 0
- MMIO_OUT32(MMIO, 0x002D00 , 0x00009009 );
- MMIO_OUT32(MMIO, 0x002D38 , 0x00000000 );
- MMIO_OUT32(MMIO, 0x002D94 , 0x20002000 );
- MMIO_OUT32(MMIO, 0x002D50 , 0xf0000000 );
- MMIO_OUT32(MMIO, 0x002D80 , 0x24002000 );
- MMIO_OUT32(MMIO, 0x002D98 , 0x81000000 );
- MMIO_OUT32(MMIO, 0x002DB0 , 0x81000000 );
- MMIO_OUT32(MMIO, 0x002DC8 , 0x808000FF );
- MMIO_OUT32(MMIO, 0x002DD4 , 0x02000200 );
- MMIO_OUT32(MMIO, 0x002DD8 , 0x02000200 );
- MMIO_OUT32(MMIO, 0x002D30 , 0x02092400 );
- MMIO_OUT32(MMIO, 0x002D04 , 0x00102120 );
- MMIO_OUT32(MMIO, 0x002D08 , 0xFFFFFFFF );
- MMIO_OUT32(MMIO, 0x002D0C , 0xF00010D0 );
- MMIO_OUT32(MMIO, 0x002D10 , 0xC0000400 );
-#endif
-
- MMIO_OUT32(MMIO, 0x002814, 0x00000000 );
-#if 0
- MMIO_OUT32(MMIO, 0x002818 , 0x00036C20 );
-#else
- MMIO_OUT32(MMIO, 0x002818 , 0x00036020 );
-#endif
- MMIO_OUT32(MMIO, 0x00281C , 0x00098081 );
-
-printf("first TRI\n");
- clr.f = 5.0;
- MMIO_OUT32(MMIO, 0x002820 , clr.i );
- clr.f = 595.0;
- MMIO_OUT32(MMIO, 0x002824 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002828 , clr.i );
- MMIO_OUT32(MMIO, 0x00282C , 0x00FF00 );
-#if 0
- clr.f = 0.0;
- MMIO_OUT32(MMIO, 0x002830 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002834 , clr.i );
-#endif
-
- clr.f = 5.0;
- MMIO_OUT32(MMIO, 0x002820 , clr.i );
- clr.f = 5.0;
- MMIO_OUT32(MMIO, 0x002824 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002828 , clr.i );
- MMIO_OUT32(MMIO, 0x00282C , 0xFF0000 );
-#if 0
- clr.f = 0.0;
- MMIO_OUT32(MMIO, 0x002830 , clr.i );
- clr.f = 0.0;
- MMIO_OUT32(MMIO, 0x002834 , clr.i );
-#endif
-
- clr.f = 395.0;
-printf("0x%x\n",clr.i);
- MMIO_OUT32(MMIO, 0x002820 , clr.i );
- clr.f = 5.0;
- MMIO_OUT32(MMIO, 0x002824 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002828 , clr.i );
- MMIO_OUT32(MMIO, 0x00282C , 0xFF );
-#if 0
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002830 , clr.i );
- clr.f = 0.0;
- MMIO_OUT32(MMIO, 0x002834 , clr.i );
-#endif
-
-printf("sec TRI\n");
- MMIO_OUT32(MMIO, 0x00281C , 0x00093980 );
- clr.f = 395.0;
- MMIO_OUT32(MMIO, 0x002820 , clr.i );
- clr.f = 595.0;
- MMIO_OUT32(MMIO, 0x002824 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002828 , clr.i );
- MMIO_OUT32(MMIO, 0x00282C , 0x00FF00 );
-#if 0
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002830 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002834 , clr.i );
-#endif
-
-#if 0
- MMIO_OUT32(MMIO, 0x002368 , MMIO_IN32(MMIO,0x002368)&0xfffffffe );
-#endif
-
-printf("fin TRI\n");
-
- return 0;
-}
-
-static INLINE void trident_draw_point(tridentContextPtr tmesa,
- const tridentVertex *v0 )
-{
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- (void) MMIO;
-}
-
-static INLINE void trident_draw_line( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1 )
-{
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- (void) MMIO;
-}
-
-static INLINE void trident_draw_triangle( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1,
- const tridentVertex *v2 )
-{
-}
-
-static INLINE void trident_draw_quad( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1,
- const tridentVertex *v2,
- const tridentVertex *v3 )
-{
- GLuint vertsize = tmesa->vertex_size;
- GLint coloridx = (vertsize > 4) ? 4 : 3;
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- int clr;
- float *ftmp = (float *)(&clr);
-
- if (tmesa->dirty)
- tridentUploadHwStateLocked( tmesa );
-#if 0
- DrawTriangle(tmesa);
- exit(0);
-#else
-#if 1
- if (first) {
- Init3D(tmesa);
-#if 0
- DrawTriangle(tmesa);
-#endif
- first = 0;
- }
-#endif
-
- LOCK_HARDWARE( tmesa );
-
- MMIO_OUT32(MMIO, 0x002C00 , 0x00000010 );
- MMIO_OUT32(MMIO, 0x002C04 , 0x029C00C0 );
-
- /* Z buffer */
- MMIO_OUT32(MMIO, 0x002C24 , 0x00100000 /*| (tmesa->tridentScreen->depthOffset)*/ );
- MMIO_OUT32(MMIO, 0x002C28 , 0xE0000000 | (tmesa->tridentScreen->depthPitch * 4) );
-
- /* front buffer */
- MMIO_OUT32(MMIO, 0x002C50 , 0x00000000 | (tmesa->drawOffset) );
- MMIO_OUT32(MMIO, 0x002C54 , 0x0C320000 | (tmesa->drawPitch * 4) );
-
- /* clipper */
- MMIO_OUT32(MMIO, 0x002C80 , 0x20008000 | tmesa->tridentScreen->height );
- MMIO_OUT32(MMIO, 0x002C84 , 0x20000000 | tmesa->tridentScreen->width );
-
- /* writemask */
- MMIO_OUT32(MMIO, 0x002C94 , 0xFFFFFFFF );
-
-if (vertsize == 4) {
- MMIO_OUT32(MMIO, 0x002818 , 0x0003A020 );
- MMIO_OUT32(MMIO, 0x00281C , 0x00098021 );
-
- *ftmp = v0->v.x;
- MMIO_OUT32(MMIO, 0x002820 , clr );
- *ftmp = v0->v.y;
- MMIO_OUT32(MMIO, 0x002824 , clr );
- *ftmp = v0->v.z;
- MMIO_OUT32(MMIO, 0x002828 , clr );
-#if 0
- *ftmp = v0->v.w;
- MMIO_OUT32(MMIO, 0x00282C , clr );
-#endif
- MMIO_OUT32(MMIO, 0x00282C , v0->ui[coloridx] );
-
- *ftmp = v1->v.x;
- MMIO_OUT32(MMIO, 0x002820 , clr );
- *ftmp = v1->v.y;
- MMIO_OUT32(MMIO, 0x002824 , clr );
- *ftmp = v1->v.z;
- MMIO_OUT32(MMIO, 0x002828 , clr );
-#if 0
- *ftmp = v1->v.w;
- MMIO_OUT32(MMIO, 0x00282C , clr );
-#endif
- MMIO_OUT32(MMIO, 0x00282C , v1->ui[coloridx] );
-
- *ftmp = v2->v.x;
- MMIO_OUT32(MMIO, 0x002820 , clr );
- *ftmp = v2->v.y;
- MMIO_OUT32(MMIO, 0x002824 , clr );
- *ftmp = v2->v.z;
- MMIO_OUT32(MMIO, 0x002828 , clr );
-#if 0
- *ftmp = v2->v.w;
- MMIO_OUT32(MMIO, 0x00282C , clr );
-#endif
- MMIO_OUT32(MMIO, 0x00282C , v2->ui[coloridx] );
-
- MMIO_OUT32(MMIO, 0x00281C , 0x00093020 );
- *ftmp = v3->v.x;
- MMIO_OUT32(MMIO, 0x002820 , clr );
- *ftmp = v3->v.y;
- MMIO_OUT32(MMIO, 0x002824 , clr );
- *ftmp = v3->v.z;
- MMIO_OUT32(MMIO, 0x002828 , clr );
-#if 0
- *ftmp = v3->v.w;
- MMIO_OUT32(MMIO, 0x00282C , clr );
-#endif
- MMIO_OUT32(MMIO, 0x00282C , v3->ui[coloridx] );
-
-}
-#endif
-
- UNLOCK_HARDWARE( tmesa );
-}
-/***********************************************************************
- * Rasterization fallback helpers *
- ***********************************************************************/
-
-
-/* This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-#if 0
-static void
-trident_fallback_quad( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1,
- const tridentVertex *v2,
- const tridentVertex *v3 )
-{
- GLcontext *ctx = tmesa->glCtx;
- SWvertex v[4];
- trident_translate_vertex( ctx, v0, &v[0] );
- trident_translate_vertex( ctx, v1, &v[1] );
- trident_translate_vertex( ctx, v2, &v[2] );
- trident_translate_vertex( ctx, v3, &v[3] );
- _swrast_Quad( ctx, &v[0], &v[1], &v[2], &v[3] );
-}
-#endif
-
-/* XXX hack to get the prototype defined in time... */
-void trident_translate_vertex(GLcontext *ctx, const tridentVertex *src,
- SWvertex *dst);
-
-static void
-trident_fallback_tri( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1,
- const tridentVertex *v2 )
-{
- GLcontext *ctx = tmesa->glCtx;
- SWvertex v[3];
- trident_translate_vertex( ctx, v0, &v[0] );
- trident_translate_vertex( ctx, v1, &v[1] );
- trident_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-static void
-trident_fallback_line( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1 )
-{
- GLcontext *ctx = tmesa->glCtx;
- SWvertex v[2];
- trident_translate_vertex( ctx, v0, &v[0] );
- trident_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-trident_fallback_point( tridentContextPtr tmesa,
- const tridentVertex *v0 )
-{
- GLcontext *ctx = tmesa->glCtx;
- SWvertex v[1];
- trident_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- tmesa->draw_tri( tmesa, a, b, c ); \
- else \
- trident_draw_triangle( tmesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- tmesa->draw_tri( tmesa, a, b, d ); \
- tmesa->draw_tri( tmesa, b, c, d ); \
- } else \
- trident_draw_quad( tmesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- tmesa->draw_line( tmesa, v0, v1 ); \
- else \
- trident_draw_line( tmesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- tmesa->draw_point( tmesa, v0 ); \
- else \
- trident_draw_point( tmesa, v0 ); \
-} while (0)
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define TRIDENT_OFFSET_BIT 0x01
-#define TRIDENT_TWOSIDE_BIT 0x02
-#define TRIDENT_UNFILLED_BIT 0x04
-#define TRIDENT_FALLBACK_BIT 0x08
-#define TRIDENT_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[TRIDENT_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & TRIDENT_FALLBACK_BIT)
-#define DO_OFFSET (IND & TRIDENT_OFFSET_BIT)
-#define DO_UNFILLED (IND & TRIDENT_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & TRIDENT_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX tridentVertex
-#define TAB rast_tab
-
-#define DEPTH_SCALE 1.0
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (tmesa->verts + (e<<tmesa->vertex_stride_shift))
-
-#define TRIDENT_COLOR( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
- dst[3] = src[3]; \
-} while (0)
-
-#define TRIDENT_SPEC( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
-} while (0)
-
-#define VERT_SET_RGBA( v, c ) TRIDENT_COLOR( v->ub4[coloroffset], c )
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-
-#define VERT_SET_SPEC( v, c ) if (havespec) TRIDENT_SPEC( v->ub4[5], c )
-#define VERT_COPY_SPEC( v0, v1 ) if (havespec) COPY_3V(v0->ub4[5], v1->ub4[5])
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (tmesa->vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (tmesa->vertex_size == 4 ? 0 : 1); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-#if 0
-static const GLuint hw_prim[GL_POLYGON+1] = {
- B_PrimType_Points,
- B_PrimType_Lines,
- B_PrimType_Lines,
- B_PrimType_Lines,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles
-};
-#endif
-
-static void tridentResetLineStipple( GLcontext *ctx );
-#if 0
-static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-#endif
-static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim );
-
-#define RASTERIZE(x) /*if (tmesa->hw_primitive != hw_prim[x]) \
- tridentRasterPrimitive( ctx, hw_prim[x] ) */
-#define RENDER_PRIMITIVE tmesa->render_primitive
-#define TAG(x) x
-#define IND TRIDENT_FALLBACK_BIT
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_OFFSET_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-static void init_rast_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
- init_fallback();
- init_offset_fallback();
- init_twoside_fallback();
- init_twoside_offset_fallback();
- init_unfilled_fallback();
- init_offset_unfilled_fallback();
- init_twoside_unfilled_fallback();
- init_twoside_offset_unfilled_fallback();
-}
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define VERT(x) (tridentVertex *)(tridentverts + (x << shift))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- trident_draw_point( tmesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- trident_draw_line( tmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- trident_draw_triangle( tmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- trident_draw_quad( tmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) tridentRenderPrimitive( ctx, x );
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); \
- const GLuint shift = tmesa->vertex_stride_shift; \
- const char *tridentverts = (char *)tmesa->verts; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE if ( stipple ) tridentResetLineStipple( ctx );
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) trident_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) trident_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void tridentRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint prim = tmesa->render_primitive;
-
- /* Render the new vertices as an unclipped polygon.
- */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive
- */
- if (prim != GL_POLYGON)
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
-}
-
-static void tridentRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-#define _TRIDENT_NEW_RENDER_STATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_POINT_SMOOTH | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET) \
-
-
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_STIPPLE|DD_LINE_SMOOTH)
-#define TRI_FALLBACK (DD_TRI_SMOOTH)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-
-static void tridentChooseRenderState(GLcontext *ctx)
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (flags & (ANY_RASTER_FLAGS|ANY_FALLBACK_FLAGS)) {
- tmesa->draw_point = trident_draw_point;
- tmesa->draw_line = trident_draw_line;
- tmesa->draw_tri = trident_draw_triangle;
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= TRIDENT_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= TRIDENT_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= TRIDENT_UNFILLED_BIT;
- }
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)) {
- if (flags & POINT_FALLBACK) tmesa->draw_point = trident_fallback_point;
- if (flags & LINE_FALLBACK) tmesa->draw_line = trident_fallback_line;
- if (flags & TRI_FALLBACK) tmesa->draw_tri = trident_fallback_tri;
- index |= TRIDENT_FALLBACK_BIT;
- }
- }
-
- if (tmesa->RenderIndex != index) {
- tmesa->RenderIndex = index;
-
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (tmesa->RenderIndex == 0) {
- tnl->Driver.Render.PrimTabVerts = trident_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = trident_render_tab_elts;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- }
- tnl->Driver.Render.ClippedLine = tridentRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = tridentRenderClippedPoly;
- }
-}
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-
-/* Determine the rasterized primitive when not drawing unfilled
- * polygons.
- *
- * Used only for the default render stage which always decomposes
- * primitives to trianges/lines/points. For the accelerated stage,
- * which renders strips as strips, the equivalent calculations are
- * performed in tridentrender.c.
- */
-#if 0
-static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- if (tmesa->hw_primitive != hwprim)
- tmesa->hw_primitive = hwprim;
-}
-#endif
-
-static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- tmesa->render_primitive = prim;
-}
-
-static void tridentRunPipeline( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
-
- if ( tmesa->new_state )
- tridentDDUpdateHWState( ctx );
-
- if (tmesa->new_gl_state) {
-#if 0
- if (tmesa->new_gl_state & _NEW_TEXTURE)
- tridentUpdateTextureState( ctx );
-#endif
-
- if (!tmesa->Fallback) {
- if (tmesa->new_gl_state & _TRIDENT_NEW_VERTEX)
- tridentChooseVertexState( ctx );
-
- if (tmesa->new_gl_state & _TRIDENT_NEW_RENDER_STATE)
- tridentChooseRenderState( ctx );
- }
-
- tmesa->new_gl_state = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-static void tridentRenderStart( GLcontext *ctx )
-{
- /* Check for projective texturing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
- tridentCheckTexSizes( ctx );
-}
-
-static void tridentRenderFinish( GLcontext *ctx )
-{
- if (0)
- _swrast_flush( ctx ); /* never needed */
-}
-
-static void tridentResetLineStipple( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- (void) tmesa;
-
- /* Reset the hardware stipple counter.
- */
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-
-void tridentFallback( tridentContextPtr tmesa, GLuint bit, GLboolean mode )
-{
- GLcontext *ctx = tmesa->glCtx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = tmesa->Fallback;
-
- _tnl_need_projected_coords( ctx, GL_FALSE );
-
- if (mode) {
- tmesa->Fallback |= bit;
- if (oldfallback == 0) {
- _swsetup_Wakeup( ctx );
- tmesa->RenderIndex = ~0;
- }
- }
- else {
- tmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = tridentRenderStart;
- tnl->Driver.Render.PrimitiveNotify = tridentRenderPrimitive;
- tnl->Driver.Render.Finish = tridentRenderFinish;
- tnl->Driver.Render.BuildVertices = tridentBuildVertices;
- tnl->Driver.Render.ResetLineStipple = tridentResetLineStipple;
- tmesa->new_gl_state |= (_TRIDENT_NEW_RENDER_STATE|
- _TRIDENT_NEW_VERTEX);
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void tridentDDInitTriFuncs( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tmesa->RenderIndex = ~0;
-
- tnl->Driver.RunPipeline = tridentRunPipeline;
- tnl->Driver.Render.Start = tridentRenderStart;
- tnl->Driver.Render.Finish = tridentRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = tridentRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = tridentResetLineStipple;
- tnl->Driver.Render.BuildVertices = tridentBuildVertices;
-}
diff --git a/src/mesa/drivers/dri/trident/trident_vb.c b/src/mesa/drivers/dri/trident/trident_vb.c
deleted file mode 100644
index 055a9145953..00000000000
--- a/src/mesa/drivers/dri/trident/trident_vb.c
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/macros.h"
-#include "main/colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "swrast/swrast.h"
-#include "tnl/t_context.h"
-#include "tnl/tnl.h"
-
-#include "trident_context.h"
-
-#define TRIDENT_TEX1_BIT 0x1
-#define TRIDENT_TEX0_BIT 0x2
-#define TRIDENT_RGBA_BIT 0x4
-#define TRIDENT_SPEC_BIT 0x8
-#define TRIDENT_FOG_BIT 0x10
-#define TRIDENT_XYZW_BIT 0x20
-#define TRIDENT_PTEX_BIT 0x40
-#define TRIDENT_MAX_SETUP 0x80
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- tnl_interp_func interp;
- tnl_copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
-} setup_tab[TRIDENT_MAX_SETUP];
-
-#define TINY_VERTEX_FORMAT 1
-#define NOTEX_VERTEX_FORMAT 2
-#define TEX0_VERTEX_FORMAT 3
-#define TEX1_VERTEX_FORMAT 4
-#define PROJ_TEX1_VERTEX_FORMAT 5
-#define TEX2_VERTEX_FORMAT 6
-#define TEX3_VERTEX_FORMAT 7
-#define PROJ_TEX3_VERTEX_FORMAT 8
-
-#define DO_XYZW (IND & TRIDENT_XYZW_BIT)
-#define DO_RGBA (IND & TRIDENT_RGBA_BIT)
-#define DO_SPEC (IND & TRIDENT_SPEC_BIT)
-#define DO_FOG (IND & TRIDENT_FOG_BIT)
-#define DO_TEX0 (IND & TRIDENT_TEX0_BIT)
-#define DO_TEX1 (IND & TRIDENT_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & TRIDENT_PTEX_BIT)
-
-#define VERTEX tridentVertex
-#define VERTEX_COLOR trident_color_t
-#define LOCALVARS tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
-#define GET_VIEWPORT_MAT() tmesa->hw_viewport
-#define GET_TEXSOURCE(n) tmesa->tmu_source[n]
-#define GET_VERTEX_FORMAT() tmesa->vertex_format
-#define GET_VERTEX_SIZE() tmesa->vertex_size
-#define GET_VERTEX_STORE() tmesa->verts
-#define GET_VERTEX_STRIDE_SHIFT() tmesa->vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &tmesa->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &tmesa->UbyteSecondaryColor
-
-#define HAVE_HW_VIEWPORT 0
-#define HAVE_HW_DIVIDE 0
-#define HAVE_RGBA_COLOR 0
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 0
-
-#define UNVIEWPORT_VARS \
- const GLfloat dx = - tmesa->drawX - SUBPIXEL_X; \
- const GLfloat dy = (tmesa->driDrawable->h + \
- tmesa->drawY + SUBPIXEL_Y); \
- const GLfloat sz = 1.0 / tmesa->depth_scale
-
-#define UNVIEWPORT_X(x) x + dx;
-#define UNVIEWPORT_Y(y) - y + dy;
-#define UNVIEWPORT_Z(z) z * sz;
-
-#define PTEX_FALLBACK() tridentFallback(TRIDENT_CONTEXT(ctx), TRIDENT_FALLBACK_TEXTURE, 1)
-
-#define IMPORT_FLOAT_COLORS trident_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS trident_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[tmesa->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[tmesa->SetupIndex].copy_pv
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) trident_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgst0();
- init_wgst0t1();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgft0t1();
- init_wgfpt0();
- init_wgfst0();
- init_wgfst0t1();
- init_wgfspt0();
- init_t0();
- init_t0t1();
- init_f();
- init_ft0();
- init_ft0t1();
- init_g();
- init_gs();
- init_gt0();
- init_gt0t1();
- init_gst0();
- init_gst0t1();
- init_gf();
- init_gfs();
- init_gft0();
- init_gft0t1();
- init_gfst0();
- init_gfst0t1();
-}
-
-void tridentBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)tmesa->verts + (start<<tmesa->vertex_stride_shift));
- GLuint stride = 1<<tmesa->vertex_stride_shift;
-
- newinputs |= tmesa->SetupNewInputs;
- tmesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_POS) {
- setup_tab[tmesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= TRIDENT_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= TRIDENT_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= TRIDENT_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= TRIDENT_TEX1_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= TRIDENT_FOG_BIT;
-
- if (tmesa->SetupIndex & TRIDENT_PTEX_BIT)
- ind = ~0;
-
- ind &= tmesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-void tridentCheckTexSizes( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT( ctx );
-
- if (!setup_tab[tmesa->SetupIndex].check_tex_sizes(ctx)) {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- /* Invalidate stored verts
- */
- tmesa->SetupNewInputs = ~0;
- tmesa->SetupIndex |= TRIDENT_PTEX_BIT;
-
- if (!tmesa->Fallback &&
- !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[tmesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[tmesa->SetupIndex].copy_pv;
- }
- }
-}
-
-void tridentChooseVertexState( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint ind = TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= TRIDENT_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= TRIDENT_FOG_BIT;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- ind |= TRIDENT_TEX0_BIT;
- if (ctx->Texture.Unit[1]._ReallyEnabled) {
- ind |= TRIDENT_TEX1_BIT;
- }
- }
-
- tmesa->SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = trident_interp_extras;
- tnl->Driver.Render.CopyPV = trident_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
- if (setup_tab[ind].vertex_format != tmesa->vertex_format) {
- tmesa->vertex_format = setup_tab[ind].vertex_format;
- tmesa->vertex_size = setup_tab[ind].vertex_size;
- tmesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-}
-
-void tridentInitVB( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- tmesa->verts = (GLubyte *)ALIGN_MALLOC( size * 16 * 4, 32 );
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-}
-
-void tridentFreeVB( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
-
- if (tmesa->verts) {
- ALIGN_FREE(tmesa->verts);
- tmesa->verts = 0;
- }
-
- if (tmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE((void *)tmesa->UbyteSecondaryColor.Ptr);
- tmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (tmesa->UbyteColor.Ptr) {
- ALIGN_FREE((void *)tmesa->UbyteColor.Ptr);
- tmesa->UbyteColor.Ptr = 0;
- }
-}
diff --git a/src/mesa/drivers/dri/unichrome/Makefile b/src/mesa/drivers/dri/unichrome/Makefile
index 5fe00c1bd1f..344d34fce36 100644
--- a/src/mesa/drivers/dri/unichrome/Makefile
+++ b/src/mesa/drivers/dri/unichrome/Makefile
@@ -29,4 +29,3 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 1eab13da8ea..4364ab26eab 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -173,6 +173,8 @@ GLfloat _mesa_ubyte_to_float_color_tab[256];
void
_mesa_notifySwapBuffers(__GLcontext *ctx)
{
+ if (MESA_VERBOSE & VERBOSE_SWAPBUFFERS)
+ _mesa_debug(ctx, "SwapBuffers\n");
FLUSH_CURRENT( ctx, 0 );
if (ctx->Driver.Flush) {
ctx->Driver.Flush(ctx);
@@ -1505,6 +1507,33 @@ _mesa_record_error(GLcontext *ctx, GLenum error)
/**
+ * Flush commands and wait for completion.
+ */
+void
+_mesa_finish(GLcontext *ctx)
+{
+ FLUSH_CURRENT( ctx, 0 );
+ if (ctx->Driver.Finish) {
+ ctx->Driver.Finish(ctx);
+ }
+}
+
+
+/**
+ * Flush commands.
+ */
+void
+_mesa_flush(GLcontext *ctx)
+{
+ FLUSH_CURRENT( ctx, 0 );
+ if (ctx->Driver.Flush) {
+ ctx->Driver.Flush(ctx);
+ }
+}
+
+
+
+/**
* Execute glFinish().
*
* Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the
@@ -1515,10 +1544,7 @@ _mesa_Finish(void)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- FLUSH_CURRENT( ctx, 0 );
- if (ctx->Driver.Finish) {
- ctx->Driver.Finish(ctx);
- }
+ _mesa_finish(ctx);
}
@@ -1533,10 +1559,7 @@ _mesa_Flush(void)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- FLUSH_CURRENT( ctx, 0 );
- if (ctx->Driver.Flush) {
- ctx->Driver.Flush(ctx);
- }
+ _mesa_flush(ctx);
}
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 5587695fa0b..c3be1063f86 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -170,6 +170,14 @@ _mesa_valid_to_render(GLcontext *ctx, const char *where);
extern void
_mesa_record_error( GLcontext *ctx, GLenum error );
+
+extern void
+_mesa_finish(GLcontext *ctx);
+
+extern void
+_mesa_flush(GLcontext *ctx);
+
+
extern void GLAPIENTRY
_mesa_Finish( void );
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index ce5e1586266..25aaddea81f 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -545,12 +545,6 @@ struct dd_function_table {
struct gl_texture_object *t );
/**
- * Called by glPrioritizeTextures().
- */
- void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t,
- GLclampf priority );
-
- /**
* Called by glActiveTextureARB() to set current texture unit.
*/
void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
@@ -717,7 +711,6 @@ struct dd_function_table {
void (*TexParameter)(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params);
- void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
/** Set the viewport */
void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
/*@}*/
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 8492c8561d4..0e35617575e 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -27,6 +27,7 @@
#include "attrib.h"
#include "colormac.h"
#include "context.h"
+#include "enums.h"
#include "hash.h"
#include "imports.h"
#include "debug.h"
@@ -167,14 +168,16 @@ static void add_debug_flags( const char *debug )
static const struct debug_option debug_opt[] = {
{ "varray", VERBOSE_VARRAY },
{ "tex", VERBOSE_TEXTURE },
- { "imm", VERBOSE_IMMEDIATE },
+ { "mat", VERBOSE_MATERIAL },
{ "pipe", VERBOSE_PIPELINE },
{ "driver", VERBOSE_DRIVER },
{ "state", VERBOSE_STATE },
{ "api", VERBOSE_API },
{ "list", VERBOSE_DISPLAY_LIST },
{ "lighting", VERBOSE_LIGHTING },
- { "disassem", VERBOSE_DISASSEM }
+ { "disassem", VERBOSE_DISASSEM },
+ { "draw", VERBOSE_DRAW },
+ { "swap", VERBOSE_SWAPBUFFERS }
};
GLuint i;
@@ -262,10 +265,13 @@ write_ppm(const char *filename, const GLubyte *buffer, int width, int height,
/**
- * Write level[0] image to a ppm file.
+ * Write a texture image to a ppm file.
+ * \param face cube face in [0,5]
+ * \param level mipmap level
*/
static void
-write_texture_image(struct gl_texture_object *texObj, GLuint face, GLuint level)
+write_texture_image(struct gl_texture_object *texObj,
+ GLuint face, GLuint level)
{
struct gl_texture_image *img = texObj->Image[face][level];
if (img) {
@@ -297,16 +303,53 @@ write_texture_image(struct gl_texture_object *texObj, GLuint face, GLuint level)
}
+/**
+ * Write renderbuffer image to a ppm file.
+ */
+static void
+write_renderbuffer_image(const struct gl_renderbuffer *rb)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLubyte *buffer;
+ char s[100];
+ GLenum format, type;
+
+ if (rb->_BaseFormat == GL_RGB ||
+ rb->_BaseFormat == GL_RGBA) {
+ format = GL_RGBA;
+ type = GL_UNSIGNED_BYTE;
+ }
+ else if (rb->_BaseFormat == GL_DEPTH_STENCIL) {
+ format = GL_DEPTH_STENCIL;
+ type = GL_UNSIGNED_INT_24_8;
+ }
+ else {
+ return;
+ }
+
+ buffer = (GLubyte *) _mesa_malloc(rb->Width * rb->Height * 4);
+
+ ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height,
+ format, type, &ctx->DefaultPacking, buffer);
+
+ /* make filename */
+ _mesa_sprintf(s, "/tmp/renderbuffer%u.ppm", rb->Name);
+
+ _mesa_printf(" Writing renderbuffer image to %s\n", s);
+ write_ppm(s, buffer, rb->Width, rb->Height, 4, 0, 1, 2, GL_TRUE);
+
+ _mesa_free(buffer);
+}
+
+
static GLboolean DumpImages;
static void
-dump_texture_cb(GLuint id, void *data, void *userData)
+dump_texture(struct gl_texture_object *texObj)
{
- struct gl_texture_object *texObj = (struct gl_texture_object *) data;
int i;
GLboolean written = GL_FALSE;
- (void) userData;
_mesa_printf("Texture %u\n", texObj->Name);
_mesa_printf(" Target 0x%x\n", texObj->Target);
@@ -327,6 +370,30 @@ dump_texture_cb(GLuint id, void *data, void *userData)
/**
+ * Dump a single texture.
+ */
+void
+_mesa_dump_texture(GLuint texture, GLboolean dumpImages)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture);
+ if (texObj) {
+ DumpImages = dumpImages;
+ dump_texture(texObj);
+ }
+}
+
+
+static void
+dump_texture_cb(GLuint id, void *data, void *userData)
+{
+ struct gl_texture_object *texObj = (struct gl_texture_object *) data;
+ (void) userData;
+ dump_texture(texObj);
+}
+
+
+/**
* Print basic info about all texture objext to stdout.
* If dumpImages is true, write PPM of level[0] image to a file.
*/
@@ -339,6 +406,35 @@ _mesa_dump_textures(GLboolean dumpImages)
}
+static void
+dump_renderbuffer_cb(GLuint id, void *data, void *userData)
+{
+ const struct gl_renderbuffer *rb = (const struct gl_renderbuffer *) data;
+ (void) userData;
+
+ _mesa_printf("Renderbuffer %u: %u x %u IntFormat = %s\n",
+ rb->Name, rb->Width, rb->Height,
+ _mesa_lookup_enum_by_nr(rb->InternalFormat));
+ if (DumpImages) {
+ write_renderbuffer_image(rb);
+ }
+}
+
+
+/**
+ * Print basic info about all renderbuffers to stdout.
+ * If dumpImages is true, write PPM of level[0] image to a file.
+ */
+void
+_mesa_dump_renderbuffers(GLboolean dumpImages)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ DumpImages = dumpImages;
+ _mesa_HashWalk(ctx->Shared->RenderBuffers, dump_renderbuffer_cb, ctx);
+}
+
+
+
void
_mesa_dump_color_buffer(const char *filename)
{
diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h
index bb384c43242..f66f774a45d 100644
--- a/src/mesa/main/debug.h
+++ b/src/mesa/main/debug.h
@@ -58,9 +58,15 @@ extern void _mesa_init_debug( GLcontext *ctx );
#endif
extern void
+_mesa_dump_texture(GLuint texture, GLboolean dumpImages);
+
+extern void
_mesa_dump_textures(GLboolean dumpImages);
extern void
+_mesa_dump_renderbuffers(GLboolean dumpImages);
+
+extern void
_mesa_dump_color_buffer(const char *filename);
extern void
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 6ffaddcde96..30fa55997ef 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -48,6 +48,13 @@
#include "context.h"
#include "version.h"
+#ifdef _GNU_SOURCE
+#include <locale.h>
+#ifdef __APPLE__
+#include <xlocale.h>
+#endif
+#endif
+
#define MAXSTRING 4000 /* for vsnprintf() */
@@ -908,7 +915,15 @@ _mesa_atoi(const char *s)
double
_mesa_strtod( const char *s, char **end )
{
+#ifdef _GNU_SOURCE
+ static locale_t loc = NULL;
+ if (!loc) {
+ loc = newlocale(LC_CTYPE_MASK, "C", NULL);
+ }
+ return strtod_l(s, end, loc);
+#else
return strtod(s, end);
+#endif
}
/** Compute simple checksum/hash for a string */
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 10c89f43688..1c8a081e9a6 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -636,7 +636,7 @@ _mesa_update_material( GLcontext *ctx, GLuint bitmask )
struct gl_light *light, *list = &ctx->Light.EnabledList;
GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
- if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
+ if (MESA_VERBOSE & VERBOSE_MATERIAL)
_mesa_debug(ctx, "_mesa_update_material, mask 0x%x\n", bitmask);
if (!bitmask)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 0f9a9685795..21eff858048 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 7.5
+ * Version: 7.7
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
@@ -208,7 +208,7 @@ typedef enum
VERT_RESULT_BFC0 = 13,
VERT_RESULT_BFC1 = 14,
VERT_RESULT_EDGE = 15,
- VERT_RESULT_VAR0 = 16 /**< shader varying */,
+ VERT_RESULT_VAR0 = 16, /**< shader varying */
VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING)
} gl_vert_result;
@@ -1917,10 +1917,10 @@ struct ati_fragment_shader
struct atifs_instruction *Instructions[2];
struct atifs_setupinst *SetupInst[2];
GLfloat Constants[8][4];
- GLbitfield LocalConstDef; /** Indicates which constants have been set */
+ GLbitfield LocalConstDef; /**< Indicates which constants have been set */
GLubyte numArithInstr[2];
GLubyte regsAssigned[2];
- GLubyte NumPasses; /** 1 or 2 */
+ GLubyte NumPasses; /**< 1 or 2 */
GLubyte cur_pass;
GLubyte last_optype;
GLboolean interpinp1;
@@ -1934,7 +1934,7 @@ struct ati_fragment_shader
struct gl_ati_fragment_shader_state
{
GLboolean Enabled;
- GLboolean _Enabled; /** enabled and valid shader? */
+ GLboolean _Enabled; /**< enabled and valid shader? */
GLboolean Compiling;
GLfloat GlobalConstants[8][4];
struct ati_fragment_shader *Current;
@@ -2046,6 +2046,7 @@ struct gl_shader_program
#define GLSL_UNIFORMS 0x10 /**< Print glUniform calls */
#define GLSL_NOP_VERT 0x20 /**< Force no-op vertex shaders */
#define GLSL_NOP_FRAG 0x40 /**< Force no-op fragment shaders */
+#define GLSL_USE_PROG 0x80 /**< Log glUseProgram calls */
/**
@@ -3122,11 +3123,12 @@ extern int MESA_DEBUG_FLAGS;
#endif
+/** The MESA_VERBOSE var is a bitmask of these flags */
enum _verbose
{
VERBOSE_VARRAY = 0x0001,
VERBOSE_TEXTURE = 0x0002,
- VERBOSE_IMMEDIATE = 0x0004,
+ VERBOSE_MATERIAL = 0x0004,
VERBOSE_PIPELINE = 0x0008,
VERBOSE_DRIVER = 0x0010,
VERBOSE_STATE = 0x0020,
@@ -3136,9 +3138,12 @@ enum _verbose
VERBOSE_PRIMS = 0x0400,
VERBOSE_VERTS = 0x0800,
VERBOSE_DISASSEM = 0x1000,
+ VERBOSE_DRAW = 0x2000,
+ VERBOSE_SWAPBUFFERS = 0x4000
};
+/** The MESA_DEBUG_FLAGS var is a bitmask of these flags */
enum _debug
{
DEBUG_ALWAYS_FLUSH = 0x1
diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c
index bc76b912913..96fd8695a59 100644
--- a/src/mesa/main/shaders.c
+++ b/src/mesa/main/shaders.c
@@ -388,7 +388,6 @@ _mesa_read_shader(const char *fname)
int len;
if (!f) {
- _mesa_fprintf(stderr, "Unable to open shader file %s\n", fname);
return NULL;
}
@@ -401,11 +400,6 @@ _mesa_read_shader(const char *fname)
shader = _mesa_strdup(buffer);
free(buffer);
- if (0) {
- _mesa_fprintf(stderr, "Read shader %s:\n", fname);
- _mesa_fprintf(stderr, "%s\n", shader);
- }
-
return shader;
}
@@ -475,19 +469,25 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
source[totalLength - 1] = '\0';
source[totalLength - 2] = '\0';
-#if 0
if (0) {
+ /* Compute the shader's source code checksum then try to open a file
+ * named newshader_<CHECKSUM>. If it exists, use it in place of the
+ * original shader source code. For debugging.
+ */
+ const GLuint checksum = _mesa_str_checksum(source);
+ char filename[100];
GLcharARB *newSource;
- newSource = _mesa_read_shader("newshader.frag");
+ sprintf(filename, "newshader_%d", checksum);
+
+ newSource = _mesa_read_shader(filename);
if (newSource) {
+ _mesa_fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n",
+ shaderObj, checksum, filename);
_mesa_free(source);
source = newSource;
}
- }
-#else
- (void) _mesa_read_shader;
-#endif
+ }
ctx->Driver.ShaderSource(ctx, shaderObj, source);
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 8fd5eaa2661..31832184c0e 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1098,8 +1098,6 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
struct gl_texture_object *t = _mesa_lookup_texture(ctx, texName[i]);
if (t) {
t->Priority = CLAMP( priorities[i], 0.0F, 1.0F );
- if (ctx->Driver.PrioritizeTexture)
- ctx->Driver.PrioritizeTexture( ctx, t, t->Priority );
}
}
}
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 43f26873e0f..16492bd7bcf 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -307,10 +307,6 @@ _mesa_ActiveTextureARB(GLenum texture)
/* update current stack pointer */
ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit];
}
-
- if (ctx->Driver.ActiveTexture) {
- (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit );
- }
}
@@ -360,9 +356,6 @@ update_texture_matrices( GLcontext *ctx )
if (ctx->Texture.Unit[u]._ReallyEnabled &&
ctx->TextureMatrixStack[u].Top->type != MATRIX_IDENTITY)
ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u);
-
- if (ctx->Driver.TextureMatrix)
- ctx->Driver.TextureMatrix( ctx, u, ctx->TextureMatrixStack[u].Top);
}
}
}
diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c
index 83521371457..3a1a4718453 100644
--- a/src/mesa/shader/lex.yy.c
+++ b/src/mesa/shader/lex.yy.c
@@ -357,8 +357,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 177
-#define YY_END_OF_BUFFER 178
+#define YY_NUM_RULES 180
+#define YY_END_OF_BUFFER 181
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -366,103 +366,109 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[862] =
+static yyconst flex_int16_t yy_accept[916] =
{ 0,
- 0, 0, 178, 176, 174, 173, 176, 176, 146, 172,
- 148, 148, 148, 148, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 174, 0, 0, 175,
- 146, 0, 147, 149, 169, 169, 0, 0, 0, 0,
- 169, 0, 0, 0, 0, 0, 0, 0, 126, 170,
- 127, 128, 160, 160, 160, 160, 0, 148, 0, 134,
- 135, 136, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
-
- 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 168,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 167,
- 167, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 166, 166, 166, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 157, 157, 157,
- 158, 158, 159, 150, 149, 150, 0, 151, 11, 12,
- 146, 13, 14, 15, 146, 16, 17, 18, 19, 146,
-
- 20, 21, 22, 23, 24, 25, 6, 26, 27, 28,
- 29, 30, 32, 31, 33, 34, 35, 36, 37, 38,
- 39, 146, 146, 146, 146, 146, 44, 47, 46, 146,
- 45, 48, 49, 50, 51, 52, 53, 54, 146, 55,
- 56, 57, 58, 59, 60, 61, 62, 146, 63, 64,
- 65, 66, 146, 146, 71, 72, 146, 146, 146, 146,
- 146, 146, 0, 0, 0, 0, 149, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 87, 88, 90,
- 0, 165, 0, 0, 0, 0, 0, 0, 104, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 164,
-
- 163, 163, 116, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 154, 154, 155, 156, 0, 152, 11,
- 11, 146, 12, 12, 12, 146, 146, 146, 146, 146,
- 19, 19, 146, 137, 20, 20, 146, 21, 21, 146,
- 22, 22, 146, 23, 23, 146, 24, 24, 146, 25,
- 25, 146, 26, 26, 146, 28, 28, 146, 29, 29,
- 146, 32, 32, 146, 31, 31, 146, 34, 34, 146,
- 35, 35, 146, 36, 36, 146, 37, 37, 146, 38,
- 38, 146, 39, 39, 146, 146, 146, 146, 40, 146,
- 42, 146, 44, 44, 146, 47, 46, 46, 146, 138,
-
- 48, 48, 146, 49, 49, 146, 146, 51, 51, 146,
- 52, 52, 146, 53, 53, 146, 54, 54, 146, 146,
- 55, 55, 146, 56, 56, 146, 57, 57, 146, 58,
- 58, 146, 59, 60, 60, 146, 61, 61, 146, 146,
- 10, 63, 146, 64, 146, 65, 146, 66, 146, 67,
- 146, 69, 146, 71, 71, 146, 146, 146, 146, 146,
- 146, 146, 146, 0, 171, 0, 0, 0, 80, 81,
- 0, 0, 0, 0, 0, 0, 0, 92, 0, 0,
+ 0, 0, 181, 179, 177, 176, 179, 179, 149, 175,
+ 151, 151, 151, 151, 149, 149, 149, 149, 149, 149,
+ 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
+ 149, 149, 149, 149, 149, 149, 177, 0, 0, 178,
+ 149, 0, 150, 152, 172, 172, 0, 0, 0, 0,
+ 172, 0, 0, 0, 0, 0, 0, 0, 129, 173,
+ 130, 131, 163, 163, 163, 163, 0, 151, 0, 137,
+ 138, 139, 149, 149, 149, 149, 149, 149, 149, 149,
+ 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
+ 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
+
+ 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
+ 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
+ 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
+ 149, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 171, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 170, 170, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 169, 169, 169, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 160, 160,
+ 160, 161, 161, 162, 153, 152, 153, 0, 154, 11,
+ 12, 149, 13, 14, 15, 149, 16, 17, 18, 19,
+
+ 149, 20, 21, 22, 23, 24, 25, 6, 26, 27,
+ 28, 29, 30, 32, 31, 33, 34, 35, 36, 37,
+ 38, 39, 149, 149, 149, 149, 149, 149, 46, 149,
+ 49, 48, 149, 47, 50, 51, 52, 53, 54, 55,
+ 56, 149, 57, 58, 59, 60, 61, 62, 63, 64,
+ 149, 65, 66, 67, 68, 69, 149, 149, 74, 75,
+ 149, 149, 149, 149, 149, 149, 0, 0, 0, 0,
+ 152, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 90, 91, 93, 0, 168, 0, 0, 0, 0,
+ 0, 0, 107, 0, 0, 0, 0, 0, 0, 0,
+
+ 0, 0, 0, 167, 166, 166, 119, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 157, 157, 158,
+ 159, 0, 155, 11, 11, 149, 12, 12, 12, 149,
+ 149, 149, 149, 149, 19, 19, 149, 140, 20, 20,
+ 149, 21, 21, 149, 22, 22, 149, 23, 23, 149,
+ 24, 24, 149, 25, 25, 149, 26, 26, 149, 28,
+ 28, 149, 29, 29, 149, 32, 32, 149, 31, 31,
+ 149, 34, 34, 149, 35, 35, 149, 36, 36, 149,
+ 37, 37, 149, 38, 38, 149, 39, 39, 149, 149,
+ 149, 149, 40, 149, 42, 149, 45, 46, 46, 149,
+
+ 149, 49, 48, 48, 149, 141, 50, 50, 149, 51,
+ 51, 149, 149, 53, 53, 149, 54, 54, 149, 55,
+ 55, 149, 56, 56, 149, 149, 57, 57, 149, 58,
+ 58, 149, 59, 59, 149, 60, 60, 149, 61, 62,
+ 62, 149, 63, 63, 149, 149, 10, 65, 149, 66,
+ 149, 67, 149, 68, 69, 149, 70, 149, 72, 149,
+ 74, 74, 149, 149, 149, 149, 149, 149, 149, 149,
+ 0, 174, 0, 0, 0, 83, 84, 0, 0, 0,
+ 0, 0, 0, 0, 95, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 162, 0, 0, 0,
-
- 120, 0, 122, 0, 0, 0, 0, 0, 0, 161,
- 153, 146, 146, 146, 4, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 146, 146, 9, 41,
- 43, 146, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 67, 146, 68, 69, 146, 70, 146, 146,
- 146, 146, 146, 76, 146, 146, 0, 0, 0, 0,
- 0, 82, 83, 0, 0, 0, 0, 91, 0, 0,
- 95, 98, 0, 0, 0, 0, 0, 0, 0, 109,
-
- 110, 0, 0, 0, 0, 115, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 146, 146, 146, 146,
- 146, 146, 5, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 7, 8, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 146, 68, 146, 146, 70,
- 146, 146, 146, 146, 146, 77, 146, 73, 0, 0,
- 0, 0, 131, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 101, 0, 105, 106, 0, 108, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 124, 125,
- 0, 0, 132, 11, 3, 12, 142, 143, 146, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 28, 29,
- 32, 31, 34, 35, 36, 37, 38, 39, 44, 46,
- 48, 49, 50, 51, 52, 53, 54, 146, 146, 146,
- 55, 56, 57, 58, 60, 61, 62, 63, 64, 65,
- 66, 146, 146, 146, 146, 71, 72, 146, 75, 133,
- 0, 0, 78, 0, 84, 0, 0, 0, 93, 0,
- 0, 0, 0, 0, 0, 107, 0, 0, 113, 100,
- 0, 0, 0, 0, 0, 0, 129, 0, 146, 139,
-
- 140, 146, 67, 146, 69, 146, 74, 0, 0, 0,
- 0, 86, 89, 94, 0, 0, 99, 0, 0, 0,
- 112, 0, 0, 0, 0, 121, 123, 0, 146, 146,
- 68, 70, 2, 1, 0, 85, 0, 97, 0, 103,
- 111, 0, 0, 118, 119, 130, 146, 141, 0, 96,
- 0, 114, 117, 146, 79, 102, 146, 146, 144, 145,
- 0
+
+ 0, 0, 0, 165, 0, 0, 0, 123, 0, 125,
+ 0, 0, 0, 0, 0, 0, 164, 156, 11, 149,
+ 12, 149, 149, 4, 149, 149, 149, 19, 149, 20,
+ 149, 21, 149, 22, 149, 23, 149, 24, 149, 25,
+ 149, 26, 149, 28, 149, 29, 149, 32, 149, 31,
+ 149, 34, 149, 35, 149, 36, 149, 37, 149, 38,
+ 149, 39, 149, 149, 149, 9, 41, 43, 46, 149,
+ 44, 49, 48, 149, 50, 149, 51, 149, 149, 53,
+ 149, 54, 149, 55, 149, 56, 149, 149, 57, 149,
+ 58, 149, 59, 149, 60, 149, 61, 62, 149, 63,
+
+ 149, 149, 65, 149, 66, 149, 67, 149, 68, 69,
+ 149, 70, 149, 71, 72, 149, 73, 74, 149, 149,
+ 149, 149, 149, 79, 149, 149, 0, 0, 0, 0,
+ 0, 85, 86, 0, 0, 0, 0, 94, 0, 0,
+ 98, 101, 0, 0, 0, 0, 0, 0, 0, 112,
+ 113, 0, 0, 0, 0, 118, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 149, 149, 149, 149,
+ 149, 149, 5, 149, 149, 149, 149, 149, 149, 149,
+ 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
+ 149, 149, 7, 8, 149, 149, 149, 149, 149, 149,
+
+ 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
+ 149, 149, 149, 149, 149, 70, 149, 71, 149, 72,
+ 149, 73, 149, 149, 149, 149, 149, 80, 149, 76,
+ 0, 0, 0, 0, 134, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 104, 0, 108, 109, 0, 111,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 127, 128, 0, 0, 135, 11, 3, 12, 145, 146,
+ 149, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 28, 29, 32, 31, 34, 35, 36, 37, 38, 39,
+ 46, 48, 50, 51, 52, 53, 54, 55, 56, 149,
+
+ 149, 149, 57, 58, 59, 60, 62, 63, 64, 65,
+ 66, 67, 69, 149, 71, 149, 149, 73, 149, 74,
+ 75, 149, 78, 136, 0, 0, 81, 0, 87, 0,
+ 0, 0, 96, 0, 0, 0, 0, 0, 0, 110,
+ 0, 0, 116, 103, 0, 0, 0, 0, 0, 0,
+ 132, 0, 149, 142, 143, 149, 70, 149, 72, 149,
+ 77, 0, 0, 0, 0, 89, 92, 97, 0, 0,
+ 102, 0, 0, 0, 115, 0, 0, 0, 0, 124,
+ 126, 0, 149, 149, 71, 73, 2, 1, 0, 88,
+ 0, 100, 0, 106, 114, 0, 0, 121, 122, 133,
+
+ 149, 144, 0, 99, 0, 117, 120, 149, 82, 105,
+ 149, 149, 147, 148, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -508,205 +514,217 @@ static yyconst flex_int32_t yy_meta[68] =
2, 2, 2, 2, 2, 2, 2
} ;
-static yyconst flex_int16_t yy_base[865] =
+static yyconst flex_int16_t yy_base[919] =
{ 0,
- 0, 0, 1310, 1311, 66, 1311, 1304, 1305, 0, 69,
- 85, 128, 140, 152, 151, 1275, 58, 56, 63, 76,
- 1282, 158, 160, 42, 163, 173, 189, 68, 1275, 80,
- 1245, 1244, 1256, 1240, 1254, 1253, 105, 1282, 1294, 1311,
- 0, 225, 1311, 218, 160, 157, 20, 123, 66, 119,
- 192, 1254, 1240, 186, 162, 1238, 1250, 197, 1311, 201,
- 244, 44, 231, 181, 238, 242, 300, 312, 323, 1311,
- 1311, 1311, 1259, 1272, 1266, 313, 1255, 1272, 1261, 1256,
- 1252, 1267, 106, 305, 1249, 1263, 225, 1249, 1262, 1253,
- 1266, 1243, 1254, 1245, 182, 1246, 1237, 1246, 1237, 1236,
-
- 1237, 144, 1231, 236, 163, 1241, 1235, 1232, 1233, 1237,
- 239, 1246, 1233, 242, 1240, 1237, 1226, 1240, 1216, 119,
- 323, 249, 1236, 1235, 1211, 1196, 1191, 1208, 1184, 1189,
- 1215, 204, 1204, 274, 1199, 349, 306, 1201, 1182, 308,
- 1192, 1188, 1183, 240, 1189, 1175, 1191, 1188, 1179, 326,
- 328, 1181, 1170, 1184, 1187, 1169, 1184, 1171, 1168, 1175,
- 288, 1183, 322, 323, 335, 338, 350, 1160, 1177, 1178,
- 1171, 1153, 343, 1154, 1176, 1167, 336, 340, 346, 350,
- 354, 358, 362, 1311, 420, 431, 437, 443, 441, 442,
- 1200, 0, 0, 1199, 1182, 0, 0, 1172, 444, 1192,
-
- 445, 452, 469, 471, 473, 472, 0, 497, 0, 498,
- 499, 0, 500, 501, 0, 525, 526, 527, 537, 538,
- 554, 1187, 1180, 1193, 320, 349, 562, 1190, 564, 1173,
- 0, 565, 566, 1165, 581, 591, 592, 593, 1186, 594,
- 618, 619, 620, 1186, 630, 631, 1162, 1172, 420, 484,
- 510, 603, 373, 464, 647, 1160, 1152, 1151, 1136, 1136,
- 1135, 1134, 1177, 1149, 1137, 663, 670, 644, 1141, 329,
- 1138, 1132, 1132, 1126, 1139, 1139, 1124, 1311, 1311, 1139,
- 1127, 647, 1134, 501, 1131, 1137, 581, 1132, 1311, 1123,
- 1130, 1129, 1132, 1118, 1117, 1121, 1116, 421, 1121, 651,
-
- 654, 666, 1311, 1113, 1111, 1111, 1119, 1120, 1102, 671,
- 1107, 1113, 656, 662, 669, 673, 677, 735, 741, 1119,
- 683, 1126, 1117, 689, 739, 1124, 1123, 1116, 1130, 1120,
- 1111, 740, 1118, 0, 1109, 742, 1116, 1107, 743, 1114,
- 1105, 744, 1112, 1103, 745, 1110, 1101, 746, 1108, 1099,
- 747, 1106, 1097, 748, 1104, 1095, 749, 1102, 1093, 750,
- 1100, 1091, 751, 1098, 1089, 752, 1096, 1087, 753, 1094,
- 1085, 754, 1092, 1083, 755, 1090, 1081, 756, 1088, 1079,
- 757, 1086, 1077, 758, 1084, 1087, 1080, 1087, 0, 1080,
- 0, 1095, 1070, 759, 1077, 0, 1068, 760, 1075, 0,
-
- 1066, 761, 1073, 1064, 764, 1071, 1070, 1061, 785, 1068,
- 1059, 786, 1066, 1057, 788, 1064, 1055, 789, 1062, 1065,
- 1052, 790, 1059, 1050, 791, 1057, 1048, 792, 1055, 1046,
- 793, 1053, 0, 1044, 794, 1051, 1042, 795, 1049, 1048,
- 0, 1039, 1046, 1037, 1044, 1035, 1042, 1033, 1040, 796,
- 1039, 797, 1054, 1029, 798, 1036, 1035, 1013, 1007, 1012,
- 1018, 1001, 1016, 527, 1311, 1015, 1005, 1009, 1311, 1311,
- 999, 1008, 994, 1011, 994, 997, 991, 1311, 992, 991,
- 988, 995, 988, 996, 992, 1002, 999, 981, 987, 994,
- 978, 977, 995, 977, 989, 988, 1311, 987, 977, 981,
-
- 1311, 968, 1311, 973, 973, 981, 964, 965, 975, 1311,
- 1311, 1007, 989, 1005, 0, 634, 1003, 1003, 1002, 1001,
- 1000, 999, 998, 997, 996, 995, 994, 993, 992, 991,
- 990, 989, 988, 987, 986, 985, 972, 965, 0, 0,
- 0, 982, 981, 980, 979, 978, 977, 976, 975, 974,
- 952, 972, 971, 970, 969, 968, 967, 966, 965, 964,
- 963, 962, 936, 943, 799, 934, 941, 800, 957, 956,
- 925, 928, 908, 0, 909, 902, 909, 908, 909, 901,
- 919, 1311, 1311, 901, 899, 909, 902, 1311, 897, 914,
- 443, 1311, 905, 889, 890, 899, 890, 889, 889, 1311,
-
- 888, 897, 887, 903, 900, 1311, 899, 897, 886, 887,
- 883, 875, 882, 877, 878, 873, 899, 899, 897, 911,
- 910, 905, 0, 893, 892, 891, 890, 889, 888, 887,
- 886, 885, 884, 883, 882, 881, 880, 879, 878, 877,
- 876, 875, 0, 0, 874, 873, 872, 871, 870, 869,
- 868, 867, 866, 541, 865, 864, 863, 862, 861, 860,
- 859, 858, 857, 856, 855, 872, 846, 853, 869, 843,
- 850, 848, 847, 825, 825, 0, 832, 0, 866, 865,
- 814, 832, 1311, 827, 822, 815, 811, 823, 813, 811,
- 807, 823, 814, 813, 1311, 1311, 816, 1311, 811, 804,
-
- 793, 804, 796, 800, 813, 808, 811, 793, 1311, 1311,
- 805, 794, 1311, 0, 0, 0, 0, 0, 833, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1453, 1454, 66, 1454, 1447, 1448, 0, 69,
+ 85, 128, 140, 152, 151, 1418, 58, 56, 63, 76,
+ 1425, 158, 160, 42, 172, 173, 190, 68, 1418, 80,
+ 1388, 1387, 1399, 1383, 1397, 1396, 105, 1425, 1437, 1454,
+ 0, 226, 1454, 219, 161, 193, 20, 123, 66, 119,
+ 195, 1397, 1383, 146, 163, 1381, 1393, 200, 1454, 202,
+ 245, 44, 232, 182, 239, 243, 301, 313, 324, 1454,
+ 1454, 1454, 1402, 1415, 1409, 314, 1398, 1415, 1404, 1399,
+ 1395, 1410, 106, 306, 1392, 1406, 169, 1392, 1405, 1396,
+ 1409, 1386, 1397, 1388, 202, 1389, 1380, 1389, 1380, 1379,
+
+ 1380, 144, 225, 1378, 233, 259, 1384, 1378, 1375, 1376,
+ 1380, 240, 1389, 1376, 297, 1383, 1380, 1369, 1383, 1359,
+ 119, 324, 252, 1379, 1378, 1354, 1339, 1334, 1351, 1327,
+ 1332, 1358, 288, 1347, 302, 1342, 352, 309, 1344, 1325,
+ 327, 1335, 1331, 1326, 241, 1332, 1318, 1334, 1331, 1322,
+ 313, 331, 1324, 1313, 1327, 1330, 1312, 1327, 1314, 1311,
+ 1318, 323, 1326, 207, 327, 345, 349, 353, 1303, 1320,
+ 1321, 1314, 1296, 338, 1297, 1319, 1310, 349, 353, 357,
+ 361, 365, 369, 373, 1454, 431, 442, 448, 454, 452,
+ 453, 1343, 0, 0, 1342, 1325, 0, 0, 1315, 455,
+
+ 1335, 456, 463, 480, 482, 484, 483, 0, 508, 0,
+ 509, 510, 0, 511, 512, 0, 536, 537, 538, 548,
+ 549, 565, 1330, 1323, 1336, 375, 364, 1335, 573, 1327,
+ 1331, 575, 1314, 0, 576, 577, 1306, 592, 602, 603,
+ 604, 1327, 605, 629, 630, 631, 1327, 641, 642, 1303,
+ 1313, 362, 431, 495, 1324, 521, 457, 372, 658, 1300,
+ 1292, 1291, 1276, 1276, 1275, 1274, 1317, 1289, 1277, 674,
+ 681, 655, 1281, 133, 1278, 1272, 1272, 1266, 1279, 1279,
+ 1264, 1454, 1454, 1279, 1267, 658, 1274, 512, 1271, 1277,
+ 573, 1272, 1454, 1263, 1270, 1269, 1272, 1258, 1257, 1261,
+
+ 1256, 297, 1261, 662, 665, 677, 1454, 1253, 1251, 1251,
+ 1259, 1260, 1242, 682, 1247, 1253, 444, 591, 667, 673,
+ 680, 738, 744, 701, 700, 1267, 750, 744, 745, 1266,
+ 1265, 1258, 1272, 1262, 756, 746, 1261, 0, 758, 752,
+ 1260, 761, 755, 1259, 764, 759, 1258, 768, 762, 1257,
+ 771, 765, 1256, 778, 766, 1255, 784, 772, 1254, 800,
+ 774, 1253, 806, 780, 1252, 812, 783, 1251, 816, 790,
+ 1250, 818, 796, 1249, 822, 802, 1248, 824, 820, 1247,
+ 829, 826, 1246, 835, 830, 1245, 839, 833, 1244, 1247,
+ 1240, 1247, 0, 1240, 0, 1255, 0, 844, 834, 1238,
+
+ 1254, 395, 858, 838, 1236, 0, 862, 840, 1235, 867,
+ 842, 1234, 1233, 876, 848, 1232, 880, 864, 1231, 882,
+ 866, 1230, 884, 870, 1229, 1232, 886, 883, 1227, 899,
+ 888, 1226, 902, 896, 1225, 905, 900, 1224, 437, 909,
+ 904, 1223, 920, 908, 1222, 1221, 0, 922, 1220, 924,
+ 1219, 928, 1218, 472, 937, 1217, 910, 1216, 918, 1231,
+ 942, 926, 1214, 1213, 1191, 1185, 1190, 1196, 1179, 1194,
+ 538, 1454, 1193, 1183, 1187, 1454, 1454, 1177, 1186, 1172,
+ 1189, 1172, 1175, 1169, 1454, 1170, 1169, 1166, 1173, 1166,
+ 1174, 1170, 1180, 1177, 1159, 1165, 1172, 1156, 1155, 1173,
+
+ 1155, 1167, 1166, 1454, 1165, 1155, 1159, 1454, 1146, 1454,
+ 1151, 1151, 1159, 1142, 1143, 1153, 1454, 1454, 1160, 1184,
+ 1158, 1165, 1181, 0, 943, 1179, 1179, 1153, 1177, 1151,
+ 1175, 1149, 1173, 1147, 1171, 1145, 1169, 1143, 1167, 1141,
+ 1165, 1139, 1163, 1137, 1161, 1135, 1159, 1133, 1157, 1131,
+ 1155, 1129, 1153, 1127, 1151, 1125, 1149, 1123, 1147, 1121,
+ 1145, 1119, 1143, 1130, 1123, 0, 0, 0, 1115, 1139,
+ 0, 0, 1113, 1137, 1111, 1135, 1109, 1133, 1132, 1106,
+ 1130, 1104, 1128, 1102, 1126, 1100, 1124, 1102, 1097, 1121,
+ 1095, 1119, 1093, 1117, 1091, 1115, 0, 1089, 1113, 1087,
+
+ 1111, 1110, 1084, 1108, 1082, 1106, 1080, 1104, 0, 1078,
+ 1102, 946, 1084, 940, 960, 1083, 944, 1074, 1098, 1097,
+ 1066, 1069, 1049, 0, 1050, 1043, 1050, 1049, 1050, 1042,
+ 1060, 1454, 1454, 1042, 1040, 1050, 1043, 1454, 1038, 1055,
+ 621, 1454, 1046, 1030, 1031, 1040, 1031, 1030, 1030, 1454,
+ 1029, 1038, 1028, 1044, 1041, 1454, 1040, 1038, 1027, 1028,
+ 1024, 1016, 1023, 1018, 1019, 1014, 1040, 1040, 1038, 1052,
+ 1051, 1046, 0, 1034, 1033, 1032, 1031, 1030, 1029, 1028,
+ 1027, 1026, 1025, 1024, 1023, 1022, 1021, 1020, 1019, 1018,
+ 1017, 1016, 0, 0, 1015, 1014, 1013, 1012, 1011, 1010,
+
+ 1009, 1008, 1007, 552, 1006, 1005, 1004, 1003, 1002, 1001,
+ 1000, 999, 998, 997, 996, 988, 1012, 962, 994, 985,
+ 1009, 964, 991, 989, 988, 966, 966, 0, 973, 0,
+ 1007, 1006, 955, 973, 1454, 968, 963, 956, 952, 958,
+ 947, 944, 940, 956, 947, 946, 1454, 1454, 949, 1454,
+ 944, 937, 926, 937, 929, 933, 946, 940, 942, 923,
+ 1454, 1454, 934, 923, 1454, 0, 0, 0, 0, 0,
+ 961, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 829, 828, 808,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 791, 808, 789, 806, 0, 0, 760, 0, 0,
- 811, 810, 1311, 670, 1311, 662, 661, 667, 1311, 651,
- 660, 648, 647, 643, 645, 1311, 599, 609, 1311, 1311,
- 605, 594, 580, 568, 561, 573, 1311, 548, 583, 0,
-
- 0, 583, 0, 566, 0, 559, 0, 581, 571, 521,
- 499, 1311, 1311, 1311, 23, 59, 1311, 151, 177, 206,
- 1311, 235, 236, 234, 257, 1311, 1311, 298, 362, 361,
- 0, 0, 1311, 1311, 380, 1311, 384, 1311, 425, 1311,
- 1311, 423, 429, 1311, 1311, 1311, 461, 0, 451, 1311,
- 443, 1311, 1311, 515, 1311, 1311, 515, 516, 0, 0,
- 1311, 841, 544, 844
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 949,
+
+ 947, 944, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 926, 901, 888, 868, 859, 882, 0,
+ 0, 803, 0, 0, 853, 833, 1454, 775, 1454, 774,
+ 763, 759, 1454, 716, 690, 673, 674, 668, 676, 1454,
+ 649, 660, 1454, 1454, 659, 649, 618, 606, 592, 605,
+ 1454, 579, 619, 0, 0, 613, 0, 595, 0, 579,
+ 0, 59, 94, 150, 162, 1454, 1454, 1454, 246, 256,
+ 1454, 273, 289, 332, 1454, 329, 346, 343, 351, 1454,
+ 1454, 443, 470, 483, 0, 0, 1454, 1454, 463, 1454,
+ 484, 1454, 492, 1454, 1454, 490, 487, 1454, 1454, 1454,
+
+ 520, 0, 510, 1454, 517, 1454, 1454, 600, 1454, 1454,
+ 573, 583, 0, 0, 1454, 1005, 602, 1008
} ;
-static yyconst flex_int16_t yy_def[865] =
+static yyconst flex_int16_t yy_def[919] =
{ 0,
- 861, 1, 861, 861, 861, 861, 861, 862, 863, 861,
- 861, 861, 861, 861, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 861, 861, 862, 861,
- 863, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 864, 861, 861, 861,
- 861, 861, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
-
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
-
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
-
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
-
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
-
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
-
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
-
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 863, 863, 863, 863, 863, 863, 863, 863, 863, 863,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 863, 863,
-
- 863, 863, 863, 863, 863, 863, 863, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 863, 863,
- 863, 863, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 863, 863, 861, 861,
- 861, 861, 861, 863, 861, 861, 863, 863, 863, 863,
- 0, 861, 861, 861
+ 915, 1, 915, 915, 915, 915, 915, 916, 917, 915,
+ 915, 915, 915, 915, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 915, 915, 916, 915,
+ 917, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 918, 915, 915, 915,
+ 915, 915, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 917, 917, 917, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 917, 917, 917, 917, 917, 917, 917, 917,
+ 917, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 917, 917, 917, 917, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+
+ 917, 917, 915, 915, 915, 915, 915, 917, 915, 915,
+ 917, 917, 917, 917, 0, 915, 915, 915
} ;
-static yyconst flex_int16_t yy_nxt[1379] =
+static yyconst flex_int16_t yy_nxt[1522] =
{ 0,
4, 5, 6, 5, 7, 8, 9, 4, 10, 11,
12, 13, 14, 11, 11, 15, 16, 17, 18, 19,
@@ -714,154 +732,171 @@ static yyconst flex_int16_t yy_nxt[1379] =
9, 26, 27, 28, 29, 9, 9, 30, 9, 9,
9, 9, 9, 9, 9, 9, 31, 9, 9, 9,
9, 9, 9, 9, 9, 9, 32, 9, 33, 34,
- 35, 9, 36, 9, 9, 9, 9, 37, 837, 37,
- 42, 99, 141, 79, 83, 142, 100, 43, 44, 44,
- 44, 44, 44, 44, 80, 84, 81, 120, 85, 174,
- 86, 123, 82, 67, 68, 68, 68, 68, 68, 68,
-
- 87, 88, 175, 838, 69, 121, 37, 89, 37, 124,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 145,
- 146, 54, 55, 56, 57, 58, 59, 60, 61, 62,
- 69, 147, 63, 64, 65, 66, 67, 68, 68, 68,
- 68, 68, 68, 201, 202, 248, 70, 69, 67, 68,
- 68, 68, 68, 68, 68, 225, 249, 226, 71, 69,
- 67, 68, 68, 68, 68, 68, 68, 73, 143, 74,
- 72, 69, 144, 69, 148, 95, 75, 149, 101, 91,
- 230, 92, 76, 96, 77, 69, 93, 102, 97, 94,
- 104, 103, 105, 106, 98, 839, 231, 69, 140, 137,
-
- 217, 137, 137, 156, 137, 107, 108, 137, 109, 110,
- 111, 112, 113, 138, 114, 137, 115, 157, 137, 218,
- 139, 116, 117, 118, 158, 119, 42, 44, 44, 44,
- 44, 44, 44, 150, 151, 154, 208, 136, 161, 137,
- 840, 155, 165, 166, 178, 177, 179, 180, 167, 162,
- 137, 841, 163, 228, 209, 164, 168, 138, 237, 137,
- 253, 241, 254, 136, 139, 229, 132, 133, 47, 48,
- 49, 50, 238, 52, 53, 242, 176, 54, 55, 56,
- 57, 58, 59, 134, 61, 62, 275, 169, 135, 170,
- 842, 843, 171, 172, 177, 177, 177, 177, 276, 844,
-
- 173, 181, 177, 177, 182, 183, 177, 177, 177, 185,
- 185, 185, 185, 185, 185, 265, 845, 203, 204, 186,
- 67, 68, 68, 68, 68, 68, 68, 205, 192, 168,
- 187, 69, 188, 188, 188, 188, 188, 188, 193, 250,
- 292, 251, 389, 846, 194, 186, 293, 268, 268, 268,
- 268, 271, 252, 268, 390, 268, 266, 69, 267, 267,
- 267, 267, 267, 267, 268, 391, 268, 268, 268, 282,
- 268, 295, 297, 268, 467, 268, 268, 268, 298, 300,
- 268, 296, 268, 392, 268, 268, 268, 468, 308, 299,
- 847, 301, 302, 268, 848, 450, 268, 268, 309, 313,
-
- 313, 313, 313, 313, 313, 313, 313, 451, 268, 314,
- 313, 313, 315, 316, 313, 313, 313, 313, 313, 313,
- 313, 317, 313, 313, 313, 313, 313, 313, 313, 44,
- 44, 44, 44, 44, 44, 849, 850, 442, 318, 136,
- 319, 319, 319, 319, 319, 319, 188, 188, 188, 188,
- 188, 188, 188, 188, 188, 188, 188, 188, 320, 323,
- 443, 331, 335, 321, 324, 136, 332, 336, 494, 338,
- 851, 495, 321, 325, 339, 332, 336, 852, 321, 324,
- 452, 322, 326, 339, 333, 337, 341, 853, 344, 350,
- 347, 342, 340, 345, 351, 348, 690, 854, 453, 691,
-
- 342, 444, 345, 351, 348, 855, 342, 856, 345, 343,
- 348, 346, 352, 349, 353, 356, 359, 362, 365, 354,
- 357, 360, 363, 366, 445, 857, 858, 446, 354, 357,
- 360, 363, 366, 859, 860, 357, 360, 355, 358, 361,
- 364, 367, 368, 371, 374, 41, 479, 369, 372, 375,
- 447, 748, 749, 836, 377, 380, 369, 372, 375, 378,
- 381, 480, 369, 372, 375, 370, 373, 376, 378, 381,
- 835, 383, 750, 577, 378, 381, 384, 379, 382, 393,
- 834, 397, 401, 404, 394, 384, 398, 402, 405, 578,
- 833, 384, 832, 394, 385, 398, 402, 405, 408, 831,
-
- 830, 829, 395, 409, 399, 403, 406, 828, 411, 414,
- 417, 421, 409, 412, 415, 418, 422, 827, 409, 826,
- 448, 410, 412, 415, 418, 422, 483, 825, 412, 415,
- 418, 413, 416, 419, 423, 424, 427, 430, 824, 484,
- 425, 428, 431, 449, 620, 621, 823, 434, 437, 425,
- 428, 431, 435, 438, 822, 425, 428, 431, 426, 429,
- 432, 435, 438, 821, 454, 820, 622, 435, 438, 455,
- 436, 439, 267, 267, 267, 267, 267, 267, 455, 267,
- 267, 267, 267, 267, 267, 465, 465, 456, 465, 465,
- 819, 465, 465, 465, 465, 465, 465, 818, 465, 817,
-
- 320, 465, 465, 816, 815, 465, 323, 497, 465, 465,
- 814, 813, 465, 465, 504, 812, 505, 811, 506, 510,
- 510, 510, 510, 322, 465, 510, 510, 510, 510, 326,
- 810, 507, 511, 510, 510, 510, 510, 510, 510, 510,
- 510, 510, 510, 510, 319, 319, 319, 319, 319, 319,
- 319, 319, 319, 319, 319, 319, 323, 331, 513, 335,
- 338, 341, 344, 347, 350, 353, 356, 359, 362, 365,
- 368, 371, 374, 377, 380, 383, 393, 397, 401, 326,
- 333, 404, 337, 340, 343, 346, 349, 352, 355, 358,
- 361, 364, 367, 370, 373, 376, 379, 382, 385, 395,
-
- 399, 403, 408, 411, 406, 414, 417, 421, 424, 427,
- 430, 434, 437, 563, 566, 454, 667, 670, 809, 808,
- 807, 806, 805, 804, 803, 410, 413, 802, 416, 419,
- 423, 426, 429, 432, 436, 439, 564, 567, 456, 668,
- 671, 39, 39, 39, 184, 184, 801, 800, 799, 798,
- 797, 796, 795, 794, 793, 792, 791, 790, 789, 788,
- 787, 786, 785, 784, 783, 782, 781, 780, 779, 778,
- 777, 776, 775, 774, 773, 772, 771, 770, 769, 768,
- 767, 766, 765, 671, 764, 763, 668, 762, 761, 760,
- 759, 758, 757, 756, 755, 754, 753, 752, 751, 747,
-
- 746, 745, 744, 743, 742, 741, 740, 739, 738, 737,
- 736, 735, 734, 733, 732, 731, 730, 729, 728, 727,
- 726, 725, 724, 723, 722, 721, 720, 719, 718, 717,
- 716, 715, 714, 713, 712, 711, 710, 709, 708, 707,
- 706, 705, 704, 703, 702, 701, 700, 699, 698, 697,
- 696, 695, 694, 693, 692, 689, 688, 687, 686, 685,
- 684, 683, 682, 681, 680, 679, 678, 677, 676, 675,
- 674, 673, 672, 669, 567, 666, 564, 665, 664, 663,
- 662, 661, 660, 659, 658, 657, 656, 655, 654, 653,
- 652, 651, 650, 649, 648, 647, 646, 645, 644, 643,
-
- 642, 641, 640, 639, 638, 637, 636, 635, 634, 633,
- 632, 631, 630, 629, 628, 627, 626, 625, 624, 623,
- 619, 618, 617, 616, 615, 614, 613, 612, 611, 610,
- 609, 608, 607, 606, 605, 604, 603, 602, 601, 600,
- 599, 598, 597, 596, 595, 594, 593, 592, 591, 590,
- 589, 588, 587, 586, 585, 584, 583, 582, 581, 580,
- 579, 576, 575, 574, 573, 572, 571, 570, 569, 456,
- 568, 565, 562, 449, 561, 447, 560, 445, 559, 443,
- 558, 557, 439, 556, 436, 555, 432, 554, 429, 553,
- 426, 552, 423, 551, 550, 419, 549, 416, 548, 413,
-
- 547, 410, 546, 545, 406, 544, 403, 543, 399, 542,
- 395, 541, 540, 539, 538, 537, 536, 385, 535, 382,
- 534, 379, 533, 376, 532, 373, 531, 370, 530, 367,
- 529, 364, 528, 361, 527, 358, 526, 355, 525, 352,
- 524, 349, 523, 346, 522, 343, 521, 340, 520, 337,
- 519, 333, 518, 517, 516, 515, 514, 326, 512, 322,
- 509, 508, 503, 502, 501, 500, 499, 498, 496, 493,
- 492, 491, 490, 489, 488, 487, 486, 485, 482, 481,
- 478, 477, 476, 475, 474, 473, 472, 471, 470, 469,
- 466, 299, 271, 464, 463, 462, 461, 460, 459, 458,
-
- 457, 441, 440, 433, 420, 407, 400, 396, 388, 387,
- 386, 334, 330, 329, 328, 327, 312, 311, 310, 307,
- 306, 305, 304, 303, 294, 291, 290, 289, 288, 287,
- 286, 285, 284, 283, 281, 280, 279, 278, 277, 274,
- 273, 272, 270, 269, 176, 264, 263, 262, 261, 260,
- 259, 258, 257, 256, 255, 247, 246, 245, 244, 243,
- 240, 239, 236, 235, 234, 233, 232, 227, 224, 223,
- 222, 221, 220, 219, 216, 215, 214, 213, 212, 211,
- 210, 207, 206, 200, 199, 198, 197, 196, 195, 191,
- 190, 189, 160, 159, 153, 152, 40, 131, 130, 129,
-
- 128, 127, 126, 125, 122, 90, 78, 40, 38, 861,
- 3, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861
+ 35, 9, 36, 9, 9, 9, 9, 37, 887, 37,
+ 42, 99, 142, 79, 83, 143, 100, 43, 44, 44,
+ 44, 44, 44, 44, 80, 84, 81, 121, 85, 175,
+ 86, 124, 82, 67, 68, 68, 68, 68, 68, 68,
+
+ 87, 88, 176, 888, 69, 122, 37, 89, 37, 125,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 146,
+ 147, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 69, 148, 63, 64, 65, 66, 67, 68, 68, 68,
+ 68, 68, 68, 202, 203, 251, 70, 69, 67, 68,
+ 68, 68, 68, 68, 68, 226, 252, 227, 71, 69,
+ 67, 68, 68, 68, 68, 68, 68, 73, 144, 74,
+ 72, 69, 145, 69, 149, 95, 75, 150, 474, 91,
+ 209, 92, 76, 96, 77, 69, 93, 101, 97, 94,
+ 105, 475, 106, 107, 98, 155, 102, 69, 210, 889,
+
+ 103, 156, 138, 138, 157, 108, 104, 109, 138, 110,
+ 111, 112, 113, 114, 139, 115, 890, 116, 158, 138,
+ 218, 140, 117, 118, 119, 159, 120, 42, 44, 44,
+ 44, 44, 44, 44, 141, 138, 151, 152, 137, 219,
+ 138, 162, 138, 166, 167, 179, 178, 180, 181, 168,
+ 231, 138, 163, 138, 228, 164, 299, 169, 165, 240,
+ 138, 229, 232, 257, 137, 258, 300, 133, 134, 47,
+ 48, 49, 50, 241, 52, 53, 233, 177, 54, 55,
+ 56, 57, 58, 59, 135, 61, 62, 279, 170, 136,
+ 171, 891, 234, 172, 173, 178, 178, 178, 178, 280,
+
+ 892, 174, 182, 178, 178, 183, 184, 178, 178, 178,
+ 186, 186, 186, 186, 186, 186, 244, 893, 204, 205,
+ 187, 67, 68, 68, 68, 68, 68, 68, 206, 193,
+ 245, 188, 69, 189, 189, 189, 189, 189, 189, 194,
+ 253, 139, 254, 269, 501, 195, 187, 502, 140, 255,
+ 272, 272, 894, 256, 272, 272, 272, 169, 69, 270,
+ 272, 271, 271, 271, 271, 271, 271, 272, 272, 272,
+ 275, 272, 286, 272, 272, 296, 301, 895, 272, 448,
+ 395, 297, 302, 312, 896, 272, 272, 272, 459, 272,
+ 304, 272, 272, 313, 305, 306, 272, 393, 396, 303,
+
+ 272, 897, 449, 272, 572, 572, 460, 272, 898, 394,
+ 899, 272, 317, 317, 317, 317, 317, 317, 317, 317,
+ 318, 317, 317, 319, 320, 317, 317, 317, 317, 317,
+ 317, 317, 321, 317, 317, 317, 317, 317, 317, 317,
+ 44, 44, 44, 44, 44, 44, 597, 597, 450, 322,
+ 137, 323, 323, 323, 323, 323, 323, 189, 189, 189,
+ 189, 189, 189, 189, 189, 189, 189, 189, 189, 324,
+ 327, 451, 335, 339, 325, 328, 137, 336, 340, 457,
+ 342, 609, 609, 325, 329, 343, 336, 340, 900, 325,
+ 328, 458, 326, 330, 343, 337, 341, 345, 901, 348,
+
+ 354, 351, 346, 344, 349, 355, 352, 517, 517, 517,
+ 517, 346, 452, 349, 355, 352, 902, 346, 903, 349,
+ 347, 352, 350, 356, 353, 357, 360, 363, 366, 369,
+ 358, 361, 364, 367, 370, 453, 904, 905, 455, 358,
+ 361, 364, 367, 370, 906, 907, 361, 364, 359, 362,
+ 365, 368, 371, 372, 375, 378, 908, 486, 373, 376,
+ 379, 456, 800, 801, 909, 381, 384, 373, 376, 379,
+ 382, 385, 487, 373, 376, 379, 374, 377, 380, 382,
+ 385, 910, 387, 802, 627, 382, 385, 388, 383, 386,
+ 398, 913, 403, 407, 410, 399, 388, 404, 408, 411,
+
+ 628, 914, 388, 41, 399, 389, 404, 408, 411, 414,
+ 911, 912, 886, 400, 415, 405, 409, 412, 490, 417,
+ 420, 423, 427, 415, 418, 421, 424, 428, 885, 415,
+ 884, 491, 416, 418, 421, 424, 428, 883, 882, 418,
+ 421, 424, 419, 422, 425, 429, 430, 433, 436, 881,
+ 880, 431, 434, 437, 517, 517, 517, 517, 440, 443,
+ 431, 434, 437, 441, 444, 879, 431, 434, 437, 432,
+ 435, 438, 441, 444, 742, 461, 878, 743, 441, 444,
+ 462, 442, 445, 271, 271, 271, 271, 271, 271, 462,
+ 271, 271, 271, 271, 271, 271, 472, 472, 463, 472,
+
+ 472, 877, 472, 472, 472, 472, 472, 472, 876, 472,
+ 519, 519, 472, 472, 875, 874, 472, 324, 504, 472,
+ 472, 873, 872, 472, 472, 511, 871, 512, 870, 513,
+ 518, 517, 517, 517, 869, 472, 517, 517, 517, 517,
+ 326, 326, 514, 517, 517, 517, 517, 323, 323, 323,
+ 323, 323, 323, 323, 323, 323, 323, 323, 323, 521,
+ 521, 327, 327, 335, 522, 528, 528, 530, 530, 339,
+ 532, 532, 342, 534, 534, 868, 345, 536, 536, 348,
+ 538, 538, 351, 354, 330, 330, 337, 540, 540, 357,
+ 330, 360, 341, 542, 542, 344, 337, 363, 341, 347,
+
+ 366, 344, 350, 867, 347, 353, 356, 369, 350, 544,
+ 544, 353, 359, 372, 362, 546, 546, 866, 356, 375,
+ 365, 548, 548, 368, 359, 550, 550, 552, 552, 865,
+ 371, 554, 554, 556, 556, 864, 374, 378, 558, 558,
+ 362, 863, 377, 381, 560, 560, 365, 384, 562, 562,
+ 387, 398, 368, 569, 569, 403, 371, 407, 374, 410,
+ 380, 862, 377, 861, 380, 414, 383, 573, 573, 383,
+ 386, 575, 575, 389, 400, 386, 577, 577, 405, 389,
+ 409, 417, 412, 420, 400, 580, 580, 423, 416, 582,
+ 582, 584, 584, 586, 586, 589, 589, 860, 405, 723,
+
+ 427, 859, 409, 858, 419, 430, 422, 412, 591, 591,
+ 425, 593, 593, 433, 595, 595, 416, 436, 598, 598,
+ 419, 440, 422, 429, 425, 443, 429, 612, 432, 600,
+ 600, 603, 603, 605, 605, 615, 435, 607, 607, 432,
+ 438, 719, 435, 461, 442, 438, 610, 610, 445, 442,
+ 613, 618, 618, 670, 671, 716, 716, 718, 616, 857,
+ 445, 722, 449, 856, 451, 855, 463, 854, 453, 720,
+ 720, 815, 815, 818, 818, 672, 853, 456, 852, 851,
+ 719, 850, 463, 849, 723, 848, 613, 847, 846, 845,
+ 844, 843, 842, 841, 840, 839, 838, 837, 836, 835,
+
+ 616, 834, 719, 833, 723, 39, 39, 39, 185, 185,
+ 832, 831, 830, 829, 828, 827, 826, 825, 824, 823,
+ 822, 821, 820, 819, 817, 616, 816, 814, 613, 813,
+ 812, 811, 810, 809, 808, 807, 806, 805, 804, 803,
+ 799, 798, 797, 796, 795, 794, 793, 792, 791, 790,
+ 789, 788, 787, 786, 785, 784, 783, 782, 781, 780,
+ 779, 778, 777, 776, 775, 774, 773, 772, 771, 770,
+ 769, 768, 767, 766, 765, 764, 763, 762, 761, 760,
+ 759, 758, 757, 756, 755, 754, 753, 752, 751, 750,
+ 749, 748, 747, 746, 745, 744, 741, 740, 739, 738,
+
+ 737, 736, 735, 734, 733, 732, 731, 730, 729, 728,
+ 727, 726, 725, 724, 463, 721, 717, 715, 456, 714,
+ 453, 713, 451, 712, 449, 711, 710, 445, 709, 442,
+ 708, 438, 707, 435, 706, 432, 705, 429, 704, 703,
+ 425, 702, 422, 701, 419, 700, 416, 699, 698, 412,
+ 697, 409, 696, 405, 695, 400, 694, 693, 692, 389,
+ 691, 386, 690, 383, 689, 380, 688, 377, 687, 374,
+ 686, 371, 685, 368, 684, 365, 683, 362, 682, 359,
+ 681, 356, 680, 353, 679, 350, 678, 347, 677, 344,
+ 676, 341, 675, 337, 674, 673, 669, 668, 330, 667,
+
+ 326, 666, 665, 664, 663, 662, 661, 660, 659, 658,
+ 657, 656, 655, 654, 653, 652, 651, 650, 649, 648,
+ 647, 646, 645, 644, 643, 642, 641, 640, 639, 638,
+ 637, 636, 635, 634, 633, 632, 631, 630, 629, 626,
+ 625, 624, 623, 622, 621, 620, 619, 617, 614, 611,
+ 608, 606, 604, 602, 601, 599, 596, 594, 592, 590,
+ 588, 587, 585, 583, 581, 579, 578, 576, 574, 571,
+ 570, 568, 567, 566, 565, 564, 563, 561, 559, 557,
+ 555, 553, 551, 549, 547, 545, 543, 541, 539, 537,
+ 535, 533, 531, 529, 527, 526, 525, 524, 523, 520,
+
+ 516, 515, 510, 509, 508, 507, 506, 505, 503, 500,
+ 499, 498, 497, 496, 495, 494, 493, 492, 489, 488,
+ 485, 484, 483, 482, 481, 480, 479, 478, 477, 476,
+ 473, 303, 275, 471, 470, 469, 468, 467, 466, 465,
+ 464, 454, 447, 446, 439, 426, 413, 406, 402, 401,
+ 397, 392, 391, 390, 338, 334, 333, 332, 331, 316,
+ 315, 314, 311, 310, 309, 308, 307, 298, 295, 294,
+ 293, 292, 291, 290, 289, 288, 287, 285, 284, 283,
+ 282, 281, 278, 277, 276, 274, 273, 177, 268, 267,
+ 266, 265, 264, 263, 262, 261, 260, 259, 250, 249,
+
+ 248, 247, 246, 243, 242, 239, 238, 237, 236, 235,
+ 230, 225, 224, 223, 222, 221, 220, 217, 216, 215,
+ 214, 213, 212, 211, 208, 207, 201, 200, 199, 198,
+ 197, 196, 192, 191, 190, 161, 160, 154, 153, 40,
+ 132, 131, 130, 129, 128, 127, 126, 123, 90, 78,
+ 40, 38, 915, 3, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915
} ;
-static yyconst flex_int16_t yy_chk[1379] =
+static yyconst flex_int16_t yy_chk[1522] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -869,151 +904,168 @@ static yyconst flex_int16_t yy_chk[1379] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 5, 815, 5,
+ 1, 1, 1, 1, 1, 1, 1, 5, 862, 5,
10, 24, 47, 17, 18, 47, 24, 10, 10, 10,
10, 10, 10, 10, 17, 18, 17, 28, 18, 62,
19, 30, 17, 11, 11, 11, 11, 11, 11, 11,
- 19, 20, 62, 816, 11, 28, 37, 20, 37, 30,
+ 19, 20, 62, 863, 11, 28, 37, 20, 37, 30,
10, 10, 10, 10, 10, 10, 10, 10, 10, 49,
49, 10, 10, 10, 10, 10, 10, 10, 10, 10,
11, 49, 10, 10, 10, 10, 12, 12, 12, 12,
- 12, 12, 12, 83, 83, 120, 12, 12, 13, 13,
- 13, 13, 13, 13, 13, 102, 120, 102, 13, 13,
+ 12, 12, 12, 83, 83, 121, 12, 12, 13, 13,
+ 13, 13, 13, 13, 13, 102, 121, 102, 13, 13,
14, 14, 14, 14, 14, 14, 14, 15, 48, 15,
- 14, 14, 48, 12, 50, 23, 15, 50, 25, 22,
- 105, 22, 15, 23, 15, 13, 22, 25, 23, 22,
- 26, 25, 26, 26, 23, 818, 105, 14, 46, 46,
-
- 95, 45, 45, 55, 46, 26, 27, 45, 27, 27,
- 27, 27, 27, 45, 27, 46, 27, 55, 45, 95,
- 45, 27, 27, 27, 55, 27, 42, 44, 44, 44,
- 44, 44, 44, 51, 51, 54, 87, 44, 58, 51,
- 819, 54, 60, 60, 64, 64, 64, 64, 60, 58,
- 51, 820, 58, 104, 87, 58, 60, 132, 111, 60,
- 122, 114, 122, 44, 132, 104, 42, 42, 42, 42,
- 42, 42, 111, 42, 42, 114, 63, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 144, 61, 42, 61,
- 822, 823, 61, 61, 63, 63, 63, 63, 144, 824,
-
- 61, 65, 65, 65, 65, 66, 66, 66, 66, 67,
- 67, 67, 67, 67, 67, 134, 825, 84, 84, 67,
- 68, 68, 68, 68, 68, 68, 68, 84, 76, 134,
- 69, 68, 69, 69, 69, 69, 69, 69, 76, 121,
- 161, 121, 225, 828, 76, 67, 161, 137, 137, 140,
- 140, 140, 121, 137, 225, 140, 136, 68, 136, 136,
- 136, 136, 136, 136, 137, 226, 140, 150, 150, 151,
- 151, 163, 164, 150, 270, 151, 165, 165, 164, 166,
- 166, 163, 165, 226, 150, 166, 151, 270, 173, 165,
- 829, 167, 167, 165, 830, 253, 166, 167, 173, 177,
-
- 177, 177, 177, 178, 178, 178, 178, 253, 167, 179,
- 179, 179, 179, 180, 180, 180, 180, 181, 181, 181,
- 181, 182, 182, 182, 182, 183, 183, 183, 183, 185,
- 185, 185, 185, 185, 185, 835, 837, 249, 186, 185,
- 186, 186, 186, 186, 186, 186, 187, 187, 187, 187,
- 187, 187, 188, 188, 188, 188, 188, 188, 189, 190,
- 249, 199, 201, 189, 190, 185, 199, 201, 298, 202,
- 839, 298, 189, 190, 202, 199, 201, 842, 189, 190,
- 254, 189, 190, 202, 199, 201, 203, 843, 204, 206,
- 205, 203, 202, 204, 206, 205, 591, 847, 254, 591,
-
- 203, 250, 204, 206, 205, 849, 203, 851, 204, 203,
- 205, 204, 206, 205, 208, 210, 211, 213, 214, 208,
- 210, 211, 213, 214, 250, 854, 854, 251, 208, 210,
- 211, 213, 214, 857, 858, 210, 211, 208, 210, 211,
- 213, 214, 216, 217, 218, 863, 284, 216, 217, 218,
- 251, 654, 654, 811, 219, 220, 216, 217, 218, 219,
- 220, 284, 216, 217, 218, 216, 217, 218, 219, 220,
- 810, 221, 654, 464, 219, 220, 221, 219, 220, 227,
- 809, 229, 232, 233, 227, 221, 229, 232, 233, 464,
- 808, 221, 806, 227, 221, 229, 232, 233, 235, 804,
-
- 802, 799, 227, 235, 229, 232, 233, 798, 236, 237,
- 238, 240, 235, 236, 237, 238, 240, 796, 235, 795,
- 252, 235, 236, 237, 238, 240, 287, 794, 236, 237,
- 238, 236, 237, 238, 240, 241, 242, 243, 793, 287,
- 241, 242, 243, 252, 516, 516, 792, 245, 246, 241,
- 242, 243, 245, 246, 791, 241, 242, 243, 241, 242,
- 243, 245, 246, 788, 255, 787, 516, 245, 246, 255,
- 245, 246, 266, 266, 266, 266, 266, 266, 255, 267,
- 267, 267, 267, 267, 267, 268, 268, 255, 282, 282,
- 785, 268, 300, 300, 282, 301, 301, 784, 300, 783,
-
- 321, 301, 268, 782, 781, 282, 324, 302, 302, 300,
- 780, 778, 301, 302, 310, 777, 310, 776, 310, 313,
- 313, 313, 313, 321, 302, 314, 314, 314, 314, 324,
- 774, 310, 315, 315, 315, 315, 316, 316, 316, 316,
- 317, 317, 317, 317, 318, 318, 318, 318, 318, 318,
- 319, 319, 319, 319, 319, 319, 325, 332, 325, 336,
- 339, 342, 345, 348, 351, 354, 357, 360, 363, 366,
- 369, 372, 375, 378, 381, 384, 394, 398, 402, 325,
- 332, 405, 336, 339, 342, 345, 348, 351, 354, 357,
- 360, 363, 366, 369, 372, 375, 378, 381, 384, 394,
-
- 398, 402, 409, 412, 405, 415, 418, 422, 425, 428,
- 431, 435, 438, 450, 452, 455, 565, 568, 772, 771,
- 768, 765, 764, 763, 762, 409, 412, 750, 415, 418,
- 422, 425, 428, 431, 435, 438, 450, 452, 455, 565,
- 568, 862, 862, 862, 864, 864, 749, 748, 719, 712,
- 711, 708, 707, 706, 705, 704, 703, 702, 701, 700,
- 699, 697, 694, 693, 692, 691, 690, 689, 688, 687,
- 686, 685, 684, 682, 681, 680, 679, 677, 675, 674,
- 673, 672, 671, 670, 669, 668, 667, 666, 665, 664,
- 663, 662, 661, 660, 659, 658, 657, 656, 655, 653,
-
- 652, 651, 650, 649, 648, 647, 646, 645, 642, 641,
- 640, 639, 638, 637, 636, 635, 634, 633, 632, 631,
- 630, 629, 628, 627, 626, 625, 624, 622, 621, 620,
- 619, 618, 617, 616, 615, 614, 613, 612, 611, 610,
- 609, 608, 607, 605, 604, 603, 602, 601, 599, 598,
- 597, 596, 595, 594, 593, 590, 589, 587, 586, 585,
- 584, 581, 580, 579, 578, 577, 576, 575, 573, 572,
- 571, 570, 569, 567, 566, 564, 563, 562, 561, 560,
- 559, 558, 557, 556, 555, 554, 553, 552, 551, 550,
- 549, 548, 547, 546, 545, 544, 543, 542, 538, 537,
-
- 536, 535, 534, 533, 532, 531, 530, 529, 528, 527,
- 526, 525, 524, 523, 522, 521, 520, 519, 518, 517,
- 514, 513, 512, 509, 508, 507, 506, 505, 504, 502,
- 500, 499, 498, 496, 495, 494, 493, 492, 491, 490,
- 489, 488, 487, 486, 485, 484, 483, 482, 481, 480,
- 479, 477, 476, 475, 474, 473, 472, 471, 468, 467,
- 466, 463, 462, 461, 460, 459, 458, 457, 456, 454,
- 453, 451, 449, 448, 447, 446, 445, 444, 443, 442,
- 440, 439, 437, 436, 434, 432, 430, 429, 427, 426,
- 424, 423, 421, 420, 419, 417, 416, 414, 413, 411,
-
- 410, 408, 407, 406, 404, 403, 401, 399, 397, 395,
- 393, 392, 390, 388, 387, 386, 385, 383, 382, 380,
- 379, 377, 376, 374, 373, 371, 370, 368, 367, 365,
- 364, 362, 361, 359, 358, 356, 355, 353, 352, 350,
- 349, 347, 346, 344, 343, 341, 340, 338, 337, 335,
- 333, 331, 330, 329, 328, 327, 326, 323, 322, 320,
- 312, 311, 309, 308, 307, 306, 305, 304, 299, 297,
- 296, 295, 294, 293, 292, 291, 290, 288, 286, 285,
- 283, 281, 280, 277, 276, 275, 274, 273, 272, 271,
- 269, 265, 264, 263, 262, 261, 260, 259, 258, 257,
-
- 256, 248, 247, 244, 239, 234, 230, 228, 224, 223,
- 222, 200, 198, 195, 194, 191, 176, 175, 174, 172,
- 171, 170, 169, 168, 162, 160, 159, 158, 157, 156,
- 155, 154, 153, 152, 149, 148, 147, 146, 145, 143,
- 142, 141, 139, 138, 135, 133, 131, 130, 129, 128,
- 127, 126, 125, 124, 123, 119, 118, 117, 116, 115,
- 113, 112, 110, 109, 108, 107, 106, 103, 101, 100,
- 99, 98, 97, 96, 94, 93, 92, 91, 90, 89,
- 88, 86, 85, 82, 81, 80, 79, 78, 77, 75,
- 74, 73, 57, 56, 53, 52, 39, 38, 36, 35,
-
- 34, 33, 32, 31, 29, 21, 16, 8, 7, 3,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861
+ 14, 14, 48, 12, 50, 23, 15, 50, 274, 22,
+ 87, 22, 15, 23, 15, 13, 22, 25, 23, 22,
+ 26, 274, 26, 26, 23, 54, 25, 14, 87, 864,
+
+ 25, 54, 45, 45, 55, 26, 25, 27, 45, 27,
+ 27, 27, 27, 27, 45, 27, 865, 27, 55, 45,
+ 95, 45, 27, 27, 27, 55, 27, 42, 44, 44,
+ 44, 44, 44, 44, 46, 46, 51, 51, 44, 95,
+ 46, 58, 51, 60, 60, 64, 64, 64, 64, 60,
+ 105, 46, 58, 51, 103, 58, 164, 60, 58, 112,
+ 60, 103, 105, 123, 44, 123, 164, 42, 42, 42,
+ 42, 42, 42, 112, 42, 42, 106, 63, 42, 42,
+ 42, 42, 42, 42, 42, 42, 42, 145, 61, 42,
+ 61, 869, 106, 61, 61, 63, 63, 63, 63, 145,
+
+ 870, 61, 65, 65, 65, 65, 66, 66, 66, 66,
+ 67, 67, 67, 67, 67, 67, 115, 872, 84, 84,
+ 67, 68, 68, 68, 68, 68, 68, 68, 84, 76,
+ 115, 69, 68, 69, 69, 69, 69, 69, 69, 76,
+ 122, 133, 122, 135, 302, 76, 67, 302, 133, 122,
+ 138, 138, 873, 122, 151, 151, 138, 135, 68, 137,
+ 151, 137, 137, 137, 137, 137, 137, 138, 141, 141,
+ 141, 151, 152, 152, 141, 162, 165, 874, 152, 252,
+ 227, 162, 165, 174, 876, 141, 166, 166, 258, 152,
+ 167, 167, 166, 174, 168, 168, 167, 226, 227, 166,
+
+ 168, 877, 252, 166, 402, 402, 258, 167, 878, 226,
+ 879, 168, 178, 178, 178, 178, 179, 179, 179, 179,
+ 180, 180, 180, 180, 181, 181, 181, 181, 182, 182,
+ 182, 182, 183, 183, 183, 183, 184, 184, 184, 184,
+ 186, 186, 186, 186, 186, 186, 439, 439, 253, 187,
+ 186, 187, 187, 187, 187, 187, 187, 188, 188, 188,
+ 188, 188, 188, 189, 189, 189, 189, 189, 189, 190,
+ 191, 253, 200, 202, 190, 191, 186, 200, 202, 257,
+ 203, 454, 454, 190, 191, 203, 200, 202, 882, 190,
+ 191, 257, 190, 191, 203, 200, 202, 204, 883, 205,
+
+ 207, 206, 204, 203, 205, 207, 206, 317, 317, 317,
+ 317, 204, 254, 205, 207, 206, 884, 204, 889, 205,
+ 204, 206, 205, 207, 206, 209, 211, 212, 214, 215,
+ 209, 211, 212, 214, 215, 254, 891, 893, 256, 209,
+ 211, 212, 214, 215, 896, 897, 211, 212, 209, 211,
+ 212, 214, 215, 217, 218, 219, 901, 288, 217, 218,
+ 219, 256, 704, 704, 903, 220, 221, 217, 218, 219,
+ 220, 221, 288, 217, 218, 219, 217, 218, 219, 220,
+ 221, 905, 222, 704, 471, 220, 221, 222, 220, 221,
+ 229, 911, 232, 235, 236, 229, 222, 232, 235, 236,
+
+ 471, 912, 222, 917, 229, 222, 232, 235, 236, 238,
+ 908, 908, 860, 229, 238, 232, 235, 236, 291, 239,
+ 240, 241, 243, 238, 239, 240, 241, 243, 858, 238,
+ 856, 291, 238, 239, 240, 241, 243, 853, 852, 239,
+ 240, 241, 239, 240, 241, 243, 244, 245, 246, 850,
+ 849, 244, 245, 246, 318, 318, 318, 318, 248, 249,
+ 244, 245, 246, 248, 249, 848, 244, 245, 246, 244,
+ 245, 246, 248, 249, 641, 259, 847, 641, 248, 249,
+ 259, 248, 249, 270, 270, 270, 270, 270, 270, 259,
+ 271, 271, 271, 271, 271, 271, 272, 272, 259, 286,
+
+ 286, 846, 272, 304, 304, 286, 305, 305, 845, 304,
+ 324, 324, 305, 272, 842, 841, 286, 325, 306, 306,
+ 304, 839, 838, 305, 306, 314, 837, 314, 836, 314,
+ 319, 319, 319, 319, 835, 306, 320, 320, 320, 320,
+ 325, 324, 314, 321, 321, 321, 321, 322, 322, 322,
+ 322, 322, 322, 323, 323, 323, 323, 323, 323, 327,
+ 327, 328, 329, 336, 329, 335, 335, 339, 339, 340,
+ 342, 342, 343, 345, 345, 834, 346, 348, 348, 349,
+ 351, 351, 352, 355, 328, 329, 336, 354, 354, 358,
+ 327, 361, 340, 357, 357, 343, 335, 364, 339, 346,
+
+ 367, 342, 349, 832, 345, 352, 355, 370, 348, 360,
+ 360, 351, 358, 373, 361, 363, 363, 831, 354, 376,
+ 364, 366, 366, 367, 357, 369, 369, 372, 372, 830,
+ 370, 375, 375, 378, 378, 828, 373, 379, 381, 381,
+ 360, 826, 376, 382, 384, 384, 363, 385, 387, 387,
+ 388, 399, 366, 398, 398, 404, 369, 408, 372, 411,
+ 379, 825, 375, 822, 378, 415, 382, 403, 403, 381,
+ 385, 407, 407, 388, 399, 384, 410, 410, 404, 387,
+ 408, 418, 411, 421, 398, 414, 414, 424, 415, 417,
+ 417, 420, 420, 423, 423, 427, 427, 819, 403, 818,
+
+ 428, 817, 407, 816, 418, 431, 421, 410, 430, 430,
+ 424, 433, 433, 434, 436, 436, 414, 437, 440, 440,
+ 417, 441, 420, 428, 423, 444, 427, 457, 431, 443,
+ 443, 448, 448, 450, 450, 459, 434, 452, 452, 430,
+ 437, 815, 433, 462, 441, 436, 455, 455, 444, 440,
+ 457, 461, 461, 525, 525, 612, 612, 614, 459, 814,
+ 443, 617, 448, 802, 450, 801, 462, 800, 452, 615,
+ 615, 718, 718, 722, 722, 525, 771, 455, 764, 763,
+ 614, 760, 461, 759, 617, 758, 612, 757, 756, 755,
+ 754, 753, 752, 751, 749, 746, 745, 744, 743, 742,
+
+ 615, 741, 718, 740, 722, 916, 916, 916, 918, 918,
+ 739, 738, 737, 736, 734, 733, 732, 731, 729, 727,
+ 726, 725, 724, 723, 721, 720, 719, 717, 716, 715,
+ 714, 713, 712, 711, 710, 709, 708, 707, 706, 705,
+ 703, 702, 701, 700, 699, 698, 697, 696, 695, 692,
+ 691, 690, 689, 688, 687, 686, 685, 684, 683, 682,
+ 681, 680, 679, 678, 677, 676, 675, 674, 672, 671,
+ 670, 669, 668, 667, 666, 665, 664, 663, 662, 661,
+ 660, 659, 658, 657, 655, 654, 653, 652, 651, 649,
+ 648, 647, 646, 645, 644, 643, 640, 639, 637, 636,
+
+ 635, 634, 631, 630, 629, 628, 627, 626, 625, 623,
+ 622, 621, 620, 619, 618, 616, 613, 611, 610, 608,
+ 607, 606, 605, 604, 603, 602, 601, 600, 599, 598,
+ 596, 595, 594, 593, 592, 591, 590, 589, 588, 587,
+ 586, 585, 584, 583, 582, 581, 580, 579, 578, 577,
+ 576, 575, 574, 573, 570, 569, 565, 564, 563, 562,
+ 561, 560, 559, 558, 557, 556, 555, 554, 553, 552,
+ 551, 550, 549, 548, 547, 546, 545, 544, 543, 542,
+ 541, 540, 539, 538, 537, 536, 535, 534, 533, 532,
+ 531, 530, 529, 528, 527, 526, 523, 522, 521, 520,
+
+ 519, 516, 515, 514, 513, 512, 511, 509, 507, 506,
+ 505, 503, 502, 501, 500, 499, 498, 497, 496, 495,
+ 494, 493, 492, 491, 490, 489, 488, 487, 486, 484,
+ 483, 482, 481, 480, 479, 478, 475, 474, 473, 470,
+ 469, 468, 467, 466, 465, 464, 463, 460, 458, 456,
+ 453, 451, 449, 446, 445, 442, 438, 435, 432, 429,
+ 426, 425, 422, 419, 416, 413, 412, 409, 405, 401,
+ 400, 396, 394, 392, 391, 390, 389, 386, 383, 380,
+ 377, 374, 371, 368, 365, 362, 359, 356, 353, 350,
+ 347, 344, 341, 337, 334, 333, 332, 331, 330, 326,
+
+ 316, 315, 313, 312, 311, 310, 309, 308, 303, 301,
+ 300, 299, 298, 297, 296, 295, 294, 292, 290, 289,
+ 287, 285, 284, 281, 280, 279, 278, 277, 276, 275,
+ 273, 269, 268, 267, 266, 265, 264, 263, 262, 261,
+ 260, 255, 251, 250, 247, 242, 237, 233, 231, 230,
+ 228, 225, 224, 223, 201, 199, 196, 195, 192, 177,
+ 176, 175, 173, 172, 171, 170, 169, 163, 161, 160,
+ 159, 158, 157, 156, 155, 154, 153, 150, 149, 148,
+ 147, 146, 144, 143, 142, 140, 139, 136, 134, 132,
+ 131, 130, 129, 128, 127, 126, 125, 124, 120, 119,
+
+ 118, 117, 116, 114, 113, 111, 110, 109, 108, 107,
+ 104, 101, 100, 99, 98, 97, 96, 94, 93, 92,
+ 91, 90, 89, 88, 86, 85, 82, 81, 80, 79,
+ 78, 77, 75, 74, 73, 57, 56, 53, 52, 39,
+ 38, 36, 35, 34, 33, 32, 31, 29, 21, 16,
+ 8, 7, 3, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915, 915, 915, 915, 915, 915, 915, 915, 915, 915,
+ 915
} ;
/* The intent behind this definition is that it'll catch
@@ -1048,6 +1100,7 @@ static yyconst flex_int16_t yy_chk[1379] =
* DEALINGS IN THE SOFTWARE.
*/
#include "main/glheader.h"
+#include "main/imports.h"
#include "prog_instruction.h"
#include "prog_statevars.h"
@@ -1059,6 +1112,7 @@ static yyconst flex_int16_t yy_chk[1379] =
#define require_ARB_fp (yyextra->mode == ARB_fragment)
#define require_NV_fp (yyextra->option.NV_fragment)
#define require_NV_vp2 (yyextra->option.NV_vertex2)
+#define require_NV_vp3 (yyextra->option.NV_vertex3)
#define require_shadow (yyextra->option.Shadow)
#define require_rect (yyextra->option.TexRect)
#define require_texarray (yyextra->option.TexArray)
@@ -1167,7 +1221,7 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval)
} while(0);
#define YY_EXTRA_TYPE struct asm_parser_state *
-#line 1171 "lex.yy.c"
+#line 1225 "lex.yy.c"
#define INITIAL 0
@@ -1413,10 +1467,10 @@ YY_DECL
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 157 "program_lexer.l"
+#line 159 "program_lexer.l"
-#line 1420 "lex.yy.c"
+#line 1474 "lex.yy.c"
yylval = yylval_param;
@@ -1473,13 +1527,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 862 )
+ if ( yy_current_state >= 916 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 1311 );
+ while ( yy_base[yy_current_state] != 1454 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1505,17 +1559,17 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 159 "program_lexer.l"
+#line 161 "program_lexer.l"
{ return ARBvp_10; }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 160 "program_lexer.l"
+#line 162 "program_lexer.l"
{ return ARBfp_10; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 161 "program_lexer.l"
+#line 163 "program_lexer.l"
{
yylval->integer = at_address;
return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS);
@@ -1523,780 +1577,795 @@ YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 165 "program_lexer.l"
+#line 167 "program_lexer.l"
{ return ALIAS; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 166 "program_lexer.l"
+#line 168 "program_lexer.l"
{ return ATTRIB; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 167 "program_lexer.l"
+#line 169 "program_lexer.l"
{ return END; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 168 "program_lexer.l"
+#line 170 "program_lexer.l"
{ return OPTION; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 169 "program_lexer.l"
+#line 171 "program_lexer.l"
{ return OUTPUT; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 170 "program_lexer.l"
+#line 172 "program_lexer.l"
{ return PARAM; }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 171 "program_lexer.l"
+#line 173 "program_lexer.l"
{ yylval->integer = at_temp; return TEMP; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 173 "program_lexer.l"
+#line 175 "program_lexer.l"
{ return_opcode( 1, VECTOR_OP, ABS, 3); }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 174 "program_lexer.l"
+#line 176 "program_lexer.l"
{ return_opcode( 1, BIN_OP, ADD, 3); }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 175 "program_lexer.l"
+#line 177 "program_lexer.l"
{ return_opcode(require_NV_vp2, ARA_OP, ARA, 3); }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 176 "program_lexer.l"
-{ return_opcode(require_ARB_vp, ARL_OP, ARL, 3); }
+#line 178 "program_lexer.l"
+{ return_opcode(require_ARB_vp, (require_NV_vp2) ? ARL_NV_OP : ARL_OP, ARL, 3); }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 177 "program_lexer.l"
+#line 179 "program_lexer.l"
{ return_opcode(require_NV_vp2, ARL_OP, ARR, 3); }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 179 "program_lexer.l"
+#line 181 "program_lexer.l"
{ return_opcode(require_NV_vp2, BRA_OP, BRA, 3); }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 181 "program_lexer.l"
+#line 183 "program_lexer.l"
{ return_opcode(require_NV_vp2, BRA_OP, CAL, 3); }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 182 "program_lexer.l"
+#line 184 "program_lexer.l"
{ return_opcode(require_ARB_fp, TRI_OP, CMP, 3); }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 183 "program_lexer.l"
+#line 185 "program_lexer.l"
{ return_opcode(require_ARB_fp || require_NV_vp2, SCALAR_OP, COS, 3); }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 185 "program_lexer.l"
+#line 187 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 186 "program_lexer.l"
+#line 188 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 187 "program_lexer.l"
+#line 189 "program_lexer.l"
{ return_opcode( 1, BIN_OP, DP3, 3); }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 188 "program_lexer.l"
+#line 190 "program_lexer.l"
{ return_opcode( 1, BIN_OP, DP4, 3); }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 189 "program_lexer.l"
+#line 191 "program_lexer.l"
{ return_opcode( 1, BIN_OP, DPH, 3); }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 190 "program_lexer.l"
+#line 192 "program_lexer.l"
{ return_opcode( 1, BIN_OP, DST, 3); }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 192 "program_lexer.l"
+#line 194 "program_lexer.l"
{ return_opcode( 1, SCALAR_OP, EX2, 3); }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 193 "program_lexer.l"
+#line 195 "program_lexer.l"
{ return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 195 "program_lexer.l"
+#line 197 "program_lexer.l"
{ return_opcode( 1, VECTOR_OP, FLR, 3); }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 196 "program_lexer.l"
+#line 198 "program_lexer.l"
{ return_opcode( 1, VECTOR_OP, FRC, 3); }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 198 "program_lexer.l"
+#line 200 "program_lexer.l"
{ return_opcode(require_ARB_fp, KIL, KIL, 3); }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 200 "program_lexer.l"
+#line 202 "program_lexer.l"
{ return_opcode( 1, VECTOR_OP, LIT, 3); }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 201 "program_lexer.l"
+#line 203 "program_lexer.l"
{ return_opcode( 1, SCALAR_OP, LG2, 3); }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 202 "program_lexer.l"
+#line 204 "program_lexer.l"
{ return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 203 "program_lexer.l"
+#line 205 "program_lexer.l"
{ return_opcode(require_ARB_fp, TRI_OP, LRP, 3); }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 205 "program_lexer.l"
+#line 207 "program_lexer.l"
{ return_opcode( 1, TRI_OP, MAD, 3); }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 206 "program_lexer.l"
+#line 208 "program_lexer.l"
{ return_opcode( 1, BIN_OP, MAX, 3); }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 207 "program_lexer.l"
+#line 209 "program_lexer.l"
{ return_opcode( 1, BIN_OP, MIN, 3); }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 208 "program_lexer.l"
+#line 210 "program_lexer.l"
{ return_opcode( 1, VECTOR_OP, MOV, 3); }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 209 "program_lexer.l"
+#line 211 "program_lexer.l"
{ return_opcode( 1, BIN_OP, MUL, 3); }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 211 "program_lexer.l"
+#line 213 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); }
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 212 "program_lexer.l"
+#line 214 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 213 "program_lexer.l"
+#line 215 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 214 "program_lexer.l"
+#line 216 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); }
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 215 "program_lexer.l"
-{ return_opcode( 1, BINSC_OP, POW, 3); }
+#line 217 "program_lexer.l"
+{ return_opcode(require_NV_vp3, PUSHA_OP, PUSHA, 5); }
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 217 "program_lexer.l"
-{ return_opcode(require_NV_vp2, FLOW_OP, RET, 3); }
+#line 218 "program_lexer.l"
+{ return_opcode(require_NV_vp3, POPA_OP, POPA, 4); }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 218 "program_lexer.l"
-{ return_opcode( 1, SCALAR_OP, RCP, 3); }
+#line 219 "program_lexer.l"
+{ return_opcode( 1, BINSC_OP, POW, 3); }
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 219 "program_lexer.l"
-{ return_opcode(require_NV_vp2, SCALAR_OP, RCC, 3); }
+#line 221 "program_lexer.l"
+{ return_opcode(require_NV_vp2, FLOW_OP, RET, 3); }
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 220 "program_lexer.l"
-{ return_opcode(require_NV_fp, BIN_OP, RFL, 3); }
+#line 222 "program_lexer.l"
+{ return_opcode( 1, SCALAR_OP, RCP, 3); }
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 221 "program_lexer.l"
-{ return_opcode( 1, SCALAR_OP, RSQ, 3); }
+#line 223 "program_lexer.l"
+{ return_opcode(require_NV_vp2, SCALAR_OP, RCC, 3); }
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 223 "program_lexer.l"
-{ return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); }
+#line 224 "program_lexer.l"
+{ return_opcode(require_NV_fp, BIN_OP, RFL, 3); }
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 224 "program_lexer.l"
-{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, SEQ, 3); }
+#line 225 "program_lexer.l"
+{ return_opcode( 1, SCALAR_OP, RSQ, 3); }
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 225 "program_lexer.l"
-{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, SFL, 3); }
+#line 227 "program_lexer.l"
+{ return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); }
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 226 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, SGE, 3); }
+#line 228 "program_lexer.l"
+{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, SEQ, 3); }
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 227 "program_lexer.l"
-{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, SGT, 3); }
+#line 229 "program_lexer.l"
+{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, SFL, 3); }
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 228 "program_lexer.l"
-{ return_opcode(require_ARB_fp || require_NV_vp2, SCALAR_OP, SIN, 3); }
+#line 230 "program_lexer.l"
+{ return_opcode( 1, BIN_OP, SGE, 3); }
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 229 "program_lexer.l"
-{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, SLE, 3); }
+#line 231 "program_lexer.l"
+{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, SGT, 3); }
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 230 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, SLT, 3); }
+#line 232 "program_lexer.l"
+{ return_opcode(require_ARB_fp || require_NV_vp2, SCALAR_OP, SIN, 3); }
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 231 "program_lexer.l"
-{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, SNE, 3); }
+#line 233 "program_lexer.l"
+{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, SLE, 3); }
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 232 "program_lexer.l"
-{ return_opcode(require_NV_vp2, VECTOR_OP, SSG, 3); }
+#line 234 "program_lexer.l"
+{ return_opcode( 1, BIN_OP, SLT, 3); }
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 233 "program_lexer.l"
-{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, STR, 3); }
+#line 235 "program_lexer.l"
+{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, SNE, 3); }
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 234 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, SUB, 3); }
+#line 236 "program_lexer.l"
+{ return_opcode(require_NV_vp2, VECTOR_OP, SSG, 3); }
YY_BREAK
case 62:
YY_RULE_SETUP
-#line 235 "program_lexer.l"
-{ return_opcode( 1, SWZ, SWZ, 3); }
+#line 237 "program_lexer.l"
+{ return_opcode(require_NV_fp || require_NV_vp2, BIN_OP, STR, 3); }
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 237 "program_lexer.l"
-{ return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); }
+#line 238 "program_lexer.l"
+{ return_opcode( 1, BIN_OP, SUB, 3); }
YY_BREAK
case 64:
YY_RULE_SETUP
-#line 238 "program_lexer.l"
-{ return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); }
+#line 239 "program_lexer.l"
+{ return_opcode( 1, SWZ, SWZ, 3); }
YY_BREAK
case 65:
YY_RULE_SETUP
-#line 239 "program_lexer.l"
-{ return_opcode(require_NV_fp, TXD_OP, TXD, 3); }
+#line 241 "program_lexer.l"
+{ return_opcode(require_ARB_fp || require_NV_vp3, SAMPLE_OP, TEX, 3); }
YY_BREAK
case 66:
YY_RULE_SETUP
-#line 240 "program_lexer.l"
-{ return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); }
+#line 242 "program_lexer.l"
+{ return_opcode(require_ARB_fp || require_NV_vp3, SAMPLE_OP, TXB, 3); }
YY_BREAK
case 67:
YY_RULE_SETUP
-#line 242 "program_lexer.l"
-{ return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); }
+#line 243 "program_lexer.l"
+{ return_opcode(require_NV_fp, TXD_OP, TXD, 3); }
YY_BREAK
case 68:
YY_RULE_SETUP
-#line 243 "program_lexer.l"
-{ return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); }
+#line 244 "program_lexer.l"
+{ return_opcode(require_NV_vp3, SAMPLE_OP, TXP, 3); }
YY_BREAK
case 69:
YY_RULE_SETUP
-#line 244 "program_lexer.l"
-{ return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); }
+#line 245 "program_lexer.l"
+{ return_opcode(require_ARB_fp || require_NV_vp3, SAMPLE_OP, TXP, 3); }
YY_BREAK
case 70:
YY_RULE_SETUP
-#line 245 "program_lexer.l"
-{ return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); }
+#line 247 "program_lexer.l"
+{ return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); }
YY_BREAK
case 71:
YY_RULE_SETUP
-#line 247 "program_lexer.l"
-{ return_opcode(require_NV_fp, TRI_OP, X2D, 3); }
+#line 248 "program_lexer.l"
+{ return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); }
YY_BREAK
case 72:
YY_RULE_SETUP
-#line 248 "program_lexer.l"
-{ return_opcode( 1, BIN_OP, XPD, 3); }
+#line 249 "program_lexer.l"
+{ return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); }
YY_BREAK
case 73:
YY_RULE_SETUP
#line 250 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); }
+{ return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); }
YY_BREAK
case 74:
YY_RULE_SETUP
-#line 251 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); }
+#line 252 "program_lexer.l"
+{ return_opcode(require_NV_fp, TRI_OP, X2D, 3); }
YY_BREAK
case 75:
YY_RULE_SETUP
-#line 252 "program_lexer.l"
-{ return PROGRAM; }
+#line 253 "program_lexer.l"
+{ return_opcode( 1, BIN_OP, XPD, 3); }
YY_BREAK
case 76:
YY_RULE_SETUP
-#line 253 "program_lexer.l"
-{ return STATE; }
+#line 255 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); }
YY_BREAK
case 77:
YY_RULE_SETUP
-#line 254 "program_lexer.l"
-{ return RESULT; }
+#line 256 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); }
YY_BREAK
case 78:
YY_RULE_SETUP
-#line 256 "program_lexer.l"
-{ return AMBIENT; }
+#line 257 "program_lexer.l"
+{ return PROGRAM; }
YY_BREAK
case 79:
YY_RULE_SETUP
-#line 257 "program_lexer.l"
-{ return ATTENUATION; }
+#line 258 "program_lexer.l"
+{ return STATE; }
YY_BREAK
case 80:
YY_RULE_SETUP
-#line 258 "program_lexer.l"
-{ return BACK; }
+#line 259 "program_lexer.l"
+{ return RESULT; }
YY_BREAK
case 81:
YY_RULE_SETUP
-#line 259 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, CLIP); }
+#line 261 "program_lexer.l"
+{ return AMBIENT; }
YY_BREAK
case 82:
YY_RULE_SETUP
-#line 260 "program_lexer.l"
-{ return COLOR; }
+#line 262 "program_lexer.l"
+{ return ATTENUATION; }
YY_BREAK
case 83:
YY_RULE_SETUP
-#line 261 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_fp, DEPTH); }
+#line 263 "program_lexer.l"
+{ return BACK; }
YY_BREAK
case 84:
YY_RULE_SETUP
-#line 262 "program_lexer.l"
-{ return DIFFUSE; }
+#line 264 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, CLIP); }
YY_BREAK
case 85:
YY_RULE_SETUP
-#line 263 "program_lexer.l"
-{ return DIRECTION; }
+#line 265 "program_lexer.l"
+{ return COLOR; }
YY_BREAK
case 86:
YY_RULE_SETUP
-#line 264 "program_lexer.l"
-{ return EMISSION; }
+#line 266 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_fp, DEPTH); }
YY_BREAK
case 87:
YY_RULE_SETUP
-#line 265 "program_lexer.l"
-{ return ENV; }
+#line 267 "program_lexer.l"
+{ return DIFFUSE; }
YY_BREAK
case 88:
YY_RULE_SETUP
-#line 266 "program_lexer.l"
-{ return EYE; }
+#line 268 "program_lexer.l"
+{ return DIRECTION; }
YY_BREAK
case 89:
YY_RULE_SETUP
-#line 267 "program_lexer.l"
-{ return FOGCOORD; }
+#line 269 "program_lexer.l"
+{ return EMISSION; }
YY_BREAK
case 90:
YY_RULE_SETUP
-#line 268 "program_lexer.l"
-{ return FOG; }
+#line 270 "program_lexer.l"
+{ return ENV; }
YY_BREAK
case 91:
YY_RULE_SETUP
-#line 269 "program_lexer.l"
-{ return FRONT; }
+#line 271 "program_lexer.l"
+{ return EYE; }
YY_BREAK
case 92:
YY_RULE_SETUP
-#line 270 "program_lexer.l"
-{ return HALF; }
+#line 272 "program_lexer.l"
+{ return FOGCOORD; }
YY_BREAK
case 93:
YY_RULE_SETUP
-#line 271 "program_lexer.l"
-{ return INVERSE; }
+#line 273 "program_lexer.l"
+{ return FOG; }
YY_BREAK
case 94:
YY_RULE_SETUP
-#line 272 "program_lexer.l"
-{ return INVTRANS; }
+#line 274 "program_lexer.l"
+{ return FRONT; }
YY_BREAK
case 95:
YY_RULE_SETUP
-#line 273 "program_lexer.l"
-{ return LIGHT; }
+#line 275 "program_lexer.l"
+{ return HALF; }
YY_BREAK
case 96:
YY_RULE_SETUP
-#line 274 "program_lexer.l"
-{ return LIGHTMODEL; }
+#line 276 "program_lexer.l"
+{ return INVERSE; }
YY_BREAK
case 97:
YY_RULE_SETUP
-#line 275 "program_lexer.l"
-{ return LIGHTPROD; }
+#line 277 "program_lexer.l"
+{ return INVTRANS; }
YY_BREAK
case 98:
YY_RULE_SETUP
-#line 276 "program_lexer.l"
-{ return LOCAL; }
+#line 278 "program_lexer.l"
+{ return LIGHT; }
YY_BREAK
case 99:
YY_RULE_SETUP
-#line 277 "program_lexer.l"
-{ return MATERIAL; }
+#line 279 "program_lexer.l"
+{ return LIGHTMODEL; }
YY_BREAK
case 100:
YY_RULE_SETUP
-#line 278 "program_lexer.l"
-{ return MAT_PROGRAM; }
+#line 280 "program_lexer.l"
+{ return LIGHTPROD; }
YY_BREAK
case 101:
YY_RULE_SETUP
-#line 279 "program_lexer.l"
-{ return MATRIX; }
+#line 281 "program_lexer.l"
+{ return LOCAL; }
YY_BREAK
case 102:
YY_RULE_SETUP
-#line 280 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, MATRIXINDEX); }
+#line 282 "program_lexer.l"
+{ return MATERIAL; }
YY_BREAK
case 103:
YY_RULE_SETUP
-#line 281 "program_lexer.l"
-{ return MODELVIEW; }
+#line 283 "program_lexer.l"
+{ return MAT_PROGRAM; }
YY_BREAK
case 104:
YY_RULE_SETUP
-#line 282 "program_lexer.l"
-{ return MVP; }
+#line 284 "program_lexer.l"
+{ return MATRIX; }
YY_BREAK
case 105:
YY_RULE_SETUP
-#line 283 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, NORMAL); }
+#line 285 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, MATRIXINDEX); }
YY_BREAK
case 106:
YY_RULE_SETUP
-#line 284 "program_lexer.l"
-{ return OBJECT; }
+#line 286 "program_lexer.l"
+{ return MODELVIEW; }
YY_BREAK
case 107:
YY_RULE_SETUP
-#line 285 "program_lexer.l"
-{ return PALETTE; }
+#line 287 "program_lexer.l"
+{ return MVP; }
YY_BREAK
case 108:
YY_RULE_SETUP
-#line 286 "program_lexer.l"
-{ return PARAMS; }
+#line 288 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, NORMAL); }
YY_BREAK
case 109:
YY_RULE_SETUP
-#line 287 "program_lexer.l"
-{ return PLANE; }
+#line 289 "program_lexer.l"
+{ return OBJECT; }
YY_BREAK
case 110:
YY_RULE_SETUP
-#line 288 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, POINT_TOK); }
+#line 290 "program_lexer.l"
+{ return PALETTE; }
YY_BREAK
case 111:
YY_RULE_SETUP
-#line 289 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, POINTSIZE); }
+#line 291 "program_lexer.l"
+{ return PARAMS; }
YY_BREAK
case 112:
YY_RULE_SETUP
-#line 290 "program_lexer.l"
-{ return POSITION; }
+#line 292 "program_lexer.l"
+{ return PLANE; }
YY_BREAK
case 113:
YY_RULE_SETUP
-#line 291 "program_lexer.l"
-{ return PRIMARY; }
+#line 293 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, POINT_TOK); }
YY_BREAK
case 114:
YY_RULE_SETUP
-#line 292 "program_lexer.l"
-{ return PROJECTION; }
+#line 294 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, POINTSIZE); }
YY_BREAK
case 115:
YY_RULE_SETUP
-#line 293 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_fp, RANGE); }
+#line 295 "program_lexer.l"
+{ return POSITION; }
YY_BREAK
case 116:
YY_RULE_SETUP
-#line 294 "program_lexer.l"
-{ return ROW; }
+#line 296 "program_lexer.l"
+{ return PRIMARY; }
YY_BREAK
case 117:
YY_RULE_SETUP
-#line 295 "program_lexer.l"
-{ return SCENECOLOR; }
+#line 297 "program_lexer.l"
+{ return PROJECTION; }
YY_BREAK
case 118:
YY_RULE_SETUP
-#line 296 "program_lexer.l"
-{ return SECONDARY; }
+#line 298 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_fp, RANGE); }
YY_BREAK
case 119:
YY_RULE_SETUP
-#line 297 "program_lexer.l"
-{ return SHININESS; }
+#line 299 "program_lexer.l"
+{ return ROW; }
YY_BREAK
case 120:
YY_RULE_SETUP
-#line 298 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, SIZE_TOK); }
+#line 300 "program_lexer.l"
+{ return SCENECOLOR; }
YY_BREAK
case 121:
YY_RULE_SETUP
-#line 299 "program_lexer.l"
-{ return SPECULAR; }
+#line 301 "program_lexer.l"
+{ return SECONDARY; }
YY_BREAK
case 122:
YY_RULE_SETUP
-#line 300 "program_lexer.l"
-{ return SPOT; }
+#line 302 "program_lexer.l"
+{ return SHININESS; }
YY_BREAK
case 123:
YY_RULE_SETUP
-#line 301 "program_lexer.l"
-{ return TEXCOORD; }
+#line 303 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, SIZE_TOK); }
YY_BREAK
case 124:
YY_RULE_SETUP
-#line 302 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_fp, TEXENV); }
+#line 304 "program_lexer.l"
+{ return SPECULAR; }
YY_BREAK
case 125:
YY_RULE_SETUP
-#line 303 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, TEXGEN); }
+#line 305 "program_lexer.l"
+{ return SPOT; }
YY_BREAK
case 126:
YY_RULE_SETUP
-#line 304 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, TEXGEN_Q); }
+#line 306 "program_lexer.l"
+{ return TEXCOORD; }
YY_BREAK
case 127:
YY_RULE_SETUP
-#line 305 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, TEXGEN_S); }
+#line 307 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_fp, TEXENV); }
YY_BREAK
case 128:
YY_RULE_SETUP
-#line 306 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, TEXGEN_T); }
+#line 308 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, TEXGEN); }
YY_BREAK
case 129:
YY_RULE_SETUP
-#line 307 "program_lexer.l"
-{ return TEXTURE; }
+#line 309 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, TEXGEN_Q); }
YY_BREAK
case 130:
YY_RULE_SETUP
-#line 308 "program_lexer.l"
-{ return TRANSPOSE; }
+#line 310 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, TEXGEN_S); }
YY_BREAK
case 131:
YY_RULE_SETUP
-#line 309 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, VTXATTRIB); }
+#line 311 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, TEXGEN_T); }
YY_BREAK
case 132:
YY_RULE_SETUP
-#line 310 "program_lexer.l"
-{ return_token_or_DOT(require_ARB_vp, WEIGHT); }
+#line 312 "program_lexer.l"
+{ return TEXTURE; }
YY_BREAK
case 133:
YY_RULE_SETUP
-#line 312 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); }
+#line 313 "program_lexer.l"
+{ return TRANSPOSE; }
YY_BREAK
case 134:
YY_RULE_SETUP
-#line 313 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); }
+#line 314 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, VTXATTRIB); }
YY_BREAK
case 135:
YY_RULE_SETUP
-#line 314 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); }
+#line 315 "program_lexer.l"
+{ return_token_or_DOT(require_ARB_vp, WEIGHT); }
YY_BREAK
case 136:
YY_RULE_SETUP
-#line 315 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); }
+#line 317 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); }
YY_BREAK
case 137:
YY_RULE_SETUP
-#line 316 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); }
+#line 318 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp || require_NV_vp3, TEX_1D); }
YY_BREAK
case 138:
YY_RULE_SETUP
-#line 317 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); }
+#line 319 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp || require_NV_vp3, TEX_2D); }
YY_BREAK
case 139:
YY_RULE_SETUP
-#line 318 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); }
+#line 320 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp || require_NV_vp3, TEX_3D); }
YY_BREAK
case 140:
YY_RULE_SETUP
-#line 319 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); }
+#line 321 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); }
YY_BREAK
case 141:
YY_RULE_SETUP
-#line 320 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); }
+#line 322 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); }
YY_BREAK
case 142:
YY_RULE_SETUP
-#line 321 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); }
+#line 323 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); }
YY_BREAK
case 143:
YY_RULE_SETUP
-#line 322 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); }
+#line 324 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); }
YY_BREAK
case 144:
YY_RULE_SETUP
-#line 323 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); }
+#line 325 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); }
YY_BREAK
case 145:
YY_RULE_SETUP
-#line 324 "program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); }
+#line 326 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); }
YY_BREAK
case 146:
YY_RULE_SETUP
-#line 326 "program_lexer.l"
-{ return handle_ident(yyextra, yytext, yylval); }
+#line 327 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); }
YY_BREAK
case 147:
YY_RULE_SETUP
#line 328 "program_lexer.l"
-{ return DOT_DOT; }
+{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); }
YY_BREAK
case 148:
YY_RULE_SETUP
-#line 330 "program_lexer.l"
+#line 329 "program_lexer.l"
+{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); }
+ YY_BREAK
+case 149:
+YY_RULE_SETUP
+#line 331 "program_lexer.l"
+{ return handle_ident(yyextra, yytext, yylval); }
+ YY_BREAK
+case 150:
+YY_RULE_SETUP
+#line 333 "program_lexer.l"
+{ return DOT_DOT; }
+ YY_BREAK
+case 151:
+YY_RULE_SETUP
+#line 335 "program_lexer.l"
{
yylval->integer = strtol(yytext, NULL, 10);
return INTEGER;
}
YY_BREAK
-case 149:
+case 152:
YY_RULE_SETUP
-#line 334 "program_lexer.l"
+#line 339 "program_lexer.l"
{
- yylval->real = strtod(yytext, NULL);
+ yylval->real = _mesa_strtod(yytext, NULL);
return REAL;
}
YY_BREAK
-case 150:
-/* rule 150 can match eol */
+case 153:
+/* rule 153 can match eol */
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 338 "program_lexer.l"
+#line 343 "program_lexer.l"
{
- yylval->real = strtod(yytext, NULL);
+ yylval->real = _mesa_strtod(yytext, NULL);
return REAL;
}
YY_BREAK
-case 151:
+case 154:
YY_RULE_SETUP
-#line 342 "program_lexer.l"
+#line 347 "program_lexer.l"
{
- yylval->real = strtod(yytext, NULL);
+ yylval->real = _mesa_strtod(yytext, NULL);
return REAL;
}
YY_BREAK
-case 152:
+case 155:
YY_RULE_SETUP
-#line 346 "program_lexer.l"
+#line 351 "program_lexer.l"
{
- yylval->real = strtod(yytext, NULL);
+ yylval->real = _mesa_strtod(yytext, NULL);
return REAL;
}
YY_BREAK
-case 153:
+case 156:
YY_RULE_SETUP
-#line 351 "program_lexer.l"
+#line 356 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_NOOP;
yylval->swiz_mask.mask = WRITEMASK_XYZW;
return MASK4;
}
YY_BREAK
-case 154:
+case 157:
YY_RULE_SETUP
-#line 357 "program_lexer.l"
+#line 362 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_XY
@@ -2304,27 +2373,27 @@ YY_RULE_SETUP
return MASK3;
}
YY_BREAK
-case 155:
+case 158:
YY_RULE_SETUP
-#line 363 "program_lexer.l"
+#line 368 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_XZW;
return MASK3;
}
YY_BREAK
-case 156:
+case 159:
YY_RULE_SETUP
-#line 368 "program_lexer.l"
+#line 373 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_YZW;
return MASK3;
}
YY_BREAK
-case 157:
+case 160:
YY_RULE_SETUP
-#line 374 "program_lexer.l"
+#line 379 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_X
@@ -2332,9 +2401,9 @@ YY_RULE_SETUP
return MASK2;
}
YY_BREAK
-case 158:
+case 161:
YY_RULE_SETUP
-#line 380 "program_lexer.l"
+#line 385 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_Y
@@ -2342,18 +2411,18 @@ YY_RULE_SETUP
return MASK2;
}
YY_BREAK
-case 159:
+case 162:
YY_RULE_SETUP
-#line 386 "program_lexer.l"
+#line 391 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_ZW;
return MASK2;
}
YY_BREAK
-case 160:
+case 163:
YY_RULE_SETUP
-#line 392 "program_lexer.l"
+#line 397 "program_lexer.l"
{
const unsigned s = swiz_from_char(yytext[1]);
yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s);
@@ -2361,9 +2430,9 @@ YY_RULE_SETUP
return MASK1;
}
YY_BREAK
-case 161:
+case 164:
YY_RULE_SETUP
-#line 399 "program_lexer.l"
+#line 404 "program_lexer.l"
{
yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]),
swiz_from_char(yytext[2]),
@@ -2373,18 +2442,18 @@ YY_RULE_SETUP
return SWIZZLE;
}
YY_BREAK
-case 162:
+case 165:
YY_RULE_SETUP
-#line 408 "program_lexer.l"
+#line 413 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_NOOP;
yylval->swiz_mask.mask = WRITEMASK_XYZW;
return_token_or_DOT(require_ARB_fp, MASK4);
}
YY_BREAK
-case 163:
+case 166:
YY_RULE_SETUP
-#line 414 "program_lexer.l"
+#line 419 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_XY
@@ -2392,27 +2461,27 @@ YY_RULE_SETUP
return_token_or_DOT(require_ARB_fp, MASK3);
}
YY_BREAK
-case 164:
+case 167:
YY_RULE_SETUP
-#line 420 "program_lexer.l"
+#line 425 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_XZW;
return_token_or_DOT(require_ARB_fp, MASK3);
}
YY_BREAK
-case 165:
+case 168:
YY_RULE_SETUP
-#line 425 "program_lexer.l"
+#line 430 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_YZW;
return_token_or_DOT(require_ARB_fp, MASK3);
}
YY_BREAK
-case 166:
+case 169:
YY_RULE_SETUP
-#line 431 "program_lexer.l"
+#line 436 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_X
@@ -2420,9 +2489,9 @@ YY_RULE_SETUP
return_token_or_DOT(require_ARB_fp, MASK2);
}
YY_BREAK
-case 167:
+case 170:
YY_RULE_SETUP
-#line 437 "program_lexer.l"
+#line 442 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_Y
@@ -2430,18 +2499,18 @@ YY_RULE_SETUP
return_token_or_DOT(require_ARB_fp, MASK2);
}
YY_BREAK
-case 168:
+case 171:
YY_RULE_SETUP
-#line 443 "program_lexer.l"
+#line 448 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_ZW;
return_token_or_DOT(require_ARB_fp, MASK2);
}
YY_BREAK
-case 169:
+case 172:
YY_RULE_SETUP
-#line 449 "program_lexer.l"
+#line 454 "program_lexer.l"
{
const unsigned s = swiz_from_char(yytext[1]);
yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s);
@@ -2449,9 +2518,9 @@ YY_RULE_SETUP
return_token_or_DOT(require_ARB_fp, MASK1);
}
YY_BREAK
-case 170:
+case 173:
YY_RULE_SETUP
-#line 457 "program_lexer.l"
+#line 462 "program_lexer.l"
{
if (require_ARB_vp) {
return TEXGEN_R;
@@ -2463,9 +2532,9 @@ YY_RULE_SETUP
}
}
YY_BREAK
-case 171:
+case 174:
YY_RULE_SETUP
-#line 468 "program_lexer.l"
+#line 473 "program_lexer.l"
{
yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]),
swiz_from_char(yytext[2]),
@@ -2475,15 +2544,15 @@ YY_RULE_SETUP
return_token_or_DOT(require_ARB_fp, SWIZZLE);
}
YY_BREAK
-case 172:
+case 175:
YY_RULE_SETUP
-#line 477 "program_lexer.l"
+#line 482 "program_lexer.l"
{ return DOT; }
YY_BREAK
-case 173:
-/* rule 173 can match eol */
+case 176:
+/* rule 176 can match eol */
YY_RULE_SETUP
-#line 479 "program_lexer.l"
+#line 484 "program_lexer.l"
{
yylloc->first_line++;
yylloc->first_column = 1;
@@ -2492,30 +2561,30 @@ YY_RULE_SETUP
yylloc->position++;
}
YY_BREAK
-case 174:
+case 177:
YY_RULE_SETUP
-#line 486 "program_lexer.l"
+#line 491 "program_lexer.l"
/* eat whitespace */ ;
YY_BREAK
-case 175:
+case 178:
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 487 "program_lexer.l"
+#line 492 "program_lexer.l"
/* eat comments */ ;
YY_BREAK
-case 176:
+case 179:
YY_RULE_SETUP
-#line 488 "program_lexer.l"
+#line 493 "program_lexer.l"
{ return yytext[0]; }
YY_BREAK
-case 177:
+case 180:
YY_RULE_SETUP
-#line 489 "program_lexer.l"
+#line 494 "program_lexer.l"
ECHO;
YY_BREAK
-#line 2519 "lex.yy.c"
+#line 2588 "lex.yy.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -2809,7 +2878,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 862 )
+ if ( yy_current_state >= 916 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -2838,11 +2907,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 862 )
+ if ( yy_current_state >= 916 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 861);
+ yy_is_jam = (yy_current_state == 915);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -3690,7 +3759,7 @@ void yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 489 "program_lexer.l"
+#line 494 "program_lexer.l"
diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c
index a2bed079004..ba4d39452f4 100644
--- a/src/mesa/shader/prog_print.c
+++ b/src/mesa/shader/prog_print.c
@@ -906,7 +906,8 @@ _mesa_fprint_parameter_list(FILE *f,
if (!list)
return;
- _mesa_fprintf(f, "param list %p\n", (void *) list);
+ if (0)
+ _mesa_fprintf(f, "param list %p\n", (void *) list);
_mesa_fprintf(f, "dirty state flags: 0x%x\n", list->StateFlags);
for (i = 0; i < list->NumParameters; i++){
struct gl_program_parameter *param = list->Parameters + i;
diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l
index 60730ca1adc..25fcaa7446a 100644
--- a/src/mesa/shader/program_lexer.l
+++ b/src/mesa/shader/program_lexer.l
@@ -22,6 +22,7 @@
* DEALINGS IN THE SOFTWARE.
*/
#include "main/glheader.h"
+#include "main/imports.h"
#include "prog_instruction.h"
#include "prog_statevars.h"
@@ -336,19 +337,19 @@ ARRAYSHADOW2D { return_token_or_IDENTIFIER(require_ARB_fp && require
return INTEGER;
}
{num}?{frac}{exp}? {
- yylval->real = strtod(yytext, NULL);
+ yylval->real = _mesa_strtod(yytext, NULL);
return REAL;
}
{num}"."/[^.] {
- yylval->real = strtod(yytext, NULL);
+ yylval->real = _mesa_strtod(yytext, NULL);
return REAL;
}
{num}{exp} {
- yylval->real = strtod(yytext, NULL);
+ yylval->real = _mesa_strtod(yytext, NULL);
return REAL;
}
{num}"."{exp} {
- yylval->real = strtod(yytext, NULL);
+ yylval->real = _mesa_strtod(yytext, NULL);
return REAL;
}
diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c
index 3fde2e3d1bd..395461d0212 100644
--- a/src/mesa/shader/program_parse.tab.c
+++ b/src/mesa/shader/program_parse.tab.c
@@ -177,9 +177,14 @@ static struct asm_instruction *asm_instruction_copy_ctor(
#define YYLEX_PARAM state->scanner
+#define SWIZZLE_XXXX MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)
+#define SWIZZLE_YYYY MAKE_SWIZZLE4(SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y)
+#define SWIZZLE_ZZZZ MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z)
+#define SWIZZLE_WWWW MAKE_SWIZZLE4(SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W)
+
/* Line 189 of yacc.c */
-#line 183 "program_parse.tab.c"
+#line 188 "program_parse.tab.c"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -222,98 +227,101 @@ static struct asm_instruction *asm_instruction_copy_ctor(
SCALAR_OP = 271,
TRI_OP = 272,
VECTOR_OP = 273,
- ARL_OP = 274,
- ARA_OP = 275,
- KIL = 276,
- SWZ = 277,
- TXD_OP = 278,
- BRA_OP = 279,
- FLOW_OP = 280,
- INTEGER = 281,
- REAL = 282,
- AMBIENT = 283,
- ATTENUATION = 284,
- BACK = 285,
- CLIP = 286,
- COLOR = 287,
- DEPTH = 288,
- DIFFUSE = 289,
- DIRECTION = 290,
- EMISSION = 291,
- ENV = 292,
- EYE = 293,
- FOG = 294,
- FOGCOORD = 295,
- FRAGMENT = 296,
- FRONT = 297,
- HALF = 298,
- INVERSE = 299,
- INVTRANS = 300,
- LIGHT = 301,
- LIGHTMODEL = 302,
- LIGHTPROD = 303,
- LOCAL = 304,
- MATERIAL = 305,
- MAT_PROGRAM = 306,
- MATRIX = 307,
- MATRIXINDEX = 308,
- MODELVIEW = 309,
- MVP = 310,
- NORMAL = 311,
- OBJECT = 312,
- PALETTE = 313,
- PARAMS = 314,
- PLANE = 315,
- POINT_TOK = 316,
- POINTSIZE = 317,
- POSITION = 318,
- PRIMARY = 319,
- PROGRAM = 320,
- PROJECTION = 321,
- RANGE = 322,
- RESULT = 323,
- ROW = 324,
- SCENECOLOR = 325,
- SECONDARY = 326,
- SHININESS = 327,
- SIZE_TOK = 328,
- SPECULAR = 329,
- SPOT = 330,
- STATE = 331,
- TEXCOORD = 332,
- TEXENV = 333,
- TEXGEN = 334,
- TEXGEN_Q = 335,
- TEXGEN_R = 336,
- TEXGEN_S = 337,
- TEXGEN_T = 338,
- TEXTURE = 339,
- TRANSPOSE = 340,
- TEXTURE_UNIT = 341,
- TEX_1D = 342,
- TEX_2D = 343,
- TEX_3D = 344,
- TEX_CUBE = 345,
- TEX_RECT = 346,
- TEX_SHADOW1D = 347,
- TEX_SHADOW2D = 348,
- TEX_SHADOWRECT = 349,
- TEX_ARRAY1D = 350,
- TEX_ARRAY2D = 351,
- TEX_ARRAYSHADOW1D = 352,
- TEX_ARRAYSHADOW2D = 353,
- VERTEX = 354,
- VTXATTRIB = 355,
- WEIGHT = 356,
- IDENTIFIER = 357,
- USED_IDENTIFIER = 358,
- MASK4 = 359,
- MASK3 = 360,
- MASK2 = 361,
- MASK1 = 362,
- SWIZZLE = 363,
- DOT_DOT = 364,
- DOT = 365
+ KIL = 274,
+ SWZ = 275,
+ TXD_OP = 276,
+ BRA_OP = 277,
+ FLOW_OP = 278,
+ ARL_OP = 279,
+ ARL_NV_OP = 280,
+ ARA_OP = 281,
+ PUSHA_OP = 282,
+ POPA_OP = 283,
+ INTEGER = 284,
+ REAL = 285,
+ AMBIENT = 286,
+ ATTENUATION = 287,
+ BACK = 288,
+ CLIP = 289,
+ COLOR = 290,
+ DEPTH = 291,
+ DIFFUSE = 292,
+ DIRECTION = 293,
+ EMISSION = 294,
+ ENV = 295,
+ EYE = 296,
+ FOG = 297,
+ FOGCOORD = 298,
+ FRAGMENT = 299,
+ FRONT = 300,
+ HALF = 301,
+ INVERSE = 302,
+ INVTRANS = 303,
+ LIGHT = 304,
+ LIGHTMODEL = 305,
+ LIGHTPROD = 306,
+ LOCAL = 307,
+ MATERIAL = 308,
+ MAT_PROGRAM = 309,
+ MATRIX = 310,
+ MATRIXINDEX = 311,
+ MODELVIEW = 312,
+ MVP = 313,
+ NORMAL = 314,
+ OBJECT = 315,
+ PALETTE = 316,
+ PARAMS = 317,
+ PLANE = 318,
+ POINT_TOK = 319,
+ POINTSIZE = 320,
+ POSITION = 321,
+ PRIMARY = 322,
+ PROGRAM = 323,
+ PROJECTION = 324,
+ RANGE = 325,
+ RESULT = 326,
+ ROW = 327,
+ SCENECOLOR = 328,
+ SECONDARY = 329,
+ SHININESS = 330,
+ SIZE_TOK = 331,
+ SPECULAR = 332,
+ SPOT = 333,
+ STATE = 334,
+ TEXCOORD = 335,
+ TEXENV = 336,
+ TEXGEN = 337,
+ TEXGEN_Q = 338,
+ TEXGEN_R = 339,
+ TEXGEN_S = 340,
+ TEXGEN_T = 341,
+ TEXTURE = 342,
+ TRANSPOSE = 343,
+ TEXTURE_UNIT = 344,
+ TEX_1D = 345,
+ TEX_2D = 346,
+ TEX_3D = 347,
+ TEX_CUBE = 348,
+ TEX_RECT = 349,
+ TEX_SHADOW1D = 350,
+ TEX_SHADOW2D = 351,
+ TEX_SHADOWRECT = 352,
+ TEX_ARRAY1D = 353,
+ TEX_ARRAY2D = 354,
+ TEX_ARRAYSHADOW1D = 355,
+ TEX_ARRAYSHADOW2D = 356,
+ VERTEX = 357,
+ VTXATTRIB = 358,
+ WEIGHT = 359,
+ IDENTIFIER = 360,
+ USED_IDENTIFIER = 361,
+ MASK4 = 362,
+ MASK3 = 363,
+ MASK2 = 364,
+ MASK1 = 365,
+ SWIZZLE = 366,
+ DOT_DOT = 367,
+ DOT = 368
};
#endif
@@ -324,7 +332,7 @@ typedef union YYSTYPE
{
/* Line 214 of yacc.c */
-#line 116 "program_parse.y"
+#line 121 "program_parse.y"
struct asm_instruction *inst;
struct asm_symbol *sym;
@@ -353,7 +361,7 @@ typedef union YYSTYPE
/* Line 214 of yacc.c */
-#line 357 "program_parse.tab.c"
+#line 365 "program_parse.tab.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -377,14 +385,14 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */
/* Line 264 of yacc.c */
-#line 262 "program_parse.y"
+#line 269 "program_parse.y"
extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
void *yyscanner);
/* Line 264 of yacc.c */
-#line 388 "program_parse.tab.c"
+#line 396 "program_parse.tab.c"
#ifdef short
# undef short
@@ -601,20 +609,20 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 5
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 434
+#define YYLAST 493
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 124
+#define YYNTOKENS 127
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 150
+#define YYNNTS 151
/* YYNRULES -- Number of rules. */
-#define YYNRULES 295
+#define YYNRULES 301
/* YYNRULES -- Number of states. */
-#define YYNSTATES 501
+#define YYNSTATES 513
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 365
+#define YYMAXUTOK 368
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -626,15 +634,15 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 119, 120, 2, 117, 113, 118, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 112, 111,
- 2, 121, 2, 2, 2, 2, 2, 2, 2, 2,
+ 122, 123, 2, 120, 116, 121, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 115, 114,
+ 2, 124, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 115, 2, 116, 2, 2, 2, 2, 2, 2,
+ 2, 118, 2, 119, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 122, 114, 123, 2, 2, 2, 2,
+ 2, 2, 2, 125, 117, 126, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -658,7 +666,7 @@ static const yytype_uint8 yytranslate[] =
75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 108, 109, 110
+ 105, 106, 107, 108, 109, 110, 111, 112, 113
};
#if YYDEBUG
@@ -669,157 +677,161 @@ static const yytype_uint16 yyprhs[] =
0, 0, 3, 8, 10, 12, 15, 16, 20, 23,
24, 27, 30, 33, 35, 37, 39, 41, 43, 45,
47, 49, 51, 53, 55, 57, 59, 61, 63, 65,
- 70, 75, 80, 85, 92, 99, 108, 117, 120, 123,
- 136, 139, 141, 143, 145, 147, 149, 151, 153, 155,
- 157, 159, 161, 163, 170, 174, 177, 180, 185, 188,
- 190, 194, 200, 204, 208, 210, 212, 220, 223, 225,
- 227, 229, 231, 236, 238, 240, 242, 244, 246, 248,
- 250, 254, 255, 258, 261, 263, 265, 267, 269, 271,
- 273, 275, 277, 278, 280, 282, 284, 286, 287, 291,
- 295, 296, 299, 302, 304, 306, 308, 310, 312, 314,
- 316, 318, 320, 322, 324, 329, 332, 335, 337, 340,
- 342, 345, 347, 350, 355, 360, 362, 363, 367, 369,
- 371, 374, 376, 379, 381, 383, 387, 394, 395, 397,
- 400, 405, 407, 411, 413, 415, 417, 419, 421, 423,
- 425, 427, 429, 431, 434, 437, 440, 443, 446, 449,
- 452, 455, 458, 461, 464, 467, 471, 473, 475, 477,
- 483, 485, 487, 489, 492, 494, 496, 499, 501, 504,
- 511, 513, 517, 519, 521, 523, 525, 527, 532, 534,
- 536, 538, 540, 542, 544, 547, 549, 551, 557, 559,
- 562, 564, 566, 572, 575, 576, 583, 587, 588, 590,
- 592, 594, 596, 598, 601, 603, 605, 608, 613, 618,
- 619, 623, 625, 627, 629, 632, 634, 636, 638, 640,
- 646, 648, 652, 658, 664, 666, 670, 676, 678, 680,
- 682, 684, 686, 688, 690, 692, 694, 698, 704, 712,
- 722, 725, 728, 730, 732, 733, 734, 739, 741, 742,
- 743, 747, 751, 753, 759, 762, 765, 768, 771, 775,
- 778, 784, 788, 789, 791, 793, 794, 796, 798, 799,
- 801, 803, 804, 806, 808, 809, 813, 814, 818, 819,
- 823, 825, 827, 829, 834, 836
+ 67, 72, 77, 82, 85, 88, 93, 98, 105, 112,
+ 121, 130, 133, 136, 149, 152, 155, 157, 159, 161,
+ 163, 165, 167, 169, 171, 173, 175, 177, 179, 181,
+ 188, 192, 195, 198, 203, 206, 208, 212, 218, 222,
+ 226, 228, 230, 238, 241, 243, 245, 247, 249, 254,
+ 256, 258, 260, 262, 264, 266, 268, 272, 273, 276,
+ 279, 281, 283, 285, 287, 289, 291, 293, 295, 296,
+ 298, 300, 302, 304, 305, 309, 313, 314, 317, 320,
+ 322, 324, 326, 328, 330, 332, 334, 336, 338, 340,
+ 342, 347, 350, 353, 355, 358, 360, 363, 365, 368,
+ 373, 378, 380, 381, 385, 387, 389, 392, 394, 397,
+ 399, 401, 405, 412, 413, 415, 418, 423, 425, 429,
+ 431, 433, 435, 437, 439, 441, 443, 445, 447, 449,
+ 452, 455, 458, 461, 464, 467, 470, 473, 476, 479,
+ 482, 485, 489, 491, 493, 495, 501, 503, 505, 507,
+ 510, 512, 514, 517, 519, 522, 529, 531, 535, 537,
+ 539, 541, 543, 545, 550, 552, 554, 556, 558, 560,
+ 562, 565, 567, 569, 575, 577, 580, 582, 584, 590,
+ 593, 594, 601, 605, 606, 608, 610, 612, 614, 616,
+ 619, 621, 623, 626, 631, 636, 637, 641, 643, 645,
+ 647, 650, 652, 654, 656, 658, 664, 666, 670, 676,
+ 682, 684, 688, 694, 696, 698, 700, 702, 704, 706,
+ 708, 710, 712, 716, 722, 730, 740, 743, 746, 748,
+ 750, 751, 752, 757, 759, 760, 761, 765, 769, 771,
+ 777, 780, 783, 786, 789, 793, 796, 802, 806, 807,
+ 809, 811, 812, 814, 816, 817, 819, 821, 822, 824,
+ 826, 827, 831, 832, 836, 837, 841, 843, 845, 847,
+ 852, 854
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int16 yyrhs[] =
{
- 125, 0, -1, 126, 127, 129, 12, -1, 3, -1,
- 4, -1, 127, 128, -1, -1, 8, 273, 111, -1,
- 129, 130, -1, -1, 131, 111, -1, 181, 111, -1,
- 179, 112, -1, 132, -1, 133, -1, 134, -1, 136,
- -1, 135, -1, 137, -1, 138, -1, 139, -1, 140,
- -1, 141, -1, 147, -1, 142, -1, 143, -1, 144,
- -1, 148, -1, 149, -1, 19, 154, 113, 150, -1,
- 20, 154, 113, 155, -1, 18, 153, 113, 152, -1,
- 16, 153, 113, 150, -1, 14, 153, 113, 150, 113,
- 150, -1, 13, 153, 113, 152, 113, 152, -1, 17,
- 153, 113, 152, 113, 152, 113, 152, -1, 15, 153,
- 113, 152, 113, 145, 113, 146, -1, 21, 152, -1,
- 21, 175, -1, 23, 153, 113, 152, 113, 152, 113,
- 152, 113, 145, 113, 146, -1, 86, 267, -1, 87,
- -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
+ 128, 0, -1, 129, 130, 132, 12, -1, 3, -1,
+ 4, -1, 130, 131, -1, -1, 8, 277, 114, -1,
+ 132, 133, -1, -1, 134, 114, -1, 185, 114, -1,
+ 183, 115, -1, 135, -1, 136, -1, 137, -1, 139,
+ -1, 138, -1, 140, -1, 141, -1, 142, -1, 143,
+ -1, 144, -1, 145, -1, 151, -1, 146, -1, 147,
+ -1, 148, -1, 152, -1, 153, -1, 24, 158, 116,
+ 154, -1, 25, 158, 116, 156, -1, 26, 158, 116,
+ 159, -1, 27, 159, -1, 28, 158, -1, 18, 157,
+ 116, 156, -1, 16, 157, 116, 154, -1, 14, 157,
+ 116, 154, 116, 154, -1, 13, 157, 116, 156, 116,
+ 156, -1, 17, 157, 116, 156, 116, 156, 116, 156,
+ -1, 15, 157, 116, 156, 116, 149, 116, 150, -1,
+ 19, 156, -1, 19, 179, -1, 21, 157, 116, 156,
+ 116, 156, 116, 156, 116, 149, 116, 150, -1, 89,
+ 271, -1, 277, 271, -1, 90, -1, 91, -1, 92,
-1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
- -1, 98, -1, 22, 153, 113, 160, 113, 157, -1,
- 24, 180, 174, -1, 25, 174, -1, 252, 151, -1,
- 252, 114, 151, 114, -1, 160, 171, -1, 249, -1,
- 252, 160, 172, -1, 252, 114, 160, 172, 114, -1,
- 161, 173, 174, -1, 169, 173, 174, -1, 156, -1,
- 169, -1, 158, 113, 158, 113, 158, 113, 158, -1,
- 252, 159, -1, 26, -1, 273, -1, 103, -1, 183,
- -1, 162, 115, 163, 116, -1, 197, -1, 260, -1,
- 103, -1, 103, -1, 164, -1, 165, -1, 26, -1,
- 169, 170, 166, -1, -1, 117, 167, -1, 118, 168,
- -1, 26, -1, 26, -1, 103, -1, 107, -1, 107,
- -1, 107, -1, 104, -1, 108, -1, -1, 104, -1,
- 105, -1, 106, -1, 107, -1, -1, 119, 175, 120,
- -1, 119, 176, 120, -1, -1, 177, 172, -1, 178,
- 172, -1, 102, -1, 103, -1, 180, -1, 102, -1,
- 103, -1, 182, -1, 189, -1, 253, -1, 256, -1,
- 259, -1, 272, -1, 7, 102, 121, 183, -1, 99,
- 184, -1, 41, 188, -1, 63, -1, 101, 186, -1,
- 56, -1, 32, 265, -1, 40, -1, 77, 266, -1,
- 53, 115, 187, 116, -1, 100, 115, 185, 116, -1,
- 26, -1, -1, 115, 187, 116, -1, 26, -1, 63,
- -1, 32, 265, -1, 40, -1, 77, 266, -1, 190,
- -1, 191, -1, 10, 102, 193, -1, 10, 102, 115,
- 192, 116, 194, -1, -1, 26, -1, 121, 196, -1,
- 121, 122, 195, 123, -1, 198, -1, 195, 113, 198,
- -1, 200, -1, 236, -1, 246, -1, 200, -1, 236,
- -1, 247, -1, 199, -1, 237, -1, 246, -1, 200,
- -1, 76, 224, -1, 76, 201, -1, 76, 203, -1,
- 76, 206, -1, 76, 208, -1, 76, 214, -1, 76,
- 210, -1, 76, 217, -1, 76, 219, -1, 76, 221,
- -1, 76, 223, -1, 76, 235, -1, 50, 264, 202,
- -1, 212, -1, 36, -1, 72, -1, 46, 115, 213,
- 116, 204, -1, 212, -1, 63, -1, 29, -1, 75,
- 205, -1, 43, -1, 35, -1, 47, 207, -1, 28,
- -1, 264, 70, -1, 48, 115, 213, 116, 264, 209,
- -1, 212, -1, 78, 268, 211, -1, 32, -1, 28,
- -1, 34, -1, 74, -1, 26, -1, 79, 266, 215,
- 216, -1, 38, -1, 57, -1, 82, -1, 83, -1,
- 81, -1, 80, -1, 39, 218, -1, 32, -1, 59,
- -1, 31, 115, 220, 116, 60, -1, 26, -1, 61,
- 222, -1, 73, -1, 29, -1, 226, 69, 115, 229,
- 116, -1, 226, 225, -1, -1, 69, 115, 229, 109,
- 229, 116, -1, 52, 230, 227, -1, -1, 228, -1,
- 44, -1, 85, -1, 45, -1, 26, -1, 54, 231,
- -1, 66, -1, 55, -1, 84, 266, -1, 58, 115,
- 233, 116, -1, 51, 115, 234, 116, -1, -1, 115,
- 232, 116, -1, 26, -1, 26, -1, 26, -1, 33,
- 67, -1, 240, -1, 243, -1, 238, -1, 241, -1,
- 65, 37, 115, 239, 116, -1, 244, -1, 244, 109,
- 244, -1, 65, 37, 115, 244, 116, -1, 65, 49,
- 115, 242, 116, -1, 245, -1, 245, 109, 245, -1,
- 65, 49, 115, 245, 116, -1, 26, -1, 26, -1,
- 248, -1, 250, -1, 249, -1, 250, -1, 251, -1,
- 27, -1, 26, -1, 122, 251, 123, -1, 122, 251,
- 113, 251, 123, -1, 122, 251, 113, 251, 113, 251,
- 123, -1, 122, 251, 113, 251, 113, 251, 113, 251,
- 123, -1, 252, 27, -1, 252, 26, -1, 117, -1,
- 118, -1, -1, -1, 255, 11, 254, 258, -1, 273,
- -1, -1, -1, 5, 257, 258, -1, 258, 113, 102,
- -1, 102, -1, 255, 9, 102, 121, 260, -1, 68,
- 63, -1, 68, 40, -1, 68, 261, -1, 68, 62,
- -1, 68, 77, 266, -1, 68, 33, -1, 68, 31,
- 115, 220, 116, -1, 32, 262, 263, -1, -1, 42,
- -1, 30, -1, -1, 64, -1, 71, -1, -1, 42,
- -1, 30, -1, -1, 64, -1, 71, -1, -1, 115,
- 269, 116, -1, -1, 115, 270, 116, -1, -1, 115,
- 271, 116, -1, 26, -1, 26, -1, 26, -1, 6,
- 102, 121, 103, -1, 102, -1, 103, -1
+ -1, 98, -1, 99, -1, 100, -1, 101, -1, 277,
+ -1, 20, 157, 116, 164, 116, 161, -1, 22, 184,
+ 178, -1, 23, 178, -1, 256, 155, -1, 256, 117,
+ 155, 117, -1, 164, 175, -1, 253, -1, 256, 164,
+ 176, -1, 256, 117, 164, 176, 117, -1, 165, 177,
+ 178, -1, 173, 177, 178, -1, 160, -1, 173, -1,
+ 162, 116, 162, 116, 162, 116, 162, -1, 256, 163,
+ -1, 29, -1, 277, -1, 106, -1, 187, -1, 166,
+ 118, 167, 119, -1, 201, -1, 264, -1, 106, -1,
+ 106, -1, 168, -1, 169, -1, 29, -1, 173, 174,
+ 170, -1, -1, 120, 171, -1, 121, 172, -1, 29,
+ -1, 29, -1, 106, -1, 110, -1, 110, -1, 110,
+ -1, 107, -1, 111, -1, -1, 107, -1, 108, -1,
+ 109, -1, 110, -1, -1, 122, 179, 123, -1, 122,
+ 180, 123, -1, -1, 181, 176, -1, 182, 176, -1,
+ 105, -1, 106, -1, 184, -1, 105, -1, 106, -1,
+ 186, -1, 193, -1, 257, -1, 260, -1, 263, -1,
+ 276, -1, 7, 105, 124, 187, -1, 102, 188, -1,
+ 44, 192, -1, 66, -1, 104, 190, -1, 59, -1,
+ 35, 269, -1, 43, -1, 80, 270, -1, 56, 118,
+ 191, 119, -1, 103, 118, 189, 119, -1, 29, -1,
+ -1, 118, 191, 119, -1, 29, -1, 66, -1, 35,
+ 269, -1, 43, -1, 80, 270, -1, 194, -1, 195,
+ -1, 10, 105, 197, -1, 10, 105, 118, 196, 119,
+ 198, -1, -1, 29, -1, 124, 200, -1, 124, 125,
+ 199, 126, -1, 202, -1, 199, 116, 202, -1, 204,
+ -1, 240, -1, 250, -1, 204, -1, 240, -1, 251,
+ -1, 203, -1, 241, -1, 250, -1, 204, -1, 79,
+ 228, -1, 79, 205, -1, 79, 207, -1, 79, 210,
+ -1, 79, 212, -1, 79, 218, -1, 79, 214, -1,
+ 79, 221, -1, 79, 223, -1, 79, 225, -1, 79,
+ 227, -1, 79, 239, -1, 53, 268, 206, -1, 216,
+ -1, 39, -1, 75, -1, 49, 118, 217, 119, 208,
+ -1, 216, -1, 66, -1, 32, -1, 78, 209, -1,
+ 46, -1, 38, -1, 50, 211, -1, 31, -1, 268,
+ 73, -1, 51, 118, 217, 119, 268, 213, -1, 216,
+ -1, 81, 272, 215, -1, 35, -1, 31, -1, 37,
+ -1, 77, -1, 29, -1, 82, 270, 219, 220, -1,
+ 41, -1, 60, -1, 85, -1, 86, -1, 84, -1,
+ 83, -1, 42, 222, -1, 35, -1, 62, -1, 34,
+ 118, 224, 119, 63, -1, 29, -1, 64, 226, -1,
+ 76, -1, 32, -1, 230, 72, 118, 233, 119, -1,
+ 230, 229, -1, -1, 72, 118, 233, 112, 233, 119,
+ -1, 55, 234, 231, -1, -1, 232, -1, 47, -1,
+ 88, -1, 48, -1, 29, -1, 57, 235, -1, 69,
+ -1, 58, -1, 87, 270, -1, 61, 118, 237, 119,
+ -1, 54, 118, 238, 119, -1, -1, 118, 236, 119,
+ -1, 29, -1, 29, -1, 29, -1, 36, 70, -1,
+ 244, -1, 247, -1, 242, -1, 245, -1, 68, 40,
+ 118, 243, 119, -1, 248, -1, 248, 112, 248, -1,
+ 68, 40, 118, 248, 119, -1, 68, 52, 118, 246,
+ 119, -1, 249, -1, 249, 112, 249, -1, 68, 52,
+ 118, 249, 119, -1, 29, -1, 29, -1, 252, -1,
+ 254, -1, 253, -1, 254, -1, 255, -1, 30, -1,
+ 29, -1, 125, 255, 126, -1, 125, 255, 116, 255,
+ 126, -1, 125, 255, 116, 255, 116, 255, 126, -1,
+ 125, 255, 116, 255, 116, 255, 116, 255, 126, -1,
+ 256, 30, -1, 256, 29, -1, 120, -1, 121, -1,
+ -1, -1, 259, 11, 258, 262, -1, 277, -1, -1,
+ -1, 5, 261, 262, -1, 262, 116, 105, -1, 105,
+ -1, 259, 9, 105, 124, 264, -1, 71, 66, -1,
+ 71, 43, -1, 71, 265, -1, 71, 65, -1, 71,
+ 80, 270, -1, 71, 36, -1, 71, 34, 118, 224,
+ 119, -1, 35, 266, 267, -1, -1, 45, -1, 33,
+ -1, -1, 67, -1, 74, -1, -1, 45, -1, 33,
+ -1, -1, 67, -1, 74, -1, -1, 118, 273, 119,
+ -1, -1, 118, 274, 119, -1, -1, 118, 275, 119,
+ -1, 29, -1, 29, -1, 29, -1, 6, 105, 124,
+ 106, -1, 105, -1, 106, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 269, 269, 272, 280, 292, 293, 296, 318, 319,
- 322, 337, 338, 341, 346, 351, 354, 355, 356, 357,
- 358, 359, 360, 361, 364, 365, 366, 369, 370, 373,
- 379, 385, 391, 397, 404, 410, 417, 461, 466, 476,
- 520, 526, 527, 528, 529, 530, 531, 532, 533, 534,
- 535, 536, 537, 540, 552, 569, 579, 587, 604, 611,
- 630, 641, 661, 686, 708, 711, 719, 752, 759, 774,
- 824, 866, 877, 898, 908, 914, 945, 962, 962, 964,
- 971, 983, 984, 985, 988, 1002, 1016, 1034, 1055, 1057,
- 1058, 1059, 1060, 1063, 1063, 1063, 1063, 1064, 1067, 1078,
- 1090, 1097, 1104, 1111, 1134, 1157, 1176, 1176, 1179, 1180,
- 1181, 1182, 1183, 1184, 1187, 1205, 1209, 1215, 1219, 1223,
- 1227, 1236, 1245, 1249, 1254, 1260, 1271, 1271, 1272, 1274,
- 1278, 1282, 1286, 1292, 1292, 1294, 1310, 1333, 1336, 1347,
- 1353, 1359, 1360, 1367, 1373, 1379, 1387, 1393, 1399, 1407,
- 1413, 1419, 1427, 1428, 1431, 1432, 1433, 1434, 1435, 1436,
- 1437, 1438, 1439, 1440, 1441, 1444, 1453, 1457, 1461, 1467,
- 1476, 1480, 1484, 1493, 1497, 1503, 1509, 1516, 1521, 1529,
- 1539, 1541, 1549, 1555, 1559, 1563, 1569, 1580, 1589, 1593,
- 1598, 1602, 1606, 1610, 1616, 1623, 1627, 1633, 1641, 1652,
- 1659, 1663, 1669, 1679, 1690, 1694, 1712, 1721, 1724, 1730,
- 1734, 1738, 1744, 1755, 1760, 1765, 1770, 1775, 1780, 1788,
- 1791, 1796, 1809, 1817, 1828, 1836, 1836, 1838, 1838, 1840,
- 1850, 1855, 1862, 1872, 1881, 1886, 1893, 1903, 1913, 1925,
- 1925, 1926, 1926, 1928, 1938, 1946, 1956, 1964, 1972, 1981,
- 1992, 1996, 2002, 2003, 2004, 2007, 2007, 2010, 2045, 2049,
- 2049, 2052, 2058, 2066, 2079, 2088, 2097, 2101, 2110, 2119,
- 2128, 2135, 2142, 2147, 2156, 2168, 2171, 2180, 2191, 2192,
- 2193, 2196, 2197, 2198, 2201, 2202, 2205, 2206, 2209, 2210,
- 2213, 2224, 2235, 2246, 2267, 2268
+ 0, 276, 276, 279, 287, 299, 300, 303, 325, 326,
+ 329, 344, 345, 348, 353, 358, 361, 362, 363, 364,
+ 365, 366, 367, 368, 369, 372, 373, 374, 377, 378,
+ 387, 391, 397, 403, 407, 419, 425, 431, 438, 444,
+ 451, 495, 500, 510, 554, 558, 575, 576, 577, 578,
+ 579, 580, 581, 582, 583, 584, 585, 586, 587, 627,
+ 639, 656, 666, 674, 691, 698, 717, 728, 748, 773,
+ 795, 798, 807, 840, 847, 862, 912, 954, 965, 988,
+ 998, 1004, 1035, 1052, 1052, 1054, 1061, 1071, 1072, 1073,
+ 1076, 1090, 1104, 1122, 1143, 1145, 1146, 1147, 1148, 1151,
+ 1151, 1151, 1151, 1152, 1155, 1166, 1178, 1185, 1192, 1199,
+ 1220, 1241, 1260, 1260, 1263, 1264, 1265, 1266, 1267, 1268,
+ 1271, 1289, 1293, 1299, 1303, 1307, 1311, 1320, 1329, 1333,
+ 1338, 1344, 1355, 1355, 1356, 1358, 1362, 1366, 1370, 1376,
+ 1376, 1378, 1394, 1417, 1420, 1431, 1437, 1443, 1444, 1451,
+ 1457, 1463, 1471, 1477, 1483, 1491, 1497, 1503, 1511, 1512,
+ 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524,
+ 1525, 1528, 1537, 1541, 1545, 1551, 1560, 1564, 1568, 1577,
+ 1581, 1587, 1593, 1600, 1605, 1613, 1623, 1625, 1633, 1639,
+ 1643, 1647, 1653, 1664, 1673, 1677, 1682, 1686, 1690, 1694,
+ 1700, 1707, 1711, 1717, 1725, 1736, 1743, 1747, 1753, 1763,
+ 1774, 1778, 1796, 1805, 1808, 1814, 1818, 1822, 1828, 1839,
+ 1844, 1849, 1854, 1859, 1864, 1872, 1875, 1880, 1893, 1901,
+ 1912, 1920, 1920, 1922, 1922, 1924, 1934, 1939, 1946, 1956,
+ 1965, 1970, 1977, 1987, 1997, 2009, 2009, 2010, 2010, 2012,
+ 2022, 2030, 2040, 2048, 2056, 2065, 2076, 2080, 2086, 2087,
+ 2088, 2091, 2091, 2094, 2129, 2133, 2133, 2136, 2142, 2150,
+ 2163, 2172, 2181, 2185, 2194, 2203, 2212, 2219, 2226, 2231,
+ 2240, 2252, 2255, 2264, 2275, 2276, 2277, 2280, 2281, 2282,
+ 2285, 2286, 2289, 2290, 2293, 2294, 2297, 2308, 2319, 2330,
+ 2351, 2352
};
#endif
@@ -830,27 +842,28 @@ static const char *const yytname[] =
{
"$end", "error", "$undefined", "ARBvp_10", "ARBfp_10", "ADDRESS",
"ALIAS", "ATTRIB", "OPTION", "OUTPUT", "PARAM", "TEMP", "END", "BIN_OP",
- "BINSC_OP", "SAMPLE_OP", "SCALAR_OP", "TRI_OP", "VECTOR_OP", "ARL_OP",
- "ARA_OP", "KIL", "SWZ", "TXD_OP", "BRA_OP", "FLOW_OP", "INTEGER", "REAL",
- "AMBIENT", "ATTENUATION", "BACK", "CLIP", "COLOR", "DEPTH", "DIFFUSE",
- "DIRECTION", "EMISSION", "ENV", "EYE", "FOG", "FOGCOORD", "FRAGMENT",
- "FRONT", "HALF", "INVERSE", "INVTRANS", "LIGHT", "LIGHTMODEL",
- "LIGHTPROD", "LOCAL", "MATERIAL", "MAT_PROGRAM", "MATRIX", "MATRIXINDEX",
- "MODELVIEW", "MVP", "NORMAL", "OBJECT", "PALETTE", "PARAMS", "PLANE",
- "POINT_TOK", "POINTSIZE", "POSITION", "PRIMARY", "PROGRAM", "PROJECTION",
- "RANGE", "RESULT", "ROW", "SCENECOLOR", "SECONDARY", "SHININESS",
- "SIZE_TOK", "SPECULAR", "SPOT", "STATE", "TEXCOORD", "TEXENV", "TEXGEN",
- "TEXGEN_Q", "TEXGEN_R", "TEXGEN_S", "TEXGEN_T", "TEXTURE", "TRANSPOSE",
- "TEXTURE_UNIT", "TEX_1D", "TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT",
- "TEX_SHADOW1D", "TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D",
- "TEX_ARRAY2D", "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX",
- "VTXATTRIB", "WEIGHT", "IDENTIFIER", "USED_IDENTIFIER", "MASK4", "MASK3",
- "MASK2", "MASK1", "SWIZZLE", "DOT_DOT", "DOT", "';'", "':'", "','",
- "'|'", "'['", "']'", "'+'", "'-'", "'('", "')'", "'='", "'{'", "'}'",
- "$accept", "program", "language", "optionSequence", "option",
- "statementSequence", "statement", "instruction", "ALU_instruction",
- "TexInstruction", "FlowInstruction", "ARL_instruction",
- "ARA_instruction", "VECTORop_instruction", "SCALARop_instruction",
+ "BINSC_OP", "SAMPLE_OP", "SCALAR_OP", "TRI_OP", "VECTOR_OP", "KIL",
+ "SWZ", "TXD_OP", "BRA_OP", "FLOW_OP", "ARL_OP", "ARL_NV_OP", "ARA_OP",
+ "PUSHA_OP", "POPA_OP", "INTEGER", "REAL", "AMBIENT", "ATTENUATION",
+ "BACK", "CLIP", "COLOR", "DEPTH", "DIFFUSE", "DIRECTION", "EMISSION",
+ "ENV", "EYE", "FOG", "FOGCOORD", "FRAGMENT", "FRONT", "HALF", "INVERSE",
+ "INVTRANS", "LIGHT", "LIGHTMODEL", "LIGHTPROD", "LOCAL", "MATERIAL",
+ "MAT_PROGRAM", "MATRIX", "MATRIXINDEX", "MODELVIEW", "MVP", "NORMAL",
+ "OBJECT", "PALETTE", "PARAMS", "PLANE", "POINT_TOK", "POINTSIZE",
+ "POSITION", "PRIMARY", "PROGRAM", "PROJECTION", "RANGE", "RESULT", "ROW",
+ "SCENECOLOR", "SECONDARY", "SHININESS", "SIZE_TOK", "SPECULAR", "SPOT",
+ "STATE", "TEXCOORD", "TEXENV", "TEXGEN", "TEXGEN_Q", "TEXGEN_R",
+ "TEXGEN_S", "TEXGEN_T", "TEXTURE", "TRANSPOSE", "TEXTURE_UNIT", "TEX_1D",
+ "TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT", "TEX_SHADOW1D",
+ "TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D", "TEX_ARRAY2D",
+ "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB",
+ "WEIGHT", "IDENTIFIER", "USED_IDENTIFIER", "MASK4", "MASK3", "MASK2",
+ "MASK1", "SWIZZLE", "DOT_DOT", "DOT", "';'", "':'", "','", "'|'", "'['",
+ "']'", "'+'", "'-'", "'('", "')'", "'='", "'{'", "'}'", "$accept",
+ "program", "language", "optionSequence", "option", "statementSequence",
+ "statement", "instruction", "ALU_instruction", "TexInstruction",
+ "FlowInstruction", "ARL_instruction", "ARA_instruction",
+ "ASTACK_instruction", "VECTORop_instruction", "SCALARop_instruction",
"BINSCop_instruction", "BINop_instruction", "TRIop_instruction",
"SAMPLE_instruction", "KIL_instruction", "TXD_instruction",
"texImageUnit", "texTarget", "SWZ_instruction", "BRA_instruction",
@@ -911,44 +924,45 @@ static const yytype_uint16 yytoknum[] =
335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
- 365, 59, 58, 44, 124, 91, 93, 43, 45, 40,
- 41, 61, 123, 125
+ 365, 366, 367, 368, 59, 58, 44, 124, 91, 93,
+ 43, 45, 40, 41, 61, 123, 125
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint16 yyr1[] =
{
- 0, 124, 125, 126, 126, 127, 127, 128, 129, 129,
- 130, 130, 130, 131, 131, 131, 132, 132, 132, 132,
- 132, 132, 132, 132, 133, 133, 133, 134, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143, 143, 144,
- 145, 146, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 147, 148, 149, 150, 150, 151, 151,
- 152, 152, 153, 154, 155, 156, 157, 158, 159, 159,
- 160, 160, 160, 160, 161, 161, 162, 163, 163, 164,
- 165, 166, 166, 166, 167, 168, 169, 170, 171, 172,
- 172, 172, 172, 173, 173, 173, 173, 173, 174, 174,
- 174, 175, 176, 177, 178, 179, 180, 180, 181, 181,
- 181, 181, 181, 181, 182, 183, 183, 184, 184, 184,
- 184, 184, 184, 184, 184, 185, 186, 186, 187, 188,
- 188, 188, 188, 189, 189, 190, 191, 192, 192, 193,
- 194, 195, 195, 196, 196, 196, 197, 197, 197, 198,
- 198, 198, 199, 199, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 201, 202, 202, 202, 203,
- 204, 204, 204, 204, 204, 205, 206, 207, 207, 208,
- 209, 210, 211, 212, 212, 212, 213, 214, 215, 215,
- 216, 216, 216, 216, 217, 218, 218, 219, 220, 221,
- 222, 222, 223, 224, 225, 225, 226, 227, 227, 228,
- 228, 228, 229, 230, 230, 230, 230, 230, 230, 231,
- 231, 232, 233, 234, 235, 236, 236, 237, 237, 238,
- 239, 239, 240, 241, 242, 242, 243, 244, 245, 246,
- 246, 247, 247, 248, 249, 249, 250, 250, 250, 250,
- 251, 251, 252, 252, 252, 254, 253, 255, 255, 257,
- 256, 258, 258, 259, 260, 260, 260, 260, 260, 260,
- 260, 261, 262, 262, 262, 263, 263, 263, 264, 264,
- 264, 265, 265, 265, 266, 266, 267, 267, 268, 268,
- 269, 270, 271, 272, 273, 273
+ 0, 127, 128, 129, 129, 130, 130, 131, 132, 132,
+ 133, 133, 133, 134, 134, 134, 135, 135, 135, 135,
+ 135, 135, 135, 135, 135, 136, 136, 136, 137, 137,
+ 138, 138, 139, 140, 140, 141, 142, 143, 144, 145,
+ 146, 147, 147, 148, 149, 149, 150, 150, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 151,
+ 152, 153, 154, 154, 155, 155, 156, 156, 157, 158,
+ 159, 160, 161, 162, 163, 163, 164, 164, 164, 164,
+ 165, 165, 166, 167, 167, 168, 169, 170, 170, 170,
+ 171, 172, 173, 174, 175, 176, 176, 176, 176, 177,
+ 177, 177, 177, 177, 178, 178, 178, 179, 180, 181,
+ 182, 183, 184, 184, 185, 185, 185, 185, 185, 185,
+ 186, 187, 187, 188, 188, 188, 188, 188, 188, 188,
+ 188, 189, 190, 190, 191, 192, 192, 192, 192, 193,
+ 193, 194, 195, 196, 196, 197, 198, 199, 199, 200,
+ 200, 200, 201, 201, 201, 202, 202, 202, 203, 203,
+ 204, 204, 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 205, 206, 206, 206, 207, 208, 208, 208, 208,
+ 208, 209, 210, 211, 211, 212, 213, 214, 215, 216,
+ 216, 216, 217, 218, 219, 219, 220, 220, 220, 220,
+ 221, 222, 222, 223, 224, 225, 226, 226, 227, 228,
+ 229, 229, 230, 231, 231, 232, 232, 232, 233, 234,
+ 234, 234, 234, 234, 234, 235, 235, 236, 237, 238,
+ 239, 240, 240, 241, 241, 242, 243, 243, 244, 245,
+ 246, 246, 247, 248, 249, 250, 250, 251, 251, 252,
+ 253, 253, 254, 254, 254, 254, 255, 255, 256, 256,
+ 256, 258, 257, 259, 259, 261, 260, 262, 262, 263,
+ 264, 264, 264, 264, 264, 264, 264, 265, 266, 266,
+ 266, 267, 267, 267, 268, 268, 268, 269, 269, 269,
+ 270, 270, 271, 271, 272, 272, 273, 274, 275, 276,
+ 277, 277
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -956,34 +970,35 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 4, 1, 1, 2, 0, 3, 2, 0,
2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 4,
- 4, 4, 4, 6, 6, 8, 8, 2, 2, 12,
- 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 6, 3, 2, 2, 4, 2, 1,
- 3, 5, 3, 3, 1, 1, 7, 2, 1, 1,
- 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
- 3, 0, 2, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 0, 1, 1, 1, 1, 0, 3, 3,
- 0, 2, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 4, 2, 2, 1, 2, 1,
- 2, 1, 2, 4, 4, 1, 0, 3, 1, 1,
- 2, 1, 2, 1, 1, 3, 6, 0, 1, 2,
- 4, 1, 3, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 3, 1, 1, 1, 5,
- 1, 1, 1, 2, 1, 1, 2, 1, 2, 6,
- 1, 3, 1, 1, 1, 1, 1, 4, 1, 1,
- 1, 1, 1, 1, 2, 1, 1, 5, 1, 2,
- 1, 1, 5, 2, 0, 6, 3, 0, 1, 1,
- 1, 1, 1, 2, 1, 1, 2, 4, 4, 0,
- 3, 1, 1, 1, 2, 1, 1, 1, 1, 5,
- 1, 3, 5, 5, 1, 3, 5, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 3, 5, 7, 9,
- 2, 2, 1, 1, 0, 0, 4, 1, 0, 0,
- 3, 3, 1, 5, 2, 2, 2, 2, 3, 2,
- 5, 3, 0, 1, 1, 0, 1, 1, 0, 1,
- 1, 0, 1, 1, 0, 3, 0, 3, 0, 3,
- 1, 1, 1, 4, 1, 1
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 4, 4, 4, 2, 2, 4, 4, 6, 6, 8,
+ 8, 2, 2, 12, 2, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 6,
+ 3, 2, 2, 4, 2, 1, 3, 5, 3, 3,
+ 1, 1, 7, 2, 1, 1, 1, 1, 4, 1,
+ 1, 1, 1, 1, 1, 1, 3, 0, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
+ 1, 1, 1, 0, 3, 3, 0, 2, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 4, 2, 2, 1, 2, 1, 2, 1, 2, 4,
+ 4, 1, 0, 3, 1, 1, 2, 1, 2, 1,
+ 1, 3, 6, 0, 1, 2, 4, 1, 3, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 3, 1, 1, 1, 5, 1, 1, 1, 2,
+ 1, 1, 2, 1, 2, 6, 1, 3, 1, 1,
+ 1, 1, 1, 4, 1, 1, 1, 1, 1, 1,
+ 2, 1, 1, 5, 1, 2, 1, 1, 5, 2,
+ 0, 6, 3, 0, 1, 1, 1, 1, 1, 2,
+ 1, 1, 2, 4, 4, 0, 3, 1, 1, 1,
+ 2, 1, 1, 1, 1, 5, 1, 3, 5, 5,
+ 1, 3, 5, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 3, 5, 7, 9, 2, 2, 1, 1,
+ 0, 0, 4, 1, 0, 0, 3, 3, 1, 5,
+ 2, 2, 2, 2, 3, 2, 5, 3, 0, 1,
+ 1, 0, 1, 1, 0, 1, 1, 0, 1, 1,
+ 0, 3, 0, 3, 0, 3, 1, 1, 1, 4,
+ 1, 1
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -991,313 +1006,330 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint16 yydefact[] =
{
- 0, 3, 4, 0, 6, 1, 9, 0, 5, 258,
- 294, 295, 0, 259, 0, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 0, 0, 254, 0, 0, 0,
- 100, 294, 295, 8, 0, 13, 14, 15, 17, 16,
- 18, 19, 20, 21, 22, 24, 25, 26, 23, 27,
- 28, 0, 105, 0, 108, 109, 133, 134, 110, 0,
- 111, 112, 113, 257, 7, 0, 0, 0, 0, 0,
- 75, 0, 97, 74, 0, 0, 0, 0, 0, 86,
- 0, 97, 0, 103, 252, 253, 37, 38, 92, 0,
- 0, 0, 106, 107, 100, 0, 55, 10, 12, 11,
- 0, 255, 262, 260, 0, 0, 137, 254, 135, 0,
- 272, 269, 265, 267, 264, 284, 266, 254, 93, 94,
- 95, 96, 100, 254, 254, 254, 254, 254, 254, 100,
- 0, 90, 89, 91, 101, 245, 244, 0, 0, 0,
- 0, 70, 0, 254, 92, 0, 71, 73, 146, 147,
- 225, 226, 148, 241, 242, 0, 254, 54, 104, 0,
- 0, 92, 0, 0, 0, 293, 114, 138, 0, 139,
- 143, 144, 145, 239, 240, 243, 0, 0, 274, 273,
- 275, 0, 268, 0, 62, 0, 0, 0, 32, 0,
- 31, 29, 63, 30, 64, 65, 281, 131, 129, 284,
- 116, 0, 0, 0, 0, 0, 0, 278, 0, 278,
- 0, 0, 288, 284, 154, 155, 156, 157, 159, 158,
- 160, 161, 162, 163, 0, 164, 281, 121, 0, 119,
- 117, 284, 0, 126, 115, 92, 0, 60, 0, 0,
- 0, 98, 99, 102, 0, 256, 261, 0, 251, 250,
- 198, 0, 276, 277, 271, 290, 0, 254, 254, 0,
- 56, 0, 59, 0, 254, 282, 283, 130, 132, 0,
- 0, 0, 224, 195, 196, 194, 0, 177, 280, 279,
- 176, 0, 0, 0, 0, 219, 215, 0, 214, 284,
- 207, 201, 200, 199, 0, 0, 0, 0, 120, 0,
- 122, 0, 0, 118, 0, 254, 246, 79, 0, 77,
- 78, 0, 254, 254, 263, 0, 136, 270, 285, 34,
- 33, 0, 88, 58, 286, 0, 0, 237, 0, 238,
- 0, 0, 186, 0, 178, 0, 183, 184, 167, 168,
- 185, 165, 166, 0, 0, 213, 0, 216, 209, 211,
- 210, 206, 208, 292, 0, 182, 181, 188, 189, 0,
- 0, 128, 0, 125, 0, 0, 61, 0, 72, 87,
- 81, 53, 0, 0, 0, 254, 57, 0, 40, 0,
- 254, 232, 236, 0, 0, 278, 223, 0, 221, 0,
- 222, 0, 289, 193, 192, 190, 191, 187, 212, 0,
- 123, 124, 127, 254, 247, 0, 0, 80, 254, 68,
- 67, 69, 254, 0, 0, 0, 141, 149, 152, 150,
- 227, 228, 151, 291, 0, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 36, 35, 197,
- 172, 174, 171, 0, 169, 170, 0, 218, 220, 217,
- 202, 0, 84, 82, 85, 83, 0, 0, 0, 0,
- 153, 204, 254, 140, 287, 175, 173, 179, 180, 254,
- 248, 254, 0, 0, 0, 0, 203, 142, 0, 0,
- 0, 0, 230, 0, 234, 0, 249, 254, 0, 229,
- 0, 233, 0, 0, 66, 39, 231, 235, 0, 0,
- 205
+ 0, 3, 4, 0, 6, 1, 9, 0, 5, 264,
+ 300, 301, 0, 265, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 260, 0, 0, 0, 106, 0,
+ 0, 0, 0, 0, 300, 301, 8, 0, 13, 14,
+ 15, 17, 16, 18, 19, 20, 21, 22, 23, 25,
+ 26, 27, 24, 28, 29, 0, 111, 0, 114, 115,
+ 139, 140, 116, 0, 117, 118, 119, 263, 7, 0,
+ 0, 0, 0, 0, 81, 0, 103, 80, 0, 0,
+ 0, 0, 0, 109, 258, 259, 41, 42, 98, 0,
+ 0, 0, 112, 113, 106, 0, 61, 92, 0, 103,
+ 0, 0, 33, 70, 71, 34, 10, 12, 11, 0,
+ 261, 268, 266, 0, 0, 143, 260, 141, 0, 278,
+ 275, 271, 273, 270, 290, 272, 260, 99, 100, 101,
+ 102, 106, 260, 260, 260, 260, 260, 96, 95, 97,
+ 107, 251, 250, 0, 0, 0, 0, 76, 0, 260,
+ 98, 0, 77, 79, 152, 153, 231, 232, 154, 247,
+ 248, 0, 260, 60, 110, 0, 0, 98, 260, 106,
+ 260, 0, 0, 0, 0, 299, 120, 144, 0, 145,
+ 149, 150, 151, 245, 246, 249, 0, 0, 280, 279,
+ 281, 0, 274, 0, 68, 0, 0, 0, 36, 0,
+ 35, 287, 137, 135, 290, 122, 0, 0, 0, 0,
+ 0, 0, 284, 0, 284, 0, 0, 294, 290, 160,
+ 161, 162, 163, 165, 164, 166, 167, 168, 169, 0,
+ 170, 287, 127, 0, 125, 123, 290, 0, 132, 121,
+ 98, 0, 66, 0, 0, 0, 104, 105, 108, 30,
+ 69, 31, 32, 0, 262, 267, 0, 257, 256, 204,
+ 0, 282, 283, 277, 296, 0, 260, 260, 0, 62,
+ 0, 65, 0, 260, 288, 289, 136, 138, 0, 0,
+ 0, 230, 201, 202, 200, 0, 183, 286, 285, 182,
+ 0, 0, 0, 0, 225, 221, 0, 220, 290, 213,
+ 207, 206, 205, 0, 0, 0, 0, 126, 0, 128,
+ 0, 0, 124, 0, 260, 252, 85, 0, 83, 84,
+ 0, 260, 260, 269, 0, 142, 276, 291, 38, 37,
+ 0, 94, 64, 292, 0, 292, 0, 243, 0, 244,
+ 0, 0, 192, 0, 184, 0, 189, 190, 173, 174,
+ 191, 171, 172, 0, 0, 219, 0, 222, 215, 217,
+ 216, 212, 214, 298, 0, 188, 187, 194, 195, 0,
+ 0, 134, 0, 131, 0, 0, 67, 0, 78, 93,
+ 87, 59, 0, 0, 0, 260, 63, 0, 44, 0,
+ 45, 260, 238, 242, 0, 0, 284, 229, 0, 227,
+ 0, 228, 0, 295, 199, 198, 196, 197, 193, 218,
+ 0, 129, 130, 133, 260, 253, 0, 0, 86, 260,
+ 74, 73, 75, 260, 0, 0, 0, 147, 155, 158,
+ 156, 233, 234, 157, 297, 0, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 40, 58,
+ 39, 203, 178, 180, 177, 0, 175, 176, 0, 224,
+ 226, 223, 208, 0, 90, 88, 91, 89, 0, 0,
+ 0, 0, 159, 210, 260, 146, 293, 181, 179, 185,
+ 186, 260, 254, 260, 0, 0, 0, 0, 209, 148,
+ 0, 0, 0, 0, 236, 0, 240, 0, 255, 260,
+ 0, 235, 0, 239, 0, 0, 72, 43, 237, 241,
+ 0, 0, 211
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 3, 4, 6, 8, 9, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 325, 437, 48, 49, 50, 185, 260, 86, 71,
- 80, 193, 194, 371, 372, 410, 261, 72, 145, 308,
- 309, 310, 407, 453, 455, 81, 370, 323, 134, 122,
- 96, 87, 160, 88, 161, 51, 52, 53, 54, 146,
- 234, 364, 303, 362, 200, 55, 56, 57, 168, 108,
- 316, 415, 169, 147, 416, 417, 148, 214, 341, 215,
- 444, 466, 216, 280, 217, 467, 218, 356, 342, 333,
- 219, 359, 397, 220, 275, 221, 251, 222, 293, 223,
- 460, 476, 224, 351, 352, 399, 290, 345, 389, 391,
- 387, 225, 149, 419, 420, 481, 150, 421, 483, 151,
- 328, 330, 422, 152, 173, 153, 154, 175, 89, 58,
- 163, 59, 60, 65, 103, 61, 73, 116, 180, 254,
- 281, 267, 182, 378, 295, 256, 424, 354, 62, 12
+ -1, 3, 4, 6, 8, 9, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 334, 448, 52, 53, 54, 195, 269, 86,
+ 75, 98, 102, 103, 381, 382, 421, 270, 76, 151,
+ 317, 318, 319, 418, 465, 467, 99, 380, 332, 140,
+ 131, 96, 87, 166, 88, 167, 55, 56, 57, 58,
+ 152, 239, 374, 312, 372, 205, 59, 60, 61, 178,
+ 117, 325, 426, 179, 153, 427, 428, 154, 219, 351,
+ 220, 456, 478, 221, 289, 222, 479, 223, 366, 352,
+ 343, 224, 369, 408, 225, 284, 226, 260, 227, 302,
+ 228, 472, 488, 229, 361, 362, 410, 299, 355, 400,
+ 402, 398, 230, 155, 430, 431, 493, 156, 432, 495,
+ 157, 338, 340, 433, 158, 183, 159, 160, 185, 89,
+ 62, 173, 63, 64, 69, 112, 65, 77, 125, 190,
+ 263, 290, 276, 192, 388, 304, 265, 435, 364, 66,
+ 335
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -409
+#define YYPACT_NINF -468
static const yytype_int16 yypact[] =
{
- 237, -409, -409, 14, -409, -409, 20, 153, -409, 25,
- -409, -409, -12, -409, 22, 56, 105, -409, -2, -2,
- -2, -2, -2, -2, 13, 13, 85, -2, -2, 156,
- 3, 103, 109, -409, 84, -409, -409, -409, -409, -409,
- -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,
- -409, 160, -409, 102, -409, -409, -409, -409, -409, 164,
- -409, -409, -409, -409, -409, 163, 152, 159, -92, 137,
- -409, 144, 143, -409, 166, 168, 169, 170, 172, -409,
- 173, 143, 174, -409, -409, -409, -409, -409, 138, -14,
- 175, 176, -409, -409, 3, 158, -409, -409, -409, -409,
- 167, -409, -409, 177, 181, -22, 250, -5, -409, 162,
- 50, -409, -409, -409, -409, 178, -409, 149, -409, -409,
- -409, -409, 3, 149, 149, 149, 149, 149, 149, 3,
- 13, -409, -409, -409, -409, -409, -409, 43, 77, 113,
- 79, 179, 31, 149, 138, 180, -409, -409, -409, -409,
- -409, -409, -409, -409, -409, 31, 149, -409, -409, 182,
- 183, 138, 184, 163, 189, -409, -409, -409, 188, -409,
- -409, -409, -409, -409, -409, -409, 236, 266, -409, -409,
- 93, 271, -409, 185, -409, 186, 26, 187, -409, 193,
- -409, -409, -409, -409, -409, -409, 145, -409, -409, 178,
- -409, 192, 194, 196, 241, 27, 197, 155, 198, 91,
- 135, 5, 199, 178, -409, -409, -409, -409, -409, -409,
- -409, -409, -409, -409, 246, -409, 145, -409, 201, -409,
- -409, 178, 202, 203, -409, 138, 65, -409, -6, 206,
- 207, -409, -409, -409, 253, 177, -409, 204, -409, -409,
- -409, 208, -409, -409, -409, -409, 210, 149, 149, 31,
- -409, 215, 220, 242, 149, -409, -409, -409, -409, 297,
- 303, 266, -409, -409, -409, -409, 305, -409, -409, -409,
- -409, 262, 305, 148, 218, 219, -409, 221, -409, 178,
- 127, -409, -409, -409, 309, 306, 41, 222, -409, 313,
- -409, 314, 313, -409, 227, 149, -409, -409, 226, -409,
- -409, 238, 149, 149, -409, 224, -409, -409, -409, -409,
- -409, 229, -409, -409, 232, 231, 235, -409, 233, -409,
- 234, 240, -409, 243, -409, 244, -409, -409, -409, -409,
- -409, -409, -409, 325, 326, -409, 327, -409, -409, -409,
- -409, -409, -409, -409, 245, -409, -409, -409, -409, 171,
- 328, -409, 247, -409, 251, 252, -409, 81, -409, -409,
- 157, -409, 256, -9, 257, 19, -409, 340, -409, 136,
- 149, -409, -409, 311, 75, 91, -409, 258, -409, 259,
- -409, 260, -409, -409, -409, -409, -409, -409, -409, 261,
- -409, -409, -409, 149, -409, 346, 347, -409, 149, -409,
- -409, -409, 149, 94, 113, 83, -409, -409, -409, -409,
- -409, -409, -409, -409, 263, -409, -409, -409, -409, -409,
- -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,
- -409, -409, -409, 343, -409, -409, 36, -409, -409, -409,
- -409, 95, -409, -409, -409, -409, 268, 269, 270, 272,
- -409, 315, 19, -409, -409, -409, -409, -409, -409, 149,
- -409, 149, 242, 297, 303, 273, -409, -409, 267, 276,
- 278, 277, 274, 279, 283, 328, -409, 149, 136, -409,
- 297, -409, 303, 101, -409, -409, -409, -409, 328, 280,
- -409
+ 144, -468, -468, 32, -468, -468, 28, 125, -468, 51,
+ -468, -468, -74, -468, 7, 16, 80, -468, -51, -51,
+ -51, -51, -51, -51, 13, -51, -51, 132, 117, 94,
+ 94, 94, 94, 94, 87, 90, -468, 133, -468, -468,
+ -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,
+ -468, -468, -468, -468, -468, 150, -468, 172, -468, -468,
+ -468, -468, -468, 97, -468, -468, -468, -468, -468, 182,
+ 165, 166, -14, 138, -468, 175, 126, -468, 176, 177,
+ 178, 179, 180, -468, -468, -468, -468, -468, 118, 18,
+ 181, 184, -468, -468, 117, 158, -468, -468, 185, 126,
+ 186, 187, -468, -468, -468, -468, -468, -468, -468, 183,
+ -468, -468, 189, 192, -9, 277, 59, -468, 190, 4,
+ -468, -468, -468, -468, 193, -468, 162, -468, -468, -468,
+ -468, 117, 162, 162, 162, 162, 162, -468, -468, -468,
+ -468, -468, -468, 147, 109, 159, 66, 195, 61, 162,
+ 118, 196, -468, -468, -468, -468, -468, -468, -468, -468,
+ -468, 61, 162, -468, -468, 194, 197, 118, 162, 117,
+ 162, 94, 198, 182, 202, -468, -468, -468, 199, -468,
+ -468, -468, -468, -468, -468, -468, 239, 280, -468, -468,
+ 120, 281, -468, 200, -468, 203, 58, 205, -468, 207,
+ -468, 148, -468, -468, 193, -468, 206, 208, 209, 245,
+ -2, 210, 83, 211, 78, 163, 6, 212, 193, -468,
+ -468, -468, -468, -468, -468, -468, -468, -468, -468, 253,
+ -468, 148, -468, 213, -468, -468, 193, 214, 215, -468,
+ 118, -87, -468, -17, 218, 219, -468, -468, -468, -468,
+ -468, -468, -468, 265, 189, -468, 216, -468, -468, -468,
+ 220, -468, -468, -468, -468, 222, 162, 162, 61, -468,
+ 227, 232, 53, 162, -468, -468, -468, -468, 314, 315,
+ 280, -468, -468, -468, -468, 316, -468, -468, -468, -468,
+ 273, 316, 76, 229, 230, -468, 231, -468, 193, -34,
+ -468, -468, -468, 321, 317, -10, 233, -468, 324, -468,
+ 325, 324, -468, 238, 162, -468, -468, 237, -468, -468,
+ 247, 162, 162, -468, 235, -468, -468, -468, -468, -468,
+ 241, -468, -468, 246, 249, 246, 251, -468, 244, -468,
+ 250, 252, -468, 254, -468, 255, -468, -468, -468, -468,
+ -468, -468, -468, 341, 343, -468, 346, -468, -468, -468,
+ -468, -468, -468, -468, 258, -468, -468, -468, -468, 191,
+ 349, -468, 260, -468, 261, 262, -468, 52, -468, -468,
+ 164, -468, 267, -11, 269, 71, -468, 357, -468, 161,
+ -468, 162, -468, -468, 326, 99, 78, -468, 268, -468,
+ 271, -468, 272, -468, -468, -468, -468, -468, -468, -468,
+ 274, -468, -468, -468, 162, -468, 359, 363, -468, 162,
+ -468, -468, -468, 162, 114, 159, 72, -468, -468, -468,
+ -468, -468, -468, -468, -468, 275, -468, -468, -468, -468,
+ -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,
+ -468, -468, -468, -468, -468, 358, -468, -468, 15, -468,
+ -468, -468, -468, 81, -468, -468, -468, -468, 279, 282,
+ 283, 284, -468, 327, 71, -468, -468, -468, -468, -468,
+ -468, 162, -468, 162, 53, 314, 315, 285, -468, -468,
+ 278, 289, 290, 288, 296, 291, 297, 349, -468, 162,
+ 161, -468, 314, -468, 315, 107, -468, -468, -468, -468,
+ 349, 292, -468
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,
- -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,
- -409, -86, -94, -409, -409, -409, -119, 139, -102, 216,
- 372, -409, -409, -409, -397, -409, -79, -409, -409, -409,
- -409, -409, -409, -409, -409, -123, -409, -409, -88, 318,
- -61, 307, -409, -409, -409, -409, 371, -409, -409, 296,
- -409, -409, -409, 104, -409, -409, -409, -409, -409, -409,
- -409, -409, -409, -409, -59, -409, -105, -409, -409, -409,
- -409, -409, -409, -409, -409, -409, -409, -409, -358, 122,
- -409, -409, -409, -409, -409, -409, 134, -409, -409, -409,
- -409, -409, -7, -409, -409, -331, -409, -409, -409, -409,
- -409, -409, 301, -409, -409, -409, -409, -409, -409, -409,
- -408, -369, 302, -409, -409, -178, -104, -139, -107, -409,
- -409, -409, -409, -409, 248, -409, 190, -409, -409, -409,
- -204, 191, -144, -409, -409, -409, -409, -409, -409, -8
+ -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,
+ -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,
+ -468, -468, -84, -103, -468, -468, -468, -126, 145, -111,
+ 223, 248, 243, -468, -468, -403, -468, -63, -468, -468,
+ -468, -468, -468, -468, -468, -468, -27, -468, -468, -140,
+ 313, -50, 320, -468, -468, -468, -468, 389, -468, -468,
+ 303, -468, -468, -468, 108, -468, -468, -468, -468, -468,
+ -468, -468, -468, -468, -468, -56, -468, -113, -468, -468,
+ -468, -468, -468, -468, -468, -468, -468, -468, -468, -374,
+ 129, -468, -468, -468, -468, -468, -468, 141, -468, -468,
+ -468, -468, -468, -3, -468, -468, -467, -468, -468, -468,
+ -468, -468, -468, 307, -468, -468, -468, -468, -468, -468,
+ -468, -457, -387, 308, -468, -468, -185, -112, -143, -115,
+ -468, -468, -468, -468, -468, 256, -468, 173, -468, -468,
+ -468, -207, 201, -195, 92, -468, -468, -468, -468, -468,
+ -7
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -242
+#define YYTABLE_NINF -248
static const yytype_int16 yytable[] =
{
- 176, 63, 170, 174, 236, 283, 188, 195, 262, 191,
- 144, 456, 135, 136, 5, 183, 186, 409, 186, 137,
- 307, 186, 187, 106, 189, 190, 445, 137, 7, 107,
- 13, 14, 15, 157, 291, 16, 176, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 138, 135, 136, 240, 268, 237, 135, 136, 273,
- 138, 184, 139, 235, 336, 482, 69, 137, 192, 296,
- 337, 139, 137, 243, 479, 196, 239, 140, 292, 357,
- 178, 262, 496, 197, 413, 140, 274, 300, 468, 141,
- 494, 138, 179, 10, 11, 414, 138, 79, 358, 64,
- 142, 70, 139, 336, 440, 484, 198, 139, 143, 337,
- 340, 226, 84, 85, 201, 311, 79, 143, 441, 227,
- 199, 278, 95, 497, 66, 140, 202, 31, 32, 141,
- 140, 458, 228, 279, 141, 229, 84, 85, 442, 320,
- 259, 143, 230, 459, 203, 347, 204, 304, 143, 340,
- 443, 186, 205, 143, 493, 319, 231, 252, 67, 206,
- 207, 208, 326, 209, 253, 210, 367, 499, 109, 110,
- 111, 348, 349, 100, 211, 101, 336, 112, 305, 232,
- 233, 446, 337, 277, 338, 278, 284, 83, 306, 285,
- 286, 212, 213, 287, 403, 97, 462, 279, 176, 113,
- 114, 288, 84, 85, 404, 373, 463, 68, 469, 265,
- 498, 374, 350, 99, 115, -106, 266, 450, 470, 289,
- 339, -107, 340, 425, 426, 427, 428, 429, 430, 431,
- 432, 433, 434, 435, 436, 74, 75, 76, 77, 78,
- 1, 2, 131, 90, 91, 132, 133, 118, 119, 120,
- 121, 393, 394, 395, 396, 10, 11, 117, 92, 93,
- 83, 158, 248, 249, 451, 102, 84, 85, 176, 162,
- 418, 174, 98, 104, 405, 406, 167, 177, 438, 123,
- 105, 124, 125, 126, 165, 127, 128, 130, 155, 156,
- 164, 246, 250, 181, -76, 238, 176, 255, 257, 258,
- 263, 373, 241, 242, 247, 244, 264, 269, 272, 270,
- 457, 271, 276, 282, 294, 297, 299, 301, 302, 312,
- 313, 69, 322, 327, 317, 315, 318, -241, 324, 329,
- 478, 332, 334, 343, 344, 353, 346, 360, 355, 361,
- 363, 366, 368, 376, 379, 369, 375, 377, 380, 381,
- 382, 386, 388, 390, 398, 176, 383, 418, 174, 384,
- 385, 392, 176, 400, 373, 411, 423, 401, 402, 408,
- 412, 439, 452, 454, 447, 448, 449, 450, 465, 464,
- 373, 471, 472, 490, 475, 473, 480, 474, 485, 487,
- 486, 488, 492, 489, 495, 491, 500, 82, 321, 129,
- 94, 166, 159, 477, 335, 331, 365, 461, 171, 172,
- 0, 245, 0, 0, 0, 0, 0, 298, 0, 0,
+ 12, 186, 67, 180, 184, 104, 241, 292, 198, 277,
+ 242, 271, 316, 358, 359, 193, 468, 196, 420, 196,
+ 73, 457, 197, 305, 199, 200, 150, 248, 494, 314,
+ 505, 367, 5, 282, 186, 143, 7, 188, 300, 315,
+ 68, 309, 249, 511, 163, 508, 346, 141, 142, 189,
+ 368, 245, 347, 196, 360, 74, 13, 14, 15, 251,
+ 283, 16, 143, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 491, 194, 301, 271, 480, 240, 144, 141, 142, 97,
+ 141, 142, 350, 146, 10, 11, 506, 145, 244, 496,
+ 313, 231, 143, 357, 115, 143, 109, 346, 110, 232,
+ 116, 287, 70, 347, 286, 348, 287, 509, 83, 250,
+ 146, 71, 233, 288, 147, 234, 144, 144, 288, 144,
+ 346, 452, 235, 84, 85, 148, 347, 145, 145, 424,
+ 145, 329, 333, 149, 104, 453, 236, 1, 2, 206,
+ 425, 349, 196, 350, 470, 328, 34, 35, 10, 11,
+ 146, 207, 336, 146, 147, 454, 471, 147, 414, 237,
+ 238, 377, 118, 119, 120, 268, 350, 455, 415, 84,
+ 85, 121, 201, 149, 149, 72, 149, 261, 474, 458,
+ 202, 84, 85, 208, 262, 209, 149, 481, 475, 186,
+ 97, 210, -112, 122, 123, -113, 383, 482, 211, 212,
+ 213, 384, 214, 203, 215, 274, 320, 293, 124, 510,
+ 294, 295, 275, 216, 296, 137, 462, 204, 138, 139,
+ 10, 11, 297, 127, 128, 129, 130, 92, 93, 95,
+ 217, 218, 78, 79, 80, 81, 82, 106, 90, 91,
+ 298, 436, 437, 438, 439, 440, 441, 442, 443, 444,
+ 445, 446, 447, 83, 164, 107, 10, 11, 257, 258,
+ 186, 463, 429, 184, 404, 405, 406, 407, 100, 101,
+ 450, 105, 84, 85, 416, 417, 108, 111, 172, 113,
+ 114, 126, 132, 133, 134, 135, 136, 161, 175, 186,
+ 162, 168, 170, 171, 383, 174, 177, 255, 187, 259,
+ 264, 191, 469, -82, 243, 281, 266, 246, 256, 267,
+ 247, 272, 253, 273, 278, 306, 279, 280, 285, 291,
+ 303, 308, 310, 311, 321, 322, 73, 331, 490, 326,
+ 324, 327, -247, 337, 339, 342, 344, 353, 354, 356,
+ 363, 370, 365, 371, 373, 376, 378, 379, 386, 186,
+ 385, 429, 184, 392, 387, 389, 186, 391, 383, 393,
+ 397, 394, 399, 395, 396, 401, 422, 403, 409, 411,
+ 412, 413, 449, 419, 383, 423, 434, 459, 464, 451,
+ 460, 461, 466, 462, 476, 483, 477, 507, 484, 487,
+ 492, 485, 486, 497, 498, 499, 500, 501, 502, 504,
+ 503, 512, 169, 330, 252, 165, 94, 176, 489, 375,
+ 345, 341, 473, 181, 182, 0, 323, 390, 0, 254,
+ 0, 0, 307, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 314
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 449
};
static const yytype_int16 yycheck[] =
{
- 107, 9, 107, 107, 143, 209, 125, 130, 186, 128,
- 89, 408, 26, 27, 0, 117, 123, 26, 125, 41,
- 26, 128, 124, 115, 126, 127, 384, 41, 8, 121,
- 5, 6, 7, 94, 29, 10, 143, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 65, 26, 27, 156, 199, 144, 26, 27, 32,
- 65, 122, 76, 142, 28, 473, 68, 41, 129, 213,
- 34, 76, 41, 161, 471, 32, 155, 99, 73, 38,
- 30, 259, 490, 40, 65, 99, 59, 231, 446, 103,
- 487, 65, 42, 102, 103, 76, 65, 103, 57, 111,
- 114, 103, 76, 28, 29, 474, 63, 76, 122, 34,
- 74, 32, 117, 118, 37, 238, 103, 122, 43, 40,
- 77, 30, 119, 492, 102, 99, 49, 102, 103, 103,
- 99, 37, 53, 42, 103, 56, 117, 118, 63, 258,
- 114, 122, 63, 49, 31, 289, 33, 235, 122, 74,
- 75, 258, 39, 122, 485, 257, 77, 64, 102, 46,
- 47, 48, 264, 50, 71, 52, 305, 498, 31, 32,
- 33, 44, 45, 9, 61, 11, 28, 40, 113, 100,
- 101, 385, 34, 28, 36, 30, 51, 102, 123, 54,
- 55, 78, 79, 58, 113, 111, 113, 42, 305, 62,
- 63, 66, 117, 118, 123, 312, 123, 102, 113, 64,
- 109, 313, 85, 111, 77, 112, 71, 116, 123, 84,
- 72, 112, 74, 87, 88, 89, 90, 91, 92, 93,
- 94, 95, 96, 97, 98, 19, 20, 21, 22, 23,
- 3, 4, 104, 27, 28, 107, 108, 104, 105, 106,
- 107, 80, 81, 82, 83, 102, 103, 113, 102, 103,
- 102, 103, 26, 27, 403, 102, 117, 118, 375, 102,
- 375, 375, 112, 121, 117, 118, 26, 115, 380, 113,
- 121, 113, 113, 113, 103, 113, 113, 113, 113, 113,
- 113, 102, 26, 115, 115, 115, 403, 26, 113, 113,
- 113, 408, 120, 120, 116, 121, 113, 115, 67, 115,
- 412, 115, 115, 115, 115, 69, 115, 115, 115, 113,
- 113, 68, 107, 26, 116, 121, 116, 107, 86, 26,
- 469, 26, 70, 115, 115, 26, 115, 115, 32, 26,
- 26, 114, 116, 114, 113, 107, 122, 115, 113, 116,
- 116, 26, 26, 26, 26, 462, 116, 462, 462, 116,
- 116, 116, 469, 116, 471, 373, 26, 116, 116, 113,
- 113, 60, 26, 26, 116, 116, 116, 116, 35, 116,
- 487, 113, 113, 109, 69, 115, 472, 115, 115, 113,
- 123, 113, 109, 116, 488, 116, 116, 25, 259, 81,
- 29, 105, 95, 462, 282, 271, 302, 414, 107, 107,
- -1, 163, -1, -1, -1, -1, -1, 226, -1, -1,
+ 7, 116, 9, 116, 116, 32, 149, 214, 134, 204,
+ 150, 196, 29, 47, 48, 126, 419, 132, 29, 134,
+ 71, 395, 133, 218, 135, 136, 89, 167, 485, 116,
+ 497, 41, 0, 35, 149, 44, 8, 33, 32, 126,
+ 114, 236, 168, 510, 94, 502, 31, 29, 30, 45,
+ 60, 162, 37, 168, 88, 106, 5, 6, 7, 170,
+ 62, 10, 44, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 483, 131, 76, 268, 458, 148, 68, 29, 30, 106,
+ 29, 30, 77, 102, 105, 106, 499, 79, 161, 486,
+ 240, 35, 44, 298, 118, 44, 9, 31, 11, 43,
+ 124, 33, 105, 37, 31, 39, 33, 504, 105, 169,
+ 102, 105, 56, 45, 106, 59, 68, 68, 45, 68,
+ 31, 32, 66, 120, 121, 117, 37, 79, 79, 68,
+ 79, 267, 89, 125, 171, 46, 80, 3, 4, 40,
+ 79, 75, 267, 77, 40, 266, 105, 106, 105, 106,
+ 102, 52, 273, 102, 106, 66, 52, 106, 116, 103,
+ 104, 314, 34, 35, 36, 117, 77, 78, 126, 120,
+ 121, 43, 35, 125, 125, 105, 125, 67, 116, 396,
+ 43, 120, 121, 34, 74, 36, 125, 116, 126, 314,
+ 106, 42, 115, 65, 66, 115, 321, 126, 49, 50,
+ 51, 322, 53, 66, 55, 67, 243, 54, 80, 112,
+ 57, 58, 74, 64, 61, 107, 119, 80, 110, 111,
+ 105, 106, 69, 107, 108, 109, 110, 105, 106, 122,
+ 81, 82, 19, 20, 21, 22, 23, 114, 25, 26,
+ 87, 90, 91, 92, 93, 94, 95, 96, 97, 98,
+ 99, 100, 101, 105, 106, 115, 105, 106, 29, 30,
+ 385, 414, 385, 385, 83, 84, 85, 86, 30, 31,
+ 391, 33, 120, 121, 120, 121, 114, 105, 105, 124,
+ 124, 116, 116, 116, 116, 116, 116, 116, 106, 414,
+ 116, 116, 116, 116, 419, 116, 29, 105, 118, 29,
+ 29, 118, 423, 118, 118, 70, 116, 123, 119, 116,
+ 123, 116, 124, 116, 118, 72, 118, 118, 118, 118,
+ 118, 118, 118, 118, 116, 116, 71, 110, 481, 119,
+ 124, 119, 110, 29, 29, 29, 73, 118, 118, 118,
+ 29, 118, 35, 29, 29, 117, 119, 110, 117, 474,
+ 125, 474, 474, 119, 118, 116, 481, 116, 483, 119,
+ 29, 119, 29, 119, 119, 29, 383, 119, 29, 119,
+ 119, 119, 389, 116, 499, 116, 29, 119, 29, 63,
+ 119, 119, 29, 119, 119, 116, 38, 500, 116, 72,
+ 484, 118, 118, 118, 126, 116, 116, 119, 112, 112,
+ 119, 119, 99, 268, 171, 95, 27, 114, 474, 311,
+ 291, 280, 425, 116, 116, -1, 253, 335, -1, 173,
+ -1, -1, 231, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 244
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 500
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint16 yystos[] =
{
- 0, 3, 4, 125, 126, 0, 127, 8, 128, 129,
- 102, 103, 273, 5, 6, 7, 10, 12, 13, 14,
+ 0, 3, 4, 128, 129, 0, 130, 8, 131, 132,
+ 105, 106, 277, 5, 6, 7, 10, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 102, 103, 130, 131, 132, 133, 134, 135, 136,
- 137, 138, 139, 140, 141, 142, 143, 144, 147, 148,
- 149, 179, 180, 181, 182, 189, 190, 191, 253, 255,
- 256, 259, 272, 273, 111, 257, 102, 102, 102, 68,
- 103, 153, 161, 260, 153, 153, 153, 153, 153, 103,
- 154, 169, 154, 102, 117, 118, 152, 175, 177, 252,
- 153, 153, 102, 103, 180, 119, 174, 111, 112, 111,
- 9, 11, 102, 258, 121, 121, 115, 121, 193, 31,
- 32, 33, 40, 62, 63, 77, 261, 113, 104, 105,
- 106, 107, 173, 113, 113, 113, 113, 113, 113, 173,
- 113, 104, 107, 108, 172, 26, 27, 41, 65, 76,
- 99, 103, 114, 122, 160, 162, 183, 197, 200, 236,
- 240, 243, 247, 249, 250, 113, 113, 174, 103, 175,
- 176, 178, 102, 254, 113, 103, 183, 26, 192, 196,
- 200, 236, 246, 248, 250, 251, 252, 115, 30, 42,
- 262, 115, 266, 152, 174, 150, 252, 152, 150, 152,
- 152, 150, 174, 155, 156, 169, 32, 40, 63, 77,
- 188, 37, 49, 31, 33, 39, 46, 47, 48, 50,
- 52, 61, 78, 79, 201, 203, 206, 208, 210, 214,
- 217, 219, 221, 223, 226, 235, 32, 40, 53, 56,
- 63, 77, 100, 101, 184, 160, 251, 172, 115, 160,
- 152, 120, 120, 172, 121, 258, 102, 116, 26, 27,
- 26, 220, 64, 71, 263, 26, 269, 113, 113, 114,
- 151, 160, 249, 113, 113, 64, 71, 265, 266, 115,
- 115, 115, 67, 32, 59, 218, 115, 28, 30, 42,
- 207, 264, 115, 264, 51, 54, 55, 58, 66, 84,
- 230, 29, 73, 222, 115, 268, 266, 69, 265, 115,
- 266, 115, 115, 186, 172, 113, 123, 26, 163, 164,
- 165, 169, 113, 113, 260, 121, 194, 116, 116, 152,
- 150, 151, 107, 171, 86, 145, 152, 26, 244, 26,
- 245, 220, 26, 213, 70, 213, 28, 34, 36, 72,
- 74, 202, 212, 115, 115, 231, 115, 266, 44, 45,
- 85, 227, 228, 26, 271, 32, 211, 38, 57, 215,
- 115, 26, 187, 26, 185, 187, 114, 251, 116, 107,
- 170, 157, 158, 252, 152, 122, 114, 115, 267, 113,
- 113, 116, 116, 116, 116, 116, 26, 234, 26, 232,
- 26, 233, 116, 80, 81, 82, 83, 216, 26, 229,
- 116, 116, 116, 113, 123, 117, 118, 166, 113, 26,
- 159, 273, 113, 65, 76, 195, 198, 199, 200, 237,
- 238, 241, 246, 26, 270, 87, 88, 89, 90, 91,
- 92, 93, 94, 95, 96, 97, 98, 146, 152, 60,
- 29, 43, 63, 75, 204, 212, 264, 116, 116, 116,
- 116, 251, 26, 167, 26, 168, 158, 152, 37, 49,
- 224, 226, 113, 123, 116, 35, 205, 209, 212, 113,
- 123, 113, 113, 115, 115, 69, 225, 198, 251, 158,
- 145, 239, 244, 242, 245, 115, 123, 113, 113, 116,
- 109, 116, 109, 229, 158, 146, 244, 245, 109, 229,
- 116
+ 25, 26, 27, 28, 105, 106, 133, 134, 135, 136,
+ 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
+ 147, 148, 151, 152, 153, 183, 184, 185, 186, 193,
+ 194, 195, 257, 259, 260, 263, 276, 277, 114, 261,
+ 105, 105, 105, 71, 106, 157, 165, 264, 157, 157,
+ 157, 157, 157, 105, 120, 121, 156, 179, 181, 256,
+ 157, 157, 105, 106, 184, 122, 178, 106, 158, 173,
+ 158, 158, 159, 160, 173, 158, 114, 115, 114, 9,
+ 11, 105, 262, 124, 124, 118, 124, 197, 34, 35,
+ 36, 43, 65, 66, 80, 265, 116, 107, 108, 109,
+ 110, 177, 116, 116, 116, 116, 116, 107, 110, 111,
+ 176, 29, 30, 44, 68, 79, 102, 106, 117, 125,
+ 164, 166, 187, 201, 204, 240, 244, 247, 251, 253,
+ 254, 116, 116, 178, 106, 179, 180, 182, 116, 177,
+ 116, 116, 105, 258, 116, 106, 187, 29, 196, 200,
+ 204, 240, 250, 252, 254, 255, 256, 118, 33, 45,
+ 266, 118, 270, 156, 178, 154, 256, 156, 154, 156,
+ 156, 35, 43, 66, 80, 192, 40, 52, 34, 36,
+ 42, 49, 50, 51, 53, 55, 64, 81, 82, 205,
+ 207, 210, 212, 214, 218, 221, 223, 225, 227, 230,
+ 239, 35, 43, 56, 59, 66, 80, 103, 104, 188,
+ 164, 255, 176, 118, 164, 156, 123, 123, 176, 154,
+ 178, 156, 159, 124, 262, 105, 119, 29, 30, 29,
+ 224, 67, 74, 267, 29, 273, 116, 116, 117, 155,
+ 164, 253, 116, 116, 67, 74, 269, 270, 118, 118,
+ 118, 70, 35, 62, 222, 118, 31, 33, 45, 211,
+ 268, 118, 268, 54, 57, 58, 61, 69, 87, 234,
+ 32, 76, 226, 118, 272, 270, 72, 269, 118, 270,
+ 118, 118, 190, 176, 116, 126, 29, 167, 168, 169,
+ 173, 116, 116, 264, 124, 198, 119, 119, 156, 154,
+ 155, 110, 175, 89, 149, 277, 156, 29, 248, 29,
+ 249, 224, 29, 217, 73, 217, 31, 37, 39, 75,
+ 77, 206, 216, 118, 118, 235, 118, 270, 47, 48,
+ 88, 231, 232, 29, 275, 35, 215, 41, 60, 219,
+ 118, 29, 191, 29, 189, 191, 117, 255, 119, 110,
+ 174, 161, 162, 256, 156, 125, 117, 118, 271, 116,
+ 271, 116, 119, 119, 119, 119, 119, 29, 238, 29,
+ 236, 29, 237, 119, 83, 84, 85, 86, 220, 29,
+ 233, 119, 119, 119, 116, 126, 120, 121, 170, 116,
+ 29, 163, 277, 116, 68, 79, 199, 202, 203, 204,
+ 241, 242, 245, 250, 29, 274, 90, 91, 92, 93,
+ 94, 95, 96, 97, 98, 99, 100, 101, 150, 277,
+ 156, 63, 32, 46, 66, 78, 208, 216, 268, 119,
+ 119, 119, 119, 255, 29, 171, 29, 172, 162, 156,
+ 40, 52, 228, 230, 116, 126, 119, 38, 209, 213,
+ 216, 116, 126, 116, 116, 118, 118, 72, 229, 202,
+ 255, 162, 149, 243, 248, 246, 249, 118, 126, 116,
+ 116, 119, 112, 119, 112, 233, 162, 150, 248, 249,
+ 112, 233, 119
};
#define yyerrok (yyerrstatus = 0)
@@ -2151,7 +2183,7 @@ yyreduce:
case 3:
/* Line 1455 of yacc.c */
-#line 273 "program_parse.y"
+#line 280 "program_parse.y"
{
if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid fragment program header");
@@ -2164,7 +2196,7 @@ yyreduce:
case 4:
/* Line 1455 of yacc.c */
-#line 281 "program_parse.y"
+#line 288 "program_parse.y"
{
if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex program header");
@@ -2179,7 +2211,7 @@ yyreduce:
case 7:
/* Line 1455 of yacc.c */
-#line 297 "program_parse.y"
+#line 304 "program_parse.y"
{
int valid = 0;
@@ -2204,7 +2236,7 @@ yyreduce:
case 10:
/* Line 1455 of yacc.c */
-#line 323 "program_parse.y"
+#line 330 "program_parse.y"
{
if ((yyvsp[(1) - (2)].inst) != NULL) {
if (state->inst_tail == NULL) {
@@ -2224,7 +2256,7 @@ yyreduce:
case 13:
/* Line 1455 of yacc.c */
-#line 342 "program_parse.y"
+#line 349 "program_parse.y"
{
(yyval.inst) = (yyvsp[(1) - (1)].inst);
state->prog->NumAluInstructions++;
@@ -2234,80 +2266,112 @@ yyreduce:
case 14:
/* Line 1455 of yacc.c */
-#line 347 "program_parse.y"
+#line 354 "program_parse.y"
{
(yyval.inst) = (yyvsp[(1) - (1)].inst);
state->prog->NumTexInstructions++;
;}
break;
- case 29:
+ case 30:
/* Line 1455 of yacc.c */
-#line 374 "program_parse.y"
+#line 388 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
;}
break;
- case 30:
+ case 31:
+
+/* Line 1455 of yacc.c */
+#line 392 "program_parse.y"
+ {
+ (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
+ ;}
+ break;
+
+ case 32:
/* Line 1455 of yacc.c */
-#line 380 "program_parse.y"
+#line 398 "program_parse.y"
{
(yyval.inst) = asm_instruction_ctor(OPCODE_ARA, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
;}
break;
- case 31:
+ case 33:
+
+/* Line 1455 of yacc.c */
+#line 404 "program_parse.y"
+ {
+ (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (2)].temp_inst), NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL);
+ ;}
+ break;
+
+ case 34:
+
+/* Line 1455 of yacc.c */
+#line 408 "program_parse.y"
+ {
+ if ((yyvsp[(2) - (2)].dst_reg).WriteMask != WRITEMASK_XYZW) {
+ yyerror(& (yylsp[(2) - (2)]), state, "POPA only supports .xyzw write mask");
+ YYERROR;
+ }
+
+ (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (2)].temp_inst), & (yyvsp[(2) - (2)].dst_reg), NULL, NULL, NULL);
+ ;}
+ break;
+
+ case 35:
/* Line 1455 of yacc.c */
-#line 386 "program_parse.y"
+#line 420 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
;}
break;
- case 32:
+ case 36:
/* Line 1455 of yacc.c */
-#line 392 "program_parse.y"
+#line 426 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
;}
break;
- case 33:
+ case 37:
/* Line 1455 of yacc.c */
-#line 398 "program_parse.y"
+#line 432 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL);
;}
break;
- case 34:
+ case 38:
/* Line 1455 of yacc.c */
-#line 405 "program_parse.y"
+#line 439 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL);
;}
break;
- case 35:
+ case 39:
/* Line 1455 of yacc.c */
-#line 412 "program_parse.y"
+#line 446 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg));
;}
break;
- case 36:
+ case 40:
/* Line 1455 of yacc.c */
-#line 418 "program_parse.y"
+#line 452 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL);
if ((yyval.inst) != NULL) {
@@ -2351,20 +2415,20 @@ yyreduce:
;}
break;
- case 37:
+ case 41:
/* Line 1455 of yacc.c */
-#line 462 "program_parse.y"
+#line 496 "program_parse.y"
{
(yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL);
state->fragment.UsesKill = 1;
;}
break;
- case 38:
+ case 42:
/* Line 1455 of yacc.c */
-#line 467 "program_parse.y"
+#line 501 "program_parse.y"
{
(yyval.inst) = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL);
(yyval.inst)->Base.DstReg.CondMask = (yyvsp[(2) - (2)].dst_reg).CondMask;
@@ -2374,10 +2438,10 @@ yyreduce:
;}
break;
- case 39:
+ case 43:
/* Line 1455 of yacc.c */
-#line 477 "program_parse.y"
+#line 511 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (12)].temp_inst), & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg));
if ((yyval.inst) != NULL) {
@@ -2421,103 +2485,166 @@ yyreduce:
;}
break;
- case 40:
+ case 44:
/* Line 1455 of yacc.c */
-#line 521 "program_parse.y"
+#line 555 "program_parse.y"
{
(yyval.integer) = (yyvsp[(2) - (2)].integer);
;}
break;
- case 41:
+ case 45:
+
+/* Line 1455 of yacc.c */
+#line 559 "program_parse.y"
+ {
+ /* The NV_vertex_program3 spec is just plain broken. While
+ * ARB_fragment_program correctly makes "texture" a reserved word,
+ * NV_vp3 does not. To work around this, the lexer treats it as
+ * IDENTIFIER or USED_IDENTIFIER, and the parser has to do the
+ * matching.
+ */
+ if (strcmp("texture", (yyvsp[(1) - (2)].string)) == 0) {
+ (yyval.integer) = (yyvsp[(2) - (2)].integer);
+ } else {
+ yyerror(& (yylsp[(1) - (2)]), state, "expected \"texture\", got IDENTIFIER");
+ YYERROR;
+ }
+ ;}
+ break;
+
+ case 46:
/* Line 1455 of yacc.c */
-#line 526 "program_parse.y"
+#line 575 "program_parse.y"
{ (yyval.integer) = TEXTURE_1D_INDEX; ;}
break;
- case 42:
+ case 47:
/* Line 1455 of yacc.c */
-#line 527 "program_parse.y"
+#line 576 "program_parse.y"
{ (yyval.integer) = TEXTURE_2D_INDEX; ;}
break;
- case 43:
+ case 48:
/* Line 1455 of yacc.c */
-#line 528 "program_parse.y"
+#line 577 "program_parse.y"
{ (yyval.integer) = TEXTURE_3D_INDEX; ;}
break;
- case 44:
+ case 49:
/* Line 1455 of yacc.c */
-#line 529 "program_parse.y"
+#line 578 "program_parse.y"
{ (yyval.integer) = TEXTURE_CUBE_INDEX; ;}
break;
- case 45:
+ case 50:
/* Line 1455 of yacc.c */
-#line 530 "program_parse.y"
+#line 579 "program_parse.y"
{ (yyval.integer) = TEXTURE_RECT_INDEX; ;}
break;
- case 46:
+ case 51:
/* Line 1455 of yacc.c */
-#line 531 "program_parse.y"
+#line 580 "program_parse.y"
{ (yyval.integer) = -TEXTURE_1D_INDEX; ;}
break;
- case 47:
+ case 52:
/* Line 1455 of yacc.c */
-#line 532 "program_parse.y"
+#line 581 "program_parse.y"
{ (yyval.integer) = -TEXTURE_2D_INDEX; ;}
break;
- case 48:
+ case 53:
/* Line 1455 of yacc.c */
-#line 533 "program_parse.y"
+#line 582 "program_parse.y"
{ (yyval.integer) = -TEXTURE_RECT_INDEX; ;}
break;
- case 49:
+ case 54:
/* Line 1455 of yacc.c */
-#line 534 "program_parse.y"
+#line 583 "program_parse.y"
{ (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;}
break;
- case 50:
+ case 55:
/* Line 1455 of yacc.c */
-#line 535 "program_parse.y"
+#line 584 "program_parse.y"
{ (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;}
break;
- case 51:
+ case 56:
/* Line 1455 of yacc.c */
-#line 536 "program_parse.y"
+#line 585 "program_parse.y"
{ (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;}
break;
- case 52:
+ case 57:
/* Line 1455 of yacc.c */
-#line 537 "program_parse.y"
+#line 586 "program_parse.y"
{ (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;}
break;
- case 53:
+ case 58:
+
+/* Line 1455 of yacc.c */
+#line 588 "program_parse.y"
+ {
+ int valid = 0;
+
+ /* The NV_vertex_program3 spec is just plain broken. While
+ * ARB_fragment_program correctly makes SHADOW1D, SHADOW2D, CUBE,
+ * and RECT reserved words, NV_vp3 does not. To work around this,
+ * the lexer treats these as IDENTIFIER or USED_IDENTIFIER, and the
+ * parser has to do the matching.
+ */
+ if (state->option.NV_vertex3) {
+ if (strncmp("SHADOW", (yyvsp[(1) - (1)].string), 6) == 0) {
+ const char *const subTarget = & (yyvsp[(1) - (1)].string)[6];
+
+ if (strcmp("1D", subTarget) == 0) {
+ (yyval.integer) = -TEXTURE_1D_INDEX;
+ valid = state->option.Shadow;
+ } else if (strcmp("2D", subTarget) == 0) {
+ (yyval.integer) = -TEXTURE_2D_INDEX;
+ valid = state->option.Shadow;
+ } else if (strcmp("RECT", subTarget) == 0) {
+ (yyval.integer) = -TEXTURE_RECT_INDEX;
+ valid = state->option.Shadow && state->option.TexRect;
+ }
+ } else if (strcmp("CUBE", (yyvsp[(1) - (1)].string)) == 0) {
+ (yyval.integer) = TEXTURE_CUBE_INDEX;
+ valid = 1;
+ } else if (strcmp("RECT", (yyvsp[(1) - (1)].string)) == 0) {
+ (yyval.integer) = TEXTURE_RECT_INDEX;
+ valid = state->option.TexRect;
+ }
+ }
+
+ if (!valid) {
+ yyerror(& (yylsp[(1) - (1)]), state, "invalid texture target");
+ YYERROR;
+ }
+ ;}
+ break;
+
+ case 59:
/* Line 1455 of yacc.c */
-#line 541 "program_parse.y"
+#line 628 "program_parse.y"
{
/* FIXME: Is this correct? Should the extenedSwizzle be applied
* FIXME: to the existing swizzle?
@@ -2529,10 +2656,10 @@ yyreduce:
;}
break;
- case 54:
+ case 60:
/* Line 1455 of yacc.c */
-#line 553 "program_parse.y"
+#line 640 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (3)].temp_inst), NULL, NULL, NULL, NULL);
@@ -2549,10 +2676,10 @@ yyreduce:
;}
break;
- case 55:
+ case 61:
/* Line 1455 of yacc.c */
-#line 570 "program_parse.y"
+#line 657 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (2)].temp_inst), NULL, NULL, NULL, NULL);
@@ -2562,10 +2689,10 @@ yyreduce:
;}
break;
- case 56:
+ case 62:
/* Line 1455 of yacc.c */
-#line 580 "program_parse.y"
+#line 667 "program_parse.y"
{
(yyval.src_reg) = (yyvsp[(2) - (2)].src_reg);
@@ -2575,10 +2702,10 @@ yyreduce:
;}
break;
- case 57:
+ case 63:
/* Line 1455 of yacc.c */
-#line 588 "program_parse.y"
+#line 675 "program_parse.y"
{
(yyval.src_reg) = (yyvsp[(3) - (4)].src_reg);
@@ -2595,10 +2722,10 @@ yyreduce:
;}
break;
- case 58:
+ case 64:
/* Line 1455 of yacc.c */
-#line 605 "program_parse.y"
+#line 692 "program_parse.y"
{
(yyval.src_reg) = (yyvsp[(1) - (2)].src_reg);
@@ -2607,10 +2734,10 @@ yyreduce:
;}
break;
- case 59:
+ case 65:
/* Line 1455 of yacc.c */
-#line 612 "program_parse.y"
+#line 699 "program_parse.y"
{
struct asm_symbol temp_sym;
@@ -2629,10 +2756,10 @@ yyreduce:
;}
break;
- case 60:
+ case 66:
/* Line 1455 of yacc.c */
-#line 631 "program_parse.y"
+#line 718 "program_parse.y"
{
(yyval.src_reg) = (yyvsp[(2) - (3)].src_reg);
@@ -2645,10 +2772,10 @@ yyreduce:
;}
break;
- case 61:
+ case 67:
/* Line 1455 of yacc.c */
-#line 642 "program_parse.y"
+#line 729 "program_parse.y"
{
(yyval.src_reg) = (yyvsp[(3) - (5)].src_reg);
@@ -2667,10 +2794,10 @@ yyreduce:
;}
break;
- case 62:
+ case 68:
/* Line 1455 of yacc.c */
-#line 662 "program_parse.y"
+#line 749 "program_parse.y"
{
(yyval.dst_reg) = (yyvsp[(1) - (3)].dst_reg);
(yyval.dst_reg).WriteMask = (yyvsp[(2) - (3)].swiz_mask).mask;
@@ -2695,10 +2822,10 @@ yyreduce:
;}
break;
- case 63:
+ case 69:
/* Line 1455 of yacc.c */
-#line 687 "program_parse.y"
+#line 774 "program_parse.y"
{
if (!state->option.NV_vertex2) {
if ((yyvsp[(2) - (3)].swiz_mask).mask != WRITEMASK_X) {
@@ -2710,7 +2837,7 @@ yyreduce:
init_dst_reg(& (yyval.dst_reg));
(yyval.dst_reg).File = PROGRAM_ADDRESS;
- (yyval.dst_reg).Index = 0;
+ (yyval.dst_reg).Index = (yyvsp[(1) - (3)].sym)->binding;
(yyval.dst_reg).WriteMask = (yyvsp[(2) - (3)].swiz_mask).mask;
(yyval.dst_reg).CondMask = (yyvsp[(3) - (3)].dst_reg).CondMask;
(yyval.dst_reg).CondSwizzle = (yyvsp[(3) - (3)].dst_reg).CondSwizzle;
@@ -2718,21 +2845,22 @@ yyreduce:
;}
break;
- case 65:
+ case 71:
/* Line 1455 of yacc.c */
-#line 712 "program_parse.y"
+#line 799 "program_parse.y"
{
init_src_reg(& (yyval.src_reg));
(yyval.src_reg).Base.File = PROGRAM_ADDRESS;
+ (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].sym)->binding;
(yyval.src_reg).Symbol = (yyvsp[(1) - (1)].sym);
;}
break;
- case 66:
+ case 72:
/* Line 1455 of yacc.c */
-#line 720 "program_parse.y"
+#line 808 "program_parse.y"
{
const unsigned xyzw_valid =
((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0)
@@ -2765,20 +2893,20 @@ yyreduce:
;}
break;
- case 67:
+ case 73:
/* Line 1455 of yacc.c */
-#line 753 "program_parse.y"
+#line 841 "program_parse.y"
{
(yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle);
(yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0;
;}
break;
- case 68:
+ case 74:
/* Line 1455 of yacc.c */
-#line 760 "program_parse.y"
+#line 848 "program_parse.y"
{
if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
@@ -2795,10 +2923,10 @@ yyreduce:
;}
break;
- case 69:
+ case 75:
/* Line 1455 of yacc.c */
-#line 775 "program_parse.y"
+#line 863 "program_parse.y"
{
if (strlen((yyvsp[(1) - (1)].string)) > 1) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
@@ -2848,10 +2976,10 @@ yyreduce:
;}
break;
- case 70:
+ case 76:
/* Line 1455 of yacc.c */
-#line 825 "program_parse.y"
+#line 913 "program_parse.y"
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
@@ -2872,7 +3000,7 @@ yyreduce:
switch (s->type) {
case at_temp:
(yyval.src_reg).Base.File = PROGRAM_TEMPORARY;
- (yyval.src_reg).Base.Index = s->temp_binding;
+ (yyval.src_reg).Base.Index = s->binding;
break;
case at_param:
(yyval.src_reg).Base.File = s->param_binding_type;
@@ -2880,7 +3008,7 @@ yyreduce:
break;
case at_attrib:
(yyval.src_reg).Base.File = PROGRAM_INPUT;
- (yyval.src_reg).Base.Index = s->attrib_binding;
+ (yyval.src_reg).Base.Index = s->binding;
state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index);
if (!validate_inputs(& (yylsp[(1) - (1)]), state)) {
@@ -2895,10 +3023,10 @@ yyreduce:
;}
break;
- case 71:
+ case 77:
/* Line 1455 of yacc.c */
-#line 867 "program_parse.y"
+#line 955 "program_parse.y"
{
init_src_reg(& (yyval.src_reg));
(yyval.src_reg).Base.File = PROGRAM_INPUT;
@@ -2911,10 +3039,10 @@ yyreduce:
;}
break;
- case 72:
+ case 78:
/* Line 1455 of yacc.c */
-#line 878 "program_parse.y"
+#line 966 "program_parse.y"
{
if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr
&& ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) {
@@ -2930,6 +3058,8 @@ yyreduce:
(yyval.src_reg).Base.RelAddr = 1;
(yyval.src_reg).Base.Index = (yyvsp[(3) - (4)].src_reg).Base.Index;
+ (yyval.src_reg).Base.AddrReg = (yyvsp[(3) - (4)].src_reg).Base.AddrReg;
+ (yyval.src_reg).Base.AddrComponent = (yyvsp[(3) - (4)].src_reg).Base.AddrComponent;
(yyval.src_reg).Symbol = (yyvsp[(1) - (4)].sym);
} else {
(yyval.src_reg).Base.Index = (yyvsp[(1) - (4)].sym)->param_binding_begin + (yyvsp[(3) - (4)].src_reg).Base.Index;
@@ -2937,10 +3067,10 @@ yyreduce:
;}
break;
- case 73:
+ case 79:
/* Line 1455 of yacc.c */
-#line 899 "program_parse.y"
+#line 989 "program_parse.y"
{
init_src_reg(& (yyval.src_reg));
(yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL)
@@ -2950,10 +3080,10 @@ yyreduce:
;}
break;
- case 74:
+ case 80:
/* Line 1455 of yacc.c */
-#line 909 "program_parse.y"
+#line 999 "program_parse.y"
{
init_dst_reg(& (yyval.dst_reg));
(yyval.dst_reg).File = PROGRAM_OUTPUT;
@@ -2961,10 +3091,10 @@ yyreduce:
;}
break;
- case 75:
+ case 81:
/* Line 1455 of yacc.c */
-#line 915 "program_parse.y"
+#line 1005 "program_parse.y"
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
@@ -2981,11 +3111,11 @@ yyreduce:
switch (s->type) {
case at_temp:
(yyval.dst_reg).File = PROGRAM_TEMPORARY;
- (yyval.dst_reg).Index = s->temp_binding;
+ (yyval.dst_reg).Index = s->binding;
break;
case at_output:
(yyval.dst_reg).File = PROGRAM_OUTPUT;
- (yyval.dst_reg).Index = s->output_binding;
+ (yyval.dst_reg).Index = s->binding;
break;
default:
(yyval.dst_reg).File = s->param_binding_type;
@@ -2995,10 +3125,10 @@ yyreduce:
;}
break;
- case 76:
+ case 82:
/* Line 1455 of yacc.c */
-#line 946 "program_parse.y"
+#line 1036 "program_parse.y"
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
@@ -3015,56 +3145,54 @@ yyreduce:
;}
break;
- case 79:
+ case 85:
/* Line 1455 of yacc.c */
-#line 965 "program_parse.y"
+#line 1055 "program_parse.y"
{
init_src_reg(& (yyval.src_reg));
(yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer);
;}
break;
- case 80:
+ case 86:
/* Line 1455 of yacc.c */
-#line 972 "program_parse.y"
+#line 1062 "program_parse.y"
{
- /* FINISHME: Add support for multiple address registers.
- */
init_src_reg(& (yyval.src_reg));
(yyval.src_reg).Base.RelAddr = 1;
(yyval.src_reg).Base.Index = (yyvsp[(3) - (3)].integer);
- (yyval.src_reg).Base.AddrReg = 0;
+ (yyval.src_reg).Base.AddrReg = (yyvsp[(1) - (3)].sym)->binding;
(yyval.src_reg).Base.AddrComponent = (yyvsp[(2) - (3)].integer);
;}
break;
- case 81:
+ case 87:
/* Line 1455 of yacc.c */
-#line 983 "program_parse.y"
+#line 1071 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
- case 82:
+ case 88:
/* Line 1455 of yacc.c */
-#line 984 "program_parse.y"
+#line 1072 "program_parse.y"
{ (yyval.integer) = (yyvsp[(2) - (2)].integer); ;}
break;
- case 83:
+ case 89:
/* Line 1455 of yacc.c */
-#line 985 "program_parse.y"
+#line 1073 "program_parse.y"
{ (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;}
break;
- case 84:
+ case 90:
/* Line 1455 of yacc.c */
-#line 989 "program_parse.y"
+#line 1077 "program_parse.y"
{
if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) {
char s[100];
@@ -3078,10 +3206,10 @@ yyreduce:
;}
break;
- case 85:
+ case 91:
/* Line 1455 of yacc.c */
-#line 1003 "program_parse.y"
+#line 1091 "program_parse.y"
{
if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) {
char s[100];
@@ -3095,10 +3223,10 @@ yyreduce:
;}
break;
- case 86:
+ case 92:
/* Line 1455 of yacc.c */
-#line 1017 "program_parse.y"
+#line 1105 "program_parse.y"
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
@@ -3116,10 +3244,10 @@ yyreduce:
;}
break;
- case 87:
+ case 93:
/* Line 1455 of yacc.c */
-#line 1035 "program_parse.y"
+#line 1123 "program_parse.y"
{
if (!state->option.NV_vertex2 && ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X)) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector");
@@ -3140,24 +3268,24 @@ yyreduce:
;}
break;
- case 92:
+ case 98:
/* Line 1455 of yacc.c */
-#line 1060 "program_parse.y"
+#line 1148 "program_parse.y"
{ (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;}
break;
- case 97:
+ case 103:
/* Line 1455 of yacc.c */
-#line 1064 "program_parse.y"
+#line 1152 "program_parse.y"
{ (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;}
break;
- case 98:
+ case 104:
/* Line 1455 of yacc.c */
-#line 1068 "program_parse.y"
+#line 1156 "program_parse.y"
{
if (!state->option.NV_vertex2
&& !state->option.NV_fragment) {
@@ -3170,10 +3298,10 @@ yyreduce:
;}
break;
- case 99:
+ case 105:
/* Line 1455 of yacc.c */
-#line 1079 "program_parse.y"
+#line 1167 "program_parse.y"
{
if (!state->option.NV_vertex2
&& !state->option.NV_fragment) {
@@ -3186,10 +3314,10 @@ yyreduce:
;}
break;
- case 100:
+ case 106:
/* Line 1455 of yacc.c */
-#line 1090 "program_parse.y"
+#line 1178 "program_parse.y"
{
(yyval.dst_reg).CondMask = COND_TR;
(yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
@@ -3197,33 +3325,33 @@ yyreduce:
;}
break;
- case 101:
+ case 107:
/* Line 1455 of yacc.c */
-#line 1098 "program_parse.y"
+#line 1186 "program_parse.y"
{
(yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg);
(yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle;
;}
break;
- case 102:
+ case 108:
/* Line 1455 of yacc.c */
-#line 1105 "program_parse.y"
+#line 1193 "program_parse.y"
{
(yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg);
(yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle;
;}
break;
- case 103:
+ case 109:
/* Line 1455 of yacc.c */
-#line 1112 "program_parse.y"
+#line 1200 "program_parse.y"
{
- const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string));
- if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) {
+ const int good_cond = _mesa_parse_cc(state, (yyvsp[(1) - (1)].string), & (yyval.dst_reg));
+ if (! good_cond) {
char *const err_str =
make_error_string("invalid condition code \"%s\"", (yyvsp[(1) - (1)].string));
@@ -3237,19 +3365,17 @@ yyreduce:
YYERROR;
}
- (yyval.dst_reg).CondMask = cond;
(yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
- (yyval.dst_reg).CondSrc = 0;
;}
break;
- case 104:
+ case 110:
/* Line 1455 of yacc.c */
-#line 1135 "program_parse.y"
+#line 1221 "program_parse.y"
{
- const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string));
- if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) {
+ const int good_cond = _mesa_parse_cc(state, (yyvsp[(1) - (1)].string), & (yyval.dst_reg));
+ if (! good_cond) {
char *const err_str =
make_error_string("invalid condition code \"%s\"", (yyvsp[(1) - (1)].string));
@@ -3263,16 +3389,14 @@ yyreduce:
YYERROR;
}
- (yyval.dst_reg).CondMask = cond;
(yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
- (yyval.dst_reg).CondSrc = 0;
;}
break;
- case 105:
+ case 111:
/* Line 1455 of yacc.c */
-#line 1158 "program_parse.y"
+#line 1242 "program_parse.y"
{
const void *const label =
_mesa_symbol_table_find_symbol(state->st, 1, (yyvsp[(1) - (1)].string));
@@ -3291,10 +3415,10 @@ yyreduce:
;}
break;
- case 114:
+ case 120:
/* Line 1455 of yacc.c */
-#line 1188 "program_parse.y"
+#line 1272 "program_parse.y"
{
struct asm_symbol *const s =
declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)]));
@@ -3302,8 +3426,8 @@ yyreduce:
if (s == NULL) {
YYERROR;
} else {
- s->attrib_binding = (yyvsp[(4) - (4)].attrib);
- state->InputsBound |= (1U << s->attrib_binding);
+ s->binding = (yyvsp[(4) - (4)].attrib);
+ state->InputsBound |= (1U << s->binding);
if (!validate_inputs(& (yylsp[(4) - (4)]), state)) {
YYERROR;
@@ -3312,55 +3436,55 @@ yyreduce:
;}
break;
- case 115:
+ case 121:
/* Line 1455 of yacc.c */
-#line 1206 "program_parse.y"
+#line 1290 "program_parse.y"
{
(yyval.attrib) = (yyvsp[(2) - (2)].attrib);
;}
break;
- case 116:
+ case 122:
/* Line 1455 of yacc.c */
-#line 1210 "program_parse.y"
+#line 1294 "program_parse.y"
{
(yyval.attrib) = (yyvsp[(2) - (2)].attrib);
;}
break;
- case 117:
+ case 123:
/* Line 1455 of yacc.c */
-#line 1216 "program_parse.y"
+#line 1300 "program_parse.y"
{
(yyval.attrib) = VERT_ATTRIB_POS;
;}
break;
- case 118:
+ case 124:
/* Line 1455 of yacc.c */
-#line 1220 "program_parse.y"
+#line 1304 "program_parse.y"
{
(yyval.attrib) = VERT_ATTRIB_WEIGHT;
;}
break;
- case 119:
+ case 125:
/* Line 1455 of yacc.c */
-#line 1224 "program_parse.y"
+#line 1308 "program_parse.y"
{
(yyval.attrib) = VERT_ATTRIB_NORMAL;
;}
break;
- case 120:
+ case 126:
/* Line 1455 of yacc.c */
-#line 1228 "program_parse.y"
+#line 1312 "program_parse.y"
{
if (!state->ctx->Extensions.EXT_secondary_color) {
yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported");
@@ -3371,10 +3495,10 @@ yyreduce:
;}
break;
- case 121:
+ case 127:
/* Line 1455 of yacc.c */
-#line 1237 "program_parse.y"
+#line 1321 "program_parse.y"
{
if (!state->ctx->Extensions.EXT_fog_coord) {
yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported");
@@ -3385,38 +3509,38 @@ yyreduce:
;}
break;
- case 122:
+ case 128:
/* Line 1455 of yacc.c */
-#line 1246 "program_parse.y"
+#line 1330 "program_parse.y"
{
(yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer);
;}
break;
- case 123:
+ case 129:
/* Line 1455 of yacc.c */
-#line 1250 "program_parse.y"
+#line 1334 "program_parse.y"
{
yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported");
YYERROR;
;}
break;
- case 124:
+ case 130:
/* Line 1455 of yacc.c */
-#line 1255 "program_parse.y"
+#line 1339 "program_parse.y"
{
(yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer);
;}
break;
- case 125:
+ case 131:
/* Line 1455 of yacc.c */
-#line 1261 "program_parse.y"
+#line 1345 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference");
@@ -3427,46 +3551,46 @@ yyreduce:
;}
break;
- case 129:
+ case 135:
/* Line 1455 of yacc.c */
-#line 1275 "program_parse.y"
+#line 1359 "program_parse.y"
{
(yyval.attrib) = FRAG_ATTRIB_WPOS;
;}
break;
- case 130:
+ case 136:
/* Line 1455 of yacc.c */
-#line 1279 "program_parse.y"
+#line 1363 "program_parse.y"
{
(yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer);
;}
break;
- case 131:
+ case 137:
/* Line 1455 of yacc.c */
-#line 1283 "program_parse.y"
+#line 1367 "program_parse.y"
{
(yyval.attrib) = FRAG_ATTRIB_FOGC;
;}
break;
- case 132:
+ case 138:
/* Line 1455 of yacc.c */
-#line 1287 "program_parse.y"
+#line 1371 "program_parse.y"
{
(yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer);
;}
break;
- case 135:
+ case 141:
/* Line 1455 of yacc.c */
-#line 1295 "program_parse.y"
+#line 1379 "program_parse.y"
{
struct asm_symbol *const s =
declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)]));
@@ -3482,10 +3606,10 @@ yyreduce:
;}
break;
- case 136:
+ case 142:
/* Line 1455 of yacc.c */
-#line 1311 "program_parse.y"
+#line 1395 "program_parse.y"
{
if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) {
yyerror(& (yylsp[(4) - (6)]), state,
@@ -3507,19 +3631,19 @@ yyreduce:
;}
break;
- case 137:
+ case 143:
/* Line 1455 of yacc.c */
-#line 1333 "program_parse.y"
+#line 1417 "program_parse.y"
{
(yyval.integer) = 0;
;}
break;
- case 138:
+ case 144:
/* Line 1455 of yacc.c */
-#line 1337 "program_parse.y"
+#line 1421 "program_parse.y"
{
if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size");
@@ -3530,38 +3654,38 @@ yyreduce:
;}
break;
- case 139:
+ case 145:
/* Line 1455 of yacc.c */
-#line 1348 "program_parse.y"
+#line 1432 "program_parse.y"
{
(yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym);
;}
break;
- case 140:
+ case 146:
/* Line 1455 of yacc.c */
-#line 1354 "program_parse.y"
+#line 1438 "program_parse.y"
{
(yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym);
;}
break;
- case 142:
+ case 148:
/* Line 1455 of yacc.c */
-#line 1361 "program_parse.y"
+#line 1445 "program_parse.y"
{
(yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length;
(yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym);
;}
break;
- case 143:
+ case 149:
/* Line 1455 of yacc.c */
-#line 1368 "program_parse.y"
+#line 1452 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
@@ -3569,10 +3693,10 @@ yyreduce:
;}
break;
- case 144:
+ case 150:
/* Line 1455 of yacc.c */
-#line 1374 "program_parse.y"
+#line 1458 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
@@ -3580,10 +3704,10 @@ yyreduce:
;}
break;
- case 145:
+ case 151:
/* Line 1455 of yacc.c */
-#line 1380 "program_parse.y"
+#line 1464 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
@@ -3591,10 +3715,10 @@ yyreduce:
;}
break;
- case 146:
+ case 152:
/* Line 1455 of yacc.c */
-#line 1388 "program_parse.y"
+#line 1472 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
@@ -3602,10 +3726,10 @@ yyreduce:
;}
break;
- case 147:
+ case 153:
/* Line 1455 of yacc.c */
-#line 1394 "program_parse.y"
+#line 1478 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
@@ -3613,10 +3737,10 @@ yyreduce:
;}
break;
- case 148:
+ case 154:
/* Line 1455 of yacc.c */
-#line 1400 "program_parse.y"
+#line 1484 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
@@ -3624,10 +3748,10 @@ yyreduce:
;}
break;
- case 149:
+ case 155:
/* Line 1455 of yacc.c */
-#line 1408 "program_parse.y"
+#line 1492 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
@@ -3635,10 +3759,10 @@ yyreduce:
;}
break;
- case 150:
+ case 156:
/* Line 1455 of yacc.c */
-#line 1414 "program_parse.y"
+#line 1498 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
@@ -3646,10 +3770,10 @@ yyreduce:
;}
break;
- case 151:
+ case 157:
/* Line 1455 of yacc.c */
-#line 1420 "program_parse.y"
+#line 1504 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
@@ -3657,101 +3781,101 @@ yyreduce:
;}
break;
- case 152:
+ case 158:
/* Line 1455 of yacc.c */
-#line 1427 "program_parse.y"
+#line 1511 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;}
break;
- case 153:
+ case 159:
/* Line 1455 of yacc.c */
-#line 1428 "program_parse.y"
+#line 1512 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 154:
+ case 160:
/* Line 1455 of yacc.c */
-#line 1431 "program_parse.y"
+#line 1515 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 155:
+ case 161:
/* Line 1455 of yacc.c */
-#line 1432 "program_parse.y"
+#line 1516 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 156:
+ case 162:
/* Line 1455 of yacc.c */
-#line 1433 "program_parse.y"
+#line 1517 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 157:
+ case 163:
/* Line 1455 of yacc.c */
-#line 1434 "program_parse.y"
+#line 1518 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 158:
+ case 164:
/* Line 1455 of yacc.c */
-#line 1435 "program_parse.y"
+#line 1519 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 159:
+ case 165:
/* Line 1455 of yacc.c */
-#line 1436 "program_parse.y"
+#line 1520 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 160:
+ case 166:
/* Line 1455 of yacc.c */
-#line 1437 "program_parse.y"
+#line 1521 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 161:
+ case 167:
/* Line 1455 of yacc.c */
-#line 1438 "program_parse.y"
+#line 1522 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 162:
+ case 168:
/* Line 1455 of yacc.c */
-#line 1439 "program_parse.y"
+#line 1523 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 163:
+ case 169:
/* Line 1455 of yacc.c */
-#line 1440 "program_parse.y"
+#line 1524 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 164:
+ case 170:
/* Line 1455 of yacc.c */
-#line 1441 "program_parse.y"
+#line 1525 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
- case 165:
+ case 171:
/* Line 1455 of yacc.c */
-#line 1445 "program_parse.y"
+#line 1529 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_MATERIAL;
@@ -3760,37 +3884,37 @@ yyreduce:
;}
break;
- case 166:
+ case 172:
/* Line 1455 of yacc.c */
-#line 1454 "program_parse.y"
+#line 1538 "program_parse.y"
{
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
- case 167:
+ case 173:
/* Line 1455 of yacc.c */
-#line 1458 "program_parse.y"
+#line 1542 "program_parse.y"
{
(yyval.integer) = STATE_EMISSION;
;}
break;
- case 168:
+ case 174:
/* Line 1455 of yacc.c */
-#line 1462 "program_parse.y"
+#line 1546 "program_parse.y"
{
(yyval.integer) = STATE_SHININESS;
;}
break;
- case 169:
+ case 175:
/* Line 1455 of yacc.c */
-#line 1468 "program_parse.y"
+#line 1552 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_LIGHT;
@@ -3799,28 +3923,28 @@ yyreduce:
;}
break;
- case 170:
+ case 176:
/* Line 1455 of yacc.c */
-#line 1477 "program_parse.y"
+#line 1561 "program_parse.y"
{
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
- case 171:
+ case 177:
/* Line 1455 of yacc.c */
-#line 1481 "program_parse.y"
+#line 1565 "program_parse.y"
{
(yyval.integer) = STATE_POSITION;
;}
break;
- case 172:
+ case 178:
/* Line 1455 of yacc.c */
-#line 1485 "program_parse.y"
+#line 1569 "program_parse.y"
{
if (!state->ctx->Extensions.EXT_point_parameters) {
yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported");
@@ -3831,57 +3955,57 @@ yyreduce:
;}
break;
- case 173:
+ case 179:
/* Line 1455 of yacc.c */
-#line 1494 "program_parse.y"
+#line 1578 "program_parse.y"
{
(yyval.integer) = (yyvsp[(2) - (2)].integer);
;}
break;
- case 174:
+ case 180:
/* Line 1455 of yacc.c */
-#line 1498 "program_parse.y"
+#line 1582 "program_parse.y"
{
(yyval.integer) = STATE_HALF_VECTOR;
;}
break;
- case 175:
+ case 181:
/* Line 1455 of yacc.c */
-#line 1504 "program_parse.y"
+#line 1588 "program_parse.y"
{
(yyval.integer) = STATE_SPOT_DIRECTION;
;}
break;
- case 176:
+ case 182:
/* Line 1455 of yacc.c */
-#line 1510 "program_parse.y"
+#line 1594 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(2) - (2)].state)[0];
(yyval.state)[1] = (yyvsp[(2) - (2)].state)[1];
;}
break;
- case 177:
+ case 183:
/* Line 1455 of yacc.c */
-#line 1517 "program_parse.y"
+#line 1601 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT;
;}
break;
- case 178:
+ case 184:
/* Line 1455 of yacc.c */
-#line 1522 "program_parse.y"
+#line 1606 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR;
@@ -3889,10 +4013,10 @@ yyreduce:
;}
break;
- case 179:
+ case 185:
/* Line 1455 of yacc.c */
-#line 1530 "program_parse.y"
+#line 1614 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_LIGHTPROD;
@@ -3902,10 +4026,10 @@ yyreduce:
;}
break;
- case 181:
+ case 187:
/* Line 1455 of yacc.c */
-#line 1542 "program_parse.y"
+#line 1626 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = (yyvsp[(3) - (3)].integer);
@@ -3913,46 +4037,46 @@ yyreduce:
;}
break;
- case 182:
+ case 188:
/* Line 1455 of yacc.c */
-#line 1550 "program_parse.y"
+#line 1634 "program_parse.y"
{
(yyval.integer) = STATE_TEXENV_COLOR;
;}
break;
- case 183:
+ case 189:
/* Line 1455 of yacc.c */
-#line 1556 "program_parse.y"
+#line 1640 "program_parse.y"
{
(yyval.integer) = STATE_AMBIENT;
;}
break;
- case 184:
+ case 190:
/* Line 1455 of yacc.c */
-#line 1560 "program_parse.y"
+#line 1644 "program_parse.y"
{
(yyval.integer) = STATE_DIFFUSE;
;}
break;
- case 185:
+ case 191:
/* Line 1455 of yacc.c */
-#line 1564 "program_parse.y"
+#line 1648 "program_parse.y"
{
(yyval.integer) = STATE_SPECULAR;
;}
break;
- case 186:
+ case 192:
/* Line 1455 of yacc.c */
-#line 1570 "program_parse.y"
+#line 1654 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector");
@@ -3963,10 +4087,10 @@ yyreduce:
;}
break;
- case 187:
+ case 193:
/* Line 1455 of yacc.c */
-#line 1581 "program_parse.y"
+#line 1665 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_TEXGEN;
@@ -3975,92 +4099,92 @@ yyreduce:
;}
break;
- case 188:
+ case 194:
/* Line 1455 of yacc.c */
-#line 1590 "program_parse.y"
+#line 1674 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_EYE_S;
;}
break;
- case 189:
+ case 195:
/* Line 1455 of yacc.c */
-#line 1594 "program_parse.y"
+#line 1678 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_OBJECT_S;
;}
break;
- case 190:
+ case 196:
/* Line 1455 of yacc.c */
-#line 1599 "program_parse.y"
+#line 1683 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S;
;}
break;
- case 191:
+ case 197:
/* Line 1455 of yacc.c */
-#line 1603 "program_parse.y"
+#line 1687 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S;
;}
break;
- case 192:
+ case 198:
/* Line 1455 of yacc.c */
-#line 1607 "program_parse.y"
+#line 1691 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S;
;}
break;
- case 193:
+ case 199:
/* Line 1455 of yacc.c */
-#line 1611 "program_parse.y"
+#line 1695 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S;
;}
break;
- case 194:
+ case 200:
/* Line 1455 of yacc.c */
-#line 1617 "program_parse.y"
+#line 1701 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = (yyvsp[(2) - (2)].integer);
;}
break;
- case 195:
+ case 201:
/* Line 1455 of yacc.c */
-#line 1624 "program_parse.y"
+#line 1708 "program_parse.y"
{
(yyval.integer) = STATE_FOG_COLOR;
;}
break;
- case 196:
+ case 202:
/* Line 1455 of yacc.c */
-#line 1628 "program_parse.y"
+#line 1712 "program_parse.y"
{
(yyval.integer) = STATE_FOG_PARAMS;
;}
break;
- case 197:
+ case 203:
/* Line 1455 of yacc.c */
-#line 1634 "program_parse.y"
+#line 1718 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_CLIPPLANE;
@@ -4068,10 +4192,10 @@ yyreduce:
;}
break;
- case 198:
+ case 204:
/* Line 1455 of yacc.c */
-#line 1642 "program_parse.y"
+#line 1726 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector");
@@ -4082,38 +4206,38 @@ yyreduce:
;}
break;
- case 199:
+ case 205:
/* Line 1455 of yacc.c */
-#line 1653 "program_parse.y"
+#line 1737 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = (yyvsp[(2) - (2)].integer);
;}
break;
- case 200:
+ case 206:
/* Line 1455 of yacc.c */
-#line 1660 "program_parse.y"
+#line 1744 "program_parse.y"
{
(yyval.integer) = STATE_POINT_SIZE;
;}
break;
- case 201:
+ case 207:
/* Line 1455 of yacc.c */
-#line 1664 "program_parse.y"
+#line 1748 "program_parse.y"
{
(yyval.integer) = STATE_POINT_ATTENUATION;
;}
break;
- case 202:
+ case 208:
/* Line 1455 of yacc.c */
-#line 1670 "program_parse.y"
+#line 1754 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (5)].state)[0];
(yyval.state)[1] = (yyvsp[(1) - (5)].state)[1];
@@ -4123,10 +4247,10 @@ yyreduce:
;}
break;
- case 203:
+ case 209:
/* Line 1455 of yacc.c */
-#line 1680 "program_parse.y"
+#line 1764 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (2)].state)[0];
(yyval.state)[1] = (yyvsp[(1) - (2)].state)[1];
@@ -4136,20 +4260,20 @@ yyreduce:
;}
break;
- case 204:
+ case 210:
/* Line 1455 of yacc.c */
-#line 1690 "program_parse.y"
+#line 1774 "program_parse.y"
{
(yyval.state)[2] = 0;
(yyval.state)[3] = 3;
;}
break;
- case 205:
+ case 211:
/* Line 1455 of yacc.c */
-#line 1695 "program_parse.y"
+#line 1779 "program_parse.y"
{
/* It seems logical that the matrix row range specifier would have
* to specify a range or more than one row (i.e., $5 > $3).
@@ -4167,10 +4291,10 @@ yyreduce:
;}
break;
- case 206:
+ case 212:
/* Line 1455 of yacc.c */
-#line 1713 "program_parse.y"
+#line 1797 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(2) - (3)].state)[0];
(yyval.state)[1] = (yyvsp[(2) - (3)].state)[1];
@@ -4178,55 +4302,55 @@ yyreduce:
;}
break;
- case 207:
+ case 213:
/* Line 1455 of yacc.c */
-#line 1721 "program_parse.y"
+#line 1805 "program_parse.y"
{
(yyval.integer) = 0;
;}
break;
- case 208:
+ case 214:
/* Line 1455 of yacc.c */
-#line 1725 "program_parse.y"
+#line 1809 "program_parse.y"
{
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
- case 209:
+ case 215:
/* Line 1455 of yacc.c */
-#line 1731 "program_parse.y"
+#line 1815 "program_parse.y"
{
(yyval.integer) = STATE_MATRIX_INVERSE;
;}
break;
- case 210:
+ case 216:
/* Line 1455 of yacc.c */
-#line 1735 "program_parse.y"
+#line 1819 "program_parse.y"
{
(yyval.integer) = STATE_MATRIX_TRANSPOSE;
;}
break;
- case 211:
+ case 217:
/* Line 1455 of yacc.c */
-#line 1739 "program_parse.y"
+#line 1823 "program_parse.y"
{
(yyval.integer) = STATE_MATRIX_INVTRANS;
;}
break;
- case 212:
+ case 218:
/* Line 1455 of yacc.c */
-#line 1745 "program_parse.y"
+#line 1829 "program_parse.y"
{
if ((yyvsp[(1) - (1)].integer) > 3) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference");
@@ -4237,88 +4361,88 @@ yyreduce:
;}
break;
- case 213:
+ case 219:
/* Line 1455 of yacc.c */
-#line 1756 "program_parse.y"
+#line 1840 "program_parse.y"
{
(yyval.state)[0] = STATE_MODELVIEW_MATRIX;
(yyval.state)[1] = (yyvsp[(2) - (2)].integer);
;}
break;
- case 214:
+ case 220:
/* Line 1455 of yacc.c */
-#line 1761 "program_parse.y"
+#line 1845 "program_parse.y"
{
(yyval.state)[0] = STATE_PROJECTION_MATRIX;
(yyval.state)[1] = 0;
;}
break;
- case 215:
+ case 221:
/* Line 1455 of yacc.c */
-#line 1766 "program_parse.y"
+#line 1850 "program_parse.y"
{
(yyval.state)[0] = STATE_MVP_MATRIX;
(yyval.state)[1] = 0;
;}
break;
- case 216:
+ case 222:
/* Line 1455 of yacc.c */
-#line 1771 "program_parse.y"
+#line 1855 "program_parse.y"
{
(yyval.state)[0] = STATE_TEXTURE_MATRIX;
(yyval.state)[1] = (yyvsp[(2) - (2)].integer);
;}
break;
- case 217:
+ case 223:
/* Line 1455 of yacc.c */
-#line 1776 "program_parse.y"
+#line 1860 "program_parse.y"
{
yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported");
YYERROR;
;}
break;
- case 218:
+ case 224:
/* Line 1455 of yacc.c */
-#line 1781 "program_parse.y"
+#line 1865 "program_parse.y"
{
(yyval.state)[0] = STATE_PROGRAM_MATRIX;
(yyval.state)[1] = (yyvsp[(3) - (4)].integer);
;}
break;
- case 219:
+ case 225:
/* Line 1455 of yacc.c */
-#line 1788 "program_parse.y"
+#line 1872 "program_parse.y"
{
(yyval.integer) = 0;
;}
break;
- case 220:
+ case 226:
/* Line 1455 of yacc.c */
-#line 1792 "program_parse.y"
+#line 1876 "program_parse.y"
{
(yyval.integer) = (yyvsp[(2) - (3)].integer);
;}
break;
- case 221:
+ case 227:
/* Line 1455 of yacc.c */
-#line 1797 "program_parse.y"
+#line 1881 "program_parse.y"
{
/* Since GL_ARB_vertex_blend isn't supported, only modelview matrix
* zero is valid.
@@ -4332,10 +4456,10 @@ yyreduce:
;}
break;
- case 222:
+ case 228:
/* Line 1455 of yacc.c */
-#line 1810 "program_parse.y"
+#line 1894 "program_parse.y"
{
/* Since GL_ARB_matrix_palette isn't supported, just let any value
* through here. The error will be generated later.
@@ -4344,10 +4468,10 @@ yyreduce:
;}
break;
- case 223:
+ case 229:
/* Line 1455 of yacc.c */
-#line 1818 "program_parse.y"
+#line 1902 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector");
@@ -4358,20 +4482,20 @@ yyreduce:
;}
break;
- case 224:
+ case 230:
/* Line 1455 of yacc.c */
-#line 1829 "program_parse.y"
+#line 1913 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_DEPTH_RANGE;
;}
break;
- case 229:
+ case 235:
/* Line 1455 of yacc.c */
-#line 1841 "program_parse.y"
+#line 1925 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = state->state_param_enum;
@@ -4381,30 +4505,30 @@ yyreduce:
;}
break;
- case 230:
+ case 236:
/* Line 1455 of yacc.c */
-#line 1851 "program_parse.y"
+#line 1935 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (1)].integer);
(yyval.state)[1] = (yyvsp[(1) - (1)].integer);
;}
break;
- case 231:
+ case 237:
/* Line 1455 of yacc.c */
-#line 1856 "program_parse.y"
+#line 1940 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (3)].integer);
(yyval.state)[1] = (yyvsp[(3) - (3)].integer);
;}
break;
- case 232:
+ case 238:
/* Line 1455 of yacc.c */
-#line 1863 "program_parse.y"
+#line 1947 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = state->state_param_enum;
@@ -4414,10 +4538,10 @@ yyreduce:
;}
break;
- case 233:
+ case 239:
/* Line 1455 of yacc.c */
-#line 1873 "program_parse.y"
+#line 1957 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = state->state_param_enum;
@@ -4427,30 +4551,30 @@ yyreduce:
;}
break;
- case 234:
+ case 240:
/* Line 1455 of yacc.c */
-#line 1882 "program_parse.y"
+#line 1966 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (1)].integer);
(yyval.state)[1] = (yyvsp[(1) - (1)].integer);
;}
break;
- case 235:
+ case 241:
/* Line 1455 of yacc.c */
-#line 1887 "program_parse.y"
+#line 1971 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (3)].integer);
(yyval.state)[1] = (yyvsp[(3) - (3)].integer);
;}
break;
- case 236:
+ case 242:
/* Line 1455 of yacc.c */
-#line 1894 "program_parse.y"
+#line 1978 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = state->state_param_enum;
@@ -4460,10 +4584,10 @@ yyreduce:
;}
break;
- case 237:
+ case 243:
/* Line 1455 of yacc.c */
-#line 1904 "program_parse.y"
+#line 1988 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference");
@@ -4473,10 +4597,10 @@ yyreduce:
;}
break;
- case 238:
+ case 244:
/* Line 1455 of yacc.c */
-#line 1914 "program_parse.y"
+#line 1998 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference");
@@ -4486,10 +4610,10 @@ yyreduce:
;}
break;
- case 243:
+ case 249:
/* Line 1455 of yacc.c */
-#line 1929 "program_parse.y"
+#line 2013 "program_parse.y"
{
(yyval.vector).count = 4;
(yyval.vector).data[0] = (yyvsp[(1) - (1)].real);
@@ -4499,10 +4623,10 @@ yyreduce:
;}
break;
- case 244:
+ case 250:
/* Line 1455 of yacc.c */
-#line 1939 "program_parse.y"
+#line 2023 "program_parse.y"
{
(yyval.vector).count = 1;
(yyval.vector).data[0] = (yyvsp[(1) - (1)].real);
@@ -4512,10 +4636,10 @@ yyreduce:
;}
break;
- case 245:
+ case 251:
/* Line 1455 of yacc.c */
-#line 1947 "program_parse.y"
+#line 2031 "program_parse.y"
{
(yyval.vector).count = 1;
(yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer);
@@ -4525,10 +4649,10 @@ yyreduce:
;}
break;
- case 246:
+ case 252:
/* Line 1455 of yacc.c */
-#line 1957 "program_parse.y"
+#line 2041 "program_parse.y"
{
(yyval.vector).count = 4;
(yyval.vector).data[0] = (yyvsp[(2) - (3)].real);
@@ -4538,10 +4662,10 @@ yyreduce:
;}
break;
- case 247:
+ case 253:
/* Line 1455 of yacc.c */
-#line 1965 "program_parse.y"
+#line 2049 "program_parse.y"
{
(yyval.vector).count = 4;
(yyval.vector).data[0] = (yyvsp[(2) - (5)].real);
@@ -4551,10 +4675,10 @@ yyreduce:
;}
break;
- case 248:
+ case 254:
/* Line 1455 of yacc.c */
-#line 1974 "program_parse.y"
+#line 2058 "program_parse.y"
{
(yyval.vector).count = 4;
(yyval.vector).data[0] = (yyvsp[(2) - (7)].real);
@@ -4564,10 +4688,10 @@ yyreduce:
;}
break;
- case 249:
+ case 255:
/* Line 1455 of yacc.c */
-#line 1983 "program_parse.y"
+#line 2067 "program_parse.y"
{
(yyval.vector).count = 4;
(yyval.vector).data[0] = (yyvsp[(2) - (9)].real);
@@ -4577,56 +4701,56 @@ yyreduce:
;}
break;
- case 250:
+ case 256:
/* Line 1455 of yacc.c */
-#line 1993 "program_parse.y"
+#line 2077 "program_parse.y"
{
(yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real);
;}
break;
- case 251:
+ case 257:
/* Line 1455 of yacc.c */
-#line 1997 "program_parse.y"
+#line 2081 "program_parse.y"
{
(yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer));
;}
break;
- case 252:
+ case 258:
/* Line 1455 of yacc.c */
-#line 2002 "program_parse.y"
+#line 2086 "program_parse.y"
{ (yyval.negate) = FALSE; ;}
break;
- case 253:
+ case 259:
/* Line 1455 of yacc.c */
-#line 2003 "program_parse.y"
+#line 2087 "program_parse.y"
{ (yyval.negate) = TRUE; ;}
break;
- case 254:
+ case 260:
/* Line 1455 of yacc.c */
-#line 2004 "program_parse.y"
+#line 2088 "program_parse.y"
{ (yyval.negate) = FALSE; ;}
break;
- case 255:
+ case 261:
/* Line 1455 of yacc.c */
-#line 2007 "program_parse.y"
+#line 2091 "program_parse.y"
{ (yyval.integer) = (yyvsp[(2) - (2)].integer); ;}
break;
- case 257:
+ case 263:
/* Line 1455 of yacc.c */
-#line 2011 "program_parse.y"
+#line 2095 "program_parse.y"
{
/* NV_fragment_program_option defines the size qualifiers in a
* fairly broken way. "SHORT" or "LONG" can optionally be used
@@ -4662,25 +4786,25 @@ yyreduce:
;}
break;
- case 258:
+ case 264:
/* Line 1455 of yacc.c */
-#line 2045 "program_parse.y"
+#line 2129 "program_parse.y"
{
;}
break;
- case 259:
+ case 265:
/* Line 1455 of yacc.c */
-#line 2049 "program_parse.y"
+#line 2133 "program_parse.y"
{ (yyval.integer) = (yyvsp[(1) - (1)].integer); ;}
break;
- case 261:
+ case 267:
/* Line 1455 of yacc.c */
-#line 2053 "program_parse.y"
+#line 2137 "program_parse.y"
{
if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) {
YYERROR;
@@ -4688,10 +4812,10 @@ yyreduce:
;}
break;
- case 262:
+ case 268:
/* Line 1455 of yacc.c */
-#line 2059 "program_parse.y"
+#line 2143 "program_parse.y"
{
if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) {
YYERROR;
@@ -4699,10 +4823,10 @@ yyreduce:
;}
break;
- case 263:
+ case 269:
/* Line 1455 of yacc.c */
-#line 2067 "program_parse.y"
+#line 2151 "program_parse.y"
{
struct asm_symbol *const s =
declare_variable(state, (yyvsp[(3) - (5)].string), at_output, & (yylsp[(3) - (5)]));
@@ -4710,15 +4834,15 @@ yyreduce:
if (s == NULL) {
YYERROR;
} else {
- s->output_binding = (yyvsp[(5) - (5)].result);
+ s->binding = (yyvsp[(5) - (5)].result);
}
;}
break;
- case 264:
+ case 270:
/* Line 1455 of yacc.c */
-#line 2080 "program_parse.y"
+#line 2164 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.result) = VERT_RESULT_HPOS;
@@ -4729,10 +4853,10 @@ yyreduce:
;}
break;
- case 265:
+ case 271:
/* Line 1455 of yacc.c */
-#line 2089 "program_parse.y"
+#line 2173 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.result) = VERT_RESULT_FOGC;
@@ -4743,19 +4867,19 @@ yyreduce:
;}
break;
- case 266:
+ case 272:
/* Line 1455 of yacc.c */
-#line 2098 "program_parse.y"
+#line 2182 "program_parse.y"
{
(yyval.result) = (yyvsp[(2) - (2)].result);
;}
break;
- case 267:
+ case 273:
/* Line 1455 of yacc.c */
-#line 2102 "program_parse.y"
+#line 2186 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.result) = VERT_RESULT_PSIZ;
@@ -4766,10 +4890,10 @@ yyreduce:
;}
break;
- case 268:
+ case 274:
/* Line 1455 of yacc.c */
-#line 2111 "program_parse.y"
+#line 2195 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer);
@@ -4780,10 +4904,10 @@ yyreduce:
;}
break;
- case 269:
+ case 275:
/* Line 1455 of yacc.c */
-#line 2120 "program_parse.y"
+#line 2204 "program_parse.y"
{
if (state->mode == ARB_fragment) {
(yyval.result) = FRAG_RESULT_DEPTH;
@@ -4794,29 +4918,29 @@ yyreduce:
;}
break;
- case 270:
+ case 276:
/* Line 1455 of yacc.c */
-#line 2129 "program_parse.y"
+#line 2213 "program_parse.y"
{
yyerror(& (yylsp[(2) - (5)]), state, "user clip planes not yet supported");
YYERROR;
;}
break;
- case 271:
+ case 277:
/* Line 1455 of yacc.c */
-#line 2136 "program_parse.y"
+#line 2220 "program_parse.y"
{
(yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer);
;}
break;
- case 272:
+ case 278:
/* Line 1455 of yacc.c */
-#line 2142 "program_parse.y"
+#line 2226 "program_parse.y"
{
(yyval.integer) = (state->mode == ARB_vertex)
? VERT_RESULT_COL0
@@ -4824,10 +4948,10 @@ yyreduce:
;}
break;
- case 273:
+ case 279:
/* Line 1455 of yacc.c */
-#line 2148 "program_parse.y"
+#line 2232 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.integer) = VERT_RESULT_COL0;
@@ -4838,10 +4962,10 @@ yyreduce:
;}
break;
- case 274:
+ case 280:
/* Line 1455 of yacc.c */
-#line 2157 "program_parse.y"
+#line 2241 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.integer) = VERT_RESULT_BFC0;
@@ -4852,19 +4976,19 @@ yyreduce:
;}
break;
- case 275:
+ case 281:
/* Line 1455 of yacc.c */
-#line 2168 "program_parse.y"
+#line 2252 "program_parse.y"
{
(yyval.integer) = 0;
;}
break;
- case 276:
+ case 282:
/* Line 1455 of yacc.c */
-#line 2172 "program_parse.y"
+#line 2256 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.integer) = 0;
@@ -4875,10 +4999,10 @@ yyreduce:
;}
break;
- case 277:
+ case 283:
/* Line 1455 of yacc.c */
-#line 2181 "program_parse.y"
+#line 2265 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.integer) = 1;
@@ -4889,94 +5013,94 @@ yyreduce:
;}
break;
- case 278:
+ case 284:
/* Line 1455 of yacc.c */
-#line 2191 "program_parse.y"
+#line 2275 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
- case 279:
+ case 285:
/* Line 1455 of yacc.c */
-#line 2192 "program_parse.y"
+#line 2276 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
- case 280:
+ case 286:
/* Line 1455 of yacc.c */
-#line 2193 "program_parse.y"
+#line 2277 "program_parse.y"
{ (yyval.integer) = 1; ;}
break;
- case 281:
+ case 287:
/* Line 1455 of yacc.c */
-#line 2196 "program_parse.y"
+#line 2280 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
- case 282:
+ case 288:
/* Line 1455 of yacc.c */
-#line 2197 "program_parse.y"
+#line 2281 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
- case 283:
+ case 289:
/* Line 1455 of yacc.c */
-#line 2198 "program_parse.y"
+#line 2282 "program_parse.y"
{ (yyval.integer) = 1; ;}
break;
- case 284:
+ case 290:
/* Line 1455 of yacc.c */
-#line 2201 "program_parse.y"
+#line 2285 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
- case 285:
+ case 291:
/* Line 1455 of yacc.c */
-#line 2202 "program_parse.y"
+#line 2286 "program_parse.y"
{ (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
break;
- case 286:
+ case 292:
/* Line 1455 of yacc.c */
-#line 2205 "program_parse.y"
+#line 2289 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
- case 287:
+ case 293:
/* Line 1455 of yacc.c */
-#line 2206 "program_parse.y"
+#line 2290 "program_parse.y"
{ (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
break;
- case 288:
+ case 294:
/* Line 1455 of yacc.c */
-#line 2209 "program_parse.y"
+#line 2293 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
- case 289:
+ case 295:
/* Line 1455 of yacc.c */
-#line 2210 "program_parse.y"
+#line 2294 "program_parse.y"
{ (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
break;
- case 290:
+ case 296:
/* Line 1455 of yacc.c */
-#line 2214 "program_parse.y"
+#line 2298 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector");
@@ -4987,10 +5111,10 @@ yyreduce:
;}
break;
- case 291:
+ case 297:
/* Line 1455 of yacc.c */
-#line 2225 "program_parse.y"
+#line 2309 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector");
@@ -5001,10 +5125,10 @@ yyreduce:
;}
break;
- case 292:
+ case 298:
/* Line 1455 of yacc.c */
-#line 2236 "program_parse.y"
+#line 2320 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector");
@@ -5015,10 +5139,10 @@ yyreduce:
;}
break;
- case 293:
+ case 299:
/* Line 1455 of yacc.c */
-#line 2247 "program_parse.y"
+#line 2331 "program_parse.y"
{
struct asm_symbol *exist = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string));
@@ -5042,7 +5166,7 @@ yyreduce:
/* Line 1455 of yacc.c */
-#line 5046 "program_parse.tab.c"
+#line 5170 "program_parse.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -5261,7 +5385,7 @@ yyreturn:
/* Line 1675 of yacc.c */
-#line 2271 "program_parse.y"
+#line 2355 "program_parse.y"
void
@@ -5278,6 +5402,7 @@ asm_instruction_set_operands(struct asm_instruction *inst,
* BRA (GL_NV_vertex_program2_option)
* CAL (GL_NV_vertex_program2_option)
* RET (GL_NV_vertex_program2_option)
+ * PUSHA (GL_NV_vertex_program3)
*/
if (dst == NULL) {
init_dst_reg(& inst->Base.DstReg);
@@ -5292,6 +5417,7 @@ asm_instruction_set_operands(struct asm_instruction *inst,
* BRA (GL_NV_vertex_program2_option)
* CAL (GL_NV_vertex_program2_option)
* RET (GL_NV_vertex_program2_option)
+ * POPA (GL_NV_vertex_program3)
*/
if (src0 != NULL) {
inst->Base.SrcReg[0] = src0->Base;
@@ -5429,7 +5555,7 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
return NULL;
}
- s->temp_binding = state->prog->NumTemporaries;
+ s->binding = state->prog->NumTemporaries;
state->prog->NumTemporaries++;
break;
@@ -5440,8 +5566,7 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
return NULL;
}
- /* FINISHME: Add support for multiple address registers.
- */
+ s->binding = state->prog->NumAddressRegs;
state->prog->NumAddressRegs++;
break;
diff --git a/src/mesa/shader/program_parse.tab.h b/src/mesa/shader/program_parse.tab.h
index 25fa33ea587..28258d511c4 100644
--- a/src/mesa/shader/program_parse.tab.h
+++ b/src/mesa/shader/program_parse.tab.h
@@ -55,98 +55,101 @@
SCALAR_OP = 271,
TRI_OP = 272,
VECTOR_OP = 273,
- ARL_OP = 274,
- ARA_OP = 275,
- KIL = 276,
- SWZ = 277,
- TXD_OP = 278,
- BRA_OP = 279,
- FLOW_OP = 280,
- INTEGER = 281,
- REAL = 282,
- AMBIENT = 283,
- ATTENUATION = 284,
- BACK = 285,
- CLIP = 286,
- COLOR = 287,
- DEPTH = 288,
- DIFFUSE = 289,
- DIRECTION = 290,
- EMISSION = 291,
- ENV = 292,
- EYE = 293,
- FOG = 294,
- FOGCOORD = 295,
- FRAGMENT = 296,
- FRONT = 297,
- HALF = 298,
- INVERSE = 299,
- INVTRANS = 300,
- LIGHT = 301,
- LIGHTMODEL = 302,
- LIGHTPROD = 303,
- LOCAL = 304,
- MATERIAL = 305,
- MAT_PROGRAM = 306,
- MATRIX = 307,
- MATRIXINDEX = 308,
- MODELVIEW = 309,
- MVP = 310,
- NORMAL = 311,
- OBJECT = 312,
- PALETTE = 313,
- PARAMS = 314,
- PLANE = 315,
- POINT_TOK = 316,
- POINTSIZE = 317,
- POSITION = 318,
- PRIMARY = 319,
- PROGRAM = 320,
- PROJECTION = 321,
- RANGE = 322,
- RESULT = 323,
- ROW = 324,
- SCENECOLOR = 325,
- SECONDARY = 326,
- SHININESS = 327,
- SIZE_TOK = 328,
- SPECULAR = 329,
- SPOT = 330,
- STATE = 331,
- TEXCOORD = 332,
- TEXENV = 333,
- TEXGEN = 334,
- TEXGEN_Q = 335,
- TEXGEN_R = 336,
- TEXGEN_S = 337,
- TEXGEN_T = 338,
- TEXTURE = 339,
- TRANSPOSE = 340,
- TEXTURE_UNIT = 341,
- TEX_1D = 342,
- TEX_2D = 343,
- TEX_3D = 344,
- TEX_CUBE = 345,
- TEX_RECT = 346,
- TEX_SHADOW1D = 347,
- TEX_SHADOW2D = 348,
- TEX_SHADOWRECT = 349,
- TEX_ARRAY1D = 350,
- TEX_ARRAY2D = 351,
- TEX_ARRAYSHADOW1D = 352,
- TEX_ARRAYSHADOW2D = 353,
- VERTEX = 354,
- VTXATTRIB = 355,
- WEIGHT = 356,
- IDENTIFIER = 357,
- USED_IDENTIFIER = 358,
- MASK4 = 359,
- MASK3 = 360,
- MASK2 = 361,
- MASK1 = 362,
- SWIZZLE = 363,
- DOT_DOT = 364,
- DOT = 365
+ KIL = 274,
+ SWZ = 275,
+ TXD_OP = 276,
+ BRA_OP = 277,
+ FLOW_OP = 278,
+ ARL_OP = 279,
+ ARL_NV_OP = 280,
+ ARA_OP = 281,
+ PUSHA_OP = 282,
+ POPA_OP = 283,
+ INTEGER = 284,
+ REAL = 285,
+ AMBIENT = 286,
+ ATTENUATION = 287,
+ BACK = 288,
+ CLIP = 289,
+ COLOR = 290,
+ DEPTH = 291,
+ DIFFUSE = 292,
+ DIRECTION = 293,
+ EMISSION = 294,
+ ENV = 295,
+ EYE = 296,
+ FOG = 297,
+ FOGCOORD = 298,
+ FRAGMENT = 299,
+ FRONT = 300,
+ HALF = 301,
+ INVERSE = 302,
+ INVTRANS = 303,
+ LIGHT = 304,
+ LIGHTMODEL = 305,
+ LIGHTPROD = 306,
+ LOCAL = 307,
+ MATERIAL = 308,
+ MAT_PROGRAM = 309,
+ MATRIX = 310,
+ MATRIXINDEX = 311,
+ MODELVIEW = 312,
+ MVP = 313,
+ NORMAL = 314,
+ OBJECT = 315,
+ PALETTE = 316,
+ PARAMS = 317,
+ PLANE = 318,
+ POINT_TOK = 319,
+ POINTSIZE = 320,
+ POSITION = 321,
+ PRIMARY = 322,
+ PROGRAM = 323,
+ PROJECTION = 324,
+ RANGE = 325,
+ RESULT = 326,
+ ROW = 327,
+ SCENECOLOR = 328,
+ SECONDARY = 329,
+ SHININESS = 330,
+ SIZE_TOK = 331,
+ SPECULAR = 332,
+ SPOT = 333,
+ STATE = 334,
+ TEXCOORD = 335,
+ TEXENV = 336,
+ TEXGEN = 337,
+ TEXGEN_Q = 338,
+ TEXGEN_R = 339,
+ TEXGEN_S = 340,
+ TEXGEN_T = 341,
+ TEXTURE = 342,
+ TRANSPOSE = 343,
+ TEXTURE_UNIT = 344,
+ TEX_1D = 345,
+ TEX_2D = 346,
+ TEX_3D = 347,
+ TEX_CUBE = 348,
+ TEX_RECT = 349,
+ TEX_SHADOW1D = 350,
+ TEX_SHADOW2D = 351,
+ TEX_SHADOWRECT = 352,
+ TEX_ARRAY1D = 353,
+ TEX_ARRAY2D = 354,
+ TEX_ARRAYSHADOW1D = 355,
+ TEX_ARRAYSHADOW2D = 356,
+ VERTEX = 357,
+ VTXATTRIB = 358,
+ WEIGHT = 359,
+ IDENTIFIER = 360,
+ USED_IDENTIFIER = 361,
+ MASK4 = 362,
+ MASK3 = 363,
+ MASK2 = 364,
+ MASK1 = 365,
+ SWIZZLE = 366,
+ DOT_DOT = 367,
+ DOT = 368
};
#endif
@@ -157,7 +160,7 @@ typedef union YYSTYPE
{
/* Line 1676 of yacc.c */
-#line 116 "program_parse.y"
+#line 121 "program_parse.y"
struct asm_instruction *inst;
struct asm_symbol *sym;
@@ -186,7 +189,7 @@ typedef union YYSTYPE
/* Line 1676 of yacc.c */
-#line 190 "program_parse.tab.h"
+#line 193 "program_parse.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index ce196493231..f473bd1173b 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -390,6 +390,8 @@ get_shader_flags(void)
flags |= GLSL_OPT;
if (_mesa_strstr(env, "uniform"))
flags |= GLSL_UNIFORMS;
+ if (_mesa_strstr(env, "useprog"))
+ flags |= GLSL_USE_PROG;
}
return flags;
@@ -1524,19 +1526,32 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
}
/* debug code */
- if (0) {
+ if (ctx->Shader.Flags & GLSL_USE_PROG) {
GLuint i;
- _mesa_printf("Use Shader %u\n", shProg->Name);
+ _mesa_printf("Mesa: glUseProgram(%u)\n", shProg->Name);
for (i = 0; i < shProg->NumShaders; i++) {
- _mesa_printf(" shader %u, type 0x%x, checksum %u\n",
+ const char *s;
+ switch (shProg->Shaders[i]->Type) {
+ case GL_VERTEX_SHADER:
+ s = "vertex";
+ break;
+ case GL_FRAGMENT_SHADER:
+ s = "fragment";
+ break;
+ case GL_GEOMETRY_SHADER:
+ s = "geometry";
+ break;
+ default:
+ s = "";
+ }
+ _mesa_printf(" %s shader %u, checksum %u\n", s,
shProg->Shaders[i]->Name,
- shProg->Shaders[i]->Type,
shProg->Shaders[i]->SourceChecksum);
}
if (shProg->VertexProgram)
- printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
+ _mesa_printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
if (shProg->FragmentProgram)
- printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
+ _mesa_printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
}
}
else {
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index 5209a6a0c9c..e18c0f6e0a1 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -39,6 +39,7 @@
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
#include "cso_cache/cso_context.h"
+#include "util/u_rect.h"
@@ -162,10 +163,17 @@ update_framebuffer_state( struct st_context *st )
(void) st_get_framebuffer_surface(stfb, ST_SURFACE_FRONT_LEFT, &surf_front);
(void) st_get_framebuffer_surface(stfb, ST_SURFACE_BACK_LEFT, &surf_back);
- st->pipe->surface_copy(st->pipe,
- surf_front, 0, 0, /* dest */
- surf_back, 0, 0, /* src */
- fb->Width, fb->Height);
+ if (st->pipe->surface_copy) {
+ st->pipe->surface_copy(st->pipe,
+ surf_front, 0, 0, /* dest */
+ surf_back, 0, 0, /* src */
+ fb->Width, fb->Height);
+ } else {
+ util_surface_copy(st->pipe, FALSE,
+ surf_front, 0, 0,
+ surf_back, 0, 0,
+ fb->Width, fb->Height);
+ }
}
/* we're assuming we'll really draw to the front buffer */
st->frontbuffer_status = FRONT_STATUS_DIRTY;
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 5c3413f9056..be445771175 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -62,6 +62,7 @@
#include "util/u_tile.h"
#include "util/u_draw_quad.h"
#include "util/u_math.h"
+#include "util/u_rect.h"
#include "shader/prog_instruction.h"
#include "cso_cache/cso_context.h"
@@ -1075,11 +1076,19 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
PIPE_BUFFER_USAGE_GPU_READ);
struct pipe_surface *psTex = screen->get_tex_surface(screen, pt, 0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE );
- pipe->surface_copy(pipe,
- psTex, /* dest */
- 0, 0, /* destx/y */
- psRead,
- srcx, srcy, width, height);
+ if (pipe->surface_copy) {
+ pipe->surface_copy(pipe,
+ psTex, /* dest */
+ 0, 0, /* destx/y */
+ psRead,
+ srcx, srcy, width, height);
+ } else {
+ util_surface_copy(pipe, FALSE,
+ psTex,
+ 0, 0,
+ psRead,
+ srcx, srcy, width, height);
+ }
pipe_surface_reference(&psRead, NULL);
pipe_surface_reference(&psTex, NULL);
}
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 864f5d3ca3f..73aa65955ba 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -49,6 +49,7 @@
#include "st_public.h"
#include "st_texture.h"
+#include "util/u_rect.h"
/**
@@ -538,10 +539,17 @@ copy_back_to_front(struct st_context *st,
(void) st_get_framebuffer_surface(stfb, backIndex, &surf_back);
if (surf_front && surf_back) {
- st->pipe->surface_copy(st->pipe,
- surf_front, 0, 0, /* dest */
- surf_back, 0, 0, /* src */
- fb->Width, fb->Height);
+ if (st->pipe->surface_copy) {
+ st->pipe->surface_copy(st->pipe,
+ surf_front, 0, 0, /* dest */
+ surf_back, 0, 0, /* src */
+ fb->Width, fb->Height);
+ } else {
+ util_surface_copy(st->pipe, FALSE,
+ surf_front, 0, 0,
+ surf_back, 0, 0,
+ fb->Width, fb->Height);
+ }
}
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index b9437871063..a1953342b41 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1546,7 +1546,8 @@ st_copy_texsubimage(GLcontext *ctx,
if (ctx->_ImageTransferState == 0x0) {
- if (matching_base_formats &&
+ if (pipe->surface_copy &&
+ matching_base_formats &&
src_format == dest_format &&
!do_flip)
{
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index ca4edcfcb9b..6137c2d2fe5 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -207,7 +207,6 @@ struct vertex_buffer
GLvector4f *EyePtr; /* _TNL_BIT_POS */
GLvector4f *ClipPtr; /* _TNL_BIT_POS */
GLvector4f *NdcPtr; /* _TNL_BIT_POS */
- GLfloat *ClipDistancePtr[MAX_CLIP_PLANES]; /* _TNL_BIT_POS */
GLubyte ClipOrMask; /* _TNL_BIT_POS */
GLubyte ClipAndMask; /* _TNL_BIT_POS */
GLubyte *ClipMask; /* _TNL_BIT_POS */
diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h
index 0d2183a9e67..618b8b31304 100644
--- a/src/mesa/tnl/t_vb_cliptmp.h
+++ b/src/mesa/tnl/t_vb_cliptmp.h
@@ -80,58 +80,6 @@ do { \
} while (0)
-#define POLY_USERCLIP(PLANE) \
-do { \
- if (mask & CLIP_USER_BIT) { \
- GLuint idxPrev = inlist[0]; \
- GLfloat dpPrev = VB->ClipDistancePtr[PLANE][idxPrev]; \
- GLuint outcount = 0; \
- GLuint i; \
- \
- inlist[n] = inlist[0]; /* prevent rotation of vertices */ \
- for (i = 1; i <= n; i++) { \
- GLuint idx = inlist[i]; \
- GLfloat dp = VB->ClipDistancePtr[PLANE][idx]; \
- \
- if (!IS_NEGATIVE(dpPrev)) { \
- outlist[outcount++] = idxPrev; \
- } \
- \
- if (DIFFERENT_SIGNS(dp, dpPrev)) { \
- if (IS_NEGATIVE(dp)) { \
- /* Going out of bounds. Avoid division by zero as we \
- * know dp != dpPrev from DIFFERENT_SIGNS, above. \
- */ \
- GLfloat t = dp / (dp - dpPrev); \
- INTERP_4F( t, coord[newvert], coord[idx], coord[idxPrev]); \
- interp( ctx, t, newvert, idx, idxPrev, GL_TRUE ); \
- } else { \
- /* Coming back in. \
- */ \
- GLfloat t = dpPrev / (dpPrev - dp); \
- INTERP_4F( t, coord[newvert], coord[idxPrev], coord[idx]); \
- interp( ctx, t, newvert, idxPrev, idx, GL_FALSE ); \
- } \
- outlist[outcount++] = newvert++; \
- } \
- \
- idxPrev = idx; \
- dpPrev = dp; \
- } \
- \
- if (outcount < 3) \
- return; \
- \
- { \
- GLuint *tmp = inlist; \
- inlist = outlist; \
- outlist = tmp; \
- n = outcount; \
- } \
- } \
-} while (0)
-
-
#define LINE_CLIP(PLANE_BIT, A, B, C, D ) \
do { \
if (mask & PLANE_BIT) { \
@@ -163,37 +111,6 @@ do { \
} while (0)
-#define LINE_USERCLIP(PLANE) \
-do { \
- if (mask & CLIP_USER_BIT) { \
- const GLfloat dp0 = VB->ClipDistancePtr[PLANE][v0]; \
- const GLfloat dp1 = VB->ClipDistancePtr[PLANE][v1]; \
- const GLboolean neg_dp0 = IS_NEGATIVE(dp0); \
- const GLboolean neg_dp1 = IS_NEGATIVE(dp1); \
- \
- /* For regular clipping, we know from the clipmask that one \
- * (or both) of these must be negative (otherwise we wouldn't \
- * be here). \
- * For userclip, there is only a single bit for all active \
- * planes, so we can end up here when there is nothing to do, \
- * hence the second IS_NEGATIVE() test: \
- */ \
- if (neg_dp0 && neg_dp1) \
- return; /* both vertices outside clip plane: discard */ \
- \
- if (neg_dp1) { \
- GLfloat t = dp1 / (dp1 - dp0); \
- if (t > t1) t1 = t; \
- } else if (neg_dp0) { \
- GLfloat t = dp0 / (dp0 - dp1); \
- if (t > t0) t0 = t; \
- } \
- if (t0 + t1 >= 1.0) \
- return; /* discard */ \
- } \
-} while (0)
-
-
/* Clip a line against the viewport and user clip planes.
*/
@@ -222,7 +139,11 @@ TAG(clip_line)( GLcontext *ctx, GLuint v0, GLuint v1, GLubyte mask )
if (mask & CLIP_USER_BIT) {
for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
- LINE_USERCLIP(p);
+ const GLfloat a = ctx->Transform._ClipUserPlane[p][0];
+ const GLfloat b = ctx->Transform._ClipUserPlane[p][1];
+ const GLfloat c = ctx->Transform._ClipUserPlane[p][2];
+ const GLfloat d = ctx->Transform._ClipUserPlane[p][3];
+ LINE_CLIP( CLIP_USER_BIT, a, b, c, d );
}
}
}
@@ -307,7 +228,11 @@ TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask )
if (mask & CLIP_USER_BIT) {
for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
- POLY_USERCLIP(p);
+ const GLfloat a = ctx->Transform._ClipUserPlane[p][0];
+ const GLfloat b = ctx->Transform._ClipUserPlane[p][1];
+ const GLfloat c = ctx->Transform._ClipUserPlane[p][2];
+ const GLfloat d = ctx->Transform._ClipUserPlane[p][3];
+ POLY_CLIP( CLIP_USER_BIT, a, b, c, d );
}
}
}
@@ -366,7 +291,11 @@ TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3,
if (mask & CLIP_USER_BIT) {
for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
- POLY_USERCLIP(p);
+ const GLfloat a = ctx->Transform._ClipUserPlane[p][0];
+ const GLfloat b = ctx->Transform._ClipUserPlane[p][1];
+ const GLfloat c = ctx->Transform._ClipUserPlane[p][2];
+ const GLfloat d = ctx->Transform._ClipUserPlane[p][3];
+ POLY_CLIP( CLIP_USER_BIT, a, b, c, d );
}
}
}
@@ -388,6 +317,4 @@ TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3,
#undef SIZE
#undef TAG
#undef POLY_CLIP
-#undef POLY_USERCLIP
#undef LINE_CLIP
-#undef LINE_USERCLIP
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index 5fb83c2b01b..c10a27614ff 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -66,7 +66,6 @@ struct vp_stage_data {
GLvector4f results[VERT_RESULT_MAX];
GLvector4f ndcCoords; /**< normalized device coords */
- GLfloat *clipdistance[MAX_CLIP_PLANES];
GLubyte *clipmask; /**< clip flags */
GLubyte ormask, andmask; /**< for clipping */
};
@@ -78,7 +77,6 @@ struct vp_stage_data {
static void
userclip( GLcontext *ctx,
GLvector4f *clip,
- GLfloat *clipdistance[MAX_CLIP_PLANES],
GLubyte *clipmask,
GLubyte *clipormask,
GLubyte *clipandmask )
@@ -107,8 +105,6 @@ userclip( GLcontext *ctx,
clipmask[i] |= CLIP_USER_BIT;
}
- clipdistance[p][i] = dp;
-
STRIDE_F(coord, stride);
}
@@ -168,7 +164,6 @@ do_ndc_cliptest(GLcontext *ctx, struct vp_stage_data *store)
ctx->VertexProgram.Current->IsPositionInvariant)) {
userclip( ctx,
VB->ClipPtr,
- store->clipdistance,
store->clipmask,
&store->ormask,
&store->andmask );
@@ -176,9 +171,6 @@ do_ndc_cliptest(GLcontext *ctx, struct vp_stage_data *store)
if (store->andmask) {
return GL_FALSE;
}
-
- memcpy(VB->ClipDistancePtr, store->clipdistance,
- sizeof(store->clipdistance));
}
VB->ClipAndMask = store->andmask;
@@ -522,10 +514,6 @@ init_vp(GLcontext *ctx, struct tnl_pipeline_stage *stage)
_mesa_vector4f_alloc( &store->ndcCoords, 0, size, 32 );
store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 );
- for (i = 0; i < MAX_CLIP_PLANES; i++)
- store->clipdistance[i] =
- (GLfloat *) ALIGN_MALLOC(sizeof(GLfloat) * size, 32);
-
return GL_TRUE;
}
@@ -549,9 +537,6 @@ dtr(struct tnl_pipeline_stage *stage)
_mesa_vector4f_free( &store->ndcCoords );
ALIGN_FREE( store->clipmask );
- for (i = 0; i < MAX_CLIP_PLANES; i++)
- ALIGN_FREE(store->clipdistance[i]);
-
FREE( store );
stage->privatePtr = NULL;
}
diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c
index 2a61ff11779..4734754ea40 100644
--- a/src/mesa/tnl/t_vb_vertex.c
+++ b/src/mesa/tnl/t_vb_vertex.c
@@ -44,7 +44,6 @@ struct vertex_stage_data {
GLvector4f eye;
GLvector4f clip;
GLvector4f proj;
- GLfloat *clipdistance[MAX_CLIP_PLANES];
GLubyte *clipmask;
GLubyte ormask;
GLubyte andmask;
@@ -57,12 +56,11 @@ struct vertex_stage_data {
/* This function implements cliptesting for user-defined clip planes.
* The clipping of primitives to these planes is implemented in
- * t_vp_cliptmp.h.
+ * t_render_clip.h.
*/
#define USER_CLIPTEST(NAME, SZ) \
static void NAME( GLcontext *ctx, \
GLvector4f *clip, \
- GLfloat *clipdistances[MAX_CLIP_PLANES], \
GLubyte *clipmask, \
GLubyte *clipormask, \
GLubyte *clipandmask ) \
@@ -90,8 +88,6 @@ static void NAME( GLcontext *ctx, \
clipmask[i] |= CLIP_USER_BIT; \
} \
\
- clipdistances[p][i] = dp; \
- \
STRIDE_F(coord, stride); \
} \
\
@@ -111,9 +107,8 @@ USER_CLIPTEST(userclip3, 3)
USER_CLIPTEST(userclip4, 4)
static void (*(usercliptab[5]))( GLcontext *,
- GLvector4f *,
- GLfloat *[MAX_CLIP_PLANES],
- GLubyte *, GLubyte *, GLubyte * ) =
+ GLvector4f *, GLubyte *,
+ GLubyte *, GLubyte * ) =
{
NULL,
NULL,
@@ -219,16 +214,12 @@ static GLboolean run_vertex_stage( GLcontext *ctx,
if (ctx->Transform.ClipPlanesEnabled) {
usercliptab[VB->ClipPtr->size]( ctx,
VB->ClipPtr,
- store->clipdistance,
store->clipmask,
&store->ormask,
&store->andmask );
if (store->andmask)
return GL_FALSE;
-
- memcpy(VB->ClipDistancePtr, store->clipdistance,
- sizeof(store->clipdistance));
}
VB->ClipAndMask = store->andmask;
@@ -245,7 +236,6 @@ static GLboolean init_vertex_stage( GLcontext *ctx,
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
struct vertex_stage_data *store;
GLuint size = VB->Size;
- unsigned i;
stage->privatePtr = CALLOC(sizeof(*store));
store = VERTEX_STAGE_DATA(stage);
@@ -257,17 +247,8 @@ static GLboolean init_vertex_stage( GLcontext *ctx,
_mesa_vector4f_alloc( &store->proj, 0, size, 32 );
store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 );
- for (i = 0; i < MAX_CLIP_PLANES; i++)
- store->clipdistance[i] =
- (GLfloat *) ALIGN_MALLOC(sizeof(GLfloat) * size, 32);
if (!store->clipmask ||
- !store->clipdistance[0] ||
- !store->clipdistance[1] ||
- !store->clipdistance[2] ||
- !store->clipdistance[3] ||
- !store->clipdistance[4] ||
- !store->clipdistance[5] ||
!store->eye.data ||
!store->clip.data ||
!store->proj.data)
@@ -281,16 +262,10 @@ static void dtr( struct tnl_pipeline_stage *stage )
struct vertex_stage_data *store = VERTEX_STAGE_DATA(stage);
if (store) {
- unsigned i;
-
_mesa_vector4f_free( &store->eye );
_mesa_vector4f_free( &store->clip );
_mesa_vector4f_free( &store->proj );
ALIGN_FREE( store->clipmask );
-
- for (i = 0; i < MAX_CLIP_PLANES; i++)
- ALIGN_FREE(store->clipdistance[i]);
-
FREE(store);
stage->privatePtr = NULL;
stage->run = init_vertex_stage;
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index bfa6d76886a..f88df5aac79 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -57,7 +57,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
static void reset_attrfv( struct vbo_exec_context *exec );
-/* Close off the last primitive, execute the buffer, restart the
+/**
+ * Close off the last primitive, execute the buffer, restart the
* primitive.
*/
static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec )
@@ -106,7 +107,8 @@ static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec )
}
-/* Deal with buffer wrapping where provoked by the vertex buffer
+/**
+ * Deal with buffer wrapping where provoked by the vertex buffer
* filling up, as opposed to upgrade_vertex().
*/
void vbo_exec_vtx_wrap( struct vbo_exec_context *exec )
@@ -135,7 +137,7 @@ void vbo_exec_vtx_wrap( struct vbo_exec_context *exec )
}
-/*
+/**
* Copy the active vertex's values to the ctx->Current fields.
*/
static void vbo_exec_copy_to_current( struct vbo_exec_context *exec )
@@ -208,7 +210,8 @@ static void vbo_exec_copy_from_current( struct vbo_exec_context *exec )
}
-/* Flush existing data, set new attrib size, replay copied vertices.
+/**
+ * Flush existing data, set new attrib size, replay copied vertices.
*/
static void vbo_exec_wrap_upgrade_vertex( struct vbo_exec_context *exec,
GLuint attr,
@@ -392,8 +395,7 @@ do { \
#if FEATURE_evaluators
-/* Eval
- */
+
static void GLAPIENTRY vbo_exec_EvalCoord1f( GLfloat u )
{
GET_CURRENT_CONTEXT( ctx );
@@ -492,8 +494,8 @@ static void GLAPIENTRY vbo_exec_EvalPoint2( GLint i, GLint j )
#endif /* FEATURE_evaluators */
-/* Build a list of primitives on the fly. Keep
- * ctx->Driver.CurrentExecPrimitive uptodate as well.
+/**
+ * Called via glBegin.
*/
static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
{
@@ -537,6 +539,10 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
}
+
+/**
+ * Called via glEnd.
+ */
static void GLAPIENTRY vbo_exec_End( void )
{
GET_CURRENT_CONTEXT( ctx );
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 774cffc451b..fd70b57b72e 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -33,6 +33,7 @@
#include "main/api_noop.h"
#include "main/varray.h"
#include "main/bufferobj.h"
+#include "main/enums.h"
#include "main/macros.h"
#include "glapi/dispatch.h"
@@ -53,10 +54,9 @@ vbo_get_minmax_index(GLcontext *ctx,
const void *indices;
if (_mesa_is_bufferobj(ib->obj)) {
- const GLvoid *map = ctx->Driver.MapBuffer(ctx,
- GL_ELEMENT_ARRAY_BUFFER_ARB,
- GL_READ_ONLY,
- ib->obj);
+ const GLvoid *map =
+ ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB,
+ GL_READ_ONLY, ib->obj);
indices = ADD_POINTERS(map, ib->ptr);
} else {
indices = ib->ptr;
@@ -105,9 +105,7 @@ vbo_get_minmax_index(GLcontext *ctx,
}
if (_mesa_is_bufferobj(ib->obj)) {
- ctx->Driver.UnmapBuffer(ctx,
- GL_ELEMENT_ARRAY_BUFFER_ARB,
- ib->obj);
+ ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, ib->obj);
}
}
@@ -125,10 +123,9 @@ check_array_data(GLcontext *ctx, struct gl_client_array *array,
if (_mesa_is_bufferobj(array->BufferObj)) {
if (!array->BufferObj->Pointer) {
/* need to map now */
- array->BufferObj->Pointer = ctx->Driver.MapBuffer(ctx,
- GL_ARRAY_BUFFER_ARB,
- GL_READ_ONLY,
- array->BufferObj);
+ array->BufferObj->Pointer =
+ ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB,
+ GL_READ_ONLY, array->BufferObj);
}
data = ADD_POINTERS(data, array->BufferObj->Pointer);
}
@@ -169,9 +166,7 @@ unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array)
if (array->Enabled &&
_mesa_is_bufferobj(array->BufferObj) &&
_mesa_bufferobj_mapped(array->BufferObj)) {
- ctx->Driver.UnmapBuffer(ctx,
- GL_ARRAY_BUFFER_ARB,
- array->BufferObj);
+ ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, array->BufferObj);
}
}
@@ -222,13 +217,13 @@ check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType,
check_array_data(ctx, &arrayObj->TexCoord[k], VERT_ATTRIB_TEX0 + k, j);
}
for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) {
- check_array_data(ctx, &arrayObj->VertexAttrib[k], VERT_ATTRIB_GENERIC0 + k, j);
+ check_array_data(ctx, &arrayObj->VertexAttrib[k],
+ VERT_ATTRIB_GENERIC0 + k, j);
}
}
if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
- ctx->Driver.UnmapBuffer(ctx,
- GL_ELEMENT_ARRAY_BUFFER_ARB,
+ ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB,
ctx->Array.ElementArrayBufferObj);
}
@@ -459,7 +454,6 @@ bind_arrays(GLcontext *ctx)
}
else if (exec->array.program_mode != get_program_mode(ctx) ||
exec->array.enabled_flags != ctx->Array.ArrayObj->_Enabled) {
-
recalculate_input_bindings(ctx);
}
#else
@@ -482,6 +476,10 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
struct vbo_exec_context *exec = &vbo->exec;
struct _mesa_prim prim[1];
+ if (MESA_VERBOSE & VERBOSE_DRAW)
+ _mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n",
+ _mesa_lookup_enum_by_nr(mode), start, count);
+
if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
return;
@@ -582,11 +580,11 @@ dump_element_buffer(GLcontext *ctx, GLenum type)
;
}
- ctx->Driver.UnmapBuffer(ctx,
- GL_ELEMENT_ARRAY_BUFFER_ARB,
+ ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB,
ctx->Array.ElementArrayBufferObj);
}
+
/* Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */
static void
vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode,
@@ -675,6 +673,12 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
static GLuint warnCount = 0;
GET_CURRENT_CONTEXT(ctx);
+ if (MESA_VERBOSE & VERBOSE_DRAW)
+ _mesa_debug(ctx,
+ "glDrawRangeElementsBaseVertex(%s, %u, %u, %d, %s, %p, %d)\n",
+ _mesa_lookup_enum_by_nr(mode), start, end, count,
+ _mesa_lookup_enum_by_nr(type), indices, basevertex);
+
if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
type, indices, basevertex ))
return;
@@ -755,12 +759,19 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
count, type, indices, basevertex);
}
+
static void GLAPIENTRY
-vbo_exec_DrawRangeElements(GLenum mode,
- GLuint start, GLuint end,
- GLsizei count, GLenum type,
- const GLvoid *indices)
+vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end,
+ GLsizei count, GLenum type, const GLvoid *indices)
{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_DRAW)
+ _mesa_debug(ctx,
+ "glDrawRangeElements(%s, %u, %u, %d, %s, %p)\n",
+ _mesa_lookup_enum_by_nr(mode), start, end, count,
+ _mesa_lookup_enum_by_nr(type), indices);
+
vbo_exec_DrawRangeElementsBaseVertex(mode, start, end, count, type,
indices, 0);
}
@@ -772,6 +783,11 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
{
GET_CURRENT_CONTEXT(ctx);
+ if (MESA_VERBOSE & VERBOSE_DRAW)
+ _mesa_debug(ctx, "glDrawElements(%s, %u, %s, %p)\n",
+ _mesa_lookup_enum_by_nr(mode), count,
+ _mesa_lookup_enum_by_nr(type), indices);
+
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 ))
return;
@@ -779,12 +795,18 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
count, type, indices, 0);
}
+
static void GLAPIENTRY
vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
{
GET_CURRENT_CONTEXT(ctx);
+ if (MESA_VERBOSE & VERBOSE_DRAW)
+ _mesa_debug(ctx, "glDrawElementsBaseVertex(%s, %d, %s, %p, %d)\n",
+ _mesa_lookup_enum_by_nr(mode), count,
+ _mesa_lookup_enum_by_nr(type), indices, basevertex);
+
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices,
basevertex ))
return;
@@ -793,7 +815,8 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
count, type, indices, basevertex);
}
-/* Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */
+
+/** Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */
static void
vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode,
const GLsizei *count, GLenum type,
@@ -928,6 +951,7 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode,
_mesa_free(prim);
}
+
static void GLAPIENTRY
vbo_exec_MultiDrawElements(GLenum mode,
const GLsizei *count, GLenum type,
@@ -949,6 +973,7 @@ vbo_exec_MultiDrawElements(GLenum mode,
NULL);
}
+
static void GLAPIENTRY
vbo_exec_MultiDrawElementsBaseVertex(GLenum mode,
const GLsizei *count, GLenum type,
@@ -1038,6 +1063,7 @@ _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
vbo_exec_DrawRangeElements(mode, start, end, count, type, indices);
}
+
void GLAPIENTRY
_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
GLsizei count, GLenum type,
@@ -1047,6 +1073,7 @@ _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
indices, basevertex);
}
+
/* GL_EXT_multi_draw_arrays */
void GLAPIENTRY
_mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type,
@@ -1055,6 +1082,7 @@ _mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type,
vbo_exec_MultiDrawElements(mode, count, type, indices, primcount);
}
+
void GLAPIENTRY
_mesa_MultiDrawElementsBaseVertex(GLenum mode,
const GLsizei *count, GLenum type,