summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-03-02 13:27:46 +0000
committerJosé Fonseca <jfonseca@vmware.com>2009-03-02 13:27:46 +0000
commit97a1fd158c9acfaa3a8deda7eb5bf0b253e85c15 (patch)
tree37e6c11507c1ef044aa8f0ee009136bb1d8b5bbc
parent60e5fe65067da76dea816535bec1e9073adc0ba7 (diff)
parentb70f344e223fc10df8df08a6d82a813505225712 (diff)
Merge commit 'origin/master' into gallium-map-range
-rw-r--r--Makefile49
-rw-r--r--configs/autoconf.in1
-rw-r--r--configs/default1
-rw-r--r--configure.ac28
-rw-r--r--docs/relnotes-7.5.html1
-rw-r--r--include/EGL/eglplatform.h2
-rw-r--r--progs/demos/arbfplight.c1
-rw-r--r--progs/demos/arbfslight.c1
-rw-r--r--progs/demos/fslight.c1
-rw-r--r--progs/demos/gearbox.c1
-rw-r--r--progs/demos/gears.c1
-rw-r--r--progs/demos/geartrain.c1
-rw-r--r--progs/demos/gloss.c1
-rw-r--r--progs/demos/glslnoise.c1
-rw-r--r--progs/demos/reflect.c1
-rw-r--r--progs/demos/streaming_rect.c1
-rw-r--r--progs/demos/texcyl.c1
-rw-r--r--progs/glsl/Makefile1
-rw-r--r--progs/glsl/shadow_sampler.c341
-rw-r--r--progs/tests/Makefile1
-rw-r--r--progs/tests/bufferobj.c89
-rw-r--r--progs/tests/fbotexture.c31
-rw-r--r--progs/tests/mapvbo.c138
-rw-r--r--progs/trivial/.gitignore1
-rw-r--r--progs/trivial/Makefile1
-rw-r--r--progs/trivial/SConscript1
-rw-r--r--progs/trivial/tri-viewport.c129
-rw-r--r--progs/trivial/tri.c86
-rw-r--r--src/egl/main/Makefile5
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c4
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr.h5
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c16
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_execmem.c10
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_dump.c8
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_sanity.c30
-rw-r--r--src/gallium/auxiliary/util/u_debug_memory.c6
-rw-r--r--src/gallium/auxiliary/util/u_draw_quad.c2
-rw-r--r--src/gallium/auxiliary/util/u_stream_stdc.c2
-rw-r--r--src/gallium/auxiliary/util/u_time.c12
-rw-r--r--src/gallium/auxiliary/util/u_time.h6
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.h6
-rw-r--r--src/gallium/drivers/cell/ppu/cell_fence.c12
-rw-r--r--src/gallium/drivers/cell/ppu/cell_pipe_state.c54
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_emit.c18
-rw-r--r--src/gallium/drivers/cell/ppu/cell_texture.c332
-rw-r--r--src/gallium/drivers/cell/ppu/cell_texture.h17
-rw-r--r--src/gallium/drivers/i915simple/i915_screen.c1
-rw-r--r--src/gallium/drivers/i915simple/i915_screen.h4
-rw-r--r--src/gallium/drivers/i915simple/i915_state_emit.c2
-rw-r--r--src/gallium/drivers/i915simple/i915_texture.c18
-rw-r--r--src/gallium/drivers/i915simple/i915_winsys.h42
-rw-r--r--src/gallium/drivers/nv04/Makefile1
-rw-r--r--src/gallium/drivers/nv04/nv04_miptree.c47
-rw-r--r--src/gallium/drivers/nv04/nv04_screen.c26
-rw-r--r--src/gallium/drivers/nv04/nv04_screen.h3
-rw-r--r--src/gallium/drivers/nv04/nv04_state.h3
-rw-r--r--src/gallium/drivers/nv04/nv04_state_emit.c17
-rw-r--r--src/gallium/drivers/nv04/nv04_surface_2d.c43
-rw-r--r--src/gallium/drivers/nv04/nv04_surface_2d.h5
-rw-r--r--src/gallium/drivers/nv04/nv04_transfer.c201
-rw-r--r--src/gallium/drivers/nv10/Makefile1
-rw-r--r--src/gallium/drivers/nv10/nv10_miptree.c33
-rw-r--r--src/gallium/drivers/nv10/nv10_screen.c28
-rw-r--r--src/gallium/drivers/nv10/nv10_screen.h4
-rw-r--r--src/gallium/drivers/nv10/nv10_state_emit.c14
-rw-r--r--src/gallium/drivers/nv10/nv10_transfer.c201
-rw-r--r--src/gallium/drivers/nv20/Makefile1
-rw-r--r--src/gallium/drivers/nv20/nv20_miptree.c69
-rw-r--r--src/gallium/drivers/nv20/nv20_screen.c28
-rw-r--r--src/gallium/drivers/nv20/nv20_screen.h4
-rw-r--r--src/gallium/drivers/nv20/nv20_state_emit.c14
-rw-r--r--src/gallium/drivers/nv20/nv20_transfer.c201
-rw-r--r--src/gallium/drivers/nv30/Makefile1
-rw-r--r--src/gallium/drivers/nv30/nv30_miptree.c56
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c80
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.h3
-rw-r--r--src/gallium/drivers/nv30/nv30_state.h3
-rw-r--r--src/gallium/drivers/nv30/nv30_state_fb.c28
-rw-r--r--src/gallium/drivers/nv30/nv30_transfer.c201
-rw-r--r--src/gallium/drivers/nv40/Makefile1
-rw-r--r--src/gallium/drivers/nv40/nv40_miptree.c47
-rw-r--r--src/gallium/drivers/nv40/nv40_screen.c83
-rw-r--r--src/gallium/drivers/nv40/nv40_screen.h3
-rw-r--r--src/gallium/drivers/nv40/nv40_state.h3
-rw-r--r--src/gallium/drivers/nv40/nv40_state_fb.c40
-rw-r--r--src/gallium/drivers/nv40/nv40_transfer.c201
-rw-r--r--src/gallium/drivers/r300/Makefile1
-rw-r--r--src/gallium/drivers/r300/r300_chipset.c9
-rw-r--r--src/gallium/drivers/r300/r300_chipset.h1
-rw-r--r--src/gallium/drivers/r300/r300_context.c4
-rw-r--r--src/gallium/drivers/r300/r300_context.h22
-rw-r--r--src/gallium/drivers/r300/r300_emit.c53
-rw-r--r--src/gallium/drivers/r300/r300_reg.h10
-rw-r--r--src/gallium/drivers/r300/r300_screen.c18
-rw-r--r--src/gallium/drivers/r300/r300_state.c320
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c145
-rw-r--r--src/gallium/drivers/r300/r300_state_inlines.h342
-rw-r--r--src/gallium/drivers/r300/r300_state_invariant.c54
-rw-r--r--src/gallium/drivers/r300/r300_state_invariant.h33
-rw-r--r--src/gallium/drivers/r300/r300_surface.c54
-rw-r--r--src/gallium/drivers/r300/r300_surface.h12
-rw-r--r--src/gallium/drivers/r300/r300_swtcl_emit.c16
-rw-r--r--src/gallium/drivers/r300/r300_texture.c3
-rw-r--r--src/gallium/drivers/softpipe/sp_prim_vbuf.c33
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c26
-rw-r--r--src/gallium/drivers/trace/tr_dump.c4
-rw-r--r--src/gallium/include/pipe/p_config.h8
-rw-r--r--src/gallium/include/pipe/p_thread.h10
-rw-r--r--src/gallium/include/state_tracker/drm_api.h22
-rw-r--r--src/gallium/state_trackers/egl/Makefile5
-rw-r--r--src/gallium/state_trackers/egl/egl_surface.c2
-rw-r--r--src/gallium/state_trackers/wgl/icd/stw_icd.c44
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_api.c5
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_device.c43
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_device.h21
-rw-r--r--src/gallium/winsys/drm/radeon/Makefile1
-rw-r--r--src/gallium/winsys/drm/radeon/radeon_drm.c30
-rw-r--r--src/gallium/winsys/drm/radeon/radeon_drm.h35
-rw-r--r--src/gallium/winsys/g3dvl/xsp_winsys.c17
-rw-r--r--src/gallium/winsys/xlib/xlib_cell.c3
-rw-r--r--src/glx/x11/glxext.c86
-rw-r--r--src/mesa/drivers/dri/i915/i915_fragprog.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_line.c66
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_tri.c76
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h8
-rw-r--r--src/mesa/drivers/dri/i965/brw_curbe.c16
-rw-r--r--src/mesa/drivers/dri/i965/brw_defines.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c34
-rw-r--r--src/mesa/drivers/dri/i965/brw_misc_state.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_state.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_structs.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vtbl.c22
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_fp.c63
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_glsl.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_pass0.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_state.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c10
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffer_objects.c16
-rw-r--r--src/mesa/drivers/dri/intel/intel_chipset.h11
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_depthtmp.h54
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c61
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c32
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c255
-rw-r--r--src/mesa/drivers/dri/intel/intel_spantmp.h61
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_format.c15
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog.c4
-rw-r--r--src/mesa/drivers/dri/r300/r500_fragprog.c4
-rw-r--r--src/mesa/drivers/dri/r300/radeon_nqssadce.c2
-rw-r--r--src/mesa/drivers/dri/r300/radeon_program_pair.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_chipset.h4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c10
-rw-r--r--src/mesa/glapi/glX_proto_recv.py2
-rw-r--r--src/mesa/glapi/gl_SPARC_asm.py228
-rw-r--r--src/mesa/glapi/glapi.c131
-rw-r--r--src/mesa/glapi/glapi_getproc.c78
-rw-r--r--src/mesa/main/attrib.c96
-rw-r--r--src/mesa/main/bufferobj.c60
-rw-r--r--src/mesa/main/context.c35
-rw-r--r--src/mesa/main/drawpix.c8
-rw-r--r--src/mesa/main/fbobject.c19
-rw-r--r--src/mesa/main/feedback.c101
-rw-r--r--src/mesa/main/feedback.h41
-rw-r--r--src/mesa/main/glheader.h2
-rw-r--r--src/mesa/main/imports.h10
-rw-r--r--src/mesa/main/mtypes.h422
-rw-r--r--src/mesa/main/texenvprogram.c6
-rw-r--r--src/mesa/main/texstate.c3
-rw-r--r--src/mesa/main/version.h4
-rw-r--r--src/mesa/math/m_debug_util.h4
-rw-r--r--src/mesa/shader/arbprogparse.c4
-rw-r--r--src/mesa/shader/nvfragparse.c40
-rw-r--r--src/mesa/shader/nvfragparse.h5
-rw-r--r--src/mesa/shader/prog_debug.c12
-rw-r--r--src/mesa/shader/prog_instruction.h11
-rw-r--r--src/mesa/shader/prog_print.c13
-rw-r--r--src/mesa/shader/program.c6
-rw-r--r--src/mesa/shader/programopt.c6
-rw-r--r--src/mesa/shader/slang/slang_builtin.c2
-rw-r--r--src/mesa/shader/slang/slang_codegen.c4
-rw-r--r--src/mesa/shader/slang/slang_link.c2
-rw-r--r--src/mesa/sources.mak17
-rw-r--r--src/mesa/sparc/clip.S29
-rw-r--r--src/mesa/sparc/glapi_sparc.S1645
-rw-r--r--src/mesa/sparc/norm.S25
-rw-r--r--src/mesa/sparc/sparc.c37
-rw-r--r--src/mesa/sparc/sparc.h1
-rw-r--r--src/mesa/state_tracker/st_atom_depth.c2
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c4
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c14
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c10
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c20
-rw-r--r--src/mesa/state_tracker/st_cb_feedback.c10
-rw-r--r--src/mesa/state_tracker/st_program.c10
-rw-r--r--src/mesa/swrast/s_context.c2
-rw-r--r--src/mesa/swrast/s_context.h28
-rw-r--r--src/mesa/swrast/s_feedback.c8
-rw-r--r--src/mesa/swrast/s_fragprog.c12
-rw-r--r--src/mesa/swrast/swrast.h6
-rw-r--r--src/mesa/tnl/t_context.c11
-rw-r--r--src/mesa/tnl/t_context.h1
-rw-r--r--src/mesa/tnl_dd/t_dd_vb.c3
204 files changed, 5223 insertions, 3595 deletions
diff --git a/Makefile b/Makefile
index c79fb1cb28..dbc1f807b6 100644
--- a/Makefile
+++ b/Makefile
@@ -190,8 +190,6 @@ MAIN_FILES = \
$(DIRECTORY)/configure.ac \
$(DIRECTORY)/acinclude.m4 \
$(DIRECTORY)/aclocal.m4 \
- $(DIRECTORY)/descrip.mms \
- $(DIRECTORY)/mms-config. \
$(DIRECTORY)/bin/config.guess \
$(DIRECTORY)/bin/config.sub \
$(DIRECTORY)/bin/install-sh \
@@ -223,9 +221,8 @@ MAIN_FILES = \
$(DIRECTORY)/include/GL/vms_x_fix.h \
$(DIRECTORY)/include/GL/wmesa.h \
$(DIRECTORY)/src/Makefile \
- $(DIRECTORY)/src/descrip.mms \
$(DIRECTORY)/src/mesa/Makefile* \
- $(DIRECTORY)/src/mesa/sources \
+ $(DIRECTORY)/src/mesa/sources.mak \
$(DIRECTORY)/src/mesa/descrip.mms \
$(DIRECTORY)/src/mesa/gl.pc.in \
$(DIRECTORY)/src/mesa/osmesa.pc.in \
@@ -233,13 +230,11 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/main/*.[chS] \
$(DIRECTORY)/src/mesa/main/descrip.mms \
$(DIRECTORY)/src/mesa/glapi/*.[chS] \
- $(DIRECTORY)/src/mesa/glapi/descrip.mms \
$(DIRECTORY)/src/mesa/math/*.[ch] \
$(DIRECTORY)/src/mesa/math/descrip.mms \
$(DIRECTORY)/src/mesa/shader/*.[ch] \
$(DIRECTORY)/src/mesa/shader/descrip.mms \
$(DIRECTORY)/src/mesa/shader/grammar/*.[ch] \
- $(DIRECTORY)/src/mesa/shader/grammar/descrip.mms \
$(DIRECTORY)/src/mesa/shader/slang/*.[ch] \
$(DIRECTORY)/src/mesa/shader/slang/descrip.mms \
$(DIRECTORY)/src/mesa/shader/slang/library/*.[ch] \
@@ -300,11 +295,36 @@ MAIN_FILES = \
$(DIRECTORY)/progs/util/README \
$(DIRECTORY)/progs/util/*.[ch] \
$(DIRECTORY)/progs/util/sampleMakefile \
- $(DIRECTORY)/vms/analyze_map.com \
- $(DIRECTORY)/vms/xlib.opt \
- $(DIRECTORY)/vms/xlib_share.opt \
$(DIRECTORY)/windows/VC8/
+EGL_FILES = \
+ $(DIRECTORY)/include/EGL/*.h \
+ $(DIRECTORY)/include/GLES/*.h \
+ $(DIRECTORY)/include/GLES2/*.h \
+ $(DIRECTORY)/src/egl/Makefile \
+ $(DIRECTORY)/src/egl/*/Makefile \
+ $(DIRECTORY)/src/egl/*/*.[ch] \
+ $(DIRECTORY)/src/egl/*/*/Makefile \
+ $(DIRECTORY)/src/egl/*/*/*.[ch] \
+
+GALLIUM_FILES = \
+ $(DIRECTORY)/src/mesa/state_tracker/*[ch] \
+ $(DIRECTORY)/src/gallium/Makefile \
+ $(DIRECTORY)/src/gallium/Makefile.template \
+ $(DIRECTORY)/src/gallium/SConscript \
+ $(DIRECTORY)/src/gallium/*/Makefile \
+ $(DIRECTORY)/src/gallium/*/SConscript \
+ $(DIRECTORY)/src/gallium/*/*/Makefile \
+ $(DIRECTORY)/src/gallium/*/*/Makefile.template \
+ $(DIRECTORY)/src/gallium/*/*/SConscript \
+ $(DIRECTORY)/src/gallium/*/*/*.[ch] \
+ $(DIRECTORY)/src/gallium/*/*/*.py \
+ $(DIRECTORY)/src/gallium/*/*/*/Makefile \
+ $(DIRECTORY)/src/gallium/*/*/*/SConscript \
+ $(DIRECTORY)/src/gallium/*/*/*/*.[ch] \
+ $(DIRECTORY)/src/gallium/*/*/*/*.py \
+ $(DIRECTORY)/src/gallium/*/*/*/*/*.[ch] \
+
DRI_FILES = \
$(DIRECTORY)/include/GL/internal/dri_interface.h \
@@ -325,15 +345,12 @@ DRI_FILES = \
SGI_GLU_FILES = \
$(DIRECTORY)/src/glu/Makefile \
- $(DIRECTORY)/src/glu/descrip.mms \
$(DIRECTORY)/src/glu/glu.pc.in \
$(DIRECTORY)/src/glu/sgi/Makefile \
$(DIRECTORY)/src/glu/sgi/Makefile.mgw \
$(DIRECTORY)/src/glu/sgi/Makefile.win \
- $(DIRECTORY)/src/glu/sgi/Makefile.DJ \
$(DIRECTORY)/src/glu/sgi/glu.def \
$(DIRECTORY)/src/glu/sgi/dummy.cc \
- $(DIRECTORY)/src/glu/sgi/descrip.mms \
$(DIRECTORY)/src/glu/sgi/glu.exports \
$(DIRECTORY)/src/glu/sgi/glu.exports.darwin \
$(DIRECTORY)/src/glu/sgi/mesaglu.opt \
@@ -438,7 +455,13 @@ DEPEND_FILES = \
$(TOP)/src/glu/sgi/depend
-LIB_FILES = $(MAIN_FILES) $(DRI_FILES) $(SGI_GLU_FILES) $(GLW_FILES)
+LIB_FILES = \
+ $(MAIN_FILES) \
+ $(EGL_FILES) \
+ $(GALLIUM_FILES) \
+ $(DRI_FILES) \
+ $(SGI_GLU_FILES) \
+ $(GLW_FILES)
# Everything for new a Mesa release:
diff --git a/configs/autoconf.in b/configs/autoconf.in
index af66d58a6d..e034431618 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -90,6 +90,7 @@ MOTIF_CFLAGS = @MOTIF_CFLAGS@
GL_LIB_DEPS = $(EXTRA_LIB_PATH) @GL_LIB_DEPS@
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \
$(EXTRA_LIB_PATH) @OSMESA_LIB_DEPS@
+EGL_LIB_DEPS = $(EXTRA_LIB_PATH) @EGL_LIB_DEPS@
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLU_MESA_DEPS@ \
$(EXTRA_LIB_PATH) @GLU_LIB_DEPS@
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLUT_MESA_DEPS@ \
diff --git a/configs/default b/configs/default
index 920f963b58..4eecd9cd52 100644
--- a/configs/default
+++ b/configs/default
@@ -102,6 +102,7 @@ GALLIUM_STATE_TRACKERS_DIRS = glx
# Library dependencies
#EXTRA_LIB_PATH ?=
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
+EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -ldl
OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
GLUT_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lm
diff --git a/configure.ac b/configure.ac
index f06174a302..2f3f0beff1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -307,6 +307,13 @@ if test "x$enable_asm" = xyes; then
;;
esac
;;
+ sparc*)
+ case "$host_os" in
+ linux*)
+ asm_arch=sparc
+ ;;
+ esac
+ ;;
esac
case "$asm_arch" in
@@ -327,6 +334,12 @@ if test "x$enable_asm" = xyes; then
MESA_ASM_SOURCES='$(PPC_SOURCES)'
AC_MSG_RESULT([yes, ppc])
;;
+ sparc)
+ ASM_FLAGS="-DUSE_SPARC_ASM"
+ MESA_ASM_SOURCES='$(SPARC_SOURCES)'
+ GLAPI_ASM_SOURCES='$(SPARC_API)'
+ AC_MSG_RESULT([yes, sparc])
+ ;;
*)
AC_MSG_RESULT([no, platform not supported])
;;
@@ -382,7 +395,7 @@ default_driver="xlib"
case "$host_os" in
linux*)
case "$host_cpu" in
- i*86|x86_64|powerpc*) default_driver="dri";;
+ i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
esac
;;
*freebsd* | dragonfly*)
@@ -856,6 +869,19 @@ AC_SUBST([OSMESA_PC_REQ])
AC_SUBST([OSMESA_PC_LIB_PRIV])
dnl
+dnl EGL configuration
+dnl
+if test "$x11_pkgconfig" = yes; then
+ PKG_CHECK_MODULES([EGL],[x11])
+ EGL_LIB_DEPS="$EGL_LIBS"
+else
+ # should check these...
+ EGL_LIB_DEPS="$X_LIBS -lX11"
+fi
+EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS $OS_LIBS"
+AC_SUBST([EGL_LIB_DEPS])
+
+dnl
dnl GLU configuration
dnl
AC_ARG_ENABLE([glu],
diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html
index 621bd4afac..f29553b0fb 100644
--- a/docs/relnotes-7.5.html
+++ b/docs/relnotes-7.5.html
@@ -39,6 +39,7 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
<li>GL_EXT_vertex_array_bgra extension (software drivers, i965 driver)
<li>GL_NV_texture_env_combine4 extension (software drivers, i965/i915 drivers)
<li>GL_EXT_texture_swizzle extension (software drivers, i965 driver)
+<li>Updated SPARC assembly optimizations (David S. Miller)
</ul>
diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
index 02c3b94bd8..d873428d75 100644
--- a/include/EGL/eglplatform.h
+++ b/include/EGL/eglplatform.h
@@ -68,7 +68,7 @@ typedef HWND NativeWindowType;
typedef HBITMAP NativePixmapType;
/** END Added for Windows **/
-#elif defined(__gnu_linux__)
+#elif defined(__gnu_linux__) || defined(__FreeBSD__)
/** BEGIN Added for X (Mesa) **/
#ifndef EGLAPI
diff --git a/progs/demos/arbfplight.c b/progs/demos/arbfplight.c
index 401bfb4968..7b7a12bf88 100644
--- a/progs/demos/arbfplight.c
+++ b/progs/demos/arbfplight.c
@@ -92,6 +92,7 @@ static void Redisplay( void )
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+ fflush(stdout);
T0 = t;
Frames = 0;
}
diff --git a/progs/demos/arbfslight.c b/progs/demos/arbfslight.c
index a84491d34f..275c85105e 100644
--- a/progs/demos/arbfslight.c
+++ b/progs/demos/arbfslight.c
@@ -105,6 +105,7 @@ static void Redisplay (void)
GLfloat seconds = (GLfloat) (t - t0) / 1000.0f;
GLfloat fps = frames / seconds;
printf ("%d frames in %6.3f seconds = %6.3f FPS\n", frames, seconds, fps);
+ fflush(stdout);
t0 = t;
frames = 0;
}
diff --git a/progs/demos/fslight.c b/progs/demos/fslight.c
index e79b5cc197..41a13cc9f4 100644
--- a/progs/demos/fslight.c
+++ b/progs/demos/fslight.c
@@ -105,6 +105,7 @@ Redisplay(void)
GLfloat fps = frames / seconds;
printf("%d frames in %6.3f seconds = %6.3f FPS\n",
frames, seconds, fps);
+ fflush(stdout);
t0 = t;
frames = 0;
}
diff --git a/progs/demos/gearbox.c b/progs/demos/gearbox.c
index 35bde04417..2dcf32f92f 100644
--- a/progs/demos/gearbox.c
+++ b/progs/demos/gearbox.c
@@ -314,6 +314,7 @@ draw(void)
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+ fflush(stdout);
T0 = t;
Frames = 0;
}
diff --git a/progs/demos/gears.c b/progs/demos/gears.c
index 2a9fefefb5..6016162d6f 100644
--- a/progs/demos/gears.c
+++ b/progs/demos/gears.c
@@ -219,6 +219,7 @@ draw(void)
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+ fflush(stdout);
T0 = t;
Frames = 0;
if ((t >= 999.0 * autoexit) && (autoexit)) {
diff --git a/progs/demos/geartrain.c b/progs/demos/geartrain.c
index 8363f2abc6..8fe405e807 100644
--- a/progs/demos/geartrain.c
+++ b/progs/demos/geartrain.c
@@ -905,6 +905,7 @@ draw (void)
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
+ fflush(stdout);
T0 = t;
Frames = 0;
}
diff --git a/progs/demos/gloss.c b/progs/demos/gloss.c
index b2126e3267..69694b23a0 100644
--- a/progs/demos/gloss.c
+++ b/progs/demos/gloss.c
@@ -132,6 +132,7 @@ static void Display( void )
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
+ fflush(stdout);
T0 = t;
Frames = 0;
}
diff --git a/progs/demos/glslnoise.c b/progs/demos/glslnoise.c
index 4ee1292816..e972b62673 100644
--- a/progs/demos/glslnoise.c
+++ b/progs/demos/glslnoise.c
@@ -65,6 +65,7 @@ static void Redisplay (void)
GLfloat seconds = (GLfloat) (t - t0) / 1000.0f;
GLfloat fps = frames / seconds;
printf ("%d frames in %6.3f seconds = %6.3f FPS\n", frames, seconds, fps);
+ fflush(stdout);
t0 = t;
frames = 0;
}
diff --git a/progs/demos/reflect.c b/progs/demos/reflect.c
index 0bec0663bc..b72af12885 100644
--- a/progs/demos/reflect.c
+++ b/progs/demos/reflect.c
@@ -401,6 +401,7 @@ DrawWindow(void)
GLfloat seconds = (t - t0) / 1000.0;
GLfloat fps = frames / seconds;
printf("%d frames in %g seconds = %g FPS\n", frames, seconds, fps);
+ fflush(stdout);
t0 = t;
frames = 0;
}
diff --git a/progs/demos/streaming_rect.c b/progs/demos/streaming_rect.c
index 294f9c3060..f65ac4ce36 100644
--- a/progs/demos/streaming_rect.c
+++ b/progs/demos/streaming_rect.c
@@ -153,6 +153,7 @@ static void Display( void )
GLfloat fps = Frames / seconds;
printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+ fflush(stdout);
drift_increment = 2.2 * seconds / Frames;
T0 = t;
diff --git a/progs/demos/texcyl.c b/progs/demos/texcyl.c
index e3b0303975..0e6089bced 100644
--- a/progs/demos/texcyl.c
+++ b/progs/demos/texcyl.c
@@ -79,6 +79,7 @@ static void Display( void )
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
+ fflush(stdout);
T0 = t;
Frames = 0;
}
diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile
index 7099eeadbd..8061277033 100644
--- a/progs/glsl/Makefile
+++ b/progs/glsl/Makefile
@@ -25,6 +25,7 @@ PROGS = \
pointcoord \
samplers \
samplers_array \
+ shadow_sampler \
skinning \
texdemo1 \
toyball \
diff --git a/progs/glsl/shadow_sampler.c b/progs/glsl/shadow_sampler.c
new file mode 100644
index 0000000000..2902b53552
--- /dev/null
+++ b/progs/glsl/shadow_sampler.c
@@ -0,0 +1,341 @@
+/**
+ * Test shadow2DRectProj() and shadow2D() functions.
+ * Brian Paul
+ * 11 April 2007
+ */
+
+#define GL_GLEXT_PROTOTYPES
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <GL/gl.h>
+#include <GL/glut.h>
+#include <GL/glext.h>
+#include "extfuncs.h"
+
+
+/** Use GL_RECTANGLE texture (with projective texcoords)? */
+#define USE_RECT 01
+
+#define TEXSIZE 16
+
+
+static char *FragProgFile = NULL;
+static char *VertProgFile = NULL;
+
+static GLuint fragShader;
+static GLuint vertShader;
+static GLuint program;
+
+static GLint uTexture2D;
+static GLint uTextureRect;
+
+static GLint win = 0;
+
+static GLenum Filter = GL_LINEAR;
+
+static void
+CheckError(int line)
+{
+ GLenum err = glGetError();
+ if (err) {
+ printf("GL Error %s (0x%x) at line %d\n",
+ gluErrorString(err), (int) err, line);
+ }
+}
+
+
+static void
+PrintString(const char *s)
+{
+ while (*s) {
+ glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
+ s++;
+ }
+}
+
+
+static void
+Redisplay(void)
+{
+ CheckError(__LINE__);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glPushMatrix();
+
+ CheckError(__LINE__);
+ glUseProgram_func(program);
+ CheckError(__LINE__);
+
+ glBegin(GL_POLYGON);
+#if USE_RECT
+ /* scale coords by two to test projection */
+ glTexCoord4f( 0, 0, 0, 2.0); glVertex2f(-1, -1);
+ glTexCoord4f(2*TEXSIZE, 0, 2*1, 2.0); glVertex2f( 1, -1);
+ glTexCoord4f(2*TEXSIZE, 2*TEXSIZE, 2*1, 2.0); glVertex2f( 1, 1);
+ glTexCoord4f( 0, 2*TEXSIZE, 0, 2.0); glVertex2f(-1, 1);
+#else
+ glTexCoord3f(0, 0, 0); glVertex2f(-1, -1);
+ glTexCoord3f(1, 0, 1); glVertex2f( 1, -1);
+ glTexCoord3f(1, 1, 1); glVertex2f( 1, 1);
+ glTexCoord3f(0, 1, 0); glVertex2f(-1, 1);
+#endif
+ glEnd();
+
+ glPopMatrix();
+
+ glUseProgram_func(0);
+ glWindowPos2iARB(80, 20);
+ PrintString("white black white black");
+
+ glutSwapBuffers();
+}
+
+
+static void
+Reshape(int width, int height)
+{
+ glViewport(0, 0, width, height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0f, 0.0f, -8.0f);
+}
+
+
+static void
+CleanUp(void)
+{
+ glDeleteShader_func(fragShader);
+ glDeleteShader_func(vertShader);
+ glDeleteProgram_func(program);
+ glutDestroyWindow(win);
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+ (void) x;
+ (void) y;
+
+ switch(key) {
+ case 27:
+ CleanUp();
+ exit(0);
+ break;
+ }
+ glutPostRedisplay();
+}
+
+
+static void
+MakeTexture(void)
+{
+ GLfloat image[TEXSIZE][TEXSIZE];
+ GLuint i, j;
+
+ for (i = 0; i < TEXSIZE; i++) {
+ for (j = 0; j < TEXSIZE; j++) {
+ if (j < (TEXSIZE / 2)) {
+ image[i][j] = 0.25;
+ }
+ else {
+ image[i][j] = 0.75;
+ }
+ }
+ }
+
+ glActiveTexture(GL_TEXTURE0); /* unit 0 */
+ glBindTexture(GL_TEXTURE_2D, 42);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, TEXSIZE, TEXSIZE, 0,
+ GL_DEPTH_COMPONENT, GL_FLOAT, image);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
+ GL_COMPARE_R_TO_TEXTURE_ARB);
+ CheckError(__LINE__);
+
+ glActiveTexture(GL_TEXTURE1); /* unit 1 */
+ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 43);
+ glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_DEPTH_COMPONENT,
+ TEXSIZE, 10, 0,/*16x10*/
+ GL_DEPTH_COMPONENT, GL_FLOAT, image);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, Filter);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, Filter);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_COMPARE_MODE_ARB,
+ GL_COMPARE_R_TO_TEXTURE_ARB);
+ CheckError(__LINE__);
+}
+
+
+static void
+LoadAndCompileShader(GLuint shader, const char *text)
+{
+ GLint stat;
+ glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
+ glCompileShader_func(shader);
+ glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
+ if (!stat) {
+ GLchar log[1000];
+ GLsizei len;
+ glGetShaderInfoLog_func(shader, 1000, &len, log);
+ fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
+ exit(1);
+ }
+}
+
+
+/**
+ * Read a shader from a file.
+ */
+static void
+ReadShader(GLuint shader, const char *filename)
+{
+ const int max = 100*1000;
+ int n;
+ char *buffer = (char*) malloc(max);
+ FILE *f = fopen(filename, "r");
+ if (!f) {
+ fprintf(stderr, "fslight: Unable to open shader file %s\n", filename);
+ exit(1);
+ }
+
+ n = fread(buffer, 1, max, f);
+ printf("fslight: read %d bytes from shader file %s\n", n, filename);
+ if (n > 0) {
+ buffer[n] = 0;
+ LoadAndCompileShader(shader, buffer);
+ }
+
+ fclose(f);
+ free(buffer);
+}
+
+
+static void
+CheckLink(GLuint prog)
+{
+ GLint stat;
+ glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
+ if (!stat) {
+ GLchar log[1000];
+ GLsizei len;
+ glGetProgramInfoLog_func(prog, 1000, &len, log);
+ fprintf(stderr, "Linker error:\n%s\n", log);
+ }
+}
+
+
+static void
+Init(void)
+{
+ static const char *fragShaderText =
+ "uniform sampler2DShadow shadowTex2D; \n"
+ "uniform sampler2DRectShadow shadowTexRect; \n"
+ "void main() {\n"
+#if USE_RECT
+ " gl_FragColor = shadow2DRectProj(shadowTexRect, gl_TexCoord[0]); \n"
+#else
+ " gl_FragColor = shadow2D(shadowTex2D, gl_TexCoord[0].xyz); \n"
+#endif
+ "}\n";
+ static const char *vertShaderText =
+ "void main() {\n"
+ " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
+ " gl_TexCoord[0] = gl_MultiTexCoord0; \n"
+ "}\n";
+ const char *version;
+
+#if USE_RECT
+ if (!glutExtensionSupported("GL_ARB_texture_rectangle")) {
+ printf("This program requires GL_ARB_texture_rectangle\n");
+ exit(1);
+ }
+#endif
+
+ version = (const char *) glGetString(GL_VERSION);
+ if (version[0] != '2' || version[1] != '.') {
+ printf("This program requires OpenGL 2.x, found %s\n", version);
+ exit(1);
+ }
+ printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
+
+ GetExtensionFuncs();
+
+ fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
+ if (FragProgFile)
+ ReadShader(fragShader, FragProgFile);
+ else
+ LoadAndCompileShader(fragShader, fragShaderText);
+
+ vertShader = glCreateShader_func(GL_VERTEX_SHADER);
+ if (VertProgFile)
+ ReadShader(vertShader, VertProgFile);
+ else
+ LoadAndCompileShader(vertShader, vertShaderText);
+
+ program = glCreateProgram_func();
+ glAttachShader_func(program, fragShader);
+ glAttachShader_func(program, vertShader);
+ glLinkProgram_func(program);
+ CheckLink(program);
+ glUseProgram_func(program);
+
+ uTexture2D = glGetUniformLocation_func(program, "shadowTex2D");
+ uTextureRect = glGetUniformLocation_func(program, "shadowTexRect");
+ printf("uTexture2D %d uTextureRect %d\n", uTexture2D, uTextureRect);
+ if (uTexture2D >= 0) {
+ glUniform1i_func(uTexture2D, 0); /* use texture unit 0 */
+ }
+ if (uTextureRect >= 0) {
+ glUniform1i_func(uTextureRect, 1); /* use texture unit 0 */
+ }
+ CheckError(__LINE__);
+
+ glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
+ glColor3f(1, 1, 1);
+
+ MakeTexture();
+ CheckError(__LINE__);
+}
+
+
+static void
+ParseOptions(int argc, char *argv[])
+{
+ int i;
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-fs") == 0) {
+ FragProgFile = argv[i+1];
+ }
+ else if (strcmp(argv[i], "-vs") == 0) {
+ VertProgFile = argv[i+1];
+ }
+ }
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ glutInit(&argc, argv);
+ glutInitWindowPosition( 0, 0);
+ glutInitWindowSize(400, 300);
+ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
+ win = glutCreateWindow(argv[0]);
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Redisplay);
+ ParseOptions(argc, argv);
+ Init();
+ glutMainLoop();
+ return 0;
+}
+
+
diff --git a/progs/tests/Makefile b/progs/tests/Makefile
index 34c9ab1dce..a70a6ab9ab 100644
--- a/progs/tests/Makefile
+++ b/progs/tests/Makefile
@@ -54,6 +54,7 @@ SOURCES = \
jkrahntest.c \
lineclip.c \
manytex.c \
+ mapvbo.c \
minmag.c \
mipmap_limits.c \
mipmap_view.c \
diff --git a/progs/tests/bufferobj.c b/progs/tests/bufferobj.c
index d1a85392e1..9edb86e575 100644
--- a/progs/tests/bufferobj.c
+++ b/progs/tests/bufferobj.c
@@ -17,7 +17,8 @@
struct object
{
- GLuint BufferID;
+ GLuint VertexBufferID;
+ GLuint ColorBufferID;
GLuint ElementsBufferID;
GLuint NumVerts;
GLuint VertexOffset;
@@ -47,7 +48,7 @@ static void CheckError(int line)
static void DrawObject( const struct object *obj )
{
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
glVertexPointer(3, GL_FLOAT, obj->VertexStride, (void *) obj->VertexOffset);
glEnable(GL_VERTEX_ARRAY);
@@ -62,6 +63,7 @@ static void DrawObject( const struct object *obj )
glPopClientAttrib();
}
#endif
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->ColorBufferID);
glColorPointer(3, GL_FLOAT, obj->ColorStride, (void *) obj->ColorOffset);
glEnable(GL_COLOR_ARRAY);
@@ -92,7 +94,7 @@ static void Display( void )
glClear( GL_COLOR_BUFFER_BIT );
for (i = 0; i < NumObjects; i++) {
- float x = 5.0 * ((float) i / (NumObjects-1) - 0.5);
+ float x = 7.0 * ((float) i / (NumObjects-1) - 0.5);
glPushMatrix();
glTranslatef(x, 0, 0);
glRotatef(Xrot, 1, 0, 0);
@@ -125,8 +127,11 @@ static void Reshape( int width, int height )
static void FreeBuffers(void)
{
int i;
- for (i = 0; i < NUM_OBJECTS; i++)
- glDeleteBuffersARB(1, &Objects[i].BufferID);
+ for (i = 0; i < NUM_OBJECTS; i++) {
+ glDeleteBuffersARB(1, &Objects[i].VertexBufferID);
+ glDeleteBuffersARB(1, &Objects[i].ColorBufferID);
+ glDeleteBuffersARB(1, &Objects[i].ElementsBufferID);
+ }
}
@@ -182,7 +187,9 @@ static void SpecialKey( int key, int x, int y )
}
-
+/*
+ * Non-interleaved position/color data.
+ */
static void MakeObject1(struct object *obj)
{
GLfloat *v, *c;
@@ -193,10 +200,11 @@ static void MakeObject1(struct object *obj)
for (i = 0; i < 500; i++)
buffer[i] = i & 0xff;
- obj->BufferID = 0;
- glGenBuffersARB(1, &obj->BufferID);
- assert(obj->BufferID != 0);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
+ obj->VertexBufferID = 0;
+ glGenBuffersARB(1, &obj->VertexBufferID);
+ obj->ColorBufferID = obj->VertexBufferID;
+ assert(obj->VertexBufferID != 0);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, 500, buffer, GL_STATIC_DRAW_ARB);
for (i = 0; i < 500; i++)
@@ -257,13 +265,18 @@ static void MakeObject1(struct object *obj)
}
+/*
+ * Interleaved position/color data.
+ */
static void MakeObject2(struct object *obj)
{
GLfloat *v;
int start = 40; /* bytes, to test non-zero array offsets */
- glGenBuffersARB(1, &obj->BufferID);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
+ glGenBuffersARB(1, &obj->VertexBufferID);
+ obj->ColorBufferID = obj->VertexBufferID;
+
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, NULL, GL_STATIC_DRAW_ARB);
v = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
@@ -287,6 +300,9 @@ static void MakeObject2(struct object *obj)
}
+/*
+ * Use an index buffer and glDrawElements().
+ */
static void MakeObject3(struct object *obj)
{
GLfloat vertexData[1000];
@@ -314,8 +330,10 @@ static void MakeObject3(struct object *obj)
bytes = obj->NumVerts * (3 + 3) * sizeof(GLfloat);
/* Don't use glMap/UnmapBuffer for this object */
- glGenBuffersARB(1, &obj->BufferID);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
+ glGenBuffersARB(1, &obj->VertexBufferID);
+ obj->ColorBufferID = obj->VertexBufferID;
+
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, bytes, vertexData, GL_STATIC_DRAW_ARB);
/* Setup a buffer of indices to test the ELEMENTS path */
@@ -332,6 +350,46 @@ static void MakeObject3(struct object *obj)
}
+/*
+ * Vertex and color data in different buffers.
+ */
+static void MakeObject4(struct object *obj)
+{
+ static const GLfloat vertexData[] = {
+ 0, -1, 0,
+ 0.5, 0, 0,
+ 0, 1, 0,
+ -0.5, 0, 0
+ };
+ static const GLfloat colorData[] = {
+ 1, 1, 1,
+ 1, 1, 0,
+ .5, .5, 0,
+ 1, 1, 0
+ };
+
+ obj->VertexOffset = 0;
+ obj->VertexStride = 0;
+ obj->ColorOffset = 0;
+ obj->ColorStride = 0;
+ obj->NumVerts = 4;
+
+ glGenBuffersARB(1, &obj->VertexBufferID);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
+ glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(vertexData), vertexData,
+ GL_STATIC_DRAW_ARB);
+
+ glGenBuffersARB(1, &obj->ColorBufferID);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->ColorBufferID);
+ glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(colorData), colorData,
+ GL_STATIC_DRAW_ARB);
+
+ /* Setup a buffer of indices to test the ELEMENTS path */
+ obj->ElementsBufferID = 0;
+ obj->NumElements = 0;
+}
+
+
static void Init( void )
{
@@ -358,7 +416,8 @@ static void Init( void )
MakeObject1(Objects + 0);
MakeObject2(Objects + 1);
MakeObject3(Objects + 2);
- NumObjects = 3;
+ MakeObject4(Objects + 3);
+ NumObjects = 4;
}
diff --git a/progs/tests/fbotexture.c b/progs/tests/fbotexture.c
index 1f7c45fc79..ae993576b0 100644
--- a/progs/tests/fbotexture.c
+++ b/progs/tests/fbotexture.c
@@ -26,9 +26,16 @@
static int Win = 0;
static int Width = 400, Height = 400;
-static GLenum TexTarget = GL_TEXTURE_2D; /*GL_TEXTURE_RECTANGLE_ARB;*/
+#if 1
+static GLenum TexTarget = GL_TEXTURE_2D;
static int TexWidth = 512, TexHeight = 512;
-/*static int TexWidth = 600, TexHeight = 600;*/
+static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */
+#else
+static GLenum TexTarget = GL_TEXTURE_RECTANGLE_ARB;
+static int TexWidth = 200, TexHeight = 200;
+static GLenum TexIntFormat = GL_RGB5; /* either GL_RGB or GL_RGBA */
+#endif
+static GLuint TextureLevel = 0; /* which texture level to render to */
static GLuint MyFB;
static GLuint TexObj;
@@ -38,8 +45,6 @@ static GLfloat Rot = 0.0;
static GLboolean UsePackedDepthStencil = GL_FALSE;
static GLboolean UsePackedDepthStencilBoth = GL_FALSE;
static GLboolean Use_ARB_fbo = GL_FALSE;
-static GLuint TextureLevel = 0; /* which texture level to render to */
-static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */
static GLboolean Cull = GL_FALSE;
static GLboolean Wireframe = GL_FALSE;
@@ -404,8 +409,12 @@ AttachDepthAndStencilBuffers(GLuint fbo,
return GL_FALSE;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
- if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
+ if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ glDeleteRenderbuffersEXT(1, depthRbOut);
+ *depthRbOut = 0;
+ glDeleteRenderbuffersEXT(1, &rb);
return GL_FALSE;
+ }
*stencilRbOut = rb;
}
@@ -554,15 +563,17 @@ Init(void)
/* make two image levels */
glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexImage2D(TexTarget, 1, TexIntFormat, TexWidth/2, TexHeight/2, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- TexWidth = TexWidth >> TextureLevel;
- TexHeight = TexHeight >> TextureLevel;
+ if (TexTarget == GL_TEXTURE_2D) {
+ glTexImage2D(TexTarget, 1, TexIntFormat, TexWidth/2, TexHeight/2, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ TexWidth = TexWidth >> TextureLevel;
+ TexHeight = TexHeight >> TextureLevel;
+ glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel);
+ }
glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel);
- glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
diff --git a/progs/tests/mapvbo.c b/progs/tests/mapvbo.c
new file mode 100644
index 0000000000..49e120de73
--- /dev/null
+++ b/progs/tests/mapvbo.c
@@ -0,0 +1,138 @@
+/*
+ * Test glMapBuffer() call immediately after glDrawArrays().
+ * See details below.
+ *
+ * NOTE: Do not use freeglut with this test! It calls the Display()
+ * callback twice right away instead of just once.
+ *
+ * Brian Paul
+ * 27 Feb 2009
+ */
+
+
+#define GL_GLEXT_PROTOTYPES
+#include <stdio.h>
+#include <stdlib.h>
+#include <GL/glut.h>
+
+static GLuint BufferID;
+
+
+static GLuint Win;
+
+
+
+
+/*
+ * Create VBO (position and color) and load with data.
+ */
+static void
+SetupBuffers(void)
+{
+ static const GLfloat data[] = {
+ /* vertex */ /* color */
+ 0, -1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 1, 0,
+ 0, 1, 0, 1, 1, 0,
+ -1, 0, 0, 1, 1, 0
+ };
+
+ glGenBuffersARB(1, &BufferID);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, BufferID);
+ glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(data), data,
+ GL_STATIC_DRAW_ARB);
+}
+
+
+static void
+Draw(void)
+{
+ static int count = 1;
+
+ printf("Draw Frame %d\n", count);
+ count++;
+
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, BufferID);
+ glVertexPointer(3, GL_FLOAT, 24, 0);
+ glEnable(GL_VERTEX_ARRAY);
+
+ glColorPointer(3, GL_FLOAT, 24, (void*) 12);
+ glEnable(GL_COLOR_ARRAY);
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ if (0)
+ glFinish();
+
+ /* Immediately map the color buffer and change something.
+ * This should not effect the first glDrawArrays above, but the
+ * next time we draw we should see a black vertex.
+ */
+ if (1) {
+ GLfloat *m = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB,
+ GL_WRITE_ONLY_ARB);
+ m[3] = m[4] = m[5] = 0.0f; /* black vertex */
+ glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
+ }
+}
+
+
+static void Display( void )
+{
+ glClear( GL_COLOR_BUFFER_BIT );
+ Draw();
+ glutSwapBuffers();
+}
+
+
+static void Reshape( int width, int height )
+{
+ float ar = (float) width / (float) height;
+ glViewport( 0, 0, width, height );
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity();
+ glFrustum( -ar, ar, -1.0, 1.0, 5.0, 25.0 );
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity();
+ glTranslatef( 0.0, 0.0, -15.0 );
+}
+
+
+static void Key( unsigned char key, int x, int y )
+{
+ (void) x;
+ (void) y;
+ if (key == 27) {
+ glutDestroyWindow(Win);
+ exit(0);
+ }
+ glutPostRedisplay();
+}
+
+
+static void Init( void )
+{
+ if (!glutExtensionSupported("GL_ARB_vertex_buffer_object")) {
+ printf("GL_ARB_vertex_buffer_object not found!\n");
+ exit(0);
+ }
+ printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+
+ SetupBuffers();
+}
+
+
+int main( int argc, char *argv[] )
+{
+ glutInit( &argc, argv );
+ glutInitWindowPosition( 0, 0 );
+ glutInitWindowSize( 300, 300 );
+ glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
+ Win = glutCreateWindow(argv[0]);
+ glutReshapeFunc( Reshape );
+ glutKeyboardFunc( Key );
+ glutDisplayFunc( Display );
+ Init();
+ glutMainLoop();
+ return 0;
+}
diff --git a/progs/trivial/.gitignore b/progs/trivial/.gitignore
index dadd535591..5159e31aa2 100644
--- a/progs/trivial/.gitignore
+++ b/progs/trivial/.gitignore
@@ -110,6 +110,7 @@ tri-unfilled-tri-lit
tri-unfilled-userclip
tri-unfilled-userclip-stip
tri-userclip
+tri-viewport
tri-z
tri-z-eq
trifan
diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile
index 6ba41a7895..3300fce636 100644
--- a/progs/trivial/Makefile
+++ b/progs/trivial/Makefile
@@ -119,6 +119,7 @@ SOURCES = \
tri-unfilled-userclip.c \
tri-unfilled.c \
tri-userclip.c \
+ tri-viewport.c \
tri-z-eq.c \
tri-z.c \
tri.c \
diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript
index 8a7fb6be30..dc84a0550b 100644
--- a/progs/trivial/SConscript
+++ b/progs/trivial/SConscript
@@ -114,6 +114,7 @@ progs = [
'tri-unfilled-userclip',
'tri-unfilled',
'tri-userclip',
+ 'tri-viewport',
'tri-z-eq',
'tri-z',
'tri',
diff --git a/progs/trivial/tri-viewport.c b/progs/trivial/tri-viewport.c
new file mode 100644
index 0000000000..3205b9ee9c
--- /dev/null
+++ b/progs/trivial/tri-viewport.c
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the name of
+ * Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
+ * ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <GL/glut.h>
+
+GLenum doubleBuffer = 1;
+int win;
+
+static void Init(void)
+{
+ fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+ fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
+ fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+
+ glClearColor(0.3, 0.1, 0.3, 0.0);
+}
+
+static void Reshape(int width, int height)
+{
+ glViewport(width / -2.0, height / -2.0, width, height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+ switch (key) {
+ case 27:
+ exit(0);
+ default:
+ glutPostRedisplay();
+ return;
+ }
+}
+
+static void Draw(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glBegin(GL_TRIANGLES);
+ glColor3f(.8,0,0);
+ glVertex3f(-0.9, 0.9, -30.0);
+ glColor3f(0,.9,0);
+ glVertex3f( 0.9, 0.9, -30.0);
+ glColor3f(0,0,.7);
+ glVertex3f( 0.0, -0.9, -30.0);
+ glEnd();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ fprintf(stderr, "%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ GLenum type;
+
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+
+ type = GLUT_RGB | GLUT_ALPHA;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ win = glutCreateWindow(*argv);
+ if (!win) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/progs/trivial/tri.c b/progs/trivial/tri.c
index 033d6ceae2..d99d5872a9 100644
--- a/progs/trivial/tri.c
+++ b/progs/trivial/tri.c
@@ -41,28 +41,28 @@ static void Init(void)
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- glClearColor(0.3, 0.1, 0.3, 0.0);
+ glClearColor(0.3, 0.1, 0.3, 0.0);
}
static void Reshape(int width, int height)
{
- glViewport(0, 0, (GLint)width, (GLint)height);
+ glViewport(0, 0, (GLint)width, (GLint)height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
+ glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
- case 27:
- exit(0);
- default:
- glutPostRedisplay();
- return;
+ case 27:
+ exit(0);
+ default:
+ glutPostRedisplay();
+ return;
}
}
@@ -88,47 +88,47 @@ static void Draw(void)
static GLenum Args(int argc, char **argv)
{
- GLint i;
-
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-sb") == 0) {
- doubleBuffer = GL_FALSE;
- } else if (strcmp(argv[i], "-db") == 0) {
- doubleBuffer = GL_TRUE;
- } else {
- fprintf(stderr, "%s (Bad option).\n", argv[i]);
- return GL_FALSE;
- }
- }
- return GL_TRUE;
+ GLint i;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ fprintf(stderr, "%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
}
int main(int argc, char **argv)
{
- GLenum type;
+ GLenum type;
- glutInit(&argc, argv);
+ glutInit(&argc, argv);
- if (Args(argc, argv) == GL_FALSE) {
- exit(1);
- }
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
- type = GLUT_RGB | GLUT_ALPHA;
- type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
- glutInitDisplayMode(type);
+ type = GLUT_RGB | GLUT_ALPHA;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
- win = glutCreateWindow(*argv);
- if (!win) {
- exit(1);
- }
+ win = glutCreateWindow(*argv);
+ if (!win) {
+ exit(1);
+ }
- Init();
+ Init();
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
}
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index 89b4a200bc..5ee246dc3f 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -46,8 +46,6 @@ OBJECTS = $(SOURCES:.c=.o)
# Undefined for now
LOCAL_CFLAGS = -D_EGL_PLATFORM_X=1
-LIBS = -lX11
-
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@
@@ -63,7 +61,8 @@ library: $(TOP)/$(LIB_DIR)/libEGL.so
$(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS)
$(MKLIB) -o EGL -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major 1 -minor 0 \
- -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS)
+ -install $(TOP)/$(LIB_DIR) \
+ $(EGL_LIB_DEPS) $(OBJECTS)
install:
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index 556f26c0f0..533c0a15f3 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -36,7 +36,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
#include <unistd.h>
#include <sched.h>
#endif
@@ -559,7 +559,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
/* Wait on outstanding fences */
while (fenced_list->numDelayed) {
pipe_mutex_unlock(fenced_list->mutex);
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
sched_yield();
#endif
_fenced_buffer_list_check_free(fenced_list, 1);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
index fec8db91c7..74077f8277 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
@@ -200,10 +200,11 @@ pb_ondemand_manager_create(struct pb_manager *provider);
/**
* Debug buffer manager to detect buffer under- and overflows.
*
- * Band size should be a multiple of the largest alignment
+ * Under/overflow sizes should be a multiple of the largest alignment
*/
struct pb_manager *
-pb_debug_manager_create(struct pb_manager *provider, size_t band_size);
+pb_debug_manager_create(struct pb_manager *provider,
+ size_t underflow_size, size_t overflow_size);
#ifdef __cplusplus
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index 070bf3f517..21079b8bfd 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -78,7 +78,8 @@ struct pb_debug_manager
struct pb_manager *provider;
- size_t band_size;
+ size_t underflow_size;
+ size_t overflow_size;
};
@@ -301,7 +302,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
if(!buf)
return NULL;
- real_size = size + 2*mgr->band_size;
+ real_size = mgr->underflow_size + size + mgr->overflow_size;
real_desc = *desc;
real_desc.usage |= PIPE_BUFFER_USAGE_CPU_WRITE;
real_desc.usage |= PIPE_BUFFER_USAGE_CPU_READ;
@@ -327,7 +328,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
buf->base.vtbl = &pb_debug_buffer_vtbl;
buf->mgr = mgr;
- buf->underflow_size = mgr->band_size;
+ buf->underflow_size = mgr->underflow_size;
buf->overflow_size = buf->buffer->base.size - buf->underflow_size - size;
pb_debug_buffer_fill(buf);
@@ -356,7 +357,8 @@ pb_debug_manager_destroy(struct pb_manager *_mgr)
struct pb_manager *
-pb_debug_manager_create(struct pb_manager *provider, size_t band_size)
+pb_debug_manager_create(struct pb_manager *provider,
+ size_t underflow_size, size_t overflow_size)
{
struct pb_debug_manager *mgr;
@@ -371,7 +373,8 @@ pb_debug_manager_create(struct pb_manager *provider, size_t band_size)
mgr->base.create_buffer = pb_debug_manager_create_buffer;
mgr->base.flush = pb_debug_manager_flush;
mgr->provider = provider;
- mgr->band_size = band_size;
+ mgr->underflow_size = underflow_size;
+ mgr->overflow_size = overflow_size;
return &mgr->base;
}
@@ -381,7 +384,8 @@ pb_debug_manager_create(struct pb_manager *provider, size_t band_size)
struct pb_manager *
-pb_debug_manager_create(struct pb_manager *provider, size_t band_size)
+pb_debug_manager_create(struct pb_manager *provider,
+ size_t underflow_size, size_t overflow_size)
{
return provider;
}
diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
index 5acc5bcb7b..1f0923b683 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
@@ -37,8 +37,12 @@
#include "rtasm_execmem.h"
+#if defined(PIPE_OS_BSD)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
-#if defined(PIPE_OS_LINUX)
+
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
/*
@@ -114,7 +118,7 @@ rtasm_exec_free(void *addr)
}
-#else /* PIPE_OS_LINUX */
+#else /* PIPE_OS_LINUX || PIPE_OS_BSD */
/*
* Just use regular memory.
@@ -134,4 +138,4 @@ rtasm_exec_free(void *addr)
}
-#endif /* PIPE_OS_LINUX */
+#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index d57cb9139f..a784b7cc3c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -245,8 +245,12 @@ iter_declaration(
}
}
- TXT( ", " );
- ENM( decl->Declaration.Interpolate, interpolate_names );
+ if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT &&
+ decl->Declaration.File == TGSI_FILE_INPUT)
+ {
+ TXT( ", " );
+ ENM( decl->Declaration.Interpolate, interpolate_names );
+ }
if (decl->Declaration.Centroid) {
TXT( ", CENTROID" );
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
index 76e773da91..6f1f5c2b4b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
@@ -30,18 +30,19 @@
#include "tgsi_info.h"
#include "tgsi_iterate.h"
-#define MAX_REGISTERS 256
-
typedef uint reg_flag;
#define BITS_IN_REG_FLAG (sizeof( reg_flag ) * 8)
+#define MAX_REGISTERS 256
+#define MAX_REG_FLAGS ((MAX_REGISTERS + BITS_IN_REG_FLAG - 1) / BITS_IN_REG_FLAG)
+
struct sanity_check_ctx
{
struct tgsi_iterate_context iter;
- reg_flag regs_decl[TGSI_FILE_COUNT][MAX_REGISTERS / BITS_IN_REG_FLAG];
- reg_flag regs_used[TGSI_FILE_COUNT][MAX_REGISTERS / BITS_IN_REG_FLAG];
+ reg_flag regs_decl[TGSI_FILE_COUNT][MAX_REG_FLAGS];
+ reg_flag regs_used[TGSI_FILE_COUNT][MAX_REG_FLAGS];
boolean regs_ind_used[TGSI_FILE_COUNT];
uint num_imms;
uint num_instructions;
@@ -89,7 +90,7 @@ check_file_name(
uint file )
{
if (file <= TGSI_FILE_NULL || file >= TGSI_FILE_COUNT) {
- report_error( ctx, "Invalid register file name" );
+ report_error( ctx, "(%u): Invalid register file name", file );
return FALSE;
}
return TRUE;
@@ -113,7 +114,7 @@ is_any_register_declared(
{
uint i;
- for (i = 0; i < MAX_REGISTERS / BITS_IN_REG_FLAG; i++)
+ for (i = 0; i < MAX_REG_FLAGS; i++)
if (ctx->regs_decl[file][i])
return TRUE;
return FALSE;
@@ -162,9 +163,8 @@ check_register_usage(
ctx->regs_ind_used[file] = TRUE;
}
else {
- if (index < 0 || index > MAX_REGISTERS) {
- report_error( ctx, "%s[%i]: Invalid index %s",
- file_names[file], index, name );
+ if (index < 0 || index >= MAX_REGISTERS) {
+ report_error( ctx, "%s[%d]: Invalid %s index", file_names[file], index, name );
return FALSE;
}
@@ -193,15 +193,15 @@ iter_instruction(
info = tgsi_get_opcode_info( inst->Instruction.Opcode );
if (info == NULL) {
- report_error( ctx, "Invalid instruction opcode" );
+ report_error( ctx, "(%u): Invalid instruction opcode", inst->Instruction.Opcode );
return TRUE;
}
if (info->num_dst != inst->Instruction.NumDstRegs) {
- report_error( ctx, "Invalid number of destination operands" );
+ report_error( ctx, "Invalid number of destination operands, should be %u", info->num_dst );
}
if (info->num_src != inst->Instruction.NumSrcRegs) {
- report_error( ctx, "Invalid number of source operands" );
+ report_error( ctx, "Invalid number of source operands, should be %u", info->num_src );
}
/* Check destination and source registers' validity.
@@ -266,7 +266,7 @@ iter_declaration(
return TRUE;
for (i = decl->DeclarationRange.First; i <= decl->DeclarationRange.Last; i++) {
if (is_register_declared( ctx, file, i ))
- report_error( ctx, "The same register declared twice" );
+ report_error( ctx, "%s[%u]: The same register declared more than once", file_names[file], i );
ctx->regs_decl[file][i / BITS_IN_REG_FLAG] |= (1 << (i % BITS_IN_REG_FLAG));
}
@@ -295,7 +295,7 @@ iter_immediate(
/* Check data type validity.
*/
if (imm->Immediate.DataType != TGSI_IMM_FLOAT32) {
- report_error( ctx, "Invalid immediate data type" );
+ report_error( ctx, "(%u): Invalid immediate data type", imm->Immediate.DataType );
return TRUE;
}
@@ -322,7 +322,7 @@ epilog(
for (i = 0; i < MAX_REGISTERS; i++) {
if (is_register_declared( ctx, file, i ) && !is_register_used( ctx, file, i ) && !ctx->regs_ind_used[file]) {
- report_warning( ctx, "Register never used" );
+ report_warning( ctx, "%s[%u]: Register never used", file_names[file], i );
}
}
}
diff --git a/src/gallium/auxiliary/util/u_debug_memory.c b/src/gallium/auxiliary/util/u_debug_memory.c
index 758541c282..7623cb9398 100644
--- a/src/gallium/auxiliary/util/u_debug_memory.c
+++ b/src/gallium/auxiliary/util/u_debug_memory.c
@@ -73,7 +73,9 @@ struct debug_memory_header
const char *file;
unsigned line;
const char *function;
+#if DEBUG_MEMORY_STACK
struct debug_stack_frame backtrace[DEBUG_MEMORY_STACK];
+#endif
size_t size;
unsigned magic;
@@ -140,7 +142,9 @@ debug_malloc(const char *file, unsigned line, const char *function,
hdr->size = size;
hdr->magic = DEBUG_MEMORY_MAGIC;
+#if DEBUG_MEMORY_STACK
debug_backtrace_capture(hdr->backtrace, 0, DEBUG_MEMORY_STACK);
+#endif
ftr = footer_from_header(hdr);
ftr->magic = DEBUG_MEMORY_MAGIC;
@@ -296,7 +300,9 @@ debug_memory_end(unsigned long start_no)
debug_printf("%s:%u:%s: %u bytes at %p not freed\n",
hdr->file, hdr->line, hdr->function,
hdr->size, ptr);
+#if DEBUG_MEMORY_STACK
debug_backtrace_dump(hdr->backtrace, DEBUG_MEMORY_STACK);
+#endif
total_size += hdr->size;
}
diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c
index f282f3d289..f0bcd75899 100644
--- a/src/gallium/auxiliary/util/u_draw_quad.c
+++ b/src/gallium/auxiliary/util/u_draw_quad.c
@@ -51,9 +51,11 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
assert(num_attribs <= PIPE_MAX_ATTRIBS);
/* tell pipe about the vertex buffer */
+ memset(&vbuffer, 0, sizeof(vbuffer));
vbuffer.buffer = vbuf;
vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */
vbuffer.buffer_offset = offset;
+ vbuffer.max_index = num_verts - 1;
pipe->set_vertex_buffers(pipe, 1, &vbuffer);
/* tell pipe about the vertex attributes */
diff --git a/src/gallium/auxiliary/util/u_stream_stdc.c b/src/gallium/auxiliary/util/u_stream_stdc.c
index ca80bef0f3..0ead45a749 100644
--- a/src/gallium/auxiliary/util/u_stream_stdc.c
+++ b/src/gallium/auxiliary/util/u_stream_stdc.c
@@ -32,7 +32,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)
#include <stdio.h>
diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c
index dde2c74fa8..357d9360c9 100644
--- a/src/gallium/auxiliary/util/u_time.c
+++ b/src/gallium/auxiliary/util/u_time.c
@@ -35,7 +35,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
#include <sys/time.h>
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
#include <windows.h>
@@ -77,7 +77,7 @@ util_time_get_frequency(void)
void
util_time_get(struct util_time *t)
{
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
gettimeofday(&t->tv, NULL);
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
LONGLONG temp;
@@ -102,7 +102,7 @@ util_time_add(const struct util_time *t1,
int64_t usecs,
struct util_time *t2)
{
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000;
t2->tv.tv_usec = t1->tv.tv_usec + usecs % 1000000;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
@@ -124,7 +124,7 @@ int64_t
util_time_diff(const struct util_time *t1,
const struct util_time *t2)
{
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
return (t2->tv.tv_usec - t1->tv.tv_usec) +
(t2->tv.tv_sec - t1->tv.tv_sec)*1000000;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
@@ -144,7 +144,7 @@ util_time_micros( void )
util_time_get(&t1);
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
return t1.tv.tv_usec + t1.tv.tv_sec*1000000LL;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
util_time_get_frequency();
@@ -166,7 +166,7 @@ static INLINE int
util_time_compare(const struct util_time *t1,
const struct util_time *t2)
{
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
if (t1->tv.tv_sec < t2->tv.tv_sec)
return -1;
else if(t1->tv.tv_sec > t2->tv.tv_sec)
diff --git a/src/gallium/auxiliary/util/u_time.h b/src/gallium/auxiliary/util/u_time.h
index 35d97d16c7..4346ce1fa4 100644
--- a/src/gallium/auxiliary/util/u_time.h
+++ b/src/gallium/auxiliary/util/u_time.h
@@ -38,7 +38,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
#include <time.h> /* timeval */
#include <unistd.h> /* usleep */
#endif
@@ -58,7 +58,7 @@ extern "C" {
*/
struct util_time
{
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
struct timeval tv;
#else
int64_t counter;
@@ -89,7 +89,7 @@ util_time_timeout(const struct util_time *start,
const struct util_time *end,
const struct util_time *curr);
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
#define util_time_sleep usleep
#else
void
diff --git a/src/gallium/drivers/cell/ppu/cell_context.h b/src/gallium/drivers/cell/ppu/cell_context.h
index ca03dc1511..5c3188e7f9 100644
--- a/src/gallium/drivers/cell/ppu/cell_context.h
+++ b/src/gallium/drivers/cell/ppu/cell_context.h
@@ -127,15 +127,9 @@ struct cell_context
struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
uint num_vertex_elements;
- struct pipe_transfer *cbuf_transfer[PIPE_MAX_COLOR_BUFS];
- struct pipe_transfer *zsbuf_transfer;
-
ubyte *cbuf_map[PIPE_MAX_COLOR_BUFS];
ubyte *zsbuf_map;
- struct pipe_surface *tex_surf;
- uint *tex_map;
-
uint dirty;
uint dirty_textures; /* bitmask of texture units */
uint dirty_samplers; /* bitmask of sampler units */
diff --git a/src/gallium/drivers/cell/ppu/cell_fence.c b/src/gallium/drivers/cell/ppu/cell_fence.c
index 867b5dcaa0..32dbf5706c 100644
--- a/src/gallium/drivers/cell/ppu/cell_fence.c
+++ b/src/gallium/drivers/cell/ppu/cell_fence.c
@@ -153,16 +153,12 @@ cell_add_fenced_textures(struct cell_context *cell)
for (i = 0; i < cell->num_textures; i++) {
struct cell_texture *ct = cell->texture[i];
if (ct) {
- uint level;
- for (level = 0; level < CELL_MAX_TEXTURE_LEVELS; level++) {
- if (ct->tiled_buffer[level]) {
#if 0
- printf("Adding texture %p buffer %p to list\n",
- ct, ct->tiled_buffer[level]);
+ printf("Adding texture %p buffer %p to list\n",
+ ct, ct->tiled_buffer[level]);
#endif
- cell_add_buffer_to_list(cell, list, ct->tiled_buffer[level]);
- }
- }
+ if (ct->buffer)
+ cell_add_buffer_to_list(cell, list, ct->buffer);
}
}
}
diff --git a/src/gallium/drivers/cell/ppu/cell_pipe_state.c b/src/gallium/drivers/cell/ppu/cell_pipe_state.c
index facd9551fe..ccd0fef6e8 100644
--- a/src/gallium/drivers/cell/ppu/cell_pipe_state.c
+++ b/src/gallium/drivers/cell/ppu/cell_pipe_state.c
@@ -285,28 +285,22 @@ cell_map_surfaces(struct cell_context *cell)
for (i = 0; i < 1; i++) {
struct pipe_surface *ps = cell->framebuffer.cbufs[i];
if (ps) {
- cell->cbuf_transfer[i] =
- screen->get_tex_transfer(screen, ps->texture, ps->face,
- ps->level, ps->zslice,
- PIPE_TRANSFER_READ_WRITE,
- 0, 0, ps->width, ps->height);
-
- cell->cbuf_map[i] =
- screen->transfer_map(screen, cell->cbuf_transfer[i]);
+ struct cell_texture *ct = cell_texture(ps->texture);
+ cell->cbuf_map[i] = screen->buffer_map(screen,
+ ct->buffer,
+ (PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_GPU_WRITE));
}
}
{
struct pipe_surface *ps = cell->framebuffer.zsbuf;
if (ps) {
- cell->zsbuf_transfer =
- screen->get_tex_transfer(screen, ps->texture, ps->face,
- ps->level, ps->zslice,
- PIPE_TRANSFER_READ_WRITE,
- 0, 0, ps->width, ps->height);
-
- cell->zsbuf_map =
- screen->transfer_map(screen, cell->zsbuf_transfer);
+ struct cell_texture *ct = cell_texture(ps->texture);
+ cell->zsbuf_map = screen->buffer_map(screen,
+ ct->buffer,
+ (PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_GPU_WRITE));
}
}
}
@@ -322,24 +316,24 @@ cell_unmap_surfaces(struct cell_context *cell)
uint i;
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
- if (cell->cbuf_transfer[i] && cell->cbuf_map[i]) {
- /* unmap color buffer/surface [i] */
- screen->transfer_unmap(screen, cell->cbuf_transfer[i]);
- cell->cbuf_map[i] = NULL;
+ struct pipe_surface *ps = cell->framebuffer.cbufs[i];
+ if (ps && cell->cbuf_map[i]) {
+ struct cell_texture *ct = cell_texture(ps->texture);
+ assert(ps->texture);
+ assert(ct->buffer);
- /* get rid of transfer object [i] */
- screen->tex_transfer_release(screen, &cell->cbuf_transfer[i]);
- assert(cell->cbuf_transfer[i] == NULL);
+ screen->buffer_unmap(screen, ct->buffer);
+ cell->cbuf_map[i] = NULL;
}
}
- if (cell->zsbuf_transfer && cell->zsbuf_map) {
- screen->transfer_unmap(screen, cell->zsbuf_transfer);
- cell->zsbuf_map = NULL;
-
- /* get rid of transfer object */
- screen->tex_transfer_release(screen, &cell->zsbuf_transfer);
- assert(cell->zsbuf_transfer == NULL);
+ {
+ struct pipe_surface *ps = cell->framebuffer.zsbuf;
+ if (ps && cell->zsbuf_map) {
+ struct cell_texture *ct = cell_texture(ps->texture);
+ screen->buffer_unmap(screen, ct->buffer);
+ cell->zsbuf_map = NULL;
+ }
}
}
diff --git a/src/gallium/drivers/cell/ppu/cell_state_emit.c b/src/gallium/drivers/cell/ppu/cell_state_emit.c
index ff529fe22c..9479c0898f 100644
--- a/src/gallium/drivers/cell/ppu/cell_state_emit.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_emit.c
@@ -287,19 +287,23 @@ cell_emit_state(struct cell_context *cell)
for (i = 0;i < CELL_MAX_SAMPLERS; i++) {
if (cell->dirty_textures & (1 << i)) {
STATIC_ASSERT(sizeof(struct cell_command_texture) % 16 == 0);
- struct cell_command_texture *texture
- = (struct cell_command_texture *)cell_batch_alloc16(cell, sizeof(*texture));
+ struct cell_command_texture *texture =
+ (struct cell_command_texture *)
+ cell_batch_alloc16(cell, sizeof(*texture));
+
texture->opcode[0] = CELL_CMD_STATE_TEXTURE;
texture->unit = i;
if (cell->texture[i]) {
+ struct cell_texture *ct = cell->texture[i];
uint level;
for (level = 0; level < CELL_MAX_TEXTURE_LEVELS; level++) {
- texture->start[level] = cell->texture[i]->tiled_mapped[level];
- texture->width[level] = cell->texture[i]->base.width[level];
- texture->height[level] = cell->texture[i]->base.height[level];
- texture->depth[level] = cell->texture[i]->base.depth[level];
+ texture->start[level] = (ct->mapped +
+ ct->level_offset[level]);
+ texture->width[level] = ct->base.width[level];
+ texture->height[level] = ct->base.height[level];
+ texture->depth[level] = ct->base.depth[level];
}
- texture->target = cell->texture[i]->base.target;
+ texture->target = ct->base.target;
}
else {
uint level;
diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c
index fa52e2cbea..74724393f7 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.c
+++ b/src/gallium/drivers/cell/ppu/cell_texture.c
@@ -62,7 +62,7 @@ cell_texture_layout(struct cell_texture *ct)
ct->buffer_size = 0;
- for ( level = 0 ; level <= pt->last_level ; level++ ) {
+ for (level = 0; level <= pt->last_level; level++) {
unsigned size;
unsigned w_tile, h_tile;
@@ -90,7 +90,7 @@ cell_texture_layout(struct cell_texture *ct)
ct->buffer_size += size;
- width = minify(width);
+ width = minify(width);
height = minify(height);
depth = minify(depth);
}
@@ -131,33 +131,19 @@ cell_texture_release(struct pipe_screen *screen,
if (!*pt)
return;
- /*
- DBG("%s %p refcount will be %d\n",
- __FUNCTION__, (void *) *pt, (*pt)->refcount - 1);
- */
if (--(*pt)->refcount <= 0) {
/* Delete this texture now.
* But note that the underlying pipe_buffer may linger...
*/
struct cell_texture *ct = cell_texture(*pt);
- uint i;
- /*
- DBG("%s deleting %p\n", __FUNCTION__, (void *) ct);
- */
+ if (ct->mapped) {
+ pipe_buffer_unmap(screen, ct->buffer);
+ ct->mapped = NULL;
+ }
pipe_buffer_reference(screen, &ct->buffer, NULL);
- for (i = 0; i < CELL_MAX_TEXTURE_LEVELS; i++) {
- /* Unreference the tiled image buffer.
- * It may not actually be deleted until a fence is hit.
- */
- if (ct->tiled_buffer[i]) {
- ct->tiled_mapped[i] = NULL;
- pipe_buffer_reference(screen, &ct->tiled_buffer[i], NULL);
- }
- }
-
FREE(ct);
}
*pt = NULL;
@@ -294,107 +280,6 @@ untwiddle_image_uint(uint w, uint h, uint tile_size, uint *dst,
}
-/**
- * Convert linear texture image data to tiled format for SPU usage.
- */
-static void
-cell_twiddle_texture(struct pipe_screen *screen,
- struct pipe_surface *surface)
-{
-#if 0 // XXX fix me
- struct cell_texture *ct = cell_texture(surface->texture);
- const uint level = surface->level;
- const uint texWidth = ct->base.width[level];
- const uint texHeight = ct->base.height[level];
- const uint bufWidth = align(texWidth, TILE_SIZE);
- const uint bufHeight = align(texHeight, TILE_SIZE);
- const void *map = screen->surface_map(screen, surface, PIPE_BUFFER_USAGE_CPU_READ);
- const uint *src = (const uint *) map;
-
- switch (ct->base.format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
- {
- int numFaces = ct->base.target == PIPE_TEXTURE_CUBE ? 6 : 1;
- int offset = bufWidth * bufHeight * 4 * surface->face;
- uint *dst;
-
- if (!ct->tiled_buffer[level]) {
- /* allocate buffer for tiled data now */
- struct pipe_winsys *ws = screen->winsys;
- uint bytes = bufWidth * bufHeight * 4 * numFaces;
- ct->tiled_buffer[level] =
- ws->buffer_create(ws, 16, PIPE_BUFFER_USAGE_PIXEL, bytes);
- /* and map it */
- ct->tiled_mapped[level] =
- ws->buffer_map(ws, ct->tiled_buffer[level],
- PIPE_BUFFER_USAGE_GPU_READ);
- }
- dst = (uint *) ((ubyte *) ct->tiled_mapped[level] + offset);
-
- twiddle_image_uint(texWidth, texHeight, TILE_SIZE, dst,
- surface->stride, src);
- }
- break;
- default:
- printf("Cell: twiddle unsupported texture format %s\n",
- pf_name(ct->base.format));
- }
-
- screen->surface_unmap(screen, surface);
-#endif
-}
-
-
-/**
- * Convert SPU tiled texture image data to linear format for app usage.
- */
-static void
-cell_untwiddle_texture(struct pipe_screen *screen,
- struct pipe_surface *surface)
-{
-#if 0 // XXX fix me
- struct cell_texture *ct = cell_texture(surface->texture);
- const uint level = surface->level;
- const uint texWidth = ct->base.width[level];
- const uint texHeight = ct->base.height[level];
- const void *map = screen->surface_map(screen, surface, PIPE_BUFFER_USAGE_CPU_READ);
- const uint *src = (const uint *) ((const ubyte *) map + surface->offset);
-
- switch (ct->base.format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
- {
- int numFaces = ct->base.target == PIPE_TEXTURE_CUBE ? 6 : 1;
- int offset = surface->stride * texHeight * 4 * surface->face;
- uint *dst;
-
- if (!ct->untiled_data[level]) {
- ct->untiled_data[level] =
- align_malloc(surface->stride * texHeight * 4 * numFaces, 16);
- }
-
- dst = (uint *) ((ubyte *) ct->untiled_data[level] + offset);
-
- untwiddle_image_uint(texWidth, texHeight, TILE_SIZE, dst,
- surface->stride, src);
- }
- break;
- default:
- {
- ct->untiled_data[level] = NULL;
- printf("Cell: untwiddle unsupported texture format %s\n",
- pf_name(ct->base.format));
- }
- }
-
- screen->surface_unmap(screen, surface);
-#endif
-}
-
-
static struct pipe_surface *
cell_get_tex_surface(struct pipe_screen *screen,
struct pipe_texture *pt,
@@ -409,38 +294,25 @@ cell_get_tex_surface(struct pipe_screen *screen,
ps->refcount = 1;
pipe_texture_reference(&ps->texture, pt);
ps->format = pt->format;
- //ps->block = pt->block;
ps->width = pt->width[level];
ps->height = pt->height[level];
- //ps->nblocksx = pt->nblocksx[level];
- //ps->nblocksy = pt->nblocksy[level];
- //ps->stride = ct->stride[level];
ps->offset = ct->level_offset[level];
- ps->usage = usage;
-
/* XXX may need to override usage flags (see sp_texture.c) */
-
- pipe_texture_reference(&ps->texture, pt);
+ ps->usage = usage;
ps->face = face;
ps->level = level;
ps->zslice = zslice;
- if (pt->target == PIPE_TEXTURE_CUBE || pt->target == PIPE_TEXTURE_3D) {
-#if 0 // XXX fix me
- ps->offset += ((pt->target == PIPE_TEXTURE_CUBE) ? face : zslice) *
- ps->nblocksy *
- ps->stride;
-#endif
+ if (pt->target == PIPE_TEXTURE_CUBE) {
+ ps->offset += face * pt->nblocksy[level] * ct->stride[level];
+ }
+ else if (pt->target == PIPE_TEXTURE_3D) {
+ ps->offset += zslice * pt->nblocksy[level] * ct->stride[level];
}
else {
assert(face == 0);
assert(zslice == 0);
}
-
- if (ps->usage & PIPE_BUFFER_USAGE_CPU_READ) {
- /* convert from tiled to linear layout */
- cell_untwiddle_texture(screen, ps);
- }
}
return ps;
}
@@ -450,24 +322,8 @@ static void
cell_tex_surface_release(struct pipe_screen *screen,
struct pipe_surface **s)
{
- struct cell_texture *ct = cell_texture((*s)->texture);
- const uint level = (*s)->level;
struct pipe_surface *surf = *s;
- if ((surf->usage & PIPE_BUFFER_USAGE_CPU_READ) && (ct->untiled_data[level]))
- {
- align_free(ct->untiled_data[level]);
- ct->untiled_data[level] = NULL;
- }
-
- if ((ct->base.tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) &&
- (surf->usage & PIPE_BUFFER_USAGE_CPU_WRITE)) {
- /* convert from linear to tiled layout */
- cell_twiddle_texture(screen, surf);
- }
-
- /* XXX if done rendering to teximage, re-tile */
-
if (--surf->refcount == 0) {
pipe_texture_reference(&surf->texture, NULL);
FREE(surf);
@@ -476,6 +332,11 @@ cell_tex_surface_release(struct pipe_screen *screen,
}
+/**
+ * Create new pipe_transfer object.
+ * This is used by the user to put tex data into a texture (and get it
+ * back out for glGetTexImage).
+ */
static struct pipe_transfer *
cell_get_tex_transfer(struct pipe_screen *screen,
struct pipe_texture *texture,
@@ -485,14 +346,13 @@ cell_get_tex_transfer(struct pipe_screen *screen,
{
struct cell_texture *ct = cell_texture(texture);
struct cell_transfer *ctrans;
- struct pipe_transfer *pt;
assert(texture);
assert(level <= texture->last_level);
ctrans = CALLOC_STRUCT(cell_transfer);
- pt = &ctrans->base;
if (ctrans) {
+ struct pipe_transfer *pt = &ctrans->base;
pt->refcount = 1;
pipe_texture_reference(&pt->texture, texture);
pt->format = texture->format;
@@ -504,23 +364,26 @@ cell_get_tex_transfer(struct pipe_screen *screen,
pt->nblocksx = texture->nblocksx[level];
pt->nblocksy = texture->nblocksy[level];
pt->stride = ct->stride[level];
- ctrans->offset = ct->level_offset[level];
pt->usage = usage;
pt->face = face;
pt->level = level;
pt->zslice = zslice;
- if (texture->target == PIPE_TEXTURE_CUBE ||
- texture->target == PIPE_TEXTURE_3D) {
- ctrans->offset += ((texture->target == PIPE_TEXTURE_CUBE) ? face :
- zslice) * pt->nblocksy * pt->stride;
+ ctrans->offset = ct->level_offset[level];
+
+ if (texture->target == PIPE_TEXTURE_CUBE) {
+ ctrans->offset += face * pt->nblocksy * pt->stride;
+ }
+ else if (texture->target == PIPE_TEXTURE_3D) {
+ ctrans->offset += zslice * pt->nblocksy * pt->stride;
}
else {
assert(face == 0);
assert(zslice == 0);
}
+ return pt;
}
- return pt;
+ return NULL;
}
@@ -542,16 +405,23 @@ cell_tex_transfer_release(struct pipe_screen *screen,
}
+/**
+ * Return pointer to texture image data in linear layout.
+ */
static void *
-cell_transfer_map( struct pipe_screen *screen,
- struct pipe_transfer *transfer )
+cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer)
{
- ubyte *map;
- struct cell_texture *spt;
- unsigned flags = 0;
+ struct cell_transfer *ctrans = cell_transfer(transfer);
+ struct pipe_texture *pt = transfer->texture;
+ struct cell_texture *ct = cell_texture(pt);
+ const uint level = ctrans->base.level;
+ const uint texWidth = pt->width[level];
+ const uint texHeight = pt->height[level];
+ const uint stride = ct->stride[level];
+ unsigned flags = 0x0;
+ unsigned size;
assert(transfer->texture);
- spt = cell_texture(transfer->texture);
if (transfer->usage != PIPE_TRANSFER_READ) {
flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
@@ -561,89 +431,82 @@ cell_transfer_map( struct pipe_screen *screen,
flags |= PIPE_BUFFER_USAGE_CPU_READ;
}
- map = pipe_buffer_map(screen, spt->buffer, flags);
- if (map == NULL)
- return NULL;
+ if (!ct->mapped) {
+ /* map now */
+ ct->mapped = pipe_buffer_map(screen, ct->buffer, flags);
+ }
- /* May want to different things here depending on read/write nature
- * of the map:
+ /*
+ * Create a buffer of ordinary memory for the linear texture.
+ * This is the memory that the user will read/write.
*/
- if (transfer->texture && transfer->usage != PIPE_TRANSFER_READ)
- {
- /* Do something to notify sharing contexts of a texture change.
- * In cell, that would mean flushing the texture cache.
- */
-#if 00
- cell_screen(screen)->timestamp++;
-#endif
+ size = pt->nblocksx[level] * pt->nblocksy[level] * pt->block.size;
+
+ ctrans->map = align_malloc(size, 16);
+ if (!ctrans->map)
+ return NULL; /* out of memory */
+
+ if (transfer->usage & PIPE_TRANSFER_READ) {
+ /* need to untwiddle the texture to make a linear version */
+ const uint bpp = pf_get_size(ct->base.format);
+ if (bpp == 4) {
+ const uint *src = (uint *) (ct->mapped + ctrans->offset);
+ uint *dst = ctrans->map;
+ untwiddle_image_uint(texWidth, texHeight, TILE_SIZE,
+ dst, stride, src);
+ }
+ else {
+ // xxx fix
+ }
}
-
- return map + cell_transfer(transfer)->offset +
- transfer->y / transfer->block.height * transfer->stride +
- transfer->x / transfer->block.width * transfer->block.size;
+
+ return ctrans->map;
}
+/**
+ * Called when user is done reading/writing texture data.
+ * If new data was written, this is where we convert the linear data
+ * to tiled data.
+ */
static void
cell_transfer_unmap(struct pipe_screen *screen,
- struct pipe_transfer *transfer)
+ struct pipe_transfer *transfer)
{
- struct cell_texture *spt;
-
- assert(transfer->texture);
- spt = cell_texture(transfer->texture);
-
- pipe_buffer_unmap( screen, spt->buffer );
-}
-
-
-static void *
-cell_surface_map(struct pipe_screen *screen,
- struct pipe_surface *surface,
- unsigned flags)
-{
- ubyte *map;
- struct cell_texture *ct = cell_texture(surface->texture);
- const uint level = surface->level;
-
- assert(ct);
-
-#if 0
- if (flags & ~surface->usage) {
- assert(0);
- return NULL;
+ struct cell_transfer *ctrans = cell_transfer(transfer);
+ struct pipe_texture *pt = transfer->texture;
+ struct cell_texture *ct = cell_texture(pt);
+ const uint level = ctrans->base.level;
+ const uint texWidth = pt->width[level];
+ const uint texHeight = pt->height[level];
+ const uint stride = ct->stride[level];
+
+ if (!ct->mapped) {
+ /* map now */
+ ct->mapped = pipe_buffer_map(screen, ct->buffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
}
-#endif
- map = pipe_buffer_map( screen, ct->buffer, flags );
- if (map == NULL) {
- return NULL;
- }
- else {
- if ((surface->usage & PIPE_BUFFER_USAGE_CPU_READ) &&
- (ct->untiled_data[level])) {
- return (void *) ((ubyte *) ct->untiled_data[level] + surface->offset);
+ if (transfer->usage & PIPE_TRANSFER_WRITE) {
+ /* The user wrote new texture data into the mapped buffer.
+ * We need to convert the new linear data into the twiddled/tiled format.
+ */
+ const uint bpp = pf_get_size(ct->base.format);
+ if (bpp == 4) {
+ const uint *src = ctrans->map;
+ uint *dst = (uint *) (ct->mapped + ctrans->offset);
+ twiddle_image_uint(texWidth, texHeight, TILE_SIZE, dst, stride, src);
}
else {
- return (void *) (map + surface->offset);
+ // xxx fix
}
}
-}
-
-
-static void
-cell_surface_unmap(struct pipe_screen *screen,
- struct pipe_surface *surface)
-{
- struct cell_texture *ct = cell_texture(surface->texture);
-
- assert(ct);
- pipe_buffer_unmap( screen, ct->buffer );
+ align_free(ctrans->map);
+ ctrans->map = NULL;
}
-
void
cell_init_screen_texture_funcs(struct pipe_screen *screen)
{
@@ -655,6 +518,7 @@ cell_init_screen_texture_funcs(struct pipe_screen *screen)
screen->get_tex_transfer = cell_get_tex_transfer;
screen->tex_transfer_release = cell_tex_transfer_release;
+
screen->transfer_map = cell_transfer_map;
screen->transfer_unmap = cell_transfer_unmap;
}
diff --git a/src/gallium/drivers/cell/ppu/cell_texture.h b/src/gallium/drivers/cell/ppu/cell_texture.h
index fc6486adbe..3ffc0bfdb5 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.h
+++ b/src/gallium/drivers/cell/ppu/cell_texture.h
@@ -43,20 +43,14 @@ struct cell_texture
unsigned long level_offset[CELL_MAX_TEXTURE_LEVELS];
unsigned long stride[CELL_MAX_TEXTURE_LEVELS];
- /* The data is held here:
- */
+ /** The tiled texture data is held in this buffer */
struct pipe_buffer *buffer;
unsigned long buffer_size;
- /** Texture data in tiled layout is held here */
- struct pipe_buffer *tiled_buffer[CELL_MAX_TEXTURE_LEVELS];
- /** Mapped, tiled texture data */
- void *tiled_mapped[CELL_MAX_TEXTURE_LEVELS];
-
- struct pipe_transfer *transfer;
-
- /** The original, linear texture data */
- void *untiled_data[CELL_MAX_TEXTURE_LEVELS];
+ /** The buffer above, mapped. This is the memory from which the
+ * SPUs will fetch texels. This texture data is in the tiled layout.
+ */
+ ubyte *mapped;
};
@@ -65,6 +59,7 @@ struct cell_transfer
struct pipe_transfer base;
unsigned long offset;
+ void *map;
};
diff --git a/src/gallium/drivers/i915simple/i915_screen.c b/src/gallium/drivers/i915simple/i915_screen.c
index b7bd3b3b74..49471287a2 100644
--- a/src/gallium/drivers/i915simple/i915_screen.c
+++ b/src/gallium/drivers/i915simple/i915_screen.c
@@ -36,6 +36,7 @@
#include "i915_context.h"
#include "i915_screen.h"
#include "i915_texture.h"
+#include "i915_winsys.h"
static const char *
diff --git a/src/gallium/drivers/i915simple/i915_screen.h b/src/gallium/drivers/i915simple/i915_screen.h
index a371663453..5284c32595 100644
--- a/src/gallium/drivers/i915simple/i915_screen.h
+++ b/src/gallium/drivers/i915simple/i915_screen.h
@@ -75,10 +75,6 @@ i915_transfer( struct pipe_transfer *transfer )
}
-extern struct pipe_screen *
-i915_create_screen(struct pipe_winsys *winsys, uint pci_id);
-
-
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/drivers/i915simple/i915_state_emit.c b/src/gallium/drivers/i915simple/i915_state_emit.c
index 26e03f5127..1e1fb968b4 100644
--- a/src/gallium/drivers/i915simple/i915_state_emit.c
+++ b/src/gallium/drivers/i915simple/i915_state_emit.c
@@ -214,7 +214,6 @@ i915_emit_hardware_state(struct i915_context *i915 )
unsigned ctile = BUF_3D_USE_FENCE;
struct i915_texture *tex = (struct i915_texture *)
cbuf_surface->texture;
- struct pipe_buffer *buffer = tex->buffer;
assert(tex);
if (tex && tex->tiled) {
@@ -238,7 +237,6 @@ i915_emit_hardware_state(struct i915_context *i915 )
unsigned ztile = BUF_3D_USE_FENCE;
struct i915_texture *tex = (struct i915_texture *)
depth_surface->texture;
- struct pipe_buffer *buffer = tex->buffer;
assert(tex);
if (tex && tex->tiled) {
diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c
index 957726523f..6aead3e75e 100644
--- a/src/gallium/drivers/i915simple/i915_texture.c
+++ b/src/gallium/drivers/i915simple/i915_texture.c
@@ -42,6 +42,7 @@
#include "i915_texture.h"
#include "i915_debug.h"
#include "i915_screen.h"
+#include "i915_winsys.h"
/*
* Helper function and arrays
@@ -765,3 +766,20 @@ i915_init_screen_texture_functions(struct pipe_screen *screen)
screen->texture_blanket = i915_texture_blanket;
screen->tex_surface_release = i915_tex_surface_release;
}
+
+boolean i915_get_texture_buffer( struct pipe_texture *texture,
+ struct pipe_buffer **buf,
+ unsigned *stride )
+{
+ struct i915_texture *tex = (struct i915_texture *)texture;
+
+ if (!tex)
+ return FALSE;
+
+ pipe_buffer_reference(texture->screen, buf, tex->buffer);
+
+ if (stride)
+ *stride = tex->stride;
+
+ return TRUE;
+}
diff --git a/src/gallium/drivers/i915simple/i915_winsys.h b/src/gallium/drivers/i915simple/i915_winsys.h
index 81904c2a74..ff5b34f193 100644
--- a/src/gallium/drivers/i915simple/i915_winsys.h
+++ b/src/gallium/drivers/i915simple/i915_winsys.h
@@ -30,7 +30,8 @@
* This is the interface that i915simple requires any window system
* hosting it to implement. This is the only include file in i915simple
* which is public.
- *
+ *
+ * This isn't currently true as the winsys needs i915_batchbuffer.h
*/
#ifndef I915_WINSYS_H
@@ -45,10 +46,9 @@ extern "C" {
#endif
-/* Pipe drivers are (meant to be!) independent of both GL and the
- * window system. The window system provides a buffer manager and a
- * set of additional hooks for things like command buffer submission,
- * etc.
+/* Pipe drivers are independent of both GL and the window system.
+ * The window system provides a buffer manager and a set of additional
+ * hooks for things like command buffer submission, etc.
*
* There clearly has to be some agreement between the window system
* driver and the hardware driver about the format of command buffers,
@@ -56,6 +56,7 @@ extern "C" {
*/
struct i915_batchbuffer;
+struct pipe_texture;
struct pipe_buffer;
struct pipe_fence_handle;
struct pipe_winsys;
@@ -64,7 +65,7 @@ struct pipe_screen;
/**
* Additional winsys interface for i915simple.
- *
+ *
* It is an over-simple batchbuffer mechanism. Will want to improve the
* performance of this, perhaps based on the cmdstream stuff. It
* would be pretty impossible to implement swz on top of this
@@ -110,12 +111,33 @@ struct i915_winsys {
#define I915_BUFFER_USAGE_LIT_VERTEX (PIPE_BUFFER_USAGE_CUSTOM << 0)
-struct pipe_context *i915_create_context( struct pipe_screen *,
- struct pipe_winsys *,
- struct i915_winsys * );
+/**
+ * Create i915 pipe_screen.
+ */
+struct pipe_screen *i915_create_screen( struct pipe_winsys *winsys,
+ uint pci_id );
+
+/**
+ * Create a i915 pipe_context.
+ */
+struct pipe_context *i915_create_context( struct pipe_screen *screen,
+ struct pipe_winsys *winsys,
+ struct i915_winsys *i915 );
+
+/**
+ * Used for the winsys to get the buffer used for a texture
+ * and also the stride used for the texture.
+ *
+ * Buffer is referenced for you so you need to unref after use.
+ *
+ * This is needed for example kms.
+ */
+boolean i915_get_texture_buffer( struct pipe_texture *texture,
+ struct pipe_buffer **buf,
+ unsigned *stride );
#ifdef __cplusplus
}
#endif
-#endif
+#endif
diff --git a/src/gallium/drivers/nv04/Makefile b/src/gallium/drivers/nv04/Makefile
index cf9deea851..7c14bacb1d 100644
--- a/src/gallium/drivers/nv04/Makefile
+++ b/src/gallium/drivers/nv04/Makefile
@@ -15,6 +15,7 @@ C_SOURCES = \
nv04_state.c \
nv04_state_emit.c \
nv04_surface.c \
+ nv04_transfer.c \
nv04_vbo.c
include ../../Makefile.template
diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c
index 993c5ef5dd..9acd613e2e 100644
--- a/src/gallium/drivers/nv04/nv04_miptree.c
+++ b/src/gallium/drivers/nv04/nv04_miptree.c
@@ -50,8 +50,6 @@ nv04_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
mt->base = *pt;
mt->base.refcount = 1;
mt->base.screen = pscreen;
- mt->shadow_tex = NULL;
- mt->shadow_surface = NULL;
//mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
@@ -111,12 +109,6 @@ nv04_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt)
FREE(mt->level[l].image_offset);
}
- if (mt->shadow_tex) {
- assert(mt->shadow_surface);
- pscreen->tex_surface_release(pscreen, &mt->shadow_surface);
- nv04_miptree_release(pscreen, &mt->shadow_tex);
- }
-
FREE(mt);
}
@@ -126,29 +118,26 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
unsigned flags)
{
struct nv04_miptree *nv04mt = (struct nv04_miptree *)pt;
- struct pipe_surface *ps;
+ struct nv04_surface *ns;
- ps = CALLOC_STRUCT(pipe_surface);
- if (!ps)
+ ns = CALLOC_STRUCT(nv04_surface);
+ if (!ns)
return NULL;
- pipe_texture_reference(&ps->texture, pt);
- ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
- ps->block = pt->block;
- ps->nblocksx = pt->nblocksx[level];
- ps->nblocksy = pt->nblocksy[level];
- ps->stride = nv04mt->level[level].pitch;
- ps->usage = flags;
- ps->status = PIPE_SURFACE_STATUS_DEFINED;
- ps->refcount = 1;
- ps->face = face;
- ps->level = level;
- ps->zslice = zslice;
-
- ps->offset = nv04mt->level[level].image_offset;
-
- return ps;
+ pipe_texture_reference(&ns->base.texture, pt);
+ ns->base.format = pt->format;
+ ns->base.width = pt->width[level];
+ ns->base.height = pt->height[level];
+ ns->base.usage = flags;
+ ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
+ ns->base.refcount = 1;
+ ns->base.face = face;
+ ns->base.level = level;
+ ns->base.zslice = zslice;
+ ns->pitch = nv04mt->level[level].pitch;
+
+ ns->base.offset = nv04mt->level[level].image_offset;
+
+ return &ns->base;
}
static void
diff --git a/src/gallium/drivers/nv04/nv04_screen.c b/src/gallium/drivers/nv04/nv04_screen.c
index 9ef38bc244..f9f6d97426 100644
--- a/src/gallium/drivers/nv04/nv04_screen.c
+++ b/src/gallium/drivers/nv04/nv04_screen.c
@@ -119,28 +119,6 @@ nv04_screen_is_format_supported(struct pipe_screen *screen,
return FALSE;
}
-static void *
-nv04_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
- unsigned flags )
-{
- void *map;
- struct nv04_miptree *nv04mt = (struct nv04_miptree *)surface->texture;
-
- map = pipe_buffer_map(screen, nv04mt->buffer, flags);
- if (!map)
- return NULL;
-
- return map + surface->offset;
-}
-
-static void
-nv04_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
-{
- struct nv04_miptree *nv04mt = (struct nv04_miptree *)surface->texture;
-
- pipe_buffer_unmap(screen, nv04mt->buffer);
-}
-
static void
nv04_screen_destroy(struct pipe_screen *pscreen)
{
@@ -226,10 +204,8 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.is_format_supported = nv04_screen_is_format_supported;
- screen->pipe.surface_map = nv04_surface_map;
- screen->pipe.surface_unmap = nv04_surface_unmap;
-
nv04_screen_init_miptree_functions(&screen->pipe);
+ nv04_screen_init_transfer_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
diff --git a/src/gallium/drivers/nv04/nv04_screen.h b/src/gallium/drivers/nv04/nv04_screen.h
index 540aec907b..ee6fb6db44 100644
--- a/src/gallium/drivers/nv04/nv04_screen.h
+++ b/src/gallium/drivers/nv04/nv04_screen.h
@@ -24,4 +24,7 @@ nv04_screen(struct pipe_screen *screen)
return (struct nv04_screen *)screen;
}
+void
+nv04_screen_init_transfer_functions(struct pipe_screen *pscreen);
+
#endif
diff --git a/src/gallium/drivers/nv04/nv04_state.h b/src/gallium/drivers/nv04/nv04_state.h
index 15d4685ec1..0d51439e3f 100644
--- a/src/gallium/drivers/nv04/nv04_state.h
+++ b/src/gallium/drivers/nv04/nv04_state.h
@@ -35,9 +35,6 @@ struct nv04_miptree {
struct pipe_buffer *buffer;
uint total_size;
- struct pipe_texture *shadow_tex;
- struct pipe_surface *shadow_surface;
-
struct {
uint pitch;
uint image_offset;
diff --git a/src/gallium/drivers/nv04/nv04_state_emit.c b/src/gallium/drivers/nv04/nv04_state_emit.c
index bd8ef1adbf..eb2c1c57c6 100644
--- a/src/gallium/drivers/nv04/nv04_state_emit.c
+++ b/src/gallium/drivers/nv04/nv04_state_emit.c
@@ -93,7 +93,7 @@ static void nv04_emit_sampler(struct nv04_context *nv04, int unit)
static void nv04_state_emit_framebuffer(struct nv04_context* nv04)
{
struct pipe_framebuffer_state* fb = nv04->framebuffer;
- struct pipe_surface *rt, *zeta;
+ struct nv04_surface *rt, *zeta;
uint32_t rt_format, w, h;
int colour_format = 0, zeta_format = 0;
struct nv04_miptree *nv04mt = 0;
@@ -101,7 +101,7 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04)
w = fb->cbufs[0]->width;
h = fb->cbufs[0]->height;
colour_format = fb->cbufs[0]->format;
- rt = fb->cbufs[0];
+ rt = (struct nv04_surface *)fb->cbufs[0];
if (fb->zsbuf) {
if (colour_format) {
@@ -113,7 +113,7 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04)
}
zeta_format = fb->zsbuf->format;
- zeta = fb->zsbuf;
+ zeta = (struct nv04_surface *)fb->zsbuf;
}
switch (colour_format) {
@@ -131,13 +131,13 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04)
BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_FORMAT, 1);
OUT_RING(rt_format);
- nv04mt = (struct nv04_miptree *)rt->texture;
+ nv04mt = (struct nv04_miptree *)rt->base.texture;
/* FIXME pitches have to be aligned ! */
BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_PITCH, 2);
- OUT_RING(rt->stride|(zeta->stride<<16));
+ OUT_RING(rt->pitch|(zeta->pitch<<16));
OUT_RELOCl(nv04mt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
if (fb->zsbuf) {
- nv04mt = (struct nv04_miptree *)zeta->texture;
+ nv04mt = (struct nv04_miptree *)zeta->base.texture;
BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA, 1);
OUT_RELOCl(nv04mt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
}
@@ -202,8 +202,11 @@ nv04_emit_hw_state(struct nv04_context *nv04)
*/
/* Render target */
+ unsigned rt_pitch = ((struct nv04_surface *)nv04->rt)->pitch;
+ unsigned zeta_pitch = ((struct nv04_surface *)nv04->zeta)->pitch;
+
BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_PITCH, 2);
- OUT_RING(nv04->rt->stride|(nv04->zeta->stride<<16));
+ OUT_RING(rt_pitch|(zeta_pitch<<16));
OUT_RELOCl(nv04->rt, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
if (nv04->zeta) {
BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA, 1);
diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c
index 230cfd17dd..e8fd3166ab 100644
--- a/src/gallium/drivers/nv04/nv04_surface_2d.c
+++ b/src/gallium/drivers/nv04/nv04_surface_2d.c
@@ -101,6 +101,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
struct nouveau_grobj *sifm = ctx->sifm;
struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
+ const unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
const unsigned max_w = 1024;
const unsigned max_h = 1024;
const unsigned sub_w = w > max_w ? max_w : w;
@@ -110,6 +111,8 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
/* POT or GTFO */
assert(!(w & (w - 1)) && !(h & (h - 1)));
+ /* That's the way she likes it */
+ assert(src_pitch == ((struct nv04_surface *)dst)->pitch);
BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_DMA_IMAGE, 1);
OUT_RELOCo(chan, dst_bo,
@@ -130,7 +133,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
for (cx = 0; cx < w; cx += sub_w) {
BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1);
OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(cx, cy) *
- dst->block.size, NOUVEAU_BO_GART |
+ dst->texture->block.size, NOUVEAU_BO_GART |
NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9);
@@ -146,11 +149,11 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_SIZE, 4);
OUT_RING (chan, sub_h << 16 | sub_w);
- OUT_RING (chan, src->stride |
+ OUT_RING (chan, src_pitch |
NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER |
NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE);
- OUT_RELOCl(chan, src_bo, src->offset + cy * src->stride +
- cx * src->block.size, NOUVEAU_BO_GART |
+ OUT_RELOCl(chan, src_bo, src->offset + cy * src_pitch +
+ cx * src->texture->block.size, NOUVEAU_BO_GART |
NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
OUT_RING (chan, 0);
}
@@ -168,10 +171,12 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx,
struct nouveau_grobj *m2mf = ctx->m2mf;
struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
- unsigned dst_offset, src_offset;
-
- dst_offset = dst->offset + (dy * dst->stride) + (dx * dst->block.size);
- src_offset = src->offset + (sy * src->stride) + (sx * src->block.size);
+ unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
+ unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
+ unsigned dst_offset = dst->offset + dy * dst_pitch +
+ dx * dst->texture->block.size;
+ unsigned src_offset = src->offset + sy * src_pitch +
+ sx * src->texture->block.size;
WAIT_RING (chan, 3 + ((h / 2047) + 1) * 9);
BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN, 2);
@@ -188,16 +193,16 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx,
NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD);
OUT_RELOCl(chan, dst_bo, dst_offset,
NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_WR);
- OUT_RING (chan, src->stride);
- OUT_RING (chan, dst->stride);
- OUT_RING (chan, w * src->block.size);
+ OUT_RING (chan, src_pitch);
+ OUT_RING (chan, dst_pitch);
+ OUT_RING (chan, w * src->texture->block.size);
OUT_RING (chan, count);
OUT_RING (chan, 0x0101);
OUT_RING (chan, 0);
h -= count;
- src_offset += src->stride * count;
- dst_offset += dst->stride * count;
+ src_offset += src_pitch * count;
+ dst_offset += dst_pitch * count;
}
return 0;
@@ -213,6 +218,8 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
struct nouveau_grobj *blit = ctx->blit;
struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
+ unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
+ unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
int format;
format = nv04_surface_format(dst->format);
@@ -225,7 +232,7 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_FORMAT, 4);
OUT_RING (chan, format);
- OUT_RING (chan, (dst->stride << 16) | src->stride);
+ OUT_RING (chan, (dst_pitch << 16) | src_pitch);
OUT_RELOCl(chan, src_bo, src->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
@@ -242,6 +249,8 @@ nv04_surface_copy(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
int dx, int dy, struct pipe_surface *src, int sx, int sy,
int w, int h)
{
+ unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
+ unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
int src_linear = src->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR;
int dst_linear = dst->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR;
@@ -257,7 +266,8 @@ nv04_surface_copy(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
* to NV_MEMORY_TO_MEMORY_FORMAT in this case.
*/
if ((src->offset & 63) || (dst->offset & 63) ||
- (src->stride & 63) || (dst->stride & 63)) {
+ (src_pitch & 63) || (dst_pitch & 63) ||
+ debug_get_bool_option("NOUVEAU_NO_COPYBLIT", FALSE)) {
nv04_surface_copy_m2mf(ctx, dst, dx, dy, src, sx, sy, w, h);
return;
}
@@ -273,6 +283,7 @@ nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
struct nouveau_grobj *surf2d = ctx->surf2d;
struct nouveau_grobj *rect = ctx->rect;
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
+ unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
int cs2d_format, gdirect_format;
cs2d_format = nv04_surface_format(dst->format);
@@ -287,7 +298,7 @@ nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_FORMAT, 4);
OUT_RING (chan, cs2d_format);
- OUT_RING (chan, (dst->stride << 16) | dst->stride);
+ OUT_RING (chan, (dst_pitch << 16) | dst_pitch);
OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.h b/src/gallium/drivers/nv04/nv04_surface_2d.h
index 21b8f86960..82ce7189c8 100644
--- a/src/gallium/drivers/nv04/nv04_surface_2d.h
+++ b/src/gallium/drivers/nv04/nv04_surface_2d.h
@@ -1,6 +1,11 @@
#ifndef __NV04_SURFACE_2D_H__
#define __NV04_SURFACE_2D_H__
+struct nv04_surface {
+ struct pipe_surface base;
+ unsigned pitch;
+};
+
struct nv04_surface_2d {
struct nouveau_winsys *nvws;
struct nouveau_notifier *ntfy;
diff --git a/src/gallium/drivers/nv04/nv04_transfer.c b/src/gallium/drivers/nv04/nv04_transfer.c
new file mode 100644
index 0000000000..314d2045f7
--- /dev/null
+++ b/src/gallium/drivers/nv04/nv04_transfer.c
@@ -0,0 +1,201 @@
+#include <pipe/p_state.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
+#include <nouveau/nouveau_winsys.h>
+#include "nv04_context.h"
+#include "nv04_screen.h"
+#include "nv04_state.h"
+
+struct nv04_transfer {
+ struct pipe_transfer base;
+ struct pipe_surface *surface;
+ bool direct;
+};
+
+static unsigned nv04_usage_tx_to_buf(unsigned tx_usage)
+{
+ switch (tx_usage) {
+ case PIPE_TRANSFER_READ:
+ return PIPE_BUFFER_USAGE_CPU_READ;
+ case PIPE_TRANSFER_WRITE:
+ return PIPE_BUFFER_USAGE_CPU_WRITE;
+ case PIPE_TRANSFER_READ_WRITE:
+ return PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+ default:
+ assert(0);
+ }
+
+ return -1;
+}
+
+static void
+nv04_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
+ struct pipe_texture *template)
+{
+ memset(template, 0, sizeof(struct pipe_texture));
+ template->target = pt->target;
+ template->format = pt->format;
+ template->width[0] = pt->width[level];
+ template->height[0] = pt->height[level];
+ template->depth[0] = 1;
+ template->block = pt->block;
+ template->nblocksx[0] = pt->nblocksx[level];
+ template->nblocksy[0] = pt->nblocksx[level];
+ template->last_level = 0;
+ template->compressed = pt->compressed;
+ template->nr_samples = pt->nr_samples;
+
+ template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
+ NOUVEAU_TEXTURE_USAGE_LINEAR;
+}
+
+static struct pipe_transfer *
+nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+ unsigned face, unsigned level, unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ struct nv04_miptree *mt = (struct nv04_miptree *)pt;
+ struct nv04_transfer *tx;
+ struct pipe_texture tx_tex_template, *tx_tex;
+
+ tx = CALLOC_STRUCT(nv04_transfer);
+ if (!tx)
+ return NULL;
+
+ tx->base.refcount = 1;
+ pipe_texture_reference(&tx->base.texture, pt);
+ tx->base.format = pt->format;
+ tx->base.x = x;
+ tx->base.y = y;
+ tx->base.width = w;
+ tx->base.height = h;
+ tx->base.block = pt->block;
+ tx->base.nblocksx = pt->nblocksx[level];
+ tx->base.nblocksy = pt->nblocksy[level];
+ tx->base.stride = mt->level[level].pitch;
+ tx->base.usage = usage;
+ tx->base.face = face;
+ tx->base.level = level;
+ tx->base.zslice = zslice;
+
+ /* Direct access to texture */
+ if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
+ debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+ pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
+ {
+ tx->direct = true;
+ tx->surface = pscreen->get_tex_surface(pscreen, pt,
+ face, level, zslice,
+ nv04_usage_tx_to_buf(usage));
+ return &tx->base;
+ }
+
+ tx->direct = false;
+
+ nv04_compatible_transfer_tex(pt, level, &tx_tex_template);
+
+ tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
+ if (!tx_tex)
+ {
+ FREE(tx);
+ return NULL;
+ }
+
+ tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
+ face, level, zslice,
+ nv04_usage_tx_to_buf(usage));
+
+ pipe_texture_reference(&tx_tex, NULL);
+
+ if (!tx->surface)
+ {
+ pipe_surface_reference(&tx->surface, NULL);
+ FREE(tx);
+ return NULL;
+ }
+
+ if (usage != PIPE_TRANSFER_WRITE) {
+ struct nv04_screen *nvscreen = nv04_screen(pscreen);
+ struct pipe_surface *src;
+
+ src = pscreen->get_tex_surface(pscreen, pt,
+ face, level, zslice,
+ PIPE_BUFFER_USAGE_GPU_READ);
+
+ /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+ /* TODO: Check if SIFM can un-swizzle */
+ nvscreen->eng2d->copy(nvscreen->eng2d,
+ tx->surface, 0, 0,
+ src, 0, 0,
+ src->width, src->height);
+
+ pipe_surface_reference(&src, NULL);
+ }
+
+ return &tx->base;
+}
+
+static void
+nv04_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer **pptx)
+{
+ struct pipe_transfer *ptx = *pptx;
+ struct nv04_transfer *tx = (struct nv04_transfer *)ptx;
+
+ if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) {
+ struct nv04_screen *nvscreen = nv04_screen(pscreen);
+ struct pipe_surface *dst;
+
+ dst = pscreen->get_tex_surface(pscreen, ptx->texture,
+ ptx->face, ptx->level, ptx->zslice,
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+ nvscreen->eng2d->copy(nvscreen->eng2d,
+ dst, 0, 0,
+ tx->surface, 0, 0,
+ dst->width, dst->height);
+
+ pipe_surface_reference(&dst, NULL);
+ }
+
+ *pptx = NULL;
+ if (--ptx->refcount)
+ return;
+
+ pipe_surface_reference(&tx->surface, NULL);
+ pipe_texture_reference(&ptx->texture, NULL);
+ FREE(ptx);
+}
+
+static void *
+nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+ struct nv04_transfer *tx = (struct nv04_transfer *)ptx;
+ struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
+ struct nv04_miptree *mt = (struct nv04_miptree *)tx->surface->texture;
+ void *map = pipe_buffer_map(pscreen, mt->buffer,
+ nv04_usage_tx_to_buf(ptx->usage));
+
+ return map + ns->base.offset +
+ ptx->y * ns->pitch + ptx->x * ptx->block.size;
+}
+
+static void
+nv04_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+ struct nv04_transfer *tx = (struct nv04_transfer *)ptx;
+ struct nv04_miptree *mt = (struct nv04_miptree *)tx->surface->texture;
+
+ pipe_buffer_unmap(pscreen, mt->buffer);
+}
+
+void
+nv04_screen_init_transfer_functions(struct pipe_screen *pscreen)
+{
+ pscreen->get_tex_transfer = nv04_transfer_new;
+ pscreen->tex_transfer_release = nv04_transfer_del;
+ pscreen->transfer_map = nv04_transfer_map;
+ pscreen->transfer_unmap = nv04_transfer_unmap;
+}
diff --git a/src/gallium/drivers/nv10/Makefile b/src/gallium/drivers/nv10/Makefile
index 2b5fbd4f5a..62677f5194 100644
--- a/src/gallium/drivers/nv10/Makefile
+++ b/src/gallium/drivers/nv10/Makefile
@@ -14,6 +14,7 @@ C_SOURCES = \
nv10_state.c \
nv10_state_emit.c \
nv10_surface.c \
+ nv10_transfer.c \
nv10_vbo.c
include ../../Makefile.template
diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c
index 9616135461..4747868a50 100644
--- a/src/gallium/drivers/nv10/nv10_miptree.c
+++ b/src/gallium/drivers/nv10/nv10_miptree.c
@@ -131,30 +131,31 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
unsigned flags)
{
- struct pipe_winsys *ws = screen->winsys;
struct nv10_miptree *nv10mt = (struct nv10_miptree *)pt;
- struct pipe_surface *ps;
+ struct nv04_surface *ns;
- ps = CALLOC_STRUCT(pipe_surface);
- if (!ps)
+ ns = CALLOC_STRUCT(nv04_surface);
+ if (!ns)
return NULL;
- pipe_texture_reference(&ps->texture, pt);
- ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
- ps->block = pt->block;
- ps->nblocksx = pt->nblocksx[level];
- ps->nblocksy = pt->nblocksy[level];
- ps->stride = nv10mt->level[level].pitch;
- ps->refcount = 1;
+ pipe_texture_reference(&ns->base.texture, pt);
+ ns->base.format = pt->format;
+ ns->base.width = pt->width[level];
+ ns->base.height = pt->height[level];
+ ns->base.usage = flags;
+ ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
+ ns->base.refcount = 1;
+ ns->base.face = face;
+ ns->base.level = level;
+ ns->base.zslice = zslice;
+ ns->pitch = nv10mt->level[level].pitch;
if (pt->target == PIPE_TEXTURE_CUBE) {
- ps->offset = nv10mt->level[level].image_offset[face];
+ ns->base.offset = nv10mt->level[level].image_offset[face];
} else {
- ps->offset = nv10mt->level[level].image_offset[0];
+ ns->base.offset = nv10mt->level[level].image_offset[0];
}
- return ps;
+ return &ns->base;
}
static void
diff --git a/src/gallium/drivers/nv10/nv10_screen.c b/src/gallium/drivers/nv10/nv10_screen.c
index f417b06c94..6532a93c7b 100644
--- a/src/gallium/drivers/nv10/nv10_screen.c
+++ b/src/gallium/drivers/nv10/nv10_screen.c
@@ -116,30 +116,6 @@ nv10_screen_is_format_supported(struct pipe_screen *screen,
return FALSE;
}
-static void *
-nv10_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
- unsigned flags )
-{
- struct pipe_winsys *ws = screen->winsys;
- void *map;
- struct nv10_miptree *nv10mt = (struct nv10_miptree *)surface->texture;
-
- map = ws->buffer_map(ws, nv10mt->buffer, flags);
- if (!map)
- return NULL;
-
- return map + surface->offset;
-}
-
-static void
-nv10_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
-{
- struct pipe_winsys *ws = screen->winsys;
- struct nv10_miptree *nv10mt = (struct nv10_miptree *)surface->texture;
-
- ws->buffer_unmap(ws, nv10mt->buffer);
-}
-
static void
nv10_screen_destroy(struct pipe_screen *pscreen)
{
@@ -215,10 +191,8 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.is_format_supported = nv10_screen_is_format_supported;
- screen->pipe.surface_map = nv10_surface_map;
- screen->pipe.surface_unmap = nv10_surface_unmap;
-
nv10_screen_init_miptree_functions(&screen->pipe);
+ nv10_screen_init_transfer_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
diff --git a/src/gallium/drivers/nv10/nv10_screen.h b/src/gallium/drivers/nv10/nv10_screen.h
index 60102a369a..ad829ee3fd 100644
--- a/src/gallium/drivers/nv10/nv10_screen.h
+++ b/src/gallium/drivers/nv10/nv10_screen.h
@@ -21,4 +21,8 @@ nv10_screen(struct pipe_screen *screen)
return (struct nv10_screen *)screen;
}
+
+void
+nv10_screen_init_transfer_functions(struct pipe_screen *pscreen);
+
#endif
diff --git a/src/gallium/drivers/nv10/nv10_state_emit.c b/src/gallium/drivers/nv10/nv10_state_emit.c
index 5dec618b93..d8691ef9c6 100644
--- a/src/gallium/drivers/nv10/nv10_state_emit.c
+++ b/src/gallium/drivers/nv10/nv10_state_emit.c
@@ -103,7 +103,7 @@ static void nv10_state_emit_scissor(struct nv10_context* nv10)
static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
{
struct pipe_framebuffer_state* fb = nv10->framebuffer;
- struct pipe_surface *rt, *zeta = NULL;
+ struct nv04_surface *rt, *zeta = NULL;
uint32_t rt_format, w, h;
int colour_format = 0, zeta_format = 0;
struct nv10_miptree *nv10mt = 0;
@@ -111,7 +111,7 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
w = fb->cbufs[0]->width;
h = fb->cbufs[0]->height;
colour_format = fb->cbufs[0]->format;
- rt = fb->cbufs[0];
+ rt = (struct nv04_surface *)fb->cbufs[0];
if (fb->zsbuf) {
if (colour_format) {
@@ -123,7 +123,7 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
}
zeta_format = fb->zsbuf->format;
- zeta = fb->zsbuf;
+ zeta = (struct nv04_surface *)fb->zsbuf;
}
rt_format = NV10TCL_RT_FORMAT_TYPE_LINEAR;
@@ -142,18 +142,18 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
if (zeta) {
BEGIN_RING(celsius, NV10TCL_RT_PITCH, 1);
- OUT_RING (rt->stride | (zeta->stride << 16));
+ OUT_RING (rt->pitch | (zeta->pitch << 16));
} else {
BEGIN_RING(celsius, NV10TCL_RT_PITCH, 1);
- OUT_RING (rt->stride | (rt->stride << 16));
+ OUT_RING (rt->pitch | (rt->pitch << 16));
}
- nv10mt = (struct nv10_miptree *)rt->texture;
+ nv10mt = (struct nv10_miptree *)rt->base.texture;
nv10->rt[0] = nv10mt->buffer;
if (zeta_format)
{
- nv10mt = (struct nv10_miptree *)zeta->texture;
+ nv10mt = (struct nv10_miptree *)zeta->base.texture;
nv10->zeta = nv10mt->buffer;
}
diff --git a/src/gallium/drivers/nv10/nv10_transfer.c b/src/gallium/drivers/nv10/nv10_transfer.c
new file mode 100644
index 0000000000..967e2cc20c
--- /dev/null
+++ b/src/gallium/drivers/nv10/nv10_transfer.c
@@ -0,0 +1,201 @@
+#include <pipe/p_state.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
+#include <nouveau/nouveau_winsys.h>
+#include "nv10_context.h"
+#include "nv10_screen.h"
+#include "nv10_state.h"
+
+struct nv10_transfer {
+ struct pipe_transfer base;
+ struct pipe_surface *surface;
+ bool direct;
+};
+
+static unsigned nv10_usage_tx_to_buf(unsigned tx_usage)
+{
+ switch (tx_usage) {
+ case PIPE_TRANSFER_READ:
+ return PIPE_BUFFER_USAGE_CPU_READ;
+ case PIPE_TRANSFER_WRITE:
+ return PIPE_BUFFER_USAGE_CPU_WRITE;
+ case PIPE_TRANSFER_READ_WRITE:
+ return PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+ default:
+ assert(0);
+ }
+
+ return -1;
+}
+
+static void
+nv10_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
+ struct pipe_texture *template)
+{
+ memset(template, 0, sizeof(struct pipe_texture));
+ template->target = pt->target;
+ template->format = pt->format;
+ template->width[0] = pt->width[level];
+ template->height[0] = pt->height[level];
+ template->depth[0] = 1;
+ template->block = pt->block;
+ template->nblocksx[0] = pt->nblocksx[level];
+ template->nblocksy[0] = pt->nblocksx[level];
+ template->last_level = 0;
+ template->compressed = pt->compressed;
+ template->nr_samples = pt->nr_samples;
+
+ template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
+ NOUVEAU_TEXTURE_USAGE_LINEAR;
+}
+
+static struct pipe_transfer *
+nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+ unsigned face, unsigned level, unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ struct nv10_miptree *mt = (struct nv10_miptree *)pt;
+ struct nv10_transfer *tx;
+ struct pipe_texture tx_tex_template, *tx_tex;
+
+ tx = CALLOC_STRUCT(nv10_transfer);
+ if (!tx)
+ return NULL;
+
+ tx->base.refcount = 1;
+ pipe_texture_reference(&tx->base.texture, pt);
+ tx->base.format = pt->format;
+ tx->base.x = x;
+ tx->base.y = y;
+ tx->base.width = w;
+ tx->base.height = h;
+ tx->base.block = pt->block;
+ tx->base.nblocksx = pt->nblocksx[level];
+ tx->base.nblocksy = pt->nblocksy[level];
+ tx->base.stride = mt->level[level].pitch;
+ tx->base.usage = usage;
+ tx->base.face = face;
+ tx->base.level = level;
+ tx->base.zslice = zslice;
+
+ /* Direct access to texture */
+ if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
+ debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+ pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
+ {
+ tx->direct = true;
+ tx->surface = pscreen->get_tex_surface(pscreen, pt,
+ face, level, zslice,
+ nv10_usage_tx_to_buf(usage));
+ return &tx->base;
+ }
+
+ tx->direct = false;
+
+ nv10_compatible_transfer_tex(pt, level, &tx_tex_template);
+
+ tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
+ if (!tx_tex)
+ {
+ FREE(tx);
+ return NULL;
+ }
+
+ tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
+ face, level, zslice,
+ nv10_usage_tx_to_buf(usage));
+
+ pipe_texture_reference(&tx_tex, NULL);
+
+ if (!tx->surface)
+ {
+ pipe_surface_reference(&tx->surface, NULL);
+ FREE(tx);
+ return NULL;
+ }
+
+ if (usage != PIPE_TRANSFER_WRITE) {
+ struct nv10_screen *nvscreen = nv10_screen(pscreen);
+ struct pipe_surface *src;
+
+ src = pscreen->get_tex_surface(pscreen, pt,
+ face, level, zslice,
+ PIPE_BUFFER_USAGE_GPU_READ);
+
+ /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+ /* TODO: Check if SIFM can un-swizzle */
+ nvscreen->eng2d->copy(nvscreen->eng2d,
+ tx->surface, 0, 0,
+ src, 0, 0,
+ src->width, src->height);
+
+ pipe_surface_reference(&src, NULL);
+ }
+
+ return &tx->base;
+}
+
+static void
+nv10_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer **pptx)
+{
+ struct pipe_transfer *ptx = *pptx;
+ struct nv10_transfer *tx = (struct nv10_transfer *)ptx;
+
+ if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) {
+ struct nv10_screen *nvscreen = nv10_screen(pscreen);
+ struct pipe_surface *dst;
+
+ dst = pscreen->get_tex_surface(pscreen, ptx->texture,
+ ptx->face, ptx->level, ptx->zslice,
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+ nvscreen->eng2d->copy(nvscreen->eng2d,
+ dst, 0, 0,
+ tx->surface, 0, 0,
+ dst->width, dst->height);
+
+ pipe_surface_reference(&dst, NULL);
+ }
+
+ *pptx = NULL;
+ if (--ptx->refcount)
+ return;
+
+ pipe_surface_reference(&tx->surface, NULL);
+ pipe_texture_reference(&ptx->texture, NULL);
+ FREE(ptx);
+}
+
+static void *
+nv10_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+ struct nv10_transfer *tx = (struct nv10_transfer *)ptx;
+ struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
+ struct nv10_miptree *mt = (struct nv10_miptree *)tx->surface->texture;
+ void *map = pipe_buffer_map(pscreen, mt->buffer,
+ nv10_usage_tx_to_buf(ptx->usage));
+
+ return map + ns->base.offset +
+ ptx->y * ns->pitch + ptx->x * ptx->block.size;
+}
+
+static void
+nv10_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+ struct nv10_transfer *tx = (struct nv10_transfer *)ptx;
+ struct nv10_miptree *mt = (struct nv10_miptree *)tx->surface->texture;
+
+ pipe_buffer_unmap(pscreen, mt->buffer);
+}
+
+void
+nv10_screen_init_transfer_functions(struct pipe_screen *pscreen)
+{
+ pscreen->get_tex_transfer = nv10_transfer_new;
+ pscreen->tex_transfer_release = nv10_transfer_del;
+ pscreen->transfer_map = nv10_transfer_map;
+ pscreen->transfer_unmap = nv10_transfer_unmap;
+}
diff --git a/src/gallium/drivers/nv20/Makefile b/src/gallium/drivers/nv20/Makefile
index 93e34f8e92..1305f26c59 100644
--- a/src/gallium/drivers/nv20/Makefile
+++ b/src/gallium/drivers/nv20/Makefile
@@ -14,6 +14,7 @@ C_SOURCES = \
nv20_state.c \
nv20_state_emit.c \
nv20_surface.c \
+ nv20_transfer.c \
nv20_vbo.c
# nv20_vertprog.c
diff --git a/src/gallium/drivers/nv20/nv20_miptree.c b/src/gallium/drivers/nv20/nv20_miptree.c
index ef7e9c5428..2946240897 100644
--- a/src/gallium/drivers/nv20/nv20_miptree.c
+++ b/src/gallium/drivers/nv20/nv20_miptree.c
@@ -9,10 +9,14 @@ static void
nv20_miptree_layout(struct nv20_miptree *nv20mt)
{
struct pipe_texture *pt = &nv20mt->base;
- boolean swizzled = FALSE;
uint width = pt->width[0], height = pt->height[0];
uint offset = 0;
int nr_faces, l, f;
+ uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER |
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
+ PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_PRIMARY);
if (pt->target == PIPE_TEXTURE_CUBE) {
nr_faces = 6;
@@ -26,25 +30,31 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt)
pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
- if (swizzled)
- nv20mt->level[l].pitch = pt->nblocksx[l] * pt->block.size;
+ if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
+ nv20mt->level[l].pitch = align(pt->width[0] * pt->block.size, 64);
else
- nv20mt->level[l].pitch = pt->nblocksx[0] * pt->block.size;
- nv20mt->level[l].pitch = (nv20mt->level[l].pitch + 63) & ~63;
+ nv20mt->level[l].pitch = pt->width[l] * pt->block.size;
nv20mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
width = MAX2(1, width >> 1);
height = MAX2(1, height >> 1);
-
}
for (f = 0; f < nr_faces; f++) {
- for (l = 0; l <= pt->last_level; l++) {
+ for (l = 0; l < pt->last_level; l++) {
nv20mt->level[l].image_offset[f] = offset;
- offset += nv20mt->level[l].pitch * pt->height[l];
+
+ if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) &&
+ pt->width[l + 1] > 1 && pt->height[l + 1] > 1)
+ offset += align(nv20mt->level[l].pitch * pt->height[l], 64);
+ else
+ offset += nv20mt->level[l].pitch * pt->height[l];
}
+
+ nv20mt->level[l].image_offset[f] = offset;
+ offset += nv20mt->level[l].pitch * pt->height[l];
}
nv20mt->total_size = offset;
@@ -96,7 +106,8 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else
if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
- PIPE_TEXTURE_USAGE_DISPLAY_TARGET))
+ PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else
if (pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC)
@@ -107,7 +118,11 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
case PIPE_FORMAT_A8R8G8B8_UNORM:
case PIPE_FORMAT_X8R8G8B8_UNORM:
case PIPE_FORMAT_R16_SNORM:
+ {
+ if (debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE))
+ mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
break;
+ }
default:
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
}
@@ -152,33 +167,33 @@ nv20_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
unsigned flags)
{
struct nv20_miptree *nv20mt = (struct nv20_miptree *)pt;
- struct pipe_surface *ps;
+ struct nv04_surface *ns;
- ps = CALLOC_STRUCT(pipe_surface);
- if (!ps)
+ ns = CALLOC_STRUCT(nv04_surface);
+ if (!ns)
return NULL;
- pipe_texture_reference(&ps->texture, pt);
- ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
- ps->block = pt->block;
- ps->nblocksx = pt->nblocksx[level];
- ps->nblocksy = pt->nblocksy[level];
- ps->stride = nv20mt->level[level].pitch;
- ps->usage = flags;
- ps->status = PIPE_SURFACE_STATUS_DEFINED;
- ps->refcount = 1;
+ pipe_texture_reference(&ns->base.texture, pt);
+ ns->base.format = pt->format;
+ ns->base.width = pt->width[level];
+ ns->base.height = pt->height[level];
+ ns->base.usage = flags;
+ ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
+ ns->base.refcount = 1;
+ ns->base.face = face;
+ ns->base.level = level;
+ ns->base.zslice = zslice;
+ ns->pitch = nv20mt->level[level].pitch;
if (pt->target == PIPE_TEXTURE_CUBE) {
- ps->offset = nv20mt->level[level].image_offset[face];
+ ns->base.offset = nv20mt->level[level].image_offset[face];
} else
if (pt->target == PIPE_TEXTURE_3D) {
- ps->offset = nv20mt->level[level].image_offset[zslice];
+ ns->base.offset = nv20mt->level[level].image_offset[zslice];
} else {
- ps->offset = nv20mt->level[level].image_offset[0];
+ ns->base.offset = nv20mt->level[level].image_offset[0];
}
- return ps;
+ return &ns->base;
}
static void
diff --git a/src/gallium/drivers/nv20/nv20_screen.c b/src/gallium/drivers/nv20/nv20_screen.c
index 5f2b7b4f71..7760ae27c0 100644
--- a/src/gallium/drivers/nv20/nv20_screen.c
+++ b/src/gallium/drivers/nv20/nv20_screen.c
@@ -116,30 +116,6 @@ nv20_screen_is_format_supported(struct pipe_screen *screen,
return FALSE;
}
-static void *
-nv20_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
- unsigned flags )
-{
- struct pipe_winsys *ws = screen->winsys;
- void *map;
- struct nv20_miptree *nv20mt = (struct nv20_miptree *)surface->texture;
-
- map = ws->buffer_map(ws, nv20mt->buffer, flags);
- if (!map)
- return NULL;
-
- return map + surface->offset;
-}
-
-static void
-nv20_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
-{
- struct pipe_winsys *ws = screen->winsys;
- struct nv20_miptree *nv20mt = (struct nv20_miptree *)surface->texture;
-
- ws->buffer_unmap(ws, nv20mt->buffer);
-}
-
static void
nv20_screen_destroy(struct pipe_screen *pscreen)
{
@@ -211,10 +187,8 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.is_format_supported = nv20_screen_is_format_supported;
- screen->pipe.surface_map = nv20_surface_map;
- screen->pipe.surface_unmap = nv20_surface_unmap;
-
nv20_screen_init_miptree_functions(&screen->pipe);
+ nv20_screen_init_transfer_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
diff --git a/src/gallium/drivers/nv20/nv20_screen.h b/src/gallium/drivers/nv20/nv20_screen.h
index bf2f2c0d9f..d9fce2bced 100644
--- a/src/gallium/drivers/nv20/nv20_screen.h
+++ b/src/gallium/drivers/nv20/nv20_screen.h
@@ -21,4 +21,8 @@ nv20_screen(struct pipe_screen *screen)
return (struct nv20_screen *)screen;
}
+
+void
+nv20_screen_init_transfer_functions(struct pipe_screen *pscreen);
+
#endif
diff --git a/src/gallium/drivers/nv20/nv20_state_emit.c b/src/gallium/drivers/nv20/nv20_state_emit.c
index 0f4df9ca31..4042f46d05 100644
--- a/src/gallium/drivers/nv20/nv20_state_emit.c
+++ b/src/gallium/drivers/nv20/nv20_state_emit.c
@@ -109,7 +109,7 @@ static void nv20_state_emit_scissor(struct nv20_context* nv20)
static void nv20_state_emit_framebuffer(struct nv20_context* nv20)
{
struct pipe_framebuffer_state* fb = nv20->framebuffer;
- struct pipe_surface *rt, *zeta = NULL;
+ struct nv04_surface *rt, *zeta = NULL;
uint32_t rt_format, w, h;
int colour_format = 0, zeta_format = 0;
struct nv20_miptree *nv20mt = 0;
@@ -117,7 +117,7 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20)
w = fb->cbufs[0]->width;
h = fb->cbufs[0]->height;
colour_format = fb->cbufs[0]->format;
- rt = fb->cbufs[0];
+ rt = (struct nv04_surface *)fb->cbufs[0];
if (fb->zsbuf) {
if (colour_format) {
@@ -129,7 +129,7 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20)
}
zeta_format = fb->zsbuf->format;
- zeta = fb->zsbuf;
+ zeta = (struct nv04_surface *)fb->zsbuf;
}
rt_format = NV20TCL_RT_FORMAT_TYPE_LINEAR | 0x20;
@@ -148,18 +148,18 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20)
if (zeta) {
BEGIN_RING(kelvin, NV20TCL_RT_PITCH, 1);
- OUT_RING (rt->stride | (zeta->stride << 16));
+ OUT_RING (rt->pitch | (zeta->pitch << 16));
} else {
BEGIN_RING(kelvin, NV20TCL_RT_PITCH, 1);
- OUT_RING (rt->stride | (rt->stride << 16));
+ OUT_RING (rt->pitch | (rt->pitch << 16));
}
- nv20mt = (struct nv20_miptree *)rt->texture;
+ nv20mt = (struct nv20_miptree *)rt->base.texture;
nv20->rt[0] = nv20mt->buffer;
if (zeta_format)
{
- nv20mt = (struct nv20_miptree *)zeta->texture;
+ nv20mt = (struct nv20_miptree *)zeta->base.texture;
nv20->zeta = nv20mt->buffer;
}
diff --git a/src/gallium/drivers/nv20/nv20_transfer.c b/src/gallium/drivers/nv20/nv20_transfer.c
new file mode 100644
index 0000000000..19de09486d
--- /dev/null
+++ b/src/gallium/drivers/nv20/nv20_transfer.c
@@ -0,0 +1,201 @@
+#include <pipe/p_state.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
+#include <nouveau/nouveau_winsys.h>
+#include "nv20_context.h"
+#include "nv20_screen.h"
+#include "nv20_state.h"
+
+struct nv20_transfer {
+ struct pipe_transfer base;
+ struct pipe_surface *surface;
+ bool direct;
+};
+
+static unsigned nv20_usage_tx_to_buf(unsigned tx_usage)
+{
+ switch (tx_usage) {
+ case PIPE_TRANSFER_READ:
+ return PIPE_BUFFER_USAGE_CPU_READ;
+ case PIPE_TRANSFER_WRITE:
+ return PIPE_BUFFER_USAGE_CPU_WRITE;
+ case PIPE_TRANSFER_READ_WRITE:
+ return PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+ default:
+ assert(0);
+ }
+
+ return -1;
+}
+
+static void
+nv20_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
+ struct pipe_texture *template)
+{
+ memset(template, 0, sizeof(struct pipe_texture));
+ template->target = pt->target;
+ template->format = pt->format;
+ template->width[0] = pt->width[level];
+ template->height[0] = pt->height[level];
+ template->depth[0] = 1;
+ template->block = pt->block;
+ template->nblocksx[0] = pt->nblocksx[level];
+ template->nblocksy[0] = pt->nblocksx[level];
+ template->last_level = 0;
+ template->compressed = pt->compressed;
+ template->nr_samples = pt->nr_samples;
+
+ template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
+ NOUVEAU_TEXTURE_USAGE_LINEAR;
+}
+
+static struct pipe_transfer *
+nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+ unsigned face, unsigned level, unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ struct nv20_miptree *mt = (struct nv20_miptree *)pt;
+ struct nv20_transfer *tx;
+ struct pipe_texture tx_tex_template, *tx_tex;
+
+ tx = CALLOC_STRUCT(nv20_transfer);
+ if (!tx)
+ return NULL;
+
+ tx->base.refcount = 1;
+ pipe_texture_reference(&tx->base.texture, pt);
+ tx->base.format = pt->format;
+ tx->base.x = x;
+ tx->base.y = y;
+ tx->base.width = w;
+ tx->base.height = h;
+ tx->base.block = pt->block;
+ tx->base.nblocksx = pt->nblocksx[level];
+ tx->base.nblocksy = pt->nblocksy[level];
+ tx->base.stride = mt->level[level].pitch;
+ tx->base.usage = usage;
+ tx->base.face = face;
+ tx->base.level = level;
+ tx->base.zslice = zslice;
+
+ /* Direct access to texture */
+ if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
+ debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+ pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
+ {
+ tx->direct = true;
+ tx->surface = pscreen->get_tex_surface(pscreen, pt,
+ face, level, zslice,
+ nv20_usage_tx_to_buf(usage));
+ return &tx->base;
+ }
+
+ tx->direct = false;
+
+ nv20_compatible_transfer_tex(pt, level, &tx_tex_template);
+
+ tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
+ if (!tx_tex)
+ {
+ FREE(tx);
+ return NULL;
+ }
+
+ tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
+ face, level, zslice,
+ nv20_usage_tx_to_buf(usage));
+
+ pipe_texture_reference(&tx_tex, NULL);
+
+ if (!tx->surface)
+ {
+ pipe_surface_reference(&tx->surface, NULL);
+ FREE(tx);
+ return NULL;
+ }
+
+ if (usage != PIPE_TRANSFER_WRITE) {
+ struct nv20_screen *nvscreen = nv20_screen(pscreen);
+ struct pipe_surface *src;
+
+ src = pscreen->get_tex_surface(pscreen, pt,
+ face, level, zslice,
+ PIPE_BUFFER_USAGE_GPU_READ);
+
+ /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+ /* TODO: Check if SIFM can un-swizzle */
+ nvscreen->eng2d->copy(nvscreen->eng2d,
+ tx->surface, 0, 0,
+ src, 0, 0,
+ src->width, src->height);
+
+ pipe_surface_reference(&src, NULL);
+ }
+
+ return &tx->base;
+}
+
+static void
+nv20_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer **pptx)
+{
+ struct pipe_transfer *ptx = *pptx;
+ struct nv20_transfer *tx = (struct nv20_transfer *)ptx;
+
+ if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) {
+ struct nv20_screen *nvscreen = nv20_screen(pscreen);
+ struct pipe_surface *dst;
+
+ dst = pscreen->get_tex_surface(pscreen, ptx->texture,
+ ptx->face, ptx->level, ptx->zslice,
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+ nvscreen->eng2d->copy(nvscreen->eng2d,
+ dst, 0, 0,
+ tx->surface, 0, 0,
+ dst->width, dst->height);
+
+ pipe_surface_reference(&dst, NULL);
+ }
+
+ *pptx = NULL;
+ if (--ptx->refcount)
+ return;
+
+ pipe_surface_reference(&tx->surface, NULL);
+ pipe_texture_reference(&ptx->texture, NULL);
+ FREE(ptx);
+}
+
+static void *
+nv20_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+ struct nv20_transfer *tx = (struct nv20_transfer *)ptx;
+ struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
+ struct nv20_miptree *mt = (struct nv20_miptree *)tx->surface->texture;
+ void *map = pipe_buffer_map(pscreen, mt->buffer,
+ nv20_usage_tx_to_buf(ptx->usage));
+
+ return map + ns->base.offset +
+ ptx->y * ns->pitch + ptx->x * ptx->block.size;
+}
+
+static void
+nv20_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+ struct nv20_transfer *tx = (struct nv20_transfer *)ptx;
+ struct nv20_miptree *mt = (struct nv20_miptree *)tx->surface->texture;
+
+ pipe_buffer_unmap(pscreen, mt->buffer);
+}
+
+void
+nv20_screen_init_transfer_functions(struct pipe_screen *pscreen)
+{
+ pscreen->get_tex_transfer = nv20_transfer_new;
+ pscreen->tex_transfer_release = nv20_transfer_del;
+ pscreen->transfer_map = nv20_transfer_map;
+ pscreen->transfer_unmap = nv20_transfer_unmap;
+}
diff --git a/src/gallium/drivers/nv30/Makefile b/src/gallium/drivers/nv30/Makefile
index 4c29e2eab3..364c80d8f3 100644
--- a/src/gallium/drivers/nv30/Makefile
+++ b/src/gallium/drivers/nv30/Makefile
@@ -22,6 +22,7 @@ C_SOURCES = \
nv30_state_viewport.c \
nv30_state_zsa.c \
nv30_surface.c \
+ nv30_transfer.c \
nv30_vbo.c \
nv30_vertprog.c
diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
index b11ed8c24e..ec0a8b8438 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -69,6 +69,8 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
{
struct pipe_winsys *ws = pscreen->winsys;
struct nv30_miptree *mt;
+ unsigned buf_usage = PIPE_BUFFER_USAGE_PIXEL |
+ NOUVEAU_BUFFER_USAGE_TEXTURE;
mt = MALLOC(sizeof(struct nv30_miptree));
if (!mt)
@@ -76,8 +78,6 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
mt->base = *pt;
mt->base.refcount = 1;
mt->base.screen = pscreen;
- mt->shadow_tex = NULL;
- mt->shadow_surface = NULL;
/* Swizzled textures must be POT */
if (pt->width[0] & (pt->width[0] - 1) ||
@@ -107,11 +107,12 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
}
}
+ if (pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC)
+ buf_usage |= PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+
nv30_miptree_layout(mt);
- mt->buffer = ws->buffer_create(ws, 256,
- PIPE_BUFFER_USAGE_PIXEL |
- NOUVEAU_BUFFER_USAGE_TEXTURE,
+ mt->buffer = ws->buffer_create(ws, 256, buf_usage,
mt->total_size);
if (!mt->buffer) {
FREE(mt);
@@ -163,12 +164,6 @@ nv30_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt)
FREE(mt->level[l].image_offset);
}
- if (mt->shadow_tex) {
- if (mt->shadow_surface)
- pscreen->tex_surface_release(pscreen, &mt->shadow_surface);
- nv30_miptree_release(pscreen, &mt->shadow_tex);
- }
-
FREE(mt);
}
@@ -178,36 +173,33 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
unsigned flags)
{
struct nv30_miptree *nv30mt = (struct nv30_miptree *)pt;
- struct pipe_surface *ps;
+ struct nv04_surface *ns;
- ps = CALLOC_STRUCT(pipe_surface);
- if (!ps)
+ ns = CALLOC_STRUCT(nv04_surface);
+ if (!ns)
return NULL;
- pipe_texture_reference(&ps->texture, pt);
- ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
- ps->block = pt->block;
- ps->nblocksx = pt->nblocksx[level];
- ps->nblocksy = pt->nblocksy[level];
- ps->stride = nv30mt->level[level].pitch;
- ps->usage = flags;
- ps->status = PIPE_SURFACE_STATUS_DEFINED;
- ps->refcount = 1;
- ps->face = face;
- ps->level = level;
- ps->zslice = zslice;
+ pipe_texture_reference(&ns->base.texture, pt);
+ ns->base.format = pt->format;
+ ns->base.width = pt->width[level];
+ ns->base.height = pt->height[level];
+ ns->base.usage = flags;
+ ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
+ ns->base.refcount = 1;
+ ns->base.face = face;
+ ns->base.level = level;
+ ns->base.zslice = zslice;
+ ns->pitch = nv30mt->level[level].pitch;
if (pt->target == PIPE_TEXTURE_CUBE) {
- ps->offset = nv30mt->level[level].image_offset[face];
+ ns->base.offset = nv30mt->level[level].image_offset[face];
} else
if (pt->target == PIPE_TEXTURE_3D) {
- ps->offset = nv30mt->level[level].image_offset[zslice];
+ ns->base.offset = nv30mt->level[level].image_offset[zslice];
} else {
- ps->offset = nv30mt->level[level].image_offset[0];
+ ns->base.offset = nv30mt->level[level].image_offset[0];
}
- return ps;
+ return &ns->base;
}
static void
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index c97a73f0b1..d395c5e1b7 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -135,82 +135,6 @@ nv30_surface_buffer(struct pipe_surface *surf)
return mt->buffer;
}
-static void *
-nv30_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
- unsigned flags )
-{
- struct pipe_winsys *ws = screen->winsys;
- struct pipe_surface *surface_to_map;
- void *map;
-
- if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
- struct nv30_miptree *mt = (struct nv30_miptree *)surface->texture;
-
- if (!mt->shadow_tex) {
- unsigned old_tex_usage = surface->texture->tex_usage;
- surface->texture->tex_usage = NOUVEAU_TEXTURE_USAGE_LINEAR |
- PIPE_TEXTURE_USAGE_DYNAMIC;
- mt->shadow_tex = screen->texture_create(screen, surface->texture);
- surface->texture->tex_usage = old_tex_usage;
-
- assert(mt->shadow_tex->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR);
- }
-
- mt->shadow_surface = screen->get_tex_surface
- (
- screen, mt->shadow_tex,
- surface->face, surface->level, surface->zslice,
- surface->usage
- );
-
- surface_to_map = mt->shadow_surface;
- }
- else
- surface_to_map = surface;
-
- assert(surface_to_map);
-
- map = ws->buffer_map(ws, nv30_surface_buffer(surface_to_map), flags);
- if (!map)
- return NULL;
-
- return map + surface_to_map->offset;
-}
-
-static void
-nv30_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
-{
- struct pipe_winsys *ws = screen->winsys;
- struct pipe_surface *surface_to_unmap;
-
- /* TODO: Copy from shadow just before push buffer is flushed instead.
- There are probably some programs that map/unmap excessively
- before rendering. */
- if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
- struct nv30_miptree *mt = (struct nv30_miptree *)surface->texture;
-
- assert(mt->shadow_tex);
-
- surface_to_unmap = mt->shadow_surface;
- }
- else
- surface_to_unmap = surface;
-
- assert(surface_to_unmap);
-
- ws->buffer_unmap(ws, nv30_surface_buffer(surface_to_unmap));
-
- if (surface_to_unmap != surface) {
- struct nv30_screen *nvscreen = nv30_screen(screen);
-
- nvscreen->eng2d->copy(nvscreen->eng2d, surface, 0, 0,
- surface_to_unmap, 0, 0,
- surface->width, surface->height);
-
- screen->tex_surface_release(screen, &surface_to_unmap);
- }
-}
-
static void
nv30_screen_destroy(struct pipe_screen *pscreen)
{
@@ -391,10 +315,8 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.is_format_supported = nv30_screen_surface_format_supported;
- screen->pipe.surface_map = nv30_surface_map;
- screen->pipe.surface_unmap = nv30_surface_unmap;
-
nv30_screen_init_miptree_functions(&screen->pipe);
+ nv30_screen_init_transfer_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
diff --git a/src/gallium/drivers/nv30/nv30_screen.h b/src/gallium/drivers/nv30/nv30_screen.h
index b11e470f94..8e36883975 100644
--- a/src/gallium/drivers/nv30/nv30_screen.h
+++ b/src/gallium/drivers/nv30/nv30_screen.h
@@ -34,4 +34,7 @@ nv30_screen(struct pipe_screen *screen)
return (struct nv30_screen *)screen;
}
+void
+nv30_screen_init_transfer_functions(struct pipe_screen *pscreen);
+
#endif
diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h
index 2023278e37..e6f23bf166 100644
--- a/src/gallium/drivers/nv30/nv30_state.h
+++ b/src/gallium/drivers/nv30/nv30_state.h
@@ -76,9 +76,6 @@ struct nv30_miptree {
struct pipe_buffer *buffer;
uint total_size;
- struct pipe_texture *shadow_tex;
- struct pipe_surface *shadow_surface;
-
struct {
uint pitch;
uint *image_offset;
diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c
index 77368cb205..ee0326011c 100644
--- a/src/gallium/drivers/nv30/nv30_state_fb.c
+++ b/src/gallium/drivers/nv30/nv30_state_fb.c
@@ -5,7 +5,7 @@ static boolean
nv30_state_framebuffer_validate(struct nv30_context *nv30)
{
struct pipe_framebuffer_state *fb = &nv30->framebuffer;
- struct pipe_surface *rt[2], *zeta = NULL;
+ struct nv04_surface *rt[2], *zeta = NULL;
uint32_t rt_enable, rt_format;
int i, colour_format = 0, zeta_format = 0;
struct nouveau_stateobj *so = so_new(64, 10);
@@ -21,7 +21,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
} else {
colour_format = fb->cbufs[i]->format;
rt_enable |= (NV34TCL_RT_ENABLE_COLOR0 << i);
- rt[i] = fb->cbufs[i];
+ rt[i] = (struct nv04_surface *)fb->cbufs[i];
}
}
@@ -30,13 +30,13 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
if (fb->zsbuf) {
zeta_format = fb->zsbuf->format;
- zeta = fb->zsbuf;
+ zeta = (struct nv04_surface *)fb->zsbuf;
}
- if (!(rt[0]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
+ if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
for (i = 1; i < fb->nr_cbufs; i++)
- assert(!(rt[i]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
+ assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
/* FIXME: NV34TCL_RT_FORMAT_LOG2_[WIDTH/HEIGHT] */
rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
@@ -71,44 +71,44 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
}
if (rt_enable & NV34TCL_RT_ENABLE_COLOR0) {
- uint32_t pitch = rt[0]->stride;
+ uint32_t pitch = rt[0]->pitch;
if (zeta) {
- pitch |= (zeta->stride << 16);
+ pitch |= (zeta->pitch << 16);
} else {
pitch |= (pitch << 16);
}
- nv30mt = (struct nv30_miptree *)rt[0]->texture;
+ nv30mt = (struct nv30_miptree *)rt[0]->base.texture;
so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR0, 1);
so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
nv30->nvws->channel->vram->handle,
nv30->nvws->channel->gart->handle);
so_method(so, nv30->screen->rankine, NV34TCL_COLOR0_PITCH, 2);
so_data (so, pitch);
- so_reloc (so, nv30mt->buffer, rt[0]->offset, rt_flags |
+ so_reloc (so, nv30mt->buffer, rt[0]->base.offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
}
if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) {
- nv30mt = (struct nv30_miptree *)rt[1]->texture;
+ nv30mt = (struct nv30_miptree *)rt[1]->base.texture;
so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR1, 1);
so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
nv30->nvws->channel->vram->handle,
nv30->nvws->channel->gart->handle);
so_method(so, nv30->screen->rankine, NV34TCL_COLOR1_OFFSET, 2);
- so_reloc (so, nv30mt->buffer, rt[1]->offset, rt_flags |
+ so_reloc (so, nv30mt->buffer, rt[1]->base.offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
- so_data (so, rt[1]->stride);
+ so_data (so, rt[1]->pitch);
}
if (zeta_format) {
- nv30mt = (struct nv30_miptree *)zeta->texture;
+ nv30mt = (struct nv30_miptree *)zeta->base.texture;
so_method(so, nv30->screen->rankine, NV34TCL_DMA_ZETA, 1);
so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
nv30->nvws->channel->vram->handle,
nv30->nvws->channel->gart->handle);
so_method(so, nv30->screen->rankine, NV34TCL_ZETA_OFFSET, 1);
- so_reloc (so, nv30mt->buffer, zeta->offset, rt_flags |
+ so_reloc (so, nv30mt->buffer, zeta->base.offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
/* TODO: allocate LMA depth buffer */
}
diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c
new file mode 100644
index 0000000000..df4dc4b1f6
--- /dev/null
+++ b/src/gallium/drivers/nv30/nv30_transfer.c
@@ -0,0 +1,201 @@
+#include <pipe/p_state.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
+#include <nouveau/nouveau_winsys.h>
+#include "nv30_context.h"
+#include "nv30_screen.h"
+#include "nv30_state.h"
+
+struct nv30_transfer {
+ struct pipe_transfer base;
+ struct pipe_surface *surface;
+ bool direct;
+};
+
+static unsigned nv30_usage_tx_to_buf(unsigned tx_usage)
+{
+ switch (tx_usage) {
+ case PIPE_TRANSFER_READ:
+ return PIPE_BUFFER_USAGE_CPU_READ;
+ case PIPE_TRANSFER_WRITE:
+ return PIPE_BUFFER_USAGE_CPU_WRITE;
+ case PIPE_TRANSFER_READ_WRITE:
+ return PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+ default:
+ assert(0);
+ }
+
+ return -1;
+}
+
+static void
+nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
+ struct pipe_texture *template)
+{
+ memset(template, 0, sizeof(struct pipe_texture));
+ template->target = pt->target;
+ template->format = pt->format;
+ template->width[0] = pt->width[level];
+ template->height[0] = pt->height[level];
+ template->depth[0] = 1;
+ template->block = pt->block;
+ template->nblocksx[0] = pt->nblocksx[level];
+ template->nblocksy[0] = pt->nblocksx[level];
+ template->last_level = 0;
+ template->compressed = pt->compressed;
+ template->nr_samples = pt->nr_samples;
+
+ template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
+ NOUVEAU_TEXTURE_USAGE_LINEAR;
+}
+
+static struct pipe_transfer *
+nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+ unsigned face, unsigned level, unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ struct nv30_miptree *mt = (struct nv30_miptree *)pt;
+ struct nv30_transfer *tx;
+ struct pipe_texture tx_tex_template, *tx_tex;
+
+ tx = CALLOC_STRUCT(nv30_transfer);
+ if (!tx)
+ return NULL;
+
+ tx->base.refcount = 1;
+ pipe_texture_reference(&tx->base.texture, pt);
+ tx->base.format = pt->format;
+ tx->base.x = x;
+ tx->base.y = y;
+ tx->base.width = w;
+ tx->base.height = h;
+ tx->base.block = pt->block;
+ tx->base.nblocksx = pt->nblocksx[level];
+ tx->base.nblocksy = pt->nblocksy[level];
+ tx->base.stride = mt->level[level].pitch;
+ tx->base.usage = usage;
+ tx->base.face = face;
+ tx->base.level = level;
+ tx->base.zslice = zslice;
+
+ /* Direct access to texture */
+ if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
+ debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+ pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
+ {
+ tx->direct = true;
+ tx->surface = pscreen->get_tex_surface(pscreen, pt,
+ face, level, zslice,
+ nv30_usage_tx_to_buf(usage));
+ return &tx->base;
+ }
+
+ tx->direct = false;
+
+ nv30_compatible_transfer_tex(pt, level, &tx_tex_template);
+
+ tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
+ if (!tx_tex)
+ {
+ FREE(tx);
+ return NULL;
+ }
+
+ tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
+ face, level, zslice,
+ nv30_usage_tx_to_buf(usage));
+
+ pipe_texture_reference(&tx_tex, NULL);
+
+ if (!tx->surface)
+ {
+ pipe_surface_reference(&tx->surface, NULL);
+ FREE(tx);
+ return NULL;
+ }
+
+ if (usage != PIPE_TRANSFER_WRITE) {
+ struct nv30_screen *nvscreen = nv30_screen(pscreen);
+ struct pipe_surface *src;
+
+ src = pscreen->get_tex_surface(pscreen, pt,
+ face, level, zslice,
+ PIPE_BUFFER_USAGE_GPU_READ);
+
+ /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+ /* TODO: Check if SIFM can un-swizzle */
+ nvscreen->eng2d->copy(nvscreen->eng2d,
+ tx->surface, 0, 0,
+ src, 0, 0,
+ src->width, src->height);
+
+ pipe_surface_reference(&src, NULL);
+ }
+
+ return &tx->base;
+}
+
+static void
+nv30_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer **pptx)
+{
+ struct pipe_transfer *ptx = *pptx;
+ struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
+
+ if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) {
+ struct nv30_screen *nvscreen = nv30_screen(pscreen);
+ struct pipe_surface *dst;
+
+ dst = pscreen->get_tex_surface(pscreen, ptx->texture,
+ ptx->face, ptx->level, ptx->zslice,
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+ nvscreen->eng2d->copy(nvscreen->eng2d,
+ dst, 0, 0,
+ tx->surface, 0, 0,
+ dst->width, dst->height);
+
+ pipe_surface_reference(&dst, NULL);
+ }
+
+ *pptx = NULL;
+ if (--ptx->refcount)
+ return;
+
+ pipe_surface_reference(&tx->surface, NULL);
+ pipe_texture_reference(&ptx->texture, NULL);
+ FREE(ptx);
+}
+
+static void *
+nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+ struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
+ struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
+ struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture;
+ void *map = pipe_buffer_map(pscreen, mt->buffer,
+ nv30_usage_tx_to_buf(ptx->usage));
+
+ return map + ns->base.offset +
+ ptx->y * ns->pitch + ptx->x * ptx->block.size;
+}
+
+static void
+nv30_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+ struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
+ struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture;
+
+ pipe_buffer_unmap(pscreen, mt->buffer);
+}
+
+void
+nv30_screen_init_transfer_functions(struct pipe_screen *pscreen)
+{
+ pscreen->get_tex_transfer = nv30_transfer_new;
+ pscreen->tex_transfer_release = nv30_transfer_del;
+ pscreen->transfer_map = nv30_transfer_map;
+ pscreen->transfer_unmap = nv30_transfer_unmap;
+}
diff --git a/src/gallium/drivers/nv40/Makefile b/src/gallium/drivers/nv40/Makefile
index 8c738aefa6..0ecae2b491 100644
--- a/src/gallium/drivers/nv40/Makefile
+++ b/src/gallium/drivers/nv40/Makefile
@@ -22,6 +22,7 @@ C_SOURCES = \
nv40_state_viewport.c \
nv40_state_zsa.c \
nv40_surface.c \
+ nv40_transfer.c \
nv40_vbo.c \
nv40_vertprog.c
diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c
index e38b1e7f5c..638d279aa5 100644
--- a/src/gallium/drivers/nv40/nv40_miptree.c
+++ b/src/gallium/drivers/nv40/nv40_miptree.c
@@ -78,8 +78,6 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
mt->base = *pt;
mt->base.refcount = 1;
mt->base.screen = pscreen;
- mt->shadow_tex = NULL;
- mt->shadow_surface = NULL;
/* Swizzled textures must be POT */
if (pt->width[0] & (pt->width[0] - 1) ||
@@ -165,12 +163,6 @@ nv40_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt)
FREE(mt->level[l].image_offset);
}
- if (mt->shadow_tex) {
- if (mt->shadow_surface)
- pscreen->tex_surface_release(pscreen, &mt->shadow_surface);
- nv40_miptree_release(pscreen, &mt->shadow_tex);
- }
-
FREE(mt);
}
@@ -180,36 +172,33 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
unsigned flags)
{
struct nv40_miptree *mt = (struct nv40_miptree *)pt;
- struct pipe_surface *ps;
+ struct nv04_surface *ns;
- ps = CALLOC_STRUCT(pipe_surface);
- if (!ps)
+ ns = CALLOC_STRUCT(nv04_surface);
+ if (!ns)
return NULL;
- pipe_texture_reference(&ps->texture, pt);
- ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
- ps->block = pt->block;
- ps->nblocksx = pt->nblocksx[level];
- ps->nblocksy = pt->nblocksy[level];
- ps->stride = mt->level[level].pitch;
- ps->usage = flags;
- ps->status = PIPE_SURFACE_STATUS_DEFINED;
- ps->refcount = 1;
- ps->face = face;
- ps->level = level;
- ps->zslice = zslice;
+ pipe_texture_reference(&ns->base.texture, pt);
+ ns->base.format = pt->format;
+ ns->base.width = pt->width[level];
+ ns->base.height = pt->height[level];
+ ns->base.usage = flags;
+ ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
+ ns->base.refcount = 1;
+ ns->base.face = face;
+ ns->base.level = level;
+ ns->base.zslice = zslice;
+ ns->pitch = mt->level[level].pitch;
if (pt->target == PIPE_TEXTURE_CUBE) {
- ps->offset = mt->level[level].image_offset[face];
+ ns->base.offset = mt->level[level].image_offset[face];
} else
if (pt->target == PIPE_TEXTURE_3D) {
- ps->offset = mt->level[level].image_offset[zslice];
+ ns->base.offset = mt->level[level].image_offset[zslice];
} else {
- ps->offset = mt->level[level].image_offset[0];
+ ns->base.offset = mt->level[level].image_offset[0];
}
- return ps;
+ return &ns->base;
}
static void
diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c
index 2372bc8441..0d4baefaea 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -144,81 +144,6 @@ nv40_surface_buffer(struct pipe_surface *surf)
return mt->buffer;
}
-static void *
-nv40_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
- unsigned flags )
-{
- struct pipe_winsys *ws = screen->winsys;
- struct pipe_surface *surface_to_map;
- void *map;
-
- if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
- struct nv40_miptree *mt = (struct nv40_miptree *)surface->texture;
-
- if (!mt->shadow_tex) {
- unsigned old_tex_usage = surface->texture->tex_usage;
- surface->texture->tex_usage = NOUVEAU_TEXTURE_USAGE_LINEAR |
- PIPE_TEXTURE_USAGE_DYNAMIC;
- mt->shadow_tex = screen->texture_create(screen, surface->texture);
- surface->texture->tex_usage = old_tex_usage;
-
- assert(mt->shadow_tex->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR);
- }
-
- mt->shadow_surface = screen->get_tex_surface
- (
- screen, mt->shadow_tex,
- surface->face, surface->level, surface->zslice,
- surface->usage
- );
-
- surface_to_map = mt->shadow_surface;
- }
- else
- surface_to_map = surface;
-
- assert(surface_to_map);
- map = ws->buffer_map(ws, nv40_surface_buffer(surface_to_map), flags);
- if (!map)
- return NULL;
-
- return map + surface_to_map->offset;
-}
-
-static void
-nv40_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
-{
- struct pipe_winsys *ws = screen->winsys;
- struct pipe_surface *surface_to_unmap;
-
- /* TODO: Copy from shadow just before push buffer is flushed instead.
- There are probably some programs that map/unmap excessively
- before rendering. */
- if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
- struct nv40_miptree *mt = (struct nv40_miptree *)surface->texture;
-
- assert(mt->shadow_tex);
-
- surface_to_unmap = mt->shadow_surface;
- }
- else
- surface_to_unmap = surface;
-
- assert(surface_to_unmap);
-
- ws->buffer_unmap(ws, nv40_surface_buffer(surface_to_unmap));
-
- if (surface_to_unmap != surface) {
- struct nv40_screen *nvscreen = nv40_screen(screen);
-
- nvscreen->eng2d->copy(nvscreen->eng2d, surface, 0, 0,
- surface_to_unmap, 0, 0,
- surface->width, surface->height);
-
- screen->tex_surface_release(screen, &surface_to_unmap);
- }
-}
-
static void
nv40_screen_destroy(struct pipe_screen *pscreen)
{
@@ -240,7 +165,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
{
struct nv40_screen *screen = CALLOC_STRUCT(nv40_screen);
struct nouveau_stateobj *so;
- unsigned curie_class;
+ unsigned curie_class = 0;
unsigned chipset = nvws->channel->device->chipset;
int ret;
@@ -265,8 +190,6 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
if (NV6X_GRCLASS4497_CHIPSETS & (1 << (chipset & 0x0f)))
curie_class = NV44TCL;
break;
- default:
- break;
}
if (!curie_class) {
@@ -372,10 +295,8 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.is_format_supported = nv40_screen_surface_format_supported;
- screen->pipe.surface_map = nv40_surface_map;
- screen->pipe.surface_unmap = nv40_surface_unmap;
-
nv40_screen_init_miptree_functions(&screen->pipe);
+ nv40_screen_init_transfer_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
diff --git a/src/gallium/drivers/nv40/nv40_screen.h b/src/gallium/drivers/nv40/nv40_screen.h
index 4500aa0e5c..7b503bd207 100644
--- a/src/gallium/drivers/nv40/nv40_screen.h
+++ b/src/gallium/drivers/nv40/nv40_screen.h
@@ -34,4 +34,7 @@ nv40_screen(struct pipe_screen *screen)
return (struct nv40_screen *)screen;
}
+void
+nv40_screen_init_transfer_functions(struct pipe_screen *pscreen);
+
#endif
diff --git a/src/gallium/drivers/nv40/nv40_state.h b/src/gallium/drivers/nv40/nv40_state.h
index 9c55903ae3..8a9d8c8fdf 100644
--- a/src/gallium/drivers/nv40/nv40_state.h
+++ b/src/gallium/drivers/nv40/nv40_state.h
@@ -79,9 +79,6 @@ struct nv40_miptree {
struct pipe_buffer *buffer;
uint total_size;
- struct pipe_texture *shadow_tex;
- struct pipe_surface *shadow_surface;
-
struct {
uint pitch;
uint *image_offset;
diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c
index 454abad31f..5ebd3a1a56 100644
--- a/src/gallium/drivers/nv40/nv40_state_fb.c
+++ b/src/gallium/drivers/nv40/nv40_state_fb.c
@@ -12,7 +12,7 @@ static boolean
nv40_state_framebuffer_validate(struct nv40_context *nv40)
{
struct pipe_framebuffer_state *fb = &nv40->framebuffer;
- struct pipe_surface *rt[4], *zeta;
+ struct nv04_surface *rt[4], *zeta;
uint32_t rt_enable, rt_format;
int i, colour_format = 0, zeta_format = 0;
struct nouveau_stateobj *so = so_new(64, 10);
@@ -27,7 +27,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
} else {
colour_format = fb->cbufs[i]->format;
rt_enable |= (NV40TCL_RT_ENABLE_COLOR0 << i);
- rt[i] = fb->cbufs[i];
+ rt[i] = (struct nv04_surface *)fb->cbufs[i];
}
}
@@ -37,13 +37,13 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
if (fb->zsbuf) {
zeta_format = fb->zsbuf->format;
- zeta = fb->zsbuf;
+ zeta = (struct nv04_surface *)fb->zsbuf;
}
- if (!(rt[0]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
+ if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
for (i = 1; i < fb->nr_cbufs; i++)
- assert(!(rt[i]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
+ assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
rt_format = NV40TCL_RT_FORMAT_TYPE_SWIZZLED |
log2i(fb->width) << NV40TCL_RT_FORMAT_LOG2_WIDTH_SHIFT |
@@ -78,60 +78,60 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
if (rt_enable & NV40TCL_RT_ENABLE_COLOR0) {
so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR0, 1);
- so_reloc (so, nv40_surface_buffer(rt[0]), 0, rt_flags | NOUVEAU_BO_OR,
+ so_reloc (so, nv40_surface_buffer(&rt[0]->base), 0, rt_flags | NOUVEAU_BO_OR,
nv40->nvws->channel->vram->handle,
nv40->nvws->channel->gart->handle);
so_method(so, nv40->screen->curie, NV40TCL_COLOR0_PITCH, 2);
- so_data (so, rt[0]->stride);
- so_reloc (so, nv40_surface_buffer(rt[0]), rt[0]->offset, rt_flags |
+ so_data (so, rt[0]->pitch);
+ so_reloc (so, nv40_surface_buffer(&rt[0]->base), rt[0]->base.offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
}
if (rt_enable & NV40TCL_RT_ENABLE_COLOR1) {
so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR1, 1);
- so_reloc (so, nv40_surface_buffer(rt[1]), 0, rt_flags | NOUVEAU_BO_OR,
+ so_reloc (so, nv40_surface_buffer(&rt[1]->base), 0, rt_flags | NOUVEAU_BO_OR,
nv40->nvws->channel->vram->handle,
nv40->nvws->channel->gart->handle);
so_method(so, nv40->screen->curie, NV40TCL_COLOR1_OFFSET, 2);
- so_reloc (so, nv40_surface_buffer(rt[1]), rt[1]->offset, rt_flags |
+ so_reloc (so, nv40_surface_buffer(&rt[1]->base), rt[1]->base.offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
- so_data (so, rt[1]->stride);
+ so_data (so, rt[1]->pitch);
}
if (rt_enable & NV40TCL_RT_ENABLE_COLOR2) {
so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR2, 1);
- so_reloc (so, nv40_surface_buffer(rt[2]), 0, rt_flags | NOUVEAU_BO_OR,
+ so_reloc (so, nv40_surface_buffer(&rt[2]->base), 0, rt_flags | NOUVEAU_BO_OR,
nv40->nvws->channel->vram->handle,
nv40->nvws->channel->gart->handle);
so_method(so, nv40->screen->curie, NV40TCL_COLOR2_OFFSET, 1);
- so_reloc (so, nv40_surface_buffer(rt[2]), rt[2]->offset, rt_flags |
+ so_reloc (so, nv40_surface_buffer(&rt[2]->base), rt[2]->base.offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
so_method(so, nv40->screen->curie, NV40TCL_COLOR2_PITCH, 1);
- so_data (so, rt[2]->stride);
+ so_data (so, rt[2]->pitch);
}
if (rt_enable & NV40TCL_RT_ENABLE_COLOR3) {
so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR3, 1);
- so_reloc (so, nv40_surface_buffer(rt[3]), 0, rt_flags | NOUVEAU_BO_OR,
+ so_reloc (so, nv40_surface_buffer(&rt[3]->base), 0, rt_flags | NOUVEAU_BO_OR,
nv40->nvws->channel->vram->handle,
nv40->nvws->channel->gart->handle);
so_method(so, nv40->screen->curie, NV40TCL_COLOR3_OFFSET, 1);
- so_reloc (so, nv40_surface_buffer(rt[3]), rt[3]->offset, rt_flags |
+ so_reloc (so, nv40_surface_buffer(&rt[3]->base), rt[3]->base.offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
so_method(so, nv40->screen->curie, NV40TCL_COLOR3_PITCH, 1);
- so_data (so, rt[3]->stride);
+ so_data (so, rt[3]->pitch);
}
if (zeta_format) {
so_method(so, nv40->screen->curie, NV40TCL_DMA_ZETA, 1);
- so_reloc (so, nv40_surface_buffer(zeta), 0, rt_flags | NOUVEAU_BO_OR,
+ so_reloc (so, nv40_surface_buffer(&zeta->base), 0, rt_flags | NOUVEAU_BO_OR,
nv40->nvws->channel->vram->handle,
nv40->nvws->channel->gart->handle);
so_method(so, nv40->screen->curie, NV40TCL_ZETA_OFFSET, 1);
- so_reloc (so, nv40_surface_buffer(zeta), zeta->offset, rt_flags |
+ so_reloc (so, nv40_surface_buffer(&zeta->base), zeta->base.offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
so_method(so, nv40->screen->curie, NV40TCL_ZETA_PITCH, 1);
- so_data (so, zeta->stride);
+ so_data (so, zeta->pitch);
}
so_method(so, nv40->screen->curie, NV40TCL_RT_ENABLE, 1);
diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c
new file mode 100644
index 0000000000..b090f2238e
--- /dev/null
+++ b/src/gallium/drivers/nv40/nv40_transfer.c
@@ -0,0 +1,201 @@
+#include <pipe/p_state.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
+#include <nouveau/nouveau_winsys.h>
+#include "nv40_context.h"
+#include "nv40_screen.h"
+#include "nv40_state.h"
+
+struct nv40_transfer {
+ struct pipe_transfer base;
+ struct pipe_surface *surface;
+ bool direct;
+};
+
+static unsigned nv40_usage_tx_to_buf(unsigned tx_usage)
+{
+ switch (tx_usage) {
+ case PIPE_TRANSFER_READ:
+ return PIPE_BUFFER_USAGE_CPU_READ;
+ case PIPE_TRANSFER_WRITE:
+ return PIPE_BUFFER_USAGE_CPU_WRITE;
+ case PIPE_TRANSFER_READ_WRITE:
+ return PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+ default:
+ assert(0);
+ }
+
+ return -1;
+}
+
+static void
+nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
+ struct pipe_texture *template)
+{
+ memset(template, 0, sizeof(struct pipe_texture));
+ template->target = pt->target;
+ template->format = pt->format;
+ template->width[0] = pt->width[level];
+ template->height[0] = pt->height[level];
+ template->depth[0] = 1;
+ template->block = pt->block;
+ template->nblocksx[0] = pt->nblocksx[level];
+ template->nblocksy[0] = pt->nblocksx[level];
+ template->last_level = 0;
+ template->compressed = pt->compressed;
+ template->nr_samples = pt->nr_samples;
+
+ template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
+ NOUVEAU_TEXTURE_USAGE_LINEAR;
+}
+
+static struct pipe_transfer *
+nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+ unsigned face, unsigned level, unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ struct nv40_miptree *mt = (struct nv40_miptree *)pt;
+ struct nv40_transfer *tx;
+ struct pipe_texture tx_tex_template, *tx_tex;
+
+ tx = CALLOC_STRUCT(nv40_transfer);
+ if (!tx)
+ return NULL;
+
+ tx->base.refcount = 1;
+ pipe_texture_reference(&tx->base.texture, pt);
+ tx->base.format = pt->format;
+ tx->base.x = x;
+ tx->base.y = y;
+ tx->base.width = w;
+ tx->base.height = h;
+ tx->base.block = pt->block;
+ tx->base.nblocksx = pt->nblocksx[level];
+ tx->base.nblocksy = pt->nblocksy[level];
+ tx->base.stride = mt->level[level].pitch;
+ tx->base.usage = usage;
+ tx->base.face = face;
+ tx->base.level = level;
+ tx->base.zslice = zslice;
+
+ /* Direct access to texture */
+ if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
+ debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+ pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
+ {
+ tx->direct = true;
+ tx->surface = pscreen->get_tex_surface(pscreen, pt,
+ face, level, zslice,
+ nv40_usage_tx_to_buf(usage));
+ return &tx->base;
+ }
+
+ tx->direct = false;
+
+ nv40_compatible_transfer_tex(pt, level, &tx_tex_template);
+
+ tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
+ if (!tx_tex)
+ {
+ FREE(tx);
+ return NULL;
+ }
+
+ tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
+ face, level, zslice,
+ nv40_usage_tx_to_buf(usage));
+
+ pipe_texture_reference(&tx_tex, NULL);
+
+ if (!tx->surface)
+ {
+ pipe_surface_reference(&tx->surface, NULL);
+ FREE(tx);
+ return NULL;
+ }
+
+ if (usage != PIPE_TRANSFER_WRITE) {
+ struct nv40_screen *nvscreen = nv40_screen(pscreen);
+ struct pipe_surface *src;
+
+ src = pscreen->get_tex_surface(pscreen, pt,
+ face, level, zslice,
+ PIPE_BUFFER_USAGE_GPU_READ);
+
+ /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+ /* TODO: Check if SIFM can un-swizzle */
+ nvscreen->eng2d->copy(nvscreen->eng2d,
+ tx->surface, 0, 0,
+ src, 0, 0,
+ src->width, src->height);
+
+ pipe_surface_reference(&src, NULL);
+ }
+
+ return &tx->base;
+}
+
+static void
+nv40_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer **pptx)
+{
+ struct pipe_transfer *ptx = *pptx;
+ struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
+
+ if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) {
+ struct nv40_screen *nvscreen = nv40_screen(pscreen);
+ struct pipe_surface *dst;
+
+ dst = pscreen->get_tex_surface(pscreen, ptx->texture,
+ ptx->face, ptx->level, ptx->zslice,
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
+ nvscreen->eng2d->copy(nvscreen->eng2d,
+ dst, 0, 0,
+ tx->surface, 0, 0,
+ dst->width, dst->height);
+
+ pipe_surface_reference(&dst, NULL);
+ }
+
+ *pptx = NULL;
+ if (--ptx->refcount)
+ return;
+
+ pipe_surface_reference(&tx->surface, NULL);
+ pipe_texture_reference(&ptx->texture, NULL);
+ FREE(ptx);
+}
+
+static void *
+nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+ struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
+ struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
+ struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture;
+ void *map = pipe_buffer_map(pscreen, mt->buffer,
+ nv40_usage_tx_to_buf(ptx->usage));
+
+ return map + ns->base.offset +
+ ptx->y * ns->pitch + ptx->x * ptx->block.size;
+}
+
+static void
+nv40_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+{
+ struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
+ struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture;
+
+ pipe_buffer_unmap(pscreen, mt->buffer);
+}
+
+void
+nv40_screen_init_transfer_functions(struct pipe_screen *pscreen)
+{
+ pscreen->get_tex_transfer = nv40_transfer_new;
+ pscreen->tex_transfer_release = nv40_transfer_del;
+ pscreen->transfer_map = nv40_transfer_map;
+ pscreen->transfer_unmap = nv40_transfer_unmap;
+}
diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile
index 9b7524b523..a0fd17bd59 100644
--- a/src/gallium/drivers/r300/Makefile
+++ b/src/gallium/drivers/r300/Makefile
@@ -12,6 +12,7 @@ C_SOURCES = \
r300_screen.c \
r300_state.c \
r300_state_derived.c \
+ r300_state_invariant.c \
r300_state_shader.c \
r300_surface.c \
r300_swtcl_emit.c \
diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c
index 196537a432..e01a0546b2 100644
--- a/src/gallium/drivers/r300/r300_chipset.c
+++ b/src/gallium/drivers/r300/r300_chipset.c
@@ -30,7 +30,7 @@
void r300_parse_chipset(struct r300_capabilities* caps)
{
/* Reasonable defaults */
- caps->has_tcl = TRUE;
+ caps->has_tcl = getenv("RADEON_NO_TCL") ? TRUE : FALSE;
caps->is_r500 = FALSE;
caps->num_vert_fpus = 4;
@@ -204,6 +204,13 @@ void r300_parse_chipset(struct r300_capabilities* caps)
caps->has_tcl = FALSE;
break;
+ case 0x793F:
+ case 0x7941:
+ case 0x7942:
+ caps->family = CHIP_FAMILY_RS600;
+ caps->has_tcl = FALSE;
+ break;
+
case 0x796C:
case 0x796D:
case 0x796E:
diff --git a/src/gallium/drivers/r300/r300_chipset.h b/src/gallium/drivers/r300/r300_chipset.h
index a9cd372ec5..21eebeae60 100644
--- a/src/gallium/drivers/r300/r300_chipset.h
+++ b/src/gallium/drivers/r300/r300_chipset.h
@@ -64,6 +64,7 @@ enum {
CHIP_FAMILY_RC410,
CHIP_FAMILY_RS480,
CHIP_FAMILY_RS482,
+ CHIP_FAMILY_RS600,
CHIP_FAMILY_RS690,
CHIP_FAMILY_RS740,
CHIP_FAMILY_RV515,
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 15a8751549..a981150143 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -73,7 +73,7 @@ static boolean r300_draw_range_elements(struct pipe_context* pipe,
start + count - 1, NULL);
}
- return true;
+ return TRUE;
}
static boolean r300_draw_elements(struct pipe_context* pipe,
@@ -97,6 +97,7 @@ static void r300_destroy_context(struct pipe_context* context) {
draw_destroy(r300->draw);
FREE(r300->blend_color_state);
+ FREE(r300->rs_block);
FREE(r300->scissor_state);
FREE(r300);
}
@@ -126,6 +127,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
draw_set_rasterize_stage(r300->draw, r300_draw_swtcl_stage(r300));
r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state);
+ r300->rs_block = CALLOC_STRUCT(r300_rs_block);
r300->scissor_state = CALLOC_STRUCT(r300_scissor_state);
r300_init_flush_functions(r300);
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index aaab1dd2bc..5247901be5 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -75,6 +75,13 @@ struct r300_rs_state {
uint32_t line_stipple_value; /* R300_GA_LINE_STIPPLE_VALUE: 0x4260 */
};
+struct r300_rs_block {
+ uint32_t ip[8]; /* R300_RS_IP_[0-7], R500_RS_IP_[0-7] */
+ uint32_t count; /* R300_RS_COUNT */
+ uint32_t inst_count; /* R300_RS_INST_COUNT */
+ uint32_t inst[8]; /* R300_RS_INST_[0-7] */
+};
+
struct r300_sampler_state {
uint32_t filter0; /* R300_TX_FILTER0: 0x4400 */
uint32_t filter1; /* R300_TX_FILTER1: 0x4440 */
@@ -96,12 +103,13 @@ struct r300_texture_state {
#define R300_NEW_FRAMEBUFFERS 0x0000010
#define R300_NEW_FRAGMENT_SHADER 0x0000020
#define R300_NEW_RASTERIZER 0x0000040
-#define R300_NEW_SAMPLER 0x0000080
-#define R300_NEW_SCISSOR 0x0008000
-#define R300_NEW_TEXTURE 0x0010000
-#define R300_NEW_VERTEX_FORMAT 0x1000000
-#define R300_NEW_VERTEX_SHADER 0x2000000
-#define R300_NEW_KITCHEN_SINK 0x3ffffff
+#define R300_NEW_RS_BLOCK 0x0000080
+#define R300_NEW_SAMPLER 0x0000100
+#define R300_NEW_SCISSOR 0x0010000
+#define R300_NEW_TEXTURE 0x0020000
+#define R300_NEW_VERTEX_FORMAT 0x2000000
+#define R300_NEW_VERTEX_SHADER 0x4000000
+#define R300_NEW_KITCHEN_SINK 0x7ffffff
/* The next several objects are not pure Radeon state; they inherit from
* various Gallium classes. */
@@ -224,6 +232,8 @@ struct r300_context {
struct pipe_framebuffer_state framebuffer_state;
/* Rasterizer state. */
struct r300_rs_state* rs_state;
+ /* RS block state. */
+ struct r300_rs_block* rs_block;
/* Sampler states. */
struct r300_sampler_state* sampler_states[8];
int sampler_count;
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 960f45f651..91fac62cbe 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -40,9 +40,9 @@ void r300_emit_blend_state(struct r300_context* r300,
void r300_emit_blend_color_state(struct r300_context* r300,
struct r300_blend_color_state* bc)
{
- struct r300_screen* r300screen =
- (struct r300_screen*)r300->context.screen;
+ struct r300_screen* r300screen = r300_screen(r300->context.screen);
CS_LOCALS(r300);
+
if (r300screen->caps->is_r500) {
BEGIN_CS(3);
OUT_CS_REG_SEQ(R500_RB3D_CONSTANT_COLOR_AR, 2);
@@ -59,9 +59,9 @@ void r300_emit_blend_color_state(struct r300_context* r300,
void r300_emit_dsa_state(struct r300_context* r300,
struct r300_dsa_state* dsa)
{
- struct r300_screen* r300screen =
- (struct r300_screen*)r300->context.screen;
+ struct r300_screen* r300screen = r300_screen(r300->context.screen);
CS_LOCALS(r300);
+
BEGIN_CS(r300screen->caps->is_r500 ? 8 : 8);
OUT_CS_REG(R300_FG_ALPHA_FUNC, dsa->alpha_function);
/* XXX figure out the r300 counterpart for this */
@@ -84,6 +84,7 @@ void r300_emit_fragment_shader(struct r300_context* r300,
{
CS_LOCALS(r300);
int i;
+
BEGIN_CS(22);
OUT_CS_REG(R300_US_CONFIG, MAX2(fs->indirections - 1, 0));
@@ -114,7 +115,8 @@ void r500_emit_fragment_shader(struct r300_context* r300,
struct r500_fragment_shader* fs)
{
CS_LOCALS(r300);
- int i = 0;
+ int i;
+
BEGIN_CS(9 + (fs->instruction_count * 6));
OUT_CS_REG(R500_US_CONFIG, R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO);
OUT_CS_REG(R500_US_PIXSIZE, fs->shader.stack_size);
@@ -191,9 +193,9 @@ void r300_emit_fb_state(struct r300_context* r300,
void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs)
{
- struct r300_screen* r300screen =
- (struct r300_screen*)r300->context.screen;
+ struct r300_screen* r300screen = r300_screen(r300->context.screen);
CS_LOCALS(r300);
+
BEGIN_CS(13);
OUT_CS_REG(R300_VAP_CNTL_STATUS, rs->vap_control_status);
OUT_CS_REG_SEQ(R300_SU_POLY_OFFSET_FRONT_SCALE, 6);
@@ -208,10 +210,44 @@ void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs)
END_CS;
}
+void r300_emit_rs_block_state(struct r300_context* r300,
+ struct r300_rs_block* rs)
+{
+ struct r300_screen* r300screen = r300_screen(r300->context.screen);
+ CS_LOCALS(r300);
+ int i;
+
+ BEGIN_CS(21);
+ if (r300screen->caps->is_r500) {
+ OUT_CS_REG_SEQ(R500_RS_IP_0, 8);
+ } else {
+ OUT_CS_REG_SEQ(R300_RS_IP_0, 8);
+ }
+ for (i = 0; i < 8; i++) {
+ OUT_CS(rs->ip[i]);
+ }
+
+ OUT_CS_REG_SEQ(R300_RS_COUNT, 2);
+ OUT_CS(rs->count);
+ OUT_CS(rs->inst_count);
+
+ if (r300screen->caps->is_r500) {
+ OUT_CS_REG_SEQ(R500_RS_INST_0, 8);
+ } else {
+ OUT_CS_REG_SEQ(R300_RS_INST_0, 8);
+ }
+ for (i = 0; i < 8; i++) {
+ OUT_CS(rs->inst[i]);
+ }
+
+ END_CS;
+}
+
void r300_emit_scissor_state(struct r300_context* r300,
struct r300_scissor_state* scissor)
{
CS_LOCALS(r300);
+
BEGIN_CS(3);
OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2);
OUT_CS(scissor->scissor_top_left);
@@ -248,8 +284,7 @@ void r300_emit_vertex_format_state(struct r300_context* r300)
/* Emit all dirty state. */
void r300_emit_dirty_state(struct r300_context* r300)
{
- struct r300_screen* r300screen =
- (struct r300_screen*)r300->context.screen;
+ struct r300_screen* r300screen = r300_screen(r300->context.screen);
CS_LOCALS(r300);
if (!(r300->dirty_state) && !(r300->dirty_hw)) {
diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
index 8888b39a2f..e0da9d361e 100644
--- a/src/gallium/drivers/r300/r300_reg.h
+++ b/src/gallium/drivers/r300/r300_reg.h
@@ -732,6 +732,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R500_RS_IP_TEX_PTR_Q_SHIFT 18
#define R500_RS_IP_COL_PTR_SHIFT 24
#define R500_RS_IP_COL_FMT_SHIFT 27
+# define R500_RS_SEL_S(x) ((x) << 0)
+# define R500_RS_SEL_T(x) ((x) << 6)
+# define R500_RS_SEL_R(x) ((x) << 12)
+# define R500_RS_SEL_Q(x) ((x) << 18)
# define R500_RS_COL_PTR(x) ((x) << 24)
# define R500_RS_COL_FMT(x) ((x) << 27)
/* gap */
@@ -1216,14 +1220,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R500_RS_INST_14 0x4358
#define R500_RS_INST_15 0x435c
#define R500_RS_INST_TEX_ID_SHIFT 0
+# define R500_RS_INST_TEX_ID(x) ((x) << 0)
#define R500_RS_INST_TEX_CN_WRITE (1 << 4)
#define R500_RS_INST_TEX_ADDR_SHIFT 5
+# define R500_RS_INST_TEX_ADDR(x) ((x) << 0)
#define R500_RS_INST_COL_ID_SHIFT 12
+# define R500_RS_INST_COL_ID(x) ((x) << 12)
#define R500_RS_INST_COL_CN_NO_WRITE (0 << 16)
#define R500_RS_INST_COL_CN_WRITE (1 << 16)
#define R500_RS_INST_COL_CN_WRITE_FBUFFER (2 << 16)
#define R500_RS_INST_COL_CN_WRITE_BACKFACE (3 << 16)
#define R500_RS_INST_COL_ADDR_SHIFT 18
+# define R500_RS_INST_COL_ADDR(x) ((x) << 18)
#define R500_RS_INST_TEX_ADJ (1 << 25)
#define R500_RS_INST_W_CN (1 << 26)
@@ -1240,9 +1248,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R300_RS_INST_7 0x434C
# define R300_RS_INST_TEX_ID(x) ((x) << 0)
# define R300_RS_INST_TEX_CN_WRITE (1 << 3)
+# define R300_RS_INST_TEX_ADDR(x) ((x) << 6)
# define R300_RS_INST_TEX_ADDR_SHIFT 6
# define R300_RS_INST_COL_ID(x) ((x) << 11)
# define R300_RS_INST_COL_CN_WRITE (1 << 14)
+# define R300_RS_INST_COL_ADDR(x) ((x) << 17)
# define R300_RS_INST_COL_ADDR_SHIFT 17
# define R300_RS_INST_TEX_ADJ (1 << 22)
# define R300_RS_COL_BIAS_UNUSED_SHIFT 23
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 5ff9015a7b..2fcd504812 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -50,6 +50,7 @@ static const char* chip_families[] = {
"RC410",
"RS480",
"RS482",
+ "RS600",
"RS690",
"RS740",
"RV515",
@@ -178,8 +179,11 @@ static boolean check_tex_2d_format(enum pipe_format format, boolean is_r500)
{
switch (format) {
/* Colorbuffer */
+ case PIPE_FORMAT_A4R4G4B4_UNORM:
+ case PIPE_FORMAT_R5G6B5_UNORM:
+ case PIPE_FORMAT_A1R5G5B5_UNORM:
case PIPE_FORMAT_A8R8G8B8_UNORM:
- /* Texture */
+ /* Colorbuffer or texture */
case PIPE_FORMAT_I8_UNORM:
/* Z buffer */
case PIPE_FORMAT_Z16_UNORM:
@@ -187,29 +191,25 @@ static boolean check_tex_2d_format(enum pipe_format format, boolean is_r500)
case PIPE_FORMAT_Z24S8_UNORM:
return TRUE;
- /* XXX Supported yet unimplemented formats: */
- case PIPE_FORMAT_A1R5G5B5_UNORM:
- case PIPE_FORMAT_R5G6B5_UNORM:
/* 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) */
- case PIPE_FORMAT_A4R4G4B4_UNORM:
+ /* XXX What the deuce is UV88? (r3xx accel page 14)
debug_printf("r300: Warning: Got unimplemented format: %s in %s\n",
pf_name(format), __FUNCTION__);
- return FALSE;
+ return FALSE; */
/* XXX Supported yet unimplemented r5xx formats: */
/* XXX Again, what is UV1010 this time? (r5xx accel page 148) */
/* XXX Even more that don't exist
case PIPE_FORMAT_A10R10G10B10_UNORM:
case PIPE_FORMAT_A2R10G10B10_UNORM:
- case PIPE_FORMAT_I10_UNORM: */
+ case PIPE_FORMAT_I10_UNORM:
debug_printf(
"r300: Warning: Got unimplemented r500 format: %s in %s\n",
pf_name(format), __FUNCTION__);
- return FALSE;
+ return FALSE; */
default:
debug_printf("r300: Warning: Got unsupported format: %s in %s\n",
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index da99a3be6b..6e64ad2dc3 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -28,89 +28,11 @@
#include "r300_context.h"
#include "r300_reg.h"
+#include "r300_state_inlines.h"
#include "r300_state_shader.h"
/* r300_state: Functions used to intialize state context by translating
- * Gallium state objects into semi-native r300 state objects.
- *
- * XXX break this file up into pieces if it gets too big! */
-
-/* Pack a float into a dword. */
-static uint32_t pack_float_32(float f)
-{
- union {
- float f;
- uint32_t u;
- } u;
-
- u.f = f;
- return u.u;
-}
-
-static uint32_t translate_blend_function(int blend_func) {
- switch (blend_func) {
- case PIPE_BLEND_ADD:
- return R300_COMB_FCN_ADD_CLAMP;
- case PIPE_BLEND_SUBTRACT:
- return R300_COMB_FCN_SUB_CLAMP;
- case PIPE_BLEND_REVERSE_SUBTRACT:
- return R300_COMB_FCN_RSUB_CLAMP;
- case PIPE_BLEND_MIN:
- return R300_COMB_FCN_MIN;
- case PIPE_BLEND_MAX:
- return R300_COMB_FCN_MAX;
- default:
- debug_printf("r300: Unknown blend function %d\n", blend_func);
- break;
- }
- return 0;
-}
-
-/* XXX we can also offer the D3D versions of some of these... */
-static uint32_t translate_blend_factor(int blend_fact) {
- switch (blend_fact) {
- case PIPE_BLENDFACTOR_ONE:
- return R300_BLEND_GL_ONE;
- case PIPE_BLENDFACTOR_SRC_COLOR:
- return R300_BLEND_GL_SRC_COLOR;
- case PIPE_BLENDFACTOR_SRC_ALPHA:
- return R300_BLEND_GL_SRC_ALPHA;
- case PIPE_BLENDFACTOR_DST_ALPHA:
- return R300_BLEND_GL_DST_ALPHA;
- case PIPE_BLENDFACTOR_DST_COLOR:
- return R300_BLEND_GL_DST_COLOR;
- case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
- return R300_BLEND_GL_SRC_ALPHA_SATURATE;
- case PIPE_BLENDFACTOR_CONST_COLOR:
- return R300_BLEND_GL_CONST_COLOR;
- case PIPE_BLENDFACTOR_CONST_ALPHA:
- return R300_BLEND_GL_CONST_ALPHA;
- /* XXX WTF are these?
- case PIPE_BLENDFACTOR_SRC1_COLOR:
- case PIPE_BLENDFACTOR_SRC1_ALPHA: */
- case PIPE_BLENDFACTOR_ZERO:
- return R300_BLEND_GL_ZERO;
- case PIPE_BLENDFACTOR_INV_SRC_COLOR:
- return R300_BLEND_GL_ONE_MINUS_SRC_COLOR;
- case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
- return R300_BLEND_GL_ONE_MINUS_SRC_ALPHA;
- case PIPE_BLENDFACTOR_INV_DST_ALPHA:
- return R300_BLEND_GL_ONE_MINUS_DST_ALPHA;
- case PIPE_BLENDFACTOR_INV_DST_COLOR:
- return R300_BLEND_GL_ONE_MINUS_DST_COLOR;
- case PIPE_BLENDFACTOR_INV_CONST_COLOR:
- return R300_BLEND_GL_ONE_MINUS_CONST_COLOR;
- case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
- return R300_BLEND_GL_ONE_MINUS_CONST_ALPHA;
- /* XXX see above
- case PIPE_BLENDFACTOR_INV_SRC1_COLOR:
- case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: */
- default:
- debug_printf("r300: Unknown blend factor %d\n", blend_fact);
- break;
- }
- return 0;
-}
+ * Gallium state objects into semi-native r300 state objects. */
/* Create a new blend state based on the CSO blend state.
*
@@ -126,16 +48,16 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
blend->blend_control = R300_ALPHA_BLEND_ENABLE |
R300_SEPARATE_ALPHA_ENABLE |
R300_READ_ENABLE |
- translate_blend_function(state->rgb_func) |
- (translate_blend_factor(state->rgb_src_factor) <<
+ r300_translate_blend_function(state->rgb_func) |
+ (r300_translate_blend_factor(state->rgb_src_factor) <<
R300_SRC_BLEND_SHIFT) |
- (translate_blend_factor(state->rgb_dst_factor) <<
+ (r300_translate_blend_factor(state->rgb_dst_factor) <<
R300_DST_BLEND_SHIFT);
blend->alpha_blend_control =
- translate_blend_function(state->alpha_func) |
- (translate_blend_factor(state->alpha_src_factor) <<
+ r300_translate_blend_function(state->alpha_func) |
+ (r300_translate_blend_factor(state->alpha_src_factor) <<
R300_SRC_BLEND_SHIFT) |
- (translate_blend_factor(state->alpha_dst_factor) <<
+ (r300_translate_blend_factor(state->alpha_dst_factor) <<
R300_DST_BLEND_SHIFT);
}
@@ -178,21 +100,17 @@ static void r300_set_blend_color(struct pipe_context* pipe,
const struct pipe_blend_color* color)
{
struct r300_context* r300 = r300_context(pipe);
- uint32_t r, g, b, a;
ubyte ur, ug, ub, ua;
- r = util_iround(color->color[0] * 1023.0f);
- g = util_iround(color->color[1] * 1023.0f);
- b = util_iround(color->color[2] * 1023.0f);
- a = util_iround(color->color[3] * 1023.0f);
-
ur = float_to_ubyte(color->color[0]);
ug = float_to_ubyte(color->color[1]);
ub = float_to_ubyte(color->color[2]);
ua = float_to_ubyte(color->color[3]);
- r300->blend_color_state->blend_color = (a << 24) | (r << 16) | (g << 8) | b;
+ util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM,
+ &r300->blend_color_state->blend_color);
+ /* XXX this is wrong */
r300->blend_color_state->blend_color_red_alpha = ur | (ua << 16);
r300->blend_color_state->blend_color_green_blue = ub | (ug << 16);
@@ -233,82 +151,6 @@ static void
r300->dirty_state |= R300_NEW_CONSTANTS;
}
-static uint32_t translate_depth_stencil_function(int zs_func) {
- switch (zs_func) {
- case PIPE_FUNC_NEVER:
- return R300_ZS_NEVER;
- case PIPE_FUNC_LESS:
- return R300_ZS_LESS;
- case PIPE_FUNC_EQUAL:
- return R300_ZS_EQUAL;
- case PIPE_FUNC_LEQUAL:
- return R300_ZS_LEQUAL;
- case PIPE_FUNC_GREATER:
- return R300_ZS_GREATER;
- case PIPE_FUNC_NOTEQUAL:
- return R300_ZS_NOTEQUAL;
- case PIPE_FUNC_GEQUAL:
- return R300_ZS_GEQUAL;
- case PIPE_FUNC_ALWAYS:
- return R300_ZS_ALWAYS;
- default:
- debug_printf("r300: Unknown depth/stencil function %d\n",
- zs_func);
- break;
- }
- return 0;
-}
-
-static uint32_t translate_stencil_op(int s_op) {
- switch (s_op) {
- case PIPE_STENCIL_OP_KEEP:
- return R300_ZS_KEEP;
- case PIPE_STENCIL_OP_ZERO:
- return R300_ZS_ZERO;
- case PIPE_STENCIL_OP_REPLACE:
- return R300_ZS_REPLACE;
- case PIPE_STENCIL_OP_INCR:
- return R300_ZS_INCR;
- case PIPE_STENCIL_OP_DECR:
- return R300_ZS_DECR;
- case PIPE_STENCIL_OP_INCR_WRAP:
- return R300_ZS_INCR_WRAP;
- case PIPE_STENCIL_OP_DECR_WRAP:
- return R300_ZS_DECR_WRAP;
- case PIPE_STENCIL_OP_INVERT:
- return R300_ZS_INVERT;
- default:
- debug_printf("r300: Unknown stencil op %d", s_op);
- break;
- }
- return 0;
-}
-
-static uint32_t translate_alpha_function(int alpha_func) {
- switch (alpha_func) {
- case PIPE_FUNC_NEVER:
- return R300_FG_ALPHA_FUNC_NEVER;
- case PIPE_FUNC_LESS:
- return R300_FG_ALPHA_FUNC_LESS;
- case PIPE_FUNC_EQUAL:
- return R300_FG_ALPHA_FUNC_EQUAL;
- case PIPE_FUNC_LEQUAL:
- return R300_FG_ALPHA_FUNC_LE;
- case PIPE_FUNC_GREATER:
- return R300_FG_ALPHA_FUNC_GREATER;
- case PIPE_FUNC_NOTEQUAL:
- return R300_FG_ALPHA_FUNC_NOTEQUAL;
- case PIPE_FUNC_GEQUAL:
- return R300_FG_ALPHA_FUNC_GE;
- case PIPE_FUNC_ALWAYS:
- return R300_FG_ALPHA_FUNC_ALWAYS;
- default:
- debug_printf("r300: Unknown alpha function %d", alpha_func);
- break;
- }
- return 0;
-}
-
/* Create a new depth, stencil, and alpha state based on the CSO dsa state.
*
* This contains the depth buffer, stencil buffer, alpha test, and such.
@@ -329,7 +171,7 @@ static void*
}
dsa->z_stencil_control |=
- (translate_depth_stencil_function(state->depth.func) <<
+ (r300_translate_depth_stencil_function(state->depth.func) <<
R300_Z_FUNC_SHIFT);
}
@@ -337,14 +179,14 @@ static void*
if (state->stencil[0].enabled) {
dsa->z_buffer_control |= R300_STENCIL_ENABLE;
dsa->z_stencil_control |=
- (translate_depth_stencil_function(state->stencil[0].func) <<
- R300_S_FRONT_FUNC_SHIFT) |
- (translate_stencil_op(state->stencil[0].fail_op) <<
- R300_S_FRONT_SFAIL_OP_SHIFT) |
- (translate_stencil_op(state->stencil[0].zpass_op) <<
- R300_S_FRONT_ZPASS_OP_SHIFT) |
- (translate_stencil_op(state->stencil[0].zfail_op) <<
- R300_S_FRONT_ZFAIL_OP_SHIFT);
+ (r300_translate_depth_stencil_function(state->stencil[0].func) <<
+ R300_S_FRONT_FUNC_SHIFT) |
+ (r300_translate_stencil_op(state->stencil[0].fail_op) <<
+ R300_S_FRONT_SFAIL_OP_SHIFT) |
+ (r300_translate_stencil_op(state->stencil[0].zpass_op) <<
+ R300_S_FRONT_ZPASS_OP_SHIFT) |
+ (r300_translate_stencil_op(state->stencil[0].zfail_op) <<
+ R300_S_FRONT_ZFAIL_OP_SHIFT);
dsa->stencil_ref_mask = (state->stencil[0].ref_value) |
(state->stencil[0].valuemask << R300_STENCILMASK_SHIFT) |
@@ -353,14 +195,14 @@ static void*
if (state->stencil[1].enabled) {
dsa->z_buffer_control |= R300_STENCIL_FRONT_BACK;
dsa->z_stencil_control |=
- (translate_depth_stencil_function(state->stencil[1].func) <<
- R300_S_BACK_FUNC_SHIFT) |
- (translate_stencil_op(state->stencil[1].fail_op) <<
- R300_S_BACK_SFAIL_OP_SHIFT) |
- (translate_stencil_op(state->stencil[1].zpass_op) <<
- R300_S_BACK_ZPASS_OP_SHIFT) |
- (translate_stencil_op(state->stencil[1].zfail_op) <<
- R300_S_BACK_ZFAIL_OP_SHIFT);
+ (r300_translate_depth_stencil_function(state->stencil[1].func) <<
+ R300_S_BACK_FUNC_SHIFT) |
+ (r300_translate_stencil_op(state->stencil[1].fail_op) <<
+ R300_S_BACK_SFAIL_OP_SHIFT) |
+ (r300_translate_stencil_op(state->stencil[1].zpass_op) <<
+ R300_S_BACK_ZPASS_OP_SHIFT) |
+ (r300_translate_stencil_op(state->stencil[1].zfail_op) <<
+ R300_S_BACK_ZFAIL_OP_SHIFT);
dsa->stencil_ref_bf = (state->stencil[1].ref_value) |
(state->stencil[1].valuemask << R300_STENCILMASK_SHIFT) |
@@ -370,7 +212,8 @@ static void*
/* Alpha test setup. */
if (state->alpha.enabled) {
- dsa->alpha_function = translate_alpha_function(state->alpha.func) |
+ dsa->alpha_function =
+ r300_translate_alpha_function(state->alpha.func) |
R300_FG_ALPHA_FUNC_ENABLE;
dsa->alpha_reference = CLAMP(state->alpha.ref_value * 1023.0f,
0, 1023);
@@ -457,7 +300,7 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader)
}
}
- fs->translated = true;
+ fs->translated = TRUE;
r300->fs = fs;
r300->dirty_state |= R300_NEW_FRAGMENT_SHADER;
@@ -475,10 +318,6 @@ static void r300_set_polygon_stipple(struct pipe_context* pipe,
/* XXX */
}
-static INLINE int pack_float_16_6x(float f) {
- return ((int)(f * 6.0) & 0xffff);
-}
-
/* Create a new rasterizer state based on the CSO rasterizer state.
*
* This is a very large chunk of state, and covers most of the graphics
@@ -530,15 +369,15 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
if (rs->polygon_offset_enable) {
rs->depth_offset_front = rs->depth_offset_back =
- pack_float_32(state->offset_units);
+ fui(state->offset_units);
rs->depth_scale_front = rs->depth_scale_back =
- pack_float_32(state->offset_scale);
+ fui(state->offset_scale);
}
if (state->line_stipple_enable) {
rs->line_stipple_config =
R300_GA_LINE_STIPPLE_CONFIG_LINE_RESET_LINE |
- (pack_float_32((float)state->line_stipple_factor) &
+ (fui((float)state->line_stipple_factor) &
R300_GA_LINE_STIPPLE_CONFIG_STIPPLE_SCALE_MASK);
/* XXX this might need to be scaled up */
rs->line_stipple_value = state->line_stipple_pattern;
@@ -567,83 +406,6 @@ static void r300_delete_rs_state(struct pipe_context* pipe, void* state)
FREE(state);
}
-static uint32_t translate_wrap(int wrap) {
- switch (wrap) {
- case PIPE_TEX_WRAP_REPEAT:
- return R300_TX_REPEAT;
- case PIPE_TEX_WRAP_CLAMP:
- return R300_TX_CLAMP;
- case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
- return R300_TX_CLAMP_TO_EDGE;
- case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
- return R300_TX_CLAMP_TO_BORDER;
- case PIPE_TEX_WRAP_MIRROR_REPEAT:
- return R300_TX_REPEAT | R300_TX_MIRRORED;
- case PIPE_TEX_WRAP_MIRROR_CLAMP:
- return R300_TX_CLAMP | R300_TX_MIRRORED;
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
- return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
- return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
- default:
- debug_printf("r300: Unknown texture wrap %d", wrap);
- return 0;
- }
-}
-
-static uint32_t translate_tex_filters(int min, int mag, int mip) {
- uint32_t retval = 0;
- switch (min) {
- case PIPE_TEX_FILTER_NEAREST:
- retval |= R300_TX_MIN_FILTER_NEAREST;
- case PIPE_TEX_FILTER_LINEAR:
- retval |= R300_TX_MIN_FILTER_LINEAR;
- case PIPE_TEX_FILTER_ANISO:
- retval |= R300_TX_MIN_FILTER_ANISO;
- default:
- debug_printf("r300: Unknown texture filter %d", min);
- break;
- }
- switch (mag) {
- case PIPE_TEX_FILTER_NEAREST:
- retval |= R300_TX_MAG_FILTER_NEAREST;
- case PIPE_TEX_FILTER_LINEAR:
- retval |= R300_TX_MAG_FILTER_LINEAR;
- case PIPE_TEX_FILTER_ANISO:
- retval |= R300_TX_MAG_FILTER_ANISO;
- default:
- debug_printf("r300: Unknown texture filter %d", mag);
- break;
- }
- switch (mip) {
- case PIPE_TEX_MIPFILTER_NONE:
- retval |= R300_TX_MIN_FILTER_MIP_NONE;
- case PIPE_TEX_MIPFILTER_NEAREST:
- retval |= R300_TX_MIN_FILTER_MIP_NEAREST;
- case PIPE_TEX_MIPFILTER_LINEAR:
- retval |= R300_TX_MIN_FILTER_MIP_LINEAR;
- default:
- debug_printf("r300: Unknown texture filter %d", mip);
- break;
- }
-
- return retval;
-}
-
-static uint32_t anisotropy(float max_aniso) {
- if (max_aniso >= 16.0f) {
- return R300_TX_MAX_ANISO_16_TO_1;
- } else if (max_aniso >= 8.0f) {
- return R300_TX_MAX_ANISO_8_TO_1;
- } else if (max_aniso >= 4.0f) {
- return R300_TX_MAX_ANISO_4_TO_1;
- } else if (max_aniso >= 2.0f) {
- return R300_TX_MAX_ANISO_2_TO_1;
- } else {
- return R300_TX_MAX_ANISO_1_TO_1;
- }
-}
-
static void*
r300_create_sampler_state(struct pipe_context* pipe,
const struct pipe_sampler_state* state)
@@ -653,19 +415,19 @@ static void*
int lod_bias;
sampler->filter0 |=
- (translate_wrap(state->wrap_s) << R300_TX_WRAP_S_SHIFT) |
- (translate_wrap(state->wrap_t) << R300_TX_WRAP_T_SHIFT) |
- (translate_wrap(state->wrap_r) << R300_TX_WRAP_R_SHIFT);
+ (r300_translate_wrap(state->wrap_s) << R300_TX_WRAP_S_SHIFT) |
+ (r300_translate_wrap(state->wrap_t) << R300_TX_WRAP_T_SHIFT) |
+ (r300_translate_wrap(state->wrap_r) << R300_TX_WRAP_R_SHIFT);
- sampler->filter0 |= translate_tex_filters(state->min_img_filter,
- state->mag_img_filter,
- state->min_mip_filter);
+ sampler->filter0 |= r300_translate_tex_filters(state->min_img_filter,
+ state->mag_img_filter,
+ state->min_mip_filter);
lod_bias = CLAMP((int)(state->lod_bias * 32), -(1 << 9), (1 << 9) - 1);
sampler->filter1 |= lod_bias << R300_LOD_BIAS_SHIFT;
- sampler->filter1 |= anisotropy(state->max_anisotropy);
+ sampler->filter1 |= r300_anisotropy(state->max_anisotropy);
util_pack_color(state->border_color, PIPE_FORMAT_A8R8G8B8_UNORM,
&sampler->border_color);
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index a51904096f..548a840f25 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -57,34 +57,40 @@ static uint32_t translate_vertex_data_type(int type) {
/* XXX this function should be able to handle vert shaders as well as draw */
static void r300_update_vertex_layout(struct r300_context* r300)
{
+ struct r300_vertex_format vformat;
struct vertex_info vinfo;
- boolean pos = false, psize = false, fog = false;
+ boolean pos = FALSE, psize = FALSE, fog = FALSE;
int i, texs = 0, cols = 0;
+ int tab[16];
struct tgsi_shader_info* info = &r300->fs->info;
+
memset(&vinfo, 0, sizeof(vinfo));
+ for (i = 0; i < 16; i++) {
+ tab[i] = -1;
+ }
assert(info->num_inputs <= 16);
- /* This is rather lame. Since draw_find_vs_output doesn't return an error
- * when it can't find an output, we have to pre-iterate and count each
- * output ourselves. */
for (i = 0; i < info->num_inputs; i++) {
switch (info->input_semantic_name[i]) {
case TGSI_SEMANTIC_POSITION:
- pos = true;
+ pos = TRUE;
+ tab[i] = 0;
break;
case TGSI_SEMANTIC_COLOR:
- cols++;
+ tab[i] = 2 + cols++;
break;
case TGSI_SEMANTIC_FOG:
- fog = true;
+ fog = TRUE;
+ tab[i] = 6 + texs++;
break;
case TGSI_SEMANTIC_PSIZE:
- psize = true;
+ psize = TRUE;
+ tab[i] = 1;
break;
case TGSI_SEMANTIC_GENERIC:
- texs++;
+ tab[i] = 6 + texs++;
break;
default:
debug_printf("r300: Unknown vertex input %d\n",
@@ -105,6 +111,12 @@ static void r300_update_vertex_layout(struct r300_context* r300)
if (!pos) {
debug_printf("r300: Forcing vertex position attribute emit...\n");
+ /* Make room for the position attribute
+ * at the beginning of the tab. */
+ for (i = 1; i < 16; i++) {
+ tab[i] = tab[i-1];
+ }
+ tab[0] = 0;
}
draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_POS,
@@ -125,16 +137,17 @@ static void r300_update_vertex_layout(struct r300_context* r300)
vinfo.hwfmt[2] |= (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i);
}
- if (fog) {
+ for (i = 0; i < texs; i++) {
draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE,
- draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0));
- vinfo.hwfmt[2] |=
- (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << cols);
+ draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i));
+ vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i);
+ vinfo.hwfmt[3] |= (4 << (3 * i));
}
- for (i = 0; i < texs; i++) {
- draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR,
- draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i));
+ if (fog) {
+ i++;
+ draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE,
+ draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0));
vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i);
vinfo.hwfmt[3] |= (4 << (3 * i));
}
@@ -152,18 +165,29 @@ static void r300_update_vertex_layout(struct r300_context* r300)
(0xf << R300_WRITE_ENA_SHIFT))
for (i = 0; i < vinfo.num_attribs; i++) {
+ /* Make sure we have a proper destination for our attribute */
+ if (tab[i] == -1) {
+ debug_printf("attrib count: %d, fp input count: %d\n",
+ vinfo.num_attribs, info->num_inputs);
+ for (i = 0; i < vinfo.num_attribs; i++) {
+ debug_printf("attrib: offset %d, interp %d, size %d,"
+ " tab %d\n", vinfo.attrib[i].src_index,
+ vinfo.attrib[i].interp_mode, vinfo.attrib[i].emit,
+ tab[i]);
+ }
+ assert(0);
+ }
+
temp = translate_vertex_data_type(vinfo.attrib[i].emit) |
- R300_SIGNED;
+ (tab[i] << R300_DST_VEC_LOC_SHIFT) | R300_SIGNED;
if (i & 1) {
r300->vertex_info.vap_prog_stream_cntl[i >> 1] &= 0xffff0000;
r300->vertex_info.vap_prog_stream_cntl[i >> 1] |=
- (translate_vertex_data_type(vinfo.attrib[i].emit) |
- R300_SIGNED) << 16;
+ temp << 16;
} else {
r300->vertex_info.vap_prog_stream_cntl[i >> 1] &= 0xffff;
r300->vertex_info.vap_prog_stream_cntl[i >> 1] |=
- translate_vertex_data_type(vinfo.attrib[i].emit) |
- R300_SIGNED;
+ temp;
}
r300->vertex_info.vap_prog_stream_cntl_ext[i >> 1] |=
@@ -180,8 +204,85 @@ static void r300_update_vertex_layout(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. */
-void r300_update_rs_block(struct r300_context* r300)
+static void r300_update_rs_block(struct r300_context* r300)
{
+ struct r300_rs_block* rs = r300->rs_block;
+ struct vertex_info* vinfo = &r300->vertex_info.vinfo;
+ int col_count = 0, fp_offset = 0, i, tex_count = 0;
+
+ memset(rs, 0, sizeof(struct r300_rs_block));
+
+ if (r300_screen(r300->context.screen)->caps->is_r500) {
+ for (i = 0; i < vinfo->num_attribs; i++) {
+ switch (vinfo->attrib[i].interp_mode) {
+ case INTERP_LINEAR:
+ rs->ip[col_count] |=
+ R500_RS_COL_PTR(vinfo->attrib[i].src_index) |
+ R500_RS_COL_FMT(R300_RS_COL_FMT_RGBA);
+ col_count++;
+ break;
+ case INTERP_PERSPECTIVE:
+ rs->ip[tex_count] |=
+ R500_RS_SEL_S(vinfo->attrib[i].src_index) |
+ R500_RS_SEL_T(vinfo->attrib[i].src_index + 1) |
+ R500_RS_SEL_R(vinfo->attrib[i].src_index + 2) |
+ R500_RS_SEL_Q(vinfo->attrib[i].src_index + 3);
+ tex_count++;
+ break;
+ }
+ }
+
+ for (i = 0; i < tex_count; i++) {
+ rs->inst[i] |= R500_RS_INST_TEX_ID(i) | R500_RS_INST_TEX_CN_WRITE |
+ R500_RS_INST_TEX_ADDR(fp_offset);
+ fp_offset++;
+ }
+
+ for (i = 0; i < col_count; i++) {
+ rs->inst[i] |= R500_RS_INST_COL_ID(i) | R500_RS_INST_COL_CN_WRITE |
+ R500_RS_INST_COL_ADDR(fp_offset);
+ fp_offset++;
+ }
+
+ rs->inst_count = MAX2(col_count, tex_count);
+ } else {
+ for (i = 0; i < vinfo->num_attribs; i++) {
+ switch (vinfo->attrib[i].interp_mode) {
+ case INTERP_LINEAR:
+ rs->ip[col_count] |=
+ R300_RS_COL_PTR(vinfo->attrib[i].src_index) |
+ R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA);
+ col_count++;
+ break;
+ case INTERP_PERSPECTIVE:
+ rs->ip[tex_count] |=
+ R300_RS_TEX_PTR(vinfo->attrib[i].src_index) |
+ R300_RS_SEL_S(R300_RS_SEL_C0) |
+ R300_RS_SEL_T(R300_RS_SEL_C1) |
+ R300_RS_SEL_R(R300_RS_SEL_C2) |
+ R300_RS_SEL_Q(R300_RS_SEL_C3);
+ tex_count += 4;
+ break;
+ }
+ }
+
+ for (i = 0; i < tex_count; i++) {
+ rs->inst[i] |= R300_RS_INST_TEX_ID(i) | R300_RS_INST_TEX_CN_WRITE |
+ R300_RS_INST_TEX_ADDR(fp_offset);
+ fp_offset++;
+ }
+
+ for (i = 0; i < col_count; i++) {
+ rs->inst[i] |= R300_RS_INST_COL_ID(i) | R300_RS_INST_COL_CN_WRITE |
+ R300_RS_INST_COL_ADDR(fp_offset);
+ fp_offset++;
+ }
+ }
+
+ rs->count = (tex_count * 4) | (col_count << R300_IC_COUNT_SHIFT) |
+ R300_HIRES_EN;
+
+ rs->inst_count = MAX2(col_count, tex_count);
}
void r300_update_derived_state(struct r300_context* r300)
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
index 005fb74ed6..630ac3b2fc 100644
--- a/src/gallium/drivers/r300/r300_state_inlines.h
+++ b/src/gallium/drivers/r300/r300_state_inlines.h
@@ -1,5 +1,6 @@
/*
* Copyright 2009 Joakim Sindholt <opensource@zhasha.com>
+ * Corbin Simpson <MostAwesomeDude@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,56 +28,319 @@
#include "r300_reg.h"
+/* Some maths. These should probably find their way to u_math, if needed. */
+
+static INLINE int pack_float_16_6x(float f) {
+ return ((int)(f * 6.0) & 0xffff);
+}
+
+/* Blend state. */
+
+static INLINE uint32_t r300_translate_blend_function(int blend_func)
+{
+ switch (blend_func) {
+ case PIPE_BLEND_ADD:
+ return R300_COMB_FCN_ADD_CLAMP;
+ case PIPE_BLEND_SUBTRACT:
+ return R300_COMB_FCN_SUB_CLAMP;
+ case PIPE_BLEND_REVERSE_SUBTRACT:
+ return R300_COMB_FCN_RSUB_CLAMP;
+ case PIPE_BLEND_MIN:
+ return R300_COMB_FCN_MIN;
+ case PIPE_BLEND_MAX:
+ return R300_COMB_FCN_MAX;
+ default:
+ debug_printf("r300: Unknown blend function %d\n", blend_func);
+ break;
+ }
+ return 0;
+}
+
+/* XXX we can also offer the D3D versions of some of these... */
+static INLINE uint32_t r300_translate_blend_factor(int blend_fact)
+{
+ switch (blend_fact) {
+ case PIPE_BLENDFACTOR_ONE:
+ return R300_BLEND_GL_ONE;
+ case PIPE_BLENDFACTOR_SRC_COLOR:
+ return R300_BLEND_GL_SRC_COLOR;
+ case PIPE_BLENDFACTOR_SRC_ALPHA:
+ return R300_BLEND_GL_SRC_ALPHA;
+ case PIPE_BLENDFACTOR_DST_ALPHA:
+ return R300_BLEND_GL_DST_ALPHA;
+ case PIPE_BLENDFACTOR_DST_COLOR:
+ return R300_BLEND_GL_DST_COLOR;
+ case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
+ return R300_BLEND_GL_SRC_ALPHA_SATURATE;
+ case PIPE_BLENDFACTOR_CONST_COLOR:
+ return R300_BLEND_GL_CONST_COLOR;
+ case PIPE_BLENDFACTOR_CONST_ALPHA:
+ return R300_BLEND_GL_CONST_ALPHA;
+ /* XXX WTF are these?
+ case PIPE_BLENDFACTOR_SRC1_COLOR:
+ case PIPE_BLENDFACTOR_SRC1_ALPHA: */
+ case PIPE_BLENDFACTOR_ZERO:
+ return R300_BLEND_GL_ZERO;
+ case PIPE_BLENDFACTOR_INV_SRC_COLOR:
+ return R300_BLEND_GL_ONE_MINUS_SRC_COLOR;
+ case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
+ return R300_BLEND_GL_ONE_MINUS_SRC_ALPHA;
+ case PIPE_BLENDFACTOR_INV_DST_ALPHA:
+ return R300_BLEND_GL_ONE_MINUS_DST_ALPHA;
+ case PIPE_BLENDFACTOR_INV_DST_COLOR:
+ return R300_BLEND_GL_ONE_MINUS_DST_COLOR;
+ case PIPE_BLENDFACTOR_INV_CONST_COLOR:
+ return R300_BLEND_GL_ONE_MINUS_CONST_COLOR;
+ case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
+ return R300_BLEND_GL_ONE_MINUS_CONST_ALPHA;
+ /* XXX see above
+ case PIPE_BLENDFACTOR_INV_SRC1_COLOR:
+ case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: */
+ default:
+ debug_printf("r300: Unknown blend factor %d\n", blend_fact);
+ break;
+ }
+ return 0;
+}
+
+/* DSA state. */
+
+static INLINE uint32_t r300_translate_depth_stencil_function(int zs_func)
+{
+ switch (zs_func) {
+ case PIPE_FUNC_NEVER:
+ return R300_ZS_NEVER;
+ case PIPE_FUNC_LESS:
+ return R300_ZS_LESS;
+ case PIPE_FUNC_EQUAL:
+ return R300_ZS_EQUAL;
+ case PIPE_FUNC_LEQUAL:
+ return R300_ZS_LEQUAL;
+ case PIPE_FUNC_GREATER:
+ return R300_ZS_GREATER;
+ case PIPE_FUNC_NOTEQUAL:
+ return R300_ZS_NOTEQUAL;
+ case PIPE_FUNC_GEQUAL:
+ return R300_ZS_GEQUAL;
+ case PIPE_FUNC_ALWAYS:
+ return R300_ZS_ALWAYS;
+ default:
+ debug_printf("r300: Unknown depth/stencil function %d\n",
+ zs_func);
+ break;
+ }
+ return 0;
+}
+
+static INLINE uint32_t r300_translate_stencil_op(int s_op)
+{
+ switch (s_op) {
+ case PIPE_STENCIL_OP_KEEP:
+ return R300_ZS_KEEP;
+ case PIPE_STENCIL_OP_ZERO:
+ return R300_ZS_ZERO;
+ case PIPE_STENCIL_OP_REPLACE:
+ return R300_ZS_REPLACE;
+ case PIPE_STENCIL_OP_INCR:
+ return R300_ZS_INCR;
+ case PIPE_STENCIL_OP_DECR:
+ return R300_ZS_DECR;
+ case PIPE_STENCIL_OP_INCR_WRAP:
+ return R300_ZS_INCR_WRAP;
+ case PIPE_STENCIL_OP_DECR_WRAP:
+ return R300_ZS_DECR_WRAP;
+ case PIPE_STENCIL_OP_INVERT:
+ return R300_ZS_INVERT;
+ default:
+ debug_printf("r300: Unknown stencil op %d", s_op);
+ break;
+ }
+ return 0;
+}
+
+static INLINE uint32_t r300_translate_alpha_function(int alpha_func)
+{
+ switch (alpha_func) {
+ case PIPE_FUNC_NEVER:
+ return R300_FG_ALPHA_FUNC_NEVER;
+ case PIPE_FUNC_LESS:
+ return R300_FG_ALPHA_FUNC_LESS;
+ case PIPE_FUNC_EQUAL:
+ return R300_FG_ALPHA_FUNC_EQUAL;
+ case PIPE_FUNC_LEQUAL:
+ return R300_FG_ALPHA_FUNC_LE;
+ case PIPE_FUNC_GREATER:
+ return R300_FG_ALPHA_FUNC_GREATER;
+ case PIPE_FUNC_NOTEQUAL:
+ return R300_FG_ALPHA_FUNC_NOTEQUAL;
+ case PIPE_FUNC_GEQUAL:
+ return R300_FG_ALPHA_FUNC_GE;
+ case PIPE_FUNC_ALWAYS:
+ return R300_FG_ALPHA_FUNC_ALWAYS;
+ default:
+ debug_printf("r300: Unknown alpha function %d", alpha_func);
+ break;
+ }
+ return 0;
+}
+
+/* Texture sampler state. */
+
+static INLINE uint32_t r300_translate_wrap(int wrap)
+{
+ switch (wrap) {
+ case PIPE_TEX_WRAP_REPEAT:
+ return R300_TX_REPEAT;
+ case PIPE_TEX_WRAP_CLAMP:
+ return R300_TX_CLAMP;
+ case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+ return R300_TX_CLAMP_TO_EDGE;
+ case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
+ return R300_TX_CLAMP_TO_BORDER;
+ case PIPE_TEX_WRAP_MIRROR_REPEAT:
+ return R300_TX_REPEAT | R300_TX_MIRRORED;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP:
+ return R300_TX_CLAMP | R300_TX_MIRRORED;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
+ return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
+ return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
+ default:
+ debug_printf("r300: Unknown texture wrap %d", wrap);
+ return 0;
+ }
+}
+
+static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip)
+{
+ uint32_t retval = 0;
+ switch (min) {
+ case PIPE_TEX_FILTER_NEAREST:
+ retval |= R300_TX_MIN_FILTER_NEAREST;
+ case PIPE_TEX_FILTER_LINEAR:
+ retval |= R300_TX_MIN_FILTER_LINEAR;
+ case PIPE_TEX_FILTER_ANISO:
+ retval |= R300_TX_MIN_FILTER_ANISO;
+ default:
+ debug_printf("r300: Unknown texture filter %d", min);
+ break;
+ }
+ switch (mag) {
+ case PIPE_TEX_FILTER_NEAREST:
+ retval |= R300_TX_MAG_FILTER_NEAREST;
+ case PIPE_TEX_FILTER_LINEAR:
+ retval |= R300_TX_MAG_FILTER_LINEAR;
+ case PIPE_TEX_FILTER_ANISO:
+ retval |= R300_TX_MAG_FILTER_ANISO;
+ default:
+ debug_printf("r300: Unknown texture filter %d", mag);
+ break;
+ }
+ switch (mip) {
+ case PIPE_TEX_MIPFILTER_NONE:
+ retval |= R300_TX_MIN_FILTER_MIP_NONE;
+ case PIPE_TEX_MIPFILTER_NEAREST:
+ retval |= R300_TX_MIN_FILTER_MIP_NEAREST;
+ case PIPE_TEX_MIPFILTER_LINEAR:
+ retval |= R300_TX_MIN_FILTER_MIP_LINEAR;
+ default:
+ debug_printf("r300: Unknown texture filter %d", mip);
+ break;
+ }
+
+ return retval;
+}
+
+static INLINE uint32_t r300_anisotropy(float max_aniso)
+{
+ if (max_aniso >= 16.0f) {
+ return R300_TX_MAX_ANISO_16_TO_1;
+ } else if (max_aniso >= 8.0f) {
+ return R300_TX_MAX_ANISO_8_TO_1;
+ } else if (max_aniso >= 4.0f) {
+ return R300_TX_MAX_ANISO_4_TO_1;
+ } else if (max_aniso >= 2.0f) {
+ return R300_TX_MAX_ANISO_2_TO_1;
+ } else {
+ return R300_TX_MAX_ANISO_1_TO_1;
+ }
+}
+
+/* Buffer formats. */
+
static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
{
switch (format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- return R300_COLOR_FORMAT_ARGB8888;
- case PIPE_FORMAT_I8_UNORM:
- return R300_COLOR_FORMAT_I8;
- case PIPE_FORMAT_A1R5G5B5_UNORM:
- return R300_COLOR_FORMAT_ARGB1555;
- case PIPE_FORMAT_R5G6B5_UNORM:
- return R300_COLOR_FORMAT_RGB565;
- /* XXX Not in pipe_format
- case PIPE_FORMAT_A32R32G32B32:
- return R300_COLOR_FORMAT_ARGB32323232;
- case PIPE_FORMAT_A16R16G16B16:
- return R300_COLOR_FORMAT_ARGB16161616; */
- case PIPE_FORMAT_A4R4G4B4_UNORM:
- return R300_COLOR_FORMAT_ARGB4444;
- /* XXX Not in pipe_format
- case PIPE_FORMAT_A10R10G10B10_UNORM:
- return R500_COLOR_FORMAT_ARGB10101010;
- case PIPE_FORMAT_A2R10G10B10_UNORM:
- return R500_COLOR_FORMAT_ARGB2101010;
- case PIPE_FORMAT_I10_UNORM:
- return R500_COLOR_FORMAT_I10; */
- default:
- debug_printf("r300: Implementation error: " \
- "Got unsupported color format %s in %s\n",
- pf_name(format), __FUNCTION__);
- break;
+ /* 8-bit buffers */
+ case PIPE_FORMAT_I8_UNORM:
+ return R300_COLOR_FORMAT_I8;
+ /* 16-bit buffers */
+ case PIPE_FORMAT_R5G6B5_UNORM:
+ return R300_COLOR_FORMAT_RGB565;
+ case PIPE_FORMAT_A1R5G5B5_UNORM:
+ return R300_COLOR_FORMAT_ARGB1555;
+ case PIPE_FORMAT_A4R4G4B4_UNORM:
+ return R300_COLOR_FORMAT_ARGB4444;
+ /* 32-bit buffers */
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ return R300_COLOR_FORMAT_ARGB8888;
+ /* XXX Not in pipe_format
+ case PIPE_FORMAT_A32R32G32B32:
+ return R300_COLOR_FORMAT_ARGB32323232;
+ case PIPE_FORMAT_A16R16G16B16:
+ return R300_COLOR_FORMAT_ARGB16161616; */
+ /* XXX Not in pipe_format
+ case PIPE_FORMAT_A10R10G10B10_UNORM:
+ return R500_COLOR_FORMAT_ARGB10101010;
+ case PIPE_FORMAT_A2R10G10B10_UNORM:
+ return R500_COLOR_FORMAT_ARGB2101010;
+ case PIPE_FORMAT_I10_UNORM:
+ return R500_COLOR_FORMAT_I10; */
+ default:
+ debug_printf("r300: Implementation error: " \
+ "Got unsupported color format %s in %s\n",
+ pf_name(format), __FUNCTION__);
+ break;
}
-
return 0;
}
static INLINE uint32_t r300_translate_zsformat(enum pipe_format format)
{
switch (format) {
- case PIPE_FORMAT_Z16_UNORM:
- return R300_DEPTHFORMAT_16BIT_INT_Z;
- /* XXX R300_DEPTHFORMAT_16BIT_13E3 anyone? */
- case PIPE_FORMAT_Z24S8_UNORM:
- return R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL;
- default:
- debug_printf("r300: Implementation error: " \
- "Got unsupported ZS format %s in %s\n",
- pf_name(format), __FUNCTION__);
- break;
+ /* 16-bit depth, no stencil */
+ case PIPE_FORMAT_Z16_UNORM:
+ return R300_DEPTHFORMAT_16BIT_INT_Z;
+ /* 24-bit depth, 8-bit stencil */
+ case PIPE_FORMAT_Z24S8_UNORM:
+ return R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL;
+ default:
+ debug_printf("r300: Implementation error: " \
+ "Got unsupported ZS format %s in %s\n",
+ pf_name(format), __FUNCTION__);
+ break;
+ }
+ return 0;
+}
+
+/* Non-CSO state. (For now.) */
+
+static INLINE uint32_t r300_translate_gb_pipes(int pipe_count)
+{
+ switch (pipe_count) {
+ case 1:
+ return R300_GB_TILE_PIPE_COUNT_RV300;
+ break;
+ case 2:
+ return R300_GB_TILE_PIPE_COUNT_R300;
+ break;
+ case 3:
+ return R300_GB_TILE_PIPE_COUNT_R420_3P;
+ break;
+ case 4:
+ return R300_GB_TILE_PIPE_COUNT_R420;
+ break;
}
-
return 0;
}
diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c
new file mode 100644
index 0000000000..7fd7aefeb7
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_state_invariant.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2009 Joakim Sindholt <opensource@zhasha.com>
+ * Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "r300_state_invariant.h"
+
+/* Calculate and emit invariant state. This is data that the 3D engine
+ * will probably want at the beginning of every CS, but it's not currently
+ * handled by any CSO setup, and in addition it doesn't really change much.
+ *
+ * Note that eventually this should be empty, but it's useful for development
+ * and general unduplication of code. */
+void r300_emit_invariant_state(struct r300_context* r300)
+{
+ struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
+ CS_LOCALS(r300);
+
+ BEGIN_CS(14);
+ /* Amount of time to wait for vertex fetches in PVS */
+ OUT_CS_REG(VAP_PVS_VTX_TIMEOUT_REG, 0xffff);
+ /* Various GB enables */
+ OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE |
+ R300_GB_LINE_STUFF_ENABLE | R300_GB_TRIANGLE_STUFF_ENABLE);
+ /* Subpixel multisampling for AA */
+ OUT_CS_REG(R300_GB_MSPOS0, 0x66666666);
+ OUT_CS_REG(R300_GB_MSPOS1, 0x66666666);
+ /* GB tile config and pipe setup */
+ OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_DISABLE |
+ r300_translate_gb_pipes(caps->num_frag_pipes));
+ /* Source of fog depth */
+ OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W);
+ /* AA enable */
+ OUT_CS_REG(R300_GB_AA_CONFIG, 0x0);
+ END_CS;
+}
diff --git a/src/gallium/drivers/r300/r300_state_invariant.h b/src/gallium/drivers/r300/r300_state_invariant.h
new file mode 100644
index 0000000000..8204bf9588
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_state_invariant.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef R300_STATE_INVARIANT_H
+#define R300_STATE_INVARIANT_H
+
+#include "r300_context.h"
+#include "r300_cs.h"
+#include "r300_reg.h"
+#include "r300_state_inlines.h"
+
+void r300_emit_invariant_state(struct r300_context* r300);
+
+#endif /* R300_STATE_INVARIANT_H */
diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c
index 49e4a96f83..288d8dea15 100644
--- a/src/gallium/drivers/r300/r300_surface.c
+++ b/src/gallium/drivers/r300/r300_surface.c
@@ -33,9 +33,10 @@ static void r300_surface_fill(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
CS_LOCALS(r300);
- struct r300_capabilities* caps = ((struct r300_screen*)pipe->screen)->caps;
+ struct r300_capabilities* caps = r300_screen(pipe->screen)->caps;
struct r300_texture* tex = (struct r300_texture*)dest->texture;
int i;
+
float r, g, b, a;
unsigned pixpitch = tex->stride / tex->tex.block.size;
r = (float)((color >> 16) & 0xff) / 255.0f;
@@ -55,7 +56,14 @@ static void r300_surface_fill(struct pipe_context* pipe,
return;
}*/
- BEGIN_CS(163 + (caps->is_r500 ? 22 : 14) + (caps->has_tcl ? 4 : 2));
+ r300_emit_invariant_state(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(129 + (caps->is_r500 ? 22 : 14) + (caps->has_tcl ? 4 : 2));
/* Flush PVS. */
OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
@@ -69,7 +77,12 @@ static void r300_surface_fill(struct pipe_context* pipe,
OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, 0xFFFFFF);
OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, 0x0);
/* XXX endian */
- OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP);
+ if (caps->has_tcl) {
+ OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP);
+ } else {
+ OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP |
+ R300_VAP_TCL_BYPASS);
+ }
OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, 0x0);
/* XXX magic number not in r300_reg */
OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0xAAAAAAAA);
@@ -79,18 +92,6 @@ static void r300_surface_fill(struct pipe_context* pipe,
OUT_CS_32F(1.0);
OUT_CS_32F(1.0);
OUT_CS_32F(1.0);
- /* XXX is this too long? */
- OUT_CS_REG(VAP_PVS_VTX_TIMEOUT_REG, 0xFFFF);
- OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE |
- R300_GB_LINE_STUFF_ENABLE | R300_GB_TRIANGLE_STUFF_ENABLE);
- /* XXX more magic numbers */
- OUT_CS_REG(R300_GB_MSPOS0, 0x66666666);
- OUT_CS_REG(R300_GB_MSPOS1, 0x66666666);
- /* XXX why doesn't classic Mesa write the number of pipes, too? */
- OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_ENABLE |
- R300_GB_TILE_SIZE_16);
- OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W);
- OUT_CS_REG(R300_GB_AA_CONFIG, 0x0);
/* XXX point tex stuffing */
OUT_CS_REG_SEQ(R300_GA_POINT_S0, 1);
OUT_CS_32F(0.0);
@@ -102,9 +103,6 @@ static void r300_surface_fill(struct pipe_context* pipe,
OUT_CS_REG(R300_GA_POINT_MINMAX, 0x6 |
(0x1800 << R300_GA_POINT_MINMAX_MAX_SHIFT));
/* XXX this big chunk should be refactored into rs_state */
- OUT_CS_REG(R300_GA_LINE_CNTL, 0x00030006);
- OUT_CS_REG(R300_GA_LINE_STIPPLE_CONFIG, 0x3BAAAAAB);
- OUT_CS_REG(R300_GA_LINE_STIPPLE_VALUE, 0x00000000);
OUT_CS_REG(R300_GA_LINE_S0, 0x00000000);
OUT_CS_REG(R300_GA_LINE_S1, 0x3F800000);
OUT_CS_REG(R300_GA_ENHANCE, 0x00000002);
@@ -117,12 +115,6 @@ static void r300_surface_fill(struct pipe_context* pipe,
OUT_CS_REG(R300_GA_FOG_SCALE, 0x3DBF1412);
OUT_CS_REG(R300_GA_FOG_OFFSET, 0x00000000);
OUT_CS_REG(R300_SU_TEX_WRAP, 0x00000000);
- OUT_CS_REG(R300_SU_POLY_OFFSET_FRONT_SCALE, 0x00000000);
- OUT_CS_REG(R300_SU_POLY_OFFSET_FRONT_OFFSET, 0x00000000);
- OUT_CS_REG(R300_SU_POLY_OFFSET_BACK_SCALE, 0x00000000);
- OUT_CS_REG(R300_SU_POLY_OFFSET_BACK_OFFSET, 0x00000000);
- OUT_CS_REG(R300_SU_POLY_OFFSET_ENABLE, 0x00000000);
- OUT_CS_REG(R300_SU_CULL_MODE, 0x00000000);
OUT_CS_REG(R300_SU_DEPTH_SCALE, 0x4B7FFFFF);
OUT_CS_REG(R300_SU_DEPTH_OFFSET, 0x00000000);
OUT_CS_REG(R300_SC_HYPERZ, 0x0000001C);
@@ -190,11 +182,6 @@ static void r300_surface_fill(struct pipe_context* pipe,
R300_PS_UCP_MODE_CLIP_AS_TRIFAN);
}
- /* 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));
-
/* XXX */
OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa);
@@ -240,7 +227,7 @@ static void r300_surface_fill(struct pipe_context* pipe,
r300_emit_fragment_shader(r300, &r300_passthrough_fragment_shader);
}
- BEGIN_CS(8 + (caps->has_tcl ? 20 : 2));
+ BEGIN_CS(7 + (caps->has_tcl ? 21 : 2));
OUT_CS_REG_SEQ(R300_US_OUT_FMT_0, 4);
OUT_CS(R300_C0_SEL_B | R300_C1_SEL_G | R300_C2_SEL_R | R300_C3_SEL_A);
OUT_CS(R300_US_OUT_FMT_UNUSED);
@@ -277,9 +264,10 @@ static void r300_surface_fill(struct pipe_context* pipe,
}
END_CS;
- r300_emit_blend_state(r300, &blend_clear_state);
- r300_emit_blend_color_state(r300, &blend_color_clear_state);
- r300_emit_dsa_state(r300, &dsa_clear_state);
+ /* 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));
BEGIN_CS(24);
/* Flush colorbuffer and blend caches. */
diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h
index 442eac2cf2..807aad39e4 100644
--- a/src/gallium/drivers/r300/r300_surface.h
+++ b/src/gallium/drivers/r300/r300_surface.h
@@ -57,4 +57,16 @@ const struct r300_dsa_state dsa_clear_state = {
.stencil_ref_bf = 0x0,
};
+const struct r300_rs_state rs_clear_state = {
+ .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,
+};
+
#endif /* R300_SURFACE_H */
diff --git a/src/gallium/drivers/r300/r300_swtcl_emit.c b/src/gallium/drivers/r300/r300_swtcl_emit.c
index 5b028aaf7b..f9baaade1e 100644
--- a/src/gallium/drivers/r300/r300_swtcl_emit.c
+++ b/src/gallium/drivers/r300/r300_swtcl_emit.c
@@ -27,6 +27,7 @@
#include "r300_cs.h"
#include "r300_context.h"
#include "r300_reg.h"
+#include "r300_state_derived.h"
/* r300_swtcl_emit: Vertex and index buffer primitive emission. No HW TCL. */
@@ -91,9 +92,9 @@ static boolean r300_swtcl_render_allocate_vertices(struct vbuf_render* render,
r300render->vertex_size = vertex_size;
if (r300render->vbo) {
- return true;
+ return TRUE;
} else {
- return false;
+ return FALSE;
}
}
@@ -167,11 +168,11 @@ static boolean r300_swtcl_render_set_primitive(struct vbuf_render* render,
r300render->hwprim = R300_VAP_VF_CNTL__PRIM_POLYGON;
break;
default:
- return false;
+ return FALSE;
break;
}
- return true;
+ return TRUE;
}
static void prepare_render(struct r300_swtcl_render* render)
@@ -191,12 +192,15 @@ static void prepare_render(struct r300_swtcl_render* render)
* PACKET3 [3D_LOAD_VBPNTR]
* COUNT [1]
* FORMAT [size | stride << 8]
+ * OFFSET [0]
* VBPNTR [relocated BO]
*/
BEGIN_CS(5);
OUT_CS(CP_PACKET3(R300_PACKET3_3D_LOAD_VBPNTR, 3));
OUT_CS(1);
- OUT_CS(r300->vertex_info.vinfo.size | (r300->vertex_info.vinfo.size << 8));
+ OUT_CS(r300->vertex_info.vinfo.size |
+ (r300->vertex_info.vinfo.size << 8));
+ OUT_CS(render->vbo_offset);
OUT_CS_RELOC(render->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
END_CS;
}
@@ -218,7 +222,7 @@ static void r300_swtcl_render_draw_arrays(struct vbuf_render* render,
BEGIN_CS(2);
OUT_CS(CP_PACKET3(R300_PACKET3_3D_DRAW_VBUF_2, 0));
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) |
- r300render->hwprim | R300_VAP_VF_CNTL__INDEX_SIZE_32bit);
+ r300render->hwprim);
END_CS;
}
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index edd4370663..8251a597ea 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -31,8 +31,9 @@ static void r300_setup_miptree(struct r300_texture* tex)
{
struct pipe_texture* base = &tex->tex;
int stride, size, offset;
+ int i;
- for (int i = 0; i <= base->last_level; i++) {
+ for (i = 0; i <= base->last_level; i++) {
if (i > 0) {
base->width[i] = minify(base->width[i-1]);
base->height[i] = minify(base->height[i-1]);
diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
index d56eed80a4..eef6e5806c 100644
--- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c
+++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
@@ -60,6 +60,7 @@ struct softpipe_vbuf_render
struct softpipe_context *softpipe;
uint prim;
uint vertex_size;
+ uint nr_vertices;
uint vertex_buffer_size;
void *vertex_buffer;
};
@@ -95,12 +96,44 @@ sp_vbuf_allocate_vertices(struct vbuf_render *vbr,
}
cvbr->vertex_size = vertex_size;
+ cvbr->nr_vertices = nr_vertices;
+
return cvbr->vertex_buffer != NULL;
}
static void
sp_vbuf_release_vertices(struct vbuf_render *vbr)
{
+#if 0
+ {
+ struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr);
+ const struct vertex_info *info =
+ softpipe_get_vbuf_vertex_info(cvbr->softpipe);
+ const float *vtx = (const float *) cvbr->vertex_buffer;
+ uint i, j;
+ debug_printf("%s (vtx_size = %u, vtx_used = %u)\n",
+ __FUNCTION__, cvbr->vertex_size, cvbr->nr_vertices);
+ for (i = 0; i < cvbr->nr_vertices; i++) {
+ for (j = 0; j < info->num_attribs; j++) {
+ uint k;
+ switch (info->attrib[j].emit) {
+ case EMIT_4F: k = 4; break;
+ case EMIT_3F: k = 3; break;
+ case EMIT_2F: k = 2; break;
+ case EMIT_1F: k = 1; break;
+ default: assert(0);
+ }
+ debug_printf("Vert %u attr %u: ", i, j);
+ while (k-- > 0) {
+ debug_printf("%g ", vtx[0]);
+ vtx++;
+ }
+ debug_printf("\n");
+ }
+ }
+ }
+#endif
+
/* keep the old allocation for next time */
}
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 28a9784b16..142ce230fc 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -243,9 +243,11 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
ps->level = level;
ps->zslice = zslice;
- if (pt->target == PIPE_TEXTURE_CUBE || pt->target == PIPE_TEXTURE_3D) {
- ps->offset += ((pt->target == PIPE_TEXTURE_CUBE) ? face : zslice) *
- pt->nblocksy[level] * spt->stride[level];
+ if (pt->target == PIPE_TEXTURE_CUBE) {
+ ps->offset += face * pt->nblocksy[level] * spt->stride[level];
+ }
+ else if (pt->target == PIPE_TEXTURE_3D) {
+ ps->offset += zslice * pt->nblocksy[level] * spt->stride[level];
}
else {
assert(face == 0);
@@ -283,14 +285,13 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
{
struct softpipe_texture *sptex = softpipe_texture(texture);
struct softpipe_transfer *spt;
- struct pipe_transfer *pt;
assert(texture);
assert(level <= texture->last_level);
spt = CALLOC_STRUCT(softpipe_transfer);
- pt = &spt->base;
if (spt) {
+ struct pipe_transfer *pt = &spt->base;
pt->refcount = 1;
pipe_texture_reference(&pt->texture, texture);
pt->format = texture->format;
@@ -302,23 +303,26 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
pt->nblocksx = texture->nblocksx[level];
pt->nblocksy = texture->nblocksy[level];
pt->stride = sptex->stride[level];
- spt->offset = sptex->level_offset[level];
pt->usage = usage;
pt->face = face;
pt->level = level;
pt->zslice = zslice;
- if (texture->target == PIPE_TEXTURE_CUBE ||
- texture->target == PIPE_TEXTURE_3D) {
- spt->offset += ((texture->target == PIPE_TEXTURE_CUBE) ? face :
- zslice) * pt->nblocksy * pt->stride;
+ spt->offset = sptex->level_offset[level];
+
+ if (texture->target == PIPE_TEXTURE_CUBE) {
+ spt->offset += face * pt->nblocksy * pt->stride;
+ }
+ else if (texture->target == PIPE_TEXTURE_3D) {
+ spt->offset += zslice * pt->nblocksy * pt->stride;
}
else {
assert(face == 0);
assert(zslice == 0);
}
+ return pt;
}
- return pt;
+ return NULL;
}
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index d98cef221b..8757ac8bec 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -40,7 +40,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
#include <stdlib.h>
#endif
@@ -236,7 +236,7 @@ boolean trace_dump_trace_begin()
trace_dump_writes("<?xml-stylesheet type='text/xsl' href='trace.xsl'?>\n");
trace_dump_writes("<trace version='0.1'>\n");
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
/* Linux applications rarely cleanup GL / Gallium resources so catch
* application exit here */
atexit(trace_dump_trace_close);
diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h
index 05cbd2fc4d..7f7657031d 100644
--- a/src/gallium/include/pipe/p_config.h
+++ b/src/gallium/include/pipe/p_config.h
@@ -111,6 +111,10 @@
#define PIPE_OS_LINUX
#endif
+#if defined(__FreeBSD__)
+#define PIPE_OS_BSD
+#endif
+
#if defined(_WIN32) || defined(WIN32)
#define PIPE_OS_WINDOWS
#endif
@@ -122,9 +126,9 @@
* NOTE: There is no way to auto-detect most of these.
*/
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
#define PIPE_SUBSYSTEM_DRI
-#endif /* PIPE_OS_LINUX */
+#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */
#if defined(PIPE_OS_WINDOWS)
#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h
index 8af3cd958b..e59b999b9a 100644
--- a/src/gallium/include/pipe/p_thread.h
+++ b/src/gallium/include/pipe/p_thread.h
@@ -38,7 +38,7 @@
#include "pipe/p_compiler.h"
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
#include <pthread.h> /* POSIX threads headers */
#include <stdio.h> /* for perror() */
@@ -210,7 +210,7 @@ typedef unsigned pipe_condvar;
*/
typedef struct {
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
pthread_key_t key;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
DWORD key;
@@ -225,7 +225,7 @@ typedef struct {
static INLINE void
pipe_tsd_init(pipe_tsd *tsd)
{
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
perror("pthread_key_create(): failed to allocate key for thread specific data");
exit(-1);
@@ -242,7 +242,7 @@ pipe_tsd_get(pipe_tsd *tsd)
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
pipe_tsd_init(tsd);
}
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
return pthread_getspecific(tsd->key);
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
assert(0);
@@ -259,7 +259,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value)
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
pipe_tsd_init(tsd);
}
-#if defined(PIPE_OS_LINUX)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
if (pthread_setspecific(tsd->key, value) != 0) {
perror("pthread_set_specific() failed");
exit(-1);
diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h
index 54480fa047..91a727be66 100644
--- a/src/gallium/include/state_tracker/drm_api.h
+++ b/src/gallium/include/state_tracker/drm_api.h
@@ -2,14 +2,18 @@
#ifndef _DRM_API_H_
#define _DRM_API_H_
+#include "pipe/p_compiler.h"
+
struct pipe_screen;
struct pipe_winsys;
+struct pipe_buffer;
struct pipe_context;
+struct pipe_texture;
struct drm_api
{
/**
- * Special buffer function
+ * Special buffer functions
*/
/*@{*/
struct pipe_screen* (*create_screen)(int drmFB, int pciID);
@@ -17,11 +21,21 @@ struct drm_api
/*@}*/
/**
- * Special buffer function
+ * Special buffer functions
*/
/*@{*/
- struct pipe_buffer* (*buffer_from_handle)(struct pipe_winsys *winsys, const char *name, unsigned handle);
- unsigned (*handle_from_buffer)(struct pipe_winsys *winsys, struct pipe_buffer *buffer);
+ boolean (*buffer_from_texture)(struct pipe_texture *texture,
+ struct pipe_buffer **buffer,
+ unsigned *stride);
+ struct pipe_buffer* (*buffer_from_handle)(struct pipe_screen *screen,
+ const char *name,
+ unsigned handle);
+ boolean (*handle_from_buffer)(struct pipe_screen *screen,
+ struct pipe_buffer *buffer,
+ unsigned *handle);
+ boolean (*global_handle_from_buffer)(struct pipe_screen *screen,
+ struct pipe_buffer *buffer,
+ unsigned *handle);
/*@}*/
};
diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile
index ea4cec0bb8..692a3c8b76 100644
--- a/src/gallium/state_trackers/egl/Makefile
+++ b/src/gallium/state_trackers/egl/Makefile
@@ -6,14 +6,15 @@ TOP = ../../../..
include ${TOP}/configs/current
-CFLAGS += -g -Wall -Werror-implicit-function-declaration -fPIC \
+CFLAGS := \
-I${GALLIUMDIR}/include \
-I${GALLIUMDIR}/auxiliary \
-I${TOP}/src/mesa/drivers/dri/common \
-I${TOP}/src/mesa \
-I$(TOP)/include \
-I$(TOP)/src/egl/main \
- ${LIBDRM_CFLAGS}
+ ${LIBDRM_CFLAGS} \
+ ${CFLAGS}
#############################################
diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c
index 281dff9f8a..aa3c32d41c 100644
--- a/src/gallium/state_trackers/egl/egl_surface.c
+++ b/src/gallium/state_trackers/egl/egl_surface.c
@@ -132,7 +132,7 @@ drm_create_texture(_EGLDriver *drv,
scrn->front.width = w;
scrn->front.height = h;
scrn->front.pitch = pitch;
- scrn->front.handle = drm_api_hocks.handle_from_buffer(dev->winsys, scrn->buffer);
+ drm_api_hocks.handle_from_buffer(dev->winsys, scrn->buffer, &scrn->front.handle);
if (0)
goto err_handle;
diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c
index 8ae6aa1f3e..faf7f2f410 100644
--- a/src/gallium/state_trackers/wgl/icd/stw_icd.c
+++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c
@@ -36,6 +36,7 @@
#include "shared/stw_public.h"
#include "icd/stw_icd.h"
+#define DBG 0
static GLCLTPROCTABLE cpt;
static boolean cpt_initialized = FALSE;
@@ -81,7 +82,8 @@ DrvDescribeLayerPlane(
UINT nBytes,
LPLAYERPLANEDESCRIPTOR plpd )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return FALSE;
}
@@ -97,8 +99,9 @@ DrvDescribePixelFormat(
r = stw_pixelformat_describe( hdc, iPixelFormat, cjpfd, ppfd );
- debug_printf( "%s( %p, %d, %u, %p ) = %d\n",
- __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
+ if (DBG)
+ debug_printf( "%s( %p, %d, %u, %p ) = %d\n",
+ __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
return r;
}
@@ -111,7 +114,8 @@ DrvGetLayerPaletteEntries(
INT cEntries,
COLORREF *pcr )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return 0;
}
@@ -124,7 +128,8 @@ DrvGetProcAddress(
r = stw_get_proc_address( lpszProc );
- debug_printf( "%s( \", __FUNCTION__%s\" ) = %p\n", lpszProc, r );
+ if (DBG)
+ debug_printf( "%s( \", __FUNCTION__%s\" ) = %p\n", lpszProc, r );
return r;
}
@@ -135,7 +140,8 @@ DrvRealizeLayerPalette(
INT iLayerPlane,
BOOL bRealize )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return FALSE;
}
@@ -152,7 +158,8 @@ DrvSetCallbackProcs(
INT nProcs,
PROC *pProcs )
{
- debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs );
+ if (DBG)
+ debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs );
return;
}
@@ -510,8 +517,9 @@ DrvSetContext(
DHGLRC dhglrc,
PFN_SETPROCTABLE pfnSetProcTable )
{
- debug_printf( "%s( 0x%p, %u, 0x%p )\n",
- __FUNCTION__, hdc, dhglrc, pfnSetProcTable );
+ if (DBG)
+ debug_printf( "%s( 0x%p, %u, 0x%p )\n",
+ __FUNCTION__, hdc, dhglrc, pfnSetProcTable );
/* Although WGL allows different dispatch entrypoints per
*/
@@ -534,7 +542,8 @@ DrvSetLayerPaletteEntries(
INT cEntries,
CONST COLORREF *pcr )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return 0;
}
@@ -548,7 +557,8 @@ DrvSetPixelFormat(
r = stw_pixelformat_set( hdc, iPixelFormat );
- debug_printf( "%s( %p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" );
+ if (DBG)
+ debug_printf( "%s( %p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" );
return r;
}
@@ -558,7 +568,8 @@ DrvShareLists(
DHGLRC dhglrc1,
DHGLRC dhglrc2 )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return FALSE;
}
@@ -567,7 +578,8 @@ BOOL APIENTRY
DrvSwapBuffers(
HDC hdc )
{
- debug_printf( "%s( %p )\n", __FUNCTION__, hdc );
+ if (DBG)
+ debug_printf( "%s( %p )\n", __FUNCTION__, hdc );
return stw_swap_buffers( hdc );
}
@@ -577,7 +589,8 @@ DrvSwapLayerBuffers(
HDC hdc,
UINT fuPlanes )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return FALSE;
}
@@ -586,7 +599,8 @@ BOOL APIENTRY
DrvValidateVersion(
ULONG ulVersion )
{
- debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion );
+ if (DBG)
+ debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion );
/* TODO: get the expected version from the winsys */
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.c b/src/gallium/winsys/drm/intel/gem/intel_be_api.c
index 6cffed5134..3f71c25441 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_api.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.c
@@ -1,12 +1,15 @@
#include "intel_be_api.h"
+#include "i915simple/i915_winsys.h"
struct drm_api drm_api_hocks =
{
/* intel_be_context.c */
.create_context = intel_be_create_context,
- /* intel_be_screen.c */
+ /* intel_be_device.c */
.create_screen = intel_be_create_screen,
+ .buffer_from_texture = i915_get_texture_buffer,
.buffer_from_handle = intel_be_buffer_from_handle,
.handle_from_buffer = intel_be_handle_from_buffer,
+ .global_handle_from_buffer = intel_be_global_handle_from_buffer,
};
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
index a2163a1e6d..595de44726 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
@@ -9,7 +9,7 @@
#include "intel_be_fence.h"
-#include "i915simple/i915_screen.h"
+#include "i915simple/i915_winsys.h"
#include "intel_be_api.h"
@@ -70,6 +70,8 @@ intel_be_buffer_create(struct pipe_winsys *winsys,
buffer->base.alignment = alignment;
buffer->base.usage = usage;
buffer->base.size = size;
+ buffer->flinked = FALSE;
+ buffer->flink = 0;
if (usage & (PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_CONSTANT)) {
/* Local buffer */
@@ -133,10 +135,10 @@ err:
}
struct pipe_buffer *
-intel_be_buffer_from_handle(struct pipe_winsys *winsys,
+intel_be_buffer_from_handle(struct pipe_screen *screen,
const char* name, unsigned handle)
{
- struct intel_be_device *dev = intel_be_device(winsys);
+ struct intel_be_device *dev = intel_be_device(screen->winsys);
struct intel_be_buffer *buffer = CALLOC_STRUCT(intel_be_buffer);
if (!buffer)
@@ -162,14 +164,39 @@ err:
return NULL;
}
-unsigned
-intel_be_handle_from_buffer(struct pipe_winsys *winsys,
- struct pipe_buffer *buf)
+boolean
+intel_be_handle_from_buffer(struct pipe_screen *screen,
+ struct pipe_buffer *buffer,
+ unsigned *handle)
{
- drm_intel_bo *bo = intel_bo(buf);
- return bo->handle;
+ drm_intel_bo *bo;
+
+ if (!buffer)
+ return FALSE;
+
+ *handle = intel_bo(buffer)->handle;
+ return TRUE;
}
+boolean
+intel_be_global_handle_from_buffer(struct pipe_screen *screen,
+ struct pipe_buffer *buffer,
+ unsigned *handle)
+{
+ struct intel_be_buffer *buf = intel_be_buffer(buffer);
+
+ if (!buffer)
+ return FALSE;
+
+ if (!buf->flinked) {
+ if (drm_intel_bo_flink(intel_bo(buffer), &buf->flink))
+ return FALSE;
+ buf->flinked = TRUE;
+ }
+
+ *handle = buf->flink;
+ return TRUE;
+}
/*
* Fence
*/
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.h b/src/gallium/winsys/drm/intel/gem/intel_be_device.h
index c4837e65fa..47d2176cb4 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.h
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.h
@@ -44,6 +44,8 @@ intel_be_init_device(struct intel_be_device *device, int fd, unsigned id);
struct intel_be_buffer {
struct pipe_buffer base;
drm_intel_bo *bo;
+ boolean flinked;
+ unsigned flink;
};
/**
@@ -52,7 +54,7 @@ struct intel_be_buffer {
* Takes a reference.
*/
struct pipe_buffer *
-intel_be_buffer_from_handle(struct pipe_winsys *winsys,
+intel_be_buffer_from_handle(struct pipe_screen *screen,
const char* name, unsigned handle);
/**
@@ -60,9 +62,20 @@ intel_be_buffer_from_handle(struct pipe_winsys *winsys,
*
* If buffer is destroyed handle may become invalid.
*/
-unsigned
-intel_be_handle_from_buffer(struct pipe_winsys *winsys,
- struct pipe_buffer *buffer);
+boolean
+intel_be_handle_from_buffer(struct pipe_screen *screen,
+ struct pipe_buffer *buffer,
+ unsigned *handle);
+
+/**
+ * Gets the global handle from a buffer.
+ *
+ * If buffer is destroyed handle may become invalid.
+ */
+boolean
+intel_be_global_handle_from_buffer(struct pipe_screen *screen,
+ struct pipe_buffer *buffer,
+ unsigned *handle);
static INLINE struct intel_be_buffer *
intel_be_buffer(struct pipe_buffer *buf)
diff --git a/src/gallium/winsys/drm/radeon/Makefile b/src/gallium/winsys/drm/radeon/Makefile
index dca1e3233a..784686ffb6 100644
--- a/src/gallium/winsys/drm/radeon/Makefile
+++ b/src/gallium/winsys/drm/radeon/Makefile
@@ -13,6 +13,7 @@ PIPE_DRIVERS = \
DRIVER_SOURCES = \
radeon_buffer.c \
radeon_context.c \
+ radeon_drm.c \
radeon_r300.c \
radeon_screen.c \
radeon_winsys_softpipe.c
diff --git a/src/gallium/winsys/drm/radeon/radeon_drm.c b/src/gallium/winsys/drm/radeon/radeon_drm.c
new file mode 100644
index 0000000000..839b0bf0bd
--- /dev/null
+++ b/src/gallium/winsys/drm/radeon/radeon_drm.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2009 Corbin Simpson
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
+ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+/*
+ * Authors:
+ * Corbin Simpson <MostAwesomeDude@gmail.com>
+ */
+#include "radeon_drm.h"
diff --git a/src/gallium/winsys/drm/radeon/radeon_drm.h b/src/gallium/winsys/drm/radeon/radeon_drm.h
new file mode 100644
index 0000000000..8ccbc81895
--- /dev/null
+++ b/src/gallium/winsys/drm/radeon/radeon_drm.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2009 Corbin Simpson
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
+ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+/*
+ * Authors:
+ * Corbin Simpson <MostAwesomeDude@gmail.com>
+ */
+#ifndef RADEON_DRM_H
+#define RADEON_DRM_H
+
+#include "state_tracker/drm_api.h"
+
+#endif
diff --git a/src/gallium/winsys/g3dvl/xsp_winsys.c b/src/gallium/winsys/g3dvl/xsp_winsys.c
index 40d683234f..acfb8ec4ea 100644
--- a/src/gallium/winsys/g3dvl/xsp_winsys.c
+++ b/src/gallium/winsys/g3dvl/xsp_winsys.c
@@ -1,9 +1,10 @@
#include "vl_winsys.h"
#include <X11/Xutil.h>
-#include <pipe/p_winsys.h>
+#include <pipe/internal/p_winsys_screen.h>
#include <pipe/p_state.h>
#include <pipe/p_inlines.h>
#include <util/u_memory.h>
+#include <util/u_math.h>
#include <softpipe/sp_winsys.h>
/* pipe_winsys implementation */
@@ -96,12 +97,6 @@ static void xsp_buffer_destroy(struct pipe_winsys *pws, struct pipe_buffer *buff
free(xsp_buf);
}
-/* Borrowed from Mesa's xm_winsys */
-static unsigned int round_up(unsigned n, unsigned multiple)
-{
- return (n + multiple - 1) & ~(multiple - 1);
-}
-
static struct pipe_buffer* xsp_surface_buffer_create
(
struct pipe_winsys *pws,
@@ -119,11 +114,11 @@ static struct pipe_buffer* xsp_surface_buffer_create
pf_get_block(format, &block);
nblocksx = pf_get_nblocksx(&block, width);
nblocksy = pf_get_nblocksy(&block, height);
- *stride = round_up(nblocksx * block.size, ALIGNMENT);
+ *stride = align(nblocksx * block.size, ALIGNMENT);
- return winsys->buffer_create(winsys, ALIGNMENT,
- usage,
- *stride * nblocksy);
+ return pws->buffer_create(pws, ALIGNMENT,
+ usage,
+ *stride * nblocksy);
}
static void xsp_fence_reference(struct pipe_winsys *pws, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence)
diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c
index c87564f4dc..40bcdfe42a 100644
--- a/src/gallium/winsys/xlib/xlib_cell.c
+++ b/src/gallium/winsys/xlib/xlib_cell.c
@@ -222,7 +222,8 @@ xm_flush_frontbuffer(struct pipe_winsys *pws,
* This function copies that XImage to the actual X Window.
*/
XMesaContext xmctx = (XMesaContext) context_private;
- xlib_cell_display_surface(xmctx->xm_buffer, surf);
+ if (xmctx)
+ xlib_cell_display_surface(xmctx->xm_buffer, surf);
}
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index be6edf9b19..b296b7c651 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -56,19 +56,6 @@
void __glXDumpDrawBuffer(__GLXcontext * ctx);
#endif
-#ifdef USE_SPARC_ASM
-static void _glx_mesa_init_sparc_glapi_relocs(void);
-static int _mesa_sparc_needs_init = 1;
-#define INIT_MESA_SPARC do { \
- if (_mesa_sparc_needs_init) { \
- _glx_mesa_init_sparc_glapi_relocs(); \
- _mesa_sparc_needs_init = 0; \
- } \
- } while(0)
-#else
-#define INIT_MESA_SPARC do { } while(0)
-#endif
-
/*
** You can set this cell to 1 to force the gl drawing stuff to be
** one command per packet
@@ -670,7 +657,6 @@ __glXInitialize(Display * dpy)
}
#endif
- INIT_MESA_SPARC;
/* The one and only long long lock */
__glXLock();
@@ -785,7 +771,6 @@ __glXSetupForCommand(Display * dpy)
if (gc->currentDpy == dpy) {
/* Use opcode from gc because its right */
- INIT_MESA_SPARC;
return gc->majorOpcode;
}
else {
@@ -979,74 +964,3 @@ __glXDumpDrawBuffer(__GLXcontext * ctx)
}
}
#endif
-
-#ifdef USE_SPARC_ASM
-/*
- * This is where our dispatch table's bounds are.
- * And the static mesa_init is taken directly from
- * Mesa's 'sparc.c' initializer.
- *
- * We need something like this here, because this version
- * of openGL/glx never initializes a Mesa context, and so
- * the address of the dispatch table pointer never gets stuffed
- * into the dispatch jump table otherwise.
- *
- * It matters only on SPARC, and only if you are using assembler
- * code instead of C-code indirect dispatch.
- *
- * -- FEM, 04.xii.03
- */
-extern unsigned int _mesa_sparc_glapi_begin;
-extern unsigned int _mesa_sparc_glapi_end;
-extern void __glapi_sparc_icache_flush(unsigned int *);
-
-static void
-_glx_mesa_init_sparc_glapi_relocs(void)
-{
- unsigned int *insn_ptr, *end_ptr;
- unsigned long disp_addr;
-
- insn_ptr = &_mesa_sparc_glapi_begin;
- end_ptr = &_mesa_sparc_glapi_end;
- disp_addr = (unsigned long) &_glapi_Dispatch;
-
- /*
- * Verbatim from Mesa sparc.c. It's needed because there doesn't
- * seem to be a better way to do this:
- *
- * UNCONDITIONAL_JUMP ( (*_glapi_Dispatch) + entry_offset )
- *
- * This code is patching in the ADDRESS of the pointer to the
- * dispatch table. Hence, it must be called exactly once, because
- * that address is not going to change.
- *
- * What it points to can change, but Mesa (and hence, we) assume
- * that there is only one pointer.
- *
- */
- while (insn_ptr < end_ptr) {
-#if ( defined(__sparc_v9__) && ( !defined(__linux__) || defined(__linux_64__) ) )
-/*
- This code patches for 64-bit addresses. This had better
- not happen for Sparc/Linux, no matter what architecture we
- are building for. So, don't do this.
-
- The 'defined(__linux_64__)' is used here as a placeholder for
- when we do do 64-bit usermode on sparc linux.
- */
- insn_ptr[0] |= (disp_addr >> (32 + 10));
- insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10);
- __glapi_sparc_icache_flush(&insn_ptr[0]);
- insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1));
- insn_ptr[3] |= (disp_addr & ((1 << 10) - 1));
- __glapi_sparc_icache_flush(&insn_ptr[2]);
- insn_ptr += 11;
-#else
- insn_ptr[0] |= (disp_addr >> 10);
- insn_ptr[1] |= (disp_addr & ((1 << 10) - 1));
- __glapi_sparc_icache_flush(&insn_ptr[0]);
- insn_ptr += 5;
-#endif
- }
-}
-#endif /* sparc ASM in use */
diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
index f091d600c3..52f09a4b1b 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -180,9 +180,9 @@ get_result_vector(struct i915_fragment_program *p,
switch (inst->DstReg.File) {
case PROGRAM_OUTPUT:
switch (inst->DstReg.Index) {
- case FRAG_RESULT_COLR:
+ case FRAG_RESULT_COLOR:
return UREG(REG_TYPE_OC, 0);
- case FRAG_RESULT_DEPR:
+ case FRAG_RESULT_DEPTH:
p->depth_written = 1;
return UREG(REG_TYPE_OD, 0);
default:
diff --git a/src/mesa/drivers/dri/i965/brw_clip_line.c b/src/mesa/drivers/dri/i965/brw_clip_line.c
index c45d48dff8..d830e49e50 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_line.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_line.c
@@ -181,34 +181,54 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
brw_DP4(p, vec4(c->reg.dp1), deref_4f(vtx1, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation);
is_negative = brw_IF(p, BRW_EXECUTE_1);
{
- brw_ADD(p, c->reg.t, c->reg.dp1, negate(c->reg.dp0));
- brw_math_invert(p, c->reg.t, c->reg.t);
- brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp1);
-
- brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t1 );
- brw_MOV(p, c->reg.t1, c->reg.t);
- brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ /*
+ * Both can be negative on GM965/G965 due to RHW workaround
+ * if so, this object should be rejected.
+ */
+ if (!BRW_IS_G4X(p->brw)) {
+ brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_LE, c->reg.dp0, brw_imm_f(0.0));
+ is_neg2 = brw_IF(p, BRW_EXECUTE_1);
+ {
+ brw_clip_kill_thread(c);
+ }
+ brw_ENDIF(p, is_neg2);
+ }
+
+ brw_ADD(p, c->reg.t, c->reg.dp1, negate(c->reg.dp0));
+ brw_math_invert(p, c->reg.t, c->reg.t);
+ brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp1);
+
+ brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t1 );
+ brw_MOV(p, c->reg.t1, c->reg.t);
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
}
is_negative = brw_ELSE(p, is_negative);
{
- /* Coming back in. We know that both cannot be negative
- * because the line would have been culled in that case.
- */
+ /* Coming back in. We know that both cannot be negative
+ * because the line would have been culled in that case.
+ */
+
+ /* If both are positive, do nothing */
+ /* Only on GM965/G965 */
+ if (!BRW_IS_G4X(p->brw)) {
+ brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.dp0, brw_imm_f(0.0));
+ is_neg2 = brw_IF(p, BRW_EXECUTE_1);
+ }
- /* If both are positive, do nothing */
- brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.dp0, brw_imm_f(0.0));
- is_neg2 = brw_IF(p, BRW_EXECUTE_1);
{
- brw_ADD(p, c->reg.t, c->reg.dp0, negate(c->reg.dp1));
- brw_math_invert(p, c->reg.t, c->reg.t);
- brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp0);
-
- brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t0 );
- brw_MOV(p, c->reg.t0, c->reg.t);
- brw_set_predicate_control(p, BRW_PREDICATE_NONE);
- }
- brw_ENDIF(p, is_neg2);
- }
+ brw_ADD(p, c->reg.t, c->reg.dp0, negate(c->reg.dp1));
+ brw_math_invert(p, c->reg.t, c->reg.t);
+ brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp0);
+
+ brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t0 );
+ brw_MOV(p, c->reg.t0, c->reg.t);
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ }
+
+ if (!BRW_IS_G4X(p->brw)) {
+ brw_ENDIF(p, is_neg2);
+ }
+ }
brw_ENDIF(p, is_negative);
}
brw_ENDIF(p, plane_active);
diff --git a/src/mesa/drivers/dri/i965/brw_clip_tri.c b/src/mesa/drivers/dri/i965/brw_clip_tri.c
index 1dbba37fe7..7fd37bd05f 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_tri.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_tri.c
@@ -455,6 +455,8 @@ static void brw_clip_test( struct brw_clip_compile *c )
struct brw_indirect vt2 = brw_indirect(2, 0);
struct brw_compile *p = &c->func;
+ struct brw_instruction *is_outside;
+ struct brw_reg tmp0 = c->reg.loopcount; /* handy temporary */
brw_MOV(p, get_addr_reg(vt0), brw_address(c->reg.vertex[0]));
brw_MOV(p, get_addr_reg(vt1), brw_address(c->reg.vertex[1]));
@@ -462,53 +464,87 @@ static void brw_clip_test( struct brw_clip_compile *c )
brw_MOV(p, v0, deref_4f(vt0, c->offset[VERT_RESULT_HPOS]));
brw_MOV(p, v1, deref_4f(vt1, c->offset[VERT_RESULT_HPOS]));
brw_MOV(p, v2, deref_4f(vt2, c->offset[VERT_RESULT_HPOS]));
+ brw_AND(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(~0x3f));
/* test nearz, xmin, ymin plane */
- brw_CMP(p, t1, BRW_CONDITIONAL_LE, negate(v0), get_element(v0, 3));
+ /* clip.xyz < -clip.w */
+ brw_CMP(p, t1, BRW_CONDITIONAL_L, v0, negate(get_element(v0, 3)));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
- brw_CMP(p, t2, BRW_CONDITIONAL_LE, negate(v1), get_element(v1, 3));
+ brw_CMP(p, t2, BRW_CONDITIONAL_L, v1, negate(get_element(v1, 3)));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
- brw_CMP(p, t3, BRW_CONDITIONAL_LE, negate(v2), get_element(v2, 3));
+ brw_CMP(p, t3, BRW_CONDITIONAL_L, v2, negate(get_element(v2, 3)));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+
+ /* All vertices are outside of a plane, rejected */
+ brw_AND(p, t, t1, t2);
+ brw_AND(p, t, t, t3);
+ brw_OR(p, tmp0, get_element(t, 0), get_element(t, 1));
+ brw_OR(p, tmp0, tmp0, get_element(t, 2));
+ brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
+ brw_AND(p, brw_null_reg(), tmp0, brw_imm_ud(0x1));
+ is_outside = brw_IF(p, BRW_EXECUTE_1);
+ {
+ brw_clip_kill_thread(c);
+ }
+ brw_ENDIF(p, is_outside);
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+
+ /* some vertices are inside a plane, some are outside,need to clip */
brw_XOR(p, t, t1, t2);
brw_XOR(p, t1, t2, t3);
brw_OR(p, t, t, t1);
-
- brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
- get_element(t, 0), brw_imm_ud(0));
+ brw_AND(p, t, t, brw_imm_ud(0x1));
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 0), brw_imm_ud(0));
brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<5)));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
- brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
- get_element(t, 1), brw_imm_ud(0));
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 1), brw_imm_ud(0));
brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<3)));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
- brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
- get_element(t, 2), brw_imm_ud(0));
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 2), brw_imm_ud(0));
brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<1)));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
/* test farz, xmax, ymax plane */
- brw_CMP(p, t1, BRW_CONDITIONAL_L, v0, get_element(v0, 3));
+ /* clip.xyz > clip.w */
+ brw_CMP(p, t1, BRW_CONDITIONAL_G, v0, get_element(v0, 3));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
- brw_CMP(p, t2, BRW_CONDITIONAL_L, v1, get_element(v1, 3));
+ brw_CMP(p, t2, BRW_CONDITIONAL_G, v1, get_element(v1, 3));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
- brw_CMP(p, t3, BRW_CONDITIONAL_L, v2, get_element(v2, 3));
+ brw_CMP(p, t3, BRW_CONDITIONAL_G, v2, get_element(v2, 3));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ /* All vertices are outside of a plane, rejected */
+ brw_AND(p, t, t1, t2);
+ brw_AND(p, t, t, t3);
+ brw_OR(p, tmp0, get_element(t, 0), get_element(t, 1));
+ brw_OR(p, tmp0, tmp0, get_element(t, 2));
+ brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
+ brw_AND(p, brw_null_reg(), tmp0, brw_imm_ud(0x1));
+ is_outside = brw_IF(p, BRW_EXECUTE_1);
+ {
+ brw_clip_kill_thread(c);
+ }
+ brw_ENDIF(p, is_outside);
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+
+ /* some vertices are inside a plane, some are outside,need to clip */
brw_XOR(p, t, t1, t2);
brw_XOR(p, t1, t2, t3);
brw_OR(p, t, t, t1);
-
- brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
- get_element(t, 0), brw_imm_ud(0));
+ brw_AND(p, t, t, brw_imm_ud(0x1));
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 0), brw_imm_ud(0));
brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<4)));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
- brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
- get_element(t, 1), brw_imm_ud(0));
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 1), brw_imm_ud(0));
brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<2)));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
- brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
- get_element(t, 2), brw_imm_ud(0));
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 2), brw_imm_ud(0));
brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<0)));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 9106b748ad..a43fc40ac9 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -418,8 +418,8 @@ struct brw_context
struct brw_tracked_state **atoms;
GLuint nr_atoms;
- GLuint nr_draw_regions;
- struct intel_region *draw_regions[MAX_DRAW_BUFFERS];
+ GLuint nr_color_regions;
+ struct intel_region *color_regions[MAX_DRAW_BUFFERS];
struct intel_region *depth_region;
/**
@@ -670,7 +670,9 @@ void brwInitFragProgFuncs( struct dd_function_table *functions );
*/
void brw_upload_urb_fence(struct brw_context *brw);
-void brw_upload_constant_buffer_state(struct brw_context *brw);
+/* brw_curbe.c
+ */
+void brw_upload_cs_urb_state(struct brw_context *brw);
/*======================================================================
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 4eaaa5f871..4ec0cfb816 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -138,24 +138,24 @@ const struct brw_tracked_state brw_curbe_offsets = {
* fixed-function hardware in a double-buffering scheme to avoid a
* pipeline stall each time the contents of the curbe is changed.
*/
-void brw_upload_constant_buffer_state(struct brw_context *brw)
+void brw_upload_cs_urb_state(struct brw_context *brw)
{
- struct brw_constant_buffer_state cbs;
- memset(&cbs, 0, sizeof(cbs));
+ struct brw_cs_urb_state cs_urb;
+ memset(&cs_urb, 0, sizeof(cs_urb));
/* It appears that this is the state packet for the CS unit, ie. the
* urb entries detailed here are housed in the CS range from the
* URB_FENCE command.
*/
- cbs.header.opcode = CMD_CONST_BUFFER_STATE;
- cbs.header.length = sizeof(cbs)/4 - 2;
+ cs_urb.header.opcode = CMD_CS_URB_STATE;
+ cs_urb.header.length = sizeof(cs_urb)/4 - 2;
/* BRW_NEW_URB_FENCE */
- cbs.bits0.nr_urb_entries = brw->urb.nr_cs_entries;
- cbs.bits0.urb_entry_size = brw->urb.csize - 1;
+ cs_urb.bits0.nr_urb_entries = brw->urb.nr_cs_entries;
+ cs_urb.bits0.urb_entry_size = brw->urb.csize - 1;
assert(brw->urb.nr_cs_entries);
- BRW_CACHED_BATCH_STRUCT(brw, &cbs);
+ BRW_CACHED_BATCH_STRUCT(brw, &cs_urb);
}
static GLfloat fixed_plane[6][4] = {
diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h
index 39c32255f8..590b064c7e 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -734,7 +734,7 @@
#define CMD_URB_FENCE 0x6000
-#define CMD_CONST_BUFFER_STATE 0x6001
+#define CMD_CS_URB_STATE 0x6001
#define CMD_CONST_BUFFER 0x6002
#define CMD_STATE_BASE_ADDRESS 0x6101
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 3ca953da37..7ab1ece263 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -194,6 +194,9 @@ static GLboolean check_fallbacks( struct brw_context *brw,
GLcontext *ctx = &brw->intel.ctx;
GLuint i;
+ /* If we don't require strict OpenGL conformance, never
+ * use fallbacks.
+ */
if (!brw->intel.strict_conformance)
return GL_FALSE;
@@ -230,13 +233,31 @@ static GLboolean check_fallbacks( struct brw_context *brw,
}
}
-
if (ctx->Point.SmoothFlag) {
for (i = 0; i < nr_prims; i++)
if (prim[i].mode == GL_POINTS)
return GL_TRUE;
}
+
+ /* BRW hardware doesn't handle GL_CLAMP texturing correctly;
+ * brw_wm_sampler_state:translate_wrap_mode() treats GL_CLAMP
+ * as GL_CLAMP_TO_EDGE instead. If we're using GL_CLAMP, and
+ * we want strict conformance, force the fallback.
+ * Right now, we only do this for 2D textures.
+ */
+ {
+ int u;
+ for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
+ if (ctx->Texture.Unit[u].Enabled) {
+ if (ctx->Texture.Unit[u].CurrentTex[TEXTURE_2D_INDEX]->WrapS == GL_CLAMP ||
+ ctx->Texture.Unit[u].CurrentTex[TEXTURE_2D_INDEX]->WrapT == GL_CLAMP) {
+ return GL_TRUE;
+ }
+ }
+ }
+ }
+ /* Nothing stopping us from the fast path now */
return GL_FALSE;
}
@@ -261,11 +282,18 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
if (ctx->NewState)
_mesa_update_state( ctx );
+ /* We have to validate the textures *before* checking for fallbacks;
+ * otherwise, the software fallback won't be able to rely on the
+ * texture state, the firstLevel and lastLevel fields won't be
+ * set in the intel texture object (they'll both be 0), and the
+ * software fallback will segfault if it attempts to access any
+ * texture level other than level 0.
+ */
+ brw_validate_textures( brw );
+
if (check_fallbacks(brw, prim, nr_prims))
return GL_FALSE;
- brw_validate_textures( brw );
-
/* Bind all inputs, derive varying and size information:
*/
brw_merge_inputs( brw, arrays );
diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
index 9dcdad7b4e..40cb7a341d 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -178,7 +178,7 @@ static void upload_psp_urb_cbs(struct brw_context *brw )
{
upload_pipelined_state_pointers(brw);
brw_upload_urb_fence(brw);
- brw_upload_constant_buffer_state(brw);
+ brw_upload_cs_urb_state(brw);
}
const struct brw_tracked_state brw_psp_urb_cbs = {
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index df839c5b30..81b0a45998 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -52,7 +52,6 @@ const struct brw_tracked_state brw_cc_vp;
const struct brw_tracked_state brw_check_fallback;
const struct brw_tracked_state brw_clip_prog;
const struct brw_tracked_state brw_clip_unit;
-const struct brw_tracked_state brw_constant_buffer_state;
const struct brw_tracked_state brw_constant_buffer;
const struct brw_tracked_state brw_curbe_offsets;
const struct brw_tracked_state brw_invarient_state;
diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h
index d97ff27f0a..89e2981203 100644
--- a/src/mesa/drivers/dri/i965/brw_structs.h
+++ b/src/mesa/drivers/dri/i965/brw_structs.h
@@ -439,7 +439,7 @@ struct brw_urb_fence
} bits1;
};
-struct brw_constant_buffer_state /* previously brw_command_streamer */
+struct brw_cs_urb_state
{
struct header header;
diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 15ceac6ba1..fc9f6cc80c 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -71,9 +71,9 @@ static void brw_destroy_context( struct intel_context *intel )
brw_FrameBufferTexDestroy( brw );
- for (i = 0; i < brw->state.nr_draw_regions; i++)
- intel_region_release(&brw->state.draw_regions[i]);
- brw->state.nr_draw_regions = 0;
+ for (i = 0; i < brw->state.nr_color_regions; i++)
+ intel_region_release(&brw->state.color_regions[i]);
+ brw->state.nr_color_regions = 0;
intel_region_release(&brw->state.depth_region);
dri_bo_release(&brw->curbe.curbe_bo);
@@ -105,25 +105,25 @@ static void brw_destroy_context( struct intel_context *intel )
* called from intelDrawBuffer()
*/
static void brw_set_draw_region( struct intel_context *intel,
- struct intel_region *draw_regions[],
+ struct intel_region *color_regions[],
struct intel_region *depth_region,
- GLuint num_regions)
+ GLuint num_color_regions)
{
struct brw_context *brw = brw_context(&intel->ctx);
- int i;
+ GLuint i;
/* release old color/depth regions */
if (brw->state.depth_region != depth_region)
brw->state.dirty.brw |= BRW_NEW_DEPTH_BUFFER;
- for (i = 0; i < brw->state.nr_draw_regions; i++)
- intel_region_release(&brw->state.draw_regions[i]);
+ for (i = 0; i < brw->state.nr_color_regions; i++)
+ intel_region_release(&brw->state.color_regions[i]);
intel_region_release(&brw->state.depth_region);
/* reference new color/depth regions */
- for (i = 0; i < num_regions; i++)
- intel_region_reference(&brw->state.draw_regions[i], draw_regions[i]);
+ for (i = 0; i < num_color_regions; i++)
+ intel_region_reference(&brw->state.color_regions[i], color_regions[i]);
intel_region_reference(&brw->state.depth_region, depth_region);
- brw->state.nr_draw_regions = num_regions;
+ brw->state.nr_color_regions = num_color_regions;
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 10f38e02a4..06a6f3f0f4 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -198,7 +198,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
ctx->Color.AlphaEnabled)
lookup |= IZ_PS_KILL_ALPHATEST_BIT;
- if (fp->program.Base.OutputsWritten & (1<<FRAG_RESULT_DEPR))
+ if (fp->program.Base.OutputsWritten & (1<<FRAG_RESULT_DEPTH))
lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
/* _NEW_DEPTH */
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index 37766b7c3a..7e88ef0053 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -289,8 +289,7 @@ static struct prog_src_register get_pixel_w( struct brw_wm_compile *c )
struct prog_dst_register pixel_w = get_temp(c);
struct prog_src_register deltas = get_delta_xy(c);
struct prog_src_register interp_wpos = src_reg(PROGRAM_PAYLOAD, FRAG_ATTRIB_WPOS);
-
-
+
/* deltas.xyw = DELTAS2 deltas.xy, payload.interp_wpos.x
*/
emit_op(c,
@@ -510,7 +509,6 @@ static void precalc_dst( struct brw_wm_compile *c,
src_undef());
}
-
if (dst.WriteMask & WRITEMASK_XZ) {
struct prog_instruction *swz;
GLuint z = GET_SWZ(src0.Swizzle, Z);
@@ -563,7 +561,6 @@ static void precalc_lit( struct brw_wm_compile *c,
swz->SrcReg[0].NegateBase = 0;
}
-
if (dst.WriteMask & WRITEMASK_YZ) {
emit_op(c,
OPCODE_LIT,
@@ -865,42 +862,41 @@ static void precalc_txp( struct brw_wm_compile *c,
static void emit_fb_write( struct brw_wm_compile *c )
{
struct prog_src_register payload_r0_depth = src_reg(PROGRAM_PAYLOAD, PAYLOAD_DEPTH);
- struct prog_src_register outdepth = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DEPR);
+ struct prog_src_register outdepth = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DEPTH);
struct prog_src_register outcolor;
GLuint i;
struct prog_instruction *inst, *last_inst;
struct brw_context *brw = c->func.brw;
- /* inst->Sampler is not used by backend,
- use it for fb write target and eot */
-
- if (brw->state.nr_draw_regions > 1) {
- for (i = 0 ; i < brw->state.nr_draw_regions; i++) {
- outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i);
- last_inst = inst = emit_op(c,
- WM_FB_WRITE, dst_mask(dst_undef(),0), 0,
- outcolor, payload_r0_depth, outdepth);
- inst->Sampler = (i<<1);
- if (c->fp_fragcolor_emitted) {
- outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
- last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
- 0, outcolor, payload_r0_depth, outdepth);
- inst->Sampler = (i<<1);
- }
- }
- last_inst->Sampler |= 1; //eot
+ /* The inst->Aux field is used for FB write target and the EOT marker */
+
+ if (brw->state.nr_color_regions > 1) {
+ for (i = 0 ; i < brw->state.nr_color_regions; i++) {
+ outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i);
+ last_inst = inst = emit_op(c,
+ WM_FB_WRITE, dst_mask(dst_undef(),0), 0,
+ outcolor, payload_r0_depth, outdepth);
+ inst->Aux = (i<<1);
+ if (c->fp_fragcolor_emitted) {
+ outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
+ last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
+ 0, outcolor, payload_r0_depth, outdepth);
+ inst->Aux = (i<<1);
+ }
+ }
+ last_inst->Aux |= 1; //eot
}
else {
/* if gl_FragData[0] is written, use it, else use gl_FragColor */
if (c->fp->program.Base.OutputsWritten & (1 << FRAG_RESULT_DATA0))
outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0);
else
- outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
+ outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
- inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
- 0, outcolor, payload_r0_depth, outdepth);
- inst->Sampler = 1|(0<<1);
+ inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
+ 0, outcolor, payload_r0_depth, outdepth);
+ inst->Aux = 1|(0<<1);
}
}
@@ -931,9 +927,9 @@ static void validate_dst_regs( struct brw_wm_compile *c,
const struct prog_instruction *inst )
{
if (inst->DstReg.File == PROGRAM_OUTPUT) {
- GLuint idx = inst->DstReg.Index;
- if (idx == FRAG_RESULT_COLR)
- c->fp_fragcolor_emitted = 1;
+ GLuint idx = inst->DstReg.Index;
+ if (idx == FRAG_RESULT_COLOR)
+ c->fp_fragcolor_emitted = 1;
}
}
@@ -954,7 +950,6 @@ static void print_insns( const struct prog_instruction *insn,
}
else
_mesa_printf("UNKNOWN\n");
-
}
}
@@ -1079,9 +1074,9 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
}
if (INTEL_DEBUG & DEBUG_WM) {
- _mesa_printf("pass_fp:\n");
- print_insns( c->prog_instructions, c->nr_fp_insns );
- _mesa_printf("\n");
+ _mesa_printf("pass_fp:\n");
+ print_insns( c->prog_instructions, c->nr_fp_insns );
+ _mesa_printf("\n");
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index 121cdc040e..8e404bcdc3 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -426,8 +426,8 @@ static void emit_fb_write(struct brw_wm_compile *c,
nr += 2;
}
- target = inst->Sampler >> 1;
- eot = inst->Sampler & 1;
+ target = inst->Aux >> 1;
+ eot = inst->Aux & 1;
fire_fb_write(c, 0, nr, target, eot);
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
index 783545de56..2debd0678a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
@@ -350,8 +350,8 @@ translate_insn(struct brw_wm_compile *c,
out->tex_unit = inst->TexSrcUnit;
out->tex_idx = inst->TexSrcTarget;
out->tex_shadow = inst->TexShadow;
- out->eot = inst->Sampler & 1;
- out->target = inst->Sampler>>1;
+ out->eot = inst->Aux & 1;
+ out->target = inst->Aux >> 1;
/* Args:
*/
diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c
index 3c3b3473d6..f7ea756fb0 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_state.c
@@ -103,7 +103,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
/* as far as we can tell */
key->computes_depth =
- (fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) != 0;
+ (fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) != 0;
/* _NEW_COLOR */
key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 654adcd131..e402fdf0ee 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -454,13 +454,13 @@ static void prepare_wm_surfaces(struct brw_context *brw )
GLuint i;
int old_nr_surfaces;
- if (brw->state.nr_draw_regions > 1) {
- for (i = 0; i < brw->state.nr_draw_regions; i++) {
- brw_update_region_surface(brw, brw->state.draw_regions[i], i,
+ if (brw->state.nr_color_regions > 1) {
+ for (i = 0; i < brw->state.nr_color_regions; i++) {
+ brw_update_region_surface(brw, brw->state.color_regions[i], i,
GL_FALSE);
}
- }else {
- brw_update_region_surface(brw, brw->state.draw_regions[0], 0, GL_TRUE);
+ } else {
+ brw_update_region_surface(brw, brw->state.color_regions[0], 0, GL_TRUE);
}
old_nr_surfaces = brw->wm.nr_surfaces;
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 60d7bb3770..b7c7eeb368 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -35,9 +35,6 @@
#include "intel_batchbuffer.h"
#include "intel_regions.h"
-static GLboolean intel_bufferobj_unmap(GLcontext * ctx,
- GLenum target,
- struct gl_buffer_object *obj);
/** Allocates a new dri_bo to store the data for the buffer object. */
static void
@@ -103,12 +100,7 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj)
struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
assert(intel_obj);
-
- /* Buffer objects are automatically unmapped when deleting according
- * to the spec.
- */
- if (obj->Pointer)
- intel_bufferobj_unmap(ctx, 0, obj);
+ assert(!obj->Pointer); /* Mesa should have unmapped it */
if (intel_obj->region) {
intel_bufferobj_release_region(intel, intel_obj);
@@ -141,11 +133,7 @@ intel_bufferobj_data(GLcontext * ctx,
intel_obj->Base.Size = size;
intel_obj->Base.Usage = usage;
- /* Buffer objects are automatically unmapped when creating new data buffers
- * according to the spec.
- */
- if (obj->Pointer)
- intel_bufferobj_unmap(ctx, 0, obj);
+ assert(!obj->Pointer); /* Mesa should have unmapped it */
if (intel_obj->region)
intel_bufferobj_release_region(intel, intel_obj);
diff --git a/src/mesa/drivers/dri/intel/intel_chipset.h b/src/mesa/drivers/dri/intel/intel_chipset.h
index d1b4941601..4593d90df3 100644
--- a/src/mesa/drivers/dri/intel/intel_chipset.h
+++ b/src/mesa/drivers/dri/intel/intel_chipset.h
@@ -46,6 +46,13 @@
#define PCI_CHIP_G33_G 0x29C2
#define PCI_CHIP_Q33_G 0x29D2
+#define PCI_CHIP_IGD_GM 0xA011
+#define PCI_CHIP_IGD_G 0xA001
+
+#define IS_IGDGM(devid) (devid == PCI_CHIP_IGD_GM)
+#define IS_IGDG(devid) (devid == PCI_CHIP_IGD_G)
+#define IS_IGD(devid) (IS_IGDG(devid) || IS_IGDGM(devid))
+
#define PCI_CHIP_I965_G 0x29A2
#define PCI_CHIP_I965_Q 0x2992
#define PCI_CHIP_I965_G_1 0x2982
@@ -66,7 +73,7 @@
devid == PCI_CHIP_I945_GME || \
devid == PCI_CHIP_I965_GM || \
devid == PCI_CHIP_I965_GME || \
- devid == PCI_CHIP_GM45_GM)
+ devid == PCI_CHIP_GM45_GM || IS_IGD(devid))
#define IS_G45(devid) (devid == PCI_CHIP_IGD_E_G || \
devid == PCI_CHIP_Q45_G || \
@@ -84,7 +91,7 @@
devid == PCI_CHIP_I945_GME || \
devid == PCI_CHIP_G33_G || \
devid == PCI_CHIP_Q33_G || \
- devid == PCI_CHIP_Q35_G)
+ devid == PCI_CHIP_Q35_G || IS_IGD(devid))
#define IS_965(devid) (devid == PCI_CHIP_I965_G || \
devid == PCI_CHIP_I965_Q || \
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 1aa173db18..b3f6fc02df 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -123,6 +123,10 @@ intelGetString(GLcontext * ctx, GLenum name)
case PCI_CHIP_Q33_G:
chipset = "Intel(R) Q33";
break;
+ case PCI_CHIP_IGD_GM:
+ case PCI_CHIP_IGD_G:
+ chipset = "Intel(R) IGD";
+ break;
case PCI_CHIP_I965_Q:
chipset = "Intel(R) 965Q";
break;
diff --git a/src/mesa/drivers/dri/intel/intel_depthtmp.h b/src/mesa/drivers/dri/intel/intel_depthtmp.h
new file mode 100644
index 0000000000..16d7708453
--- /dev/null
+++ b/src/mesa/drivers/dri/intel/intel_depthtmp.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/**
+ * Wrapper around the depthtmp.h macrofest to generate spans code for
+ * all the tiling styles.
+ */
+
+#define VALUE_TYPE INTEL_VALUE_TYPE
+#define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(NO_TILE(_x, _y), d)
+#define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(NO_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel##x)
+#include "depthtmp.h"
+
+#define VALUE_TYPE INTEL_VALUE_TYPE
+#define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(X_TILE(_x, _y), d)
+#define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(X_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel_XTile_##x)
+#include "depthtmp.h"
+
+#define VALUE_TYPE INTEL_VALUE_TYPE
+#define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(Y_TILE(_x, _y), d)
+#define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(Y_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel_YTile_##x)
+#include "depthtmp.h"
+
+#undef INTEL_VALUE_TYPE
+#undef INTEL_WRITE_DEPTH
+#undef INTEL_READ_DEPTH
+#undef INTEL_TAG
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index c9fb90f3b2..787c290022 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -323,6 +323,15 @@ intel_create_renderbuffer(GLenum intFormat)
irb->Base.BlueBits = 5;
irb->Base.DataType = GL_UNSIGNED_BYTE;
break;
+ case GL_RGB8:
+ irb->Base._ActualFormat = GL_RGB8;
+ irb->Base._BaseFormat = GL_RGB;
+ irb->Base.RedBits = 8;
+ irb->Base.GreenBits = 8;
+ irb->Base.BlueBits = 8;
+ irb->Base.AlphaBits = 0;
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ break;
case GL_RGBA8:
irb->Base._ActualFormat = GL_RGBA8;
irb->Base._BaseFormat = GL_RGBA;
@@ -603,19 +612,16 @@ static void
intel_finish_render_texture(GLcontext * ctx,
struct gl_renderbuffer_attachment *att)
{
- struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer);
-
- DBG("End render texture (tid %x) tex %u\n", _glthread_GetID(), att->Texture->Name);
-
- if (irb) {
- /* just release the region */
- intel_region_release(&irb->region);
- }
- else if (att->Renderbuffer) {
- /* software fallback */
- _mesa_finish_render_texture(ctx, att);
- /* XXX FBO: Need to unmap the buffer (or in intelSpanRenderStart???) */
- }
+ /* no-op
+ * Previously we released the renderbuffer's intel_region but
+ * that's not necessary and actually caused problems when trying
+ * to do a glRead/CopyPixels from the renderbuffer later.
+ * The region will be released later if the texture is replaced
+ * or the renderbuffer deleted.
+ *
+ * The intention of this driver hook is more of a "done rendering
+ * to texture, please re-twiddle/etc if necessary".
+ */
}
@@ -625,6 +631,7 @@ intel_finish_render_texture(GLcontext * ctx,
static void
intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
{
+ struct intel_context *intel = intel_context(ctx);
const struct intel_renderbuffer *depthRb =
intel_get_renderbuffer(fb, BUFFER_DEPTH);
const struct intel_renderbuffer *stencilRb =
@@ -636,6 +643,34 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
*/
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
}
+
+ /* check that texture color buffers are a format we can render into */
+ {
+ const struct gl_texture_format *supportedFormat;
+ GLuint i;
+
+ /* The texture format we can render into seems to depend on the
+ * screen depth. There currently seems to be a problem when
+ * rendering into a rgb565 texture when the screen is abgr8888.
+ */
+ if (intel->front_region->cpp == 4)
+ supportedFormat = &_mesa_texformat_argb8888;
+ else
+ supportedFormat = &_mesa_texformat_rgb565;
+
+ for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+ const struct gl_texture_object *texObj =
+ fb->Attachment[BUFFER_COLOR0 + i].Texture;
+ if (texObj) {
+ const struct gl_texture_image *texImg =
+ texObj->Image[0][texObj->BaseLevel];
+ if (texImg && texImg->TexFormat != supportedFormat) {
+ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+ break;
+ }
+ }
+ }
+ }
}
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index 749920502a..0aa5b8c02c 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -466,7 +466,8 @@ intel_recreate_static(struct intel_context *intel,
else
region->cpp = intel->ctx.Visual.rgbBits / 8;
region->pitch = intelScreen->pitch;
- region->height = intelScreen->height; /* needed? */
+ region->width = intelScreen->width;
+ region->height = intelScreen->height;
if (region->buffer != NULL) {
dri_bo_unreference(region->buffer);
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index d6110b8163..09eba13aab 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -323,7 +323,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
else {
GLboolean swStencil = (mesaVis->stencilBits > 0 &&
mesaVis->depthBits != 24);
- GLenum rgbFormat = (mesaVis->redBits == 5 ? GL_RGB5 : GL_RGBA8);
+ GLenum rgbFormat;
struct intel_framebuffer *intel_fb = CALLOC_STRUCT(intel_framebuffer);
@@ -332,6 +332,13 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
_mesa_initialize_framebuffer(&intel_fb->Base, mesaVis);
+ if (mesaVis->redBits == 5)
+ rgbFormat = GL_RGB5;
+ else if (mesaVis->alphaBits == 0)
+ rgbFormat = GL_RGB8;
+ else
+ rgbFormat = GL_RGBA8;
+
/* setup the hardware-based renderbuffers */
intel_fb->color_rb[0] = intel_create_renderbuffer(rgbFormat);
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT,
@@ -758,13 +765,34 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
fb_format[2] = GL_BGRA;
fb_type[2] = GL_UNSIGNED_INT_8_8_8_8_REV;
+ depth_bits[0] = 0;
+ stencil_bits[0] = 0;
+
for (color = 0; color < ARRAY_SIZE(fb_format); color++) {
__DRIconfig **new_configs;
+ int depth_factor;
+ /* With DRI2 right now, GetBuffers always returns a depth/stencil buffer
+ * with the same cpp as the drawable. So we can't support depth cpp !=
+ * color cpp currently.
+ */
+ if (fb_type[color] == GL_UNSIGNED_SHORT_5_6_5) {
+ depth_bits[1] = 16;
+ stencil_bits[1] = 0;
+
+ depth_factor = 2;
+ } else {
+ depth_bits[1] = 24;
+ stencil_bits[1] = 0;
+ depth_bits[2] = 24;
+ stencil_bits[2] = 8;
+
+ depth_factor = 3;
+ }
new_configs = driCreateConfigs(fb_format[color], fb_type[color],
depth_bits,
stencil_bits,
- ARRAY_SIZE(depth_bits),
+ depth_factor,
back_buffer_modes,
ARRAY_SIZE(back_buffer_modes),
msaa_samples_array,
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index bdd2fd9e85..c3a873f1ab 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -131,6 +131,18 @@ pwrite_8(struct intel_renderbuffer *irb, uint32_t offset, uint8_t val)
dri_bo_subdata(irb->region->buffer, offset, 1, &val);
}
+static uint32_t
+z24s8_to_s8z24(uint32_t val)
+{
+ return (val << 24) | (val >> 8);
+}
+
+static uint32_t
+s8z24_to_z24s8(uint32_t val)
+{
+ return (val >> 24) | (val << 8);
+}
+
static uint32_t no_tile_swizzle(struct intel_renderbuffer *irb,
int x, int y)
{
@@ -293,101 +305,29 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
#define X_TILE(_X, _Y) x_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off)
#define Y_TILE(_X, _Y) y_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off)
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) intel##x##_RGB565
-#define TAG2(x,y) intel##x##_RGB565##y
-#define GET_VALUE(X, Y) pread_16(irb, NO_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_16(irb, NO_TILE(X, Y), V)
-#include "spantmp2.h"
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) intel##x##_ARGB8888
-#define TAG2(x,y) intel##x##_ARGB8888##y
-#define GET_VALUE(X, Y) pread_32(irb, NO_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_32(irb, NO_TILE(X, Y), V)
-#include "spantmp2.h"
-
-/* 32 bit, xRGB8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) intel##x##_xRGB8888
-#define TAG2(x,y) intel##x##_xRGB8888##y
-#define GET_VALUE(X, Y) pread_xrgb8888(irb, NO_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_xrgb8888(irb, NO_TILE(X, Y), V)
-#include "spantmp2.h"
-
-/* 16 bit RGB565 color tile spanline and pixel functions
- */
-
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) intel_XTile_##x##_RGB565
-#define TAG2(x,y) intel_XTile_##x##_RGB565##y
-#define GET_VALUE(X, Y) pread_16(irb, X_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_16(irb, X_TILE(X, Y), V)
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) intel_YTile_##x##_RGB565
-#define TAG2(x,y) intel_YTile_##x##_RGB565##y
-#define GET_VALUE(X, Y) pread_16(irb, Y_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_16(irb, Y_TILE(X, Y), V)
-#include "spantmp2.h"
-
-/* 32 bit ARGB888 color tile spanline and pixel functions
- */
-
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) intel_XTile_##x##_ARGB8888
-#define TAG2(x,y) intel_XTile_##x##_ARGB8888##y
-#define GET_VALUE(X, Y) pread_32(irb, X_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_32(irb, X_TILE(X, Y), V)
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) intel_YTile_##x##_ARGB8888
-#define TAG2(x,y) intel_YTile_##x##_ARGB8888##y
-#define GET_VALUE(X, Y) pread_32(irb, Y_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_32(irb, Y_TILE(X, Y), V)
-#include "spantmp2.h"
-
-/* 32 bit xRGB888 color tile spanline and pixel functions
- */
-
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) intel_XTile_##x##_xRGB8888
-#define TAG2(x,y) intel_XTile_##x##_xRGB8888##y
-#define GET_VALUE(X, Y) pread_xrgb8888(irb, X_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_xrgb8888(irb, X_TILE(X, Y), V)
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) intel_YTile_##x##_xRGB8888
-#define TAG2(x,y) intel_YTile_##x##_xRGB8888##y
-#define GET_VALUE(X, Y) pread_xrgb8888(irb, Y_TILE(X, Y))
-#define PUT_VALUE(X, Y, V) pwrite_xrgb8888(irb, Y_TILE(X, Y), V)
-#include "spantmp2.h"
+/* r5g6b5 color span and pixel functions */
+#define INTEL_PIXEL_FMT GL_RGB
+#define INTEL_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
+#define INTEL_READ_VALUE(offset) pread_16(irb, offset)
+#define INTEL_WRITE_VALUE(offset, v) pwrite_16(irb, offset, v)
+#define INTEL_TAG(x) x##_RGB565
+#include "intel_spantmp.h"
+
+/* a8r8g8b8 color span and pixel functions */
+#define INTEL_PIXEL_FMT GL_BGRA
+#define INTEL_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
+#define INTEL_READ_VALUE(offset) pread_32(irb, offset)
+#define INTEL_WRITE_VALUE(offset, v) pwrite_32(irb, offset, v)
+#define INTEL_TAG(x) x##_ARGB8888
+#include "intel_spantmp.h"
+
+/* x8r8g8b8 color span and pixel functions */
+#define INTEL_PIXEL_FMT GL_BGRA
+#define INTEL_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
+#define INTEL_READ_VALUE(offset) pread_xrgb8888(irb, offset)
+#define INTEL_WRITE_VALUE(offset, v) pwrite_xrgb8888(irb, offset, v)
+#define INTEL_TAG(x) x##_xRGB8888
+#include "intel_spantmp.h"
#define LOCAL_DEPTH_VARS \
struct intel_context *intel = intel_context(ctx); \
@@ -402,98 +342,26 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-/**
- ** 16-bit depthbuffer functions.
- **/
-#define VALUE_TYPE GLushort
-#define WRITE_DEPTH(_x, _y, d) pwrite_16(irb, NO_TILE(_x, _y), d)
-#define READ_DEPTH(d, _x, _y) d = pread_16(irb, NO_TILE(_x, _y))
-#define TAG(x) intel##x##_z16
-#include "depthtmp.h"
+/* z16 depthbuffer functions. */
+#define INTEL_VALUE_TYPE GLushort
+#define INTEL_WRITE_DEPTH(offset, d) pwrite_16(irb, offset, d)
+#define INTEL_READ_DEPTH(offset) pread_16(irb, offset)
+#define INTEL_TAG(name) name##_z16
+#include "intel_depthtmp.h"
+/* z24 depthbuffer functions. */
+#define INTEL_VALUE_TYPE GLuint
+#define INTEL_WRITE_DEPTH(offset, d) pwrite_32(irb, offset, d)
+#define INTEL_READ_DEPTH(offset) pread_32(irb, offset)
+#define INTEL_TAG(name) name##_z24
+#include "intel_depthtmp.h"
-/**
- ** 16-bit x tile depthbuffer functions.
- **/
-#define VALUE_TYPE GLushort
-#define WRITE_DEPTH(_x, _y, d) pwrite_16(irb, X_TILE(_x, _y), d)
-#define READ_DEPTH(d, _x, _y) d = pread_16(irb, X_TILE(_x, _y))
-#define TAG(x) intel_XTile_##x##_z16
-#include "depthtmp.h"
-
-/**
- ** 16-bit y tile depthbuffer functions.
- **/
-#define VALUE_TYPE GLushort
-#define WRITE_DEPTH(_x, _y, d) pwrite_16(irb, Y_TILE(_x, _y), d)
-#define READ_DEPTH(d, _x, _y) d = pread_16(irb, Y_TILE(_x, _y))
-#define TAG(x) intel_YTile_##x##_z16
-#include "depthtmp.h"
-
-
-/**
- ** 24/8-bit interleaved depth/stencil functions
- ** Note: we're actually reading back combined depth+stencil values.
- ** The wrappers in main/depthstencil.c are used to extract the depth
- ** and stencil values.
- **/
-#define VALUE_TYPE GLuint
-
-/* Change ZZZS -> SZZZ */
-#define WRITE_DEPTH(_x, _y, d) \
- pwrite_32(irb, NO_TILE(_x, _y), ((d) >> 8) | ((d) << 24))
-
-/* Change SZZZ -> ZZZS */
-#define READ_DEPTH( d, _x, _y ) { \
- GLuint tmp = pread_32(irb, NO_TILE(_x, _y)); \
- d = (tmp << 8) | (tmp >> 24); \
-}
-
-#define TAG(x) intel##x##_z24_s8
-#include "depthtmp.h"
-
-
-/**
- ** 24/8-bit x-tile interleaved depth/stencil functions
- ** Note: we're actually reading back combined depth+stencil values.
- ** The wrappers in main/depthstencil.c are used to extract the depth
- ** and stencil values.
- **/
-#define VALUE_TYPE GLuint
-
-/* Change ZZZS -> SZZZ */
-#define WRITE_DEPTH(_x, _y, d) \
- pwrite_32(irb, X_TILE(_x, _y), ((d) >> 8) | ((d) << 24))
-
-/* Change SZZZ -> ZZZS */
-#define READ_DEPTH( d, _x, _y ) { \
- GLuint tmp = pread_32(irb, X_TILE(_x, _y)); \
- d = (tmp << 8) | (tmp >> 24); \
-}
-
-#define TAG(x) intel_XTile_##x##_z24_s8
-#include "depthtmp.h"
-
-/**
- ** 24/8-bit y-tile interleaved depth/stencil functions
- ** Note: we're actually reading back combined depth+stencil values.
- ** The wrappers in main/depthstencil.c are used to extract the depth
- ** and stencil values.
- **/
-#define VALUE_TYPE GLuint
-
-/* Change ZZZS -> SZZZ */
-#define WRITE_DEPTH(_x, _y, d) \
- pwrite_32(irb, Y_TILE(_x, _y), ((d) >> 8) | ((d) << 24))
-
-/* Change SZZZ -> ZZZS */
-#define READ_DEPTH( d, _x, _y ) { \
- GLuint tmp = pread_32(irb, Y_TILE(_x, _y)); \
- d = (tmp << 8) | (tmp >> 24); \
-}
-
-#define TAG(x) intel_YTile_##x##_z24_s8
-#include "depthtmp.h"
+/* z24s8 depthbuffer functions. */
+#define INTEL_VALUE_TYPE GLuint
+#define INTEL_WRITE_DEPTH(offset, d) pwrite_32(irb, offset, z24s8_to_s8z24(d))
+#define INTEL_READ_DEPTH(offset) s8z24_to_z24s8(pread_32(irb, offset))
+#define INTEL_TAG(name) name##_z24_s8
+#include "intel_depthtmp.h"
/**
@@ -752,8 +620,21 @@ intel_set_span_functions(struct intel_context *intel,
break;
}
}
- else if (rb->_ActualFormat == GL_DEPTH_COMPONENT24 || /* XXX FBO remove */
- rb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) {
+ else if (rb->_ActualFormat == GL_DEPTH_COMPONENT24) {
+ switch (tiling) {
+ case I915_TILING_NONE:
+ default:
+ intelInitDepthPointers_z24(rb);
+ break;
+ case I915_TILING_X:
+ intel_XTile_InitDepthPointers_z24(rb);
+ break;
+ case I915_TILING_Y:
+ intel_YTile_InitDepthPointers_z24(rb);
+ break;
+ }
+ }
+ else if (rb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) {
switch (tiling) {
case I915_TILING_NONE:
default:
diff --git a/src/mesa/drivers/dri/intel/intel_spantmp.h b/src/mesa/drivers/dri/intel/intel_spantmp.h
new file mode 100644
index 0000000000..ead0b1c168
--- /dev/null
+++ b/src/mesa/drivers/dri/intel/intel_spantmp.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/**
+ * Wrapper around the spantmp.h macrofest to generate spans code for
+ * all the tiling styles.
+ */
+
+#define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT
+#define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE
+#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(NO_TILE(_x, _y), v)
+#define GET_VALUE(_x, _y) INTEL_READ_VALUE(NO_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel##x)
+#define TAG2(x, y) INTEL_TAG(intel##x)##y
+#include "spantmp2.h"
+
+#define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT
+#define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE
+#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(X_TILE(_x, _y), v)
+#define GET_VALUE(_x, _y) INTEL_READ_VALUE(X_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel_XTile_##x)
+#define TAG2(x, y) INTEL_TAG(intel_XTile_##x)##y
+#include "spantmp2.h"
+
+#define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT
+#define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE
+#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(X_TILE(_x, _y), v)
+#define GET_VALUE(_x, _y) INTEL_READ_VALUE(X_TILE(_x, _y))
+#define TAG(x) INTEL_TAG(intel_YTile_##x)
+#define TAG2(x, y) INTEL_TAG(intel_YTile_##x)##y
+#include "spantmp2.h"
+
+#undef INTEL_PIXEL_FMT
+#undef INTEL_PIXEL_TYPE
+#undef INTEL_WRITE_VALUE
+#undef INTEL_READ_VALUE
+#undef INTEL_TAG
diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c
index 2715a540d0..2d57c67848 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_format.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_format.c
@@ -3,11 +3,15 @@
#include "main/texformat.h"
#include "main/enums.h"
-/* It works out that this function is fine for all the supported
+
+/**
+ * Choose hardware texture format given the user's glTexImage parameters.
+ *
+ * It works out that this function is fine for all the supported
* hardware. However, there is still a need to map the formats onto
* hardware descriptors.
- */
-/* Note that the i915 can actually support many more formats than
+ *
+ * Note that the i915 can actually support many more formats than
* these if we take the step of simply swizzling the colors
* immediately after sampling...
*/
@@ -18,6 +22,11 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
struct intel_context *intel = intel_context(ctx);
const GLboolean do32bpt = (intel->ctx.Visual.rgbBits >= 24);
+#if 0
+ printf("%s intFmt=0x%x format=0x%x type=0x%x\n",
+ __FUNCTION__, internalFormat, format, type);
+#endif
+
switch (internalFormat) {
case 4:
case GL_RGBA:
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c
index 8d030c63fb..32182bb667 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog.c
@@ -356,8 +356,8 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler)
static void nqssadce_init(struct nqssadce_state* s)
{
- s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW;
- s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W;
+ s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW;
+ s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W;
}
diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c
index 926ddd5964..07a2a7b17c 100644
--- a/src/mesa/drivers/dri/r300/r500_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r500_fragprog.c
@@ -298,8 +298,8 @@ static void insert_WPOS_trailer(struct r500_fragment_program_compiler *compiler)
static void nqssadce_init(struct nqssadce_state* s)
{
- s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW;
- s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W;
+ s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW;
+ s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W;
}
static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg)
diff --git a/src/mesa/drivers/dri/r300/radeon_nqssadce.c b/src/mesa/drivers/dri/r300/radeon_nqssadce.c
index 97ce016c99..a083c3d243 100644
--- a/src/mesa/drivers/dri/r300/radeon_nqssadce.c
+++ b/src/mesa/drivers/dri/r300/radeon_nqssadce.c
@@ -191,7 +191,7 @@ static void process_instruction(struct nqssadce_state* s)
if (inst->Opcode != OPCODE_KIL) {
if (s->Descr->RewriteDepthOut) {
- if (inst->DstReg.File == PROGRAM_OUTPUT && inst->DstReg.Index == FRAG_RESULT_DEPR)
+ if (inst->DstReg.File == PROGRAM_OUTPUT && inst->DstReg.Index == FRAG_RESULT_DEPTH)
rewrite_depth_out(inst);
}
diff --git a/src/mesa/drivers/dri/r300/radeon_program_pair.c b/src/mesa/drivers/dri/r300/radeon_program_pair.c
index 58bc0d5843..365e7c1722 100644
--- a/src/mesa/drivers/dri/r300/radeon_program_pair.c
+++ b/src/mesa/drivers/dri/r300/radeon_program_pair.c
@@ -778,10 +778,10 @@ static void fill_dest_into_pair(struct pair_state *s, struct radeon_pair_instruc
struct prog_instruction *inst = s->Program->Instructions + ip;
if (inst->DstReg.File == PROGRAM_OUTPUT) {
- if (inst->DstReg.Index == FRAG_RESULT_COLR) {
+ if (inst->DstReg.Index == FRAG_RESULT_COLOR) {
pair->RGB.OutputWriteMask |= inst->DstReg.WriteMask & WRITEMASK_XYZ;
pair->Alpha.OutputWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3);
- } else if (inst->DstReg.Index == FRAG_RESULT_DEPR) {
+ } else if (inst->DstReg.Index == FRAG_RESULT_DEPTH) {
pair->Alpha.DepthWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3);
}
} else {
diff --git a/src/mesa/drivers/dri/radeon/radeon_chipset.h b/src/mesa/drivers/dri/radeon/radeon_chipset.h
index 55a73eab20..f6bd1eb83f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_chipset.h
+++ b/src/mesa/drivers/dri/radeon/radeon_chipset.h
@@ -247,6 +247,9 @@
#define PCI_CHIP_RS350_7835 0x7835
#define PCI_CHIP_RS690_791E 0x791E
#define PCI_CHIP_RS690_791F 0x791F
+#define PCI_CHIP_RS600_793F 0x793F
+#define PCI_CHIP_RS600_7941 0x7941
+#define PCI_CHIP_RS600_7942 0x7942
#define PCI_CHIP_RS740_796C 0x796C
#define PCI_CHIP_RS740_796D 0x796D
#define PCI_CHIP_RS740_796E 0x796E
@@ -270,6 +273,7 @@ enum {
CHIP_FAMILY_R420,
CHIP_FAMILY_RV410,
CHIP_FAMILY_RS400,
+ CHIP_FAMILY_RS600,
CHIP_FAMILY_RS690,
CHIP_FAMILY_RS740,
CHIP_FAMILY_RV515,
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 56c22faafa..f7cba5016b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -685,6 +685,12 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
screen->chip_family = CHIP_FAMILY_RS400;
break;
+ case PCI_CHIP_RS600_793F:
+ case PCI_CHIP_RS600_7941:
+ case PCI_CHIP_RS600_7942:
+ screen->chip_family = CHIP_FAMILY_RS600;
+ break;
+
case PCI_CHIP_RS690_791E:
case PCI_CHIP_RS690_791F:
screen->chip_family = CHIP_FAMILY_RS690;
@@ -843,7 +849,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
ret = radeonGetParam( sPriv->fd, RADEON_PARAM_FB_LOCATION,
&temp);
if (ret) {
- if (screen->chip_family < CHIP_FAMILY_RS690)
+ if (screen->chip_family < CHIP_FAMILY_RS600)
screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff) << 16;
else {
FREE( screen );
@@ -854,7 +860,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
screen->fbLocation = (temp & 0xffff) << 16;
}
- if (screen->chip_family >= CHIP_FAMILY_RV515) {
+ if (screen->chip_family >= CHIP_FAMILY_R300) {
ret = radeonGetParam( sPriv->fd, RADEON_PARAM_NUM_GB_PIPES,
&temp);
if (ret) {
diff --git a/src/mesa/glapi/glX_proto_recv.py b/src/mesa/glapi/glX_proto_recv.py
index 923c1958f0..f423c6db08 100644
--- a/src/mesa/glapi/glX_proto_recv.py
+++ b/src/mesa/glapi/glX_proto_recv.py
@@ -277,7 +277,7 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
if param.is_image():
offset = f.offset_of( param.name )
- print '%s %s const %s = (%s) %s(pc + %s);' % (indent, type_string, param.name, type_string, cond, offset)
+ print '%s %s const %s = (%s) (%s(pc + %s));' % (indent, type_string, param.name, type_string, cond, offset)
if param.depth:
print '%s __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);' % (indent)
diff --git a/src/mesa/glapi/gl_SPARC_asm.py b/src/mesa/glapi/gl_SPARC_asm.py
index 178c00a227..33e752df38 100644
--- a/src/mesa/glapi/gl_SPARC_asm.py
+++ b/src/mesa/glapi/gl_SPARC_asm.py
@@ -39,80 +39,202 @@ class PrintGenericStubs(gl_XML.gl_print_base):
def printRealHeader(self):
- print '#include "glapioffsets.h"'
+ print '#include "glapi/glapioffsets.h"'
print ''
print '#ifdef __arch64__'
- print '# define GL_STUB(fn,off)\t\t\t\t\\'
- print 'fn:\t\t\t\t\t\\'
- print '\tsethi\t%hi(0xDEADBEEF), %g4 ;\t\t\t\\'
- print '\tsethi\t%hi(0xDEADBEEF), %g1 ;\t\t\t\\'
- print '\tor\t%g4, %lo(0xDEADBEEF), %g4 ;\t\t\\'
- print '\tor\t%g1, %lo(0xDEADBEEF), %g1 ;\t\t\\'
- print '\tsllx\t%g4, 32, %g4 ;\t\t\t\t\\'
- print '\tldx\t[%g1 + %g4], %g1 ;\t\t\t\\'
- print '\tsethi\t%hi(8 * off), %g4 ;\t\t\t\\'
- print '\tor\t%g4, %lo(8 * off), %g4 ;\t\t\\'
- print '\tldx\t[%g1 + %g4], %g5 ;\t\t\t\\'
- print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\'
- print '\tnop'
+ print '#define GL_OFF(N)\t((N) * 8)'
+ print '#define GL_LL\t\tldx'
+ print '#define GL_TIE_LD(SYM)\t%tie_ldx(SYM)'
+ print '#define GL_STACK_SIZE\t128'
print '#else'
- print '# define GL_STUB(fn,off)\t\t\t\t\\'
- print 'fn:\t\t\t\t\t\\'
- print '\tsethi\t%hi(0xDEADBEEF), %g1 ;\t\t\t\\'
- print '\tld\t[%g1 + %lo(0xDEADBEEF)], %g1 ;\t\t\\'
- print '\tld\t[%g1 + (4 * off)], %g5 ;\t\t\\'
- print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\'
- print '\tnop'
+ print '#define GL_OFF(N)\t((N) * 4)'
+ print '#define GL_LL\t\tld'
+ print '#define GL_TIE_LD(SYM)\t%tie_ld(SYM)'
+ print '#define GL_STACK_SIZE\t64'
print '#endif'
print ''
- print '#define GL_STUB_ALIAS(fn,alias) fn = alias'
+ print '#define GLOBL_FN(x) .globl x ; .type x, @function'
+ print '#define HIDDEN(x) .hidden x'
print ''
- print '.text'
- print '.align 32'
- print '\t\t.globl __glapi_sparc_icache_flush ; .type __glapi_sparc_icache_flush,#function'
+ print '\t.register %g2, #scratch'
+ print '\t.register %g3, #scratch'
+ print ''
+ print '\t.text'
+ print ''
+ print '\tGLOBL_FN(__glapi_sparc_icache_flush)'
+ print '\tHIDDEN(__glapi_sparc_icache_flush)'
+ print '\t.type\t__glapi_sparc_icache_flush, @function'
print '__glapi_sparc_icache_flush: /* %o0 = insn_addr */'
print '\tflush\t%o0'
print '\tretl'
- print '\tnop'
+ print '\t nop'
+ print ''
+ print '\t.align\t32'
+ print ''
+ print '\t.type\t__glapi_sparc_get_pc, @function'
+ print '__glapi_sparc_get_pc:'
+ print '\tretl'
+ print '\t add\t%o7, %g2, %g2'
+ print '\t.size\t__glapi_sparc_get_pc, .-__glapi_sparc_get_pc'
+ print ''
+ print '#ifdef GLX_USE_TLS'
+ print ''
+ print '\tGLOBL_FN(__glapi_sparc_get_dispatch)'
+ print '\tHIDDEN(__glapi_sparc_get_dispatch)'
+ print '__glapi_sparc_get_dispatch:'
+ print '\tmov\t%o7, %g1'
+ print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+ print '\tcall\t__glapi_sparc_get_pc'
+ print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+ print '\tmov\t%g1, %o7'
+ print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1'
+ print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1'
+ print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)'
+ print '\tretl'
+ print '\t mov\t%g2, %o0'
+ print ''
+ print '\t.data'
+ print '\t.align\t32'
+ print ''
+ print '\t/* --> sethi %hi(_glapi_tls_Dispatch), %g1 */'
+ print '\t/* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */'
+ print '\tGLOBL_FN(__glapi_sparc_tls_stub)'
+ print '\tHIDDEN(__glapi_sparc_tls_stub)'
+ print '__glapi_sparc_tls_stub: /* Call offset in %g3 */'
+ print '\tmov\t%o7, %g1'
+ print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+ print '\tcall\t__glapi_sparc_get_pc'
+ print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+ print '\tmov\t%g1, %o7'
+ print '\tsrl\t%g3, 10, %g3'
+ print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1'
+ print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1'
+ print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)'
+ print '\tGL_LL\t[%g7+%g2], %g1'
+ print '\tGL_LL\t[%g1 + %g3], %g1'
+ print '\tjmp\t%g1'
+ print '\t nop'
+ print '\t.size\t__glapi_sparc_tls_stub, .-__glapi_sparc_tls_stub'
+ print ''
+ print '#define GL_STUB(fn, off)\t\t\t\t\\'
+ print '\tGLOBL_FN(fn);\t\t\t\t\t\\'
+ print 'fn:\tba\t__glapi_sparc_tls_stub;\t\t\t\\'
+ print '\t sethi\tGL_OFF(off), %g3;\t\t\t\\'
+ print '\t.size\tfn,.-fn;'
+ print ''
+ print '#elif defined(PTHREADS)'
+ print ''
+ print '\t/* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */'
+ print '\t/* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */'
+ print '\t/* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */'
+ print '\t/* 64-bit 0x0c --> sllx %g1, 32, %g1 */'
+ print '\t/* 64-bit 0x10 --> add %g1, %g2, %g1 */'
+ print '\t/* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */'
+ print ''
+ print '\t/* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */'
+ print '\t/* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */'
+ print ''
+ print '\t.data'
+ print '\t.align\t32'
+ print ''
+ print '\tGLOBL_FN(__glapi_sparc_pthread_stub)'
+ print '\tHIDDEN(__glapi_sparc_pthread_stub)'
+ print '__glapi_sparc_pthread_stub: /* Call offset in %g3 */'
+ print '\tmov\t%o7, %g1'
+ print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+ print '\tcall\t__glapi_sparc_get_pc'
+ print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+ print '\tmov\t%g1, %o7'
+ print '\tsethi\t%hi(_glapi_Dispatch), %g1'
+ print '\tor\t%g1, %lo(_glapi_Dispatch), %g1'
+ print '\tsrl\t%g3, 10, %g3'
+ print '\tGL_LL\t[%g2+%g1], %g2'
+ print '\tGL_LL\t[%g2], %g1'
+ print '\tcmp\t%g1, 0'
+ print '\tbe\t2f'
+ print '\t nop'
+ print '1:\tGL_LL\t[%g1 + %g3], %g1'
+ print '\tjmp\t%g1'
+ print '\t nop'
+ print '2:\tsave\t%sp, GL_STACK_SIZE, %sp'
+ print '\tmov\t%g3, %l0'
+ print '\tcall\t_glapi_get_dispatch'
+ print '\t nop'
+ print '\tmov\t%o0, %g1'
+ print '\tmov\t%l0, %g3'
+ print '\tba\t1b'
+ print '\t restore %g0, %g0, %g0'
+ print '\t.size\t__glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub'
+ print ''
+ print '#define GL_STUB(fn, off)\t\t\t\\'
+ print '\tGLOBL_FN(fn);\t\t\t\t\\'
+ print 'fn:\tba\t__glapi_sparc_pthread_stub;\t\\'
+ print '\t sethi\tGL_OFF(off), %g3;\t\t\\'
+ print '\t.size\tfn,.-fn;'
+ print ''
+ print '#else /* Non-threaded version. */'
print ''
- print '.data'
- print '.align 64'
+ print '\t.type __glapi_sparc_nothread_stub, @function'
+ print '__glapi_sparc_nothread_stub: /* Call offset in %g3 */'
+ print '\tmov\t%o7, %g1'
+ print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+ print '\tcall\t__glapi_sparc_get_pc'
+ print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+ print '\tmov\t%g1, %o7'
+ print '\tsrl\t%g3, 10, %g3'
+ print '\tsethi\t%hi(_glapi_Dispatch), %g1'
+ print '\tor\t%g1, %lo(_glapi_Dispatch), %g1'
+ print '\tGL_LL\t[%g2+%g1], %g2'
+ print '\tGL_LL\t[%g2], %g1'
+ print '\tGL_LL\t[%g1 + %g3], %g1'
+ print '\tjmp\t%g1'
+ print '\t nop'
+ print '\t.size\t__glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub'
+ print ''
+ print '#define GL_STUB(fn, off)\t\t\t\\'
+ print '\tGLOBL_FN(fn);\t\t\t\t\\'
+ print 'fn:\tba\t__glapi_sparc_nothread_stub;\t\\'
+ print '\t sethi\tGL_OFF(off), %g3;\t\t\\'
+ print '\t.size\tfn,.-fn;'
+ print ''
+ print '#endif'
+ print ''
+ print '#define GL_STUB_ALIAS(fn, alias) \\'
+ print ' .globl fn; \\'
+ print ' .set fn, alias'
+ print ''
+ print '\t.text'
+ print '\t.align\t32'
+ print ''
+ print '\t.globl\tgl_dispatch_functions_start'
+ print '\tHIDDEN(gl_dispatch_functions_start)'
+ print 'gl_dispatch_functions_start:'
print ''
return
+ def printRealFooter(self):
+ print ''
+ print '\t.globl\tgl_dispatch_functions_end'
+ print '\tHIDDEN(gl_dispatch_functions_end)'
+ print 'gl_dispatch_functions_end:'
+ return
def printBody(self, api):
for f in api.functionIterateByOffset():
- if f.is_static_entry_point(f.name):
- name = f.name
- else:
- name = "_dispatch_stub_%u" % (f.offset)
+ name = f.dispatch_name()
- print '\t\t.globl gl%s ; .type gl%s,#function' % (name, name)
+ print '\tGL_STUB(gl%s, _gloffset_%s)' % (name, f.name)
- print '\t\t.globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function'
- print '_mesa_sparc_glapi_begin:'
- print ''
+ if not f.is_static_entry_point(f.name):
+ print '\tHIDDEN(gl%s)' % (name)
for f in api.functionIterateByOffset():
- if f.is_static_entry_point(f.name):
- name = f.name
- else:
- name = "_dispatch_stub_%u" % (f.offset)
-
- print '\tGL_STUB(gl%s, _gloffset_%s)' % (name, name)
+ name = f.dispatch_name()
- print ''
- print '\t\t.globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function'
- print '_mesa_sparc_glapi_end:'
- print ''
-
-
- for f in api.functionIterateByOffset():
- for n in f.entry_points:
- if n != f.name:
- if f.is_static_entry_point(n):
- text = '\t.globl gl%s ; .type gl%s,#function ; gl%s = gl%s' % (n, n, n, f.name)
+ if f.is_static_entry_point(f.name):
+ for n in f.entry_points:
+ if n != f.name:
+ text = '\tGL_STUB_ALIAS(gl%s, gl%s)' % (n, f.name)
if f.has_different_protocol(n):
print '#ifndef GLX_INDIRECT_RENDERING'
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index e20618abc1..2b105d0f17 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -318,6 +318,14 @@ extern const GLubyte gl_dispatch_functions_start[];
# endif
#endif
+#ifdef USE_SPARC_ASM
+#ifdef GLX_USE_TLS
+extern unsigned int __glapi_sparc_tls_stub;
+#else
+extern unsigned int __glapi_sparc_pthread_stub;
+#endif
+#endif
+
#if !defined(DISPATCH_FUNCTION_SIZE) && !defined(XFree86Server) && !defined(XGLServer)
# define NEED_FUNCTION_POINTER
#endif
@@ -344,6 +352,129 @@ init_glapi_relocs( void )
curr_func += DISPATCH_FUNCTION_SIZE;
}
#endif
+#ifdef USE_SPARC_ASM
+ extern void __glapi_sparc_icache_flush(unsigned int *);
+ static const unsigned int template[] = {
+#ifdef GLX_USE_TLS
+ 0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */
+ 0x8730e00a, /* srl %g3, 10, %g3 */
+ 0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */
+#ifdef __arch64__
+ 0xc259c002, /* ldx [%g7 + %g2], %g1 */
+ 0xc2584003, /* ldx [%g1 + %g3], %g1 */
+#else
+ 0xc201c002, /* ld [%g7 + %g2], %g1 */
+ 0xc2004003, /* ld [%g1 + %g3], %g1 */
+#endif
+ 0x81c04000, /* jmp %g1 */
+ 0x01000000, /* nop */
+#else
+#ifdef __arch64__
+ 0x03000000, /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */
+ 0x05000000, /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */
+ 0x82106000, /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */
+ 0x8730e00a, /* 64-bit 0x0c --> srl %g3, 10, %g3 */
+ 0x83287020, /* 64-bit 0x10 --> sllx %g1, 32, %g1 */
+ 0x82004002, /* 64-bit 0x14 --> add %g1, %g2, %g1 */
+ 0xc2586000, /* 64-bit 0x18 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */
+#else
+ 0x03000000, /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */
+ 0x8730e00a, /* 32-bit 0x04 --> srl %g3, 10, %g3 */
+ 0xc2006000, /* 32-bit 0x08 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */
+#endif
+ 0x80a06000, /* --> cmp %g1, 0 */
+ 0x02800005, /* --> be +4*5 */
+ 0x01000000, /* --> nop */
+#ifdef __arch64__
+ 0xc2584003, /* 64-bit --> ldx [%g1 + %g3], %g1 */
+#else
+ 0xc2004003, /* 32-bit --> ld [%g1 + %g3], %g1 */
+#endif
+ 0x81c04000, /* --> jmp %g1 */
+ 0x01000000, /* --> nop */
+#ifdef __arch64__
+ 0x9de3bf80, /* 64-bit --> save %sp, -128, %sp */
+#else
+ 0x9de3bfc0, /* 32-bit --> save %sp, -64, %sp */
+#endif
+ 0xa0100003, /* --> mov %g3, %l0 */
+ 0x40000000, /* --> call _glapi_get_dispatch */
+ 0x01000000, /* --> nop */
+ 0x82100008, /* --> mov %o0, %g1 */
+ 0x86100010, /* --> mov %l0, %g3 */
+ 0x10bffff7, /* --> ba -4*9 */
+ 0x81e80000, /* --> restore */
+#endif
+ };
+#ifdef GLX_USE_TLS
+ extern unsigned long __glapi_sparc_get_dispatch(void);
+ unsigned int *code = &__glapi_sparc_tls_stub;
+ unsigned long dispatch = __glapi_sparc_get_dispatch();
+#else
+ unsigned int *code = &__glapi_sparc_pthread_stub;
+ unsigned long dispatch = (unsigned long) &_glapi_Dispatch;
+ unsigned long call_dest = (unsigned long ) &_glapi_get_dispatch;
+ int idx;
+#endif
+
+#if defined(GLX_USE_TLS)
+ code[0] = template[0] | (dispatch >> 10);
+ code[1] = template[1];
+ __glapi_sparc_icache_flush(&code[0]);
+ code[2] = template[2] | (dispatch & 0x3ff);
+ code[3] = template[3];
+ __glapi_sparc_icache_flush(&code[2]);
+ code[4] = template[4];
+ code[5] = template[5];
+ __glapi_sparc_icache_flush(&code[4]);
+ code[6] = template[6];
+ __glapi_sparc_icache_flush(&code[6]);
+#else
+#if defined(__arch64__)
+ code[0] = template[0] | (dispatch >> (32 + 10));
+ code[1] = template[1] | ((dispatch & 0xffffffff) >> 10);
+ __glapi_sparc_icache_flush(&code[0]);
+ code[2] = template[2] | ((dispatch >> 32) & 0x3ff);
+ code[3] = template[3];
+ __glapi_sparc_icache_flush(&code[2]);
+ code[4] = template[4];
+ code[5] = template[5];
+ __glapi_sparc_icache_flush(&code[4]);
+ code[6] = template[6] | (dispatch & 0x3ff);
+ idx = 7;
+#else
+ code[0] = template[0] | (dispatch >> 10);
+ code[1] = template[1];
+ __glapi_sparc_icache_flush(&code[0]);
+ code[2] = template[2] | (dispatch & 0x3ff);
+ idx = 3;
+#endif
+ code[idx + 0] = template[idx + 0];
+ __glapi_sparc_icache_flush(&code[idx - 1]);
+ code[idx + 1] = template[idx + 1];
+ code[idx + 2] = template[idx + 2];
+ __glapi_sparc_icache_flush(&code[idx + 1]);
+ code[idx + 3] = template[idx + 3];
+ code[idx + 4] = template[idx + 4];
+ __glapi_sparc_icache_flush(&code[idx + 3]);
+ code[idx + 5] = template[idx + 5];
+ code[idx + 6] = template[idx + 6];
+ __glapi_sparc_icache_flush(&code[idx + 5]);
+ code[idx + 7] = template[idx + 7];
+ code[idx + 8] = template[idx + 8] |
+ (((call_dest - ((unsigned long) &code[idx + 8]))
+ >> 2) & 0x3fffffff);
+ __glapi_sparc_icache_flush(&code[idx + 7]);
+ code[idx + 9] = template[idx + 9];
+ code[idx + 10] = template[idx + 10];
+ __glapi_sparc_icache_flush(&code[idx + 9]);
+ code[idx + 11] = template[idx + 11];
+ code[idx + 12] = template[idx + 12];
+ __glapi_sparc_icache_flush(&code[idx + 11]);
+ code[idx + 13] = template[idx + 13];
+ __glapi_sparc_icache_flush(&code[idx + 13]);
+#endif
+#endif
}
#endif /* defined(PTHREADS) || defined(GLX_USE_TLS) */
diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c
index 4adc1aece0..764e2ef98e 100644
--- a/src/mesa/glapi/glapi_getproc.c
+++ b/src/mesa/glapi/glapi_getproc.c
@@ -259,53 +259,30 @@ generate_entrypoint(GLuint functionOffset)
}
return (_glapi_proc) code;
-#elif defined(USE_SPARC_ASM)
-
-#ifdef __arch64__
- static const unsigned int insn_template[] = {
- 0x05000000, /* sethi %uhi(_glapi_Dispatch), %g2 */
- 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */
- 0x8410a000, /* or %g2, %ulo(_glapi_Dispatch), %g2 */
- 0x82106000, /* or %g1, %lo(_glapi_Dispatch), %g1 */
- 0x8528b020, /* sllx %g2, 32, %g2 */
- 0xc2584002, /* ldx [%g1 + %g2], %g1 */
- 0x05000000, /* sethi %hi(8 * glapioffset), %g2 */
- 0x8410a000, /* or %g2, %lo(8 * glapioffset), %g2 */
- 0xc6584002, /* ldx [%g1 + %g2], %g3 */
- 0x81c0c000, /* jmpl %g3, %g0 */
- 0x01000000 /* nop */
+#elif defined(USE_SPARC_ASM) && (defined(PTHREADS) || defined(GLX_USE_TLS))
+ static const unsigned int template[] = {
+ 0x07000000, /* sethi %hi(0), %g3 */
+ 0x8210000f, /* mov %o7, %g1 */
+ 0x40000000, /* call */
+ 0x9e100001, /* mov %g1, %o7 */
};
+#ifdef GLX_USE_TLS
+ extern unsigned int __glapi_sparc_tls_stub;
+ unsigned long call_dest = (unsigned long ) &__glapi_sparc_tls_stub;
#else
- static const unsigned int insn_template[] = {
- 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */
- 0xc2006000, /* ld [%g1 + %lo(_glapi_Dispatch)], %g1 */
- 0xc6006000, /* ld [%g1 + %lo(4*glapioffset)], %g3 */
- 0x81c0c000, /* jmpl %g3, %g0 */
- 0x01000000 /* nop */
- };
-#endif /* __arch64__ */
- unsigned int *code = (unsigned int *) malloc(sizeof(insn_template));
- unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch;
+ extern unsigned int __glapi_sparc_pthread_stub;
+ unsigned long call_dest = (unsigned long ) &__glapi_sparc_pthread_stub;
+#endif
+ unsigned int *code = (unsigned int *) malloc(sizeof(template));
if (code) {
- memcpy(code, insn_template, sizeof(insn_template));
-
-#ifdef __arch64__
- code[0] |= (glapi_addr >> (32 + 10));
- code[1] |= ((glapi_addr & 0xffffffff) >> 10);
+ code[0] = template[0] | (functionOffset & 0x3fffff);
+ code[1] = template[1];
__glapi_sparc_icache_flush(&code[0]);
- code[2] |= ((glapi_addr >> 32) & ((1 << 10) - 1));
- code[3] |= (glapi_addr & ((1 << 10) - 1));
+ code[2] = template[2] |
+ (((call_dest - ((unsigned long) &code[2]))
+ >> 2) & 0x3fffffff);
+ code[3] = template[3];
__glapi_sparc_icache_flush(&code[2]);
- code[6] |= ((functionOffset * 8) >> 10);
- code[7] |= ((functionOffset * 8) & ((1 << 10) - 1));
- __glapi_sparc_icache_flush(&code[6]);
-#else
- code[0] |= (glapi_addr >> 10);
- code[1] |= (glapi_addr & ((1 << 10) - 1));
- __glapi_sparc_icache_flush(&code[0]);
- code[2] |= (functionOffset * 4);
- __glapi_sparc_icache_flush(&code[2]);
-#endif /* __arch64__ */
}
return (_glapi_proc) code;
#else
@@ -337,21 +314,10 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
#endif
#elif defined(USE_SPARC_ASM)
-
- /* XXX this hasn't been tested! */
unsigned int *code = (unsigned int *) entrypoint;
-#ifdef __arch64__
- code[6] = 0x05000000; /* sethi %hi(8 * glapioffset), %g2 */
- code[7] = 0x8410a000; /* or %g2, %lo(8 * glapioffset), %g2 */
- code[6] |= ((offset * 8) >> 10);
- code[7] |= ((offset * 8) & ((1 << 10) - 1));
- __glapi_sparc_icache_flush(&code[6]);
-#else /* __arch64__ */
- code[2] = 0xc6006000; /* ld [%g1 + %lo(4*glapioffset)], %g3 */
- code[2] |= (offset * 4);
- __glapi_sparc_icache_flush(&code[2]);
-#endif /* __arch64__ */
-
+ code[0] &= ~0x3fffff;
+ code[0] |= (offset * sizeof(void *)) & 0x3fffff;
+ __glapi_sparc_icache_flush(&code[0]);
#else
/* an unimplemented architecture */
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 996033a2d8..de27917709 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -59,6 +59,102 @@
/**
+ * glEnable()/glDisable() attribute group (GL_ENABLE_BIT).
+ */
+struct gl_enable_attrib
+{
+ GLboolean AlphaTest;
+ GLboolean AutoNormal;
+ GLboolean Blend;
+ GLbitfield ClipPlanes;
+ GLboolean ColorMaterial;
+ GLboolean ColorTable[COLORTABLE_MAX];
+ GLboolean Convolution1D;
+ GLboolean Convolution2D;
+ GLboolean Separable2D;
+ GLboolean CullFace;
+ GLboolean DepthTest;
+ GLboolean Dither;
+ GLboolean Fog;
+ GLboolean Histogram;
+ GLboolean Light[MAX_LIGHTS];
+ GLboolean Lighting;
+ GLboolean LineSmooth;
+ GLboolean LineStipple;
+ GLboolean IndexLogicOp;
+ GLboolean ColorLogicOp;
+
+ GLboolean Map1Color4;
+ GLboolean Map1Index;
+ GLboolean Map1Normal;
+ GLboolean Map1TextureCoord1;
+ GLboolean Map1TextureCoord2;
+ GLboolean Map1TextureCoord3;
+ GLboolean Map1TextureCoord4;
+ GLboolean Map1Vertex3;
+ GLboolean Map1Vertex4;
+ GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */
+ GLboolean Map2Color4;
+ GLboolean Map2Index;
+ GLboolean Map2Normal;
+ GLboolean Map2TextureCoord1;
+ GLboolean Map2TextureCoord2;
+ GLboolean Map2TextureCoord3;
+ GLboolean Map2TextureCoord4;
+ GLboolean Map2Vertex3;
+ GLboolean Map2Vertex4;
+ GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */
+
+ GLboolean MinMax;
+ GLboolean Normalize;
+ GLboolean PixelTexture;
+ GLboolean PointSmooth;
+ GLboolean PolygonOffsetPoint;
+ GLboolean PolygonOffsetLine;
+ GLboolean PolygonOffsetFill;
+ GLboolean PolygonSmooth;
+ GLboolean PolygonStipple;
+ GLboolean RescaleNormals;
+ GLboolean Scissor;
+ GLboolean Stencil;
+ GLboolean StencilTwoSide; /* GL_EXT_stencil_two_side */
+ GLboolean MultisampleEnabled; /* GL_ARB_multisample */
+ GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */
+ GLboolean SampleAlphaToOne; /* GL_ARB_multisample */
+ GLboolean SampleCoverage; /* GL_ARB_multisample */
+ GLboolean SampleCoverageInvert; /* GL_ARB_multisample */
+ GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */
+
+ GLbitfield Texture[MAX_TEXTURE_UNITS];
+ GLbitfield TexGen[MAX_TEXTURE_UNITS];
+
+ /* SGI_texture_color_table */
+ GLboolean TextureColorTable[MAX_TEXTURE_UNITS];
+
+ /* GL_ARB_vertex_program / GL_NV_vertex_program */
+ GLboolean VertexProgram;
+ GLboolean VertexProgramPointSize;
+ GLboolean VertexProgramTwoSide;
+
+ /* GL_ARB_point_sprite / GL_NV_point_sprite */
+ GLboolean PointSprite;
+ GLboolean FragmentShaderATI;
+};
+
+
+/**
+ * Node for the attribute stack.
+ */
+struct gl_attrib_node
+{
+ GLbitfield kind;
+ void *data;
+ struct gl_attrib_node *next;
+};
+
+
+
+/**
* Special struct for saving/restoring texture state (GL_TEXTURE_BIT)
*/
struct texture_state
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 016543da01..c8d160baa9 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1,8 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 7.2
+ * Version: 7.5
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -25,7 +26,7 @@
/**
* \file bufferobj.c
- * \brief Functions for the GL_ARB_vertex_buffer_object extension.
+ * \brief Functions for the GL_ARB_vertex/pixel_buffer_object extensions.
* \author Brian Paul, Ian Romanick
*/
@@ -144,8 +145,7 @@ buffer_object_subdata_range_good( GLcontext * ctx, GLenum target,
/**
* Allocate and initialize a new buffer object.
*
- * This function is intended to be called via
- * \c dd_function_table::NewBufferObject.
+ * Default callback for the \c dd_function_table::NewBufferObject() hook.
*/
struct gl_buffer_object *
_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target )
@@ -163,8 +163,7 @@ _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target )
/**
* Delete a buffer object.
*
- * This function is intended to be called via
- * \c dd_function_table::DeleteBuffer.
+ * Default callback for the \c dd_function_table::DeleteBuffer() hook.
*/
void
_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj )
@@ -271,9 +270,8 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj,
* previously stored in the buffer object is lost. If \c data is \c NULL,
* memory will be allocated, but no copy will occur.
*
- * This function is intended to be called via
- * \c dd_function_table::BufferData. This function need not set GL error
- * codes. The input parameters will have been tested before calling.
+ * This is the default callback for \c dd_function_table::BufferData()
+ * Note that all GL error checking will have been done already.
*
* \param ctx GL context.
* \param target Buffer object target on which to operate.
@@ -312,9 +310,8 @@ _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
* specified by \c size + \c offset extends beyond the end of the buffer or
* if \c data is \c NULL, no copy is performed.
*
- * This function is intended to be called by
- * \c dd_function_table::BufferSubData. This function need not set GL error
- * codes. The input parameters will have been tested before calling.
+ * This is the default callback for \c dd_function_table::BufferSubData()
+ * Note that all GL error checking will have been done already.
*
* \param ctx GL context.
* \param target Buffer object target on which to operate.
@@ -346,15 +343,14 @@ _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
* specified by \c size + \c offset extends beyond the end of the buffer or
* if \c data is \c NULL, no copy is performed.
*
- * This function is intended to be called by
- * \c dd_function_table::BufferGetSubData. This function need not set GL error
- * codes. The input parameters will have been tested before calling.
+ * This is the default callback for \c dd_function_table::GetBufferSubData()
+ * Note that all GL error checking will have been done already.
*
* \param ctx GL context.
* \param target Buffer object target on which to operate.
- * \param offset Offset of the first byte to be modified.
+ * \param offset Offset of the first byte to be fetched.
* \param size Size, in bytes, of the data range.
- * \param data Pointer to the data to store in the buffer object.
+ * \param data Destination for data
* \param bufObj Object to be used.
*
* \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData.
@@ -373,9 +369,7 @@ _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
/**
- * Fallback function called via ctx->Driver.MapBuffer().
- * Hardware drivers that really implement buffer objects should never use
- * this function.
+ * Default callback for \c dd_function_tabel::MapBuffer().
*
* The function parameters will have been already tested for errors.
*
@@ -407,9 +401,7 @@ _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access,
/**
- * Fallback function called via ctx->Driver.MapBuffer().
- * Hardware drivers that really implement buffer objects should never use
- * function.
+ * Default callback for \c dd_function_table::MapBuffer().
*
* The input parameters will have been already tested for errors.
*
@@ -446,6 +438,7 @@ _mesa_init_buffer_objects( GLcontext *ctx )
ctx->Array.ElementArrayBufferObj = ctx->Array.NullBufferObj;
}
+
/**
* Bind the specified target to buffer for the specified context.
*/
@@ -796,11 +789,18 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
for (i = 0; i < n; i++) {
struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]);
if (bufObj) {
- /* unbind any vertex pointers bound to this buffer */
GLuint j;
ASSERT(bufObj->Name == ids[i]);
+ if (bufObj->Pointer) {
+ /* if mapped, unmap it now */
+ ctx->Driver.UnmapBuffer(ctx, 0, bufObj);
+ bufObj->Access = DEFAULT_ACCESS;
+ bufObj->Pointer = NULL;
+ }
+
+ /* unbind any vertex pointers bound to this buffer */
unbind(ctx, &ctx->Array.ArrayObj->Vertex.BufferObj, bufObj);
unbind(ctx, &ctx->Array.ArrayObj->Normal.BufferObj, bufObj);
unbind(ctx, &ctx->Array.ArrayObj->Color.BufferObj, bufObj);
@@ -822,6 +822,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
_mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
}
+ /* unbind any pixel pack/unpack pointers bound to this buffer */
if (ctx->Pack.BufferObj == bufObj) {
_mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 );
}
@@ -951,8 +952,10 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
}
if (bufObj->Pointer) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer is mapped)" );
- return;
+ /* Unmap the existing buffer. We'll replace it now. Not an error. */
+ ctx->Driver.UnmapBuffer(ctx, target, bufObj);
+ bufObj->Access = DEFAULT_ACCESS;
+ bufObj->Pointer = NULL;
}
ASSERT(ctx->Driver.BufferData);
@@ -1068,10 +1071,7 @@ _mesa_UnmapBufferARB(GLenum target)
return GL_FALSE;
}
- if (ctx->Driver.UnmapBuffer) {
- status = ctx->Driver.UnmapBuffer( ctx, target, bufObj );
- }
-
+ status = ctx->Driver.UnmapBuffer( ctx, target, bufObj );
bufObj->Access = DEFAULT_ACCESS;
bufObj->Pointer = NULL;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index a94bbf3fdf..97ee925c0b 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -351,6 +351,36 @@ _mesa_destroy_visual( GLvisual *vis )
/**********************************************************************/
/*@{*/
+
+/**
+ * This is lame. gdb only seems to recognize enum types that are
+ * actually used somewhere. We want to be able to print/use enum
+ * values such as TEXTURE_2D_INDEX in gdb. But we don't actually use
+ * the gl_texture_index type anywhere. Thus, this lame function.
+ */
+static void
+dummy_enum_func(void)
+{
+ gl_buffer_index bi;
+ gl_colortable_index ci;
+ gl_face_index fi;
+ gl_frag_attrib fa;
+ gl_frag_result fr;
+ gl_texture_index ti;
+ gl_vert_attrib va;
+ gl_vert_result vr;
+
+ (void) bi;
+ (void) ci;
+ (void) fi;
+ (void) fa;
+ (void) fr;
+ (void) ti;
+ (void) va;
+ (void) vr;
+}
+
+
/**
* One-time initialization mutex lock.
*
@@ -390,9 +420,6 @@ one_time_init( GLcontext *ctx )
_mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
}
-#ifdef USE_SPARC_ASM
- _mesa_init_sparc_glapi_relocs();
-#endif
if (_mesa_getenv("MESA_DEBUG")) {
_glapi_noop_enable_warnings(GL_TRUE);
_glapi_set_warning_func( (_glapi_warning_func) _mesa_warning );
@@ -409,6 +436,8 @@ one_time_init( GLcontext *ctx )
alreadyCalled = GL_TRUE;
}
_glthread_UNLOCK_MUTEX(OneTimeLock);
+
+ dummy_enum_func();
}
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 13cfa0e756..e9de0c097a 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -103,7 +103,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
else if (ctx->RenderMode == GL_FEEDBACK) {
/* Feedback the current raster pos info */
FLUSH_CURRENT( ctx, 0 );
- FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
+ _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
_mesa_feedback_vertex( ctx,
ctx->Current.RasterPos,
ctx->Current.RasterColor,
@@ -166,7 +166,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
}
else if (ctx->RenderMode == GL_FEEDBACK) {
FLUSH_CURRENT( ctx, 0 );
- FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN );
+ _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN );
_mesa_feedback_vertex( ctx,
ctx->Current.RasterPos,
ctx->Current.RasterColor,
@@ -243,7 +243,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
#if _HAVE_FULL_GL
else if (ctx->RenderMode == GL_FEEDBACK) {
FLUSH_CURRENT(ctx, 0);
- FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN );
+ _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN );
_mesa_feedback_vertex( ctx,
ctx->Current.RasterPos,
ctx->Current.RasterColor,
@@ -311,7 +311,7 @@ _mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height,
else if (ctx->RenderMode == GL_FEEDBACK) {
/* Feedback the current raster pos info */
FLUSH_CURRENT( ctx, 0 );
- FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
+ _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
_mesa_feedback_vertex( ctx,
ctx->Current.RasterPos,
ctx->Current.RasterColor,
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 23b3fb68fb..151e29053a 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1229,19 +1229,26 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
ASSERT(newFb != &DummyFramebuffer);
/*
- * XXX check if re-binding same buffer and skip some of this code.
+ * OK, now bind the new Draw/Read framebuffers, if they're changing.
*/
if (bindReadBuf) {
- _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread);
+ if (ctx->ReadBuffer == newFbread)
+ bindReadBuf = GL_FALSE; /* no change */
+ else
+ _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread);
}
if (bindDrawBuf) {
/* check if old FB had any texture attachments */
- check_end_texture_render(ctx, ctx->DrawBuffer);
+ if (ctx->DrawBuffer->Name != 0) {
+ check_end_texture_render(ctx, ctx->DrawBuffer);
+ }
- /* check if time to delete this framebuffer */
- _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb);
+ if (ctx->DrawBuffer == newFb)
+ bindDrawBuf = GL_FALSE; /* no change */
+ else
+ _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb);
if (newFb->Name != 0) {
/* check if newly bound framebuffer has any texture attachments */
@@ -1249,7 +1256,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
}
}
- if (ctx->Driver.BindFramebuffer) {
+ if ((bindDrawBuf || bindReadBuf) && ctx->Driver.BindFramebuffer) {
ctx->Driver.BindFramebuffer(ctx, target, newFb, newFbread);
}
}
diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index 48c2ccbff3..beab535b15 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -1,13 +1,9 @@
-/**
- * \file feedback.c
- * Selection and feedback modes functions.
- */
-
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 7.5
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,6 +23,11 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/**
+ * \file feedback.c
+ * Selection and feedback modes functions.
+ */
+
#include "glheader.h"
#include "colormac.h"
@@ -110,60 +111,49 @@ _mesa_PassThrough( GLfloat token )
if (ctx->RenderMode==GL_FEEDBACK) {
FLUSH_VERTICES(ctx, 0);
- FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN );
- FEEDBACK_TOKEN( ctx, token );
+ _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN );
+ _mesa_feedback_token( ctx, token );
}
}
-
-/*
+/**
* Put a vertex into the feedback buffer.
*/
-void _mesa_feedback_vertex( GLcontext *ctx,
- const GLfloat win[4],
- const GLfloat color[4],
- GLfloat index,
- const GLfloat texcoord[4] )
+void
+_mesa_feedback_vertex(GLcontext *ctx,
+ const GLfloat win[4],
+ const GLfloat color[4],
+ GLfloat index,
+ const GLfloat texcoord[4])
{
-#if 0
- {
- /* snap window x, y to fractional pixel position */
- const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1);
- GLfixed x, y;
- x = FloatToFixed(win[0]) & snapMask;
- y = FloatToFixed(win[1]) & snapMask;
- FEEDBACK_TOKEN(ctx, FixedToFloat(x));
- FEEDBACK_TOKEN(ctx, FixedToFloat(y) );
- }
-#else
- FEEDBACK_TOKEN( ctx, win[0] );
- FEEDBACK_TOKEN( ctx, win[1] );
-#endif
+ _mesa_feedback_token( ctx, win[0] );
+ _mesa_feedback_token( ctx, win[1] );
if (ctx->Feedback._Mask & FB_3D) {
- FEEDBACK_TOKEN( ctx, win[2] );
+ _mesa_feedback_token( ctx, win[2] );
}
if (ctx->Feedback._Mask & FB_4D) {
- FEEDBACK_TOKEN( ctx, win[3] );
+ _mesa_feedback_token( ctx, win[3] );
}
if (ctx->Feedback._Mask & FB_INDEX) {
- FEEDBACK_TOKEN( ctx, (GLfloat) index );
+ _mesa_feedback_token( ctx, (GLfloat) index );
}
if (ctx->Feedback._Mask & FB_COLOR) {
- FEEDBACK_TOKEN( ctx, color[0] );
- FEEDBACK_TOKEN( ctx, color[1] );
- FEEDBACK_TOKEN( ctx, color[2] );
- FEEDBACK_TOKEN( ctx, color[3] );
+ _mesa_feedback_token( ctx, color[0] );
+ _mesa_feedback_token( ctx, color[1] );
+ _mesa_feedback_token( ctx, color[2] );
+ _mesa_feedback_token( ctx, color[3] );
}
if (ctx->Feedback._Mask & FB_TEXTURE) {
- FEEDBACK_TOKEN( ctx, texcoord[0] );
- FEEDBACK_TOKEN( ctx, texcoord[1] );
- FEEDBACK_TOKEN( ctx, texcoord[2] );
- FEEDBACK_TOKEN( ctx, texcoord[3] );
+ _mesa_feedback_token( ctx, texcoord[0] );
+ _mesa_feedback_token( ctx, texcoord[1] );
+ _mesa_feedback_token( ctx, texcoord[2] );
+ _mesa_feedback_token( ctx, texcoord[3] );
}
}
-#endif
+
+#endif /* _HAVE_FULL_GL */
/**********************************************************************/
@@ -213,11 +203,14 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer )
* Verifies there is free space in the buffer to write the value and
* increments the pointer.
*/
-#define WRITE_RECORD( CTX, V ) \
- if (CTX->Select.BufferCount < CTX->Select.BufferSize) { \
- CTX->Select.Buffer[CTX->Select.BufferCount] = (V); \
- } \
- CTX->Select.BufferCount++;
+static INLINE void
+write_record(GLcontext *ctx, GLuint value)
+{
+ if (ctx->Select.BufferCount < ctx->Select.BufferSize) {
+ ctx->Select.Buffer[ctx->Select.BufferCount] = value;
+ }
+ ctx->Select.BufferCount++;
+}
/**
@@ -229,7 +222,8 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer )
* Sets gl_selection::HitFlag and updates gl_selection::HitMinZ and
* gl_selection::HitMaxZ.
*/
-void _mesa_update_hitflag( GLcontext *ctx, GLfloat z )
+void
+_mesa_update_hitflag(GLcontext *ctx, GLfloat z)
{
ctx->Select.HitFlag = GL_TRUE;
if (z < ctx->Select.HitMinZ) {
@@ -252,7 +246,8 @@ void _mesa_update_hitflag( GLcontext *ctx, GLfloat z )
*
* \sa gl_selection.
*/
-static void write_hit_record( GLcontext *ctx )
+static void
+write_hit_record(GLcontext *ctx)
{
GLuint i;
GLuint zmin, zmax, zscale = (~0u);
@@ -264,11 +259,11 @@ static void write_hit_record( GLcontext *ctx )
zmin = (GLuint) ((GLfloat) zscale * ctx->Select.HitMinZ);
zmax = (GLuint) ((GLfloat) zscale * ctx->Select.HitMaxZ);
- WRITE_RECORD( ctx, ctx->Select.NameStackDepth );
- WRITE_RECORD( ctx, zmin );
- WRITE_RECORD( ctx, zmax );
+ write_record( ctx, ctx->Select.NameStackDepth );
+ write_record( ctx, zmin );
+ write_record( ctx, zmax );
for (i = 0; i < ctx->Select.NameStackDepth; i++) {
- WRITE_RECORD( ctx, ctx->Select.NameStack[i] );
+ write_record( ctx, ctx->Select.NameStack[i] );
}
ctx->Select.Hits++;
diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h
index 6c448ad631..72c2acd5ed 100644
--- a/src/mesa/main/feedback.h
+++ b/src/mesa/main/feedback.h
@@ -1,13 +1,9 @@
-/**
- * \file feedback.h
- * Selection and feedback modes functions.
- */
-
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 7.5
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,7 +23,6 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
#ifndef FEEDBACK_H
#define FEEDBACK_H
@@ -35,23 +30,29 @@
#include "mtypes.h"
-#define FEEDBACK_TOKEN( CTX, T ) \
- if (CTX->Feedback.Count < CTX->Feedback.BufferSize) { \
- CTX->Feedback.Buffer[CTX->Feedback.Count] = (GLfloat) (T); \
- } \
- CTX->Feedback.Count++;
+extern void
+_mesa_init_feedback( GLcontext *ctx );
+extern void
+_mesa_feedback_vertex( GLcontext *ctx,
+ const GLfloat win[4],
+ const GLfloat color[4],
+ GLfloat index,
+ const GLfloat texcoord[4] );
-extern void _mesa_init_feedback( GLcontext * ctx );
-extern void _mesa_feedback_vertex( GLcontext *ctx,
- const GLfloat win[4],
- const GLfloat color[4],
- GLfloat index,
- const GLfloat texcoord[4] );
+static INLINE void
+_mesa_feedback_token( GLcontext *ctx, GLfloat token )
+{
+ if (ctx->Feedback.Count < ctx->Feedback.BufferSize) {
+ ctx->Feedback.Buffer[ctx->Feedback.Count] = token;
+ }
+ ctx->Feedback.Count++;
+}
-extern void _mesa_update_hitflag( GLcontext *ctx, GLfloat z );
+extern void
+_mesa_update_hitflag( GLcontext *ctx, GLfloat z );
extern void GLAPIENTRY
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 482a36de93..ad095321e3 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -52,7 +52,7 @@
#define GL_GLEXT_PROTOTYPES
#include "GL/gl.h"
#include "GL/glext.h"
-#include <GL/internal/glcore.h>
+#include "GL/internal/glcore.h"
#ifndef GL_FIXED
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 4192f037c0..7b61e22e93 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -256,15 +256,7 @@ static INLINE int GET_FLOAT_BITS( float x )
/***
*** IROUND: return (as an integer) float rounded to nearest integer
***/
-#if defined(USE_SPARC_ASM) && defined(__GNUC__) && defined(__sparc__)
-static INLINE int iround(float f)
-{
- int r;
- __asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f));
- return r;
-}
-#define IROUND(x) iround(x)
-#elif defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) && \
+#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) && \
(!(defined(__BEOS__) || defined(__HAIKU__)) || \
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)))
static INLINE int iround(float f)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index e80d3db043..f17b9e1e71 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -38,7 +38,6 @@
#include "main/config.h"
#include "main/compiler.h"
#include "main/mfeatures.h"
-#include "main/bitset.h"
#include "glapi/glapi.h"
#include "math/m_matrix.h" /* GLmatrix */
@@ -79,42 +78,11 @@
/**
- * Fixed point data type.
- */
-typedef int GLfixed;
-/*
- * Fixed point arithmetic macros
- */
-#ifndef FIXED_FRAC_BITS
-#define FIXED_FRAC_BITS 11
-#endif
-
-#define FIXED_SHIFT FIXED_FRAC_BITS
-#define FIXED_ONE (1 << FIXED_SHIFT)
-#define FIXED_HALF (1 << (FIXED_SHIFT-1))
-#define FIXED_FRAC_MASK (FIXED_ONE - 1)
-#define FIXED_INT_MASK (~FIXED_FRAC_MASK)
-#define FIXED_EPSILON 1
-#define FIXED_SCALE ((float) FIXED_ONE)
-#define FIXED_DBL_SCALE ((double) FIXED_ONE)
-#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
-#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
-#define IntToFixed(I) ((I) << FIXED_SHIFT)
-#define FixedToInt(X) ((X) >> FIXED_SHIFT)
-#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT)
-#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
-#define FixedFloor(X) ((X) & FIXED_INT_MASK)
-#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
-#define PosFloatToFixed(X) FloatToFixed(X)
-#define SignedFloatToFixed(X) FloatToFixed(X)
-
-
-
-/**
* \name Some forward type declarations
*/
/*@{*/
struct _mesa_HashTable;
+struct gl_attrib_node;
struct gl_pixelstore_attrib;
struct gl_program_cache;
struct gl_texture_format;
@@ -135,7 +103,7 @@ typedef struct gl_framebuffer GLframebuffer;
* In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the
* generic attributes are distinct/separate).
*/
-enum
+typedef enum
{
VERT_ATTRIB_POS = 0,
VERT_ATTRIB_WEIGHT = 1,
@@ -171,7 +139,7 @@ enum
VERT_ATTRIB_GENERIC14 = 30,
VERT_ATTRIB_GENERIC15 = 31,
VERT_ATTRIB_MAX = 32
-};
+} gl_vert_attrib;
/**
* Bitflags for vertex attributes.
@@ -219,8 +187,7 @@ enum
/**
* Indexes for vertex program result attributes
*/
-/*@{*/
-enum
+typedef enum
{
VERT_RESULT_HPOS = 0,
VERT_RESULT_COL0 = 1,
@@ -240,14 +207,13 @@ enum
VERT_RESULT_EDGE = 15,
VERT_RESULT_VAR0 = 16 /**< shader varying */,
VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING)
-};
-/*@}*/
+} gl_vert_result;
/**
* Indexes for fragment program input attributes.
*/
-enum
+typedef enum
{
FRAG_ATTRIB_WPOS = 0,
FRAG_ATTRIB_COL0 = 1,
@@ -263,7 +229,7 @@ enum
FRAG_ATTRIB_TEX7 = 11,
FRAG_ATTRIB_VAR0 = 12, /**< shader varying */
FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING)
-};
+} gl_frag_attrib;
/**
* Bitflags for fragment program input attributes.
@@ -300,41 +266,44 @@ enum
/**
* Fragment program results
*/
-enum
+typedef enum
{
- FRAG_RESULT_COLR = 0,
- FRAG_RESULT_COLH = 1,
- FRAG_RESULT_DEPR = 2,
- FRAG_RESULT_DATA0 = 3,
+ FRAG_RESULT_DEPTH = 0,
+ FRAG_RESULT_COLOR = 1,
+ FRAG_RESULT_DATA0 = 2,
FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
-};
+} gl_frag_result;
/**
* Indexes for all renderbuffers
*/
-enum {
- BUFFER_FRONT_LEFT = 0, /* the four standard color buffers */
- BUFFER_BACK_LEFT = 1,
- BUFFER_FRONT_RIGHT = 2,
- BUFFER_BACK_RIGHT = 3,
- BUFFER_AUX0 = 4, /* optional aux buffer */
- BUFFER_AUX1 = 5,
- BUFFER_AUX2 = 6,
- BUFFER_AUX3 = 7,
- BUFFER_DEPTH = 8,
- BUFFER_STENCIL = 9,
- BUFFER_ACCUM = 10,
- BUFFER_COLOR0 = 11, /* generic renderbuffers */
- BUFFER_COLOR1 = 12,
- BUFFER_COLOR2 = 13,
- BUFFER_COLOR3 = 14,
- BUFFER_COLOR4 = 15,
- BUFFER_COLOR5 = 16,
- BUFFER_COLOR6 = 17,
- BUFFER_COLOR7 = 18,
- BUFFER_COUNT = 19
-};
+typedef enum
+{
+ /* the four standard color buffers */
+ BUFFER_FRONT_LEFT,
+ BUFFER_BACK_LEFT,
+ BUFFER_FRONT_RIGHT,
+ BUFFER_BACK_RIGHT,
+ /* optional aux buffers */
+ BUFFER_AUX0,
+ BUFFER_AUX1,
+ BUFFER_AUX2,
+ BUFFER_AUX3,
+ BUFFER_DEPTH,
+ BUFFER_STENCIL,
+ BUFFER_ACCUM,
+ /* generic renderbuffers */
+ BUFFER_COLOR0,
+ BUFFER_COLOR1,
+ BUFFER_COLOR2,
+ BUFFER_COLOR3,
+ BUFFER_COLOR4,
+ BUFFER_COLOR5,
+ BUFFER_COLOR6,
+ BUFFER_COLOR7,
+ BUFFER_COUNT
+} gl_buffer_index;
/**
* Bit flags for all renderbuffers
@@ -381,12 +350,13 @@ enum {
/** The pixel transfer path has three color tables: */
-/*@{*/
-#define COLORTABLE_PRECONVOLUTION 0
-#define COLORTABLE_POSTCONVOLUTION 1
-#define COLORTABLE_POSTCOLORMATRIX 2
-#define COLORTABLE_MAX 3
-/*@}*/
+typedef enum
+{
+ COLORTABLE_PRECONVOLUTION,
+ COLORTABLE_POSTCONVOLUTION,
+ COLORTABLE_POSTCOLORMATRIX,
+ COLORTABLE_MAX
+} gl_colortable_index;
/**
@@ -623,9 +593,7 @@ struct gl_current_attrib
* \note Index and Edgeflag current values are stored as floats in the
* SIX and SEVEN attribute slots.
*/
- /*@{*/
GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Position, color, texcoords, etc */
- /*@}*/
/**
* \name Current raster position attributes (always valid).
@@ -658,84 +626,6 @@ struct gl_depthbuffer_attrib
/**
- * glEnable()/glDisable() attribute group (GL_ENABLE_BIT).
- */
-struct gl_enable_attrib
-{
- GLboolean AlphaTest;
- GLboolean AutoNormal;
- GLboolean Blend;
- GLbitfield ClipPlanes;
- GLboolean ColorMaterial;
- GLboolean ColorTable[COLORTABLE_MAX];
- GLboolean Convolution1D;
- GLboolean Convolution2D;
- GLboolean Separable2D;
- GLboolean CullFace;
- GLboolean DepthTest;
- GLboolean Dither;
- GLboolean Fog;
- GLboolean Histogram;
- GLboolean Light[MAX_LIGHTS];
- GLboolean Lighting;
- GLboolean LineSmooth;
- GLboolean LineStipple;
- GLboolean IndexLogicOp;
- GLboolean ColorLogicOp;
- GLboolean Map1Color4;
- GLboolean Map1Index;
- GLboolean Map1Normal;
- GLboolean Map1TextureCoord1;
- GLboolean Map1TextureCoord2;
- GLboolean Map1TextureCoord3;
- GLboolean Map1TextureCoord4;
- GLboolean Map1Vertex3;
- GLboolean Map1Vertex4;
- GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */
- GLboolean Map2Color4;
- GLboolean Map2Index;
- GLboolean Map2Normal;
- GLboolean Map2TextureCoord1;
- GLboolean Map2TextureCoord2;
- GLboolean Map2TextureCoord3;
- GLboolean Map2TextureCoord4;
- GLboolean Map2Vertex3;
- GLboolean Map2Vertex4;
- GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */
- GLboolean MinMax;
- GLboolean Normalize;
- GLboolean PixelTexture;
- GLboolean PointSmooth;
- GLboolean PolygonOffsetPoint;
- GLboolean PolygonOffsetLine;
- GLboolean PolygonOffsetFill;
- GLboolean PolygonSmooth;
- GLboolean PolygonStipple;
- GLboolean RescaleNormals;
- GLboolean Scissor;
- GLboolean Stencil;
- GLboolean StencilTwoSide; /* GL_EXT_stencil_two_side */
- GLboolean MultisampleEnabled; /* GL_ARB_multisample */
- GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */
- GLboolean SampleAlphaToOne; /* GL_ARB_multisample */
- GLboolean SampleCoverage; /* GL_ARB_multisample */
- GLboolean SampleCoverageInvert; /* GL_ARB_multisample */
- GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */
- GLuint Texture[MAX_TEXTURE_UNITS];
- GLuint TexGen[MAX_TEXTURE_UNITS];
- /* SGI_texture_color_table */
- GLboolean TextureColorTable[MAX_TEXTURE_UNITS];
- /* GL_ARB_vertex_program / GL_NV_vertex_program */
- GLboolean VertexProgram;
- GLboolean VertexProgramPointSize;
- GLboolean VertexProgramTwoSide;
- /* GL_ARB_point_sprite / GL_NV_point_sprite */
- GLboolean PointSprite;
- GLboolean FragmentShaderATI;
-};
-
-
-/**
* Evaluator attribute group (GL_EVAL_BIT).
*/
struct gl_eval_attrib
@@ -822,11 +712,11 @@ struct gl_hint_attrib
*/
struct gl_histogram_attrib
{
- GLuint Width; /**< number of table entries */
- GLint Format; /**< GL_ALPHA, GL_RGB, etc */
- GLuint Count[HISTOGRAM_TABLE_SIZE][4]; /**< the histogram */
- GLboolean Sink; /**< terminate image transfer? */
- GLubyte RedSize; /**< Bits per counter */
+ GLuint Width; /**< number of table entries */
+ GLint Format; /**< GL_ALPHA, GL_RGB, etc */
+ GLuint Count[HISTOGRAM_TABLE_SIZE][4]; /**< the histogram */
+ GLboolean Sink; /**< terminate image transfer? */
+ GLubyte RedSize; /**< Bits per counter */
GLubyte GreenSize;
GLubyte BlueSize;
GLubyte AlphaSize;
@@ -1005,13 +895,15 @@ struct gl_pixel_attrib
/*--- Begin Pixel Transfer State ---*/
/* Fields are in the order in which they're applied... */
- /* Scale & Bias (index shift, offset) */
+ /** Scale & Bias (index shift, offset) */
+ /*@{*/
GLfloat RedBias, RedScale;
GLfloat GreenBias, GreenScale;
GLfloat BlueBias, BlueScale;
GLfloat AlphaBias, AlphaScale;
GLfloat DepthBias, DepthScale;
GLint IndexShift, IndexOffset;
+ /*@}*/
/* Pixel Maps */
/* Note: actual pixel maps are not part of this attrib group */
@@ -1027,7 +919,7 @@ struct gl_pixel_attrib
GLboolean Convolution1DEnabled;
GLboolean Convolution2DEnabled;
GLboolean Separable2DEnabled;
- GLfloat ConvolutionBorderColor[3][4];
+ GLfloat ConvolutionBorderColor[3][4]; /**< RGBA */
GLenum ConvolutionBorderMode[3];
GLfloat ConvolutionFilterScale[3][4]; /**< RGBA */
GLfloat ConvolutionFilterBias[3][4]; /**< RGBA */
@@ -1144,7 +1036,8 @@ struct gl_stencil_attrib
* target target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc.
* Note: the order is from highest priority to lowest priority.
*/
-enum {
+typedef enum
+{
TEXTURE_2D_ARRAY_INDEX,
TEXTURE_1D_ARRAY_INDEX,
TEXTURE_CUBE_INDEX,
@@ -1153,7 +1046,7 @@ enum {
TEXTURE_2D_INDEX,
TEXTURE_1D_INDEX,
NUM_TEXTURE_TARGETS
-};
+} gl_texture_index;
/**
@@ -1383,15 +1276,16 @@ struct gl_texture_image
/**
* Indexes for cube map faces.
*/
-/*@{*/
-#define FACE_POS_X 0
-#define FACE_NEG_X 1
-#define FACE_POS_Y 2
-#define FACE_NEG_Y 3
-#define FACE_POS_Z 4
-#define FACE_NEG_Z 5
-#define MAX_FACES 6
-/*@}*/
+typedef enum
+{
+ FACE_POS_X = 0,
+ FACE_NEG_X = 1,
+ FACE_POS_Y = 2,
+ FACE_NEG_Y = 3,
+ FACE_POS_Z = 4,
+ FACE_NEG_Z = 5,
+ MAX_FACES = 6
+} gl_face_index;
/**
@@ -1538,24 +1432,12 @@ struct gl_texture_unit
};
-
/**
* Texture attribute group (GL_TEXTURE_BIT).
*/
struct gl_texture_attrib
{
- /**
- * name multitexture
- */
- /**@{*/
- GLuint CurrentUnit; /**< Active texture unit [0, MaxTextureImageUnits-1] */
- GLbitfield _EnabledUnits; /**< one bit set for each really-enabled unit */
- GLbitfield _EnabledCoordUnits; /**< one bit per enabled coordinate unit */
- GLbitfield _GenFlags; /**< for texgen */
- GLbitfield _TexGenEnabled; /**< Mask of ENABLE_TEXGEN flags */
- GLbitfield _TexMatEnabled; /**< Mask of ENABLE_TEXMAT flags */
- /**@}*/
-
+ GLuint CurrentUnit; /**< GL_ACTIVE_TEXTURE */
struct gl_texture_unit Unit[MAX_TEXTURE_UNITS];
struct gl_texture_object *ProxyTex[NUM_TEXTURE_TARGETS];
@@ -1563,6 +1445,15 @@ struct gl_texture_attrib
/** GL_EXT_shared_texture_palette */
GLboolean SharedPalette;
struct gl_color_table Palette;
+
+ /** Per-unit flags */
+ /*@{*/
+ GLbitfield _EnabledUnits; /**< one bit set for each really-enabled unit */
+ GLbitfield _EnabledCoordUnits; /**< one bit per enabled coordinate unit */
+ GLbitfield _GenFlags; /**< for texgen */
+ GLbitfield _TexGenEnabled; /**< Mask of ENABLE_TEXGEN flags */
+ GLbitfield _TexMatEnabled; /**< Mask of ENABLE_TEXMAT flags */
+ /*@}*/
};
@@ -1598,17 +1489,6 @@ struct gl_viewport_attrib
/**
- * Node for the attribute stack.
- */
-struct gl_attrib_node
-{
- GLbitfield kind;
- void *data;
- struct gl_attrib_node *next;
-};
-
-
-/**
* GL_ARB_vertex/pixel_buffer_object buffer object
*/
struct gl_buffer_object
@@ -1624,7 +1504,6 @@ struct gl_buffer_object
};
-
/**
* Client pixel packing/unpacking attributes
*/
@@ -1634,8 +1513,8 @@ struct gl_pixelstore_attrib
GLint RowLength;
GLint SkipPixels;
GLint SkipRows;
- GLint ImageHeight; /**< for GL_EXT_texture3D */
- GLint SkipImages; /**< for GL_EXT_texture3D */
+ GLint ImageHeight;
+ GLint SkipImages;
GLboolean SwapBytes;
GLboolean LsbFirst;
GLboolean ClientStorage; /**< GL_APPLE_client_storage */
@@ -1644,7 +1523,6 @@ struct gl_pixelstore_attrib
};
-
/**
* Client vertex array attributes
*/
@@ -1724,7 +1602,7 @@ struct gl_array_attrib
struct gl_feedback
{
GLenum Type;
- GLbitfield _Mask; /* FB_* bits */
+ GLbitfield _Mask; /**< FB_* bits */
GLfloat *Buffer;
GLuint BufferSize;
GLuint Count;
@@ -1948,14 +1826,14 @@ struct gl_program_state
*/
struct gl_vertex_program_state
{
- GLboolean Enabled; /**< User-set GL_VERTEX_PROGRAM_ARB/NV flag */
- GLboolean _Enabled; /**< Enabled and _valid_ user program? */
- GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
- GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
+ GLboolean Enabled; /**< User-set GL_VERTEX_PROGRAM_ARB/NV flag */
+ GLboolean _Enabled; /**< Enabled and _valid_ user program? */
+ GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
+ GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
struct gl_vertex_program *Current; /**< User-bound vertex program */
- /** Currently enabled and valid vertex program (including internal programs,
- * user-defined vertex programs and GLSL vertex shaders).
+ /** Currently enabled and valid vertex program (including internal
+ * programs, user-defined vertex programs and GLSL vertex shaders).
* This is the program we must use when rendering.
*/
struct gl_vertex_program *_Current;
@@ -1995,8 +1873,8 @@ struct gl_fragment_program_state
GLboolean _Enabled; /**< Enabled and _valid_ user program? */
struct gl_fragment_program *Current; /**< User-bound fragment program */
- /** Currently enabled and valid fragment program (including internal programs,
- * user-defined fragment programs and GLSL fragment shaders).
+ /** Currently enabled and valid fragment program (including internal
+ * programs, user-defined fragment programs and GLSL fragment shaders).
* This is the program we must use when rendering.
*/
struct gl_fragment_program *_Current;
@@ -2339,9 +2217,8 @@ struct gl_renderbuffer
/**
- * A renderbuffer attachment point points to either a texture object
- * (and specifies a mipmap level, cube face or 3D texture slice) or
- * points to a renderbuffer.
+ * A renderbuffer attachment points to either a texture object (and specifies
+ * a mipmap level, cube face or 3D texture slice) or points to a renderbuffer.
*/
struct gl_renderbuffer_attachment
{
@@ -2373,14 +2250,16 @@ struct gl_renderbuffer_attachment
*/
struct gl_framebuffer
{
- _glthread_Mutex Mutex; /**< for thread safety */
- GLuint Name; /* if zero, this is a window system framebuffer */
+ _glthread_Mutex Mutex; /**< for thread safety */
+ GLuint Name; /**< if zero, this is a window system framebuffer */
GLint RefCount;
GLboolean DeletePending;
- GLvisual Visual; /**< The framebuffer's visual.
- Immutable if this is a window system buffer.
- Computed from attachments if user-made FBO. */
+ /**
+ * The framebuffer's visual. Immutable if this is a window system buffer.
+ * Computed from attachments if user-made FBO.
+ */
+ GLvisual Visual;
GLboolean Initialized;
@@ -2399,9 +2278,10 @@ struct gl_framebuffer
GLfloat _MRD; /**< minimum resolvable difference in Z values */
/*@}*/
- GLenum _Status; /* One of the GL_FRAMEBUFFER_(IN)COMPLETE_* tokens */
+ /** One of the GL_FRAMEBUFFER_(IN)COMPLETE_* tokens */
+ GLenum _Status;
- /* Array of all renderbuffer attachments, indexed by BUFFER_* tokens. */
+ /** Array of all renderbuffer attachments, indexed by BUFFER_* tokens. */
struct gl_renderbuffer_attachment Attachment[BUFFER_COUNT];
/* In unextended OpenGL these vars are part of the GL_COLOR_BUFFER
@@ -2463,52 +2343,58 @@ struct gl_program_constants
*/
struct gl_constants
{
- GLint MaxTextureLevels; /**< Maximum number of allowed mipmap levels. */
- GLint Max3DTextureLevels; /**< Maximum number of allowed mipmap levels for 3D texture targets. */
- GLint MaxCubeTextureLevels; /**< Maximum number of allowed mipmap levels for GL_ARB_texture_cube_map */
- GLint MaxArrayTextureLayers; /**< Maximum number of layers in an array texture. */
- GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */
+ GLint MaxTextureLevels; /**< Max mipmap levels. */
+ GLint Max3DTextureLevels; /**< Max mipmap levels for 3D textures */
+ GLint MaxCubeTextureLevels; /**< Max mipmap levels for cube textures */
+ GLint MaxArrayTextureLayers; /**< Max layers in array textures */
+ GLint MaxTextureRectSize; /**< Max rectangle texture size, in pixes */
GLuint MaxTextureCoordUnits;
GLuint MaxTextureImageUnits;
- GLuint MaxTextureUnits; /**< = MIN(CoordUnits, ImageUnits) */
- GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
- GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */
+ GLuint MaxVertexTextureImageUnits;
+ GLuint MaxTextureUnits; /**< = MIN(CoordUnits, ImageUnits) */
+ GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
+ GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */
+
GLuint MaxArrayLockSize;
+
GLint SubPixelBits;
- GLfloat MinPointSize, MaxPointSize; /* aliased */
- GLfloat MinPointSizeAA, MaxPointSizeAA; /* antialiased */
+
+ GLfloat MinPointSize, MaxPointSize; /**< aliased */
+ GLfloat MinPointSizeAA, MaxPointSizeAA; /**< antialiased */
GLfloat PointSizeGranularity;
- GLfloat MinLineWidth, MaxLineWidth; /* aliased */
- GLfloat MinLineWidthAA, MaxLineWidthAA; /* antialiased */
+ GLfloat MinLineWidth, MaxLineWidth; /**< aliased */
+ GLfloat MinLineWidthAA, MaxLineWidthAA; /**< antialiased */
GLfloat LineWidthGranularity;
+
GLuint MaxColorTableSize;
GLuint MaxConvolutionWidth;
GLuint MaxConvolutionHeight;
+
GLuint MaxClipPlanes;
GLuint MaxLights;
- GLfloat MaxShininess; /* GL_NV_light_max_exponent */
- GLfloat MaxSpotExponent; /* GL_NV_light_max_exponent */
+ GLfloat MaxShininess; /**< GL_NV_light_max_exponent */
+ GLfloat MaxSpotExponent; /**< GL_NV_light_max_exponent */
+
GLuint MaxViewportWidth, MaxViewportHeight;
- struct gl_program_constants VertexProgram; /* GL_ARB_vertex_program */
- struct gl_program_constants FragmentProgram; /* GL_ARB_fragment_program */
- /* shared by vertex and fragment program: */
+
+ struct gl_program_constants VertexProgram; /**< GL_ARB_vertex_program */
+ struct gl_program_constants FragmentProgram; /**< GL_ARB_fragment_program */
GLuint MaxProgramMatrices;
GLuint MaxProgramMatrixStackDepth;
- /* vertex array / buffer object bounds checking */
+
+ /** vertex array / buffer object bounds checking */
GLboolean CheckArrayBounds;
- /* GL_ARB_draw_buffers */
- GLuint MaxDrawBuffers;
- /* GL_OES_read_format */
- GLenum ColorReadFormat;
- GLenum ColorReadType;
- /* GL_EXT_framebuffer_object */
- GLuint MaxColorAttachments;
- GLuint MaxRenderbufferSize;
- /* GL_ARB_vertex_shader */
- GLuint MaxVertexTextureImageUnits;
- GLuint MaxVarying; /**< Number of float[4] vectors */
- /* GL_ARB_framebuffer_object */
- GLuint MaxSamples;
+
+ GLuint MaxDrawBuffers; /**< GL_ARB_draw_buffers */
+
+ GLenum ColorReadFormat; /**< GL_OES_read_format */
+ GLenum ColorReadType; /**< GL_OES_read_format */
+
+ GLuint MaxColorAttachments; /**< GL_EXT_framebuffer_object */
+ GLuint MaxRenderbufferSize; /**< GL_EXT_framebuffer_object */
+ GLuint MaxSamples; /**< GL_ARB_framebuffer_object */
+
+ GLuint MaxVarying; /**< Number of float[4] varying parameters */
};
@@ -2518,12 +2404,6 @@ struct gl_constants
*/
struct gl_extensions
{
- /**
- * \name Flags to quickly test if certain extensions are available.
- *
- * Not every extension needs to have such a flag, but it's encouraged.
- */
- /*@{*/
GLboolean dummy; /* don't remove this! */
GLboolean ARB_depth_texture;
GLboolean ARB_draw_buffers;
@@ -2641,8 +2521,7 @@ struct gl_extensions
GLboolean SGIS_texture_lod;
GLboolean TDFX_texture_compression_FXT1;
GLboolean S3_s3tc;
- /*@}*/
- /* The extension string */
+ /** The extension string */
const GLubyte *String;
};
@@ -2662,7 +2541,6 @@ struct gl_matrix_stack
/**
* \name Bits for image transfer operations
- *
* \sa __GLcontextRec::ImageTransferState.
*/
/*@{*/
@@ -2677,7 +2555,7 @@ struct gl_matrix_stack
#define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100
#define IMAGE_HISTOGRAM_BIT 0x200
#define IMAGE_MIN_MAX_BIT 0x400
-#define IMAGE_CLAMP_BIT 0x800 /* extra */
+#define IMAGE_CLAMP_BIT 0x800
/** Pixel Transfer ops up to convolution */
@@ -3040,21 +2918,15 @@ struct __GLcontextRec
struct gl_color_table ColorTable[COLORTABLE_MAX];
struct gl_color_table ProxyColorTable[COLORTABLE_MAX];
-#if 0
- struct gl_color_table PostConvolutionColorTable;
- struct gl_color_table ProxyPostConvolutionColorTable;
- struct gl_color_table PostColorMatrixColorTable;
- struct gl_color_table ProxyPostColorMatrixColorTable;
-#endif
-
- struct gl_program_state Program; /**< for vertex or fragment progs */
- struct gl_vertex_program_state VertexProgram; /**< GL_ARB/NV_vertex_program */
- struct gl_fragment_program_state FragmentProgram; /**< GL_ARB/NV_vertex_program */
- struct gl_ati_fragment_shader_state ATIFragmentShader; /**< GL_ATI_fragment_shader */
- struct gl_query_state Query; /**< GL_ARB_occlusion_query */
+ struct gl_program_state Program; /**< general program state */
+ struct gl_vertex_program_state VertexProgram;
+ struct gl_fragment_program_state FragmentProgram;
+ struct gl_ati_fragment_shader_state ATIFragmentShader;
struct gl_shader_state Shader; /**< GLSL shader object state */
+
+ struct gl_query_state Query; /**< occlusion, timer queries */
/*@}*/
#if FEATURE_EXT_framebuffer_object
@@ -3078,9 +2950,9 @@ struct __GLcontextRec
GLfloat _ModelViewInvScale;
GLboolean _NeedEyeCoords;
GLboolean _ForceEyeCoords;
- GLenum _CurrentProgram; /* currently executing program */
+ GLenum _CurrentProgram; /**< currently executing program */
- GLuint TextureStateTimestamp; /* detect changes to shared state */
+ GLuint TextureStateTimestamp; /**< detect changes to shared state */
struct gl_shine_tab *_ShineTable[2]; /**< Active shine tables */
struct gl_shine_tab *_ShineTabList; /**< MRU list of inactive shine tables */
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index d2a9e35dd5..51c13a563d 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -1098,7 +1098,7 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
rgb_shift)
dest = get_temp( p );
else
- dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
+ dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
/* Emit the RGB and A combine ops
*/
@@ -1278,7 +1278,7 @@ create_new_program(GLcontext *ctx, struct state_key *key,
p.program->Base.Parameters = _mesa_new_parameter_list();
p.program->Base.InputsRead = 0;
- p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLR;
+ p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR;
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++)
p.src_texture[unit] = undef;
@@ -1313,7 +1313,7 @@ create_new_program(GLcontext *ctx, struct state_key *key,
}
cf = get_source( &p, SRC_PREVIOUS, 0 );
- out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLR );
+ out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR );
if (key->separate_specular) {
/* Emit specular add.
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 3e6b09baa1..e25c9e732c 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -550,7 +550,6 @@ update_texture_state( GLcontext *ctx )
texUnit->_Current = NULL;
texUnit->_ReallyEnabled = 0x0;
- texUnit->_GenFlags = 0x0;
/* Get the bitmask of texture target enables.
* enableBits will be a mask of the TEXTURE_*_BIT flags indicating
@@ -609,6 +608,8 @@ update_texture_state( GLcontext *ctx )
for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) {
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ texUnit->_GenFlags = 0x0;
+
if (!(ctx->Texture._EnabledCoordUnits & (1 << unit)))
continue;
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index 9287e8515c..f5bf6e2c85 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -1,10 +1,6 @@
/*
* Mesa 3-D graphics library
-<<<<<<< HEAD:src/mesa/main/version.h
* Version: 7.5
-=======
- * Version: 7.4
->>>>>>> origin/gallium-0.2:src/mesa/main/version.h
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
diff --git a/src/mesa/math/m_debug_util.h b/src/mesa/math/m_debug_util.h
index 7abe6f2565..2e67db8e55 100644
--- a/src/mesa/math/m_debug_util.h
+++ b/src/mesa/math/m_debug_util.h
@@ -231,8 +231,8 @@ extern char *mesa_profile;
#define BEGIN_RACE(x) \
x = LONG_MAX; \
for (cycle_i = 0; cycle_i <10; cycle_i++) { \
- register long cycle_tmp1 asm("l0"); \
- register long cycle_tmp2 asm("l1"); \
+ register long cycle_tmp1 __asm__("l0"); \
+ register long cycle_tmp2 __asm__("l1"); \
/* rd %tick, %l0 */ \
__asm__ __volatile__ (".word 0xa1410000" : "=r" (cycle_tmp1)); /* save timestamp */
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index 62edb7f595..ccc0318a53 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -1688,7 +1688,7 @@ parse_result_binding(GLcontext *ctx, const GLubyte **inst,
*/
parse_output_color_num(ctx, inst, Program, &out_color);
ASSERT(out_color < MAX_DRAW_BUFFERS);
- *outputReg = FRAG_RESULT_COLR;
+ *outputReg = FRAG_RESULT_COLOR;
}
else {
/* for vtx programs, this is VERTEX_RESULT_POSITION */
@@ -1699,7 +1699,7 @@ parse_result_binding(GLcontext *ctx, const GLubyte **inst,
case FRAGMENT_RESULT_DEPTH:
if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
/* for frag programs, this is FRAGMENT_RESULT_DEPTH */
- *outputReg = FRAG_RESULT_DEPR;
+ *outputReg = FRAG_RESULT_DEPTH;
}
else {
/* for vtx programs, this is VERTEX_RESULT_COLOR */
diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c
index 20e4781372..37418ffb6e 100644
--- a/src/mesa/shader/nvfragparse.c
+++ b/src/mesa/shader/nvfragparse.c
@@ -384,18 +384,12 @@ static const char *InputRegisters[MAX_NV_FRAGMENT_PROGRAM_INPUTS + 1] = {
"TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL
};
+
static const char *OutputRegisters[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS + 1] = {
- "COLR", "COLH",
- /* These are only allows for register combiners */
- /*
- "TEX0", "TEX1", "TEX2", "TEX3",
- */
- "DEPR", NULL
+ "DEPR", "COLR", "DATA0", NULL
};
-
-
/**********************************************************************/
/**
@@ -828,7 +822,6 @@ static GLboolean
Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
{
GLubyte token[100];
- GLint j;
/* Match "o[" */
if (!Parse_String(parseState, "o["))
@@ -839,19 +832,19 @@ Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
RETURN_ERROR;
/* try to match an output register name */
- for (j = 0; OutputRegisters[j]; j++) {
- if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) {
- static GLuint bothColors = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_COLH);
- *outputRegNum = j;
- parseState->outputsWritten |= (1 << j);
- if ((parseState->outputsWritten & bothColors) == bothColors) {
- RETURN_ERROR1("Illegal to write to both o[COLR] and o[COLH]");
- }
- break;
- }
+ if (_mesa_strcmp((char *) token, "COLR") == 0 ||
+ _mesa_strcmp((char *) token, "COLH") == 0) {
+ /* note that we don't distinguish between COLR and COLH */
+ *outputRegNum = FRAG_RESULT_COLOR;
+ parseState->outputsWritten |= (1 << FRAG_RESULT_COLOR);
}
- if (!OutputRegisters[j])
+ else if (_mesa_strcmp((char *) token, "DEPR") == 0) {
+ *outputRegNum = FRAG_RESULT_DEPTH;
+ parseState->outputsWritten |= (1 << FRAG_RESULT_DEPTH);
+ }
+ else {
RETURN_ERROR1("Invalid output register name");
+ }
/* Match ']' */
if (!Parse_String(parseState, "]"))
@@ -1826,10 +1819,3 @@ _mesa_nv_fragment_input_register_name(GLuint i)
return InputRegisters[i];
}
-
-const char *
-_mesa_nv_fragment_output_register_name(GLuint i)
-{
- ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_OUTPUTS);
- return OutputRegisters[i];
-}
diff --git a/src/mesa/shader/nvfragparse.h b/src/mesa/shader/nvfragparse.h
index de45cf543d..ac97921080 100644
--- a/src/mesa/shader/nvfragparse.h
+++ b/src/mesa/shader/nvfragparse.h
@@ -44,9 +44,4 @@ _mesa_print_nv_fragment_program(const struct gl_fragment_program *program);
extern const char *
_mesa_nv_fragment_input_register_name(GLuint i);
-
-extern const char *
-_mesa_nv_fragment_output_register_name(GLuint i);
-
-
#endif
diff --git a/src/mesa/shader/prog_debug.c b/src/mesa/shader/prog_debug.c
index 7bcb2ef734..35ce37d5ce 100644
--- a/src/mesa/shader/prog_debug.c
+++ b/src/mesa/shader/prog_debug.c
@@ -222,20 +222,16 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
"glGetProgramRegisterfvMESA(registerName)");
return;
}
- else if (_mesa_strcmp(reg, "o[COLR]") == 0) {
+ else if (_mesa_strcmp(reg, "o[COLR]") == 0 ||
+ _mesa_strcmp(reg, "o[COLH]") == 0) {
/* Fragment output color */
ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
- FRAG_RESULT_COLR, v);
- }
- else if (_mesa_strcmp(reg, "o[COLH]") == 0) {
- /* Fragment output color */
- ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
- FRAG_RESULT_COLH, v);
+ FRAG_RESULT_COLOR, v);
}
else if (_mesa_strcmp(reg, "o[DEPR]") == 0) {
/* Fragment output depth */
ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
- FRAG_RESULT_DEPR, v);
+ FRAG_RESULT_DEPTH, v);
}
else {
/* try user-defined identifiers */
diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h
index e3bb7ac01d..3808644550 100644
--- a/src/mesa/shader/prog_instruction.h
+++ b/src/mesa/shader/prog_instruction.h
@@ -410,20 +410,15 @@ struct prog_instruction
*/
GLint BranchTarget;
-#if 01 /* XXX just use this for i965 driver for now! */
- /**
- * For TEX instructions in shaders, the sampler to use for the
- * texture lookup.
- */
- GLint Sampler;
-#endif
-
/** for debugging purposes */
const char *Comment;
/** Arbitrary data. Used for OPCODE_PRINT and some drivers */
void *Data;
+ /** for driver use (try to remove someday) */
+ GLint Aux;
+
/* XXX obsolete - remove someday */
#if FEATURE_MESA_program_debug
GLshort StringPos;
diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c
index 80be51c3c5..2747480834 100644
--- a/src/mesa/shader/prog_print.c
+++ b/src/mesa/shader/prog_print.c
@@ -86,6 +86,9 @@ file_string(enum register_file f, gl_prog_print_mode mode)
static const char *
arb_input_attrib_string(GLint index, GLenum progType)
{
+ /*
+ * These strings should match the VERT_ATTRIB_x and FRAG_ATTRIB_x tokens.
+ */
const char *vertAttribs[] = {
"vertex.position",
"vertex.weight",
@@ -160,6 +163,9 @@ arb_input_attrib_string(GLint index, GLenum progType)
static const char *
arb_output_attrib_string(GLint index, GLenum progType)
{
+ /*
+ * These strings should match the VERT_RESULT_x and FRAG_RESULT_x tokens.
+ */
const char *vertResults[] = {
"result.position",
"result.color.primary",
@@ -184,7 +190,12 @@ arb_output_attrib_string(GLint index, GLenum progType)
};
const char *fragResults[] = {
"result.color",
- "result.depth"
+ "result.color(half)",
+ "result.depth",
+ "result.color[0]",
+ "result.color[1]",
+ "result.color[2]",
+ "result.color[3]"
};
if (progType == GL_VERTEX_PROGRAM_ARB) {
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index 00655f0288..2e5632710e 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -738,7 +738,7 @@ _mesa_combine_programs(GLcontext *ctx,
/* Connect color outputs of fprogA to color inputs of fprogB, via a
* new temporary register.
*/
- if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) &&
+ if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) &&
(progB_inputsRead & FRAG_BIT_COL0)) {
GLint tempReg = _mesa_find_free_register(newProg, PROGRAM_TEMPORARY);
if (tempReg < 0) {
@@ -748,7 +748,7 @@ _mesa_combine_programs(GLcontext *ctx,
}
/* replace writes to result.color[0] with tempReg */
replace_registers(newInst, lenA,
- PROGRAM_OUTPUT, FRAG_RESULT_COLR,
+ PROGRAM_OUTPUT, FRAG_RESULT_COLOR,
PROGRAM_TEMPORARY, tempReg);
/* replace reads from the input color with tempReg */
replace_registers(newInst + lenA, lenB,
@@ -758,7 +758,7 @@ _mesa_combine_programs(GLcontext *ctx,
/* compute combined program's InputsRead */
inputsB = progB_inputsRead;
- if (progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) {
+ if (progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) {
inputsB &= ~(1 << FRAG_ATTRIB_COL0);
}
newProg->InputsRead = progA->InputsRead | inputsB;
diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c
index 56f1eb832e..05d9bdf7ec 100644
--- a/src/mesa/shader/programopt.c
+++ b/src/mesa/shader/programopt.c
@@ -171,7 +171,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
if (inst->Opcode == OPCODE_END)
break;
if (inst->DstReg.File == PROGRAM_OUTPUT &&
- inst->DstReg.Index == FRAG_RESULT_COLR) {
+ inst->DstReg.Index == FRAG_RESULT_COLOR) {
/* change the instruction to write to colorTemp w/ clamping */
inst->DstReg.File = PROGRAM_TEMPORARY;
inst->DstReg.Index = colorTemp;
@@ -249,7 +249,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
/* LRP result.color.xyz, fogFactorTemp.xxxx, colorTemp, fogColorRef; */
inst->Opcode = OPCODE_LRP;
inst->DstReg.File = PROGRAM_OUTPUT;
- inst->DstReg.Index = FRAG_RESULT_COLR;
+ inst->DstReg.Index = FRAG_RESULT_COLOR;
inst->DstReg.WriteMask = WRITEMASK_XYZ;
inst->SrcReg[0].File = PROGRAM_TEMPORARY;
inst->SrcReg[0].Index = fogFactorTemp;
@@ -264,7 +264,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
/* MOV result.color.w, colorTemp.x; # copy alpha */
inst->Opcode = OPCODE_MOV;
inst->DstReg.File = PROGRAM_OUTPUT;
- inst->DstReg.Index = FRAG_RESULT_COLR;
+ inst->DstReg.Index = FRAG_RESULT_COLOR;
inst->DstReg.WriteMask = WRITEMASK_W;
inst->SrcReg[0].File = PROGRAM_TEMPORARY;
inst->SrcReg[0].Index = colorTemp;
diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c
index c0f4c79e13..9858a0f7fd 100644
--- a/src/mesa/shader/slang/slang_builtin.c
+++ b/src/mesa/shader/slang/slang_builtin.c
@@ -494,7 +494,7 @@ emit_statevars(const char *name, int array_len,
}
else if (type->type == SLANG_SPEC_STRUCT) {
const slang_variable_scope *fields = type->_struct->fields;
- GLuint i, pos;
+ GLuint i, pos = 0;
for (i = 0; i < fields->num_variables; i++) {
const slang_variable *var = fields->variables[i];
GLint p = emit_statevars(var->a_name, 0, &var->type.specifier,
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 5e2ce0ce3a..ee24e2e138 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -450,8 +450,8 @@ _slang_output_index(const char *name, GLenum target)
{ NULL, 0 }
};
static const struct output_info fragOutputs[] = {
- { "gl_FragColor", FRAG_RESULT_COLR },
- { "gl_FragDepth", FRAG_RESULT_DEPR },
+ { "gl_FragColor", FRAG_RESULT_COLOR },
+ { "gl_FragDepth", FRAG_RESULT_DEPTH },
{ "gl_FragData", FRAG_RESULT_DATA0 },
{ NULL, 0 }
};
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index bcabe71bfa..f98434892b 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -686,7 +686,7 @@ _slang_link(GLcontext *ctx,
/* check that gl_FragColor and gl_FragData are not both written to */
if (shProg->FragmentProgram) {
GLbitfield outputsWritten = shProg->FragmentProgram->Base.OutputsWritten;
- if ((outputsWritten & ((1 << FRAG_RESULT_COLR))) &&
+ if ((outputsWritten & ((1 << FRAG_RESULT_COLOR))) &&
(outputsWritten >= (1 << FRAG_RESULT_DATA0))) {
link_error(shProg, "Fragment program cannot write both gl_FragColor"
" and gl_FragData[].\n");
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index a76c7b7441..357661456a 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -308,9 +308,7 @@ COMMON_DRIVER_SOURCES = \
drivers/common/driverfuncs.c
-
-### All the core C sources
-
+# Sources for building non-Gallium drivers
MESA_SOURCES = \
$(MAIN_SOURCES) \
$(MATH_XFORM_SOURCES) \
@@ -323,11 +321,7 @@ MESA_SOURCES = \
$(ASM_C_SOURCES) \
$(SLANG_SOURCES)
-ALL_SOURCES = \
- $(MESA_SOURCES) \
- $(GLAPI_SOURCES) \
- $(MESA_ASM_SOURCES)
-
+# Sources for building Gallium drivers
MESA_GALLIUM_SOURCES = \
$(MAIN_SOURCES) \
$(MATH_SOURCES) \
@@ -336,6 +330,13 @@ MESA_GALLIUM_SOURCES = \
$(SHADER_SOURCES) \
$(SLANG_SOURCES)
+# All the core C sources, for dependency checking
+ALL_SOURCES = \
+ $(MESA_SOURCES) \
+ $(GLAPI_SOURCES) \
+ $(MESA_ASM_SOURCES) \
+ $(STATETRACKER_SOURCES)
+
### Object files
diff --git a/src/mesa/sparc/clip.S b/src/mesa/sparc/clip.S
index 58c228ed15..208843c606 100644
--- a/src/mesa/sparc/clip.S
+++ b/src/mesa/sparc/clip.S
@@ -25,12 +25,8 @@
#define VEC_SIZE_3 7
#define VEC_SIZE_4 15
-#if defined(SVR4) || defined(__SVR4) || defined(__svr4__)
- /* Solaris requires this for 64-bit. */
.register %g2, #scratch
.register %g3, #scratch
- .register %g7, #scratch
-#endif
.text
.align 64
@@ -78,7 +74,7 @@ _mesa_sparc_cliptest_points4:
add %g1, 0x4, %g1
ld [%i0 + V4F_STRIDE], %l1
- ld [%i0 + V4F_COUNT], %g7
+ ld [%i0 + V4F_COUNT], %l3
LDPTR [%i0 + V4F_START], %i0
LDPTR [%i1 + V4F_START], %i5
ldub [%i3], %g2
@@ -91,12 +87,12 @@ _mesa_sparc_cliptest_points4:
st %g3, [%i1 + V4F_FLAGS]
mov 3, %g3
st %g3, [%i1 + V4F_SIZE]
- st %g7, [%i1 + V4F_COUNT]
+ st %l3, [%i1 + V4F_COUNT]
clr %l2
clr %l0
/* l0: i
- * g7: count
+ * l3: count
* l1: stride
* l2: c
* g2: (tmpAndMask << 8) | tmpOrMask
@@ -153,12 +149,12 @@ _mesa_sparc_cliptest_points4:
3: add %i5, 0x10, %i5 ! IEU1
add %l0, 1, %l0 ! IEU0 Group
add %i2, 1, %i2 ! IEU0 Group
- cmp %l0, %g7 ! IEU1 Group
+ cmp %l0, %l3 ! IEU1 Group
bne 1b ! CTI
add %i0, %l1, %i0 ! IEU0 Group
stb %g2, [%i3] ! LSU
srl %g2, 8, %g3 ! IEU0 Group
- cmp %l2, %g7 ! IEU1 Group
+ cmp %l2, %l3 ! IEU1 Group
bl,a 1f ! CTI
clr %g3 ! IEU0
1: stb %g3, [%i4] ! LSU Group
@@ -174,25 +170,18 @@ _mesa_sparc_cliptest_points4_np:
add %g1, 0x4, %g1
ld [%i0 + V4F_STRIDE], %l1
- ld [%i0 + V4F_COUNT], %g7
+ ld [%i0 + V4F_COUNT], %l3
LDPTR [%i0 + V4F_START], %i0
- LDPTR [%i1 + V4F_START], %i5
ldub [%i3], %g2
ldub [%i4], %g3
sll %g3, 8, %g3
or %g2, %g3, %g2
- ld [%i1 + V4F_FLAGS], %g3
- or %g3, VEC_SIZE_4, %g3
- st %g3, [%i1 + V4F_FLAGS]
- mov 3, %g3
- st %g3, [%i1 + V4F_SIZE]
- st %g7, [%i1 + V4F_COUNT]
clr %l2
clr %l0
/* l0: i
- * g7: count
+ * l3: count
* l1: stride
* l2: c
* g2: (tmpAndMask << 8) | tmpOrMask
@@ -230,12 +219,12 @@ _mesa_sparc_cliptest_points4_np:
and %g2, %g4, %g2 ! IEU0 Group
2: add %l0, 1, %l0 ! IEU0 Group
add %i2, 1, %i2 ! IEU0 Group
- cmp %l0, %g7 ! IEU1 Group
+ cmp %l0, %l3 ! IEU1 Group
bne 1b ! CTI
add %i0, %l1, %i0 ! IEU0 Group
stb %g2, [%i3] ! LSU
srl %g2, 8, %g3 ! IEU0 Group
- cmp %l2, %g7 ! IEU1 Group
+ cmp %l2, %l3 ! IEU1 Group
bl,a 1f ! CTI
clr %g3 ! IEU0
1: stb %g3, [%i4] ! LSU Group
diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S
index 7d215939b4..bf70fceef5 100644
--- a/src/mesa/sparc/glapi_sparc.S
+++ b/src/mesa/sparc/glapi_sparc.S
@@ -26,818 +26,176 @@
* SOFTWARE.
*/
-#include "glapioffsets.h"
+#include "glapi/glapioffsets.h"
#ifdef __arch64__
-# define GL_STUB(fn,off) \
-fn: \
- sethi %hi(0xDEADBEEF), %g4 ; \
- sethi %hi(0xDEADBEEF), %g1 ; \
- or %g4, %lo(0xDEADBEEF), %g4 ; \
- or %g1, %lo(0xDEADBEEF), %g1 ; \
- sllx %g4, 32, %g4 ; \
- ldx [%g1 + %g4], %g1 ; \
- sethi %hi(8 * off), %g4 ; \
- or %g4, %lo(8 * off), %g4 ; \
- ldx [%g1 + %g4], %g5 ; \
- jmpl %g5, %g0 ; \
- nop
+#define GL_OFF(N) ((N) * 8)
+#define GL_LL ldx
+#define GL_TIE_LD(SYM) %tie_ldx(SYM)
+#define GL_STACK_SIZE 128
#else
-# define GL_STUB(fn,off) \
-fn: \
- sethi %hi(0xDEADBEEF), %g1 ; \
- ld [%g1 + %lo(0xDEADBEEF)], %g1 ; \
- ld [%g1 + (4 * off)], %g5 ; \
- jmpl %g5, %g0 ; \
- nop
+#define GL_OFF(N) ((N) * 4)
+#define GL_LL ld
+#define GL_TIE_LD(SYM) %tie_ld(SYM)
+#define GL_STACK_SIZE 64
#endif
-#define GL_STUB_ALIAS(fn,alias) fn = alias
+#define GLOBL_FN(x) .globl x ; .type x, @function
+#define HIDDEN(x) .hidden x
-.text
-.align 32
- .globl __glapi_sparc_icache_flush ; .type __glapi_sparc_icache_flush,#function
+ .register %g2, #scratch
+ .register %g3, #scratch
+
+ .text
+
+ GLOBL_FN(__glapi_sparc_icache_flush)
+ HIDDEN(__glapi_sparc_icache_flush)
+ .type __glapi_sparc_icache_flush, @function
__glapi_sparc_icache_flush: /* %o0 = insn_addr */
flush %o0
retl
- nop
+ nop
+
+ .align 32
+
+ .type __glapi_sparc_get_pc, @function
+__glapi_sparc_get_pc:
+ retl
+ add %o7, %g2, %g2
+ .size __glapi_sparc_get_pc, .-__glapi_sparc_get_pc
+
+#ifdef GLX_USE_TLS
+
+ GLOBL_FN(__glapi_sparc_get_dispatch)
+ HIDDEN(__glapi_sparc_get_dispatch)
+__glapi_sparc_get_dispatch:
+ mov %o7, %g1
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2
+ call __glapi_sparc_get_pc
+ add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2
+ mov %g1, %o7
+ sethi %tie_hi22(_glapi_tls_Dispatch), %g1
+ add %g1, %tie_lo10(_glapi_tls_Dispatch), %g1
+ GL_LL [%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)
+ retl
+ mov %g2, %o0
+
+ .data
+ .align 32
+
+ /* --> sethi %hi(_glapi_tls_Dispatch), %g1 */
+ /* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */
+ GLOBL_FN(__glapi_sparc_tls_stub)
+ HIDDEN(__glapi_sparc_tls_stub)
+__glapi_sparc_tls_stub: /* Call offset in %g3 */
+ mov %o7, %g1
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2
+ call __glapi_sparc_get_pc
+ add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2
+ mov %g1, %o7
+ srl %g3, 10, %g3
+ sethi %tie_hi22(_glapi_tls_Dispatch), %g1
+ add %g1, %tie_lo10(_glapi_tls_Dispatch), %g1
+ GL_LL [%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)
+ GL_LL [%g7+%g2], %g1
+ GL_LL [%g1 + %g3], %g1
+ jmp %g1
+ nop
+ .size __glapi_sparc_tls_stub, .-__glapi_sparc_tls_stub
+
+#define GL_STUB(fn, off) \
+ GLOBL_FN(fn); \
+fn: ba __glapi_sparc_tls_stub; \
+ sethi GL_OFF(off), %g3; \
+ .size fn,.-fn;
+
+#elif defined(PTHREADS)
+
+ /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */
+ /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */
+ /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */
+ /* 64-bit 0x0c --> sllx %g1, 32, %g1 */
+ /* 64-bit 0x10 --> add %g1, %g2, %g1 */
+ /* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */
-.data
-.align 64
+ /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */
+ /* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */
- .globl glNewList ; .type glNewList,#function
- .globl glEndList ; .type glEndList,#function
- .globl glCallList ; .type glCallList,#function
- .globl glCallLists ; .type glCallLists,#function
- .globl glDeleteLists ; .type glDeleteLists,#function
- .globl glGenLists ; .type glGenLists,#function
- .globl glListBase ; .type glListBase,#function
- .globl glBegin ; .type glBegin,#function
- .globl glBitmap ; .type glBitmap,#function
- .globl glColor3b ; .type glColor3b,#function
- .globl glColor3bv ; .type glColor3bv,#function
- .globl glColor3d ; .type glColor3d,#function
- .globl glColor3dv ; .type glColor3dv,#function
- .globl glColor3f ; .type glColor3f,#function
- .globl glColor3fv ; .type glColor3fv,#function
- .globl glColor3i ; .type glColor3i,#function
- .globl glColor3iv ; .type glColor3iv,#function
- .globl glColor3s ; .type glColor3s,#function
- .globl glColor3sv ; .type glColor3sv,#function
- .globl glColor3ub ; .type glColor3ub,#function
- .globl glColor3ubv ; .type glColor3ubv,#function
- .globl glColor3ui ; .type glColor3ui,#function
- .globl glColor3uiv ; .type glColor3uiv,#function
- .globl glColor3us ; .type glColor3us,#function
- .globl glColor3usv ; .type glColor3usv,#function
- .globl glColor4b ; .type glColor4b,#function
- .globl glColor4bv ; .type glColor4bv,#function
- .globl glColor4d ; .type glColor4d,#function
- .globl glColor4dv ; .type glColor4dv,#function
- .globl glColor4f ; .type glColor4f,#function
- .globl glColor4fv ; .type glColor4fv,#function
- .globl glColor4i ; .type glColor4i,#function
- .globl glColor4iv ; .type glColor4iv,#function
- .globl glColor4s ; .type glColor4s,#function
- .globl glColor4sv ; .type glColor4sv,#function
- .globl glColor4ub ; .type glColor4ub,#function
- .globl glColor4ubv ; .type glColor4ubv,#function
- .globl glColor4ui ; .type glColor4ui,#function
- .globl glColor4uiv ; .type glColor4uiv,#function
- .globl glColor4us ; .type glColor4us,#function
- .globl glColor4usv ; .type glColor4usv,#function
- .globl glEdgeFlag ; .type glEdgeFlag,#function
- .globl glEdgeFlagv ; .type glEdgeFlagv,#function
- .globl glEnd ; .type glEnd,#function
- .globl glIndexd ; .type glIndexd,#function
- .globl glIndexdv ; .type glIndexdv,#function
- .globl glIndexf ; .type glIndexf,#function
- .globl glIndexfv ; .type glIndexfv,#function
- .globl glIndexi ; .type glIndexi,#function
- .globl glIndexiv ; .type glIndexiv,#function
- .globl glIndexs ; .type glIndexs,#function
- .globl glIndexsv ; .type glIndexsv,#function
- .globl glNormal3b ; .type glNormal3b,#function
- .globl glNormal3bv ; .type glNormal3bv,#function
- .globl glNormal3d ; .type glNormal3d,#function
- .globl glNormal3dv ; .type glNormal3dv,#function
- .globl glNormal3f ; .type glNormal3f,#function
- .globl glNormal3fv ; .type glNormal3fv,#function
- .globl glNormal3i ; .type glNormal3i,#function
- .globl glNormal3iv ; .type glNormal3iv,#function
- .globl glNormal3s ; .type glNormal3s,#function
- .globl glNormal3sv ; .type glNormal3sv,#function
- .globl glRasterPos2d ; .type glRasterPos2d,#function
- .globl glRasterPos2dv ; .type glRasterPos2dv,#function
- .globl glRasterPos2f ; .type glRasterPos2f,#function
- .globl glRasterPos2fv ; .type glRasterPos2fv,#function
- .globl glRasterPos2i ; .type glRasterPos2i,#function
- .globl glRasterPos2iv ; .type glRasterPos2iv,#function
- .globl glRasterPos2s ; .type glRasterPos2s,#function
- .globl glRasterPos2sv ; .type glRasterPos2sv,#function
- .globl glRasterPos3d ; .type glRasterPos3d,#function
- .globl glRasterPos3dv ; .type glRasterPos3dv,#function
- .globl glRasterPos3f ; .type glRasterPos3f,#function
- .globl glRasterPos3fv ; .type glRasterPos3fv,#function
- .globl glRasterPos3i ; .type glRasterPos3i,#function
- .globl glRasterPos3iv ; .type glRasterPos3iv,#function
- .globl glRasterPos3s ; .type glRasterPos3s,#function
- .globl glRasterPos3sv ; .type glRasterPos3sv,#function
- .globl glRasterPos4d ; .type glRasterPos4d,#function
- .globl glRasterPos4dv ; .type glRasterPos4dv,#function
- .globl glRasterPos4f ; .type glRasterPos4f,#function
- .globl glRasterPos4fv ; .type glRasterPos4fv,#function
- .globl glRasterPos4i ; .type glRasterPos4i,#function
- .globl glRasterPos4iv ; .type glRasterPos4iv,#function
- .globl glRasterPos4s ; .type glRasterPos4s,#function
- .globl glRasterPos4sv ; .type glRasterPos4sv,#function
- .globl glRectd ; .type glRectd,#function
- .globl glRectdv ; .type glRectdv,#function
- .globl glRectf ; .type glRectf,#function
- .globl glRectfv ; .type glRectfv,#function
- .globl glRecti ; .type glRecti,#function
- .globl glRectiv ; .type glRectiv,#function
- .globl glRects ; .type glRects,#function
- .globl glRectsv ; .type glRectsv,#function
- .globl glTexCoord1d ; .type glTexCoord1d,#function
- .globl glTexCoord1dv ; .type glTexCoord1dv,#function
- .globl glTexCoord1f ; .type glTexCoord1f,#function
- .globl glTexCoord1fv ; .type glTexCoord1fv,#function
- .globl glTexCoord1i ; .type glTexCoord1i,#function
- .globl glTexCoord1iv ; .type glTexCoord1iv,#function
- .globl glTexCoord1s ; .type glTexCoord1s,#function
- .globl glTexCoord1sv ; .type glTexCoord1sv,#function
- .globl glTexCoord2d ; .type glTexCoord2d,#function
- .globl glTexCoord2dv ; .type glTexCoord2dv,#function
- .globl glTexCoord2f ; .type glTexCoord2f,#function
- .globl glTexCoord2fv ; .type glTexCoord2fv,#function
- .globl glTexCoord2i ; .type glTexCoord2i,#function
- .globl glTexCoord2iv ; .type glTexCoord2iv,#function
- .globl glTexCoord2s ; .type glTexCoord2s,#function
- .globl glTexCoord2sv ; .type glTexCoord2sv,#function
- .globl glTexCoord3d ; .type glTexCoord3d,#function
- .globl glTexCoord3dv ; .type glTexCoord3dv,#function
- .globl glTexCoord3f ; .type glTexCoord3f,#function
- .globl glTexCoord3fv ; .type glTexCoord3fv,#function
- .globl glTexCoord3i ; .type glTexCoord3i,#function
- .globl glTexCoord3iv ; .type glTexCoord3iv,#function
- .globl glTexCoord3s ; .type glTexCoord3s,#function
- .globl glTexCoord3sv ; .type glTexCoord3sv,#function
- .globl glTexCoord4d ; .type glTexCoord4d,#function
- .globl glTexCoord4dv ; .type glTexCoord4dv,#function
- .globl glTexCoord4f ; .type glTexCoord4f,#function
- .globl glTexCoord4fv ; .type glTexCoord4fv,#function
- .globl glTexCoord4i ; .type glTexCoord4i,#function
- .globl glTexCoord4iv ; .type glTexCoord4iv,#function
- .globl glTexCoord4s ; .type glTexCoord4s,#function
- .globl glTexCoord4sv ; .type glTexCoord4sv,#function
- .globl glVertex2d ; .type glVertex2d,#function
- .globl glVertex2dv ; .type glVertex2dv,#function
- .globl glVertex2f ; .type glVertex2f,#function
- .globl glVertex2fv ; .type glVertex2fv,#function
- .globl glVertex2i ; .type glVertex2i,#function
- .globl glVertex2iv ; .type glVertex2iv,#function
- .globl glVertex2s ; .type glVertex2s,#function
- .globl glVertex2sv ; .type glVertex2sv,#function
- .globl glVertex3d ; .type glVertex3d,#function
- .globl glVertex3dv ; .type glVertex3dv,#function
- .globl glVertex3f ; .type glVertex3f,#function
- .globl glVertex3fv ; .type glVertex3fv,#function
- .globl glVertex3i ; .type glVertex3i,#function
- .globl glVertex3iv ; .type glVertex3iv,#function
- .globl glVertex3s ; .type glVertex3s,#function
- .globl glVertex3sv ; .type glVertex3sv,#function
- .globl glVertex4d ; .type glVertex4d,#function
- .globl glVertex4dv ; .type glVertex4dv,#function
- .globl glVertex4f ; .type glVertex4f,#function
- .globl glVertex4fv ; .type glVertex4fv,#function
- .globl glVertex4i ; .type glVertex4i,#function
- .globl glVertex4iv ; .type glVertex4iv,#function
- .globl glVertex4s ; .type glVertex4s,#function
- .globl glVertex4sv ; .type glVertex4sv,#function
- .globl glClipPlane ; .type glClipPlane,#function
- .globl glColorMaterial ; .type glColorMaterial,#function
- .globl glCullFace ; .type glCullFace,#function
- .globl glFogf ; .type glFogf,#function
- .globl glFogfv ; .type glFogfv,#function
- .globl glFogi ; .type glFogi,#function
- .globl glFogiv ; .type glFogiv,#function
- .globl glFrontFace ; .type glFrontFace,#function
- .globl glHint ; .type glHint,#function
- .globl glLightf ; .type glLightf,#function
- .globl glLightfv ; .type glLightfv,#function
- .globl glLighti ; .type glLighti,#function
- .globl glLightiv ; .type glLightiv,#function
- .globl glLightModelf ; .type glLightModelf,#function
- .globl glLightModelfv ; .type glLightModelfv,#function
- .globl glLightModeli ; .type glLightModeli,#function
- .globl glLightModeliv ; .type glLightModeliv,#function
- .globl glLineStipple ; .type glLineStipple,#function
- .globl glLineWidth ; .type glLineWidth,#function
- .globl glMaterialf ; .type glMaterialf,#function
- .globl glMaterialfv ; .type glMaterialfv,#function
- .globl glMateriali ; .type glMateriali,#function
- .globl glMaterialiv ; .type glMaterialiv,#function
- .globl glPointSize ; .type glPointSize,#function
- .globl glPolygonMode ; .type glPolygonMode,#function
- .globl glPolygonStipple ; .type glPolygonStipple,#function
- .globl glScissor ; .type glScissor,#function
- .globl glShadeModel ; .type glShadeModel,#function
- .globl glTexParameterf ; .type glTexParameterf,#function
- .globl glTexParameterfv ; .type glTexParameterfv,#function
- .globl glTexParameteri ; .type glTexParameteri,#function
- .globl glTexParameteriv ; .type glTexParameteriv,#function
- .globl glTexImage1D ; .type glTexImage1D,#function
- .globl glTexImage2D ; .type glTexImage2D,#function
- .globl glTexEnvf ; .type glTexEnvf,#function
- .globl glTexEnvfv ; .type glTexEnvfv,#function
- .globl glTexEnvi ; .type glTexEnvi,#function
- .globl glTexEnviv ; .type glTexEnviv,#function
- .globl glTexGend ; .type glTexGend,#function
- .globl glTexGendv ; .type glTexGendv,#function
- .globl glTexGenf ; .type glTexGenf,#function
- .globl glTexGenfv ; .type glTexGenfv,#function
- .globl glTexGeni ; .type glTexGeni,#function
- .globl glTexGeniv ; .type glTexGeniv,#function
- .globl glFeedbackBuffer ; .type glFeedbackBuffer,#function
- .globl glSelectBuffer ; .type glSelectBuffer,#function
- .globl glRenderMode ; .type glRenderMode,#function
- .globl glInitNames ; .type glInitNames,#function
- .globl glLoadName ; .type glLoadName,#function
- .globl glPassThrough ; .type glPassThrough,#function
- .globl glPopName ; .type glPopName,#function
- .globl glPushName ; .type glPushName,#function
- .globl glDrawBuffer ; .type glDrawBuffer,#function
- .globl glClear ; .type glClear,#function
- .globl glClearAccum ; .type glClearAccum,#function
- .globl glClearIndex ; .type glClearIndex,#function
- .globl glClearColor ; .type glClearColor,#function
- .globl glClearStencil ; .type glClearStencil,#function
- .globl glClearDepth ; .type glClearDepth,#function
- .globl glStencilMask ; .type glStencilMask,#function
- .globl glColorMask ; .type glColorMask,#function
- .globl glDepthMask ; .type glDepthMask,#function
- .globl glIndexMask ; .type glIndexMask,#function
- .globl glAccum ; .type glAccum,#function
- .globl glDisable ; .type glDisable,#function
- .globl glEnable ; .type glEnable,#function
- .globl glFinish ; .type glFinish,#function
- .globl glFlush ; .type glFlush,#function
- .globl glPopAttrib ; .type glPopAttrib,#function
- .globl glPushAttrib ; .type glPushAttrib,#function
- .globl glMap1d ; .type glMap1d,#function
- .globl glMap1f ; .type glMap1f,#function
- .globl glMap2d ; .type glMap2d,#function
- .globl glMap2f ; .type glMap2f,#function
- .globl glMapGrid1d ; .type glMapGrid1d,#function
- .globl glMapGrid1f ; .type glMapGrid1f,#function
- .globl glMapGrid2d ; .type glMapGrid2d,#function
- .globl glMapGrid2f ; .type glMapGrid2f,#function
- .globl glEvalCoord1d ; .type glEvalCoord1d,#function
- .globl glEvalCoord1dv ; .type glEvalCoord1dv,#function
- .globl glEvalCoord1f ; .type glEvalCoord1f,#function
- .globl glEvalCoord1fv ; .type glEvalCoord1fv,#function
- .globl glEvalCoord2d ; .type glEvalCoord2d,#function
- .globl glEvalCoord2dv ; .type glEvalCoord2dv,#function
- .globl glEvalCoord2f ; .type glEvalCoord2f,#function
- .globl glEvalCoord2fv ; .type glEvalCoord2fv,#function
- .globl glEvalMesh1 ; .type glEvalMesh1,#function
- .globl glEvalPoint1 ; .type glEvalPoint1,#function
- .globl glEvalMesh2 ; .type glEvalMesh2,#function
- .globl glEvalPoint2 ; .type glEvalPoint2,#function
- .globl glAlphaFunc ; .type glAlphaFunc,#function
- .globl glBlendFunc ; .type glBlendFunc,#function
- .globl glLogicOp ; .type glLogicOp,#function
- .globl glStencilFunc ; .type glStencilFunc,#function
- .globl glStencilOp ; .type glStencilOp,#function
- .globl glDepthFunc ; .type glDepthFunc,#function
- .globl glPixelZoom ; .type glPixelZoom,#function
- .globl glPixelTransferf ; .type glPixelTransferf,#function
- .globl glPixelTransferi ; .type glPixelTransferi,#function
- .globl glPixelStoref ; .type glPixelStoref,#function
- .globl glPixelStorei ; .type glPixelStorei,#function
- .globl glPixelMapfv ; .type glPixelMapfv,#function
- .globl glPixelMapuiv ; .type glPixelMapuiv,#function
- .globl glPixelMapusv ; .type glPixelMapusv,#function
- .globl glReadBuffer ; .type glReadBuffer,#function
- .globl glCopyPixels ; .type glCopyPixels,#function
- .globl glReadPixels ; .type glReadPixels,#function
- .globl glDrawPixels ; .type glDrawPixels,#function
- .globl glGetBooleanv ; .type glGetBooleanv,#function
- .globl glGetClipPlane ; .type glGetClipPlane,#function
- .globl glGetDoublev ; .type glGetDoublev,#function
- .globl glGetError ; .type glGetError,#function
- .globl glGetFloatv ; .type glGetFloatv,#function
- .globl glGetIntegerv ; .type glGetIntegerv,#function
- .globl glGetLightfv ; .type glGetLightfv,#function
- .globl glGetLightiv ; .type glGetLightiv,#function
- .globl glGetMapdv ; .type glGetMapdv,#function
- .globl glGetMapfv ; .type glGetMapfv,#function
- .globl glGetMapiv ; .type glGetMapiv,#function
- .globl glGetMaterialfv ; .type glGetMaterialfv,#function
- .globl glGetMaterialiv ; .type glGetMaterialiv,#function
- .globl glGetPixelMapfv ; .type glGetPixelMapfv,#function
- .globl glGetPixelMapuiv ; .type glGetPixelMapuiv,#function
- .globl glGetPixelMapusv ; .type glGetPixelMapusv,#function
- .globl glGetPolygonStipple ; .type glGetPolygonStipple,#function
- .globl glGetString ; .type glGetString,#function
- .globl glGetTexEnvfv ; .type glGetTexEnvfv,#function
- .globl glGetTexEnviv ; .type glGetTexEnviv,#function
- .globl glGetTexGendv ; .type glGetTexGendv,#function
- .globl glGetTexGenfv ; .type glGetTexGenfv,#function
- .globl glGetTexGeniv ; .type glGetTexGeniv,#function
- .globl glGetTexImage ; .type glGetTexImage,#function
- .globl glGetTexParameterfv ; .type glGetTexParameterfv,#function
- .globl glGetTexParameteriv ; .type glGetTexParameteriv,#function
- .globl glGetTexLevelParameterfv ; .type glGetTexLevelParameterfv,#function
- .globl glGetTexLevelParameteriv ; .type glGetTexLevelParameteriv,#function
- .globl glIsEnabled ; .type glIsEnabled,#function
- .globl glIsList ; .type glIsList,#function
- .globl glDepthRange ; .type glDepthRange,#function
- .globl glFrustum ; .type glFrustum,#function
- .globl glLoadIdentity ; .type glLoadIdentity,#function
- .globl glLoadMatrixf ; .type glLoadMatrixf,#function
- .globl glLoadMatrixd ; .type glLoadMatrixd,#function
- .globl glMatrixMode ; .type glMatrixMode,#function
- .globl glMultMatrixf ; .type glMultMatrixf,#function
- .globl glMultMatrixd ; .type glMultMatrixd,#function
- .globl glOrtho ; .type glOrtho,#function
- .globl glPopMatrix ; .type glPopMatrix,#function
- .globl glPushMatrix ; .type glPushMatrix,#function
- .globl glRotated ; .type glRotated,#function
- .globl glRotatef ; .type glRotatef,#function
- .globl glScaled ; .type glScaled,#function
- .globl glScalef ; .type glScalef,#function
- .globl glTranslated ; .type glTranslated,#function
- .globl glTranslatef ; .type glTranslatef,#function
- .globl glViewport ; .type glViewport,#function
- .globl glArrayElement ; .type glArrayElement,#function
- .globl glBindTexture ; .type glBindTexture,#function
- .globl glColorPointer ; .type glColorPointer,#function
- .globl glDisableClientState ; .type glDisableClientState,#function
- .globl glDrawArrays ; .type glDrawArrays,#function
- .globl glDrawElements ; .type glDrawElements,#function
- .globl glEdgeFlagPointer ; .type glEdgeFlagPointer,#function
- .globl glEnableClientState ; .type glEnableClientState,#function
- .globl glIndexPointer ; .type glIndexPointer,#function
- .globl glIndexub ; .type glIndexub,#function
- .globl glIndexubv ; .type glIndexubv,#function
- .globl glInterleavedArrays ; .type glInterleavedArrays,#function
- .globl glNormalPointer ; .type glNormalPointer,#function
- .globl glPolygonOffset ; .type glPolygonOffset,#function
- .globl glTexCoordPointer ; .type glTexCoordPointer,#function
- .globl glVertexPointer ; .type glVertexPointer,#function
- .globl glAreTexturesResident ; .type glAreTexturesResident,#function
- .globl glCopyTexImage1D ; .type glCopyTexImage1D,#function
- .globl glCopyTexImage2D ; .type glCopyTexImage2D,#function
- .globl glCopyTexSubImage1D ; .type glCopyTexSubImage1D,#function
- .globl glCopyTexSubImage2D ; .type glCopyTexSubImage2D,#function
- .globl glDeleteTextures ; .type glDeleteTextures,#function
- .globl glGenTextures ; .type glGenTextures,#function
- .globl glGetPointerv ; .type glGetPointerv,#function
- .globl glIsTexture ; .type glIsTexture,#function
- .globl glPrioritizeTextures ; .type glPrioritizeTextures,#function
- .globl glTexSubImage1D ; .type glTexSubImage1D,#function
- .globl glTexSubImage2D ; .type glTexSubImage2D,#function
- .globl glPopClientAttrib ; .type glPopClientAttrib,#function
- .globl glPushClientAttrib ; .type glPushClientAttrib,#function
- .globl glBlendColor ; .type glBlendColor,#function
- .globl glBlendEquation ; .type glBlendEquation,#function
- .globl glDrawRangeElements ; .type glDrawRangeElements,#function
- .globl glColorTable ; .type glColorTable,#function
- .globl glColorTableParameterfv ; .type glColorTableParameterfv,#function
- .globl glColorTableParameteriv ; .type glColorTableParameteriv,#function
- .globl glCopyColorTable ; .type glCopyColorTable,#function
- .globl glGetColorTable ; .type glGetColorTable,#function
- .globl glGetColorTableParameterfv ; .type glGetColorTableParameterfv,#function
- .globl glGetColorTableParameteriv ; .type glGetColorTableParameteriv,#function
- .globl glColorSubTable ; .type glColorSubTable,#function
- .globl glCopyColorSubTable ; .type glCopyColorSubTable,#function
- .globl glConvolutionFilter1D ; .type glConvolutionFilter1D,#function
- .globl glConvolutionFilter2D ; .type glConvolutionFilter2D,#function
- .globl glConvolutionParameterf ; .type glConvolutionParameterf,#function
- .globl glConvolutionParameterfv ; .type glConvolutionParameterfv,#function
- .globl glConvolutionParameteri ; .type glConvolutionParameteri,#function
- .globl glConvolutionParameteriv ; .type glConvolutionParameteriv,#function
- .globl glCopyConvolutionFilter1D ; .type glCopyConvolutionFilter1D,#function
- .globl glCopyConvolutionFilter2D ; .type glCopyConvolutionFilter2D,#function
- .globl glGetConvolutionFilter ; .type glGetConvolutionFilter,#function
- .globl glGetConvolutionParameterfv ; .type glGetConvolutionParameterfv,#function
- .globl glGetConvolutionParameteriv ; .type glGetConvolutionParameteriv,#function
- .globl glGetSeparableFilter ; .type glGetSeparableFilter,#function
- .globl glSeparableFilter2D ; .type glSeparableFilter2D,#function
- .globl glGetHistogram ; .type glGetHistogram,#function
- .globl glGetHistogramParameterfv ; .type glGetHistogramParameterfv,#function
- .globl glGetHistogramParameteriv ; .type glGetHistogramParameteriv,#function
- .globl glGetMinmax ; .type glGetMinmax,#function
- .globl glGetMinmaxParameterfv ; .type glGetMinmaxParameterfv,#function
- .globl glGetMinmaxParameteriv ; .type glGetMinmaxParameteriv,#function
- .globl glHistogram ; .type glHistogram,#function
- .globl glMinmax ; .type glMinmax,#function
- .globl glResetHistogram ; .type glResetHistogram,#function
- .globl glResetMinmax ; .type glResetMinmax,#function
- .globl glTexImage3D ; .type glTexImage3D,#function
- .globl glTexSubImage3D ; .type glTexSubImage3D,#function
- .globl glCopyTexSubImage3D ; .type glCopyTexSubImage3D,#function
- .globl glActiveTextureARB ; .type glActiveTextureARB,#function
- .globl glClientActiveTextureARB ; .type glClientActiveTextureARB,#function
- .globl glMultiTexCoord1dARB ; .type glMultiTexCoord1dARB,#function
- .globl glMultiTexCoord1dvARB ; .type glMultiTexCoord1dvARB,#function
- .globl glMultiTexCoord1fARB ; .type glMultiTexCoord1fARB,#function
- .globl glMultiTexCoord1fvARB ; .type glMultiTexCoord1fvARB,#function
- .globl glMultiTexCoord1iARB ; .type glMultiTexCoord1iARB,#function
- .globl glMultiTexCoord1ivARB ; .type glMultiTexCoord1ivARB,#function
- .globl glMultiTexCoord1sARB ; .type glMultiTexCoord1sARB,#function
- .globl glMultiTexCoord1svARB ; .type glMultiTexCoord1svARB,#function
- .globl glMultiTexCoord2dARB ; .type glMultiTexCoord2dARB,#function
- .globl glMultiTexCoord2dvARB ; .type glMultiTexCoord2dvARB,#function
- .globl glMultiTexCoord2fARB ; .type glMultiTexCoord2fARB,#function
- .globl glMultiTexCoord2fvARB ; .type glMultiTexCoord2fvARB,#function
- .globl glMultiTexCoord2iARB ; .type glMultiTexCoord2iARB,#function
- .globl glMultiTexCoord2ivARB ; .type glMultiTexCoord2ivARB,#function
- .globl glMultiTexCoord2sARB ; .type glMultiTexCoord2sARB,#function
- .globl glMultiTexCoord2svARB ; .type glMultiTexCoord2svARB,#function
- .globl glMultiTexCoord3dARB ; .type glMultiTexCoord3dARB,#function
- .globl glMultiTexCoord3dvARB ; .type glMultiTexCoord3dvARB,#function
- .globl glMultiTexCoord3fARB ; .type glMultiTexCoord3fARB,#function
- .globl glMultiTexCoord3fvARB ; .type glMultiTexCoord3fvARB,#function
- .globl glMultiTexCoord3iARB ; .type glMultiTexCoord3iARB,#function
- .globl glMultiTexCoord3ivARB ; .type glMultiTexCoord3ivARB,#function
- .globl glMultiTexCoord3sARB ; .type glMultiTexCoord3sARB,#function
- .globl glMultiTexCoord3svARB ; .type glMultiTexCoord3svARB,#function
- .globl glMultiTexCoord4dARB ; .type glMultiTexCoord4dARB,#function
- .globl glMultiTexCoord4dvARB ; .type glMultiTexCoord4dvARB,#function
- .globl glMultiTexCoord4fARB ; .type glMultiTexCoord4fARB,#function
- .globl glMultiTexCoord4fvARB ; .type glMultiTexCoord4fvARB,#function
- .globl glMultiTexCoord4iARB ; .type glMultiTexCoord4iARB,#function
- .globl glMultiTexCoord4ivARB ; .type glMultiTexCoord4ivARB,#function
- .globl glMultiTexCoord4sARB ; .type glMultiTexCoord4sARB,#function
- .globl glMultiTexCoord4svARB ; .type glMultiTexCoord4svARB,#function
- .globl glAttachShader ; .type glAttachShader,#function
- .globl glCreateProgram ; .type glCreateProgram,#function
- .globl glCreateShader ; .type glCreateShader,#function
- .globl glDeleteProgram ; .type glDeleteProgram,#function
- .globl glDeleteShader ; .type glDeleteShader,#function
- .globl glDetachShader ; .type glDetachShader,#function
- .globl glGetAttachedShaders ; .type glGetAttachedShaders,#function
- .globl glGetProgramInfoLog ; .type glGetProgramInfoLog,#function
- .globl glGetProgramiv ; .type glGetProgramiv,#function
- .globl glGetShaderInfoLog ; .type glGetShaderInfoLog,#function
- .globl glGetShaderiv ; .type glGetShaderiv,#function
- .globl glIsProgram ; .type glIsProgram,#function
- .globl glIsShader ; .type glIsShader,#function
- .globl glStencilFuncSeparate ; .type glStencilFuncSeparate,#function
- .globl glStencilMaskSeparate ; .type glStencilMaskSeparate,#function
- .globl glStencilOpSeparate ; .type glStencilOpSeparate,#function
- .globl glUniformMatrix2x3fv ; .type glUniformMatrix2x3fv,#function
- .globl glUniformMatrix2x4fv ; .type glUniformMatrix2x4fv,#function
- .globl glUniformMatrix3x2fv ; .type glUniformMatrix3x2fv,#function
- .globl glUniformMatrix3x4fv ; .type glUniformMatrix3x4fv,#function
- .globl glUniformMatrix4x2fv ; .type glUniformMatrix4x2fv,#function
- .globl glUniformMatrix4x3fv ; .type glUniformMatrix4x3fv,#function
- .globl glLoadTransposeMatrixdARB ; .type glLoadTransposeMatrixdARB,#function
- .globl glLoadTransposeMatrixfARB ; .type glLoadTransposeMatrixfARB,#function
- .globl glMultTransposeMatrixdARB ; .type glMultTransposeMatrixdARB,#function
- .globl glMultTransposeMatrixfARB ; .type glMultTransposeMatrixfARB,#function
- .globl glSampleCoverageARB ; .type glSampleCoverageARB,#function
- .globl glCompressedTexImage1DARB ; .type glCompressedTexImage1DARB,#function
- .globl glCompressedTexImage2DARB ; .type glCompressedTexImage2DARB,#function
- .globl glCompressedTexImage3DARB ; .type glCompressedTexImage3DARB,#function
- .globl glCompressedTexSubImage1DARB ; .type glCompressedTexSubImage1DARB,#function
- .globl glCompressedTexSubImage2DARB ; .type glCompressedTexSubImage2DARB,#function
- .globl glCompressedTexSubImage3DARB ; .type glCompressedTexSubImage3DARB,#function
- .globl glGetCompressedTexImageARB ; .type glGetCompressedTexImageARB,#function
- .globl glDisableVertexAttribArrayARB ; .type glDisableVertexAttribArrayARB,#function
- .globl glEnableVertexAttribArrayARB ; .type glEnableVertexAttribArrayARB,#function
- .globl glGetProgramEnvParameterdvARB ; .type glGetProgramEnvParameterdvARB,#function
- .globl glGetProgramEnvParameterfvARB ; .type glGetProgramEnvParameterfvARB,#function
- .globl glGetProgramLocalParameterdvARB ; .type glGetProgramLocalParameterdvARB,#function
- .globl glGetProgramLocalParameterfvARB ; .type glGetProgramLocalParameterfvARB,#function
- .globl glGetProgramStringARB ; .type glGetProgramStringARB,#function
- .globl glGetProgramivARB ; .type glGetProgramivARB,#function
- .globl glGetVertexAttribdvARB ; .type glGetVertexAttribdvARB,#function
- .globl glGetVertexAttribfvARB ; .type glGetVertexAttribfvARB,#function
- .globl glGetVertexAttribivARB ; .type glGetVertexAttribivARB,#function
- .globl glProgramEnvParameter4dARB ; .type glProgramEnvParameter4dARB,#function
- .globl glProgramEnvParameter4dvARB ; .type glProgramEnvParameter4dvARB,#function
- .globl glProgramEnvParameter4fARB ; .type glProgramEnvParameter4fARB,#function
- .globl glProgramEnvParameter4fvARB ; .type glProgramEnvParameter4fvARB,#function
- .globl glProgramLocalParameter4dARB ; .type glProgramLocalParameter4dARB,#function
- .globl glProgramLocalParameter4dvARB ; .type glProgramLocalParameter4dvARB,#function
- .globl glProgramLocalParameter4fARB ; .type glProgramLocalParameter4fARB,#function
- .globl glProgramLocalParameter4fvARB ; .type glProgramLocalParameter4fvARB,#function
- .globl glProgramStringARB ; .type glProgramStringARB,#function
- .globl glVertexAttrib1dARB ; .type glVertexAttrib1dARB,#function
- .globl glVertexAttrib1dvARB ; .type glVertexAttrib1dvARB,#function
- .globl glVertexAttrib1fARB ; .type glVertexAttrib1fARB,#function
- .globl glVertexAttrib1fvARB ; .type glVertexAttrib1fvARB,#function
- .globl glVertexAttrib1sARB ; .type glVertexAttrib1sARB,#function
- .globl glVertexAttrib1svARB ; .type glVertexAttrib1svARB,#function
- .globl glVertexAttrib2dARB ; .type glVertexAttrib2dARB,#function
- .globl glVertexAttrib2dvARB ; .type glVertexAttrib2dvARB,#function
- .globl glVertexAttrib2fARB ; .type glVertexAttrib2fARB,#function
- .globl glVertexAttrib2fvARB ; .type glVertexAttrib2fvARB,#function
- .globl glVertexAttrib2sARB ; .type glVertexAttrib2sARB,#function
- .globl glVertexAttrib2svARB ; .type glVertexAttrib2svARB,#function
- .globl glVertexAttrib3dARB ; .type glVertexAttrib3dARB,#function
- .globl glVertexAttrib3dvARB ; .type glVertexAttrib3dvARB,#function
- .globl glVertexAttrib3fARB ; .type glVertexAttrib3fARB,#function
- .globl glVertexAttrib3fvARB ; .type glVertexAttrib3fvARB,#function
- .globl glVertexAttrib3sARB ; .type glVertexAttrib3sARB,#function
- .globl glVertexAttrib3svARB ; .type glVertexAttrib3svARB,#function
- .globl glVertexAttrib4NbvARB ; .type glVertexAttrib4NbvARB,#function
- .globl glVertexAttrib4NivARB ; .type glVertexAttrib4NivARB,#function
- .globl glVertexAttrib4NsvARB ; .type glVertexAttrib4NsvARB,#function
- .globl glVertexAttrib4NubARB ; .type glVertexAttrib4NubARB,#function
- .globl glVertexAttrib4NubvARB ; .type glVertexAttrib4NubvARB,#function
- .globl glVertexAttrib4NuivARB ; .type glVertexAttrib4NuivARB,#function
- .globl glVertexAttrib4NusvARB ; .type glVertexAttrib4NusvARB,#function
- .globl glVertexAttrib4bvARB ; .type glVertexAttrib4bvARB,#function
- .globl glVertexAttrib4dARB ; .type glVertexAttrib4dARB,#function
- .globl glVertexAttrib4dvARB ; .type glVertexAttrib4dvARB,#function
- .globl glVertexAttrib4fARB ; .type glVertexAttrib4fARB,#function
- .globl glVertexAttrib4fvARB ; .type glVertexAttrib4fvARB,#function
- .globl glVertexAttrib4ivARB ; .type glVertexAttrib4ivARB,#function
- .globl glVertexAttrib4sARB ; .type glVertexAttrib4sARB,#function
- .globl glVertexAttrib4svARB ; .type glVertexAttrib4svARB,#function
- .globl glVertexAttrib4ubvARB ; .type glVertexAttrib4ubvARB,#function
- .globl glVertexAttrib4uivARB ; .type glVertexAttrib4uivARB,#function
- .globl glVertexAttrib4usvARB ; .type glVertexAttrib4usvARB,#function
- .globl glVertexAttribPointerARB ; .type glVertexAttribPointerARB,#function
- .globl glBindBufferARB ; .type glBindBufferARB,#function
- .globl glBufferDataARB ; .type glBufferDataARB,#function
- .globl glBufferSubDataARB ; .type glBufferSubDataARB,#function
- .globl glDeleteBuffersARB ; .type glDeleteBuffersARB,#function
- .globl glGenBuffersARB ; .type glGenBuffersARB,#function
- .globl glGetBufferParameterivARB ; .type glGetBufferParameterivARB,#function
- .globl glGetBufferPointervARB ; .type glGetBufferPointervARB,#function
- .globl glGetBufferSubDataARB ; .type glGetBufferSubDataARB,#function
- .globl glIsBufferARB ; .type glIsBufferARB,#function
- .globl glMapBufferARB ; .type glMapBufferARB,#function
- .globl glUnmapBufferARB ; .type glUnmapBufferARB,#function
- .globl glBeginQueryARB ; .type glBeginQueryARB,#function
- .globl glDeleteQueriesARB ; .type glDeleteQueriesARB,#function
- .globl glEndQueryARB ; .type glEndQueryARB,#function
- .globl glGenQueriesARB ; .type glGenQueriesARB,#function
- .globl glGetQueryObjectivARB ; .type glGetQueryObjectivARB,#function
- .globl glGetQueryObjectuivARB ; .type glGetQueryObjectuivARB,#function
- .globl glGetQueryivARB ; .type glGetQueryivARB,#function
- .globl glIsQueryARB ; .type glIsQueryARB,#function
- .globl glAttachObjectARB ; .type glAttachObjectARB,#function
- .globl glCompileShaderARB ; .type glCompileShaderARB,#function
- .globl glCreateProgramObjectARB ; .type glCreateProgramObjectARB,#function
- .globl glCreateShaderObjectARB ; .type glCreateShaderObjectARB,#function
- .globl glDeleteObjectARB ; .type glDeleteObjectARB,#function
- .globl glDetachObjectARB ; .type glDetachObjectARB,#function
- .globl glGetActiveUniformARB ; .type glGetActiveUniformARB,#function
- .globl glGetAttachedObjectsARB ; .type glGetAttachedObjectsARB,#function
- .globl glGetHandleARB ; .type glGetHandleARB,#function
- .globl glGetInfoLogARB ; .type glGetInfoLogARB,#function
- .globl glGetObjectParameterfvARB ; .type glGetObjectParameterfvARB,#function
- .globl glGetObjectParameterivARB ; .type glGetObjectParameterivARB,#function
- .globl glGetShaderSourceARB ; .type glGetShaderSourceARB,#function
- .globl glGetUniformLocationARB ; .type glGetUniformLocationARB,#function
- .globl glGetUniformfvARB ; .type glGetUniformfvARB,#function
- .globl glGetUniformivARB ; .type glGetUniformivARB,#function
- .globl glLinkProgramARB ; .type glLinkProgramARB,#function
- .globl glShaderSourceARB ; .type glShaderSourceARB,#function
- .globl glUniform1fARB ; .type glUniform1fARB,#function
- .globl glUniform1fvARB ; .type glUniform1fvARB,#function
- .globl glUniform1iARB ; .type glUniform1iARB,#function
- .globl glUniform1ivARB ; .type glUniform1ivARB,#function
- .globl glUniform2fARB ; .type glUniform2fARB,#function
- .globl glUniform2fvARB ; .type glUniform2fvARB,#function
- .globl glUniform2iARB ; .type glUniform2iARB,#function
- .globl glUniform2ivARB ; .type glUniform2ivARB,#function
- .globl glUniform3fARB ; .type glUniform3fARB,#function
- .globl glUniform3fvARB ; .type glUniform3fvARB,#function
- .globl glUniform3iARB ; .type glUniform3iARB,#function
- .globl glUniform3ivARB ; .type glUniform3ivARB,#function
- .globl glUniform4fARB ; .type glUniform4fARB,#function
- .globl glUniform4fvARB ; .type glUniform4fvARB,#function
- .globl glUniform4iARB ; .type glUniform4iARB,#function
- .globl glUniform4ivARB ; .type glUniform4ivARB,#function
- .globl glUniformMatrix2fvARB ; .type glUniformMatrix2fvARB,#function
- .globl glUniformMatrix3fvARB ; .type glUniformMatrix3fvARB,#function
- .globl glUniformMatrix4fvARB ; .type glUniformMatrix4fvARB,#function
- .globl glUseProgramObjectARB ; .type glUseProgramObjectARB,#function
- .globl glValidateProgramARB ; .type glValidateProgramARB,#function
- .globl glBindAttribLocationARB ; .type glBindAttribLocationARB,#function
- .globl glGetActiveAttribARB ; .type glGetActiveAttribARB,#function
- .globl glGetAttribLocationARB ; .type glGetAttribLocationARB,#function
- .globl glDrawBuffersARB ; .type glDrawBuffersARB,#function
- .globl glRenderbufferStorageMultisample ; .type glRenderbufferStorageMultisample,#function
- .globl glPolygonOffsetEXT ; .type glPolygonOffsetEXT,#function
- .globl gl_dispatch_stub_563 ; .type gl_dispatch_stub_563,#function
- .globl gl_dispatch_stub_564 ; .type gl_dispatch_stub_564,#function
- .globl gl_dispatch_stub_565 ; .type gl_dispatch_stub_565,#function
- .globl gl_dispatch_stub_566 ; .type gl_dispatch_stub_566,#function
- .globl gl_dispatch_stub_567 ; .type gl_dispatch_stub_567,#function
- .globl gl_dispatch_stub_568 ; .type gl_dispatch_stub_568,#function
- .globl gl_dispatch_stub_569 ; .type gl_dispatch_stub_569,#function
- .globl gl_dispatch_stub_570 ; .type gl_dispatch_stub_570,#function
- .globl glColorPointerEXT ; .type glColorPointerEXT,#function
- .globl glEdgeFlagPointerEXT ; .type glEdgeFlagPointerEXT,#function
- .globl glIndexPointerEXT ; .type glIndexPointerEXT,#function
- .globl glNormalPointerEXT ; .type glNormalPointerEXT,#function
- .globl glTexCoordPointerEXT ; .type glTexCoordPointerEXT,#function
- .globl glVertexPointerEXT ; .type glVertexPointerEXT,#function
- .globl glPointParameterfEXT ; .type glPointParameterfEXT,#function
- .globl glPointParameterfvEXT ; .type glPointParameterfvEXT,#function
- .globl glLockArraysEXT ; .type glLockArraysEXT,#function
- .globl glUnlockArraysEXT ; .type glUnlockArraysEXT,#function
- .globl gl_dispatch_stub_581 ; .type gl_dispatch_stub_581,#function
- .globl gl_dispatch_stub_582 ; .type gl_dispatch_stub_582,#function
- .globl glSecondaryColor3bEXT ; .type glSecondaryColor3bEXT,#function
- .globl glSecondaryColor3bvEXT ; .type glSecondaryColor3bvEXT,#function
- .globl glSecondaryColor3dEXT ; .type glSecondaryColor3dEXT,#function
- .globl glSecondaryColor3dvEXT ; .type glSecondaryColor3dvEXT,#function
- .globl glSecondaryColor3fEXT ; .type glSecondaryColor3fEXT,#function
- .globl glSecondaryColor3fvEXT ; .type glSecondaryColor3fvEXT,#function
- .globl glSecondaryColor3iEXT ; .type glSecondaryColor3iEXT,#function
- .globl glSecondaryColor3ivEXT ; .type glSecondaryColor3ivEXT,#function
- .globl glSecondaryColor3sEXT ; .type glSecondaryColor3sEXT,#function
- .globl glSecondaryColor3svEXT ; .type glSecondaryColor3svEXT,#function
- .globl glSecondaryColor3ubEXT ; .type glSecondaryColor3ubEXT,#function
- .globl glSecondaryColor3ubvEXT ; .type glSecondaryColor3ubvEXT,#function
- .globl glSecondaryColor3uiEXT ; .type glSecondaryColor3uiEXT,#function
- .globl glSecondaryColor3uivEXT ; .type glSecondaryColor3uivEXT,#function
- .globl glSecondaryColor3usEXT ; .type glSecondaryColor3usEXT,#function
- .globl glSecondaryColor3usvEXT ; .type glSecondaryColor3usvEXT,#function
- .globl glSecondaryColorPointerEXT ; .type glSecondaryColorPointerEXT,#function
- .globl glMultiDrawArraysEXT ; .type glMultiDrawArraysEXT,#function
- .globl glMultiDrawElementsEXT ; .type glMultiDrawElementsEXT,#function
- .globl glFogCoordPointerEXT ; .type glFogCoordPointerEXT,#function
- .globl glFogCoorddEXT ; .type glFogCoorddEXT,#function
- .globl glFogCoorddvEXT ; .type glFogCoorddvEXT,#function
- .globl glFogCoordfEXT ; .type glFogCoordfEXT,#function
- .globl glFogCoordfvEXT ; .type glFogCoordfvEXT,#function
- .globl gl_dispatch_stub_607 ; .type gl_dispatch_stub_607,#function
- .globl glBlendFuncSeparateEXT ; .type glBlendFuncSeparateEXT,#function
- .globl glFlushVertexArrayRangeNV ; .type glFlushVertexArrayRangeNV,#function
- .globl glVertexArrayRangeNV ; .type glVertexArrayRangeNV,#function
- .globl glCombinerInputNV ; .type glCombinerInputNV,#function
- .globl glCombinerOutputNV ; .type glCombinerOutputNV,#function
- .globl glCombinerParameterfNV ; .type glCombinerParameterfNV,#function
- .globl glCombinerParameterfvNV ; .type glCombinerParameterfvNV,#function
- .globl glCombinerParameteriNV ; .type glCombinerParameteriNV,#function
- .globl glCombinerParameterivNV ; .type glCombinerParameterivNV,#function
- .globl glFinalCombinerInputNV ; .type glFinalCombinerInputNV,#function
- .globl glGetCombinerInputParameterfvNV ; .type glGetCombinerInputParameterfvNV,#function
- .globl glGetCombinerInputParameterivNV ; .type glGetCombinerInputParameterivNV,#function
- .globl glGetCombinerOutputParameterfvNV ; .type glGetCombinerOutputParameterfvNV,#function
- .globl glGetCombinerOutputParameterivNV ; .type glGetCombinerOutputParameterivNV,#function
- .globl glGetFinalCombinerInputParameterfvNV ; .type glGetFinalCombinerInputParameterfvNV,#function
- .globl glGetFinalCombinerInputParameterivNV ; .type glGetFinalCombinerInputParameterivNV,#function
- .globl glResizeBuffersMESA ; .type glResizeBuffersMESA,#function
- .globl glWindowPos2dMESA ; .type glWindowPos2dMESA,#function
- .globl glWindowPos2dvMESA ; .type glWindowPos2dvMESA,#function
- .globl glWindowPos2fMESA ; .type glWindowPos2fMESA,#function
- .globl glWindowPos2fvMESA ; .type glWindowPos2fvMESA,#function
- .globl glWindowPos2iMESA ; .type glWindowPos2iMESA,#function
- .globl glWindowPos2ivMESA ; .type glWindowPos2ivMESA,#function
- .globl glWindowPos2sMESA ; .type glWindowPos2sMESA,#function
- .globl glWindowPos2svMESA ; .type glWindowPos2svMESA,#function
- .globl glWindowPos3dMESA ; .type glWindowPos3dMESA,#function
- .globl glWindowPos3dvMESA ; .type glWindowPos3dvMESA,#function
- .globl glWindowPos3fMESA ; .type glWindowPos3fMESA,#function
- .globl glWindowPos3fvMESA ; .type glWindowPos3fvMESA,#function
- .globl glWindowPos3iMESA ; .type glWindowPos3iMESA,#function
- .globl glWindowPos3ivMESA ; .type glWindowPos3ivMESA,#function
- .globl glWindowPos3sMESA ; .type glWindowPos3sMESA,#function
- .globl glWindowPos3svMESA ; .type glWindowPos3svMESA,#function
- .globl glWindowPos4dMESA ; .type glWindowPos4dMESA,#function
- .globl glWindowPos4dvMESA ; .type glWindowPos4dvMESA,#function
- .globl glWindowPos4fMESA ; .type glWindowPos4fMESA,#function
- .globl glWindowPos4fvMESA ; .type glWindowPos4fvMESA,#function
- .globl glWindowPos4iMESA ; .type glWindowPos4iMESA,#function
- .globl glWindowPos4ivMESA ; .type glWindowPos4ivMESA,#function
- .globl glWindowPos4sMESA ; .type glWindowPos4sMESA,#function
- .globl glWindowPos4svMESA ; .type glWindowPos4svMESA,#function
- .globl gl_dispatch_stub_649 ; .type gl_dispatch_stub_649,#function
- .globl gl_dispatch_stub_650 ; .type gl_dispatch_stub_650,#function
- .globl gl_dispatch_stub_651 ; .type gl_dispatch_stub_651,#function
- .globl gl_dispatch_stub_652 ; .type gl_dispatch_stub_652,#function
- .globl gl_dispatch_stub_653 ; .type gl_dispatch_stub_653,#function
- .globl gl_dispatch_stub_654 ; .type gl_dispatch_stub_654,#function
- .globl gl_dispatch_stub_655 ; .type gl_dispatch_stub_655,#function
- .globl gl_dispatch_stub_656 ; .type gl_dispatch_stub_656,#function
- .globl gl_dispatch_stub_657 ; .type gl_dispatch_stub_657,#function
- .globl glAreProgramsResidentNV ; .type glAreProgramsResidentNV,#function
- .globl glBindProgramNV ; .type glBindProgramNV,#function
- .globl glDeleteProgramsNV ; .type glDeleteProgramsNV,#function
- .globl glExecuteProgramNV ; .type glExecuteProgramNV,#function
- .globl glGenProgramsNV ; .type glGenProgramsNV,#function
- .globl glGetProgramParameterdvNV ; .type glGetProgramParameterdvNV,#function
- .globl glGetProgramParameterfvNV ; .type glGetProgramParameterfvNV,#function
- .globl glGetProgramStringNV ; .type glGetProgramStringNV,#function
- .globl glGetProgramivNV ; .type glGetProgramivNV,#function
- .globl glGetTrackMatrixivNV ; .type glGetTrackMatrixivNV,#function
- .globl glGetVertexAttribPointervNV ; .type glGetVertexAttribPointervNV,#function
- .globl glGetVertexAttribdvNV ; .type glGetVertexAttribdvNV,#function
- .globl glGetVertexAttribfvNV ; .type glGetVertexAttribfvNV,#function
- .globl glGetVertexAttribivNV ; .type glGetVertexAttribivNV,#function
- .globl glIsProgramNV ; .type glIsProgramNV,#function
- .globl glLoadProgramNV ; .type glLoadProgramNV,#function
- .globl glProgramParameters4dvNV ; .type glProgramParameters4dvNV,#function
- .globl glProgramParameters4fvNV ; .type glProgramParameters4fvNV,#function
- .globl glRequestResidentProgramsNV ; .type glRequestResidentProgramsNV,#function
- .globl glTrackMatrixNV ; .type glTrackMatrixNV,#function
- .globl glVertexAttrib1dNV ; .type glVertexAttrib1dNV,#function
- .globl glVertexAttrib1dvNV ; .type glVertexAttrib1dvNV,#function
- .globl glVertexAttrib1fNV ; .type glVertexAttrib1fNV,#function
- .globl glVertexAttrib1fvNV ; .type glVertexAttrib1fvNV,#function
- .globl glVertexAttrib1sNV ; .type glVertexAttrib1sNV,#function
- .globl glVertexAttrib1svNV ; .type glVertexAttrib1svNV,#function
- .globl glVertexAttrib2dNV ; .type glVertexAttrib2dNV,#function
- .globl glVertexAttrib2dvNV ; .type glVertexAttrib2dvNV,#function
- .globl glVertexAttrib2fNV ; .type glVertexAttrib2fNV,#function
- .globl glVertexAttrib2fvNV ; .type glVertexAttrib2fvNV,#function
- .globl glVertexAttrib2sNV ; .type glVertexAttrib2sNV,#function
- .globl glVertexAttrib2svNV ; .type glVertexAttrib2svNV,#function
- .globl glVertexAttrib3dNV ; .type glVertexAttrib3dNV,#function
- .globl glVertexAttrib3dvNV ; .type glVertexAttrib3dvNV,#function
- .globl glVertexAttrib3fNV ; .type glVertexAttrib3fNV,#function
- .globl glVertexAttrib3fvNV ; .type glVertexAttrib3fvNV,#function
- .globl glVertexAttrib3sNV ; .type glVertexAttrib3sNV,#function
- .globl glVertexAttrib3svNV ; .type glVertexAttrib3svNV,#function
- .globl glVertexAttrib4dNV ; .type glVertexAttrib4dNV,#function
- .globl glVertexAttrib4dvNV ; .type glVertexAttrib4dvNV,#function
- .globl glVertexAttrib4fNV ; .type glVertexAttrib4fNV,#function
- .globl glVertexAttrib4fvNV ; .type glVertexAttrib4fvNV,#function
- .globl glVertexAttrib4sNV ; .type glVertexAttrib4sNV,#function
- .globl glVertexAttrib4svNV ; .type glVertexAttrib4svNV,#function
- .globl glVertexAttrib4ubNV ; .type glVertexAttrib4ubNV,#function
- .globl glVertexAttrib4ubvNV ; .type glVertexAttrib4ubvNV,#function
- .globl glVertexAttribPointerNV ; .type glVertexAttribPointerNV,#function
- .globl glVertexAttribs1dvNV ; .type glVertexAttribs1dvNV,#function
- .globl glVertexAttribs1fvNV ; .type glVertexAttribs1fvNV,#function
- .globl glVertexAttribs1svNV ; .type glVertexAttribs1svNV,#function
- .globl glVertexAttribs2dvNV ; .type glVertexAttribs2dvNV,#function
- .globl glVertexAttribs2fvNV ; .type glVertexAttribs2fvNV,#function
- .globl glVertexAttribs2svNV ; .type glVertexAttribs2svNV,#function
- .globl glVertexAttribs3dvNV ; .type glVertexAttribs3dvNV,#function
- .globl glVertexAttribs3fvNV ; .type glVertexAttribs3fvNV,#function
- .globl glVertexAttribs3svNV ; .type glVertexAttribs3svNV,#function
- .globl glVertexAttribs4dvNV ; .type glVertexAttribs4dvNV,#function
- .globl glVertexAttribs4fvNV ; .type glVertexAttribs4fvNV,#function
- .globl glVertexAttribs4svNV ; .type glVertexAttribs4svNV,#function
- .globl glVertexAttribs4ubvNV ; .type glVertexAttribs4ubvNV,#function
- .globl glAlphaFragmentOp1ATI ; .type glAlphaFragmentOp1ATI,#function
- .globl glAlphaFragmentOp2ATI ; .type glAlphaFragmentOp2ATI,#function
- .globl glAlphaFragmentOp3ATI ; .type glAlphaFragmentOp3ATI,#function
- .globl glBeginFragmentShaderATI ; .type glBeginFragmentShaderATI,#function
- .globl glBindFragmentShaderATI ; .type glBindFragmentShaderATI,#function
- .globl glColorFragmentOp1ATI ; .type glColorFragmentOp1ATI,#function
- .globl glColorFragmentOp2ATI ; .type glColorFragmentOp2ATI,#function
- .globl glColorFragmentOp3ATI ; .type glColorFragmentOp3ATI,#function
- .globl glDeleteFragmentShaderATI ; .type glDeleteFragmentShaderATI,#function
- .globl glEndFragmentShaderATI ; .type glEndFragmentShaderATI,#function
- .globl glGenFragmentShadersATI ; .type glGenFragmentShadersATI,#function
- .globl glPassTexCoordATI ; .type glPassTexCoordATI,#function
- .globl glSampleMapATI ; .type glSampleMapATI,#function
- .globl glSetFragmentShaderConstantATI ; .type glSetFragmentShaderConstantATI,#function
- .globl glPointParameteriNV ; .type glPointParameteriNV,#function
- .globl glPointParameterivNV ; .type glPointParameterivNV,#function
- .globl gl_dispatch_stub_734 ; .type gl_dispatch_stub_734,#function
- .globl gl_dispatch_stub_735 ; .type gl_dispatch_stub_735,#function
- .globl gl_dispatch_stub_736 ; .type gl_dispatch_stub_736,#function
- .globl gl_dispatch_stub_737 ; .type gl_dispatch_stub_737,#function
- .globl gl_dispatch_stub_738 ; .type gl_dispatch_stub_738,#function
- .globl glGetProgramNamedParameterdvNV ; .type glGetProgramNamedParameterdvNV,#function
- .globl glGetProgramNamedParameterfvNV ; .type glGetProgramNamedParameterfvNV,#function
- .globl glProgramNamedParameter4dNV ; .type glProgramNamedParameter4dNV,#function
- .globl glProgramNamedParameter4dvNV ; .type glProgramNamedParameter4dvNV,#function
- .globl glProgramNamedParameter4fNV ; .type glProgramNamedParameter4fNV,#function
- .globl glProgramNamedParameter4fvNV ; .type glProgramNamedParameter4fvNV,#function
- .globl gl_dispatch_stub_745 ; .type gl_dispatch_stub_745,#function
- .globl gl_dispatch_stub_746 ; .type gl_dispatch_stub_746,#function
- .globl glBindFramebufferEXT ; .type glBindFramebufferEXT,#function
- .globl glBindRenderbufferEXT ; .type glBindRenderbufferEXT,#function
- .globl glCheckFramebufferStatusEXT ; .type glCheckFramebufferStatusEXT,#function
- .globl glDeleteFramebuffersEXT ; .type glDeleteFramebuffersEXT,#function
- .globl glDeleteRenderbuffersEXT ; .type glDeleteRenderbuffersEXT,#function
- .globl glFramebufferRenderbufferEXT ; .type glFramebufferRenderbufferEXT,#function
- .globl glFramebufferTexture1DEXT ; .type glFramebufferTexture1DEXT,#function
- .globl glFramebufferTexture2DEXT ; .type glFramebufferTexture2DEXT,#function
- .globl glFramebufferTexture3DEXT ; .type glFramebufferTexture3DEXT,#function
- .globl glGenFramebuffersEXT ; .type glGenFramebuffersEXT,#function
- .globl glGenRenderbuffersEXT ; .type glGenRenderbuffersEXT,#function
- .globl glGenerateMipmapEXT ; .type glGenerateMipmapEXT,#function
- .globl glGetFramebufferAttachmentParameterivEXT ; .type glGetFramebufferAttachmentParameterivEXT,#function
- .globl glGetRenderbufferParameterivEXT ; .type glGetRenderbufferParameterivEXT,#function
- .globl glIsFramebufferEXT ; .type glIsFramebufferEXT,#function
- .globl glIsRenderbufferEXT ; .type glIsRenderbufferEXT,#function
- .globl glRenderbufferStorageEXT ; .type glRenderbufferStorageEXT,#function
- .globl gl_dispatch_stub_764 ; .type gl_dispatch_stub_764,#function
- .globl glFramebufferTextureLayerEXT ; .type glFramebufferTextureLayerEXT,#function
- .globl gl_dispatch_stub_766 ; .type gl_dispatch_stub_766,#function
- .globl gl_dispatch_stub_767 ; .type gl_dispatch_stub_767,#function
- .globl gl_dispatch_stub_768 ; .type gl_dispatch_stub_768,#function
- .globl gl_dispatch_stub_769 ; .type gl_dispatch_stub_769,#function
- .globl gl_dispatch_stub_770 ; .type gl_dispatch_stub_770,#function
- .globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function
-_mesa_sparc_glapi_begin:
+ .data
+ .align 32
+
+ GLOBL_FN(__glapi_sparc_pthread_stub)
+ HIDDEN(__glapi_sparc_pthread_stub)
+__glapi_sparc_pthread_stub: /* Call offset in %g3 */
+ mov %o7, %g1
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2
+ call __glapi_sparc_get_pc
+ add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2
+ mov %g1, %o7
+ sethi %hi(_glapi_Dispatch), %g1
+ or %g1, %lo(_glapi_Dispatch), %g1
+ srl %g3, 10, %g3
+ GL_LL [%g2+%g1], %g2
+ GL_LL [%g2], %g1
+ cmp %g1, 0
+ be 2f
+ nop
+1: GL_LL [%g1 + %g3], %g1
+ jmp %g1
+ nop
+2: save %sp, GL_STACK_SIZE, %sp
+ mov %g3, %l0
+ call _glapi_get_dispatch
+ nop
+ mov %o0, %g1
+ mov %l0, %g3
+ ba 1b
+ restore %g0, %g0, %g0
+ .size __glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub
+
+#define GL_STUB(fn, off) \
+ GLOBL_FN(fn); \
+fn: ba __glapi_sparc_pthread_stub; \
+ sethi GL_OFF(off), %g3; \
+ .size fn,.-fn;
+
+#else /* Non-threaded version. */
+
+ .type __glapi_sparc_nothread_stub, @function
+__glapi_sparc_nothread_stub: /* Call offset in %g3 */
+ mov %o7, %g1
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2
+ call __glapi_sparc_get_pc
+ add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2
+ mov %g1, %o7
+ srl %g3, 10, %g3
+ sethi %hi(_glapi_Dispatch), %g1
+ or %g1, %lo(_glapi_Dispatch), %g1
+ GL_LL [%g2+%g1], %g2
+ GL_LL [%g2], %g1
+ GL_LL [%g1 + %g3], %g1
+ jmp %g1
+ nop
+ .size __glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub
+
+#define GL_STUB(fn, off) \
+ GLOBL_FN(fn); \
+fn: ba __glapi_sparc_nothread_stub; \
+ sethi GL_OFF(off), %g3; \
+ .size fn,.-fn;
+
+#endif
+
+#define GL_STUB_ALIAS(fn, alias) \
+ .globl fn; \
+ .set fn, alias
+
+ .text
+ .align 32
+
+ .globl gl_dispatch_functions_start
+ HIDDEN(gl_dispatch_functions_start)
+gl_dispatch_functions_start:
GL_STUB(glNewList, _gloffset_NewList)
GL_STUB(glEndList, _gloffset_EndList)
@@ -1402,14 +760,22 @@ _mesa_sparc_glapi_begin:
GL_STUB(glDrawBuffersARB, _gloffset_DrawBuffersARB)
GL_STUB(glRenderbufferStorageMultisample, _gloffset_RenderbufferStorageMultisample)
GL_STUB(glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT)
- GL_STUB(gl_dispatch_stub_563, _gloffset__dispatch_stub_563)
- GL_STUB(gl_dispatch_stub_564, _gloffset__dispatch_stub_564)
- GL_STUB(gl_dispatch_stub_565, _gloffset__dispatch_stub_565)
- GL_STUB(gl_dispatch_stub_566, _gloffset__dispatch_stub_566)
- GL_STUB(gl_dispatch_stub_567, _gloffset__dispatch_stub_567)
- GL_STUB(gl_dispatch_stub_568, _gloffset__dispatch_stub_568)
- GL_STUB(gl_dispatch_stub_569, _gloffset__dispatch_stub_569)
- GL_STUB(gl_dispatch_stub_570, _gloffset__dispatch_stub_570)
+ GL_STUB(gl_dispatch_stub_563, _gloffset_GetPixelTexGenParameterfvSGIS)
+ HIDDEN(gl_dispatch_stub_563)
+ GL_STUB(gl_dispatch_stub_564, _gloffset_GetPixelTexGenParameterivSGIS)
+ HIDDEN(gl_dispatch_stub_564)
+ GL_STUB(gl_dispatch_stub_565, _gloffset_PixelTexGenParameterfSGIS)
+ HIDDEN(gl_dispatch_stub_565)
+ GL_STUB(gl_dispatch_stub_566, _gloffset_PixelTexGenParameterfvSGIS)
+ HIDDEN(gl_dispatch_stub_566)
+ GL_STUB(gl_dispatch_stub_567, _gloffset_PixelTexGenParameteriSGIS)
+ HIDDEN(gl_dispatch_stub_567)
+ GL_STUB(gl_dispatch_stub_568, _gloffset_PixelTexGenParameterivSGIS)
+ HIDDEN(gl_dispatch_stub_568)
+ GL_STUB(gl_dispatch_stub_569, _gloffset_SampleMaskSGIS)
+ HIDDEN(gl_dispatch_stub_569)
+ GL_STUB(gl_dispatch_stub_570, _gloffset_SamplePatternSGIS)
+ HIDDEN(gl_dispatch_stub_570)
GL_STUB(glColorPointerEXT, _gloffset_ColorPointerEXT)
GL_STUB(glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT)
GL_STUB(glIndexPointerEXT, _gloffset_IndexPointerEXT)
@@ -1420,8 +786,10 @@ _mesa_sparc_glapi_begin:
GL_STUB(glPointParameterfvEXT, _gloffset_PointParameterfvEXT)
GL_STUB(glLockArraysEXT, _gloffset_LockArraysEXT)
GL_STUB(glUnlockArraysEXT, _gloffset_UnlockArraysEXT)
- GL_STUB(gl_dispatch_stub_581, _gloffset__dispatch_stub_581)
- GL_STUB(gl_dispatch_stub_582, _gloffset__dispatch_stub_582)
+ GL_STUB(gl_dispatch_stub_581, _gloffset_CullParameterdvEXT)
+ HIDDEN(gl_dispatch_stub_581)
+ GL_STUB(gl_dispatch_stub_582, _gloffset_CullParameterfvEXT)
+ HIDDEN(gl_dispatch_stub_582)
GL_STUB(glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT)
GL_STUB(glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT)
GL_STUB(glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT)
@@ -1446,7 +814,8 @@ _mesa_sparc_glapi_begin:
GL_STUB(glFogCoorddvEXT, _gloffset_FogCoorddvEXT)
GL_STUB(glFogCoordfEXT, _gloffset_FogCoordfEXT)
GL_STUB(glFogCoordfvEXT, _gloffset_FogCoordfvEXT)
- GL_STUB(gl_dispatch_stub_607, _gloffset__dispatch_stub_607)
+ GL_STUB(gl_dispatch_stub_607, _gloffset_PixelTexGenSGIX)
+ HIDDEN(gl_dispatch_stub_607)
GL_STUB(glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT)
GL_STUB(glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV)
GL_STUB(glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV)
@@ -1488,15 +857,24 @@ _mesa_sparc_glapi_begin:
GL_STUB(glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA)
GL_STUB(glWindowPos4sMESA, _gloffset_WindowPos4sMESA)
GL_STUB(glWindowPos4svMESA, _gloffset_WindowPos4svMESA)
- GL_STUB(gl_dispatch_stub_649, _gloffset__dispatch_stub_649)
- GL_STUB(gl_dispatch_stub_650, _gloffset__dispatch_stub_650)
- GL_STUB(gl_dispatch_stub_651, _gloffset__dispatch_stub_651)
- GL_STUB(gl_dispatch_stub_652, _gloffset__dispatch_stub_652)
- GL_STUB(gl_dispatch_stub_653, _gloffset__dispatch_stub_653)
- GL_STUB(gl_dispatch_stub_654, _gloffset__dispatch_stub_654)
- GL_STUB(gl_dispatch_stub_655, _gloffset__dispatch_stub_655)
- GL_STUB(gl_dispatch_stub_656, _gloffset__dispatch_stub_656)
- GL_STUB(gl_dispatch_stub_657, _gloffset__dispatch_stub_657)
+ GL_STUB(gl_dispatch_stub_649, _gloffset_MultiModeDrawArraysIBM)
+ HIDDEN(gl_dispatch_stub_649)
+ GL_STUB(gl_dispatch_stub_650, _gloffset_MultiModeDrawElementsIBM)
+ HIDDEN(gl_dispatch_stub_650)
+ GL_STUB(gl_dispatch_stub_651, _gloffset_DeleteFencesNV)
+ HIDDEN(gl_dispatch_stub_651)
+ GL_STUB(gl_dispatch_stub_652, _gloffset_FinishFenceNV)
+ HIDDEN(gl_dispatch_stub_652)
+ GL_STUB(gl_dispatch_stub_653, _gloffset_GenFencesNV)
+ HIDDEN(gl_dispatch_stub_653)
+ GL_STUB(gl_dispatch_stub_654, _gloffset_GetFenceivNV)
+ HIDDEN(gl_dispatch_stub_654)
+ GL_STUB(gl_dispatch_stub_655, _gloffset_IsFenceNV)
+ HIDDEN(gl_dispatch_stub_655)
+ GL_STUB(gl_dispatch_stub_656, _gloffset_SetFenceNV)
+ HIDDEN(gl_dispatch_stub_656)
+ GL_STUB(gl_dispatch_stub_657, _gloffset_TestFenceNV)
+ HIDDEN(gl_dispatch_stub_657)
GL_STUB(glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV)
GL_STUB(glBindProgramNV, _gloffset_BindProgramNV)
GL_STUB(glDeleteProgramsNV, _gloffset_DeleteProgramsNV)
@@ -1573,19 +951,26 @@ _mesa_sparc_glapi_begin:
GL_STUB(glSetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI)
GL_STUB(glPointParameteriNV, _gloffset_PointParameteriNV)
GL_STUB(glPointParameterivNV, _gloffset_PointParameterivNV)
- GL_STUB(gl_dispatch_stub_734, _gloffset__dispatch_stub_734)
- GL_STUB(gl_dispatch_stub_735, _gloffset__dispatch_stub_735)
- GL_STUB(gl_dispatch_stub_736, _gloffset__dispatch_stub_736)
- GL_STUB(gl_dispatch_stub_737, _gloffset__dispatch_stub_737)
- GL_STUB(gl_dispatch_stub_738, _gloffset__dispatch_stub_738)
+ GL_STUB(gl_dispatch_stub_734, _gloffset_ActiveStencilFaceEXT)
+ HIDDEN(gl_dispatch_stub_734)
+ GL_STUB(gl_dispatch_stub_735, _gloffset_BindVertexArrayAPPLE)
+ HIDDEN(gl_dispatch_stub_735)
+ GL_STUB(gl_dispatch_stub_736, _gloffset_DeleteVertexArraysAPPLE)
+ HIDDEN(gl_dispatch_stub_736)
+ GL_STUB(gl_dispatch_stub_737, _gloffset_GenVertexArraysAPPLE)
+ HIDDEN(gl_dispatch_stub_737)
+ GL_STUB(gl_dispatch_stub_738, _gloffset_IsVertexArrayAPPLE)
+ HIDDEN(gl_dispatch_stub_738)
GL_STUB(glGetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV)
GL_STUB(glGetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV)
GL_STUB(glProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV)
GL_STUB(glProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV)
GL_STUB(glProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV)
GL_STUB(glProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV)
- GL_STUB(gl_dispatch_stub_745, _gloffset__dispatch_stub_745)
- GL_STUB(gl_dispatch_stub_746, _gloffset__dispatch_stub_746)
+ GL_STUB(gl_dispatch_stub_745, _gloffset_DepthBoundsEXT)
+ HIDDEN(gl_dispatch_stub_745)
+ GL_STUB(gl_dispatch_stub_746, _gloffset_BlendEquationSeparateEXT)
+ HIDDEN(gl_dispatch_stub_746)
GL_STUB(glBindFramebufferEXT, _gloffset_BindFramebufferEXT)
GL_STUB(glBindRenderbufferEXT, _gloffset_BindRenderbufferEXT)
GL_STUB(glCheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT)
@@ -1603,287 +988,353 @@ _mesa_sparc_glapi_begin:
GL_STUB(glIsFramebufferEXT, _gloffset_IsFramebufferEXT)
GL_STUB(glIsRenderbufferEXT, _gloffset_IsRenderbufferEXT)
GL_STUB(glRenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT)
- GL_STUB(gl_dispatch_stub_764, _gloffset__dispatch_stub_764)
+ GL_STUB(gl_dispatch_stub_764, _gloffset_BlitFramebufferEXT)
+ HIDDEN(gl_dispatch_stub_764)
GL_STUB(glFramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT)
- GL_STUB(gl_dispatch_stub_766, _gloffset__dispatch_stub_766)
- GL_STUB(gl_dispatch_stub_767, _gloffset__dispatch_stub_767)
- GL_STUB(gl_dispatch_stub_768, _gloffset__dispatch_stub_768)
- GL_STUB(gl_dispatch_stub_769, _gloffset__dispatch_stub_769)
- GL_STUB(gl_dispatch_stub_770, _gloffset__dispatch_stub_770)
-
- .globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function
-_mesa_sparc_glapi_end:
-
- .globl glArrayElementEXT ; .type glArrayElementEXT,#function ; glArrayElementEXT = glArrayElement
- .globl glBindTextureEXT ; .type glBindTextureEXT,#function ; glBindTextureEXT = glBindTexture
- .globl glDrawArraysEXT ; .type glDrawArraysEXT,#function ; glDrawArraysEXT = glDrawArrays
+ GL_STUB(gl_dispatch_stub_766, _gloffset_StencilFuncSeparateATI)
+ HIDDEN(gl_dispatch_stub_766)
+ GL_STUB(gl_dispatch_stub_767, _gloffset_ProgramEnvParameters4fvEXT)
+ HIDDEN(gl_dispatch_stub_767)
+ GL_STUB(gl_dispatch_stub_768, _gloffset_ProgramLocalParameters4fvEXT)
+ HIDDEN(gl_dispatch_stub_768)
+ GL_STUB(gl_dispatch_stub_769, _gloffset_GetQueryObjecti64vEXT)
+ HIDDEN(gl_dispatch_stub_769)
+ GL_STUB(gl_dispatch_stub_770, _gloffset_GetQueryObjectui64vEXT)
+ HIDDEN(gl_dispatch_stub_770)
+ GL_STUB_ALIAS(glArrayElementEXT, glArrayElement)
+ GL_STUB_ALIAS(glBindTextureEXT, glBindTexture)
+ GL_STUB_ALIAS(glDrawArraysEXT, glDrawArrays)
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glAreTexturesResidentEXT, glAreTexturesResident)
+#endif
+ GL_STUB_ALIAS(glCopyTexImage1DEXT, glCopyTexImage1D)
+ GL_STUB_ALIAS(glCopyTexImage2DEXT, glCopyTexImage2D)
+ GL_STUB_ALIAS(glCopyTexSubImage1DEXT, glCopyTexSubImage1D)
+ GL_STUB_ALIAS(glCopyTexSubImage2DEXT, glCopyTexSubImage2D)
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glDeleteTexturesEXT, glDeleteTextures)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glGenTexturesEXT, glGenTextures)
+#endif
+ GL_STUB_ALIAS(glGetPointervEXT, glGetPointerv)
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glIsTextureEXT, glIsTexture)
+#endif
+ GL_STUB_ALIAS(glPrioritizeTexturesEXT, glPrioritizeTextures)
+ GL_STUB_ALIAS(glTexSubImage1DEXT, glTexSubImage1D)
+ GL_STUB_ALIAS(glTexSubImage2DEXT, glTexSubImage2D)
+ GL_STUB_ALIAS(glBlendColorEXT, glBlendColor)
+ GL_STUB_ALIAS(glBlendEquationEXT, glBlendEquation)
+ GL_STUB_ALIAS(glDrawRangeElementsEXT, glDrawRangeElements)
+ GL_STUB_ALIAS(glColorTableSGI, glColorTable)
+ GL_STUB_ALIAS(glColorTableEXT, glColorTable)
+ GL_STUB_ALIAS(glColorTableParameterfvSGI, glColorTableParameterfv)
+ GL_STUB_ALIAS(glColorTableParameterivSGI, glColorTableParameteriv)
+ GL_STUB_ALIAS(glCopyColorTableSGI, glCopyColorTable)
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glGetColorTableSGI, glGetColorTable)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glGetColorTableEXT, glGetColorTable)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glGetColorTableParameterfvSGI, glGetColorTableParameterfv)
+#endif
#ifndef GLX_INDIRECT_RENDERING
- .globl glAreTexturesResidentEXT ; .type glAreTexturesResidentEXT,#function ; glAreTexturesResidentEXT = glAreTexturesResident
+ GL_STUB_ALIAS(glGetColorTableParameterfvEXT, glGetColorTableParameterfv)
#endif
- .globl glCopyTexImage1DEXT ; .type glCopyTexImage1DEXT,#function ; glCopyTexImage1DEXT = glCopyTexImage1D
- .globl glCopyTexImage2DEXT ; .type glCopyTexImage2DEXT,#function ; glCopyTexImage2DEXT = glCopyTexImage2D
- .globl glCopyTexSubImage1DEXT ; .type glCopyTexSubImage1DEXT,#function ; glCopyTexSubImage1DEXT = glCopyTexSubImage1D
- .globl glCopyTexSubImage2DEXT ; .type glCopyTexSubImage2DEXT,#function ; glCopyTexSubImage2DEXT = glCopyTexSubImage2D
#ifndef GLX_INDIRECT_RENDERING
- .globl glDeleteTexturesEXT ; .type glDeleteTexturesEXT,#function ; glDeleteTexturesEXT = glDeleteTextures
+ GL_STUB_ALIAS(glGetColorTableParameterivSGI, glGetColorTableParameteriv)
#endif
#ifndef GLX_INDIRECT_RENDERING
- .globl glGenTexturesEXT ; .type glGenTexturesEXT,#function ; glGenTexturesEXT = glGenTextures
+ GL_STUB_ALIAS(glGetColorTableParameterivEXT, glGetColorTableParameteriv)
#endif
- .globl glGetPointervEXT ; .type glGetPointervEXT,#function ; glGetPointervEXT = glGetPointerv
+ GL_STUB_ALIAS(glColorSubTableEXT, glColorSubTable)
+ GL_STUB_ALIAS(glCopyColorSubTableEXT, glCopyColorSubTable)
+ GL_STUB_ALIAS(glConvolutionFilter1DEXT, glConvolutionFilter1D)
+ GL_STUB_ALIAS(glConvolutionFilter2DEXT, glConvolutionFilter2D)
+ GL_STUB_ALIAS(glConvolutionParameterfEXT, glConvolutionParameterf)
+ GL_STUB_ALIAS(glConvolutionParameterfvEXT, glConvolutionParameterfv)
+ GL_STUB_ALIAS(glConvolutionParameteriEXT, glConvolutionParameteri)
+ GL_STUB_ALIAS(glConvolutionParameterivEXT, glConvolutionParameteriv)
+ GL_STUB_ALIAS(glCopyConvolutionFilter1DEXT, glCopyConvolutionFilter1D)
+ GL_STUB_ALIAS(glCopyConvolutionFilter2DEXT, glCopyConvolutionFilter2D)
#ifndef GLX_INDIRECT_RENDERING
- .globl glIsTextureEXT ; .type glIsTextureEXT,#function ; glIsTextureEXT = glIsTexture
+ GL_STUB_ALIAS(glGetConvolutionFilterEXT, glGetConvolutionFilter)
#endif
- .globl glPrioritizeTexturesEXT ; .type glPrioritizeTexturesEXT,#function ; glPrioritizeTexturesEXT = glPrioritizeTextures
- .globl glTexSubImage1DEXT ; .type glTexSubImage1DEXT,#function ; glTexSubImage1DEXT = glTexSubImage1D
- .globl glTexSubImage2DEXT ; .type glTexSubImage2DEXT,#function ; glTexSubImage2DEXT = glTexSubImage2D
- .globl glBlendColorEXT ; .type glBlendColorEXT,#function ; glBlendColorEXT = glBlendColor
- .globl glBlendEquationEXT ; .type glBlendEquationEXT,#function ; glBlendEquationEXT = glBlendEquation
- .globl glDrawRangeElementsEXT ; .type glDrawRangeElementsEXT,#function ; glDrawRangeElementsEXT = glDrawRangeElements
- .globl glColorTableEXT ; .type glColorTableEXT,#function ; glColorTableEXT = glColorTable
#ifndef GLX_INDIRECT_RENDERING
- .globl glGetColorTableEXT ; .type glGetColorTableEXT,#function ; glGetColorTableEXT = glGetColorTable
+ GL_STUB_ALIAS(glGetConvolutionParameterfvEXT, glGetConvolutionParameterfv)
#endif
#ifndef GLX_INDIRECT_RENDERING
- .globl glGetColorTableParameterfvEXT ; .type glGetColorTableParameterfvEXT,#function ; glGetColorTableParameterfvEXT = glGetColorTableParameterfv
+ GL_STUB_ALIAS(glGetConvolutionParameterivEXT, glGetConvolutionParameteriv)
#endif
#ifndef GLX_INDIRECT_RENDERING
- .globl glGetColorTableParameterivEXT ; .type glGetColorTableParameterivEXT,#function ; glGetColorTableParameterivEXT = glGetColorTableParameteriv
+ GL_STUB_ALIAS(glGetSeparableFilterEXT, glGetSeparableFilter)
#endif
- .globl glTexImage3DEXT ; .type glTexImage3DEXT,#function ; glTexImage3DEXT = glTexImage3D
- .globl glTexSubImage3DEXT ; .type glTexSubImage3DEXT,#function ; glTexSubImage3DEXT = glTexSubImage3D
- .globl glCopyTexSubImage3DEXT ; .type glCopyTexSubImage3DEXT,#function ; glCopyTexSubImage3DEXT = glCopyTexSubImage3D
- .globl glActiveTexture ; .type glActiveTexture,#function ; glActiveTexture = glActiveTextureARB
- .globl glClientActiveTexture ; .type glClientActiveTexture,#function ; glClientActiveTexture = glClientActiveTextureARB
- .globl glMultiTexCoord1d ; .type glMultiTexCoord1d,#function ; glMultiTexCoord1d = glMultiTexCoord1dARB
- .globl glMultiTexCoord1dv ; .type glMultiTexCoord1dv,#function ; glMultiTexCoord1dv = glMultiTexCoord1dvARB
- .globl glMultiTexCoord1f ; .type glMultiTexCoord1f,#function ; glMultiTexCoord1f = glMultiTexCoord1fARB
- .globl glMultiTexCoord1fv ; .type glMultiTexCoord1fv,#function ; glMultiTexCoord1fv = glMultiTexCoord1fvARB
- .globl glMultiTexCoord1i ; .type glMultiTexCoord1i,#function ; glMultiTexCoord1i = glMultiTexCoord1iARB
- .globl glMultiTexCoord1iv ; .type glMultiTexCoord1iv,#function ; glMultiTexCoord1iv = glMultiTexCoord1ivARB
- .globl glMultiTexCoord1s ; .type glMultiTexCoord1s,#function ; glMultiTexCoord1s = glMultiTexCoord1sARB
- .globl glMultiTexCoord1sv ; .type glMultiTexCoord1sv,#function ; glMultiTexCoord1sv = glMultiTexCoord1svARB
- .globl glMultiTexCoord2d ; .type glMultiTexCoord2d,#function ; glMultiTexCoord2d = glMultiTexCoord2dARB
- .globl glMultiTexCoord2dv ; .type glMultiTexCoord2dv,#function ; glMultiTexCoord2dv = glMultiTexCoord2dvARB
- .globl glMultiTexCoord2f ; .type glMultiTexCoord2f,#function ; glMultiTexCoord2f = glMultiTexCoord2fARB
- .globl glMultiTexCoord2fv ; .type glMultiTexCoord2fv,#function ; glMultiTexCoord2fv = glMultiTexCoord2fvARB
- .globl glMultiTexCoord2i ; .type glMultiTexCoord2i,#function ; glMultiTexCoord2i = glMultiTexCoord2iARB
- .globl glMultiTexCoord2iv ; .type glMultiTexCoord2iv,#function ; glMultiTexCoord2iv = glMultiTexCoord2ivARB
- .globl glMultiTexCoord2s ; .type glMultiTexCoord2s,#function ; glMultiTexCoord2s = glMultiTexCoord2sARB
- .globl glMultiTexCoord2sv ; .type glMultiTexCoord2sv,#function ; glMultiTexCoord2sv = glMultiTexCoord2svARB
- .globl glMultiTexCoord3d ; .type glMultiTexCoord3d,#function ; glMultiTexCoord3d = glMultiTexCoord3dARB
- .globl glMultiTexCoord3dv ; .type glMultiTexCoord3dv,#function ; glMultiTexCoord3dv = glMultiTexCoord3dvARB
- .globl glMultiTexCoord3f ; .type glMultiTexCoord3f,#function ; glMultiTexCoord3f = glMultiTexCoord3fARB
- .globl glMultiTexCoord3fv ; .type glMultiTexCoord3fv,#function ; glMultiTexCoord3fv = glMultiTexCoord3fvARB
- .globl glMultiTexCoord3i ; .type glMultiTexCoord3i,#function ; glMultiTexCoord3i = glMultiTexCoord3iARB
- .globl glMultiTexCoord3iv ; .type glMultiTexCoord3iv,#function ; glMultiTexCoord3iv = glMultiTexCoord3ivARB
- .globl glMultiTexCoord3s ; .type glMultiTexCoord3s,#function ; glMultiTexCoord3s = glMultiTexCoord3sARB
- .globl glMultiTexCoord3sv ; .type glMultiTexCoord3sv,#function ; glMultiTexCoord3sv = glMultiTexCoord3svARB
- .globl glMultiTexCoord4d ; .type glMultiTexCoord4d,#function ; glMultiTexCoord4d = glMultiTexCoord4dARB
- .globl glMultiTexCoord4dv ; .type glMultiTexCoord4dv,#function ; glMultiTexCoord4dv = glMultiTexCoord4dvARB
- .globl glMultiTexCoord4f ; .type glMultiTexCoord4f,#function ; glMultiTexCoord4f = glMultiTexCoord4fARB
- .globl glMultiTexCoord4fv ; .type glMultiTexCoord4fv,#function ; glMultiTexCoord4fv = glMultiTexCoord4fvARB
- .globl glMultiTexCoord4i ; .type glMultiTexCoord4i,#function ; glMultiTexCoord4i = glMultiTexCoord4iARB
- .globl glMultiTexCoord4iv ; .type glMultiTexCoord4iv,#function ; glMultiTexCoord4iv = glMultiTexCoord4ivARB
- .globl glMultiTexCoord4s ; .type glMultiTexCoord4s,#function ; glMultiTexCoord4s = glMultiTexCoord4sARB
- .globl glMultiTexCoord4sv ; .type glMultiTexCoord4sv,#function ; glMultiTexCoord4sv = glMultiTexCoord4svARB
- .globl glLoadTransposeMatrixd ; .type glLoadTransposeMatrixd,#function ; glLoadTransposeMatrixd = glLoadTransposeMatrixdARB
- .globl glLoadTransposeMatrixf ; .type glLoadTransposeMatrixf,#function ; glLoadTransposeMatrixf = glLoadTransposeMatrixfARB
- .globl glMultTransposeMatrixd ; .type glMultTransposeMatrixd,#function ; glMultTransposeMatrixd = glMultTransposeMatrixdARB
- .globl glMultTransposeMatrixf ; .type glMultTransposeMatrixf,#function ; glMultTransposeMatrixf = glMultTransposeMatrixfARB
- .globl glSampleCoverage ; .type glSampleCoverage,#function ; glSampleCoverage = glSampleCoverageARB
- .globl glCompressedTexImage1D ; .type glCompressedTexImage1D,#function ; glCompressedTexImage1D = glCompressedTexImage1DARB
- .globl glCompressedTexImage2D ; .type glCompressedTexImage2D,#function ; glCompressedTexImage2D = glCompressedTexImage2DARB
- .globl glCompressedTexImage3D ; .type glCompressedTexImage3D,#function ; glCompressedTexImage3D = glCompressedTexImage3DARB
- .globl glCompressedTexSubImage1D ; .type glCompressedTexSubImage1D,#function ; glCompressedTexSubImage1D = glCompressedTexSubImage1DARB
- .globl glCompressedTexSubImage2D ; .type glCompressedTexSubImage2D,#function ; glCompressedTexSubImage2D = glCompressedTexSubImage2DARB
- .globl glCompressedTexSubImage3D ; .type glCompressedTexSubImage3D,#function ; glCompressedTexSubImage3D = glCompressedTexSubImage3DARB
- .globl glGetCompressedTexImage ; .type glGetCompressedTexImage,#function ; glGetCompressedTexImage = glGetCompressedTexImageARB
- .globl glDisableVertexAttribArray ; .type glDisableVertexAttribArray,#function ; glDisableVertexAttribArray = glDisableVertexAttribArrayARB
- .globl glEnableVertexAttribArray ; .type glEnableVertexAttribArray,#function ; glEnableVertexAttribArray = glEnableVertexAttribArrayARB
- .globl glGetVertexAttribdv ; .type glGetVertexAttribdv,#function ; glGetVertexAttribdv = glGetVertexAttribdvARB
- .globl glGetVertexAttribfv ; .type glGetVertexAttribfv,#function ; glGetVertexAttribfv = glGetVertexAttribfvARB
- .globl glGetVertexAttribiv ; .type glGetVertexAttribiv,#function ; glGetVertexAttribiv = glGetVertexAttribivARB
- .globl glProgramParameter4dNV ; .type glProgramParameter4dNV,#function ; glProgramParameter4dNV = glProgramEnvParameter4dARB
- .globl glProgramParameter4dvNV ; .type glProgramParameter4dvNV,#function ; glProgramParameter4dvNV = glProgramEnvParameter4dvARB
- .globl glProgramParameter4fNV ; .type glProgramParameter4fNV,#function ; glProgramParameter4fNV = glProgramEnvParameter4fARB
- .globl glProgramParameter4fvNV ; .type glProgramParameter4fvNV,#function ; glProgramParameter4fvNV = glProgramEnvParameter4fvARB
- .globl glVertexAttrib1d ; .type glVertexAttrib1d,#function ; glVertexAttrib1d = glVertexAttrib1dARB
- .globl glVertexAttrib1dv ; .type glVertexAttrib1dv,#function ; glVertexAttrib1dv = glVertexAttrib1dvARB
- .globl glVertexAttrib1f ; .type glVertexAttrib1f,#function ; glVertexAttrib1f = glVertexAttrib1fARB
- .globl glVertexAttrib1fv ; .type glVertexAttrib1fv,#function ; glVertexAttrib1fv = glVertexAttrib1fvARB
- .globl glVertexAttrib1s ; .type glVertexAttrib1s,#function ; glVertexAttrib1s = glVertexAttrib1sARB
- .globl glVertexAttrib1sv ; .type glVertexAttrib1sv,#function ; glVertexAttrib1sv = glVertexAttrib1svARB
- .globl glVertexAttrib2d ; .type glVertexAttrib2d,#function ; glVertexAttrib2d = glVertexAttrib2dARB
- .globl glVertexAttrib2dv ; .type glVertexAttrib2dv,#function ; glVertexAttrib2dv = glVertexAttrib2dvARB
- .globl glVertexAttrib2f ; .type glVertexAttrib2f,#function ; glVertexAttrib2f = glVertexAttrib2fARB
- .globl glVertexAttrib2fv ; .type glVertexAttrib2fv,#function ; glVertexAttrib2fv = glVertexAttrib2fvARB
- .globl glVertexAttrib2s ; .type glVertexAttrib2s,#function ; glVertexAttrib2s = glVertexAttrib2sARB
- .globl glVertexAttrib2sv ; .type glVertexAttrib2sv,#function ; glVertexAttrib2sv = glVertexAttrib2svARB
- .globl glVertexAttrib3d ; .type glVertexAttrib3d,#function ; glVertexAttrib3d = glVertexAttrib3dARB
- .globl glVertexAttrib3dv ; .type glVertexAttrib3dv,#function ; glVertexAttrib3dv = glVertexAttrib3dvARB
- .globl glVertexAttrib3f ; .type glVertexAttrib3f,#function ; glVertexAttrib3f = glVertexAttrib3fARB
- .globl glVertexAttrib3fv ; .type glVertexAttrib3fv,#function ; glVertexAttrib3fv = glVertexAttrib3fvARB
- .globl glVertexAttrib3s ; .type glVertexAttrib3s,#function ; glVertexAttrib3s = glVertexAttrib3sARB
- .globl glVertexAttrib3sv ; .type glVertexAttrib3sv,#function ; glVertexAttrib3sv = glVertexAttrib3svARB
- .globl glVertexAttrib4Nbv ; .type glVertexAttrib4Nbv,#function ; glVertexAttrib4Nbv = glVertexAttrib4NbvARB
- .globl glVertexAttrib4Niv ; .type glVertexAttrib4Niv,#function ; glVertexAttrib4Niv = glVertexAttrib4NivARB
- .globl glVertexAttrib4Nsv ; .type glVertexAttrib4Nsv,#function ; glVertexAttrib4Nsv = glVertexAttrib4NsvARB
- .globl glVertexAttrib4Nub ; .type glVertexAttrib4Nub,#function ; glVertexAttrib4Nub = glVertexAttrib4NubARB
- .globl glVertexAttrib4Nubv ; .type glVertexAttrib4Nubv,#function ; glVertexAttrib4Nubv = glVertexAttrib4NubvARB
- .globl glVertexAttrib4Nuiv ; .type glVertexAttrib4Nuiv,#function ; glVertexAttrib4Nuiv = glVertexAttrib4NuivARB
- .globl glVertexAttrib4Nusv ; .type glVertexAttrib4Nusv,#function ; glVertexAttrib4Nusv = glVertexAttrib4NusvARB
- .globl glVertexAttrib4bv ; .type glVertexAttrib4bv,#function ; glVertexAttrib4bv = glVertexAttrib4bvARB
- .globl glVertexAttrib4d ; .type glVertexAttrib4d,#function ; glVertexAttrib4d = glVertexAttrib4dARB
- .globl glVertexAttrib4dv ; .type glVertexAttrib4dv,#function ; glVertexAttrib4dv = glVertexAttrib4dvARB
- .globl glVertexAttrib4f ; .type glVertexAttrib4f,#function ; glVertexAttrib4f = glVertexAttrib4fARB
- .globl glVertexAttrib4fv ; .type glVertexAttrib4fv,#function ; glVertexAttrib4fv = glVertexAttrib4fvARB
- .globl glVertexAttrib4iv ; .type glVertexAttrib4iv,#function ; glVertexAttrib4iv = glVertexAttrib4ivARB
- .globl glVertexAttrib4s ; .type glVertexAttrib4s,#function ; glVertexAttrib4s = glVertexAttrib4sARB
- .globl glVertexAttrib4sv ; .type glVertexAttrib4sv,#function ; glVertexAttrib4sv = glVertexAttrib4svARB
- .globl glVertexAttrib4ubv ; .type glVertexAttrib4ubv,#function ; glVertexAttrib4ubv = glVertexAttrib4ubvARB
- .globl glVertexAttrib4uiv ; .type glVertexAttrib4uiv,#function ; glVertexAttrib4uiv = glVertexAttrib4uivARB
- .globl glVertexAttrib4usv ; .type glVertexAttrib4usv,#function ; glVertexAttrib4usv = glVertexAttrib4usvARB
- .globl glVertexAttribPointer ; .type glVertexAttribPointer,#function ; glVertexAttribPointer = glVertexAttribPointerARB
- .globl glBindBuffer ; .type glBindBuffer,#function ; glBindBuffer = glBindBufferARB
- .globl glBufferData ; .type glBufferData,#function ; glBufferData = glBufferDataARB
- .globl glBufferSubData ; .type glBufferSubData,#function ; glBufferSubData = glBufferSubDataARB
- .globl glDeleteBuffers ; .type glDeleteBuffers,#function ; glDeleteBuffers = glDeleteBuffersARB
- .globl glGenBuffers ; .type glGenBuffers,#function ; glGenBuffers = glGenBuffersARB
- .globl glGetBufferParameteriv ; .type glGetBufferParameteriv,#function ; glGetBufferParameteriv = glGetBufferParameterivARB
- .globl glGetBufferPointerv ; .type glGetBufferPointerv,#function ; glGetBufferPointerv = glGetBufferPointervARB
- .globl glGetBufferSubData ; .type glGetBufferSubData,#function ; glGetBufferSubData = glGetBufferSubDataARB
- .globl glIsBuffer ; .type glIsBuffer,#function ; glIsBuffer = glIsBufferARB
- .globl glMapBuffer ; .type glMapBuffer,#function ; glMapBuffer = glMapBufferARB
- .globl glUnmapBuffer ; .type glUnmapBuffer,#function ; glUnmapBuffer = glUnmapBufferARB
- .globl glBeginQuery ; .type glBeginQuery,#function ; glBeginQuery = glBeginQueryARB
- .globl glDeleteQueries ; .type glDeleteQueries,#function ; glDeleteQueries = glDeleteQueriesARB
- .globl glEndQuery ; .type glEndQuery,#function ; glEndQuery = glEndQueryARB
- .globl glGenQueries ; .type glGenQueries,#function ; glGenQueries = glGenQueriesARB
- .globl glGetQueryObjectiv ; .type glGetQueryObjectiv,#function ; glGetQueryObjectiv = glGetQueryObjectivARB
- .globl glGetQueryObjectuiv ; .type glGetQueryObjectuiv,#function ; glGetQueryObjectuiv = glGetQueryObjectuivARB
- .globl glGetQueryiv ; .type glGetQueryiv,#function ; glGetQueryiv = glGetQueryivARB
- .globl glIsQuery ; .type glIsQuery,#function ; glIsQuery = glIsQueryARB
- .globl glCompileShader ; .type glCompileShader,#function ; glCompileShader = glCompileShaderARB
- .globl glGetActiveUniform ; .type glGetActiveUniform,#function ; glGetActiveUniform = glGetActiveUniformARB
- .globl glGetShaderSource ; .type glGetShaderSource,#function ; glGetShaderSource = glGetShaderSourceARB
- .globl glGetUniformLocation ; .type glGetUniformLocation,#function ; glGetUniformLocation = glGetUniformLocationARB
- .globl glGetUniformfv ; .type glGetUniformfv,#function ; glGetUniformfv = glGetUniformfvARB
- .globl glGetUniformiv ; .type glGetUniformiv,#function ; glGetUniformiv = glGetUniformivARB
- .globl glLinkProgram ; .type glLinkProgram,#function ; glLinkProgram = glLinkProgramARB
- .globl glShaderSource ; .type glShaderSource,#function ; glShaderSource = glShaderSourceARB
- .globl glUniform1f ; .type glUniform1f,#function ; glUniform1f = glUniform1fARB
- .globl glUniform1fv ; .type glUniform1fv,#function ; glUniform1fv = glUniform1fvARB
- .globl glUniform1i ; .type glUniform1i,#function ; glUniform1i = glUniform1iARB
- .globl glUniform1iv ; .type glUniform1iv,#function ; glUniform1iv = glUniform1ivARB
- .globl glUniform2f ; .type glUniform2f,#function ; glUniform2f = glUniform2fARB
- .globl glUniform2fv ; .type glUniform2fv,#function ; glUniform2fv = glUniform2fvARB
- .globl glUniform2i ; .type glUniform2i,#function ; glUniform2i = glUniform2iARB
- .globl glUniform2iv ; .type glUniform2iv,#function ; glUniform2iv = glUniform2ivARB
- .globl glUniform3f ; .type glUniform3f,#function ; glUniform3f = glUniform3fARB
- .globl glUniform3fv ; .type glUniform3fv,#function ; glUniform3fv = glUniform3fvARB
- .globl glUniform3i ; .type glUniform3i,#function ; glUniform3i = glUniform3iARB
- .globl glUniform3iv ; .type glUniform3iv,#function ; glUniform3iv = glUniform3ivARB
- .globl glUniform4f ; .type glUniform4f,#function ; glUniform4f = glUniform4fARB
- .globl glUniform4fv ; .type glUniform4fv,#function ; glUniform4fv = glUniform4fvARB
- .globl glUniform4i ; .type glUniform4i,#function ; glUniform4i = glUniform4iARB
- .globl glUniform4iv ; .type glUniform4iv,#function ; glUniform4iv = glUniform4ivARB
- .globl glUniformMatrix2fv ; .type glUniformMatrix2fv,#function ; glUniformMatrix2fv = glUniformMatrix2fvARB
- .globl glUniformMatrix3fv ; .type glUniformMatrix3fv,#function ; glUniformMatrix3fv = glUniformMatrix3fvARB
- .globl glUniformMatrix4fv ; .type glUniformMatrix4fv,#function ; glUniformMatrix4fv = glUniformMatrix4fvARB
- .globl glUseProgram ; .type glUseProgram,#function ; glUseProgram = glUseProgramObjectARB
- .globl glValidateProgram ; .type glValidateProgram,#function ; glValidateProgram = glValidateProgramARB
- .globl glBindAttribLocation ; .type glBindAttribLocation,#function ; glBindAttribLocation = glBindAttribLocationARB
- .globl glGetActiveAttrib ; .type glGetActiveAttrib,#function ; glGetActiveAttrib = glGetActiveAttribARB
- .globl glGetAttribLocation ; .type glGetAttribLocation,#function ; glGetAttribLocation = glGetAttribLocationARB
- .globl glDrawBuffers ; .type glDrawBuffers,#function ; glDrawBuffers = glDrawBuffersARB
- .globl glDrawBuffersATI ; .type glDrawBuffersATI,#function ; glDrawBuffersATI = glDrawBuffersARB
- .globl glPointParameterf ; .type glPointParameterf,#function ; glPointParameterf = glPointParameterfEXT
- .globl glPointParameterfARB ; .type glPointParameterfARB,#function ; glPointParameterfARB = glPointParameterfEXT
- .globl glPointParameterfv ; .type glPointParameterfv,#function ; glPointParameterfv = glPointParameterfvEXT
- .globl glPointParameterfvARB ; .type glPointParameterfvARB,#function ; glPointParameterfvARB = glPointParameterfvEXT
- .globl glSecondaryColor3b ; .type glSecondaryColor3b,#function ; glSecondaryColor3b = glSecondaryColor3bEXT
- .globl glSecondaryColor3bv ; .type glSecondaryColor3bv,#function ; glSecondaryColor3bv = glSecondaryColor3bvEXT
- .globl glSecondaryColor3d ; .type glSecondaryColor3d,#function ; glSecondaryColor3d = glSecondaryColor3dEXT
- .globl glSecondaryColor3dv ; .type glSecondaryColor3dv,#function ; glSecondaryColor3dv = glSecondaryColor3dvEXT
- .globl glSecondaryColor3f ; .type glSecondaryColor3f,#function ; glSecondaryColor3f = glSecondaryColor3fEXT
- .globl glSecondaryColor3fv ; .type glSecondaryColor3fv,#function ; glSecondaryColor3fv = glSecondaryColor3fvEXT
- .globl glSecondaryColor3i ; .type glSecondaryColor3i,#function ; glSecondaryColor3i = glSecondaryColor3iEXT
- .globl glSecondaryColor3iv ; .type glSecondaryColor3iv,#function ; glSecondaryColor3iv = glSecondaryColor3ivEXT
- .globl glSecondaryColor3s ; .type glSecondaryColor3s,#function ; glSecondaryColor3s = glSecondaryColor3sEXT
- .globl glSecondaryColor3sv ; .type glSecondaryColor3sv,#function ; glSecondaryColor3sv = glSecondaryColor3svEXT
- .globl glSecondaryColor3ub ; .type glSecondaryColor3ub,#function ; glSecondaryColor3ub = glSecondaryColor3ubEXT
- .globl glSecondaryColor3ubv ; .type glSecondaryColor3ubv,#function ; glSecondaryColor3ubv = glSecondaryColor3ubvEXT
- .globl glSecondaryColor3ui ; .type glSecondaryColor3ui,#function ; glSecondaryColor3ui = glSecondaryColor3uiEXT
- .globl glSecondaryColor3uiv ; .type glSecondaryColor3uiv,#function ; glSecondaryColor3uiv = glSecondaryColor3uivEXT
- .globl glSecondaryColor3us ; .type glSecondaryColor3us,#function ; glSecondaryColor3us = glSecondaryColor3usEXT
- .globl glSecondaryColor3usv ; .type glSecondaryColor3usv,#function ; glSecondaryColor3usv = glSecondaryColor3usvEXT
- .globl glSecondaryColorPointer ; .type glSecondaryColorPointer,#function ; glSecondaryColorPointer = glSecondaryColorPointerEXT
- .globl glMultiDrawArrays ; .type glMultiDrawArrays,#function ; glMultiDrawArrays = glMultiDrawArraysEXT
- .globl glMultiDrawElements ; .type glMultiDrawElements,#function ; glMultiDrawElements = glMultiDrawElementsEXT
- .globl glFogCoordPointer ; .type glFogCoordPointer,#function ; glFogCoordPointer = glFogCoordPointerEXT
- .globl glFogCoordd ; .type glFogCoordd,#function ; glFogCoordd = glFogCoorddEXT
- .globl glFogCoorddv ; .type glFogCoorddv,#function ; glFogCoorddv = glFogCoorddvEXT
- .globl glFogCoordf ; .type glFogCoordf,#function ; glFogCoordf = glFogCoordfEXT
- .globl glFogCoordfv ; .type glFogCoordfv,#function ; glFogCoordfv = glFogCoordfvEXT
- .globl glBlendFuncSeparate ; .type glBlendFuncSeparate,#function ; glBlendFuncSeparate = glBlendFuncSeparateEXT
- .globl glWindowPos2d ; .type glWindowPos2d,#function ; glWindowPos2d = glWindowPos2dMESA
- .globl glWindowPos2dARB ; .type glWindowPos2dARB,#function ; glWindowPos2dARB = glWindowPos2dMESA
- .globl glWindowPos2dv ; .type glWindowPos2dv,#function ; glWindowPos2dv = glWindowPos2dvMESA
- .globl glWindowPos2dvARB ; .type glWindowPos2dvARB,#function ; glWindowPos2dvARB = glWindowPos2dvMESA
- .globl glWindowPos2f ; .type glWindowPos2f,#function ; glWindowPos2f = glWindowPos2fMESA
- .globl glWindowPos2fARB ; .type glWindowPos2fARB,#function ; glWindowPos2fARB = glWindowPos2fMESA
- .globl glWindowPos2fv ; .type glWindowPos2fv,#function ; glWindowPos2fv = glWindowPos2fvMESA
- .globl glWindowPos2fvARB ; .type glWindowPos2fvARB,#function ; glWindowPos2fvARB = glWindowPos2fvMESA
- .globl glWindowPos2i ; .type glWindowPos2i,#function ; glWindowPos2i = glWindowPos2iMESA
- .globl glWindowPos2iARB ; .type glWindowPos2iARB,#function ; glWindowPos2iARB = glWindowPos2iMESA
- .globl glWindowPos2iv ; .type glWindowPos2iv,#function ; glWindowPos2iv = glWindowPos2ivMESA
- .globl glWindowPos2ivARB ; .type glWindowPos2ivARB,#function ; glWindowPos2ivARB = glWindowPos2ivMESA
- .globl glWindowPos2s ; .type glWindowPos2s,#function ; glWindowPos2s = glWindowPos2sMESA
- .globl glWindowPos2sARB ; .type glWindowPos2sARB,#function ; glWindowPos2sARB = glWindowPos2sMESA
- .globl glWindowPos2sv ; .type glWindowPos2sv,#function ; glWindowPos2sv = glWindowPos2svMESA
- .globl glWindowPos2svARB ; .type glWindowPos2svARB,#function ; glWindowPos2svARB = glWindowPos2svMESA
- .globl glWindowPos3d ; .type glWindowPos3d,#function ; glWindowPos3d = glWindowPos3dMESA
- .globl glWindowPos3dARB ; .type glWindowPos3dARB,#function ; glWindowPos3dARB = glWindowPos3dMESA
- .globl glWindowPos3dv ; .type glWindowPos3dv,#function ; glWindowPos3dv = glWindowPos3dvMESA
- .globl glWindowPos3dvARB ; .type glWindowPos3dvARB,#function ; glWindowPos3dvARB = glWindowPos3dvMESA
- .globl glWindowPos3f ; .type glWindowPos3f,#function ; glWindowPos3f = glWindowPos3fMESA
- .globl glWindowPos3fARB ; .type glWindowPos3fARB,#function ; glWindowPos3fARB = glWindowPos3fMESA
- .globl glWindowPos3fv ; .type glWindowPos3fv,#function ; glWindowPos3fv = glWindowPos3fvMESA
- .globl glWindowPos3fvARB ; .type glWindowPos3fvARB,#function ; glWindowPos3fvARB = glWindowPos3fvMESA
- .globl glWindowPos3i ; .type glWindowPos3i,#function ; glWindowPos3i = glWindowPos3iMESA
- .globl glWindowPos3iARB ; .type glWindowPos3iARB,#function ; glWindowPos3iARB = glWindowPos3iMESA
- .globl glWindowPos3iv ; .type glWindowPos3iv,#function ; glWindowPos3iv = glWindowPos3ivMESA
- .globl glWindowPos3ivARB ; .type glWindowPos3ivARB,#function ; glWindowPos3ivARB = glWindowPos3ivMESA
- .globl glWindowPos3s ; .type glWindowPos3s,#function ; glWindowPos3s = glWindowPos3sMESA
- .globl glWindowPos3sARB ; .type glWindowPos3sARB,#function ; glWindowPos3sARB = glWindowPos3sMESA
- .globl glWindowPos3sv ; .type glWindowPos3sv,#function ; glWindowPos3sv = glWindowPos3svMESA
- .globl glWindowPos3svARB ; .type glWindowPos3svARB,#function ; glWindowPos3svARB = glWindowPos3svMESA
- .globl glBindProgramARB ; .type glBindProgramARB,#function ; glBindProgramARB = glBindProgramNV
- .globl glDeleteProgramsARB ; .type glDeleteProgramsARB,#function ; glDeleteProgramsARB = glDeleteProgramsNV
- .globl glGenProgramsARB ; .type glGenProgramsARB,#function ; glGenProgramsARB = glGenProgramsNV
- .globl glGetVertexAttribPointerv ; .type glGetVertexAttribPointerv,#function ; glGetVertexAttribPointerv = glGetVertexAttribPointervNV
- .globl glGetVertexAttribPointervARB ; .type glGetVertexAttribPointervARB,#function ; glGetVertexAttribPointervARB = glGetVertexAttribPointervNV
- .globl glIsProgramARB ; .type glIsProgramARB,#function ; glIsProgramARB = glIsProgramNV
- .globl glPointParameteri ; .type glPointParameteri,#function ; glPointParameteri = glPointParameteriNV
- .globl glPointParameteriv ; .type glPointParameteriv,#function ; glPointParameteriv = glPointParameterivNV
- .globl glBlendEquationSeparate ; .type glBlendEquationSeparate,#function ; glBlendEquationSeparate = glBlendEquationSeparateEXT
- .globl glBindFramebuffer ; .type glBindFramebuffer,#function ; glBindFramebuffer = glBindFramebufferEXT
- .globl glBindRenderbuffer ; .type glBindRenderbuffer,#function ; glBindRenderbuffer = glBindRenderbufferEXT
- .globl glCheckFramebufferStatus ; .type glCheckFramebufferStatus,#function ; glCheckFramebufferStatus = glCheckFramebufferStatusEXT
- .globl glDeleteFramebuffers ; .type glDeleteFramebuffers,#function ; glDeleteFramebuffers = glDeleteFramebuffersEXT
- .globl glDeleteRenderbuffers ; .type glDeleteRenderbuffers,#function ; glDeleteRenderbuffers = glDeleteRenderbuffersEXT
- .globl glFramebufferRenderbuffer ; .type glFramebufferRenderbuffer,#function ; glFramebufferRenderbuffer = glFramebufferRenderbufferEXT
- .globl glFramebufferTexture1D ; .type glFramebufferTexture1D,#function ; glFramebufferTexture1D = glFramebufferTexture1DEXT
- .globl glFramebufferTexture2D ; .type glFramebufferTexture2D,#function ; glFramebufferTexture2D = glFramebufferTexture2DEXT
- .globl glFramebufferTexture3D ; .type glFramebufferTexture3D,#function ; glFramebufferTexture3D = glFramebufferTexture3DEXT
- .globl glGenFramebuffers ; .type glGenFramebuffers,#function ; glGenFramebuffers = glGenFramebuffersEXT
- .globl glGenRenderbuffers ; .type glGenRenderbuffers,#function ; glGenRenderbuffers = glGenRenderbuffersEXT
- .globl glGenerateMipmap ; .type glGenerateMipmap,#function ; glGenerateMipmap = glGenerateMipmapEXT
- .globl glGetFramebufferAttachmentParameteriv ; .type glGetFramebufferAttachmentParameteriv,#function ; glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT
- .globl glGetRenderbufferParameteriv ; .type glGetRenderbufferParameteriv,#function ; glGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT
- .globl glIsFramebuffer ; .type glIsFramebuffer,#function ; glIsFramebuffer = glIsFramebufferEXT
- .globl glIsRenderbuffer ; .type glIsRenderbuffer,#function ; glIsRenderbuffer = glIsRenderbufferEXT
- .globl glRenderbufferStorage ; .type glRenderbufferStorage,#function ; glRenderbufferStorage = glRenderbufferStorageEXT
- .globl glBlitFramebuffer ; .type glBlitFramebuffer,#function ; glBlitFramebuffer = glBlitFramebufferEXT
- .globl glFramebufferTextureLayer ; .type glFramebufferTextureLayer,#function ; glFramebufferTextureLayer = glFramebufferTextureLayerEXT
+ GL_STUB_ALIAS(glSeparableFilter2DEXT, glSeparableFilter2D)
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glGetHistogramEXT, glGetHistogram)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glGetHistogramParameterfvEXT, glGetHistogramParameterfv)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glGetHistogramParameterivEXT, glGetHistogramParameteriv)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glGetMinmaxEXT, glGetMinmax)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glGetMinmaxParameterfvEXT, glGetMinmaxParameterfv)
+#endif
+#ifndef GLX_INDIRECT_RENDERING
+ GL_STUB_ALIAS(glGetMinmaxParameterivEXT, glGetMinmaxParameteriv)
+#endif
+ GL_STUB_ALIAS(glHistogramEXT, glHistogram)
+ GL_STUB_ALIAS(glMinmaxEXT, glMinmax)
+ GL_STUB_ALIAS(glResetHistogramEXT, glResetHistogram)
+ GL_STUB_ALIAS(glResetMinmaxEXT, glResetMinmax)
+ GL_STUB_ALIAS(glTexImage3DEXT, glTexImage3D)
+ GL_STUB_ALIAS(glTexSubImage3DEXT, glTexSubImage3D)
+ GL_STUB_ALIAS(glCopyTexSubImage3DEXT, glCopyTexSubImage3D)
+ GL_STUB_ALIAS(glActiveTexture, glActiveTextureARB)
+ GL_STUB_ALIAS(glClientActiveTexture, glClientActiveTextureARB)
+ GL_STUB_ALIAS(glMultiTexCoord1d, glMultiTexCoord1dARB)
+ GL_STUB_ALIAS(glMultiTexCoord1dv, glMultiTexCoord1dvARB)
+ GL_STUB_ALIAS(glMultiTexCoord1f, glMultiTexCoord1fARB)
+ GL_STUB_ALIAS(glMultiTexCoord1fv, glMultiTexCoord1fvARB)
+ GL_STUB_ALIAS(glMultiTexCoord1i, glMultiTexCoord1iARB)
+ GL_STUB_ALIAS(glMultiTexCoord1iv, glMultiTexCoord1ivARB)
+ GL_STUB_ALIAS(glMultiTexCoord1s, glMultiTexCoord1sARB)
+ GL_STUB_ALIAS(glMultiTexCoord1sv, glMultiTexCoord1svARB)
+ GL_STUB_ALIAS(glMultiTexCoord2d, glMultiTexCoord2dARB)
+ GL_STUB_ALIAS(glMultiTexCoord2dv, glMultiTexCoord2dvARB)
+ GL_STUB_ALIAS(glMultiTexCoord2f, glMultiTexCoord2fARB)
+ GL_STUB_ALIAS(glMultiTexCoord2fv, glMultiTexCoord2fvARB)
+ GL_STUB_ALIAS(glMultiTexCoord2i, glMultiTexCoord2iARB)
+ GL_STUB_ALIAS(glMultiTexCoord2iv, glMultiTexCoord2ivARB)
+ GL_STUB_ALIAS(glMultiTexCoord2s, glMultiTexCoord2sARB)
+ GL_STUB_ALIAS(glMultiTexCoord2sv, glMultiTexCoord2svARB)
+ GL_STUB_ALIAS(glMultiTexCoord3d, glMultiTexCoord3dARB)
+ GL_STUB_ALIAS(glMultiTexCoord3dv, glMultiTexCoord3dvARB)
+ GL_STUB_ALIAS(glMultiTexCoord3f, glMultiTexCoord3fARB)
+ GL_STUB_ALIAS(glMultiTexCoord3fv, glMultiTexCoord3fvARB)
+ GL_STUB_ALIAS(glMultiTexCoord3i, glMultiTexCoord3iARB)
+ GL_STUB_ALIAS(glMultiTexCoord3iv, glMultiTexCoord3ivARB)
+ GL_STUB_ALIAS(glMultiTexCoord3s, glMultiTexCoord3sARB)
+ GL_STUB_ALIAS(glMultiTexCoord3sv, glMultiTexCoord3svARB)
+ GL_STUB_ALIAS(glMultiTexCoord4d, glMultiTexCoord4dARB)
+ GL_STUB_ALIAS(glMultiTexCoord4dv, glMultiTexCoord4dvARB)
+ GL_STUB_ALIAS(glMultiTexCoord4f, glMultiTexCoord4fARB)
+ GL_STUB_ALIAS(glMultiTexCoord4fv, glMultiTexCoord4fvARB)
+ GL_STUB_ALIAS(glMultiTexCoord4i, glMultiTexCoord4iARB)
+ GL_STUB_ALIAS(glMultiTexCoord4iv, glMultiTexCoord4ivARB)
+ GL_STUB_ALIAS(glMultiTexCoord4s, glMultiTexCoord4sARB)
+ GL_STUB_ALIAS(glMultiTexCoord4sv, glMultiTexCoord4svARB)
+ GL_STUB_ALIAS(glStencilOpSeparateATI, glStencilOpSeparate)
+ GL_STUB_ALIAS(glLoadTransposeMatrixd, glLoadTransposeMatrixdARB)
+ GL_STUB_ALIAS(glLoadTransposeMatrixf, glLoadTransposeMatrixfARB)
+ GL_STUB_ALIAS(glMultTransposeMatrixd, glMultTransposeMatrixdARB)
+ GL_STUB_ALIAS(glMultTransposeMatrixf, glMultTransposeMatrixfARB)
+ GL_STUB_ALIAS(glSampleCoverage, glSampleCoverageARB)
+ GL_STUB_ALIAS(glCompressedTexImage1D, glCompressedTexImage1DARB)
+ GL_STUB_ALIAS(glCompressedTexImage2D, glCompressedTexImage2DARB)
+ GL_STUB_ALIAS(glCompressedTexImage3D, glCompressedTexImage3DARB)
+ GL_STUB_ALIAS(glCompressedTexSubImage1D, glCompressedTexSubImage1DARB)
+ GL_STUB_ALIAS(glCompressedTexSubImage2D, glCompressedTexSubImage2DARB)
+ GL_STUB_ALIAS(glCompressedTexSubImage3D, glCompressedTexSubImage3DARB)
+ GL_STUB_ALIAS(glGetCompressedTexImage, glGetCompressedTexImageARB)
+ GL_STUB_ALIAS(glDisableVertexAttribArray, glDisableVertexAttribArrayARB)
+ GL_STUB_ALIAS(glEnableVertexAttribArray, glEnableVertexAttribArrayARB)
+ GL_STUB_ALIAS(glGetVertexAttribdv, glGetVertexAttribdvARB)
+ GL_STUB_ALIAS(glGetVertexAttribfv, glGetVertexAttribfvARB)
+ GL_STUB_ALIAS(glGetVertexAttribiv, glGetVertexAttribivARB)
+ GL_STUB_ALIAS(glProgramParameter4dNV, glProgramEnvParameter4dARB)
+ GL_STUB_ALIAS(glProgramParameter4dvNV, glProgramEnvParameter4dvARB)
+ GL_STUB_ALIAS(glProgramParameter4fNV, glProgramEnvParameter4fARB)
+ GL_STUB_ALIAS(glProgramParameter4fvNV, glProgramEnvParameter4fvARB)
+ GL_STUB_ALIAS(glVertexAttrib1d, glVertexAttrib1dARB)
+ GL_STUB_ALIAS(glVertexAttrib1dv, glVertexAttrib1dvARB)
+ GL_STUB_ALIAS(glVertexAttrib1f, glVertexAttrib1fARB)
+ GL_STUB_ALIAS(glVertexAttrib1fv, glVertexAttrib1fvARB)
+ GL_STUB_ALIAS(glVertexAttrib1s, glVertexAttrib1sARB)
+ GL_STUB_ALIAS(glVertexAttrib1sv, glVertexAttrib1svARB)
+ GL_STUB_ALIAS(glVertexAttrib2d, glVertexAttrib2dARB)
+ GL_STUB_ALIAS(glVertexAttrib2dv, glVertexAttrib2dvARB)
+ GL_STUB_ALIAS(glVertexAttrib2f, glVertexAttrib2fARB)
+ GL_STUB_ALIAS(glVertexAttrib2fv, glVertexAttrib2fvARB)
+ GL_STUB_ALIAS(glVertexAttrib2s, glVertexAttrib2sARB)
+ GL_STUB_ALIAS(glVertexAttrib2sv, glVertexAttrib2svARB)
+ GL_STUB_ALIAS(glVertexAttrib3d, glVertexAttrib3dARB)
+ GL_STUB_ALIAS(glVertexAttrib3dv, glVertexAttrib3dvARB)
+ GL_STUB_ALIAS(glVertexAttrib3f, glVertexAttrib3fARB)
+ GL_STUB_ALIAS(glVertexAttrib3fv, glVertexAttrib3fvARB)
+ GL_STUB_ALIAS(glVertexAttrib3s, glVertexAttrib3sARB)
+ GL_STUB_ALIAS(glVertexAttrib3sv, glVertexAttrib3svARB)
+ GL_STUB_ALIAS(glVertexAttrib4Nbv, glVertexAttrib4NbvARB)
+ GL_STUB_ALIAS(glVertexAttrib4Niv, glVertexAttrib4NivARB)
+ GL_STUB_ALIAS(glVertexAttrib4Nsv, glVertexAttrib4NsvARB)
+ GL_STUB_ALIAS(glVertexAttrib4Nub, glVertexAttrib4NubARB)
+ GL_STUB_ALIAS(glVertexAttrib4Nubv, glVertexAttrib4NubvARB)
+ GL_STUB_ALIAS(glVertexAttrib4Nuiv, glVertexAttrib4NuivARB)
+ GL_STUB_ALIAS(glVertexAttrib4Nusv, glVertexAttrib4NusvARB)
+ GL_STUB_ALIAS(glVertexAttrib4bv, glVertexAttrib4bvARB)
+ GL_STUB_ALIAS(glVertexAttrib4d, glVertexAttrib4dARB)
+ GL_STUB_ALIAS(glVertexAttrib4dv, glVertexAttrib4dvARB)
+ GL_STUB_ALIAS(glVertexAttrib4f, glVertexAttrib4fARB)
+ GL_STUB_ALIAS(glVertexAttrib4fv, glVertexAttrib4fvARB)
+ GL_STUB_ALIAS(glVertexAttrib4iv, glVertexAttrib4ivARB)
+ GL_STUB_ALIAS(glVertexAttrib4s, glVertexAttrib4sARB)
+ GL_STUB_ALIAS(glVertexAttrib4sv, glVertexAttrib4svARB)
+ GL_STUB_ALIAS(glVertexAttrib4ubv, glVertexAttrib4ubvARB)
+ GL_STUB_ALIAS(glVertexAttrib4uiv, glVertexAttrib4uivARB)
+ GL_STUB_ALIAS(glVertexAttrib4usv, glVertexAttrib4usvARB)
+ GL_STUB_ALIAS(glVertexAttribPointer, glVertexAttribPointerARB)
+ GL_STUB_ALIAS(glBindBuffer, glBindBufferARB)
+ GL_STUB_ALIAS(glBufferData, glBufferDataARB)
+ GL_STUB_ALIAS(glBufferSubData, glBufferSubDataARB)
+ GL_STUB_ALIAS(glDeleteBuffers, glDeleteBuffersARB)
+ GL_STUB_ALIAS(glGenBuffers, glGenBuffersARB)
+ GL_STUB_ALIAS(glGetBufferParameteriv, glGetBufferParameterivARB)
+ GL_STUB_ALIAS(glGetBufferPointerv, glGetBufferPointervARB)
+ GL_STUB_ALIAS(glGetBufferSubData, glGetBufferSubDataARB)
+ GL_STUB_ALIAS(glIsBuffer, glIsBufferARB)
+ GL_STUB_ALIAS(glMapBuffer, glMapBufferARB)
+ GL_STUB_ALIAS(glUnmapBuffer, glUnmapBufferARB)
+ GL_STUB_ALIAS(glBeginQuery, glBeginQueryARB)
+ GL_STUB_ALIAS(glDeleteQueries, glDeleteQueriesARB)
+ GL_STUB_ALIAS(glEndQuery, glEndQueryARB)
+ GL_STUB_ALIAS(glGenQueries, glGenQueriesARB)
+ GL_STUB_ALIAS(glGetQueryObjectiv, glGetQueryObjectivARB)
+ GL_STUB_ALIAS(glGetQueryObjectuiv, glGetQueryObjectuivARB)
+ GL_STUB_ALIAS(glGetQueryiv, glGetQueryivARB)
+ GL_STUB_ALIAS(glIsQuery, glIsQueryARB)
+ GL_STUB_ALIAS(glCompileShader, glCompileShaderARB)
+ GL_STUB_ALIAS(glGetActiveUniform, glGetActiveUniformARB)
+ GL_STUB_ALIAS(glGetShaderSource, glGetShaderSourceARB)
+ GL_STUB_ALIAS(glGetUniformLocation, glGetUniformLocationARB)
+ GL_STUB_ALIAS(glGetUniformfv, glGetUniformfvARB)
+ GL_STUB_ALIAS(glGetUniformiv, glGetUniformivARB)
+ GL_STUB_ALIAS(glLinkProgram, glLinkProgramARB)
+ GL_STUB_ALIAS(glShaderSource, glShaderSourceARB)
+ GL_STUB_ALIAS(glUniform1f, glUniform1fARB)
+ GL_STUB_ALIAS(glUniform1fv, glUniform1fvARB)
+ GL_STUB_ALIAS(glUniform1i, glUniform1iARB)
+ GL_STUB_ALIAS(glUniform1iv, glUniform1ivARB)
+ GL_STUB_ALIAS(glUniform2f, glUniform2fARB)
+ GL_STUB_ALIAS(glUniform2fv, glUniform2fvARB)
+ GL_STUB_ALIAS(glUniform2i, glUniform2iARB)
+ GL_STUB_ALIAS(glUniform2iv, glUniform2ivARB)
+ GL_STUB_ALIAS(glUniform3f, glUniform3fARB)
+ GL_STUB_ALIAS(glUniform3fv, glUniform3fvARB)
+ GL_STUB_ALIAS(glUniform3i, glUniform3iARB)
+ GL_STUB_ALIAS(glUniform3iv, glUniform3ivARB)
+ GL_STUB_ALIAS(glUniform4f, glUniform4fARB)
+ GL_STUB_ALIAS(glUniform4fv, glUniform4fvARB)
+ GL_STUB_ALIAS(glUniform4i, glUniform4iARB)
+ GL_STUB_ALIAS(glUniform4iv, glUniform4ivARB)
+ GL_STUB_ALIAS(glUniformMatrix2fv, glUniformMatrix2fvARB)
+ GL_STUB_ALIAS(glUniformMatrix3fv, glUniformMatrix3fvARB)
+ GL_STUB_ALIAS(glUniformMatrix4fv, glUniformMatrix4fvARB)
+ GL_STUB_ALIAS(glUseProgram, glUseProgramObjectARB)
+ GL_STUB_ALIAS(glValidateProgram, glValidateProgramARB)
+ GL_STUB_ALIAS(glBindAttribLocation, glBindAttribLocationARB)
+ GL_STUB_ALIAS(glGetActiveAttrib, glGetActiveAttribARB)
+ GL_STUB_ALIAS(glGetAttribLocation, glGetAttribLocationARB)
+ GL_STUB_ALIAS(glDrawBuffers, glDrawBuffersARB)
+ GL_STUB_ALIAS(glDrawBuffersATI, glDrawBuffersARB)
+ GL_STUB_ALIAS(glPointParameterf, glPointParameterfEXT)
+ GL_STUB_ALIAS(glPointParameterfARB, glPointParameterfEXT)
+ GL_STUB_ALIAS(glPointParameterfSGIS, glPointParameterfEXT)
+ GL_STUB_ALIAS(glPointParameterfv, glPointParameterfvEXT)
+ GL_STUB_ALIAS(glPointParameterfvARB, glPointParameterfvEXT)
+ GL_STUB_ALIAS(glPointParameterfvSGIS, glPointParameterfvEXT)
+ GL_STUB_ALIAS(glSecondaryColor3b, glSecondaryColor3bEXT)
+ GL_STUB_ALIAS(glSecondaryColor3bv, glSecondaryColor3bvEXT)
+ GL_STUB_ALIAS(glSecondaryColor3d, glSecondaryColor3dEXT)
+ GL_STUB_ALIAS(glSecondaryColor3dv, glSecondaryColor3dvEXT)
+ GL_STUB_ALIAS(glSecondaryColor3f, glSecondaryColor3fEXT)
+ GL_STUB_ALIAS(glSecondaryColor3fv, glSecondaryColor3fvEXT)
+ GL_STUB_ALIAS(glSecondaryColor3i, glSecondaryColor3iEXT)
+ GL_STUB_ALIAS(glSecondaryColor3iv, glSecondaryColor3ivEXT)
+ GL_STUB_ALIAS(glSecondaryColor3s, glSecondaryColor3sEXT)
+ GL_STUB_ALIAS(glSecondaryColor3sv, glSecondaryColor3svEXT)
+ GL_STUB_ALIAS(glSecondaryColor3ub, glSecondaryColor3ubEXT)
+ GL_STUB_ALIAS(glSecondaryColor3ubv, glSecondaryColor3ubvEXT)
+ GL_STUB_ALIAS(glSecondaryColor3ui, glSecondaryColor3uiEXT)
+ GL_STUB_ALIAS(glSecondaryColor3uiv, glSecondaryColor3uivEXT)
+ GL_STUB_ALIAS(glSecondaryColor3us, glSecondaryColor3usEXT)
+ GL_STUB_ALIAS(glSecondaryColor3usv, glSecondaryColor3usvEXT)
+ GL_STUB_ALIAS(glSecondaryColorPointer, glSecondaryColorPointerEXT)
+ GL_STUB_ALIAS(glMultiDrawArrays, glMultiDrawArraysEXT)
+ GL_STUB_ALIAS(glMultiDrawElements, glMultiDrawElementsEXT)
+ GL_STUB_ALIAS(glFogCoordPointer, glFogCoordPointerEXT)
+ GL_STUB_ALIAS(glFogCoordd, glFogCoorddEXT)
+ GL_STUB_ALIAS(glFogCoorddv, glFogCoorddvEXT)
+ GL_STUB_ALIAS(glFogCoordf, glFogCoordfEXT)
+ GL_STUB_ALIAS(glFogCoordfv, glFogCoordfvEXT)
+ GL_STUB_ALIAS(glBlendFuncSeparate, glBlendFuncSeparateEXT)
+ GL_STUB_ALIAS(glBlendFuncSeparateINGR, glBlendFuncSeparateEXT)
+ GL_STUB_ALIAS(glWindowPos2d, glWindowPos2dMESA)
+ GL_STUB_ALIAS(glWindowPos2dARB, glWindowPos2dMESA)
+ GL_STUB_ALIAS(glWindowPos2dv, glWindowPos2dvMESA)
+ GL_STUB_ALIAS(glWindowPos2dvARB, glWindowPos2dvMESA)
+ GL_STUB_ALIAS(glWindowPos2f, glWindowPos2fMESA)
+ GL_STUB_ALIAS(glWindowPos2fARB, glWindowPos2fMESA)
+ GL_STUB_ALIAS(glWindowPos2fv, glWindowPos2fvMESA)
+ GL_STUB_ALIAS(glWindowPos2fvARB, glWindowPos2fvMESA)
+ GL_STUB_ALIAS(glWindowPos2i, glWindowPos2iMESA)
+ GL_STUB_ALIAS(glWindowPos2iARB, glWindowPos2iMESA)
+ GL_STUB_ALIAS(glWindowPos2iv, glWindowPos2ivMESA)
+ GL_STUB_ALIAS(glWindowPos2ivARB, glWindowPos2ivMESA)
+ GL_STUB_ALIAS(glWindowPos2s, glWindowPos2sMESA)
+ GL_STUB_ALIAS(glWindowPos2sARB, glWindowPos2sMESA)
+ GL_STUB_ALIAS(glWindowPos2sv, glWindowPos2svMESA)
+ GL_STUB_ALIAS(glWindowPos2svARB, glWindowPos2svMESA)
+ GL_STUB_ALIAS(glWindowPos3d, glWindowPos3dMESA)
+ GL_STUB_ALIAS(glWindowPos3dARB, glWindowPos3dMESA)
+ GL_STUB_ALIAS(glWindowPos3dv, glWindowPos3dvMESA)
+ GL_STUB_ALIAS(glWindowPos3dvARB, glWindowPos3dvMESA)
+ GL_STUB_ALIAS(glWindowPos3f, glWindowPos3fMESA)
+ GL_STUB_ALIAS(glWindowPos3fARB, glWindowPos3fMESA)
+ GL_STUB_ALIAS(glWindowPos3fv, glWindowPos3fvMESA)
+ GL_STUB_ALIAS(glWindowPos3fvARB, glWindowPos3fvMESA)
+ GL_STUB_ALIAS(glWindowPos3i, glWindowPos3iMESA)
+ GL_STUB_ALIAS(glWindowPos3iARB, glWindowPos3iMESA)
+ GL_STUB_ALIAS(glWindowPos3iv, glWindowPos3ivMESA)
+ GL_STUB_ALIAS(glWindowPos3ivARB, glWindowPos3ivMESA)
+ GL_STUB_ALIAS(glWindowPos3s, glWindowPos3sMESA)
+ GL_STUB_ALIAS(glWindowPos3sARB, glWindowPos3sMESA)
+ GL_STUB_ALIAS(glWindowPos3sv, glWindowPos3svMESA)
+ GL_STUB_ALIAS(glWindowPos3svARB, glWindowPos3svMESA)
+ GL_STUB_ALIAS(glBindProgramARB, glBindProgramNV)
+ GL_STUB_ALIAS(glDeleteProgramsARB, glDeleteProgramsNV)
+ GL_STUB_ALIAS(glGenProgramsARB, glGenProgramsNV)
+ GL_STUB_ALIAS(glGetVertexAttribPointerv, glGetVertexAttribPointervNV)
+ GL_STUB_ALIAS(glGetVertexAttribPointervARB, glGetVertexAttribPointervNV)
+ GL_STUB_ALIAS(glIsProgramARB, glIsProgramNV)
+ GL_STUB_ALIAS(glPointParameteri, glPointParameteriNV)
+ GL_STUB_ALIAS(glPointParameteriv, glPointParameterivNV)
+ GL_STUB_ALIAS(glBindFramebuffer, glBindFramebufferEXT)
+ GL_STUB_ALIAS(glBindRenderbuffer, glBindRenderbufferEXT)
+ GL_STUB_ALIAS(glCheckFramebufferStatus, glCheckFramebufferStatusEXT)
+ GL_STUB_ALIAS(glDeleteFramebuffers, glDeleteFramebuffersEXT)
+ GL_STUB_ALIAS(glDeleteRenderbuffers, glDeleteRenderbuffersEXT)
+ GL_STUB_ALIAS(glFramebufferRenderbuffer, glFramebufferRenderbufferEXT)
+ GL_STUB_ALIAS(glFramebufferTexture1D, glFramebufferTexture1DEXT)
+ GL_STUB_ALIAS(glFramebufferTexture2D, glFramebufferTexture2DEXT)
+ GL_STUB_ALIAS(glFramebufferTexture3D, glFramebufferTexture3DEXT)
+ GL_STUB_ALIAS(glGenFramebuffers, glGenFramebuffersEXT)
+ GL_STUB_ALIAS(glGenRenderbuffers, glGenRenderbuffersEXT)
+ GL_STUB_ALIAS(glGenerateMipmap, glGenerateMipmapEXT)
+ GL_STUB_ALIAS(glGetFramebufferAttachmentParameteriv, glGetFramebufferAttachmentParameterivEXT)
+ GL_STUB_ALIAS(glGetRenderbufferParameteriv, glGetRenderbufferParameterivEXT)
+ GL_STUB_ALIAS(glIsFramebuffer, glIsFramebufferEXT)
+ GL_STUB_ALIAS(glIsRenderbuffer, glIsRenderbufferEXT)
+ GL_STUB_ALIAS(glRenderbufferStorage, glRenderbufferStorageEXT)
+ GL_STUB_ALIAS(glFramebufferTextureLayer, glFramebufferTextureLayerEXT)
+
+ .globl gl_dispatch_functions_end
+ HIDDEN(gl_dispatch_functions_end)
+gl_dispatch_functions_end:
diff --git a/src/mesa/sparc/norm.S b/src/mesa/sparc/norm.S
index 44950a10a5..117d36fa22 100644
--- a/src/mesa/sparc/norm.S
+++ b/src/mesa/sparc/norm.S
@@ -1,11 +1,8 @@
#include "sparc_matrix.h"
-#if defined(SVR4) || defined(__SVR4) || defined(__svr4__)
- /* Solaris requires this for 64-bit. */
.register %g2, #scratch
.register %g3, #scratch
-#endif
.text
@@ -98,7 +95,7 @@ _mesa_sparc_transform_normalize_normals:
cmp %o4, %g1 ! continue if (i < count)
bl 1b
- add %g3, 0x0c, %g3 ! advance out vector pointer
+ add %g3, 0x10, %g3 ! advance out vector pointer
ba 7f
nop
@@ -154,7 +151,7 @@ _mesa_sparc_transform_normalize_normals:
cmp %o4, %g1 ! continue if (i < count)
bl 5b
- add %g3, 0x0c, %g3 ! advance out vector pointer
+ add %g3, 0x10, %g3 ! advance out vector pointer
7: retl
nop
@@ -225,7 +222,7 @@ _mesa_sparc_transform_normalize_normals_no_rot:
cmp %o4, %g1 ! continue if (i < count)
bl 1b
- add %g3, 0x0c, %g3 ! advance out vector pointer
+ add %g3, 0x10, %g3 ! advance out vector pointer
ba 7f
nop
@@ -263,7 +260,7 @@ _mesa_sparc_transform_normalize_normals_no_rot:
cmp %o4, %g1 ! continue if (i < count)
bl 5b
- add %g3, 0x0c, %g3 ! advance out vector pointer
+ add %g3, 0x10, %g3 ! advance out vector pointer
7: retl
nop
@@ -314,7 +311,7 @@ _mesa_sparc_transform_rescale_normals_no_rot:
cmp %o4, %g1 ! continue if (i < count)
bl 1b
- add %g3, 0x0c, %g3 ! advance out vector pointer
+ add %g3, 0x10, %g3 ! advance out vector pointer
7: retl
nop
@@ -379,7 +376,7 @@ _mesa_sparc_transform_rescale_normals:
cmp %o4, %g1 ! continue if (i < count)
bl 1b
- add %g3, 0x0c, %g3 ! advance out vector pointer
+ add %g3, 0x10, %g3 ! advance out vector pointer
7: retl
nop
@@ -421,7 +418,7 @@ _mesa_sparc_transform_normals_no_rot:
cmp %o4, %g1 ! continue if (i < count)
bl 1b
- add %g3, 0x0c, %g3 ! advance out vector pointer
+ add %g3, 0x10, %g3 ! advance out vector pointer
7: retl
nop
@@ -471,7 +468,7 @@ _mesa_sparc_transform_normals:
cmp %o4, %g1 ! continue if (i < count)
bl 1b
- add %g3, 0x0c, %g3 ! advance out vector pointer
+ add %g3, 0x10, %g3 ! advance out vector pointer
7: retl
nop
@@ -529,7 +526,7 @@ _mesa_sparc_normalize_normals:
cmp %o4, %g1 ! continue if (i < count)
bl 1b
- add %g3, 0x0c, %g3 ! advance out vector pointer
+ add %g3, 0x10, %g3 ! advance out vector pointer
ba 7f
nop
@@ -557,7 +554,7 @@ _mesa_sparc_normalize_normals:
cmp %o4, %g1 ! continue if (i < count)
bl 5b
- add %g3, 0x0c, %g3 ! advance out vector pointer
+ add %g3, 0x10, %g3 ! advance out vector pointer
7: retl
nop
@@ -602,7 +599,7 @@ _mesa_sparc_rescale_normals:
cmp %o4, %g1 ! continue if (i < count)
bl 1b
- add %g3, 0x0c, %g3 ! advance out vector pointer
+ add %g3, 0x10, %g3 ! advance out vector pointer
7: retl
nop
diff --git a/src/mesa/sparc/sparc.c b/src/mesa/sparc/sparc.c
index 84e8ac6723..d2286a2c83 100644
--- a/src/mesa/sparc/sparc.c
+++ b/src/mesa/sparc/sparc.c
@@ -113,8 +113,6 @@ void _mesa_init_all_sparc_transform_asm(void)
_mesa_clip_tab[4] = _mesa_sparc_cliptest_points4;
_mesa_clip_np_tab[4] = _mesa_sparc_cliptest_points4_np;
-#if 0
- /* disable these too. See bug 673938 */
_mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] =
_mesa_sparc_transform_normalize_normals;
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] =
@@ -131,7 +129,6 @@ void _mesa_init_all_sparc_transform_asm(void)
_mesa_sparc_normalize_normals;
_mesa_normal_tab[NORM_RESCALE] =
_mesa_sparc_rescale_normals;
-#endif
#ifdef DEBUG_MATH
_math_test_all_transform_functions("sparc");
@@ -140,38 +137,4 @@ void _mesa_init_all_sparc_transform_asm(void)
#endif
}
-extern unsigned int _mesa_sparc_glapi_begin;
-extern unsigned int _mesa_sparc_glapi_end;
-extern void __glapi_sparc_icache_flush(unsigned int *);
-
#endif /* USE_SPARC_ASM */
-
-
-void _mesa_init_sparc_glapi_relocs(void)
-{
-#ifdef USE_SPARC_ASM
- unsigned int *insn_ptr, *end_ptr;
- unsigned long disp_addr;
-
- insn_ptr = &_mesa_sparc_glapi_begin;
- end_ptr = &_mesa_sparc_glapi_end;
- disp_addr = (unsigned long) &_glapi_Dispatch;
-
- while (insn_ptr < end_ptr) {
-#ifdef __arch64__
- insn_ptr[0] |= (disp_addr >> (32 + 10));
- insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10);
- __glapi_sparc_icache_flush(&insn_ptr[0]);
- insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1));
- insn_ptr[3] |= (disp_addr & ((1 << 10) - 1));
- __glapi_sparc_icache_flush(&insn_ptr[2]);
- insn_ptr += 11;
-#else
- insn_ptr[0] |= (disp_addr >> 10);
- insn_ptr[1] |= (disp_addr & ((1 << 10) - 1));
- __glapi_sparc_icache_flush(&insn_ptr[0]);
- insn_ptr += 5;
-#endif
- }
-#endif /* USE_SPARC_ASM */
-}
diff --git a/src/mesa/sparc/sparc.h b/src/mesa/sparc/sparc.h
index a98e4d0e40..b9ea336856 100644
--- a/src/mesa/sparc/sparc.h
+++ b/src/mesa/sparc/sparc.h
@@ -32,6 +32,5 @@
#define SPARC_H
extern void _mesa_init_all_sparc_transform_asm(void);
-extern void _mesa_init_sparc_glapi_relocs(void);
#endif /* !(SPARC_H) */
diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c
index a6156df7ae..4ea62dda18 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -106,7 +106,7 @@ update_depth_stencil_alpha(struct st_context *st)
ctx->Query.CurrentOcclusionObject->Active)
dsa->depth.occlusion_count = 1;
- if (ctx->Stencil.Enabled && ctx->Visual.stencilBits > 0) {
+ if (ctx->Stencil.Enabled && ctx->DrawBuffer->Visual.stencilBits > 0) {
dsa->stencil[0].enabled = 1;
dsa->stencil[0].func = st_compare_func_to_pipe(ctx->Stencil.Function[0]);
dsa->stencil[0].fail_op = gl_stencil_op_to_pipe(ctx->Stencil.FailFunc[0]);
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index ce872458e3..05b69c9d00 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -212,7 +212,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
inst[ic].TexSrcTarget = TEXTURE_2D_INDEX;
ic++;
fp->Base.InputsRead = (1 << FRAG_ATTRIB_TEX0);
- fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLR);
+ fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLOR);
fp->Base.SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */
if (key->scaleAndBias) {
@@ -400,7 +400,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
{
struct prog_instruction *last = &inst[ic - 1];
last->DstReg.File = PROGRAM_OUTPUT;
- last->DstReg.Index = FRAG_RESULT_COLR;
+ last->DstReg.Index = FRAG_RESULT_COLOR;
}
/* END; */
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 66d7cbf8e6..f55a5e713f 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -142,6 +142,10 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex)
/* KIL if -tmp0 < 0 # texel=0 -> keep / texel=0 -> discard */
p->Instructions[ic].Opcode = OPCODE_KIL;
p->Instructions[ic].SrcReg[0].File = PROGRAM_TEMPORARY;
+
+ if (ctx->st->bitmap.tex_format == PIPE_FORMAT_L8_UNORM)
+ p->Instructions[ic].SrcReg[0].Swizzle = SWIZZLE_XXXX;
+
p->Instructions[ic].SrcReg[0].Index = 0;
p->Instructions[ic].SrcReg[0].NegateBase = NEGATE_XYZW;
ic++;
@@ -157,7 +161,11 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex)
stfp = (struct st_fragment_program *) p;
stfp->Base.UsesKill = GL_TRUE;
- st_translate_fragment_program(ctx->st, stfp, NULL);
+
+ /* No need to send this incomplete program down to hardware:
+ *
+ * st_translate_fragment_program(ctx->st, stfp, NULL);
+ */
return stfp;
}
@@ -786,6 +794,10 @@ st_init_bitmap(struct st_context *st)
PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM;
}
+ else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
+ st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM;
+ }
else {
/* XXX support more formats */
assert(0);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index c73d0080ca..cc7a9e7890 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -75,7 +75,7 @@ is_passthrough_program(const struct gl_fragment_program *prog)
if (inst[0].Opcode == OPCODE_MOV &&
inst[1].Opcode == OPCODE_END &&
inst[0].DstReg.File == PROGRAM_OUTPUT &&
- inst[0].DstReg.Index == FRAG_RESULT_COLR &&
+ inst[0].DstReg.Index == FRAG_RESULT_COLOR &&
inst[0].DstReg.WriteMask == WRITEMASK_XYZW &&
inst[0].SrcReg[0].File == PROGRAM_INPUT &&
inst[0].SrcReg[0].Index == FRAG_ATTRIB_COL0 &&
@@ -158,7 +158,7 @@ combined_drawpix_fragment_program(GLcontext *ctx)
/**
* Create fragment shader that does a TEX() instruction to get a Z
- * value, then writes to FRAG_RESULT_DEPR.
+ * value, then writes to FRAG_RESULT_DEPTH.
* Pass fragment color through as-is.
*/
static struct st_fragment_program *
@@ -191,7 +191,7 @@ make_fragment_shader_z(struct st_context *st)
/* TEX result.depth, fragment.texcoord[0], texture[0], 2D; */
p->Instructions[ic].Opcode = OPCODE_TEX;
p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
- p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPR;
+ p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH;
p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z;
p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
@@ -202,7 +202,7 @@ make_fragment_shader_z(struct st_context *st)
/* MOV result.color, fragment.color */
p->Instructions[ic].Opcode = OPCODE_MOV;
p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
- p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLR;
+ p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR;
p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0;
ic++;
@@ -213,7 +213,7 @@ make_fragment_shader_z(struct st_context *st)
assert(ic == p->NumInstructions);
p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0;
- p->OutputsWritten = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_DEPR);
+ p->OutputsWritten = (1 << FRAG_RESULT_COLOR) | (1 << FRAG_RESULT_DEPTH);
p->SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */
st->drawpix.z_shader = (struct st_fragment_program *) p;
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 5cc6960c06..15bd6fee05 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -439,6 +439,25 @@ st_finish_render_texture(GLcontext *ctx,
}
+/**
+ * Check that the framebuffer configuration is valid in terms of what
+ * the driver can support.
+ *
+ * For Gallium we only supports combined Z+stencil, not separate buffers.
+ */
+static void
+st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
+{
+ const struct gl_renderbuffer *depthRb =
+ fb->Attachment[BUFFER_DEPTH].Renderbuffer;
+ const struct gl_renderbuffer *stencilRb =
+ fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+
+ if (stencilRb && depthRb && stencilRb != depthRb) {
+ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+ }
+}
+
void st_init_fbo_functions(struct dd_function_table *functions)
{
@@ -448,6 +467,7 @@ void st_init_fbo_functions(struct dd_function_table *functions)
functions->FramebufferRenderbuffer = st_framebuffer_renderbuffer;
functions->RenderTexture = st_render_texture;
functions->FinishRenderTexture = st_finish_render_texture;
+ functions->ValidateFramebuffer = st_validate_framebuffer;
/* no longer needed by core Mesa, drivers handle resizes...
functions->ResizeBuffers = st_resize_buffers;
*/
diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c
index 86d3542262..93f7145219 100644
--- a/src/mesa/state_tracker/st_cb_feedback.c
+++ b/src/mesa/state_tracker/st_cb_feedback.c
@@ -122,8 +122,8 @@ feedback_tri( struct draw_stage *stage, struct prim_header *prim )
{
struct feedback_stage *fs = feedback_stage(stage);
struct draw_context *draw = stage->draw;
- FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_POLYGON_TOKEN);
- FEEDBACK_TOKEN(fs->ctx, (GLfloat) 3); /* three vertices */
+ _mesa_feedback_token(fs->ctx, (GLfloat) GL_POLYGON_TOKEN);
+ _mesa_feedback_token(fs->ctx, (GLfloat) 3); /* three vertices */
feedback_vertex(fs->ctx, draw, prim->v[0]);
feedback_vertex(fs->ctx, draw, prim->v[1]);
feedback_vertex(fs->ctx, draw, prim->v[2]);
@@ -136,11 +136,11 @@ feedback_line( struct draw_stage *stage, struct prim_header *prim )
struct feedback_stage *fs = feedback_stage(stage);
struct draw_context *draw = stage->draw;
if (fs->reset_stipple_counter) {
- FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN);
+ _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN);
fs->reset_stipple_counter = GL_FALSE;
}
else {
- FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_LINE_TOKEN);
+ _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_TOKEN);
}
feedback_vertex(fs->ctx, draw, prim->v[0]);
feedback_vertex(fs->ctx, draw, prim->v[1]);
@@ -152,7 +152,7 @@ feedback_point( struct draw_stage *stage, struct prim_header *prim )
{
struct feedback_stage *fs = feedback_stage(stage);
struct draw_context *draw = stage->draw;
- FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_POINT_TOKEN);
+ _mesa_feedback_token(fs->ctx, (GLfloat) GL_POINT_TOKEN);
feedback_vertex(fs->ctx, draw, prim->v[0]);
}
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index d2535b6a2f..f825204915 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -466,23 +466,23 @@ st_translate_fragment_program(struct st_context *st,
GLbitfield outputsWritten = stfp->Base.Base.OutputsWritten;
/* if z is written, emit that first */
- if (outputsWritten & (1 << FRAG_RESULT_DEPR)) {
+ if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) {
fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION;
fs_output_semantic_index[fs_num_outputs] = 0;
- outputMapping[FRAG_RESULT_DEPR] = fs_num_outputs;
+ outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs;
fs_num_outputs++;
- outputsWritten &= ~(1 << FRAG_RESULT_DEPR);
+ outputsWritten &= ~(1 << FRAG_RESULT_DEPTH);
}
/* handle remaning outputs (color) */
for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
if (outputsWritten & (1 << attr)) {
switch (attr) {
- case FRAG_RESULT_DEPR:
+ case FRAG_RESULT_DEPTH:
/* handled above */
assert(0);
break;
- case FRAG_RESULT_COLR:
+ case FRAG_RESULT_COLOR:
fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR;
fs_output_semantic_index[fs_num_outputs] = numColors;
outputMapping[attr] = fs_num_outputs;
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 297940adbd..719e6b8296 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -206,7 +206,7 @@ _swrast_update_deferred_texture(GLcontext *ctx)
else {
const struct gl_fragment_program *fprog
= ctx->FragmentProgram._Current;
- if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR))) {
+ if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH))) {
/* Z comes from fragment program/shader */
swrast->_DeferredTexture = GL_FALSE;
}
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index cdd6fa5048..6e8d080704 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -289,6 +289,34 @@ swrast_render_finish(GLcontext *ctx)
/*
+ * Fixed point arithmetic macros
+ */
+#ifndef FIXED_FRAC_BITS
+#define FIXED_FRAC_BITS 11
+#endif
+
+#define FIXED_SHIFT FIXED_FRAC_BITS
+#define FIXED_ONE (1 << FIXED_SHIFT)
+#define FIXED_HALF (1 << (FIXED_SHIFT-1))
+#define FIXED_FRAC_MASK (FIXED_ONE - 1)
+#define FIXED_INT_MASK (~FIXED_FRAC_MASK)
+#define FIXED_EPSILON 1
+#define FIXED_SCALE ((float) FIXED_ONE)
+#define FIXED_DBL_SCALE ((double) FIXED_ONE)
+#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
+#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
+#define IntToFixed(I) ((I) << FIXED_SHIFT)
+#define FixedToInt(X) ((X) >> FIXED_SHIFT)
+#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT)
+#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
+#define FixedFloor(X) ((X) & FIXED_INT_MASK)
+#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
+#define PosFloatToFixed(X) FloatToFixed(X)
+#define SignedFloatToFixed(X) FloatToFixed(X)
+
+
+
+/*
* XXX these macros are just bandages for now in order to make
* CHAN_BITS==32 compile cleanly.
* These should probably go elsewhere at some point.
diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c
index aa79531277..7bb914b658 100644
--- a/src/mesa/swrast/s_feedback.c
+++ b/src/mesa/swrast/s_feedback.c
@@ -59,8 +59,8 @@ _swrast_feedback_triangle(GLcontext *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2)
{
if (_swrast_culltriangle(ctx, v0, v1, v2)) {
- FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN);
- FEEDBACK_TOKEN(ctx, (GLfloat) 3); /* three vertices */
+ _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN);
+ _mesa_feedback_token(ctx, (GLfloat) 3); /* three vertices */
if (ctx->Light.ShadeModel == GL_SMOOTH) {
feedback_vertex(ctx, v0, v0);
@@ -86,7 +86,7 @@ _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0,
if (swrast->StippleCounter == 0)
token = GL_LINE_RESET_TOKEN;
- FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) token);
+ _mesa_feedback_token(ctx, (GLfloat) (GLint) token);
if (ctx->Light.ShadeModel == GL_SMOOTH) {
feedback_vertex(ctx, v0, v0);
@@ -104,7 +104,7 @@ _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0,
void
_swrast_feedback_point(GLcontext *ctx, const SWvertex *v)
{
- FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POINT_TOKEN);
+ _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN);
feedback_vertex(ctx, v, v);
}
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index c6601f5593..3735f041d6 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -202,9 +202,9 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
if (_mesa_execute_program(ctx, &program->Base, machine)) {
/* Store result color */
- if (outputsWritten & (1 << FRAG_RESULT_COLR)) {
+ if (outputsWritten & (1 << FRAG_RESULT_COLOR)) {
COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i],
- machine->Outputs[FRAG_RESULT_COLR]);
+ machine->Outputs[FRAG_RESULT_COLOR]);
}
else {
/* Multiple drawbuffers / render targets
@@ -221,8 +221,8 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
}
/* Store result depth/z */
- if (outputsWritten & (1 << FRAG_RESULT_DEPR)) {
- const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPR][2];
+ if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) {
+ const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPTH][2];
if (depth <= 0.0)
span->array->z[i] = 0;
else if (depth >= 1.0)
@@ -259,12 +259,12 @@ _swrast_exec_fragment_program( GLcontext *ctx, SWspan *span )
run_program(ctx, span, 0, span->end);
- if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLR)) {
+ if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)) {
span->interpMask &= ~SPAN_RGBA;
span->arrayMask |= SPAN_RGBA;
}
- if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) {
+ if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) {
span->interpMask &= ~SPAN_Z;
span->arrayMask |= SPAN_Z;
}
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index 047f7991e6..015f8a05c3 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -75,6 +75,12 @@ typedef struct {
} SWvertex;
+/**
+ * Fixed point data type.
+ */
+typedef int GLfixed;
+
+
#define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index f0d31fdac3..f69b122046 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -149,13 +149,10 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
/* fixed-function fog */
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
}
- else if (ctx->FragmentProgram._Current) {
- struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
- if (fp) {
- if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) {
- /* fragment program needs fog coord */
- RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
- }
+ else if (fp) {
+ if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) {
+ /* fragment program needs fog coord */
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
}
}
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 0a6ce04614..c19eb3df3c 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -50,6 +50,7 @@
#define _T_CONTEXT_H
#include "main/glheader.h"
+#include "main/bitset.h"
#include "main/mtypes.h"
#include "math/m_matrix.h"
diff --git a/src/mesa/tnl_dd/t_dd_vb.c b/src/mesa/tnl_dd/t_dd_vb.c
index 3cedd90119..b3937c29a0 100644
--- a/src/mesa/tnl_dd/t_dd_vb.c
+++ b/src/mesa/tnl_dd/t_dd_vb.c
@@ -188,6 +188,9 @@ void TAG(translate_vertex)(GLcontext *ctx,
}
+/* prototype to silence warning */
+void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v );
+
void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v )
{