+Mesa 7.2 is a stable release fixing bugs found in 7.1, which was a
+new development release.
+
+
+Mesa 7.2 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+
+
+Note that this version of Mesa does not use the GEM memory manager.
+The master branch of git uses GEM.
+The prototype DRI2 code that was in 7.1 has also been removed.
+
i965 driver: added support for G41 chipset (Intel)
+
+
+
+
Bug fixes
+
+
Fixed display list bug involving primitives split across lists (bug 17564)
+
Fixed some issues with glBindAttribLocation()
+
Fixed crash in _tnl_InvalidateState() found with Amira (bug 15834)
+
Assorted bug fixes for Ming build
+
Fixed some vertex/pixel buffer object reference counting bugs
+
Fixed depth/stencil bug in i915/945 driver
+
Fixed some shader flow control bugs in i965 driver
+
Fixed a few tdfx driver bugs which prevented driver from working
+
Fixed multisample enable/disable bug
+
+
+
Changes
+
+
Updated SGI header files with new license terms.
+
+
+
+
+
To Do (someday) items
+
+
Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy().
+Probably do the same for malloc, calloc, etc.
+The wrappers were useful in the past for memory debugging but now we
+have valgrind. Not worried about SunOS 4 support anymore either...
+
Switch to freeglut
+
Fix linux-glide target/driver.
+
Improved lambda and derivative calculation for frag progs.
+
+
+
+
Driver Status
+
+
+Driver Status
+---------------------- ----------------------
+DRI drivers varies with the driver
+XMesa/GLX (on Xlib) implements OpenGL 2.1
+OSMesa (off-screen) implements OpenGL 2.1
+Windows/Win32 implements OpenGL 2.1
+Glide (3dfx Voodoo1/2) implements OpenGL 1.3
+SVGA unsupported
+Wind River UGL unsupported
+DJGPP unsupported
+GGI unsupported
+BeOS unsupported
+Allegro unsupported
+D3D unsupported
+
+Mesa 7.3 is a new development release.
+Users especially concerned with stability should stick with latest
+stable release: version 7.2.
+
+
+Mesa 7.3 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+
+
+
+DRM version 2.4.2 or later should be used with Mesa 7.3
+
+
+
+
MD5 checksums
+
+tbd
+
+
+
+
New features
+
+
Support for GLSL 1.20
+
Intel DRI drivers now use GEM and DRI2
+
+
+
+
Bug fixes
+
+
Assorted GLSL bug fixes
+
Assorted i965 driver fixes
+
+
+
Changes
+
+
+
+
+
+
Driver Status
+
+
+Driver Status
+---------------------- ----------------------
+DRI drivers varies with the driver
+XMesa/GLX (on Xlib) implements OpenGL 2.1
+OSMesa (off-screen) implements OpenGL 2.1
+Windows/Win32 implements OpenGL 2.1
+Glide (3dfx Voodoo1/2) implements OpenGL 1.3
+SVGA unsupported
+Wind River UGL unsupported
+DJGPP unsupported
+GGI unsupported
+BeOS unsupported
+Allegro unsupported
+D3D unsupported
+
+
+
+
diff --git a/docs/relnotes.html b/docs/relnotes.html
index e305977163..020e48551e 100644
--- a/docs/relnotes.html
+++ b/docs/relnotes.html
@@ -20,6 +20,8 @@ The release notes summarize what's new or changed in each Mesa release.
+Mesa 7.3 is released.
+This is a new development release.
+
+
+
+
September 20, 2008
+
+Mesa 7.2 is released.
+This is a stable, bug-fix release.
+
+
+
August 26, 2008
Mesa 7.1 is released.
--
cgit v1.2.3
From 2c0ce92e8af4aab75f9a69a7913a1bec705220f3 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 8 Jan 2009 16:15:31 -0700
Subject: docs: updated Cell docs, from gallium-0.2 branch
---
docs/cell.html | 72 ++++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 57 insertions(+), 15 deletions(-)
diff --git a/docs/cell.html b/docs/cell.html
index f9915d67e5..7fbbba7c7e 100644
--- a/docs/cell.html
+++ b/docs/cell.html
@@ -6,7 +6,7 @@
-
Mesa Cell Driver
+
Mesa/Gallium Cell Driver
The Mesa
@@ -23,18 +23,19 @@ Two phases are planned.
First, to implement the framework for parallel rasterization using the Cell
SPEs, including texture mapping.
Second, to implement a full-featured OpenGL driver with support for GLSL, etc.
+The second phase is now underway.
Source Code
-The Cell driver source code is on the gallium-0.1 branch of the
-git repository.
+The latest Cell driver source code is on the gallium-0.2 branch
+of the Mesa git repository.
After you've cloned the repository, check out the branch with:
To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0).
@@ -43,12 +44,13 @@ or the Cell Simulator (untested, though).
-If using Cell SDK 3.0, first edit configs/linux-cell and add
--DSPU_MAIN_PARAM_LONG_LONG to the SPU_CFLAGS.
+If using Cell SDK 2.1, see the configs/linux-cell file for some
+special changes.
To compile the code, run make linux-cell.
+To build in debug mode, run make linux-cell-debug.
@@ -60,7 +62,7 @@ directory that contains libGL.so.
Verify that the Cell driver is being used by running glxinfo
and looking for:
- OpenGL renderer string: Gallium 0.1, Cell on Xlib
+ OpenGL renderer string: Gallium 0.2, Cell on Xlib
@@ -77,21 +79,61 @@ SPU local store as needed.
Similarly, textures are tiled and brought into local store as needed.
+
+
Status
+
+
+As of October 2008, the driver runs quite a few OpenGL demos.
+Features that work include:
+
+
+
Point/line/triangle rendering, glDrawPixels
+
2D, NPOT and cube texture maps with nearest/linear/mipmap filtering
+
Dynamic SPU code generation for fragment shaders, but not complete
+
Dynamic SPU code generation for fragment ops (blend, Z-test, etc), but not complete
+
Dynamic PPU/PPC code generation for vertex shaders, but not complete
+
-More recently, vertex transformation has been parallelized across the SPUs
-as well.
+Performance has recently improved with the addition of PPC code generation
+for vertex shaders, but the code quality isn't too great yet.
+
+
+Another bottleneck is SwapBuffers. It may be the limiting factor for
+many simple GL tests.
-
Status
+
+
Debug Options
-As of February 2008 the driver supports smooth/flat shaded triangle rendering
-with Z testing and simple texture mapping.
-Simple demos like gears run successfully.
-To test texture mapping, try progs/demos/texcyl (press right mouse button for
-rendering options).
+The CELL_DEBUG env var can be set to a comma-separated list of one or
+more of the following debug options:
+
+
checker - use a different background clear color for each SPU.
+ This lets you see which SPU is rendering which screen tiles.
+
sync - wait/synchronize after each DMA transfer
+
asm - print generated SPU assembly code to stdout
+
fragops - emit fragment ops debug messages
+
fragopfallback - don't use codegen for fragment ops
+
cmd - print SPU commands as their received
+
cache - print texture cache statistics when program exits
+
+
+Note that some of these options may only work for linux-cell-debug builds.
+
+
+
+If the GALLIUM_NOPPC env var is set, PPC code generation will not be used
+and vertex shaders will be run with the TGSI interpreter.
+
+
+If the GALLIUM_NOCELL env var is set, the softpipe driver will be used
+intead of the Cell driver.
+This is useful for comparison/validation.
+
+
Contributing
--
cgit v1.2.3
From 0713e9da73cebfc35550ab192f385b955eb8ebcd Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 8 Jan 2009 16:16:36 -0700
Subject: mesa: set version string to 7.3-rc1
---
src/mesa/main/version.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index 81034a35d1..83aefe685a 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -31,7 +31,7 @@
#define MESA_MAJOR 7
#define MESA_MINOR 3
#define MESA_PATCH 0
-#define MESA_VERSION_STRING "7.3-devel"
+#define MESA_VERSION_STRING "7.3-rc1"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
--
cgit v1.2.3
From acd99f67cc04ae249e35a9d80de12c0af012e4fc Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 8 Jan 2009 17:07:28 -0700
Subject: glsl: fix typo in the vec2 += operator function
---
src/mesa/shader/slang/library/slang_core.gc | 2 +-
src/mesa/shader/slang/library/slang_core_gc.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mesa/shader/slang/library/slang_core.gc b/src/mesa/shader/slang/library/slang_core.gc
index 748add4bc8..0a0d15903b 100644
--- a/src/mesa/shader/slang/library/slang_core.gc
+++ b/src/mesa/shader/slang/library/slang_core.gc
@@ -1344,7 +1344,7 @@ float __operator /= (inout float a, const float b)
vec2 __operator += (inout vec2 v, const vec2 u)
{
- v + v + u;
+ v = v + u;
return v;
}
diff --git a/src/mesa/shader/slang/library/slang_core_gc.h b/src/mesa/shader/slang/library/slang_core_gc.h
index 76344c6824..b3d3e87cf4 100644
--- a/src/mesa/shader/slang/library/slang_core_gc.h
+++ b/src/mesa/shader/slang/library/slang_core_gc.h
@@ -408,7 +408,7 @@
18,97,0,18,97,0,18,98,0,47,20,0,8,18,97,0,0,0,1,90,95,0,0,9,0,2,3,1,0,2,0,9,0,97,0,0,1,1,0,0,9,0,
98,0,0,0,1,9,18,97,0,18,97,0,18,98,0,48,20,0,8,18,97,0,0,0,1,90,95,0,0,9,0,2,4,1,0,2,0,9,0,97,0,0,
1,1,0,0,9,0,98,0,0,0,1,9,18,97,0,18,97,0,18,98,0,49,20,0,8,18,97,0,0,0,1,90,95,0,0,10,0,2,1,1,0,2,
-0,10,0,118,0,0,1,1,0,0,10,0,117,0,0,0,1,9,18,118,0,18,118,0,46,18,117,0,46,0,8,18,118,0,0,0,1,90,
+0,10,0,118,0,0,1,1,0,0,10,0,117,0,0,0,1,9,18,118,0,18,118,0,18,117,0,46,20,0,8,18,118,0,0,0,1,90,
95,0,0,10,0,2,2,1,0,2,0,10,0,118,0,0,1,1,0,0,10,0,117,0,0,0,1,9,18,118,0,18,118,0,18,117,0,47,20,0,
8,18,118,0,0,0,1,90,95,0,0,10,0,2,3,1,0,2,0,10,0,118,0,0,1,1,0,0,10,0,117,0,0,0,1,9,18,118,0,18,
118,0,18,117,0,48,20,0,8,18,118,0,0,0,1,90,95,0,0,10,0,2,4,1,0,2,0,10,0,118,0,0,1,1,0,0,10,0,117,0,
--
cgit v1.2.3
From d0c2cbd2571dba66463a37222d058f4394ba0918 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 8 Jan 2009 17:19:51 -0700
Subject: docs: dri2proto, libdrm tweaks
---
docs/install.html | 2 +-
docs/relnotes-7.3.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/install.html b/docs/install.html
index 2d72506f67..d740477c13 100644
--- a/docs/install.html
+++ b/docs/install.html
@@ -38,7 +38,7 @@ The following are required for DRI-based hardware acceleration with Mesa 7.3:
Xorg server version 1.4 or 1.5.
diff --git a/docs/relnotes-7.3.html b/docs/relnotes-7.3.html
index 2be762d91d..5cb7dc20fd 100644
--- a/docs/relnotes-7.3.html
+++ b/docs/relnotes-7.3.html
@@ -22,7 +22,7 @@ Some drivers don't support all the features required in OpenGL 2.1.
-DRM version 2.4.2 or later should be used with Mesa 7.3
+DRM version 2.4.3 or later should be used with Mesa 7.3
--
cgit v1.2.3
From 08fdc741bc509c284532d0e2fec32980c3047aec Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 8 Jan 2009 17:20:18 -0700
Subject: mesa: import glext.h version 44
---
include/GL/glext.h | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 66 insertions(+), 2 deletions(-)
diff --git a/include/GL/glext.h b/include/GL/glext.h
index 4255fa8639..c0941aa804 100644
--- a/include/GL/glext.h
+++ b/include/GL/glext.h
@@ -46,9 +46,9 @@ extern "C" {
/*************************************************************/
/* Header file version number, required by OpenGL ABI for Linux */
-/* glext.h last updated 2008/10/09 */
+/* glext.h last updated 2008/11/14 */
/* Current version at http://www.opengl.org/registry/ */
-#define GL_GLEXT_VERSION 43
+#define GL_GLEXT_VERSION 44
#ifndef GL_VERSION_1_2
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
@@ -3834,6 +3834,34 @@ extern "C" {
/* reuse GL_BGRA */
#endif
+#ifndef GL_EXT_texture_swizzle
+#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42
+#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43
+#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44
+#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45
+#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46
+#endif
+
+#ifndef GL_NV_explicit_multisample
+#define GL_SAMPLE_POSITION_NV 0x8E50
+#define GL_SAMPLE_MASK_NV 0x8E51
+#define GL_SAMPLE_MASK_VALUE_NV 0x8E52
+#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53
+#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54
+#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59
+#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55
+#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56
+#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57
+#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58
+#endif
+
+#ifndef GL_NV_transform_feedback2
+#define GL_TRANSFORM_FEEDBACK_NV 0x8E22
+#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23
+#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25
+#endif
+
/*************************************************************/
@@ -8387,6 +8415,42 @@ typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenu
#define GL_EXT_vertex_array_bgra 1
#endif
+#ifndef GL_EXT_texture_swizzle
+#define GL_EXT_texture_swizzle 1
+#endif
+
+#ifndef GL_NV_explicit_multisample
+#define GL_NV_explicit_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetMultisamplefvNV (GLenum, GLuint, GLfloat *);
+GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint, GLbitfield);
+GLAPI void APIENTRY glTexRenderbufferNV (GLenum, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val);
+typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask);
+typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer);
+#endif
+
+#ifndef GL_NV_transform_feedback2
+#define GL_NV_transform_feedback2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum, GLuint);
+GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei, const GLuint *);
+GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei, GLuint *);
+GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint);
+GLAPI void APIENTRY glPauseTransformFeedbackNV (void);
+GLAPI void APIENTRY glResumeTransformFeedbackNV (void);
+GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id);
+typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids);
+typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids);
+typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void);
+typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void);
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id);
+#endif
+
#ifdef __cplusplus
}
--
cgit v1.2.3
From f7b4c2cca9ea9013f527b25ae45605047c58d64c Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 8 Jan 2009 17:20:41 -0700
Subject: mesa: latest glxext.h header, no version change
---
include/GL/glxext.h | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/include/GL/glxext.h b/include/GL/glxext.h
index 71cf0469e3..536fb25a76 100644
--- a/include/GL/glxext.h
+++ b/include/GL/glxext.h
@@ -127,6 +127,14 @@ extern "C" {
#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004
#endif
+#ifndef GLX_ARB_create_context
+#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
+#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define GLX_CONTEXT_FLAGS_ARB 0x2094
+#endif
+
#ifndef GLX_SGIS_multisample
#define GLX_SAMPLE_BUFFERS_SGIS 100000
#define GLX_SAMPLES_SGIS 100001
@@ -366,14 +374,6 @@ extern "C" {
#ifndef GLX_NV_swap_group
#endif
-#ifndef GLX_ARB_create_context
-#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
-#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
-#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
-#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
-#define GLX_CONTEXT_FLAGS_ARB 0x2094
-#endif
-
/*************************************************************/
@@ -510,6 +510,14 @@ typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procNam
#define GLX_ARB_fbconfig_float 1
#endif
+#ifndef GLX_ARB_create_context
+#define GLX_ARB_create_context 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern GLXContext glXCreateContextAttribsARB (Display *, GLXFBConfig, GLXContext, Bool, const int *);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
+#endif
+
#ifndef GLX_SGIS_multisample
#define GLX_SGIS_multisample 1
#endif
@@ -817,14 +825,6 @@ typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawab
#define GLX_NV_swap_group 1
#endif
-#ifndef GLX_ARB_create_context
-#define GLX_ARB_create_context 1
-#ifdef GLX_GLXEXT_PROTOTYPES
-extern GLXContext glXCreateContextAttribsARB (Display *, GLXFBConfig, GLXContext, Bool, const int *);
-#endif /* GLX_GLXEXT_PROTOTYPES */
-typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
-#endif
-
#ifdef __cplusplus
}
--
cgit v1.2.3
From 4497a5a57d0fdb5c5ec15750e477aeb49f5e453d Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 8 Jan 2009 17:21:20 -0700
Subject: mesa: 7.3-rc-1 Makefile changes
---
Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index c92b4867f7..dbe444d294 100644
--- a/Makefile
+++ b/Makefile
@@ -174,10 +174,10 @@ ultrix-gcc:
# Rules for making release tarballs
-DIRECTORY = Mesa-7.1-rc4
-LIB_NAME = MesaLib-7.1-rc4
-DEMO_NAME = MesaDemos-7.1-rc4
-GLUT_NAME = MesaGLUT-7.1-rc4
+DIRECTORY = Mesa-7.3-rc1
+LIB_NAME = MesaLib-7.3-rc1
+DEMO_NAME = MesaDemos-7.3-rc1
+GLUT_NAME = MesaGLUT-7.3-rc1
MAIN_FILES = \
$(DIRECTORY)/Makefile* \
--
cgit v1.2.3
From ca03e881a8d8fa3e36a601238559c20311373633 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 9 Jan 2009 09:59:49 -0700
Subject: glsl: make minimum struct size = 2, not 1
1-component structs such as "struct foo { float x; }" could get placed at
any position within a register. This caused some trouble computing the
field offset which assumed all struct objects were placed at R.x.
It would be unusual to hit this case in normal shaders.
---
src/mesa/shader/slang/slang_codegen.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index ba1c955a1a..f5c5cbdd48 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -228,7 +228,14 @@ _slang_sizeof_type_specifier(const slang_type_specifier *spec)
break;
case SLANG_SPEC_STRUCT:
sz = _slang_field_offset(spec, 0); /* special use */
- if (sz > 4) {
+ if (sz == 1) {
+ /* 1-float structs are actually troublesome to deal with since they
+ * might get placed at R.x, R.y, R.z or R.z. Return size=2 to
+ * ensure the object is placed at R.x
+ */
+ sz = 2;
+ }
+ else if (sz > 4) {
sz = (sz + 3) & ~0x3; /* round up to multiple of four */
}
break;
--
cgit v1.2.3
From 9939a306f7dc109d301e7b2d6abf4f2ab019bde0 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Fri, 9 Jan 2009 13:56:44 -0800
Subject: swrast: Fix GL_ATI_separate_stencil
GL_ATI_separate_stencil is enabled by default for software
rasterizers, but the extension functions weren't hooked up to the
dispatch table.
---
src/mesa/drivers/dri/swrast/swrast.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 49f1b8b9ee..15b57244dc 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -66,6 +66,7 @@
#define need_GL_ARB_vertex_program
#define need_GL_APPLE_vertex_array_object
#define need_GL_ATI_fragment_shader
+#define need_GL_ATI_separate_stencil
#define need_GL_EXT_depth_bounds_test
#define need_GL_EXT_framebuffer_object
#define need_GL_EXT_framebuffer_blit
@@ -96,6 +97,7 @@ const struct dri_extension card_extensions[] =
{ "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
{ "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions },
{ "GL_ATI_fragment_shader", GL_ATI_fragment_shader_functions },
+ { "GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions },
{ "GL_EXT_depth_bounds_test", GL_EXT_depth_bounds_test_functions },
{ "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
{ "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions },
--
cgit v1.2.3
From 1d352b42a106ed0c3cd0831fa681d07794b7ff3d Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sat, 10 Jan 2009 11:39:05 -0700
Subject: glsl: replace 0/1 with GL_FALSE/GL_TRUE
---
src/mesa/shader/slang/slang_compile.c | 36 +++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index c150931ead..ec27fc69df 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -1005,7 +1005,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
/* parse child statements, do not create new variable scope */
oper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE;
while (*C->I != OP_END)
- if (!parse_child_operation(C, O, oper, 1))
+ if (!parse_child_operation(C, O, oper, GL_TRUE))
RETURN0;
C->I++;
break;
@@ -1017,7 +1017,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
oper->type = SLANG_OPER_BLOCK_NEW_SCOPE;
o.vars = oper->locals;
while (*C->I != OP_END)
- if (!parse_child_operation(C, &o, oper, 1))
+ if (!parse_child_operation(C, &o, oper, GL_TRUE))
RETURN0;
C->I++;
}
@@ -1074,7 +1074,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
if (oper->a_id == SLANG_ATOM_NULL)
RETURN0;
while (*C->I != OP_END) {
- if (!parse_child_operation(C, O, oper, 0))
+ if (!parse_child_operation(C, O, oper, GL_FALSE))
RETURN0;
}
C->I++;
@@ -1090,21 +1090,21 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
break;
case OP_RETURN:
oper->type = SLANG_OPER_RETURN;
- if (!parse_child_operation(C, O, oper, 0))
+ if (!parse_child_operation(C, O, oper, GL_FALSE))
RETURN0;
break;
case OP_EXPRESSION:
oper->type = SLANG_OPER_EXPRESSION;
- if (!parse_child_operation(C, O, oper, 0))
+ if (!parse_child_operation(C, O, oper, GL_FALSE))
RETURN0;
break;
case OP_IF:
oper->type = SLANG_OPER_IF;
- if (!parse_child_operation(C, O, oper, 0))
+ if (!parse_child_operation(C, O, oper, GL_FALSE))
RETURN0;
- if (!parse_child_operation(C, O, oper, 1))
+ if (!parse_child_operation(C, O, oper, GL_TRUE))
RETURN0;
- if (!parse_child_operation(C, O, oper, 1))
+ if (!parse_child_operation(C, O, oper, GL_TRUE))
RETURN0;
break;
case OP_WHILE:
@@ -1113,17 +1113,17 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
oper->type = SLANG_OPER_WHILE;
o.vars = oper->locals;
- if (!parse_child_operation(C, &o, oper, 1))
+ if (!parse_child_operation(C, &o, oper, GL_TRUE))
RETURN0;
- if (!parse_child_operation(C, &o, oper, 1))
+ if (!parse_child_operation(C, &o, oper, GL_TRUE))
RETURN0;
}
break;
case OP_DO:
oper->type = SLANG_OPER_DO;
- if (!parse_child_operation(C, O, oper, 1))
+ if (!parse_child_operation(C, O, oper, GL_TRUE))
RETURN0;
- if (!parse_child_operation(C, O, oper, 0))
+ if (!parse_child_operation(C, O, oper, GL_FALSE))
RETURN0;
break;
case OP_FOR:
@@ -1132,13 +1132,13 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
oper->type = SLANG_OPER_FOR;
o.vars = oper->locals;
- if (!parse_child_operation(C, &o, oper, 1))
+ if (!parse_child_operation(C, &o, oper, GL_TRUE))
RETURN0;
- if (!parse_child_operation(C, &o, oper, 1))
+ if (!parse_child_operation(C, &o, oper, GL_TRUE))
RETURN0;
- if (!parse_child_operation(C, &o, oper, 0))
+ if (!parse_child_operation(C, &o, oper, GL_FALSE))
RETURN0;
- if (!parse_child_operation(C, &o, oper, 1))
+ if (!parse_child_operation(C, &o, oper, GL_TRUE))
RETURN0;
}
break;
@@ -1429,7 +1429,7 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
C->I++;
while (*C->I != OP_END)
- if (!parse_child_operation(C, O, op, 0))
+ if (!parse_child_operation(C, O, op, GL_FALSE))
RETURN0;
C->I++;
#if 0
@@ -1494,7 +1494,7 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
RETURN0;
}
while (*C->I != OP_END)
- if (!parse_child_operation(C, O, op, 0))
+ if (!parse_child_operation(C, O, op, GL_FALSE))
RETURN0;
C->I++;
--
cgit v1.2.3
From 6333005f7aea3e5d1d86a5c47b3fa2a1ed2f3ff0 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sat, 10 Jan 2009 11:40:20 -0700
Subject: glsl: force creation of new scope for for-loop body
Fixes regression in progs/demos/convolution.c due to loop unrolling.
This also allows the following to be compiled correctly:
for (int i = 0; i < n; i++) {
int i;
...
}
This fix is a bit of a hack, however. The better fix would be to change
the slang_shader.syn grammar. Will revisit that...
---
src/mesa/shader/slang/slang_compile.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index ec27fc69df..add8594ff9 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -1138,8 +1138,26 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
RETURN0;
if (!parse_child_operation(C, &o, oper, GL_FALSE))
RETURN0;
+#if 0
if (!parse_child_operation(C, &o, oper, GL_TRUE))
RETURN0;
+#else
+ /* force creation of new scope for loop body */
+ {
+ slang_operation *ch;
+ slang_output_ctx oo = o;
+
+ /* grow child array */
+ ch = slang_operation_grow(&oper->num_children, &oper->children);
+ ch->type = SLANG_OPER_BLOCK_NEW_SCOPE;
+
+ ch->locals->outer_scope = o.vars;
+ oo.vars = ch->locals;
+
+ if (!parse_child_operation(C, &oo, ch, GL_TRUE))
+ RETURN0;
+ }
+#endif
}
break;
case OP_PRECISION:
--
cgit v1.2.3
From 2c56dd775771d9d5ea2e22cf4ee4b5dbbbb2a03d Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sat, 10 Jan 2009 11:52:55 -0700
Subject: docs: prerequisite updates
---
docs/install.html | 5 +++--
docs/relnotes-7.3.html | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/docs/install.html b/docs/install.html
index d740477c13..be61ef3043 100644
--- a/docs/install.html
+++ b/docs/install.html
@@ -39,9 +39,10 @@ The following are required for DRI-based hardware acceleration with Mesa 7.3:
diff --git a/docs/relnotes-7.3.html b/docs/relnotes-7.3.html
index 5cb7dc20fd..c00e5fe2f8 100644
--- a/docs/relnotes-7.3.html
+++ b/docs/relnotes-7.3.html
@@ -21,8 +21,8 @@ glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
-
-DRM version 2.4.3 or later should be used with Mesa 7.3
+See the Compiling/Installing page for prerequisites
+for DRI ardware acceleration.
--
cgit v1.2.3
From 1636328b0adefcebcc204d63980184a6d592efae Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sat, 10 Jan 2009 11:57:13 -0700
Subject: xmesa: deprecate the "XMesa" interface
Move the include/GL/xmesa*.h files to src/mesa/drivers/x11/ so they're no
longer considered public.
---
include/GL/xmesa.h | 424 --------------------------------------
include/GL/xmesa_x.h | 86 --------
include/GL/xmesa_xf86.h | 198 ------------------
src/mesa/drivers/x11/fakeglx.c | 1 -
src/mesa/drivers/x11/xm_api.c | 1 -
src/mesa/drivers/x11/xm_buffer.c | 1 -
src/mesa/drivers/x11/xmesa.h | 424 ++++++++++++++++++++++++++++++++++++++
src/mesa/drivers/x11/xmesaP.h | 2 +-
src/mesa/drivers/x11/xmesa_x.h | 86 ++++++++
src/mesa/drivers/x11/xmesa_xf86.h | 198 ++++++++++++++++++
10 files changed, 709 insertions(+), 712 deletions(-)
delete mode 100644 include/GL/xmesa.h
delete mode 100644 include/GL/xmesa_x.h
delete mode 100644 include/GL/xmesa_xf86.h
create mode 100644 src/mesa/drivers/x11/xmesa.h
create mode 100644 src/mesa/drivers/x11/xmesa_x.h
create mode 100644 src/mesa/drivers/x11/xmesa_xf86.h
diff --git a/include/GL/xmesa.h b/include/GL/xmesa.h
deleted file mode 100644
index 98139af833..0000000000
--- a/include/GL/xmesa.h
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/*
- * Mesa/X11 interface. This header file serves as the documentation for
- * the Mesa/X11 interface functions.
- *
- * Note: this interface isn't intended for user programs. It's primarily
- * just for implementing the pseudo-GLX interface.
- */
-
-
-/* Sample Usage:
-
-In addition to the usual X calls to select a visual, create a colormap
-and create a window, you must do the following to use the X/Mesa interface:
-
-1. Call XMesaCreateVisual() to make an XMesaVisual from an XVisualInfo.
-
-2. Call XMesaCreateContext() to create an X/Mesa rendering context, given
- the XMesaVisual.
-
-3. Call XMesaCreateWindowBuffer() to create an XMesaBuffer from an X window
- and XMesaVisual.
-
-4. Call XMesaMakeCurrent() to bind the XMesaBuffer to an XMesaContext and
- to make the context the current one.
-
-5. Make gl* calls to render your graphics.
-
-6. Use XMesaSwapBuffers() when double buffering to swap front/back buffers.
-
-7. Before the X window is destroyed, call XMesaDestroyBuffer().
-
-8. Before exiting, call XMesaDestroyVisual and XMesaDestroyContext.
-
-*/
-
-
-
-
-#ifndef XMESA_H
-#define XMESA_H
-
-#ifdef __VMS
-#include
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef XFree86Server
-#include "xmesa_xf86.h"
-#else
-#include
-#include
-#include "xmesa_x.h"
-#endif
-#include "GL/gl.h"
-
-#ifdef AMIWIN
-#include
-extern struct Library *XLibBase;
-#endif
-
-
-#define XMESA_MAJOR_VERSION 6
-#define XMESA_MINOR_VERSION 3
-
-
-
-/*
- * Values passed to XMesaGetString:
- */
-#define XMESA_VERSION 1
-#define XMESA_EXTENSIONS 2
-
-
-/*
- * Values passed to XMesaSetFXmode:
- */
-#define XMESA_FX_WINDOW 1
-#define XMESA_FX_FULLSCREEN 2
-
-
-
-typedef struct xmesa_context *XMesaContext;
-
-typedef struct xmesa_visual *XMesaVisual;
-
-typedef struct xmesa_buffer *XMesaBuffer;
-
-
-
-/*
- * Create a new X/Mesa visual.
- * Input: display - X11 display
- * visinfo - an XVisualInfo pointer
- * rgb_flag - GL_TRUE = RGB mode,
- * GL_FALSE = color index mode
- * alpha_flag - alpha buffer requested?
- * db_flag - GL_TRUE = double-buffered,
- * GL_FALSE = single buffered
- * stereo_flag - stereo visual?
- * ximage_flag - GL_TRUE = use an XImage for back buffer,
- * GL_FALSE = use an off-screen pixmap for back buffer
- * depth_size - requested bits/depth values, or zero
- * stencil_size - requested bits/stencil values, or zero
- * accum_red_size - requested bits/red accum values, or zero
- * accum_green_size - requested bits/green accum values, or zero
- * accum_blue_size - requested bits/blue accum values, or zero
- * accum_alpha_size - requested bits/alpha accum values, or zero
- * num_samples - number of samples/pixel if multisampling, or zero
- * level - visual level, usually 0
- * visualCaveat - ala the GLX extension, usually GLX_NONE_EXT
- * Return; a new XMesaVisual or 0 if error.
- */
-extern XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
- XMesaVisualInfo visinfo,
- GLboolean rgb_flag,
- GLboolean alpha_flag,
- GLboolean db_flag,
- GLboolean stereo_flag,
- GLboolean ximage_flag,
- GLint depth_size,
- GLint stencil_size,
- GLint accum_red_size,
- GLint accum_green_size,
- GLint accum_blue_size,
- GLint accum_alpha_size,
- GLint num_samples,
- GLint level,
- GLint visualCaveat );
-
-/*
- * Destroy an XMesaVisual, but not the associated XVisualInfo.
- */
-extern void XMesaDestroyVisual( XMesaVisual v );
-
-
-
-/*
- * Create a new XMesaContext for rendering into an X11 window.
- *
- * Input: visual - an XMesaVisual
- * share_list - another XMesaContext with which to share display
- * lists or NULL if no sharing is wanted.
- * Return: an XMesaContext or NULL if error.
- */
-extern XMesaContext XMesaCreateContext( XMesaVisual v,
- XMesaContext share_list );
-
-
-/*
- * Destroy a rendering context as returned by XMesaCreateContext()
- */
-extern void XMesaDestroyContext( XMesaContext c );
-
-
-#ifdef XFree86Server
-/*
- * These are the extra routines required for integration with XFree86.
- * None of these routines should be user visible. -KEM
- */
-extern GLboolean XMesaForceCurrent( XMesaContext c );
-
-extern GLboolean XMesaLoseCurrent( XMesaContext c );
-
-extern GLboolean XMesaCopyContext( XMesaContext src,
- XMesaContext dst,
- GLuint mask );
-#endif /* XFree86Server */
-
-
-/*
- * Create an XMesaBuffer from an X window.
- */
-extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, XMesaWindow w );
-
-
-/*
- * Create an XMesaBuffer from an X pixmap.
- */
-extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v,
- XMesaPixmap p,
- XMesaColormap cmap );
-
-
-/*
- * Destroy an XMesaBuffer, but not the corresponding window or pixmap.
- */
-extern void XMesaDestroyBuffer( XMesaBuffer b );
-
-
-/*
- * Return the XMesaBuffer handle which corresponds to an X drawable, if any.
- *
- * New in Mesa 2.3.
- */
-extern XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy,
- XMesaDrawable d );
-
-
-
-/*
- * Bind a buffer to a context and make the context the current one.
- */
-extern GLboolean XMesaMakeCurrent( XMesaContext c,
- XMesaBuffer b );
-
-
-/*
- * Bind two buffers (read and draw) to a context and make the
- * context the current one.
- * New in Mesa 3.3
- */
-extern GLboolean XMesaMakeCurrent2( XMesaContext c,
- XMesaBuffer drawBuffer,
- XMesaBuffer readBuffer );
-
-
-/*
- * Unbind the current context from its buffer.
- */
-extern GLboolean XMesaUnbindContext( XMesaContext c );
-
-
-/*
- * Return a handle to the current context.
- */
-extern XMesaContext XMesaGetCurrentContext( void );
-
-
-/*
- * Return handle to the current (draw) buffer.
- */
-extern XMesaBuffer XMesaGetCurrentBuffer( void );
-
-
-/*
- * Return handle to the current read buffer.
- * New in Mesa 3.3
- */
-extern XMesaBuffer XMesaGetCurrentReadBuffer( void );
-
-
-/*
- * Swap the front and back buffers for the given buffer. No action is
- * taken if the buffer is not double buffered.
- */
-extern void XMesaSwapBuffers( XMesaBuffer b );
-
-
-/*
- * Copy a sub-region of the back buffer to the front buffer.
- *
- * New in Mesa 2.6
- */
-extern void XMesaCopySubBuffer( XMesaBuffer b,
- int x,
- int y,
- int width,
- int height );
-
-
-/*
- * Return a pointer to the the Pixmap or XImage being used as the back
- * color buffer of an XMesaBuffer. This function is a way to get "under
- * the hood" of X/Mesa so one can manipulate the back buffer directly.
- * Input: b - the XMesaBuffer
- * Output: pixmap - pointer to back buffer's Pixmap, or 0
- * ximage - pointer to back buffer's XImage, or NULL
- * Return: GL_TRUE = context is double buffered
- * GL_FALSE = context is single buffered
- */
-extern GLboolean XMesaGetBackBuffer( XMesaBuffer b,
- XMesaPixmap *pixmap,
- XMesaImage **ximage );
-
-
-
-/*
- * Return the depth buffer associated with an XMesaBuffer.
- * Input: b - the XMesa buffer handle
- * Output: width, height - size of buffer in pixels
- * bytesPerValue - bytes per depth value (2 or 4)
- * buffer - pointer to depth buffer values
- * Return: GL_TRUE or GL_FALSE to indicate success or failure.
- *
- * New in Mesa 2.4.
- */
-extern GLboolean XMesaGetDepthBuffer( XMesaBuffer b,
- GLint *width,
- GLint *height,
- GLint *bytesPerValue,
- void **buffer );
-
-
-
-/*
- * Flush/sync a context
- */
-extern void XMesaFlush( XMesaContext c );
-
-
-
-/*
- * Get an X/Mesa-specific string.
- * Input: name - either XMESA_VERSION or XMESA_EXTENSIONS
- */
-extern const char *XMesaGetString( XMesaContext c, int name );
-
-
-
-/*
- * Scan for XMesaBuffers whose window/pixmap has been destroyed, then free
- * any memory used by that buffer.
- *
- * New in Mesa 2.3.
- */
-extern void XMesaGarbageCollect( void );
-
-
-
-/*
- * Return a dithered pixel value.
- * Input: c - XMesaContext
- * x, y - window coordinate
- * red, green, blue, alpha - color components in [0,1]
- * Return: pixel value
- *
- * New in Mesa 2.3.
- */
-extern unsigned long XMesaDitherColor( XMesaContext xmesa,
- GLint x,
- GLint y,
- GLfloat red,
- GLfloat green,
- GLfloat blue,
- GLfloat alpha );
-
-
-
-/*
- * 3Dfx Glide driver only!
- * Set 3Dfx/Glide full-screen or window rendering mode.
- * Input: mode - either XMESA_FX_WINDOW (window rendering mode) or
- * XMESA_FX_FULLSCREEN (full-screen rendering mode)
- * Return: GL_TRUE if success
- * GL_FALSE if invalid mode or if not using 3Dfx driver
- *
- * New in Mesa 2.6.
- */
-extern GLboolean XMesaSetFXmode( GLint mode );
-
-
-
-/*
- * Reallocate the back/depth/stencil/accum/etc/ buffers associated with
- * buffer if its size has changed.
- *
- * New in Mesa 4.0.2
- */
-extern void XMesaResizeBuffers( XMesaBuffer b );
-
-
-
-/*
- * Create a pbuffer.
- * New in Mesa 4.1
- */
-extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
- unsigned int width, unsigned int height);
-
-
-
-/*
- * Texture from Pixmap
- * New in Mesa 7.1
- */
-extern void
-XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer,
- const int *attrib_list);
-
-extern void
-XMesaReleaseTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer);
-
-
-extern XMesaBuffer
-XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p,
- XMesaColormap cmap,
- int format, int target, int mipmap);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/include/GL/xmesa_x.h b/include/GL/xmesa_x.h
deleted file mode 100644
index 865bab4313..0000000000
--- a/include/GL/xmesa_x.h
+++ /dev/null
@@ -1,86 +0,0 @@
-
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin
- *
- * When we're building the XMesa driver for stand-alone Mesa we
- * include this file when building the xm_*.c files.
- * We need to define some types and macros differently when building
- * in the Xserver vs. stand-alone Mesa.
- */
-
-#ifndef _XMESA_X_H_
-#define _XMESA_X_H_
-
-typedef Display XMesaDisplay;
-typedef Pixmap XMesaPixmap;
-typedef Colormap XMesaColormap;
-typedef Drawable XMesaDrawable;
-typedef Window XMesaWindow;
-typedef GC XMesaGC;
-typedef XVisualInfo *XMesaVisualInfo;
-typedef XImage XMesaImage;
-typedef XPoint XMesaPoint;
-typedef XColor XMesaColor;
-
-#define XMesaDestroyImage XDestroyImage
-
-#define XMesaPutPixel XPutPixel
-#define XMesaGetPixel XGetPixel
-
-#define XMesaSetForeground XSetForeground
-#define XMesaSetBackground XSetBackground
-#define XMesaSetPlaneMask XSetPlaneMask
-#define XMesaSetFunction XSetFunction
-#define XMesaSetFillStyle XSetFillStyle
-#define XMesaSetTile XSetTile
-
-#define XMesaDrawPoint XDrawPoint
-#define XMesaDrawPoints XDrawPoints
-#define XMesaDrawLine XDrawLine
-#define XMesaFillRectangle XFillRectangle
-#define XMesaGetImage XGetImage
-#define XMesaPutImage XPutImage
-#define XMesaCopyArea XCopyArea
-
-#define XMesaCreatePixmap XCreatePixmap
-#define XMesaFreePixmap XFreePixmap
-#define XMesaFreeGC XFreeGC
-
-#define GET_COLORMAP_SIZE(__v) __v->visinfo->colormap_size
-#define GET_REDMASK(__v) __v->mesa_visual.redMask
-#define GET_GREENMASK(__v) __v->mesa_visual.greenMask
-#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
-#define GET_VISUAL_DEPTH(__v) __v->visinfo->depth
-#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->mesa_visual.screen)
-#define CHECK_BYTE_ORDER(__v) host_byte_order()==ImageByteOrder(__v->display)
-#define CHECK_FOR_HPCR(__v) XInternAtom(__v->display, "_HP_RGB_SMOOTH_MAP_LIST", True)
-
-#endif
diff --git a/include/GL/xmesa_xf86.h b/include/GL/xmesa_xf86.h
deleted file mode 100644
index 10f93c3ab6..0000000000
--- a/include/GL/xmesa_xf86.h
+++ /dev/null
@@ -1,198 +0,0 @@
-
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin
- *
- * When we're building the XMesa driver for use in the X server (as the
- * indirect render) we include this file when building the xm_*.c files.
- * We need to define some types and macros differently when building
- * in the Xserver vs. stand-alone Mesa.
- */
-
-#ifndef _XMESA_XF86_H_
-#define _XMESA_XF86_H_
-
-#include "GL/glxtokens.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "gcstruct.h"
-#include "servermd.h"
-
-
-typedef struct _XMesaImageRec {
- int width, height;
- char *data;
- int bytes_per_line; /* Padded to 32 bits */
- int bits_per_pixel;
-} XMesaImage;
-
-typedef ScreenRec XMesaDisplay;
-typedef PixmapPtr XMesaPixmap;
-typedef ColormapPtr XMesaColormap;
-typedef DrawablePtr XMesaDrawable;
-typedef WindowPtr XMesaWindow;
-typedef GCPtr XMesaGC;
-typedef VisualPtr XMesaVisualInfo;
-typedef DDXPointRec XMesaPoint;
-typedef xColorItem XMesaColor;
-
-#define XMesaSetGeneric(__d,__gc,__val,__mask) \
-do { \
- CARD32 __v[1]; \
- (void) __d; \
- __v[0] = __val; \
- dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
-} while (0)
-
-#define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
-do { \
- ChangeGCVal __v[1]; \
- (void) __d; \
- __v[0].ptr = __pval; \
- dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
-} while (0)
-
-#define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground)
-#define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground)
-#define XMesaSetPlaneMask(d,gc,v) XMesaSetGeneric(d,gc,v,GCPlaneMask)
-#define XMesaSetFunction(d,gc,v) XMesaSetGeneric(d,gc,v,GCFunction)
-#define XMesaSetFillStyle(d,gc,v) XMesaSetGeneric(d,gc,v,GCFillStyle)
-
-#define XMesaSetTile(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCTile)
-
-#define XMesaDrawPoint(__d,__b,__gc,__x,__y) \
-do { \
- XMesaPoint __p[1]; \
- (void) __d; \
- __p[0].x = __x; \
- __p[0].y = __y; \
- ValidateGC(__b, __gc); \
- (*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
-} while (0)
-
-#define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
-do { \
- (void) __d; \
- ValidateGC(__b, __gc); \
- (*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
-} while (0)
-
-#define XMesaDrawLine(__d, __b, __gc, __x0, __y0, __x1, __y1) \
-do { \
- XMesaPoint __p[2]; \
- (void) __d; \
- __p[0].x = __x0; \
- __p[0].y = __y0; \
- __p[1].x = __x1; \
- __p[1].y = __y1; \
- ValidateGC(__b, __gc); \
- (*gc->ops->PolyLines)(__b, __gc, CoordModeOrigin, 2, __p); \
-} while (0)
-
-#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
-do { \
- xRectangle __r[1]; \
- (void) __d; \
- ValidateGC((DrawablePtr)__b, __gc); \
- __r[0].x = __x; \
- __r[0].y = __y; \
- __r[0].width = __w; \
- __r[0].height = __h; \
- (*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
-} while (0)
-
-static _X_INLINE XMesaImage *XMesaGetImage(XMesaDisplay *dpy, PixmapPtr p, int x,
- int y, unsigned int width,
- unsigned int height,
- unsigned long plane_mask, int format)
-{
- XMesaImage *img = Xcalloc(sizeof(*img));
-
- img->width = p->drawable.width;
- img->height = p->drawable.height;
- img->bits_per_pixel = p->drawable.bitsPerPixel;
- img->bytes_per_line = PixmapBytePad(width, p->drawable.depth);
- img->data = malloc(height * img->bytes_per_line);
-
- /* Assumes: Images are always in ZPixmap format */
- (*p->drawable.pScreen->GetImage)(&p->drawable, x, y, width, height,
- plane_mask, ZPixmap, img->data);
-
- return img;
-}
-
-#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
-do { \
- /* Assumes: Images are always in ZPixmap format */ \
- (void) __d; \
- ASSERT(!__sx && !__sy); /* The SubImage case */ \
- ValidateGC(__b, __gc); \
- (*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
- __x, __y, __w, __h, 0, ZPixmap, \
- ((XMesaImage *)(__i))->data); \
-} while (0)
-
-#define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
-do { \
- (void) __d; \
- ValidateGC(__db, __gc); \
- (*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
- __sx, __sy, __w, __h, __x, __y); \
-} while (0)
-
-
-/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
-#ifdef CREATE_PIXMAP_USAGE_SCRATCH
-#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
- (*__d->CreatePixmap)(__d, __w, __h, __depth, 0)
-#else
-#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
- (*__d->CreatePixmap)(__d, __w, __h, __depth)
-#endif
-
-#define XMesaFreePixmap(__d,__b) \
- (*__d->DestroyPixmap)(__b)
-
-#define XMesaFreeGC(__d,__gc) \
-do { \
- (void) __d; \
- FreeScratchGC(__gc); \
-} while (0)
-
-#define GET_COLORMAP_SIZE(__v) __v->ColormapEntries
-#define GET_REDMASK(__v) __v->mesa_visual.redMask
-#define GET_GREENMASK(__v) __v->mesa_visual.greenMask
-#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
-#define GET_VISUAL_DEPTH(__v) __v->nplanes
-#define GET_BLACK_PIXEL(__v) __v->display->blackPixel
-#define CHECK_BYTE_ORDER(__v) GL_TRUE
-#define CHECK_FOR_HPCR(__v) GL_FALSE
-
-#endif
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 827d39f995..ea3585258d 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -42,7 +42,6 @@
#include "glxheader.h"
#include "glxapi.h"
-#include "GL/xmesa.h"
#include "main/context.h"
#include "main/config.h"
#include "main/macros.h"
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index c9009bad03..18aa8bcc09 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -63,7 +63,6 @@
#endif
#include "glxheader.h"
-#include "GL/xmesa.h"
#include "xmesaP.h"
#include "main/context.h"
#include "main/extensions.h"
diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c
index f104d44d05..7ad67bc34d 100644
--- a/src/mesa/drivers/x11/xm_buffer.c
+++ b/src/mesa/drivers/x11/xm_buffer.c
@@ -30,7 +30,6 @@
#include "glxheader.h"
-#include "GL/xmesa.h"
#include "xmesaP.h"
#include "main/imports.h"
#include "main/framebuffer.h"
diff --git a/src/mesa/drivers/x11/xmesa.h b/src/mesa/drivers/x11/xmesa.h
new file mode 100644
index 0000000000..98139af833
--- /dev/null
+++ b/src/mesa/drivers/x11/xmesa.h
@@ -0,0 +1,424 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * Mesa/X11 interface. This header file serves as the documentation for
+ * the Mesa/X11 interface functions.
+ *
+ * Note: this interface isn't intended for user programs. It's primarily
+ * just for implementing the pseudo-GLX interface.
+ */
+
+
+/* Sample Usage:
+
+In addition to the usual X calls to select a visual, create a colormap
+and create a window, you must do the following to use the X/Mesa interface:
+
+1. Call XMesaCreateVisual() to make an XMesaVisual from an XVisualInfo.
+
+2. Call XMesaCreateContext() to create an X/Mesa rendering context, given
+ the XMesaVisual.
+
+3. Call XMesaCreateWindowBuffer() to create an XMesaBuffer from an X window
+ and XMesaVisual.
+
+4. Call XMesaMakeCurrent() to bind the XMesaBuffer to an XMesaContext and
+ to make the context the current one.
+
+5. Make gl* calls to render your graphics.
+
+6. Use XMesaSwapBuffers() when double buffering to swap front/back buffers.
+
+7. Before the X window is destroyed, call XMesaDestroyBuffer().
+
+8. Before exiting, call XMesaDestroyVisual and XMesaDestroyContext.
+
+*/
+
+
+
+
+#ifndef XMESA_H
+#define XMESA_H
+
+#ifdef __VMS
+#include
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef XFree86Server
+#include "xmesa_xf86.h"
+#else
+#include
+#include
+#include "xmesa_x.h"
+#endif
+#include "GL/gl.h"
+
+#ifdef AMIWIN
+#include
+extern struct Library *XLibBase;
+#endif
+
+
+#define XMESA_MAJOR_VERSION 6
+#define XMESA_MINOR_VERSION 3
+
+
+
+/*
+ * Values passed to XMesaGetString:
+ */
+#define XMESA_VERSION 1
+#define XMESA_EXTENSIONS 2
+
+
+/*
+ * Values passed to XMesaSetFXmode:
+ */
+#define XMESA_FX_WINDOW 1
+#define XMESA_FX_FULLSCREEN 2
+
+
+
+typedef struct xmesa_context *XMesaContext;
+
+typedef struct xmesa_visual *XMesaVisual;
+
+typedef struct xmesa_buffer *XMesaBuffer;
+
+
+
+/*
+ * Create a new X/Mesa visual.
+ * Input: display - X11 display
+ * visinfo - an XVisualInfo pointer
+ * rgb_flag - GL_TRUE = RGB mode,
+ * GL_FALSE = color index mode
+ * alpha_flag - alpha buffer requested?
+ * db_flag - GL_TRUE = double-buffered,
+ * GL_FALSE = single buffered
+ * stereo_flag - stereo visual?
+ * ximage_flag - GL_TRUE = use an XImage for back buffer,
+ * GL_FALSE = use an off-screen pixmap for back buffer
+ * depth_size - requested bits/depth values, or zero
+ * stencil_size - requested bits/stencil values, or zero
+ * accum_red_size - requested bits/red accum values, or zero
+ * accum_green_size - requested bits/green accum values, or zero
+ * accum_blue_size - requested bits/blue accum values, or zero
+ * accum_alpha_size - requested bits/alpha accum values, or zero
+ * num_samples - number of samples/pixel if multisampling, or zero
+ * level - visual level, usually 0
+ * visualCaveat - ala the GLX extension, usually GLX_NONE_EXT
+ * Return; a new XMesaVisual or 0 if error.
+ */
+extern XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
+ XMesaVisualInfo visinfo,
+ GLboolean rgb_flag,
+ GLboolean alpha_flag,
+ GLboolean db_flag,
+ GLboolean stereo_flag,
+ GLboolean ximage_flag,
+ GLint depth_size,
+ GLint stencil_size,
+ GLint accum_red_size,
+ GLint accum_green_size,
+ GLint accum_blue_size,
+ GLint accum_alpha_size,
+ GLint num_samples,
+ GLint level,
+ GLint visualCaveat );
+
+/*
+ * Destroy an XMesaVisual, but not the associated XVisualInfo.
+ */
+extern void XMesaDestroyVisual( XMesaVisual v );
+
+
+
+/*
+ * Create a new XMesaContext for rendering into an X11 window.
+ *
+ * Input: visual - an XMesaVisual
+ * share_list - another XMesaContext with which to share display
+ * lists or NULL if no sharing is wanted.
+ * Return: an XMesaContext or NULL if error.
+ */
+extern XMesaContext XMesaCreateContext( XMesaVisual v,
+ XMesaContext share_list );
+
+
+/*
+ * Destroy a rendering context as returned by XMesaCreateContext()
+ */
+extern void XMesaDestroyContext( XMesaContext c );
+
+
+#ifdef XFree86Server
+/*
+ * These are the extra routines required for integration with XFree86.
+ * None of these routines should be user visible. -KEM
+ */
+extern GLboolean XMesaForceCurrent( XMesaContext c );
+
+extern GLboolean XMesaLoseCurrent( XMesaContext c );
+
+extern GLboolean XMesaCopyContext( XMesaContext src,
+ XMesaContext dst,
+ GLuint mask );
+#endif /* XFree86Server */
+
+
+/*
+ * Create an XMesaBuffer from an X window.
+ */
+extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, XMesaWindow w );
+
+
+/*
+ * Create an XMesaBuffer from an X pixmap.
+ */
+extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v,
+ XMesaPixmap p,
+ XMesaColormap cmap );
+
+
+/*
+ * Destroy an XMesaBuffer, but not the corresponding window or pixmap.
+ */
+extern void XMesaDestroyBuffer( XMesaBuffer b );
+
+
+/*
+ * Return the XMesaBuffer handle which corresponds to an X drawable, if any.
+ *
+ * New in Mesa 2.3.
+ */
+extern XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy,
+ XMesaDrawable d );
+
+
+
+/*
+ * Bind a buffer to a context and make the context the current one.
+ */
+extern GLboolean XMesaMakeCurrent( XMesaContext c,
+ XMesaBuffer b );
+
+
+/*
+ * Bind two buffers (read and draw) to a context and make the
+ * context the current one.
+ * New in Mesa 3.3
+ */
+extern GLboolean XMesaMakeCurrent2( XMesaContext c,
+ XMesaBuffer drawBuffer,
+ XMesaBuffer readBuffer );
+
+
+/*
+ * Unbind the current context from its buffer.
+ */
+extern GLboolean XMesaUnbindContext( XMesaContext c );
+
+
+/*
+ * Return a handle to the current context.
+ */
+extern XMesaContext XMesaGetCurrentContext( void );
+
+
+/*
+ * Return handle to the current (draw) buffer.
+ */
+extern XMesaBuffer XMesaGetCurrentBuffer( void );
+
+
+/*
+ * Return handle to the current read buffer.
+ * New in Mesa 3.3
+ */
+extern XMesaBuffer XMesaGetCurrentReadBuffer( void );
+
+
+/*
+ * Swap the front and back buffers for the given buffer. No action is
+ * taken if the buffer is not double buffered.
+ */
+extern void XMesaSwapBuffers( XMesaBuffer b );
+
+
+/*
+ * Copy a sub-region of the back buffer to the front buffer.
+ *
+ * New in Mesa 2.6
+ */
+extern void XMesaCopySubBuffer( XMesaBuffer b,
+ int x,
+ int y,
+ int width,
+ int height );
+
+
+/*
+ * Return a pointer to the the Pixmap or XImage being used as the back
+ * color buffer of an XMesaBuffer. This function is a way to get "under
+ * the hood" of X/Mesa so one can manipulate the back buffer directly.
+ * Input: b - the XMesaBuffer
+ * Output: pixmap - pointer to back buffer's Pixmap, or 0
+ * ximage - pointer to back buffer's XImage, or NULL
+ * Return: GL_TRUE = context is double buffered
+ * GL_FALSE = context is single buffered
+ */
+extern GLboolean XMesaGetBackBuffer( XMesaBuffer b,
+ XMesaPixmap *pixmap,
+ XMesaImage **ximage );
+
+
+
+/*
+ * Return the depth buffer associated with an XMesaBuffer.
+ * Input: b - the XMesa buffer handle
+ * Output: width, height - size of buffer in pixels
+ * bytesPerValue - bytes per depth value (2 or 4)
+ * buffer - pointer to depth buffer values
+ * Return: GL_TRUE or GL_FALSE to indicate success or failure.
+ *
+ * New in Mesa 2.4.
+ */
+extern GLboolean XMesaGetDepthBuffer( XMesaBuffer b,
+ GLint *width,
+ GLint *height,
+ GLint *bytesPerValue,
+ void **buffer );
+
+
+
+/*
+ * Flush/sync a context
+ */
+extern void XMesaFlush( XMesaContext c );
+
+
+
+/*
+ * Get an X/Mesa-specific string.
+ * Input: name - either XMESA_VERSION or XMESA_EXTENSIONS
+ */
+extern const char *XMesaGetString( XMesaContext c, int name );
+
+
+
+/*
+ * Scan for XMesaBuffers whose window/pixmap has been destroyed, then free
+ * any memory used by that buffer.
+ *
+ * New in Mesa 2.3.
+ */
+extern void XMesaGarbageCollect( void );
+
+
+
+/*
+ * Return a dithered pixel value.
+ * Input: c - XMesaContext
+ * x, y - window coordinate
+ * red, green, blue, alpha - color components in [0,1]
+ * Return: pixel value
+ *
+ * New in Mesa 2.3.
+ */
+extern unsigned long XMesaDitherColor( XMesaContext xmesa,
+ GLint x,
+ GLint y,
+ GLfloat red,
+ GLfloat green,
+ GLfloat blue,
+ GLfloat alpha );
+
+
+
+/*
+ * 3Dfx Glide driver only!
+ * Set 3Dfx/Glide full-screen or window rendering mode.
+ * Input: mode - either XMESA_FX_WINDOW (window rendering mode) or
+ * XMESA_FX_FULLSCREEN (full-screen rendering mode)
+ * Return: GL_TRUE if success
+ * GL_FALSE if invalid mode or if not using 3Dfx driver
+ *
+ * New in Mesa 2.6.
+ */
+extern GLboolean XMesaSetFXmode( GLint mode );
+
+
+
+/*
+ * Reallocate the back/depth/stencil/accum/etc/ buffers associated with
+ * buffer if its size has changed.
+ *
+ * New in Mesa 4.0.2
+ */
+extern void XMesaResizeBuffers( XMesaBuffer b );
+
+
+
+/*
+ * Create a pbuffer.
+ * New in Mesa 4.1
+ */
+extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
+ unsigned int width, unsigned int height);
+
+
+
+/*
+ * Texture from Pixmap
+ * New in Mesa 7.1
+ */
+extern void
+XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer,
+ const int *attrib_list);
+
+extern void
+XMesaReleaseTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer);
+
+
+extern XMesaBuffer
+XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p,
+ XMesaColormap cmap,
+ int format, int target, int mipmap);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index 98867ac710..6a6c9ef600 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -27,7 +27,7 @@
#define XMESAP_H
-#include "GL/xmesa.h"
+#include "xmesa.h"
#include "main/mtypes.h"
#if defined(FX)
#include "GL/fxmesa.h"
diff --git a/src/mesa/drivers/x11/xmesa_x.h b/src/mesa/drivers/x11/xmesa_x.h
new file mode 100644
index 0000000000..865bab4313
--- /dev/null
+++ b/src/mesa/drivers/x11/xmesa_x.h
@@ -0,0 +1,86 @@
+
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin
+ *
+ * When we're building the XMesa driver for stand-alone Mesa we
+ * include this file when building the xm_*.c files.
+ * We need to define some types and macros differently when building
+ * in the Xserver vs. stand-alone Mesa.
+ */
+
+#ifndef _XMESA_X_H_
+#define _XMESA_X_H_
+
+typedef Display XMesaDisplay;
+typedef Pixmap XMesaPixmap;
+typedef Colormap XMesaColormap;
+typedef Drawable XMesaDrawable;
+typedef Window XMesaWindow;
+typedef GC XMesaGC;
+typedef XVisualInfo *XMesaVisualInfo;
+typedef XImage XMesaImage;
+typedef XPoint XMesaPoint;
+typedef XColor XMesaColor;
+
+#define XMesaDestroyImage XDestroyImage
+
+#define XMesaPutPixel XPutPixel
+#define XMesaGetPixel XGetPixel
+
+#define XMesaSetForeground XSetForeground
+#define XMesaSetBackground XSetBackground
+#define XMesaSetPlaneMask XSetPlaneMask
+#define XMesaSetFunction XSetFunction
+#define XMesaSetFillStyle XSetFillStyle
+#define XMesaSetTile XSetTile
+
+#define XMesaDrawPoint XDrawPoint
+#define XMesaDrawPoints XDrawPoints
+#define XMesaDrawLine XDrawLine
+#define XMesaFillRectangle XFillRectangle
+#define XMesaGetImage XGetImage
+#define XMesaPutImage XPutImage
+#define XMesaCopyArea XCopyArea
+
+#define XMesaCreatePixmap XCreatePixmap
+#define XMesaFreePixmap XFreePixmap
+#define XMesaFreeGC XFreeGC
+
+#define GET_COLORMAP_SIZE(__v) __v->visinfo->colormap_size
+#define GET_REDMASK(__v) __v->mesa_visual.redMask
+#define GET_GREENMASK(__v) __v->mesa_visual.greenMask
+#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
+#define GET_VISUAL_DEPTH(__v) __v->visinfo->depth
+#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->mesa_visual.screen)
+#define CHECK_BYTE_ORDER(__v) host_byte_order()==ImageByteOrder(__v->display)
+#define CHECK_FOR_HPCR(__v) XInternAtom(__v->display, "_HP_RGB_SMOOTH_MAP_LIST", True)
+
+#endif
diff --git a/src/mesa/drivers/x11/xmesa_xf86.h b/src/mesa/drivers/x11/xmesa_xf86.h
new file mode 100644
index 0000000000..10f93c3ab6
--- /dev/null
+++ b/src/mesa/drivers/x11/xmesa_xf86.h
@@ -0,0 +1,198 @@
+
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin
+ *
+ * When we're building the XMesa driver for use in the X server (as the
+ * indirect render) we include this file when building the xm_*.c files.
+ * We need to define some types and macros differently when building
+ * in the Xserver vs. stand-alone Mesa.
+ */
+
+#ifndef _XMESA_XF86_H_
+#define _XMESA_XF86_H_
+
+#include "GL/glxtokens.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "gcstruct.h"
+#include "servermd.h"
+
+
+typedef struct _XMesaImageRec {
+ int width, height;
+ char *data;
+ int bytes_per_line; /* Padded to 32 bits */
+ int bits_per_pixel;
+} XMesaImage;
+
+typedef ScreenRec XMesaDisplay;
+typedef PixmapPtr XMesaPixmap;
+typedef ColormapPtr XMesaColormap;
+typedef DrawablePtr XMesaDrawable;
+typedef WindowPtr XMesaWindow;
+typedef GCPtr XMesaGC;
+typedef VisualPtr XMesaVisualInfo;
+typedef DDXPointRec XMesaPoint;
+typedef xColorItem XMesaColor;
+
+#define XMesaSetGeneric(__d,__gc,__val,__mask) \
+do { \
+ CARD32 __v[1]; \
+ (void) __d; \
+ __v[0] = __val; \
+ dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
+} while (0)
+
+#define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
+do { \
+ ChangeGCVal __v[1]; \
+ (void) __d; \
+ __v[0].ptr = __pval; \
+ dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
+} while (0)
+
+#define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground)
+#define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground)
+#define XMesaSetPlaneMask(d,gc,v) XMesaSetGeneric(d,gc,v,GCPlaneMask)
+#define XMesaSetFunction(d,gc,v) XMesaSetGeneric(d,gc,v,GCFunction)
+#define XMesaSetFillStyle(d,gc,v) XMesaSetGeneric(d,gc,v,GCFillStyle)
+
+#define XMesaSetTile(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCTile)
+
+#define XMesaDrawPoint(__d,__b,__gc,__x,__y) \
+do { \
+ XMesaPoint __p[1]; \
+ (void) __d; \
+ __p[0].x = __x; \
+ __p[0].y = __y; \
+ ValidateGC(__b, __gc); \
+ (*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
+} while (0)
+
+#define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
+do { \
+ (void) __d; \
+ ValidateGC(__b, __gc); \
+ (*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
+} while (0)
+
+#define XMesaDrawLine(__d, __b, __gc, __x0, __y0, __x1, __y1) \
+do { \
+ XMesaPoint __p[2]; \
+ (void) __d; \
+ __p[0].x = __x0; \
+ __p[0].y = __y0; \
+ __p[1].x = __x1; \
+ __p[1].y = __y1; \
+ ValidateGC(__b, __gc); \
+ (*gc->ops->PolyLines)(__b, __gc, CoordModeOrigin, 2, __p); \
+} while (0)
+
+#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
+do { \
+ xRectangle __r[1]; \
+ (void) __d; \
+ ValidateGC((DrawablePtr)__b, __gc); \
+ __r[0].x = __x; \
+ __r[0].y = __y; \
+ __r[0].width = __w; \
+ __r[0].height = __h; \
+ (*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
+} while (0)
+
+static _X_INLINE XMesaImage *XMesaGetImage(XMesaDisplay *dpy, PixmapPtr p, int x,
+ int y, unsigned int width,
+ unsigned int height,
+ unsigned long plane_mask, int format)
+{
+ XMesaImage *img = Xcalloc(sizeof(*img));
+
+ img->width = p->drawable.width;
+ img->height = p->drawable.height;
+ img->bits_per_pixel = p->drawable.bitsPerPixel;
+ img->bytes_per_line = PixmapBytePad(width, p->drawable.depth);
+ img->data = malloc(height * img->bytes_per_line);
+
+ /* Assumes: Images are always in ZPixmap format */
+ (*p->drawable.pScreen->GetImage)(&p->drawable, x, y, width, height,
+ plane_mask, ZPixmap, img->data);
+
+ return img;
+}
+
+#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
+do { \
+ /* Assumes: Images are always in ZPixmap format */ \
+ (void) __d; \
+ ASSERT(!__sx && !__sy); /* The SubImage case */ \
+ ValidateGC(__b, __gc); \
+ (*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
+ __x, __y, __w, __h, 0, ZPixmap, \
+ ((XMesaImage *)(__i))->data); \
+} while (0)
+
+#define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
+do { \
+ (void) __d; \
+ ValidateGC(__db, __gc); \
+ (*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
+ __sx, __sy, __w, __h, __x, __y); \
+} while (0)
+
+
+/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
+#ifdef CREATE_PIXMAP_USAGE_SCRATCH
+#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
+ (*__d->CreatePixmap)(__d, __w, __h, __depth, 0)
+#else
+#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
+ (*__d->CreatePixmap)(__d, __w, __h, __depth)
+#endif
+
+#define XMesaFreePixmap(__d,__b) \
+ (*__d->DestroyPixmap)(__b)
+
+#define XMesaFreeGC(__d,__gc) \
+do { \
+ (void) __d; \
+ FreeScratchGC(__gc); \
+} while (0)
+
+#define GET_COLORMAP_SIZE(__v) __v->ColormapEntries
+#define GET_REDMASK(__v) __v->mesa_visual.redMask
+#define GET_GREENMASK(__v) __v->mesa_visual.greenMask
+#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
+#define GET_VISUAL_DEPTH(__v) __v->nplanes
+#define GET_BLACK_PIXEL(__v) __v->display->blackPixel
+#define CHECK_BYTE_ORDER(__v) GL_TRUE
+#define CHECK_FOR_HPCR(__v) GL_FALSE
+
+#endif
--
cgit v1.2.3
From d25cc16efa356a92f61f0b4836bcbd0b4cb606d2 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sat, 10 Jan 2009 12:00:27 -0700
Subject: mesa: remove the ancient include/GL/ugl*.h headers
---
include/GL/uglglutshapes.h | 45 -------------
include/GL/uglmesa.h | 155 ---------------------------------------------
2 files changed, 200 deletions(-)
delete mode 100644 include/GL/uglglutshapes.h
delete mode 100644 include/GL/uglmesa.h
diff --git a/include/GL/uglglutshapes.h b/include/GL/uglglutshapes.h
deleted file mode 100644
index 28192de2d5..0000000000
--- a/include/GL/uglglutshapes.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* uglglutshapes.h - Public header GLUT Shapes */
-
-/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */
-
-/* This program is freely distributable without licensing fees and is
- provided without guarantee or warrantee expressed or implied. This
- program is -not- in the public domain. */
-
-#ifndef GLUTSHAPES_H
-#define GLUTSHAPES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-
-void glutWireSphere (GLdouble radius, GLint slices, GLint stacks);
-void glutSolidSphere (GLdouble radius, GLint slices, GLint stacks);
-void glutWireCone (GLdouble base, GLdouble height,
- GLint slices, GLint stacks);
-void glutSolidCone (GLdouble base, GLdouble height,
- GLint slices, GLint stacks);
-void glutWireCube (GLdouble size);
-void glutSolidCube (GLdouble size);
-void glutWireTorus (GLdouble innerRadius, GLdouble outerRadius,
- GLint sides, GLint rings);
-void glutSolidTorus (GLdouble innerRadius, GLdouble outerRadius,
- GLint sides, GLint rings);
-void glutWireDodecahedron (void);
-void glutSolidDodecahedron (void);
-void glutWireOctahedron (void);
-void glutSolidOctahedron (void);
-void glutWireTetrahedron (void);
-void glutSolidTetrahedron (void);
-void glutWireIcosahedron (void);
-void glutSolidIcosahedron (void);
-void glutWireTeapot (GLdouble size);
-void glutSolidTeapot (GLdouble size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/GL/uglmesa.h b/include/GL/uglmesa.h
deleted file mode 100644
index 7ef5843504..0000000000
--- a/include/GL/uglmesa.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* uglmesa.h - Public header UGL/Mesa */
-
-/* Copyright (C) 2001 by Wind River Systems, Inc */
-
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * The MIT License
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Author:
- * Stephane Raimbault
- */
-
-#ifndef UGLMESA_H
-#define UGLMESA_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define UGL_MESA_MAJOR_VERSION 4
-#define UGL_MESA_MINOR_VERSION 0
-
-#include
-#include
-
-/*
- * Values for display mode of uglMesaCreateContext ()
- */
-
-/*
- * With these mask values, it's possible to test double buffer mode
- * with UGL_MESA_DOUBLE mask
- *
- * SINGLE 0000 0001
- * DOUBLE 0000 0110
- * - SOFT 0000 0010
- * - HARD 0000 0100
- * WINDML 0001 0000
- *
- *
- */
-#define UGL_MESA_SINGLE 0x01
-#define UGL_MESA_DOUBLE 0x06
-#define UGL_MESA_DOUBLE_SOFTWARE 0x02
-#define UGL_MESA_DOUBLE_HARDWARE 0x04
-
-#define UGL_MESA_WINDML_EXCLUSIVE 0x10
-
-#define UGL_MESA_FULLSCREEN_WIDTH 0x0
-#define UGL_MESA_FULLSCREEN_HEIGHT 0x0
-
-/*
- * uglMesaPixelStore() parameters:
- */
-
-#define UGL_MESA_ROW_LENGTH 0x20
-#define UGL_MESA_Y_UP 0x21
-
-/*
- * Accepted by uglMesaGetIntegerv:
- */
-
-#define UGL_MESA_LEFT_X 0x01
-#define UGL_MESA_TOP_Y 0x02
-#define UGL_MESA_WIDTH 0x03
-#define UGL_MESA_HEIGHT 0x04
-#define UGL_MESA_DISPLAY_WIDTH 0x05
-#define UGL_MESA_DISPLAY_HEIGHT 0x06
-#define UGL_MESA_COLOR_FORMAT 0x07
-#define UGL_MESA_COLOR_MODEL 0x08
-#define UGL_MESA_PIXEL_FORMAT 0x09
-#define UGL_MESA_TYPE 0x0A
-#define UGL_MESA_RGB 0x0B
-#define UGL_MESA_COLOR_INDEXED 0x0C
-#define UGL_MESA_SINGLE_BUFFER 0x0D
-#define UGL_MESA_DOUBLE_BUFFER 0x0E
-#define UGL_MESA_DOUBLE_BUFFER_SOFTWARE 0x0F
-#define UGL_MESA_DOUBLE_BUFFER_HARDWARE 0x10
-
-/*
- * typedefs
- */
-
-typedef struct uglMesaContext * UGL_MESA_CONTEXT;
-
-UGL_MESA_CONTEXT uglMesaCreateNewContext (GLenum mode,
- UGL_MESA_CONTEXT share_list);
-
-UGL_MESA_CONTEXT uglMesaCreateNewContextExt (GLenum mode,
- GLint depth_bits,
- GLint stencil_bits,
- GLint accum_red_bits,
- GLint accum_green_bits,
- GLint accum_blue_bits,
- GLint accum_alpha_bits,
- UGL_MESA_CONTEXT share_list);
-
-GLboolean uglMesaMakeCurrentContext (UGL_MESA_CONTEXT umc,
- GLsizei left, GLsizei top,
- GLsizei width, GLsizei height);
-
-GLboolean uglMesaMoveWindow (GLsizei dx, GLsizei dy);
-
-GLboolean uglMesaMoveToWindow (GLsizei left, GLsizei top);
-
-GLboolean uglMesaResizeWindow (GLsizei dw, GLsizei dh);
-
-GLboolean uglMesaResizeToWindow (GLsizei width, GLsizei height);
-
-void uglMesaDestroyContext (void);
-
-UGL_MESA_CONTEXT uglMesaGetCurrentContext (void);
-
-void uglMesaSwapBuffers (void);
-
-void uglMesaPixelStore (GLint pname, GLint value);
-
-void uglMesaGetIntegerv (GLint pname, GLint *value);
-
-GLboolean uglMesaGetDepthBuffer (GLint *width, GLint *height,
- GLint *bytesPerValue, void **buffer);
-
-GLboolean uglMesaGetColorBuffer (GLint *width, GLint *height,
- GLint *format, void **buffer);
-
-GLboolean uglMesaSetColor (GLubyte index, GLfloat red,
- GLfloat green, GLfloat blue);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
--
cgit v1.2.3
From f5979b0c159d1d3839caf86072639f5d96a5b0b5 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sat, 10 Jan 2009 12:01:40 -0700
Subject: mesa: deprecate the GL/fxmesa.h header
---
include/GL/fxmesa.h | 103 ------------------------------------------
src/mesa/drivers/x11/fxmesa.h | 103 ++++++++++++++++++++++++++++++++++++++++++
src/mesa/drivers/x11/xmesaP.h | 2 +-
3 files changed, 104 insertions(+), 104 deletions(-)
delete mode 100644 include/GL/fxmesa.h
create mode 100644 src/mesa/drivers/x11/fxmesa.h
diff --git a/include/GL/fxmesa.h b/include/GL/fxmesa.h
deleted file mode 100644
index f8e9661f9c..0000000000
--- a/include/GL/fxmesa.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- * Copyright (C) 1995-2001 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * FXMesa - 3Dfx Glide driver for Mesa. Contributed by David Bucciarelli
- *
- * NOTE: This version requires Glide3 (http://sourceforge.net/projects/glide)
- */
-
-
-#ifndef FXMESA_H
-#define FXMESA_H
-
-
-#include
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define FXMESA_MAJOR_VERSION 6
-#define FXMESA_MINOR_VERSION 3
-
-
-/*
- * Values for attribList parameter to fxMesaCreateContext():
- */
-#define FXMESA_NONE 0 /* to terminate attribList */
-#define FXMESA_DOUBLEBUFFER 10
-#define FXMESA_ALPHA_SIZE 11 /* followed by an integer */
-#define FXMESA_DEPTH_SIZE 12 /* followed by an integer */
-#define FXMESA_STENCIL_SIZE 13 /* followed by an integer */
-#define FXMESA_ACCUM_SIZE 14 /* followed by an integer */
-#define FXMESA_COLORDEPTH 20 /* followed by an integer */
-#define FXMESA_SHARE_CONTEXT 990099 /* keep in sync with xmesa1.c! */
-
-
-
-typedef struct tfxMesaContext *fxMesaContext;
-
-
-#if defined (__BEOS__)
-#pragma export on
-#endif
-
-
-GLAPI fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, GrScreenResolution_t,
- GrScreenRefresh_t,
- const GLint attribList[]);
-
-GLAPI fxMesaContext GLAPIENTRY fxMesaCreateBestContext(GLuint win,
- GLint width, GLint height,
- const GLint attribList[]);
-GLAPI void GLAPIENTRY fxMesaDestroyContext(fxMesaContext ctx);
-
-GLAPI GLint GLAPIENTRY fxMesaSelectCurrentBoard(int n);
-
-GLAPI void GLAPIENTRY fxMesaMakeCurrent(fxMesaContext ctx);
-
-GLAPI fxMesaContext GLAPIENTRY fxMesaGetCurrentContext(void);
-
-GLAPI void GLAPIENTRY fxMesaSwapBuffers(void);
-
-GLAPI void GLAPIENTRY fxMesaSetNearFar(GLfloat nearVal, GLfloat farVal);
-
-GLAPI void GLAPIENTRY fxMesaUpdateScreenSize(fxMesaContext ctx);
-
-GLAPI void GLAPIENTRY fxCloseHardware(void);
-
-GLAPI void GLAPIENTRY fxGetScreenGeometry (GLint *w, GLint *h);
-
-
-#if defined (__BEOS__)
-#pragma export off
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/src/mesa/drivers/x11/fxmesa.h b/src/mesa/drivers/x11/fxmesa.h
new file mode 100644
index 0000000000..f8e9661f9c
--- /dev/null
+++ b/src/mesa/drivers/x11/fxmesa.h
@@ -0,0 +1,103 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.0
+ * Copyright (C) 1995-2001 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+/*
+ * FXMesa - 3Dfx Glide driver for Mesa. Contributed by David Bucciarelli
+ *
+ * NOTE: This version requires Glide3 (http://sourceforge.net/projects/glide)
+ */
+
+
+#ifndef FXMESA_H
+#define FXMESA_H
+
+
+#include
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define FXMESA_MAJOR_VERSION 6
+#define FXMESA_MINOR_VERSION 3
+
+
+/*
+ * Values for attribList parameter to fxMesaCreateContext():
+ */
+#define FXMESA_NONE 0 /* to terminate attribList */
+#define FXMESA_DOUBLEBUFFER 10
+#define FXMESA_ALPHA_SIZE 11 /* followed by an integer */
+#define FXMESA_DEPTH_SIZE 12 /* followed by an integer */
+#define FXMESA_STENCIL_SIZE 13 /* followed by an integer */
+#define FXMESA_ACCUM_SIZE 14 /* followed by an integer */
+#define FXMESA_COLORDEPTH 20 /* followed by an integer */
+#define FXMESA_SHARE_CONTEXT 990099 /* keep in sync with xmesa1.c! */
+
+
+
+typedef struct tfxMesaContext *fxMesaContext;
+
+
+#if defined (__BEOS__)
+#pragma export on
+#endif
+
+
+GLAPI fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, GrScreenResolution_t,
+ GrScreenRefresh_t,
+ const GLint attribList[]);
+
+GLAPI fxMesaContext GLAPIENTRY fxMesaCreateBestContext(GLuint win,
+ GLint width, GLint height,
+ const GLint attribList[]);
+GLAPI void GLAPIENTRY fxMesaDestroyContext(fxMesaContext ctx);
+
+GLAPI GLint GLAPIENTRY fxMesaSelectCurrentBoard(int n);
+
+GLAPI void GLAPIENTRY fxMesaMakeCurrent(fxMesaContext ctx);
+
+GLAPI fxMesaContext GLAPIENTRY fxMesaGetCurrentContext(void);
+
+GLAPI void GLAPIENTRY fxMesaSwapBuffers(void);
+
+GLAPI void GLAPIENTRY fxMesaSetNearFar(GLfloat nearVal, GLfloat farVal);
+
+GLAPI void GLAPIENTRY fxMesaUpdateScreenSize(fxMesaContext ctx);
+
+GLAPI void GLAPIENTRY fxCloseHardware(void);
+
+GLAPI void GLAPIENTRY fxGetScreenGeometry (GLint *w, GLint *h);
+
+
+#if defined (__BEOS__)
+#pragma export off
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index 6a6c9ef600..65e747d7b9 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -30,7 +30,7 @@
#include "xmesa.h"
#include "main/mtypes.h"
#if defined(FX)
-#include "GL/fxmesa.h"
+#include "fxmesa.h"
#include "xm_glide.h"
#endif
#ifdef XFree86Server
--
cgit v1.2.3
From 287102ddcc72ae19f7e6b912205805c5e78771f7 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sat, 10 Jan 2009 12:04:39 -0700
Subject: mesa: deprecate GL/amesa.h header (allegro driver)
---
include/GL/amesa.h | 65 ----------------------------------------
src/mesa/drivers/allegro/amesa.c | 2 +-
src/mesa/drivers/allegro/amesa.h | 65 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 66 insertions(+), 66 deletions(-)
delete mode 100644 include/GL/amesa.h
create mode 100644 src/mesa/drivers/allegro/amesa.h
diff --git a/include/GL/amesa.h b/include/GL/amesa.h
deleted file mode 100644
index 852d34cf4f..0000000000
--- a/include/GL/amesa.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- *
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/* Allegro (DJGPP) driver by Bernhard Tschirren (bernie-t@geocities.com) */
-
-
-#ifndef AMESA_H
-#define AMESA_H
-
-
-#define AMESA_MAJOR_VERSION 3
-#define AMESA_MINOR_VERSION 3
-
-
-typedef struct amesa_visual *AMesaVisual;
-typedef struct amesa_buffer *AMesaBuffer;
-typedef struct amesa_context *AMesaContext;
-
-
-extern AMesaVisual AMesaCreateVisual(GLboolean dbFlag, GLint depth,
- GLint depthSize,
- GLint stencilSize,
- GLint accumSize);
-
-extern void AMesaDestroyVisual(AMesaVisual visual);
-
-extern AMesaBuffer AMesaCreateBuffer(AMesaVisual visual,
- GLint width, GLint height);
-
-extern void AMesaDestroyBuffer(AMesaBuffer buffer);
-
-
-extern AMesaContext AMesaCreateContext(AMesaVisual visual,
- AMesaContext sharelist);
-
-extern void AMesaDestroyContext(AMesaContext context);
-
-extern GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer);
-
-extern void AMesaSwapBuffers(AMesaBuffer buffer);
-
-
-#endif /* AMESA_H */
diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c
index ade6251848..a9d8f62f92 100644
--- a/src/mesa/drivers/allegro/amesa.c
+++ b/src/mesa/drivers/allegro/amesa.c
@@ -26,7 +26,7 @@
#include "main/imports.h"
#include "main/matrix.h"
#include "main/mtypes.h"
-#include "GL/amesa.h"
+#include "amesa.h"
struct amesa_visual
diff --git a/src/mesa/drivers/allegro/amesa.h b/src/mesa/drivers/allegro/amesa.h
new file mode 100644
index 0000000000..852d34cf4f
--- /dev/null
+++ b/src/mesa/drivers/allegro/amesa.h
@@ -0,0 +1,65 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.3
+ *
+ * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/* Allegro (DJGPP) driver by Bernhard Tschirren (bernie-t@geocities.com) */
+
+
+#ifndef AMESA_H
+#define AMESA_H
+
+
+#define AMESA_MAJOR_VERSION 3
+#define AMESA_MINOR_VERSION 3
+
+
+typedef struct amesa_visual *AMesaVisual;
+typedef struct amesa_buffer *AMesaBuffer;
+typedef struct amesa_context *AMesaContext;
+
+
+extern AMesaVisual AMesaCreateVisual(GLboolean dbFlag, GLint depth,
+ GLint depthSize,
+ GLint stencilSize,
+ GLint accumSize);
+
+extern void AMesaDestroyVisual(AMesaVisual visual);
+
+extern AMesaBuffer AMesaCreateBuffer(AMesaVisual visual,
+ GLint width, GLint height);
+
+extern void AMesaDestroyBuffer(AMesaBuffer buffer);
+
+
+extern AMesaContext AMesaCreateContext(AMesaVisual visual,
+ AMesaContext sharelist);
+
+extern void AMesaDestroyContext(AMesaContext context);
+
+extern GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer);
+
+extern void AMesaSwapBuffers(AMesaBuffer buffer);
+
+
+#endif /* AMESA_H */
--
cgit v1.2.3
From c3a00a728b15a13a33a38c8687ed6732c98d2260 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sat, 10 Jan 2009 12:06:29 -0700
Subject: mesa: remove deprecated headers from Makefile.am
---
include/GL/Makefile.am | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/include/GL/Makefile.am b/include/GL/Makefile.am
index 199bd5c8f3..ca528f606d 100644
--- a/include/GL/Makefile.am
+++ b/include/GL/Makefile.am
@@ -2,17 +2,12 @@
GLincludedir = $(includedir)/GL
-INC_FX = fxmesa.h
INC_GGI = ggimesa.h
INC_OSMESA = osmesa.h
INC_SVGA = svgamesa.h
-INC_X11 = glx.h glxext.h glx_mangle.h xmesa.h xmesa_x.h xmesa_xf86.h
+INC_X11 = glx.h glxext.h glx_mangle.h
INC_GLUT = glut.h glutf90.h
-if HAVE_FX
-sel_inc_fx = $(INC_FX)
-endif
-
if HAVE_GGI
sel_inc_ggi = $(INC_GGI)
endif
@@ -35,9 +30,9 @@ endif
EXTRA_HEADERS = amesa.h dosmesa.h foomesa.h glut_h.dja mesa_wgl.h mglmesa.h \
vms_x_fix.h wmesa.h \
- $(INC_FX) $(INC_GGI) $(INC_OSMESA) $(INC_SVGA) $(INC_X11) $(INC_GLUT)
+ $(INC_GGI) $(INC_OSMESA) $(INC_SVGA) $(INC_X11) $(INC_GLUT)
GLinclude_HEADERS = gl.h glext.h gl_mangle.h glu.h glu_mangle.h \
- $(sel_inc_fx) $(sel_inc_ggi) $(sel_inc_osmesa) $(sel_inc_svga) \
+ $(sel_inc_ggi) $(sel_inc_osmesa) $(sel_inc_svga) \
$(sel_inc_x11) $(sel_inc_glut)
include $(top_srcdir)/common_rules.make
--
cgit v1.2.3
From ef193c10e7b3f048abf5fce0d7dc4d72d94ba123 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sat, 10 Jan 2009 12:07:58 -0700
Subject: mesa: remove old GLView.h header for BeOS
---
include/GLView.h | 192 -------------------------------------------------------
1 file changed, 192 deletions(-)
delete mode 100644 include/GLView.h
diff --git a/include/GLView.h b/include/GLView.h
deleted file mode 100644
index 8d9d25bb1c..0000000000
--- a/include/GLView.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
-/
-/ File: GLView.h
-/
-/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
-/
-*******************************************************************************/
-
-#ifndef BGLVIEW_H
-#define BGLVIEW_H
-
-#include
-
-#define BGL_RGB 0
-#define BGL_INDEX 1
-#define BGL_SINGLE 0
-#define BGL_DOUBLE 2
-#define BGL_DIRECT 0
-#define BGL_INDIRECT 4
-#define BGL_ACCUM 8
-#define BGL_ALPHA 16
-#define BGL_DEPTH 32
-#define BGL_OVERLAY 64
-#define BGL_UNDERLAY 128
-#define BGL_STENCIL 512
-
-#ifdef __cplusplus
-
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-class BGLView : public BView {
-public:
-
- BGLView(BRect rect, char *name,
- ulong resizingMode, ulong mode,
- ulong options);
-virtual ~BGLView();
-
- void LockGL();
- void UnlockGL();
- void SwapBuffers();
- void SwapBuffers( bool vSync );
- BView * EmbeddedView();
- status_t CopyPixelsOut(BPoint source, BBitmap *dest);
- status_t CopyPixelsIn(BBitmap *source, BPoint dest);
-virtual void ErrorCallback(unsigned long errorCode); // Mesa's GLenum is uint where Be's ones was ulong!
-
-virtual void Draw(BRect updateRect);
-
-virtual void AttachedToWindow();
-virtual void AllAttached();
-virtual void DetachedFromWindow();
-virtual void AllDetached();
-
-virtual void FrameResized(float width, float height);
-virtual status_t Perform(perform_code d, void *arg);
-
- /* The public methods below, for the moment,
- are just pass-throughs to BView */
-
-virtual status_t Archive(BMessage *data, bool deep = true) const;
-
-virtual void MessageReceived(BMessage *msg);
-virtual void SetResizingMode(uint32 mode);
-
-virtual void Show();
-virtual void Hide();
-
-virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index,
- BMessage *specifier, int32 form,
- const char *property);
-virtual status_t GetSupportedSuites(BMessage *data);
-
-/* New public functions */
- void DirectConnected( direct_buffer_info *info );
- void EnableDirectMode( bool enabled );
-
- void * getGC() { return m_gc; }
-
-private:
-
-virtual void _ReservedGLView1();
-virtual void _ReservedGLView2();
-virtual void _ReservedGLView3();
-virtual void _ReservedGLView4();
-virtual void _ReservedGLView5();
-virtual void _ReservedGLView6();
-virtual void _ReservedGLView7();
-virtual void _ReservedGLView8();
-
- BGLView(const BGLView &);
- BGLView &operator=(const BGLView &);
-
- void dither_front();
- bool confirm_dither();
- void draw(BRect r);
-
- void * m_gc;
- uint32 m_options;
- uint32 m_ditherCount;
- BLocker m_drawLock;
- BLocker m_displayLock;
- void * m_clip_info;
- void * _Unused1;
-
- BBitmap * m_ditherMap;
- BRect m_bounds;
- int16 * m_errorBuffer[2];
- uint64 _reserved[8];
-
- /* Direct Window stuff */
-private:
- void drawScanline( int x1, int x2, int y, void *data );
-static void scanlineHandler(struct rasStateRec *state, GLint x1, GLint x2);
-
- void lock_draw();
- void unlock_draw();
- bool validateView();
-};
-
-
-
-class BGLScreen : public BWindowScreen {
-public:
- BGLScreen(char *name,
- ulong screenMode, ulong options,
- status_t *error, bool debug=false);
- ~BGLScreen();
-
- void LockGL();
- void UnlockGL();
- void SwapBuffers();
- virtual void ErrorCallback(GLenum errorCode);
-
- virtual void ScreenConnected(bool connected);
- virtual void FrameResized(float width, float height);
- virtual status_t Perform(perform_code d, void *arg);
-
- /* The public methods below, for the moment,
- are just pass-throughs to BWindowScreen */
-
- virtual status_t Archive(BMessage *data, bool deep = true) const;
- virtual void MessageReceived(BMessage *msg);
-
- virtual void Show();
- virtual void Hide();
-
- virtual BHandler *ResolveSpecifier(BMessage *msg,
- int32 index,
- BMessage *specifier,
- int32 form,
- const char *property);
- virtual status_t GetSupportedSuites(BMessage *data);
-
-private:
-
- virtual void _ReservedGLScreen1();
- virtual void _ReservedGLScreen2();
- virtual void _ReservedGLScreen3();
- virtual void _ReservedGLScreen4();
- virtual void _ReservedGLScreen5();
- virtual void _ReservedGLScreen6();
- virtual void _ReservedGLScreen7();
- virtual void _ReservedGLScreen8();
-
- BGLScreen(const BGLScreen &);
- BGLScreen &operator=(const BGLScreen &);
-
- void * m_gc;
- long m_options;
- BLocker m_drawLock;
-
- int32 m_colorSpace;
- uint32 m_screen_mode;
-
- uint64 _reserved[7];
-};
-
-#endif // __cplusplus
-
-#endif // BGLVIEW_H
-
-
-
-
-
--
cgit v1.2.3
From 834db8215362ca859ad4ef18441936238d1b6670 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sat, 10 Jan 2009 12:09:08 -0700
Subject: docs: document deprecated/removed headers/interfaces
---
docs/relnotes-7.3.html | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/docs/relnotes-7.3.html b/docs/relnotes-7.3.html
index c00e5fe2f8..c486614011 100644
--- a/docs/relnotes-7.3.html
+++ b/docs/relnotes-7.3.html
@@ -47,6 +47,11 @@ tbd
Changes
+
Deprecated the "XMesa" interface (include/GL/xmesa*.h files)
+
Deprecated the "FXMesa" interface (include/GL/fxmesa.h file)
+
Deprecated the "Allegro" interface (include/GL/amesa.h file)
+
Removed include/GL/uglmesa.h header
+
Removed include/GLView.h header for BeOS
--
cgit v1.2.3
From f1455ca5f411ee8f7d992682e3e9c55d82e75715 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sat, 10 Jan 2009 12:21:37 -0700
Subject: mesa: omit old headers from tarball
---
Makefile | 7 -------
1 file changed, 7 deletions(-)
diff --git a/Makefile b/Makefile
index dbe444d294..5a47375766 100644
--- a/Makefile
+++ b/Makefile
@@ -200,9 +200,7 @@ MAIN_FILES = \
$(DIRECTORY)/docs/RELNOTES* \
$(DIRECTORY)/docs/*.spec \
$(DIRECTORY)/include/GL/internal/glcore.h \
- $(DIRECTORY)/include/GL/amesa.h \
$(DIRECTORY)/include/GL/dmesa.h \
- $(DIRECTORY)/include/GL/fxmesa.h \
$(DIRECTORY)/include/GL/ggimesa.h \
$(DIRECTORY)/include/GL/gl.h \
$(DIRECTORY)/include/GL/glext.h \
@@ -217,13 +215,8 @@ MAIN_FILES = \
$(DIRECTORY)/include/GL/mglmesa.h \
$(DIRECTORY)/include/GL/osmesa.h \
$(DIRECTORY)/include/GL/svgamesa.h \
- $(DIRECTORY)/include/GL/ugl*.h \
$(DIRECTORY)/include/GL/vms_x_fix.h \
$(DIRECTORY)/include/GL/wmesa.h \
- $(DIRECTORY)/include/GL/xmesa.h \
- $(DIRECTORY)/include/GL/xmesa_x.h \
- $(DIRECTORY)/include/GL/xmesa_xf86.h \
- $(DIRECTORY)/include/GLView.h \
$(DIRECTORY)/src/Makefile \
$(DIRECTORY)/src/descrip.mms \
$(DIRECTORY)/src/mesa/Makefile* \
--
cgit v1.2.3
From 44557bf065b89abc45c24829c6ba7395925463e8 Mon Sep 17 00:00:00 2001
From: Brian
Date: Sat, 10 Jan 2009 16:32:32 -0700
Subject: mesa: require libdrm 2.4.3 in configure.ac
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 97cb298d39..d3a93645e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ AC_CONFIG_AUX_DIR([bin])
AC_CANONICAL_HOST
dnl Versions for external dependencies
-LIBDRM_REQUIRED=2.3.1
+LIBDRM_REQUIRED=2.4.3
DRI2PROTO_REQUIRED=1.99.3
dnl Check for progs
--
cgit v1.2.3
From 33ba88a0df9f414f3ea7fd35d1fedb059f220b88 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sun, 11 Jan 2009 13:23:44 -0700
Subject: cell: clean-up, re-indent, comments
---
src/gallium/drivers/cell/ppu/cell_gen_fragment.c | 234 ++++++++++++++---------
1 file changed, 139 insertions(+), 95 deletions(-)
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
index 2c64eb1bcc..e5486dc4c0 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
@@ -2,6 +2,7 @@
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
+ * Copyright 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -25,11 +26,10 @@
*
**************************************************************************/
-
-
/**
* Generate SPU per-fragment code (actually per-quad code).
* \author Brian Paul
+ * \author Bob Ellison
*/
@@ -237,39 +237,53 @@ gen_alpha_test(const struct pipe_depth_stencil_alpha_state *dsa,
spe_release_register(f, amask_reg);
}
-/* This pair of functions is used inline to allocate and deallocate
+
+/**
+ * This pair of functions is used inline to allocate and deallocate
* optional constant registers. Once a constant is discovered to be
* needed, we will likely need it again, so we don't want to deallocate
* it and have to allocate and load it again unnecessarily.
*/
-static inline void
-setup_optional_register(struct spe_function *f, boolean *is_already_set, unsigned int *r)
+static INLINE void
+setup_optional_register(struct spe_function *f,
+ boolean *is_already_set,
+ uint *r)
{
- if (*is_already_set) return;
+ if (*is_already_set)
+ return;
*r = spe_allocate_available_register(f);
*is_already_set = true;
}
-static inline void
-release_optional_register(struct spe_function *f, boolean *is_already_set, unsigned int r)
+static INLINE void
+release_optional_register(struct spe_function *f,
+ boolean *is_already_set,
+ uint r)
{
- if (!*is_already_set) return;
+ if (!*is_already_set)
+ return;
spe_release_register(f, r);
*is_already_set = false;
}
-static inline void
-setup_const_register(struct spe_function *f, boolean *is_already_set, unsigned int *r, float value)
+static INLINE void
+setup_const_register(struct spe_function *f,
+ boolean *is_already_set,
+ uint *r,
+ float value)
{
- if (*is_already_set) return;
+ if (*is_already_set)
+ return;
setup_optional_register(f, is_already_set, r);
spe_load_float(f, *r, value);
}
-static inline void
-release_const_register(struct spe_function *f, boolean *is_already_set, unsigned int r)
+static INLINE void
+release_const_register(struct spe_function *f,
+ boolean *is_already_set,
+ uint r)
{
- release_optional_register(f, is_already_set, r);
+ release_optional_register(f, is_already_set, r);
}
/**
@@ -1055,6 +1069,7 @@ gen_pack_colors(struct spe_function *f,
spe_release_register(f, ba_reg);
}
+
static void
gen_colormask(struct spe_function *f,
uint colormask,
@@ -1111,11 +1126,13 @@ gen_colormask(struct spe_function *f,
a_mask = 0;
}
- /* Get a temporary register to hold the mask that will be applied to the fragment */
+ /* Get a temporary register to hold the mask that will be applied
+ * to the fragment
+ */
int colormask_reg = spe_allocate_available_register(f);
- /* The actual mask we're going to use is an OR of the remaining R, G, B, and A
- * masks. Load the result value into our temporary register.
+ /* The actual mask we're going to use is an OR of the remaining R, G, B,
+ * and A masks. Load the result value into our temporary register.
*/
spe_load_uint(f, colormask_reg, r_mask | g_mask | b_mask | a_mask);
@@ -1135,7 +1152,9 @@ gen_colormask(struct spe_function *f,
spe_release_register(f, colormask_reg);
}
-/* This function is annoyingly similar to gen_depth_test(), above, except
+
+/**
+ * This function is annoyingly similar to gen_depth_test(), above, except
* that instead of comparing two varying values (i.e. fragment and buffer),
* we're comparing a varying value with a static value. As such, we have
* access to the Compare Immediate instructions where we don't in
@@ -1146,7 +1165,8 @@ gen_colormask(struct spe_function *f,
*
* The return value in the stencil_pass_reg is a bitmask of valid
* fragments that also passed the stencil test. The bitmask of valid
- * fragments that failed would be found in (fragment_mask_reg & ~stencil_pass_reg).
+ * fragments that failed would be found in
+ * (fragment_mask_reg & ~stencil_pass_reg).
*/
static void
gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
@@ -1154,8 +1174,9 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
unsigned int fragment_mask_reg, unsigned int fbS_reg,
unsigned int stencil_pass_reg)
{
- /* Generate code that puts the set of passing fragments into the stencil_pass_reg
- * register, taking into account whether each fragment was active to begin with.
+ /* Generate code that puts the set of passing fragments into the
+ * stencil_pass_reg register, taking into account whether each fragment
+ * was active to begin with.
*/
switch (state->func) {
case PIPE_FUNC_EQUAL:
@@ -1168,7 +1189,8 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
/* stencil_pass = fragment_mask & ((s&mask) == (reference&mask)) */
unsigned int tmp_masked_stencil = spe_allocate_available_register(f);
spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
- spe_compare_equal_uint(f, stencil_pass_reg, tmp_masked_stencil, state->value_mask & state->ref_value);
+ spe_compare_equal_uint(f, stencil_pass_reg, tmp_masked_stencil,
+ state->value_mask & state->ref_value);
spe_and(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
spe_release_register(f, tmp_masked_stencil);
}
@@ -1184,7 +1206,8 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
/* stencil_pass = fragment_mask & ~((s&mask) == (reference&mask)) */
unsigned int tmp_masked_stencil = spe_allocate_available_register(f);
spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
- spe_compare_equal_uint(f, stencil_pass_reg, tmp_masked_stencil, state->value_mask & state->ref_value);
+ spe_compare_equal_uint(f, stencil_pass_reg, tmp_masked_stencil,
+ state->value_mask & state->ref_value);
spe_andc(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
spe_release_register(f, tmp_masked_stencil);
}
@@ -1200,7 +1223,8 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
/* stencil_pass = fragment_mask & ((reference&mask) < (s & mask)) */
unsigned int tmp_masked_stencil = spe_allocate_available_register(f);
spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
- spe_compare_greater_uint(f, stencil_pass_reg, tmp_masked_stencil, state->value_mask & state->ref_value);
+ spe_compare_greater_uint(f, stencil_pass_reg, tmp_masked_stencil,
+ state->value_mask & state->ref_value);
spe_and(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
spe_release_register(f, tmp_masked_stencil);
}
@@ -1237,14 +1261,16 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
if (state->value_mask == stencil_max_value) {
/* stencil_pass = fragment_mask & (reference >= s)
* = fragment_mask & ~(s > reference) */
- spe_compare_greater_uint(f, stencil_pass_reg, fbS_reg, state->ref_value);
+ spe_compare_greater_uint(f, stencil_pass_reg, fbS_reg,
+ state->ref_value);
spe_andc(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
}
else {
/* stencil_pass = fragment_mask & ~((s&mask) > (reference&mask)) */
unsigned int tmp_masked_stencil = spe_allocate_available_register(f);
spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
- spe_compare_greater_uint(f, stencil_pass_reg, tmp_masked_stencil, state->value_mask & state->ref_value);
+ spe_compare_greater_uint(f, stencil_pass_reg, tmp_masked_stencil,
+ state->value_mask & state->ref_value);
spe_andc(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
spe_release_register(f, tmp_masked_stencil);
}
@@ -1302,9 +1328,12 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
* in the stencil buffer - in other words, it should be usable as a mask.
*/
static void
-gen_stencil_values(struct spe_function *f, unsigned int stencil_op,
- unsigned int stencil_ref_value, unsigned int stencil_max_value,
- unsigned int fbS_reg, unsigned int newS_reg)
+gen_stencil_values(struct spe_function *f,
+ unsigned int stencil_op,
+ unsigned int stencil_ref_value,
+ unsigned int stencil_max_value,
+ unsigned int fbS_reg,
+ unsigned int newS_reg)
{
/* The code below assumes that newS_reg and fbS_reg are not the same
* register; if they can be, the calculations below will have to use
@@ -1412,10 +1441,12 @@ gen_stencil_values(struct spe_function *f, unsigned int stencil_op,
* and released by the corresponding spe_release_register_set() call.
*/
static void
-gen_get_stencil_values(struct spe_function *f, const struct pipe_stencil_state *stencil,
+gen_get_stencil_values(struct spe_function *f,
+ const struct pipe_stencil_state *stencil,
const unsigned int depth_enabled,
unsigned int fbS_reg,
- unsigned int *fail_reg, unsigned int *zfail_reg,
+ unsigned int *fail_reg,
+ unsigned int *zfail_reg,
unsigned int *zpass_reg)
{
unsigned zfail_op;
@@ -1633,7 +1664,9 @@ gen_stencil_depth_test(struct spe_function *f,
* This function will allocate a variant number of registers that
* will be released as part of the register set.
*/
- spe_comment(f, 0, facing == CELL_FACING_FRONT ? "Computing front-facing stencil values" : "Computing back-facing stencil values");
+ spe_comment(f, 0, facing == CELL_FACING_FRONT
+ ? "Computing front-facing stencil values"
+ : "Computing back-facing stencil values");
gen_get_stencil_values(f, stencil, dsa->depth.enabled, fbS_reg,
&stencil_fail_values, &stencil_pass_depth_fail_values,
&stencil_pass_depth_pass_values);
@@ -1652,7 +1685,8 @@ gen_stencil_depth_test(struct spe_function *f,
if (dsa->depth.enabled) {
spe_comment(f, 0, "Running stencil depth test");
zmask_reg = spe_allocate_available_register(f);
- modified_buffers |= gen_depth_test(f, dsa, mask_reg, fragZ_reg, fbZ_reg, zmask_reg);
+ modified_buffers |= gen_depth_test(f, dsa, mask_reg, fragZ_reg,
+ fbZ_reg, zmask_reg);
}
if (need_to_calculate_stencil_values) {
@@ -1689,11 +1723,14 @@ gen_stencil_depth_test(struct spe_function *f,
* depth passing mask. Note that zmask_reg *must* have been
* set above if we're here.
*/
- unsigned int stencil_pass_depth_fail_mask = spe_allocate_available_register(f);
+ unsigned int stencil_pass_depth_fail_mask =
+ spe_allocate_available_register(f);
+
spe_comment(f, 0, "Loading stencil pass/depth fail values");
spe_andc(f, stencil_pass_depth_fail_mask, stencil_pass_reg, zmask_reg);
- spe_selb(f, newS_reg, newS_reg, stencil_pass_depth_fail_values, stencil_pass_depth_fail_mask);
+ spe_selb(f, newS_reg, newS_reg, stencil_pass_depth_fail_values,
+ stencil_pass_depth_fail_mask);
spe_release_register(f, stencil_pass_depth_fail_mask);
modified_buffers = true;
@@ -1782,7 +1819,9 @@ gen_stencil_depth_test(struct spe_function *f,
* the fragment ops appended.
*/
void
-cell_gen_fragment_function(struct cell_context *cell, const uint facing, struct spe_function *f)
+cell_gen_fragment_function(struct cell_context *cell,
+ const uint facing,
+ struct spe_function *f)
{
const struct pipe_depth_stencil_alpha_state *dsa = cell->depth_stencil;
const struct pipe_blend_state *blend = cell->blend;
@@ -1814,7 +1853,9 @@ cell_gen_fragment_function(struct cell_context *cell, const uint facing, struct
if (cell->debug_flags & CELL_DEBUG_ASM) {
spe_print_code(f, true);
spe_indent(f, 8);
- spe_comment(f, -4, facing == CELL_FACING_FRONT ? "Begin front-facing per-fragment ops": "Begin back-facing per-fragment ops");
+ spe_comment(f, -4, facing == CELL_FACING_FRONT
+ ? "Begin front-facing per-fragment ops"
+ : "Begin back-facing per-fragment ops");
}
spe_allocate_register(f, x_reg);
@@ -1868,7 +1909,7 @@ cell_gen_fragment_function(struct cell_context *cell, const uint facing, struct
boolean fbS_reg_set = false, fbZ_reg_set = false;
unsigned int fbS_reg, fbZ_reg = 0;
- spe_comment(f, 0, "Fetching Z/stencil quad from tile");
+ spe_comment(f, 0, "Fetch Z/stencil quad from tile");
/* fetch quad of depth/stencil values from tile at (x,y) */
/* Load: fbZS_reg = memory[depth_tile_reg + offset_reg] */
@@ -1888,73 +1929,73 @@ cell_gen_fragment_function(struct cell_context *cell, const uint facing, struct
* buffer must be maintained).
*/
switch(zs_format) {
+ case PIPE_FORMAT_S8Z24_UNORM: /* fall through */
+ case PIPE_FORMAT_X8Z24_UNORM:
+ /* Pull out both Z and stencil */
+ setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
+ setup_optional_register(f, &fbS_reg_set, &fbS_reg);
- case PIPE_FORMAT_S8Z24_UNORM: /* fall through */
- case PIPE_FORMAT_X8Z24_UNORM:
- /* Pull out both Z and stencil */
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
- setup_optional_register(f, &fbS_reg_set, &fbS_reg);
+ /* four 24-bit Z values in the low-order bits */
+ spe_and_uint(f, fbZ_reg, fbZS_reg, 0x00ffffff);
- /* four 24-bit Z values in the low-order bits */
- spe_and_uint(f, fbZ_reg, fbZS_reg, 0x00ffffff);
-
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 24-bit unsigned integer
- */
- spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
- spe_rotmi(f, fragZ_reg, fragZ_reg, -8);
+ /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
+ * to a 24-bit unsigned integer
+ */
+ spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
+ spe_rotmi(f, fragZ_reg, fragZ_reg, -8);
- /* four 8-bit stencil values in the high-order bits */
- spe_rotmi(f, fbS_reg, fbZS_reg, -24);
+ /* four 8-bit stencil values in the high-order bits */
+ spe_rotmi(f, fbS_reg, fbZS_reg, -24);
break;
- case PIPE_FORMAT_Z24S8_UNORM: /* fall through */
- case PIPE_FORMAT_Z24X8_UNORM:
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
- setup_optional_register(f, &fbS_reg_set, &fbS_reg);
+ case PIPE_FORMAT_Z24S8_UNORM: /* fall through */
+ case PIPE_FORMAT_Z24X8_UNORM:
+ setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
+ setup_optional_register(f, &fbS_reg_set, &fbS_reg);
+
+ /* shift by 8 to get the upper 24-bit values */
+ spe_rotmi(f, fbS_reg, fbZS_reg, -8);
+
+ /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
+ * to a 24-bit unsigned integer
+ */
+ spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
+ spe_rotmi(f, fragZ_reg, fragZ_reg, -8);
- /* shift by 8 to get the upper 24-bit values */
- spe_rotmi(f, fbS_reg, fbZS_reg, -8);
+ /* 8-bit stencil in the low-order bits - mask them out */
+ spe_and_uint(f, fbS_reg, fbZS_reg, 0x000000ff);
+ break;
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 24-bit unsigned integer
- */
- spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
- spe_rotmi(f, fragZ_reg, fragZ_reg, -8);
+ case PIPE_FORMAT_Z32_UNORM:
+ setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
+ /* Copy over 4 32-bit values */
+ spe_move(f, fbZ_reg, fbZS_reg);
- /* 8-bit stencil in the low-order bits - mask them out */
- spe_and_uint(f, fbS_reg, fbZS_reg, 0x000000ff);
+ /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
+ * to a 32-bit unsigned integer
+ */
+ spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
+ /* No stencil, so can't do anything there */
break;
- case PIPE_FORMAT_Z32_UNORM:
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
- /* Copy over 4 32-bit values */
- spe_move(f, fbZ_reg, fbZS_reg);
+ case PIPE_FORMAT_Z16_UNORM:
+ /* XXX Not sure this is correct, but it was here before, so we're
+ * going with it for now
+ */
+ setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
+ /* Copy over 4 32-bit values */
+ spe_move(f, fbZ_reg, fbZS_reg);
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 32-bit unsigned integer
- */
- spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
- /* No stencil, so can't do anything there */
+ /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
+ * to a 16-bit unsigned integer
+ */
+ spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
+ spe_rotmi(f, fragZ_reg, fragZ_reg, -16);
+ /* No stencil */
break;
- case PIPE_FORMAT_Z16_UNORM:
- /* XXX Not sure this is correct, but it was here before, so we're
- * going with it for now
- */
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
- /* Copy over 4 32-bit values */
- spe_move(f, fbZ_reg, fbZS_reg);
-
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 16-bit unsigned integer
- */
- spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
- spe_rotmi(f, fragZ_reg, fragZ_reg, -16);
- /* No stencil */
-
- default:
- ASSERT(0); /* invalid format */
+ default:
+ ASSERT(0); /* invalid format */
}
/* If stencil is enabled, use the stencil-specific code
@@ -1977,13 +2018,16 @@ cell_gen_fragment_function(struct cell_context *cell, const uint facing, struct
* gen_stencil_depth_test() function must ignore the
* fbZ_reg register if depth is not enabled.
*/
- write_depth_stencil = gen_stencil_depth_test(f, dsa, facing, mask_reg, fragZ_reg, fbZ_reg, fbS_reg);
+ write_depth_stencil = gen_stencil_depth_test(f, dsa, facing,
+ mask_reg, fragZ_reg,
+ fbZ_reg, fbS_reg);
}
else if (dsa->depth.enabled) {
int zmask_reg = spe_allocate_available_register(f);
ASSERT(fbZ_reg_set);
spe_comment(f, 0, "Perform depth test");
- write_depth_stencil = gen_depth_test(f, dsa, mask_reg, fragZ_reg, fbZ_reg, zmask_reg);
+ write_depth_stencil = gen_depth_test(f, dsa, mask_reg, fragZ_reg,
+ fbZ_reg, zmask_reg);
spe_release_register(f, zmask_reg);
}
else {
--
cgit v1.2.3
From 097da27f55b3c168a98e575132ae26d6cb121136 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sun, 11 Jan 2009 13:40:28 -0700
Subject: cell: move depth/stencil code into separate function
---
src/gallium/drivers/cell/ppu/cell_gen_fragment.c | 392 ++++++++++++-----------
1 file changed, 213 insertions(+), 179 deletions(-)
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
index e5486dc4c0..eb6ce8d2d5 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
@@ -1316,7 +1316,9 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
*/
}
-/* This function generates code that calculates a set of new stencil values
+
+/**
+ * This function generates code that calculates a set of new stencil values
* given the earlier values and the operation to apply. It does not
* apply any tests. It is intended to be called up to 3 times
* (for the stencil fail operation, for the stencil pass-z fail operation,
@@ -1426,7 +1428,8 @@ gen_stencil_values(struct spe_function *f,
}
-/* This function generates code to get all the necessary possible
+/**
+ * This function generates code to get all the necessary possible
* stencil values. For each of the output registers (fail_reg,
* zfail_reg, and zpass_reg), it either allocates a new register
* and calculates a new set of values based on the stencil operation,
@@ -1511,7 +1514,8 @@ gen_get_stencil_values(struct spe_function *f,
}
}
-/* Note that fbZ_reg may *not* be set on entry, if in fact
+/**
+ * Note that fbZ_reg may *not* be set on entry, if in fact
* the depth test is not enabled. This function must not use
* the register if depth is not enabled.
*/
@@ -1793,6 +1797,205 @@ gen_stencil_depth_test(struct spe_function *f,
}
+/**
+ * Generate depth and/or stencil test code.
+ * \param cell context
+ * \param dsa depth/stencil/alpha state
+ * \param f spe function to emit
+ * \param facing either CELL_FACING_FRONT or CELL_FACING_BACK
+ * \param mask_reg register containing the pixel alive/dead mask
+ * \param depth_tile_reg register containing address of z/stencil tile
+ * \param quad_offset_reg offset to quad from start of tile
+ * \param fragZ_reg register containg fragment Z values
+ */
+static void
+gen_depth_stencil(struct cell_context *cell,
+ const struct pipe_depth_stencil_alpha_state *dsa,
+ struct spe_function *f,
+ uint facing,
+ uint mask_reg,
+ uint depth_tile_reg,
+ uint quad_offset_reg,
+ uint fragZ_reg)
+
+{
+ const enum pipe_format zs_format = cell->framebuffer.zsbuf->format;
+ boolean write_depth_stencil;
+
+ /* We may or may not need to allocate a register for Z or stencil values */
+ boolean fbS_reg_set = false, fbZ_reg_set = false;
+ unsigned int fbS_reg, fbZ_reg = 0;
+
+ /* framebuffer's combined z/stencil values for quad */
+ int fbZS_reg = spe_allocate_available_register(f);
+
+
+ spe_comment(f, 0, "Fetch Z/stencil quad from tile");
+
+ /* fetch quad of depth/stencil values from tile at (x,y) */
+ /* Load: fbZS_reg = memory[depth_tile_reg + offset_reg] */
+ /* XXX Not sure this is allowed if we've only got a 16-bit Z buffer... */
+ spe_lqx(f, fbZS_reg, depth_tile_reg, quad_offset_reg);
+
+ /* From the Z/stencil buffer format, pull out the bits we need for
+ * Z and/or stencil. We'll also convert the incoming fragment Z
+ * value in fragZ_reg from a floating point value in [0.0..1.0] to
+ * an unsigned integer value with the appropriate resolution.
+ * Note that even if depth or stencil is *not* enabled, if it's
+ * present in the buffer, we pull it out and put it back later;
+ * otherwise, we can inadvertently destroy the contents of
+ * buffers we're not supposed to touch (e.g., if the user is
+ * clearing the depth buffer but not the stencil buffer, a
+ * quad of constant depth is drawn over the surface; the stencil
+ * buffer must be maintained).
+ */
+ switch(zs_format) {
+ case PIPE_FORMAT_S8Z24_UNORM: /* fall through */
+ case PIPE_FORMAT_X8Z24_UNORM:
+ /* Pull out both Z and stencil */
+ setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
+ setup_optional_register(f, &fbS_reg_set, &fbS_reg);
+
+ /* four 24-bit Z values in the low-order bits */
+ spe_and_uint(f, fbZ_reg, fbZS_reg, 0x00ffffff);
+
+ /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
+ * to a 24-bit unsigned integer
+ */
+ spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
+ spe_rotmi(f, fragZ_reg, fragZ_reg, -8);
+
+ /* four 8-bit stencil values in the high-order bits */
+ spe_rotmi(f, fbS_reg, fbZS_reg, -24);
+ break;
+
+ case PIPE_FORMAT_Z24S8_UNORM: /* fall through */
+ case PIPE_FORMAT_Z24X8_UNORM:
+ setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
+ setup_optional_register(f, &fbS_reg_set, &fbS_reg);
+
+ /* shift by 8 to get the upper 24-bit values */
+ spe_rotmi(f, fbS_reg, fbZS_reg, -8);
+
+ /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
+ * to a 24-bit unsigned integer
+ */
+ spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
+ spe_rotmi(f, fragZ_reg, fragZ_reg, -8);
+
+ /* 8-bit stencil in the low-order bits - mask them out */
+ spe_and_uint(f, fbS_reg, fbZS_reg, 0x000000ff);
+ break;
+
+ case PIPE_FORMAT_Z32_UNORM:
+ setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
+ /* Copy over 4 32-bit values */
+ spe_move(f, fbZ_reg, fbZS_reg);
+
+ /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
+ * to a 32-bit unsigned integer
+ */
+ spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
+ /* No stencil, so can't do anything there */
+ break;
+
+ case PIPE_FORMAT_Z16_UNORM:
+ /* XXX Not sure this is correct, but it was here before, so we're
+ * going with it for now
+ */
+ setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
+ /* Copy over 4 32-bit values */
+ spe_move(f, fbZ_reg, fbZS_reg);
+
+ /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
+ * to a 16-bit unsigned integer
+ */
+ spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
+ spe_rotmi(f, fragZ_reg, fragZ_reg, -16);
+ /* No stencil */
+ break;
+
+ default:
+ ASSERT(0); /* invalid format */
+ }
+
+ /* If stencil is enabled, use the stencil-specific code
+ * generator to generate both the stencil and depth (if needed)
+ * tests. Otherwise, if only depth is enabled, generate
+ * a quick depth test. The test generators themselves will
+ * report back whether the depth/stencil buffer has to be
+ * written back.
+ */
+ if (dsa->stencil[0].enabled) {
+ /* This will perform the stencil and depth tests, and update
+ * the mask_reg, fbZ_reg, and fbS_reg as required by the
+ * tests.
+ */
+ ASSERT(fbS_reg_set);
+ spe_comment(f, 0, "Perform stencil test");
+
+ /* Note that fbZ_reg may not be set on entry, if stenciling
+ * is enabled but there's no Z-buffer. The
+ * gen_stencil_depth_test() function must ignore the
+ * fbZ_reg register if depth is not enabled.
+ */
+ write_depth_stencil = gen_stencil_depth_test(f, dsa, facing,
+ mask_reg, fragZ_reg,
+ fbZ_reg, fbS_reg);
+ }
+ else if (dsa->depth.enabled) {
+ int zmask_reg = spe_allocate_available_register(f);
+ ASSERT(fbZ_reg_set);
+ spe_comment(f, 0, "Perform depth test");
+ write_depth_stencil = gen_depth_test(f, dsa, mask_reg, fragZ_reg,
+ fbZ_reg, zmask_reg);
+ spe_release_register(f, zmask_reg);
+ }
+ else {
+ write_depth_stencil = false;
+ }
+
+ if (write_depth_stencil) {
+ /* Merge latest Z and Stencil values into fbZS_reg.
+ * fbZ_reg has four Z vals in bits [23..0] or bits [15..0].
+ * fbS_reg has four 8-bit Z values in bits [7..0].
+ */
+ spe_comment(f, 0, "Store quad's depth/stencil values in tile");
+ if (zs_format == PIPE_FORMAT_S8Z24_UNORM ||
+ zs_format == PIPE_FORMAT_X8Z24_UNORM) {
+ spe_shli(f, fbS_reg, fbS_reg, 24); /* fbS = fbS << 24 */
+ spe_or(f, fbZS_reg, fbS_reg, fbZ_reg); /* fbZS = fbS | fbZ */
+ }
+ else if (zs_format == PIPE_FORMAT_Z24S8_UNORM ||
+ zs_format == PIPE_FORMAT_Z24X8_UNORM) {
+ spe_shli(f, fbZ_reg, fbZ_reg, 8); /* fbZ = fbZ << 8 */
+ spe_or(f, fbZS_reg, fbS_reg, fbZ_reg); /* fbZS = fbS | fbZ */
+ }
+ else if (zs_format == PIPE_FORMAT_Z32_UNORM) {
+ spe_move(f, fbZS_reg, fbZ_reg); /* fbZS = fbZ */
+ }
+ else if (zs_format == PIPE_FORMAT_Z16_UNORM) {
+ spe_move(f, fbZS_reg, fbZ_reg); /* fbZS = fbZ */
+ }
+ else if (zs_format == PIPE_FORMAT_S8_UNORM) {
+ ASSERT(0); /* XXX to do */
+ }
+ else {
+ ASSERT(0); /* bad zs_format */
+ }
+
+ /* Store: memory[depth_tile_reg + quad_offset_reg] = fbZS */
+ spe_stqx(f, fbZS_reg, depth_tile_reg, quad_offset_reg);
+ }
+
+ /* Don't need these any more */
+ release_optional_register(f, &fbZ_reg_set, fbZ_reg);
+ release_optional_register(f, &fbS_reg_set, fbS_reg);
+ spe_release_register(f, fbZS_reg);
+}
+
+
+
/**
* Generate SPE code to implement the fragment operations (alpha test,
* depth test, stencil test, blending, colormask, and final
@@ -1848,7 +2051,6 @@ cell_gen_fragment_function(struct cell_context *cell,
int quad_offset_reg;
int fbRGBA_reg; /**< framebuffer's RGBA colors for quad */
- int fbZS_reg; /**< framebuffer's combined z/stencil values for quad */
if (cell->debug_flags & CELL_DEBUG_ASM) {
spe_print_code(f, true);
@@ -1871,7 +2073,6 @@ cell_gen_fragment_function(struct cell_context *cell,
quad_offset_reg = spe_allocate_available_register(f);
fbRGBA_reg = spe_allocate_available_register(f);
- fbZS_reg = spe_allocate_available_register(f);
/* compute offset of quad from start of tile, in bytes */
{
@@ -1896,180 +2097,14 @@ cell_gen_fragment_function(struct cell_context *cell,
gen_alpha_test(dsa, f, mask_reg, fragA_reg);
}
- /* If we need the stencil buffers (because one- or two-sided stencil is
- * enabled) or the depth buffer (because the depth test is enabled),
- * go grab them. Note that if either one- or two-sided stencil is
- * enabled, dsa->stencil[0].enabled will be true.
- */
+ /* generate depth and/or stencil test code */
if (dsa->depth.enabled || dsa->stencil[0].enabled) {
- const enum pipe_format zs_format = cell->framebuffer.zsbuf->format;
- boolean write_depth_stencil;
-
- /* We may or may not need to allocate a register for Z or stencil values */
- boolean fbS_reg_set = false, fbZ_reg_set = false;
- unsigned int fbS_reg, fbZ_reg = 0;
-
- spe_comment(f, 0, "Fetch Z/stencil quad from tile");
-
- /* fetch quad of depth/stencil values from tile at (x,y) */
- /* Load: fbZS_reg = memory[depth_tile_reg + offset_reg] */
- /* XXX Not sure this is allowed if we've only got a 16-bit Z buffer... */
- spe_lqx(f, fbZS_reg, depth_tile_reg, quad_offset_reg);
-
- /* From the Z/stencil buffer format, pull out the bits we need for
- * Z and/or stencil. We'll also convert the incoming fragment Z
- * value in fragZ_reg from a floating point value in [0.0..1.0] to
- * an unsigned integer value with the appropriate resolution.
- * Note that even if depth or stencil is *not* enabled, if it's
- * present in the buffer, we pull it out and put it back later;
- * otherwise, we can inadvertently destroy the contents of
- * buffers we're not supposed to touch (e.g., if the user is
- * clearing the depth buffer but not the stencil buffer, a
- * quad of constant depth is drawn over the surface; the stencil
- * buffer must be maintained).
- */
- switch(zs_format) {
- case PIPE_FORMAT_S8Z24_UNORM: /* fall through */
- case PIPE_FORMAT_X8Z24_UNORM:
- /* Pull out both Z and stencil */
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
- setup_optional_register(f, &fbS_reg_set, &fbS_reg);
-
- /* four 24-bit Z values in the low-order bits */
- spe_and_uint(f, fbZ_reg, fbZS_reg, 0x00ffffff);
-
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 24-bit unsigned integer
- */
- spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
- spe_rotmi(f, fragZ_reg, fragZ_reg, -8);
-
- /* four 8-bit stencil values in the high-order bits */
- spe_rotmi(f, fbS_reg, fbZS_reg, -24);
- break;
-
- case PIPE_FORMAT_Z24S8_UNORM: /* fall through */
- case PIPE_FORMAT_Z24X8_UNORM:
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
- setup_optional_register(f, &fbS_reg_set, &fbS_reg);
-
- /* shift by 8 to get the upper 24-bit values */
- spe_rotmi(f, fbS_reg, fbZS_reg, -8);
-
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 24-bit unsigned integer
- */
- spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
- spe_rotmi(f, fragZ_reg, fragZ_reg, -8);
-
- /* 8-bit stencil in the low-order bits - mask them out */
- spe_and_uint(f, fbS_reg, fbZS_reg, 0x000000ff);
- break;
-
- case PIPE_FORMAT_Z32_UNORM:
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
- /* Copy over 4 32-bit values */
- spe_move(f, fbZ_reg, fbZS_reg);
-
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 32-bit unsigned integer
- */
- spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
- /* No stencil, so can't do anything there */
- break;
-
- case PIPE_FORMAT_Z16_UNORM:
- /* XXX Not sure this is correct, but it was here before, so we're
- * going with it for now
- */
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
- /* Copy over 4 32-bit values */
- spe_move(f, fbZ_reg, fbZS_reg);
-
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 16-bit unsigned integer
- */
- spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
- spe_rotmi(f, fragZ_reg, fragZ_reg, -16);
- /* No stencil */
- break;
-
- default:
- ASSERT(0); /* invalid format */
- }
-
- /* If stencil is enabled, use the stencil-specific code
- * generator to generate both the stencil and depth (if needed)
- * tests. Otherwise, if only depth is enabled, generate
- * a quick depth test. The test generators themselves will
- * report back whether the depth/stencil buffer has to be
- * written back.
- */
- if (dsa->stencil[0].enabled) {
- /* This will perform the stencil and depth tests, and update
- * the mask_reg, fbZ_reg, and fbS_reg as required by the
- * tests.
- */
- ASSERT(fbS_reg_set);
- spe_comment(f, 0, "Perform stencil test");
-
- /* Note that fbZ_reg may not be set on entry, if stenciling
- * is enabled but there's no Z-buffer. The
- * gen_stencil_depth_test() function must ignore the
- * fbZ_reg register if depth is not enabled.
- */
- write_depth_stencil = gen_stencil_depth_test(f, dsa, facing,
- mask_reg, fragZ_reg,
- fbZ_reg, fbS_reg);
- }
- else if (dsa->depth.enabled) {
- int zmask_reg = spe_allocate_available_register(f);
- ASSERT(fbZ_reg_set);
- spe_comment(f, 0, "Perform depth test");
- write_depth_stencil = gen_depth_test(f, dsa, mask_reg, fragZ_reg,
- fbZ_reg, zmask_reg);
- spe_release_register(f, zmask_reg);
- }
- else {
- write_depth_stencil = false;
- }
-
- if (write_depth_stencil) {
- /* Merge latest Z and Stencil values into fbZS_reg.
- * fbZ_reg has four Z vals in bits [23..0] or bits [15..0].
- * fbS_reg has four 8-bit Z values in bits [7..0].
- */
- spe_comment(f, 0, "Store quad's depth/stencil values in tile");
- if (zs_format == PIPE_FORMAT_S8Z24_UNORM ||
- zs_format == PIPE_FORMAT_X8Z24_UNORM) {
- spe_shli(f, fbS_reg, fbS_reg, 24); /* fbS = fbS << 24 */
- spe_or(f, fbZS_reg, fbS_reg, fbZ_reg); /* fbZS = fbS | fbZ */
- }
- else if (zs_format == PIPE_FORMAT_Z24S8_UNORM ||
- zs_format == PIPE_FORMAT_Z24X8_UNORM) {
- spe_shli(f, fbZ_reg, fbZ_reg, 8); /* fbZ = fbZ << 8 */
- spe_or(f, fbZS_reg, fbS_reg, fbZ_reg); /* fbZS = fbS | fbZ */
- }
- else if (zs_format == PIPE_FORMAT_Z32_UNORM) {
- spe_move(f, fbZS_reg, fbZ_reg); /* fbZS = fbZ */
- }
- else if (zs_format == PIPE_FORMAT_Z16_UNORM) {
- spe_move(f, fbZS_reg, fbZ_reg); /* fbZS = fbZ */
- }
- else if (zs_format == PIPE_FORMAT_S8_UNORM) {
- ASSERT(0); /* XXX to do */
- }
- else {
- ASSERT(0); /* bad zs_format */
- }
-
- /* Store: memory[depth_tile_reg + quad_offset_reg] = fbZS */
- spe_stqx(f, fbZS_reg, depth_tile_reg, quad_offset_reg);
- }
-
- /* Don't need these any more */
- release_optional_register(f, &fbZ_reg_set, fbZ_reg);
- release_optional_register(f, &fbS_reg_set, fbS_reg);
+ gen_depth_stencil(cell, dsa, f,
+ facing,
+ mask_reg,
+ depth_tile_reg,
+ quad_offset_reg,
+ fragZ_reg);
}
/* Get framebuffer quad/colors. We'll need these for blending,
@@ -2133,7 +2168,6 @@ cell_gen_fragment_function(struct cell_context *cell,
spe_bi(f, SPE_REG_RA, 0, 0); /* return from function call */
spe_release_register(f, fbRGBA_reg);
- spe_release_register(f, fbZS_reg);
spe_release_register(f, quad_offset_reg);
if (cell->debug_flags & CELL_DEBUG_ASM) {
--
cgit v1.2.3
From 91fac69537520b2427e4004203d92c092489de0d Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sun, 11 Jan 2009 13:52:58 -0700
Subject: cell: asst datatype clean-ups
---
src/gallium/drivers/cell/ppu/cell_gen_fragment.c | 148 ++++++++++++-----------
1 file changed, 75 insertions(+), 73 deletions(-)
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
index eb6ce8d2d5..611e17e5e8 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
@@ -55,7 +55,7 @@
* \param ifbZ_reg register containing integer frame buffer Z values (in/out)
* \param zmask_reg register containing result of Z test/comparison (out)
*
- * Returns true if the Z-buffer needs to be updated.
+ * Returns TRUE if the Z-buffer needs to be updated.
*/
static boolean
gen_depth_test(struct spe_function *f,
@@ -134,10 +134,10 @@ gen_depth_test(struct spe_function *f,
* framebufferZ = (ztest_passed ? fragmentZ : framebufferZ;
*/
spe_selb(f, ifbZ_reg, ifbZ_reg, ifragZ_reg, mask_reg);
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
@@ -247,29 +247,29 @@ gen_alpha_test(const struct pipe_depth_stencil_alpha_state *dsa,
static INLINE void
setup_optional_register(struct spe_function *f,
boolean *is_already_set,
- uint *r)
+ int *r)
{
if (*is_already_set)
return;
*r = spe_allocate_available_register(f);
- *is_already_set = true;
+ *is_already_set = TRUE;
}
static INLINE void
release_optional_register(struct spe_function *f,
boolean *is_already_set,
- uint r)
+ int r)
{
if (!*is_already_set)
return;
spe_release_register(f, r);
- *is_already_set = false;
+ *is_already_set = FALSE;
}
static INLINE void
setup_const_register(struct spe_function *f,
boolean *is_already_set,
- uint *r,
+ int *r,
float value)
{
if (*is_already_set)
@@ -281,7 +281,7 @@ setup_const_register(struct spe_function *f,
static INLINE void
release_const_register(struct spe_function *f,
boolean *is_already_set,
- uint r)
+ int r)
{
release_optional_register(f, is_already_set, r);
}
@@ -324,11 +324,11 @@ gen_blend(const struct pipe_blend_state *blend,
* if we do use them, make sure we only allocate them once by
* keeping a flag on each one.
*/
- boolean one_reg_set = false;
- unsigned int one_reg;
- boolean constR_reg_set = false, constG_reg_set = false,
- constB_reg_set = false, constA_reg_set = false;
- unsigned int constR_reg, constG_reg, constB_reg, constA_reg;
+ boolean one_reg_set = FALSE;
+ int one_reg;
+ boolean constR_reg_set = FALSE, constG_reg_set = FALSE,
+ constB_reg_set = FALSE, constA_reg_set = FALSE;
+ int constR_reg, constG_reg, constB_reg, constA_reg;
ASSERT(blend->blend_enable);
@@ -1082,10 +1082,10 @@ gen_colormask(struct spe_function *f,
* are packed according to the given color format, not
* necessarily RGBA...
*/
- unsigned int r_mask;
- unsigned int g_mask;
- unsigned int b_mask;
- unsigned int a_mask;
+ uint r_mask;
+ uint g_mask;
+ uint b_mask;
+ uint a_mask;
/* Calculate exactly where the bits for any particular color
* end up, so we can mask them correctly.
@@ -1169,10 +1169,12 @@ gen_colormask(struct spe_function *f,
* (fragment_mask_reg & ~stencil_pass_reg).
*/
static void
-gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
- unsigned int stencil_max_value,
- unsigned int fragment_mask_reg, unsigned int fbS_reg,
- unsigned int stencil_pass_reg)
+gen_stencil_test(struct spe_function *f,
+ const struct pipe_stencil_state *state,
+ uint stencil_max_value,
+ int fragment_mask_reg,
+ int fbS_reg,
+ int stencil_pass_reg)
{
/* Generate code that puts the set of passing fragments into the
* stencil_pass_reg register, taking into account whether each fragment
@@ -1187,7 +1189,7 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
}
else {
/* stencil_pass = fragment_mask & ((s&mask) == (reference&mask)) */
- unsigned int tmp_masked_stencil = spe_allocate_available_register(f);
+ uint tmp_masked_stencil = spe_allocate_available_register(f);
spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
spe_compare_equal_uint(f, stencil_pass_reg, tmp_masked_stencil,
state->value_mask & state->ref_value);
@@ -1204,7 +1206,7 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
}
else {
/* stencil_pass = fragment_mask & ~((s&mask) == (reference&mask)) */
- unsigned int tmp_masked_stencil = spe_allocate_available_register(f);
+ int tmp_masked_stencil = spe_allocate_available_register(f);
spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
spe_compare_equal_uint(f, stencil_pass_reg, tmp_masked_stencil,
state->value_mask & state->ref_value);
@@ -1221,7 +1223,7 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
}
else {
/* stencil_pass = fragment_mask & ((reference&mask) < (s & mask)) */
- unsigned int tmp_masked_stencil = spe_allocate_available_register(f);
+ int tmp_masked_stencil = spe_allocate_available_register(f);
spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
spe_compare_greater_uint(f, stencil_pass_reg, tmp_masked_stencil,
state->value_mask & state->ref_value);
@@ -1238,7 +1240,7 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
* comparing directly. Compare Logical Greater Than Word (clgt)
* treats its operands as unsigned - no sign extension.
*/
- unsigned int tmp_reg = spe_allocate_available_register(f);
+ int tmp_reg = spe_allocate_available_register(f);
spe_load_uint(f, tmp_reg, state->ref_value);
spe_clgt(f, stencil_pass_reg, tmp_reg, fbS_reg);
spe_and(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
@@ -1246,8 +1248,8 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
}
else {
/* stencil_pass = fragment_mask & ((reference&mask) > (s&mask)) */
- unsigned int tmp_reg = spe_allocate_available_register(f);
- unsigned int tmp_masked_stencil = spe_allocate_available_register(f);
+ int tmp_reg = spe_allocate_available_register(f);
+ int tmp_masked_stencil = spe_allocate_available_register(f);
spe_load_uint(f, tmp_reg, state->value_mask & state->ref_value);
spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
spe_clgt(f, stencil_pass_reg, tmp_reg, tmp_masked_stencil);
@@ -1267,7 +1269,7 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
}
else {
/* stencil_pass = fragment_mask & ~((s&mask) > (reference&mask)) */
- unsigned int tmp_masked_stencil = spe_allocate_available_register(f);
+ int tmp_masked_stencil = spe_allocate_available_register(f);
spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
spe_compare_greater_uint(f, stencil_pass_reg, tmp_masked_stencil,
state->value_mask & state->ref_value);
@@ -1281,7 +1283,7 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
/* stencil_pass = fragment_mask & (reference <= s) ]
* = fragment_mask & ~(reference > s) */
/* As above, we have to do this by loading a register */
- unsigned int tmp_reg = spe_allocate_available_register(f);
+ int tmp_reg = spe_allocate_available_register(f);
spe_load_uint(f, tmp_reg, state->ref_value);
spe_clgt(f, stencil_pass_reg, tmp_reg, fbS_reg);
spe_andc(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
@@ -1289,8 +1291,8 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
}
else {
/* stencil_pass = fragment_mask & ~((reference&mask) > (s&mask)) */
- unsigned int tmp_reg = spe_allocate_available_register(f);
- unsigned int tmp_masked_stencil = spe_allocate_available_register(f);
+ int tmp_reg = spe_allocate_available_register(f);
+ int tmp_masked_stencil = spe_allocate_available_register(f);
spe_load_uint(f, tmp_reg, state->ref_value & state->value_mask);
spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
spe_clgt(f, stencil_pass_reg, tmp_reg, tmp_masked_stencil);
@@ -1331,11 +1333,11 @@ gen_stencil_test(struct spe_function *f, const struct pipe_stencil_state *state,
*/
static void
gen_stencil_values(struct spe_function *f,
- unsigned int stencil_op,
- unsigned int stencil_ref_value,
- unsigned int stencil_max_value,
- unsigned int fbS_reg,
- unsigned int newS_reg)
+ uint stencil_op,
+ uint stencil_ref_value,
+ uint stencil_max_value,
+ int fbS_reg,
+ int newS_reg)
{
/* The code below assumes that newS_reg and fbS_reg are not the same
* register; if they can be, the calculations below will have to use
@@ -1377,7 +1379,7 @@ gen_stencil_values(struct spe_function *f,
case PIPE_STENCIL_OP_INCR: {
/* newS = (s == max ? max : s + 1) */
- unsigned int equals_reg = spe_allocate_available_register(f);
+ int equals_reg = spe_allocate_available_register(f);
spe_compare_equal_uint(f, equals_reg, fbS_reg, stencil_max_value);
/* Add Word Immediate computes rT = rA + 10-bit signed immediate */
@@ -1390,7 +1392,7 @@ gen_stencil_values(struct spe_function *f,
}
case PIPE_STENCIL_OP_DECR: {
/* newS = (s == 0 ? 0 : s - 1) */
- unsigned int equals_reg = spe_allocate_available_register(f);
+ int equals_reg = spe_allocate_available_register(f);
spe_compare_equal_uint(f, equals_reg, fbS_reg, 0);
/* Add Word Immediate with a (-1) value works */
@@ -1446,13 +1448,13 @@ gen_stencil_values(struct spe_function *f,
static void
gen_get_stencil_values(struct spe_function *f,
const struct pipe_stencil_state *stencil,
- const unsigned int depth_enabled,
- unsigned int fbS_reg,
- unsigned int *fail_reg,
- unsigned int *zfail_reg,
- unsigned int *zpass_reg)
+ const uint depth_enabled,
+ int fbS_reg,
+ int *fail_reg,
+ int *zfail_reg,
+ int *zpass_reg)
{
- unsigned zfail_op;
+ uint zfail_op;
/* Stenciling had better be enabled here */
ASSERT(stencil->enabled);
@@ -1529,7 +1531,7 @@ gen_stencil_depth_test(struct spe_function *f,
/* True if we've generated code that could require writeback to the
* depth and/or stencil buffers
*/
- boolean modified_buffers = false;
+ boolean modified_buffers = FALSE;
boolean need_to_calculate_stencil_values;
boolean need_to_writemask_stencil_values;
@@ -1539,11 +1541,11 @@ gen_stencil_depth_test(struct spe_function *f,
/* Registers. We may or may not actually allocate these, depending
* on whether the state values indicate that we need them.
*/
- unsigned int stencil_pass_reg, stencil_fail_reg;
- unsigned int stencil_fail_values, stencil_pass_depth_fail_values, stencil_pass_depth_pass_values;
- unsigned int stencil_writemask_reg;
- unsigned int zmask_reg;
- unsigned int newS_reg;
+ int stencil_pass_reg, stencil_fail_reg;
+ int stencil_fail_values, stencil_pass_depth_fail_values, stencil_pass_depth_pass_values;
+ int stencil_writemask_reg;
+ int zmask_reg;
+ int newS_reg;
/* Stenciling is quite complex: up to six different configurable stencil
* operations/calculations can be required (three each for front-facing
@@ -1590,27 +1592,27 @@ gen_stencil_depth_test(struct spe_function *f,
if (stencil->fail_op == PIPE_STENCIL_OP_KEEP &&
stencil->zfail_op == PIPE_STENCIL_OP_KEEP &&
stencil->zpass_op == PIPE_STENCIL_OP_KEEP) {
- need_to_calculate_stencil_values = false;
- need_to_writemask_stencil_values = false;
+ need_to_calculate_stencil_values = FALSE;
+ need_to_writemask_stencil_values = FALSE;
}
else if (stencil->write_mask == 0x0) {
/* All changes are writemasked out, so no need to calculate
* what those changes might be, and no need to write anything back.
*/
- need_to_calculate_stencil_values = false;
- need_to_writemask_stencil_values = false;
+ need_to_calculate_stencil_values = FALSE;
+ need_to_writemask_stencil_values = FALSE;
}
else if (stencil->write_mask == 0xff) {
/* Still trivial, but a little less so. We need to write the stencil
* values, but we don't need to mask them.
*/
- need_to_calculate_stencil_values = true;
- need_to_writemask_stencil_values = false;
+ need_to_calculate_stencil_values = TRUE;
+ need_to_writemask_stencil_values = FALSE;
}
else {
/* The general case: calculate, mask, and write */
- need_to_calculate_stencil_values = true;
- need_to_writemask_stencil_values = true;
+ need_to_calculate_stencil_values = TRUE;
+ need_to_writemask_stencil_values = TRUE;
/* While we're here, generate code that calculates what the
* writemask should be. If backface stenciling is enabled,
@@ -1713,7 +1715,7 @@ gen_stencil_depth_test(struct spe_function *f,
if (stencil_fail_values != fbS_reg) {
spe_comment(f, 0, "Loading stencil fail values");
spe_selb(f, newS_reg, newS_reg, stencil_fail_values, stencil_fail_reg);
- modified_buffers = true;
+ modified_buffers = TRUE;
}
/* Same for the stencil pass/depth fail values. If this calculation
@@ -1727,7 +1729,7 @@ gen_stencil_depth_test(struct spe_function *f,
* depth passing mask. Note that zmask_reg *must* have been
* set above if we're here.
*/
- unsigned int stencil_pass_depth_fail_mask =
+ uint stencil_pass_depth_fail_mask =
spe_allocate_available_register(f);
spe_comment(f, 0, "Loading stencil pass/depth fail values");
@@ -1737,7 +1739,7 @@ gen_stencil_depth_test(struct spe_function *f,
stencil_pass_depth_fail_mask);
spe_release_register(f, stencil_pass_depth_fail_mask);
- modified_buffers = true;
+ modified_buffers = TRUE;
}
/* Same for the stencil pass/depth pass mask. Note that we
@@ -1748,7 +1750,7 @@ gen_stencil_depth_test(struct spe_function *f,
*/
if (stencil_pass_depth_pass_values != fbS_reg) {
if (dsa->depth.enabled) {
- unsigned int stencil_pass_depth_pass_mask = spe_allocate_available_register(f);
+ uint stencil_pass_depth_pass_mask = spe_allocate_available_register(f);
/* We'll need a separate register */
spe_comment(f, 0, "Loading stencil pass/depth pass values");
spe_and(f, stencil_pass_depth_pass_mask, stencil_pass_reg, zmask_reg);
@@ -1760,7 +1762,7 @@ gen_stencil_depth_test(struct spe_function *f,
spe_comment(f, 0, "Loading stencil pass values");
spe_selb(f, newS_reg, newS_reg, stencil_pass_depth_pass_values, stencil_pass_reg);
}
- modified_buffers = true;
+ modified_buffers = TRUE;
}
/* Almost done. If we need to writemask, do it now, leaving the
@@ -1790,7 +1792,7 @@ gen_stencil_depth_test(struct spe_function *f,
spe_comment(f, 0, "Releasing stencil register set");
spe_release_register_set(f);
- /* Return true if we could have modified the stencil and/or
+ /* Return TRUE if we could have modified the stencil and/or
* depth buffers.
*/
return modified_buffers;
@@ -1813,18 +1815,18 @@ gen_depth_stencil(struct cell_context *cell,
const struct pipe_depth_stencil_alpha_state *dsa,
struct spe_function *f,
uint facing,
- uint mask_reg,
- uint depth_tile_reg,
- uint quad_offset_reg,
- uint fragZ_reg)
+ int mask_reg,
+ int depth_tile_reg,
+ int quad_offset_reg,
+ int fragZ_reg)
{
const enum pipe_format zs_format = cell->framebuffer.zsbuf->format;
boolean write_depth_stencil;
/* We may or may not need to allocate a register for Z or stencil values */
- boolean fbS_reg_set = false, fbZ_reg_set = false;
- unsigned int fbS_reg, fbZ_reg = 0;
+ boolean fbS_reg_set = FALSE, fbZ_reg_set = FALSE;
+ int fbS_reg, fbZ_reg = 0;
/* framebuffer's combined z/stencil values for quad */
int fbZS_reg = spe_allocate_available_register(f);
@@ -1952,7 +1954,7 @@ gen_depth_stencil(struct cell_context *cell,
spe_release_register(f, zmask_reg);
}
else {
- write_depth_stencil = false;
+ write_depth_stencil = FALSE;
}
if (write_depth_stencil) {
@@ -2053,7 +2055,7 @@ cell_gen_fragment_function(struct cell_context *cell,
int fbRGBA_reg; /**< framebuffer's RGBA colors for quad */
if (cell->debug_flags & CELL_DEBUG_ASM) {
- spe_print_code(f, true);
+ spe_print_code(f, TRUE);
spe_indent(f, 8);
spe_comment(f, -4, facing == CELL_FACING_FRONT
? "Begin front-facing per-fragment ops"
--
cgit v1.2.3
From c73b8c41313b4f1f425f0e56a8c1650b70c39fc8 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sun, 11 Jan 2009 14:06:39 -0700
Subject: cell: simplify the 'optional register' code
---
src/gallium/drivers/cell/ppu/cell_gen_fragment.c | 112 ++++++++++-------------
1 file changed, 50 insertions(+), 62 deletions(-)
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
index 611e17e5e8..4d28d4801f 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
@@ -246,44 +246,36 @@ gen_alpha_test(const struct pipe_depth_stencil_alpha_state *dsa,
*/
static INLINE void
setup_optional_register(struct spe_function *f,
- boolean *is_already_set,
int *r)
{
- if (*is_already_set)
- return;
- *r = spe_allocate_available_register(f);
- *is_already_set = TRUE;
+ if (*r < 0)
+ *r = spe_allocate_available_register(f);
}
static INLINE void
release_optional_register(struct spe_function *f,
- boolean *is_already_set,
int r)
{
- if (!*is_already_set)
- return;
- spe_release_register(f, r);
- *is_already_set = FALSE;
+ if (r >= 0)
+ spe_release_register(f, r);
}
static INLINE void
setup_const_register(struct spe_function *f,
- boolean *is_already_set,
int *r,
float value)
{
- if (*is_already_set)
+ if (*r >= 0)
return;
- setup_optional_register(f, is_already_set, r);
+ setup_optional_register(f, r);
spe_load_float(f, *r, value);
}
static INLINE void
release_const_register(struct spe_function *f,
- boolean *is_already_set,
int r)
{
- release_optional_register(f, is_already_set, r);
+ release_optional_register(f, r);
}
/**
@@ -324,11 +316,8 @@ gen_blend(const struct pipe_blend_state *blend,
* if we do use them, make sure we only allocate them once by
* keeping a flag on each one.
*/
- boolean one_reg_set = FALSE;
- int one_reg;
- boolean constR_reg_set = FALSE, constG_reg_set = FALSE,
- constB_reg_set = FALSE, constA_reg_set = FALSE;
- int constR_reg, constG_reg, constB_reg, constA_reg;
+ int one_reg = -1;
+ int constR_reg = -1, constG_reg = -1, constB_reg = -1, constA_reg = -1;
ASSERT(blend->blend_enable);
@@ -490,9 +479,9 @@ gen_blend(const struct pipe_blend_state *blend,
break;
case PIPE_BLENDFACTOR_CONST_COLOR:
/* We need the optional constant color registers */
- setup_const_register(f, &constR_reg_set, &constR_reg, blend_color->color[0]);
- setup_const_register(f, &constG_reg_set, &constG_reg, blend_color->color[1]);
- setup_const_register(f, &constB_reg_set, &constB_reg, blend_color->color[2]);
+ setup_const_register(f, &constR_reg, blend_color->color[0]);
+ setup_const_register(f, &constG_reg, blend_color->color[1]);
+ setup_const_register(f, &constB_reg, blend_color->color[2]);
/* now, factor = (Rc,Gc,Bc), so term = (R*Rc,G*Gc,B*Bc) */
spe_fm(f, term1R_reg, fragR_reg, constR_reg);
spe_fm(f, term1G_reg, fragG_reg, constG_reg);
@@ -500,7 +489,7 @@ gen_blend(const struct pipe_blend_state *blend,
break;
case PIPE_BLENDFACTOR_CONST_ALPHA:
/* we'll need the optional constant alpha register */
- setup_const_register(f, &constA_reg_set, &constA_reg, blend_color->color[3]);
+ setup_const_register(f, &constA_reg, blend_color->color[3]);
/* factor = (Ac,Ac,Ac), so term = (R*Ac,G*Ac,B*Ac) */
spe_fm(f, term1R_reg, fragR_reg, constA_reg);
spe_fm(f, term1G_reg, fragG_reg, constA_reg);
@@ -508,9 +497,9 @@ gen_blend(const struct pipe_blend_state *blend,
break;
case PIPE_BLENDFACTOR_INV_CONST_COLOR:
/* We need the optional constant color registers */
- setup_const_register(f, &constR_reg_set, &constR_reg, blend_color->color[0]);
- setup_const_register(f, &constG_reg_set, &constG_reg, blend_color->color[1]);
- setup_const_register(f, &constB_reg_set, &constB_reg, blend_color->color[2]);
+ setup_const_register(f, &constR_reg, blend_color->color[0]);
+ setup_const_register(f, &constG_reg, blend_color->color[1]);
+ setup_const_register(f, &constB_reg, blend_color->color[2]);
/* factor = (1-Rc,1-Gc,1-Bc), so term = (R*(1-Rc),G*(1-Gc),B*(1-Bc))
* or term = (R-R*Rc, G-G*Gc, B-B*Bc)
* fnms(a,b,c,d) computes a = d - b*c
@@ -521,9 +510,9 @@ gen_blend(const struct pipe_blend_state *blend,
break;
case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
/* We need the optional constant color registers */
- setup_const_register(f, &constR_reg_set, &constR_reg, blend_color->color[0]);
- setup_const_register(f, &constG_reg_set, &constG_reg, blend_color->color[1]);
- setup_const_register(f, &constB_reg_set, &constB_reg, blend_color->color[2]);
+ setup_const_register(f, &constR_reg, blend_color->color[0]);
+ setup_const_register(f, &constG_reg, blend_color->color[1]);
+ setup_const_register(f, &constB_reg, blend_color->color[2]);
/* factor = (1-Ac,1-Ac,1-Ac), so term = (R*(1-Ac),G*(1-Ac),B*(1-Ac))
* or term = (R-R*Ac,G-G*Ac,B-B*Ac)
* fnms(a,b,c,d) computes a = d - b*c
@@ -534,7 +523,7 @@ gen_blend(const struct pipe_blend_state *blend,
break;
case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
/* We'll need the optional {1,1,1,1} register */
- setup_const_register(f, &one_reg_set, &one_reg, 1.0f);
+ setup_const_register(f, &one_reg, 1.0f);
/* factor = (min(A,1-Afb),min(A,1-Afb),min(A,1-Afb)), so
* term = (R*min(A,1-Afb), G*min(A,1-Afb), B*min(A,1-Afb))
* We could expand the term (as a*min(b,c) == min(a*b,a*c)
@@ -612,7 +601,7 @@ gen_blend(const struct pipe_blend_state *blend,
case PIPE_BLENDFACTOR_CONST_ALPHA: /* fall through */
case PIPE_BLENDFACTOR_CONST_COLOR:
/* We need the optional constA_reg register */
- setup_const_register(f, &constA_reg_set, &constA_reg, blend_color->color[3]);
+ setup_const_register(f, &constA_reg, blend_color->color[3]);
/* factor = Ac, so term = A*Ac */
spe_fm(f, term1A_reg, fragA_reg, constA_reg);
break;
@@ -620,7 +609,7 @@ gen_blend(const struct pipe_blend_state *blend,
case PIPE_BLENDFACTOR_INV_CONST_ALPHA: /* fall through */
case PIPE_BLENDFACTOR_INV_CONST_COLOR:
/* We need the optional constA_reg register */
- setup_const_register(f, &constA_reg_set, &constA_reg, blend_color->color[3]);
+ setup_const_register(f, &constA_reg, blend_color->color[3]);
/* factor = 1-Ac, so term = A*(1-Ac) = A-A*Ac */
/* fnms(a,b,c,d) computes a = d - b*c */
spe_fnms(f, term1A_reg, fragA_reg, constA_reg, fragA_reg);
@@ -717,9 +706,9 @@ gen_blend(const struct pipe_blend_state *blend,
break;
case PIPE_BLENDFACTOR_CONST_COLOR:
/* We need the optional constant color registers */
- setup_const_register(f, &constR_reg_set, &constR_reg, blend_color->color[0]);
- setup_const_register(f, &constG_reg_set, &constG_reg, blend_color->color[1]);
- setup_const_register(f, &constB_reg_set, &constB_reg, blend_color->color[2]);
+ setup_const_register(f, &constR_reg, blend_color->color[0]);
+ setup_const_register(f, &constG_reg, blend_color->color[1]);
+ setup_const_register(f, &constB_reg, blend_color->color[2]);
/* now, factor = (Rc,Gc,Bc), so term = (Rfb*Rc,Gfb*Gc,Bfb*Bc) */
spe_fm(f, term2R_reg, fbR_reg, constR_reg);
spe_fm(f, term2G_reg, fbG_reg, constG_reg);
@@ -727,7 +716,7 @@ gen_blend(const struct pipe_blend_state *blend,
break;
case PIPE_BLENDFACTOR_CONST_ALPHA:
/* we'll need the optional constant alpha register */
- setup_const_register(f, &constA_reg_set, &constA_reg, blend_color->color[3]);
+ setup_const_register(f, &constA_reg, blend_color->color[3]);
/* factor = (Ac,Ac,Ac), so term = (Rfb*Ac,Gfb*Ac,Bfb*Ac) */
spe_fm(f, term2R_reg, fbR_reg, constA_reg);
spe_fm(f, term2G_reg, fbG_reg, constA_reg);
@@ -735,9 +724,9 @@ gen_blend(const struct pipe_blend_state *blend,
break;
case PIPE_BLENDFACTOR_INV_CONST_COLOR:
/* We need the optional constant color registers */
- setup_const_register(f, &constR_reg_set, &constR_reg, blend_color->color[0]);
- setup_const_register(f, &constG_reg_set, &constG_reg, blend_color->color[1]);
- setup_const_register(f, &constB_reg_set, &constB_reg, blend_color->color[2]);
+ setup_const_register(f, &constR_reg, blend_color->color[0]);
+ setup_const_register(f, &constG_reg, blend_color->color[1]);
+ setup_const_register(f, &constB_reg, blend_color->color[2]);
/* factor = (1-Rc,1-Gc,1-Bc), so term = (Rfb*(1-Rc),Gfb*(1-Gc),Bfb*(1-Bc))
* or term = (Rfb-Rfb*Rc, Gfb-Gfb*Gc, Bfb-Bfb*Bc)
* fnms(a,b,c,d) computes a = d - b*c
@@ -748,9 +737,9 @@ gen_blend(const struct pipe_blend_state *blend,
break;
case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
/* We need the optional constant color registers */
- setup_const_register(f, &constR_reg_set, &constR_reg, blend_color->color[0]);
- setup_const_register(f, &constG_reg_set, &constG_reg, blend_color->color[1]);
- setup_const_register(f, &constB_reg_set, &constB_reg, blend_color->color[2]);
+ setup_const_register(f, &constR_reg, blend_color->color[0]);
+ setup_const_register(f, &constG_reg, blend_color->color[1]);
+ setup_const_register(f, &constB_reg, blend_color->color[2]);
/* factor = (1-Ac,1-Ac,1-Ac), so term = (Rfb*(1-Ac),Gfb*(1-Ac),Bfb*(1-Ac))
* or term = (Rfb-Rfb*Ac,Gfb-Gfb*Ac,Bfb-Bfb*Ac)
* fnms(a,b,c,d) computes a = d - b*c
@@ -820,7 +809,7 @@ gen_blend(const struct pipe_blend_state *blend,
case PIPE_BLENDFACTOR_CONST_ALPHA: /* fall through */
case PIPE_BLENDFACTOR_CONST_COLOR:
/* We need the optional constA_reg register */
- setup_const_register(f, &constA_reg_set, &constA_reg, blend_color->color[3]);
+ setup_const_register(f, &constA_reg, blend_color->color[3]);
/* factor = Ac, so term = Afb*Ac */
spe_fm(f, term2A_reg, fbA_reg, constA_reg);
break;
@@ -828,7 +817,7 @@ gen_blend(const struct pipe_blend_state *blend,
case PIPE_BLENDFACTOR_INV_CONST_ALPHA: /* fall through */
case PIPE_BLENDFACTOR_INV_CONST_COLOR:
/* We need the optional constA_reg register */
- setup_const_register(f, &constA_reg_set, &constA_reg, blend_color->color[3]);
+ setup_const_register(f, &constA_reg, blend_color->color[3]);
/* factor = 1-Ac, so term = Afb*(1-Ac) = Afb-Afb*Ac */
/* fnms(a,b,c,d) computes a = d - b*c */
spe_fnms(f, term2A_reg, fbA_reg, constA_reg, fbA_reg);
@@ -924,11 +913,11 @@ gen_blend(const struct pipe_blend_state *blend,
spe_release_register(f, tmp_reg);
/* Free any optional registers that actually got used */
- release_const_register(f, &one_reg_set, one_reg);
- release_const_register(f, &constR_reg_set, constR_reg);
- release_const_register(f, &constG_reg_set, constG_reg);
- release_const_register(f, &constB_reg_set, constB_reg);
- release_const_register(f, &constA_reg_set, constA_reg);
+ release_const_register(f, one_reg);
+ release_const_register(f, constR_reg);
+ release_const_register(f, constG_reg);
+ release_const_register(f, constB_reg);
+ release_const_register(f, constA_reg);
}
@@ -1825,8 +1814,7 @@ gen_depth_stencil(struct cell_context *cell,
boolean write_depth_stencil;
/* We may or may not need to allocate a register for Z or stencil values */
- boolean fbS_reg_set = FALSE, fbZ_reg_set = FALSE;
- int fbS_reg, fbZ_reg = 0;
+ int fbS_reg = -1, fbZ_reg = -1;
/* framebuffer's combined z/stencil values for quad */
int fbZS_reg = spe_allocate_available_register(f);
@@ -1855,8 +1843,8 @@ gen_depth_stencil(struct cell_context *cell,
case PIPE_FORMAT_S8Z24_UNORM: /* fall through */
case PIPE_FORMAT_X8Z24_UNORM:
/* Pull out both Z and stencil */
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
- setup_optional_register(f, &fbS_reg_set, &fbS_reg);
+ setup_optional_register(f, &fbZ_reg);
+ setup_optional_register(f, &fbS_reg);
/* four 24-bit Z values in the low-order bits */
spe_and_uint(f, fbZ_reg, fbZS_reg, 0x00ffffff);
@@ -1873,8 +1861,8 @@ gen_depth_stencil(struct cell_context *cell,
case PIPE_FORMAT_Z24S8_UNORM: /* fall through */
case PIPE_FORMAT_Z24X8_UNORM:
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
- setup_optional_register(f, &fbS_reg_set, &fbS_reg);
+ setup_optional_register(f, &fbZ_reg);
+ setup_optional_register(f, &fbS_reg);
/* shift by 8 to get the upper 24-bit values */
spe_rotmi(f, fbS_reg, fbZS_reg, -8);
@@ -1890,7 +1878,7 @@ gen_depth_stencil(struct cell_context *cell,
break;
case PIPE_FORMAT_Z32_UNORM:
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
+ setup_optional_register(f, &fbZ_reg);
/* Copy over 4 32-bit values */
spe_move(f, fbZ_reg, fbZS_reg);
@@ -1905,7 +1893,7 @@ gen_depth_stencil(struct cell_context *cell,
/* XXX Not sure this is correct, but it was here before, so we're
* going with it for now
*/
- setup_optional_register(f, &fbZ_reg_set, &fbZ_reg);
+ setup_optional_register(f, &fbZ_reg);
/* Copy over 4 32-bit values */
spe_move(f, fbZ_reg, fbZS_reg);
@@ -1933,7 +1921,7 @@ gen_depth_stencil(struct cell_context *cell,
* the mask_reg, fbZ_reg, and fbS_reg as required by the
* tests.
*/
- ASSERT(fbS_reg_set);
+ ASSERT(fbS_reg >= 0);
spe_comment(f, 0, "Perform stencil test");
/* Note that fbZ_reg may not be set on entry, if stenciling
@@ -1947,7 +1935,7 @@ gen_depth_stencil(struct cell_context *cell,
}
else if (dsa->depth.enabled) {
int zmask_reg = spe_allocate_available_register(f);
- ASSERT(fbZ_reg_set);
+ ASSERT(fbZ_reg >= 0);
spe_comment(f, 0, "Perform depth test");
write_depth_stencil = gen_depth_test(f, dsa, mask_reg, fragZ_reg,
fbZ_reg, zmask_reg);
@@ -1991,8 +1979,8 @@ gen_depth_stencil(struct cell_context *cell,
}
/* Don't need these any more */
- release_optional_register(f, &fbZ_reg_set, fbZ_reg);
- release_optional_register(f, &fbS_reg_set, fbS_reg);
+ release_optional_register(f, fbZ_reg);
+ release_optional_register(f, fbS_reg);
spe_release_register(f, fbZS_reg);
}
--
cgit v1.2.3
From c4a782041b19cb4a08712384b19be25b79acba3c Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sun, 11 Jan 2009 14:22:00 -0700
Subject: cell: datatype clean-ups in SPE rtasm
---
src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c | 123 ++++++++++++++--------------
src/gallium/auxiliary/rtasm/rtasm_ppc_spe.h | 81 +++++++++---------
2 files changed, 99 insertions(+), 105 deletions(-)
diff --git a/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c b/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
index 071bc2015c..53a0e722cf 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
@@ -213,8 +213,8 @@ emit_instruction(struct spe_function *p, uint32_t inst_bits)
-static void emit_RR(struct spe_function *p, unsigned op, unsigned rT,
- unsigned rA, unsigned rB, const char *name)
+static void emit_RR(struct spe_function *p, unsigned op, int rT,
+ int rA, int rB, const char *name)
{
union spe_inst_RR inst;
inst.inst.op = op;
@@ -230,8 +230,8 @@ static void emit_RR(struct spe_function *p, unsigned op, unsigned rT,
}
-static void emit_RRR(struct spe_function *p, unsigned op, unsigned rT,
- unsigned rA, unsigned rB, unsigned rC, const char *name)
+static void emit_RRR(struct spe_function *p, unsigned op, int rT,
+ int rA, int rB, int rC, const char *name)
{
union spe_inst_RRR inst;
inst.inst.op = op;
@@ -248,8 +248,8 @@ static void emit_RRR(struct spe_function *p, unsigned op, unsigned rT,
}
-static void emit_RI7(struct spe_function *p, unsigned op, unsigned rT,
- unsigned rA, int imm, const char *name)
+static void emit_RI7(struct spe_function *p, unsigned op, int rT,
+ int rA, int imm, const char *name)
{
union spe_inst_RI7 inst;
inst.inst.op = op;
@@ -266,8 +266,8 @@ static void emit_RI7(struct spe_function *p, unsigned op, unsigned rT,
-static void emit_RI8(struct spe_function *p, unsigned op, unsigned rT,
- unsigned rA, int imm, const char *name)
+static void emit_RI8(struct spe_function *p, unsigned op, int rT,
+ int rA, int imm, const char *name)
{
union spe_inst_RI8 inst;
inst.inst.op = op;
@@ -284,8 +284,8 @@ static void emit_RI8(struct spe_function *p, unsigned op, unsigned rT,
-static void emit_RI10(struct spe_function *p, unsigned op, unsigned rT,
- unsigned rA, int imm, const char *name)
+static void emit_RI10(struct spe_function *p, unsigned op, int rT,
+ int rA, int imm, const char *name)
{
union spe_inst_RI10 inst;
inst.inst.op = op;
@@ -302,8 +302,8 @@ static void emit_RI10(struct spe_function *p, unsigned op, unsigned rT,
/** As above, but do range checking on signed immediate value */
-static void emit_RI10s(struct spe_function *p, unsigned op, unsigned rT,
- unsigned rA, int imm, const char *name)
+static void emit_RI10s(struct spe_function *p, unsigned op, int rT,
+ int rA, int imm, const char *name)
{
assert(imm <= 511);
assert(imm >= -512);
@@ -311,7 +311,7 @@ static void emit_RI10s(struct spe_function *p, unsigned op, unsigned rT,
}
-static void emit_RI16(struct spe_function *p, unsigned op, unsigned rT,
+static void emit_RI16(struct spe_function *p, unsigned op, int rT,
int imm, const char *name)
{
union spe_inst_RI16 inst;
@@ -326,7 +326,7 @@ static void emit_RI16(struct spe_function *p, unsigned op, unsigned rT,
}
-static void emit_RI18(struct spe_function *p, unsigned op, unsigned rT,
+static void emit_RI18(struct spe_function *p, unsigned op, int rT,
int imm, const char *name)
{
union spe_inst_RI18 inst;
@@ -348,61 +348,61 @@ void _name (struct spe_function *p) \
}
#define EMIT_(_name, _op) \
-void _name (struct spe_function *p, unsigned rT) \
+void _name (struct spe_function *p, int rT) \
{ \
emit_RR(p, _op, rT, 0, 0, __FUNCTION__); \
}
#define EMIT_R(_name, _op) \
-void _name (struct spe_function *p, unsigned rT, unsigned rA) \
+void _name (struct spe_function *p, int rT, int rA) \
{ \
emit_RR(p, _op, rT, rA, 0, __FUNCTION__); \
}
#define EMIT_RR(_name, _op) \
-void _name (struct spe_function *p, unsigned rT, unsigned rA, unsigned rB) \
+void _name (struct spe_function *p, int rT, int rA, int rB) \
{ \
emit_RR(p, _op, rT, rA, rB, __FUNCTION__); \
}
#define EMIT_RRR(_name, _op) \
-void _name (struct spe_function *p, unsigned rT, unsigned rA, unsigned rB, unsigned rC) \
+void _name (struct spe_function *p, int rT, int rA, int rB, int rC) \
{ \
emit_RRR(p, _op, rT, rA, rB, rC, __FUNCTION__); \
}
#define EMIT_RI7(_name, _op) \
-void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \
+void _name (struct spe_function *p, int rT, int rA, int imm) \
{ \
emit_RI7(p, _op, rT, rA, imm, __FUNCTION__); \
}
#define EMIT_RI8(_name, _op, bias) \
-void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \
+void _name (struct spe_function *p, int rT, int rA, int imm) \
{ \
emit_RI8(p, _op, rT, rA, bias - imm, __FUNCTION__); \
}
#define EMIT_RI10(_name, _op) \
-void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \
+void _name (struct spe_function *p, int rT, int rA, int imm) \
{ \
emit_RI10(p, _op, rT, rA, imm, __FUNCTION__); \
}
#define EMIT_RI10s(_name, _op) \
-void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \
+void _name (struct spe_function *p, int rT, int rA, int imm) \
{ \
emit_RI10s(p, _op, rT, rA, imm, __FUNCTION__); \
}
#define EMIT_RI16(_name, _op) \
-void _name (struct spe_function *p, unsigned rT, int imm) \
+void _name (struct spe_function *p, int rT, int imm) \
{ \
emit_RI16(p, _op, rT, imm, __FUNCTION__); \
}
#define EMIT_RI18(_name, _op) \
-void _name (struct spe_function *p, unsigned rT, int imm) \
+void _name (struct spe_function *p, int rT, int imm) \
{ \
emit_RI18(p, _op, rT, imm, __FUNCTION__); \
}
@@ -424,7 +424,7 @@ void _name (struct spe_function *p, int imm) \
*/
void spe_init_func(struct spe_function *p, unsigned code_size)
{
- unsigned int i;
+ uint i;
if (!code_size)
code_size = 64;
@@ -503,6 +503,7 @@ int spe_allocate_register(struct spe_function *p, int reg)
*/
void spe_release_register(struct spe_function *p, int reg)
{
+ assert(reg >= 0);
assert(reg < SPE_NUM_REGS);
assert(p->regs[reg] == 1);
@@ -517,7 +518,7 @@ void spe_release_register(struct spe_function *p, int reg)
*/
void spe_allocate_register_set(struct spe_function *p)
{
- unsigned int i;
+ uint i;
/* Keep track of the set count. If it ever wraps around to 0,
* we're in trouble.
@@ -538,7 +539,7 @@ void spe_allocate_register_set(struct spe_function *p)
void spe_release_register_set(struct spe_function *p)
{
- unsigned int i;
+ uint i;
/* If the set count drops below zero, we're in trouble. */
assert(p->set_count > 0);
@@ -599,7 +600,7 @@ spe_comment(struct spe_function *p, int rel_indent, const char *s)
* Load quad word.
* NOTE: offset is in bytes and the least significant 4 bits must be zero!
*/
-void spe_lqd(struct spe_function *p, unsigned rT, unsigned rA, int offset)
+void spe_lqd(struct spe_function *p, int rT, int rA, int offset)
{
const boolean pSave = p->print;
@@ -624,7 +625,7 @@ void spe_lqd(struct spe_function *p, unsigned rT, unsigned rA, int offset)
* Store quad word.
* NOTE: offset is in bytes and the least significant 4 bits must be zero!
*/
-void spe_stqd(struct spe_function *p, unsigned rT, unsigned rA, int offset)
+void spe_stqd(struct spe_function *p, int rT, int rA, int offset)
{
const boolean pSave = p->print;
@@ -653,51 +654,51 @@ void spe_stqd(struct spe_function *p, unsigned rT, unsigned rA, int offset)
*/
/** Branch Indirect to address in rA */
-void spe_bi(struct spe_function *p, unsigned rA, int d, int e)
+void spe_bi(struct spe_function *p, int rA, int d, int e)
{
emit_RI7(p, 0x1a8, 0, rA, (d << 5) | (e << 4), __FUNCTION__);
}
/** Interupt Return */
-void spe_iret(struct spe_function *p, unsigned rA, int d, int e)
+void spe_iret(struct spe_function *p, int rA, int d, int e)
{
emit_RI7(p, 0x1aa, 0, rA, (d << 5) | (e << 4), __FUNCTION__);
}
/** Branch indirect and set link on external data */
-void spe_bisled(struct spe_function *p, unsigned rT, unsigned rA, int d,
+void spe_bisled(struct spe_function *p, int rT, int rA, int d,
int e)
{
emit_RI7(p, 0x1ab, rT, rA, (d << 5) | (e << 4), __FUNCTION__);
}
/** Branch indirect and set link. Save PC in rT, jump to rA. */
-void spe_bisl(struct spe_function *p, unsigned rT, unsigned rA, int d,
+void spe_bisl(struct spe_function *p, int rT, int rA, int d,
int e)
{
emit_RI7(p, 0x1a9, rT, rA, (d << 5) | (e << 4), __FUNCTION__);
}
/** Branch indirect if zero word. If rT.word[0]==0, jump to rA. */
-void spe_biz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e)
+void spe_biz(struct spe_function *p, int rT, int rA, int d, int e)
{
emit_RI7(p, 0x128, rT, rA, (d << 5) | (e << 4), __FUNCTION__);
}
/** Branch indirect if non-zero word. If rT.word[0]!=0, jump to rA. */
-void spe_binz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e)
+void spe_binz(struct spe_function *p, int rT, int rA, int d, int e)
{
emit_RI7(p, 0x129, rT, rA, (d << 5) | (e << 4), __FUNCTION__);
}
/** Branch indirect if zero halfword. If rT.halfword[1]==0, jump to rA. */
-void spe_bihz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e)
+void spe_bihz(struct spe_function *p, int rT, int rA, int d, int e)
{
emit_RI7(p, 0x12a, rT, rA, (d << 5) | (e << 4), __FUNCTION__);
}
/** Branch indirect if non-zero halfword. If rT.halfword[1]!=0, jump to rA. */
-void spe_bihnz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e)
+void spe_bihnz(struct spe_function *p, int rT, int rA, int d, int e)
{
emit_RI7(p, 0x12b, rT, rA, (d << 5) | (e << 4), __FUNCTION__);
}
@@ -733,7 +734,7 @@ EMIT_R (spe_mtspr, 0x10c);
void
-spe_load_float(struct spe_function *p, unsigned rT, float x)
+spe_load_float(struct spe_function *p, int rT, float x)
{
if (x == 0.0f) {
spe_il(p, rT, 0x0);
@@ -760,7 +761,7 @@ spe_load_float(struct spe_function *p, unsigned rT, float x)
void
-spe_load_int(struct spe_function *p, unsigned rT, int i)
+spe_load_int(struct spe_function *p, int rT, int i)
{
if (-32768 <= i && i <= 32767) {
spe_il(p, rT, i);
@@ -772,7 +773,7 @@ spe_load_int(struct spe_function *p, unsigned rT, int i)
}
}
-void spe_load_uint(struct spe_function *p, unsigned rT, unsigned int ui)
+void spe_load_uint(struct spe_function *p, int rT, uint ui)
{
/* If the whole value is in the lower 18 bits, use ila, which
* doesn't sign-extend. Otherwise, if the two halfwords of
@@ -793,7 +794,7 @@ void spe_load_uint(struct spe_function *p, unsigned rT, unsigned int ui)
((ui & 0x00ff0000) == 0 || (ui & 0x00ff0000) == 0x00ff0000) &&
((ui & 0xff000000) == 0 || (ui & 0xff000000) == 0xff000000)
) {
- unsigned int mask = 0;
+ uint mask = 0;
/* fsmbi duplicates each bit in the given mask eight times,
* using a 16-bit value to initialize a 16-byte quadword.
* Each 4-bit nybble of the mask corresponds to a full word
@@ -822,7 +823,7 @@ void spe_load_uint(struct spe_function *p, unsigned rT, unsigned int ui)
* Changes to one should be made in the other.
*/
void
-spe_and_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui)
+spe_and_uint(struct spe_function *p, int rT, int rA, uint ui)
{
/* If we can, emit a single instruction, either And Byte Immediate
* (which uses the same constant across each byte), And Halfword Immediate
@@ -832,7 +833,7 @@ spe_and_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui)
*
* Otherwise, we'll need to use a temporary register.
*/
- unsigned int tmp;
+ uint tmp;
/* If the upper 23 bits are all 0s or all 1s, sign extension
* will work and we can use And Word Immediate
@@ -863,7 +864,7 @@ spe_and_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui)
}
/* Otherwise, we'll have to use a temporary register. */
- unsigned int tmp_reg = spe_allocate_available_register(p);
+ int tmp_reg = spe_allocate_available_register(p);
spe_load_uint(p, tmp_reg, ui);
spe_and(p, rT, rA, tmp_reg);
spe_release_register(p, tmp_reg);
@@ -875,7 +876,7 @@ spe_and_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui)
* Changes to one should be made in the other.
*/
void
-spe_xor_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui)
+spe_xor_uint(struct spe_function *p, int rT, int rA, uint ui)
{
/* If we can, emit a single instruction, either Exclusive Or Byte
* Immediate (which uses the same constant across each byte), Exclusive
@@ -885,7 +886,7 @@ spe_xor_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui)
*
* Otherwise, we'll need to use a temporary register.
*/
- unsigned int tmp;
+ uint tmp;
/* If the upper 23 bits are all 0s or all 1s, sign extension
* will work and we can use Exclusive Or Word Immediate
@@ -916,14 +917,14 @@ spe_xor_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui)
}
/* Otherwise, we'll have to use a temporary register. */
- unsigned int tmp_reg = spe_allocate_available_register(p);
+ int tmp_reg = spe_allocate_available_register(p);
spe_load_uint(p, tmp_reg, ui);
spe_xor(p, rT, rA, tmp_reg);
spe_release_register(p, tmp_reg);
}
void
-spe_compare_equal_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui)
+spe_compare_equal_uint(struct spe_function *p, int rT, int rA, uint ui)
{
/* If the comparison value is 9 bits or less, it fits inside a
* Compare Equal Word Immediate instruction.
@@ -933,7 +934,7 @@ spe_compare_equal_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigne
}
/* Otherwise, we're going to have to load a word first. */
else {
- unsigned int tmp_reg = spe_allocate_available_register(p);
+ int tmp_reg = spe_allocate_available_register(p);
spe_load_uint(p, tmp_reg, ui);
spe_ceq(p, rT, rA, tmp_reg);
spe_release_register(p, tmp_reg);
@@ -941,7 +942,7 @@ spe_compare_equal_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigne
}
void
-spe_compare_greater_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui)
+spe_compare_greater_uint(struct spe_function *p, int rT, int rA, uint ui)
{
/* If the comparison value is 10 bits or less, it fits inside a
* Compare Logical Greater Than Word Immediate instruction.
@@ -951,7 +952,7 @@ spe_compare_greater_uint(struct spe_function *p, unsigned rT, unsigned rA, unsig
}
/* Otherwise, we're going to have to load a word first. */
else {
- unsigned int tmp_reg = spe_allocate_available_register(p);
+ int tmp_reg = spe_allocate_available_register(p);
spe_load_uint(p, tmp_reg, ui);
spe_clgt(p, rT, rA, tmp_reg);
spe_release_register(p, tmp_reg);
@@ -959,10 +960,10 @@ spe_compare_greater_uint(struct spe_function *p, unsigned rT, unsigned rA, unsig
}
void
-spe_splat(struct spe_function *p, unsigned rT, unsigned rA)
+spe_splat(struct spe_function *p, int rT, int rA)
{
/* Use a temporary, just in case rT == rA */
- unsigned int tmp_reg = spe_allocate_available_register(p);
+ int tmp_reg = spe_allocate_available_register(p);
/* Duplicate bytes 0, 1, 2, and 3 across the whole register */
spe_ila(p, tmp_reg, 0x00010203);
spe_shufb(p, rT, rA, rA, tmp_reg);
@@ -971,14 +972,14 @@ spe_splat(struct spe_function *p, unsigned rT, unsigned rA)
void
-spe_complement(struct spe_function *p, unsigned rT, unsigned rA)
+spe_complement(struct spe_function *p, int rT, int rA)
{
spe_nor(p, rT, rA, rA);
}
void
-spe_move(struct spe_function *p, unsigned rT, unsigned rA)
+spe_move(struct spe_function *p, int rT, int rA)
{
/* Use different instructions depending on the instruction address
* to take advantage of the dual pipelines.
@@ -991,14 +992,14 @@ spe_move(struct spe_function *p, unsigned rT, unsigned rA)
void
-spe_zero(struct spe_function *p, unsigned rT)
+spe_zero(struct spe_function *p, int rT)
{
spe_xor(p, rT, rT, rT);
}
void
-spe_splat_word(struct spe_function *p, unsigned rT, unsigned rA, int word)
+spe_splat_word(struct spe_function *p, int rT, int rA, int word)
{
assert(word >= 0);
assert(word <= 3);
@@ -1038,9 +1039,9 @@ spe_splat_word(struct spe_function *p, unsigned rT, unsigned rA, int word)
* like "x = min(x, a)", we always allocate a new register to be safe.
*/
void
-spe_float_min(struct spe_function *p, unsigned rT, unsigned rA, unsigned rB)
+spe_float_min(struct spe_function *p, int rT, int rA, int rB)
{
- unsigned int compare_reg = spe_allocate_available_register(p);
+ int compare_reg = spe_allocate_available_register(p);
spe_fcgt(p, compare_reg, rA, rB);
spe_selb(p, rT, rA, rB, compare_reg);
spe_release_register(p, compare_reg);
@@ -1055,9 +1056,9 @@ spe_float_min(struct spe_function *p, unsigned rT, unsigned rA, unsigned rB)
* so that the larger of the two is selected instead of the smaller.
*/
void
-spe_float_max(struct spe_function *p, unsigned rT, unsigned rA, unsigned rB)
+spe_float_max(struct spe_function *p, int rT, int rA, int rB)
{
- unsigned int compare_reg = spe_allocate_available_register(p);
+ int compare_reg = spe_allocate_available_register(p);
spe_fcgt(p, compare_reg, rA, rB);
spe_selb(p, rT, rB, rA, compare_reg);
spe_release_register(p, compare_reg);
diff --git a/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.h b/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.h
index f9ad2acacd..65d9c77415 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.h
+++ b/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.h
@@ -79,9 +79,9 @@ struct spe_function
};
-extern void spe_init_func(struct spe_function *p, unsigned code_size);
+extern void spe_init_func(struct spe_function *p, uint code_size);
extern void spe_release_func(struct spe_function *p);
-extern unsigned spe_code_size(const struct spe_function *p);
+extern uint spe_code_size(const struct spe_function *p);
extern int spe_allocate_available_register(struct spe_function *p);
extern int spe_allocate_register(struct spe_function *p, int reg);
@@ -89,8 +89,7 @@ extern void spe_release_register(struct spe_function *p, int reg);
extern void spe_allocate_register_set(struct spe_function *p);
extern void spe_release_register_set(struct spe_function *p);
-extern unsigned
-spe_get_registers_used(const struct spe_function *p, ubyte used[]);
+extern uint spe_get_registers_used(const struct spe_function *p, ubyte used[]);
extern void spe_print_code(struct spe_function *p, boolean enable);
extern void spe_indent(struct spe_function *p, int spaces);
@@ -103,31 +102,25 @@ extern void spe_comment(struct spe_function *p, int rel_indent, const char *s);
#define EMIT(_name, _op) \
extern void _name (struct spe_function *p);
#define EMIT_(_name, _op) \
- extern void _name (struct spe_function *p, unsigned rT);
+ extern void _name (struct spe_function *p, int rT);
#define EMIT_R(_name, _op) \
- extern void _name (struct spe_function *p, unsigned rT, unsigned rA);
+ extern void _name (struct spe_function *p, int rT, int rA);
#define EMIT_RR(_name, _op) \
- extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
- unsigned rB);
+ extern void _name (struct spe_function *p, int rT, int rA, int rB);
#define EMIT_RRR(_name, _op) \
- extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
- unsigned rB, unsigned rC);
+ extern void _name (struct spe_function *p, int rT, int rA, int rB, int rC);
#define EMIT_RI7(_name, _op) \
- extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
- int imm);
+ extern void _name (struct spe_function *p, int rT, int rA, int imm);
#define EMIT_RI8(_name, _op, bias) \
- extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
- int imm);
+ extern void _name (struct spe_function *p, int rT, int rA, int imm);
#define EMIT_RI10(_name, _op) \
- extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
- int imm);
+ extern void _name (struct spe_function *p, int rT, int rA, int imm);
#define EMIT_RI10s(_name, _op) \
- extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
- int imm);
+ extern void _name (struct spe_function *p, int rT, int rA, int imm);
#define EMIT_RI16(_name, _op) \
- extern void _name (struct spe_function *p, unsigned rT, int imm);
+ extern void _name (struct spe_function *p, int rT, int imm);
#define EMIT_RI18(_name, _op) \
- extern void _name (struct spe_function *p, unsigned rT, int imm);
+ extern void _name (struct spe_function *p, int rT, int imm);
#define EMIT_I16(_name, _op) \
extern void _name (struct spe_function *p, int imm);
#define UNDEF_EMIT_MACROS
@@ -301,82 +294,82 @@ EMIT_RI16(spe_brhz, 0x044)
EMIT (spe_lnop, 0x001)
extern void
-spe_lqd(struct spe_function *p, unsigned rT, unsigned rA, int offset);
+spe_lqd(struct spe_function *p, int rT, int rA, int offset);
extern void
-spe_stqd(struct spe_function *p, unsigned rT, unsigned rA, int offset);
+spe_stqd(struct spe_function *p, int rT, int rA, int offset);
-extern void spe_bi(struct spe_function *p, unsigned rA, int d, int e);
-extern void spe_iret(struct spe_function *p, unsigned rA, int d, int e);
-extern void spe_bisled(struct spe_function *p, unsigned rT, unsigned rA,
+extern void spe_bi(struct spe_function *p, int rA, int d, int e);
+extern void spe_iret(struct spe_function *p, int rA, int d, int e);
+extern void spe_bisled(struct spe_function *p, int rT, int rA,
int d, int e);
-extern void spe_bisl(struct spe_function *p, unsigned rT, unsigned rA,
+extern void spe_bisl(struct spe_function *p, int rT, int rA,
int d, int e);
-extern void spe_biz(struct spe_function *p, unsigned rT, unsigned rA,
+extern void spe_biz(struct spe_function *p, int rT, int rA,
int d, int e);
-extern void spe_binz(struct spe_function *p, unsigned rT, unsigned rA,
+extern void spe_binz(struct spe_function *p, int rT, int rA,
int d, int e);
-extern void spe_bihz(struct spe_function *p, unsigned rT, unsigned rA,
+extern void spe_bihz(struct spe_function *p, int rT, int rA,
int d, int e);
-extern void spe_bihnz(struct spe_function *p, unsigned rT, unsigned rA,
+extern void spe_bihnz(struct spe_function *p, int rT, int rA,
int d, int e);
/** Load/splat immediate float into rT. */
extern void
-spe_load_float(struct spe_function *p, unsigned rT, float x);
+spe_load_float(struct spe_function *p, int rT, float x);
/** Load/splat immediate int into rT. */
extern void
-spe_load_int(struct spe_function *p, unsigned rT, int i);
+spe_load_int(struct spe_function *p, int rT, int i);
/** Load/splat immediate unsigned int into rT. */
extern void
-spe_load_uint(struct spe_function *p, unsigned rT, unsigned int ui);
+spe_load_uint(struct spe_function *p, int rT, uint ui);
/** And immediate value into rT. */
extern void
-spe_and_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui);
+spe_and_uint(struct spe_function *p, int rT, int rA, uint ui);
/** Xor immediate value into rT. */
extern void
-spe_xor_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui);
+spe_xor_uint(struct spe_function *p, int rT, int rA, uint ui);
/** Compare equal with immediate value. */
extern void
-spe_compare_equal_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui);
+spe_compare_equal_uint(struct spe_function *p, int rT, int rA, uint ui);
/** Compare greater with immediate value. */
extern void
-spe_compare_greater_uint(struct spe_function *p, unsigned rT, unsigned rA, unsigned int ui);
+spe_compare_greater_uint(struct spe_function *p, int rT, int rA, uint ui);
/** Replicate word 0 of rA across rT. */
extern void
-spe_splat(struct spe_function *p, unsigned rT, unsigned rA);
+spe_splat(struct spe_function *p, int rT, int rA);
/** rT = complement_all_bits(rA). */
extern void
-spe_complement(struct spe_function *p, unsigned rT, unsigned rA);
+spe_complement(struct spe_function *p, int rT, int rA);
/** rT = rA. */
extern void
-spe_move(struct spe_function *p, unsigned rT, unsigned rA);
+spe_move(struct spe_function *p, int rT, int rA);
/** rT = {0,0,0,0}. */
extern void
-spe_zero(struct spe_function *p, unsigned rT);
+spe_zero(struct spe_function *p, int rT);
/** rT = splat(rA, word) */
extern void
-spe_splat_word(struct spe_function *p, unsigned rT, unsigned rA, int word);
+spe_splat_word(struct spe_function *p, int rT, int rA, int word);
/** rT = float min(rA, rB) */
extern void
-spe_float_min(struct spe_function *p, unsigned rT, unsigned rA, unsigned rB);
+spe_float_min(struct spe_function *p, int rT, int rA, int rB);
/** rT = float max(rA, rB) */
extern void
-spe_float_max(struct spe_function *p, unsigned rT, unsigned rA, unsigned rB);
+spe_float_max(struct spe_function *p, int rT, int rA, int rB);
/* Floating-point instructions
--
cgit v1.2.3
From b27eb7cb4f5b49b9e7c24deb6c1fb52908f63703 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sun, 11 Jan 2009 15:11:00 -0700
Subject: cell: re-order the z/stencil fetch/extract/convert instructions for
better perf
The new instruction order is 10 cycles faster.
---
src/gallium/drivers/cell/ppu/cell_gen_fragment.c | 106 +++++++++++------------
1 file changed, 51 insertions(+), 55 deletions(-)
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
index 4d28d4801f..b3cce68157 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
@@ -1813,93 +1813,88 @@ gen_depth_stencil(struct cell_context *cell,
const enum pipe_format zs_format = cell->framebuffer.zsbuf->format;
boolean write_depth_stencil;
- /* We may or may not need to allocate a register for Z or stencil values */
- int fbS_reg = -1, fbZ_reg = -1;
-
- /* framebuffer's combined z/stencil values for quad */
+ /* framebuffer's combined z/stencil values register */
int fbZS_reg = spe_allocate_available_register(f);
+ /* Framebufer Z values register */
+ int fbZ_reg = spe_allocate_available_register(f);
- spe_comment(f, 0, "Fetch Z/stencil quad from tile");
+ /* Framebuffer stencil values register (may not be used) */
+ int fbS_reg = spe_allocate_available_register(f);
+
+ /* 24-bit mask register (may not be used) */
+ int zmask_reg = spe_allocate_available_register(f);
- /* fetch quad of depth/stencil values from tile at (x,y) */
- /* Load: fbZS_reg = memory[depth_tile_reg + offset_reg] */
- /* XXX Not sure this is allowed if we've only got a 16-bit Z buffer... */
- spe_lqx(f, fbZS_reg, depth_tile_reg, quad_offset_reg);
-
- /* From the Z/stencil buffer format, pull out the bits we need for
- * Z and/or stencil. We'll also convert the incoming fragment Z
- * value in fragZ_reg from a floating point value in [0.0..1.0] to
- * an unsigned integer value with the appropriate resolution.
- * Note that even if depth or stencil is *not* enabled, if it's
- * present in the buffer, we pull it out and put it back later;
- * otherwise, we can inadvertently destroy the contents of
- * buffers we're not supposed to touch (e.g., if the user is
- * clearing the depth buffer but not the stencil buffer, a
- * quad of constant depth is drawn over the surface; the stencil
- * buffer must be maintained).
+ /**
+ * The following code:
+ * 1. fetch quad of packed Z/S values from the framebuffer tile.
+ * 2. extract the separate the Z and S values from packed values
+ * 3. convert fragment Z values from float in [0,1] to 32/24/16-bit ints
+ *
+ * The instructions for doing this are interleaved for better performance.
*/
+ spe_comment(f, 0, "Fetch Z/stencil quad from tile");
+
switch(zs_format) {
case PIPE_FORMAT_S8Z24_UNORM: /* fall through */
case PIPE_FORMAT_X8Z24_UNORM:
- /* Pull out both Z and stencil */
- setup_optional_register(f, &fbZ_reg);
- setup_optional_register(f, &fbS_reg);
+ /* prepare mask to extract Z vals from ZS vals */
+ spe_load_uint(f, zmask_reg, 0x00ffffff);
- /* four 24-bit Z values in the low-order bits */
- spe_and_uint(f, fbZ_reg, fbZS_reg, 0x00ffffff);
-
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 24-bit unsigned integer
- */
+ /* convert fragment Z from [0,1] to 32-bit ints */
spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
+
+ /* Load: fbZS_reg = memory[depth_tile_reg + offset_reg] */
+ spe_lqx(f, fbZS_reg, depth_tile_reg, quad_offset_reg);
+
+ /* right shift 32-bit fragment Z to 24 bits */
spe_rotmi(f, fragZ_reg, fragZ_reg, -8);
- /* four 8-bit stencil values in the high-order bits */
+ /* extract 24-bit Z values from ZS values by masking */
+ spe_and(f, fbZ_reg, fbZS_reg, zmask_reg);
+
+ /* extract 8-bit stencil values by shifting */
spe_rotmi(f, fbS_reg, fbZS_reg, -24);
break;
case PIPE_FORMAT_Z24S8_UNORM: /* fall through */
case PIPE_FORMAT_Z24X8_UNORM:
- setup_optional_register(f, &fbZ_reg);
- setup_optional_register(f, &fbS_reg);
+ /* convert fragment Z from [0,1] to 32-bit ints */
+ spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
- /* shift by 8 to get the upper 24-bit values */
- spe_rotmi(f, fbS_reg, fbZS_reg, -8);
+ /* Load: fbZS_reg = memory[depth_tile_reg + offset_reg] */
+ spe_lqx(f, fbZS_reg, depth_tile_reg, quad_offset_reg);
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 24-bit unsigned integer
- */
- spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
+ /* right shift 32-bit fragment Z to 24 bits */
spe_rotmi(f, fragZ_reg, fragZ_reg, -8);
- /* 8-bit stencil in the low-order bits - mask them out */
+ /* extract 24-bit Z values from ZS values by shifting */
+ spe_rotmi(f, fbZ_reg, fbZS_reg, -8);
+
+ /* extract 8-bit stencil values by masking */
spe_and_uint(f, fbS_reg, fbZS_reg, 0x000000ff);
break;
case PIPE_FORMAT_Z32_UNORM:
- setup_optional_register(f, &fbZ_reg);
- /* Copy over 4 32-bit values */
- spe_move(f, fbZ_reg, fbZS_reg);
+ /* Load: fbZ_reg = memory[depth_tile_reg + offset_reg] */
+ spe_lqx(f, fbZ_reg, depth_tile_reg, quad_offset_reg);
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 32-bit unsigned integer
- */
+ /* convert fragment Z from [0,1] to 32-bit ints */
spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
+
/* No stencil, so can't do anything there */
break;
case PIPE_FORMAT_Z16_UNORM:
- /* XXX Not sure this is correct, but it was here before, so we're
- * going with it for now
- */
- setup_optional_register(f, &fbZ_reg);
+ /* XXX This code for 16bpp Z is broken! */
+
+ /* Load: fbZS_reg = memory[depth_tile_reg + offset_reg] */
+ spe_lqx(f, fbZS_reg, depth_tile_reg, quad_offset_reg);
+
/* Copy over 4 32-bit values */
spe_move(f, fbZ_reg, fbZS_reg);
- /* Incoming fragZ_reg value is a float in 0.0...1.0; convert
- * to a 16-bit unsigned integer
- */
+ /* convert Z from [0,1] to 16-bit ints */
spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
spe_rotmi(f, fragZ_reg, fragZ_reg, -16);
/* No stencil */
@@ -1979,9 +1974,10 @@ gen_depth_stencil(struct cell_context *cell,
}
/* Don't need these any more */
- release_optional_register(f, fbZ_reg);
- release_optional_register(f, fbS_reg);
spe_release_register(f, fbZS_reg);
+ spe_release_register(f, fbZ_reg);
+ spe_release_register(f, fbS_reg);
+ spe_release_register(f, zmask_reg);
}
--
cgit v1.2.3
From 6324c77e01b348ae5e5cddc23a5302871d3c018c Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sun, 11 Jan 2009 15:18:28 -0700
Subject: cell: move color unpacking code into separate function
---
src/gallium/drivers/cell/ppu/cell_gen_fragment.c | 165 ++++++++++++-----------
1 file changed, 89 insertions(+), 76 deletions(-)
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
index b3cce68157..d0036ec9d6 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
@@ -278,6 +278,92 @@ release_const_register(struct spe_function *f,
release_optional_register(f, r);
}
+
+
+/**
+ * Unpack/convert framebuffer colors from four 32-bit packed colors
+ * (fbRGBA) to four float RGBA vectors (fbR, fbG, fbB, fbA).
+ * Each 8-bit color component is expanded into a float in [0.0, 1.0].
+ */
+static void
+unpack_colors(struct spe_function *f,
+ enum pipe_format color_format,
+ int fbRGBA_reg,
+ int fbR_reg, int fbG_reg, int fbB_reg, int fbA_reg)
+{
+ int mask_reg = spe_allocate_available_register(f);
+
+ /* mask = {0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff} */
+ spe_load_int(f, mask_reg, 0xff);
+
+ /* XXX there may be more clever ways to implement the following code */
+ switch (color_format) {
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ /* fbB = fbB & mask */
+ spe_and(f, fbB_reg, fbRGBA_reg, mask_reg);
+ /* mask = mask << 8 */
+ spe_roti(f, mask_reg, mask_reg, 8);
+
+ /* fbG = fbRGBA & mask */
+ spe_and(f, fbG_reg, fbRGBA_reg, mask_reg);
+ /* fbG = fbG >> 8 */
+ spe_roti(f, fbG_reg, fbG_reg, -8);
+ /* mask = mask << 8 */
+ spe_roti(f, mask_reg, mask_reg, 8);
+
+ /* fbR = fbRGBA & mask */
+ spe_and(f, fbR_reg, fbRGBA_reg, mask_reg);
+ /* fbR = fbR >> 16 */
+ spe_roti(f, fbR_reg, fbR_reg, -16);
+ /* mask = mask << 8 */
+ spe_roti(f, mask_reg, mask_reg, 8);
+
+ /* fbA = fbRGBA & mask */
+ spe_and(f, fbA_reg, fbRGBA_reg, mask_reg);
+ /* fbA = fbA >> 24 */
+ spe_roti(f, fbA_reg, fbA_reg, -24);
+ break;
+
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ /* fbA = fbA & mask */
+ spe_and(f, fbA_reg, fbRGBA_reg, mask_reg);
+ /* mask = mask << 8 */
+ spe_roti(f, mask_reg, mask_reg, 8);
+
+ /* fbR = fbRGBA & mask */
+ spe_and(f, fbR_reg, fbRGBA_reg, mask_reg);
+ /* fbR = fbR >> 8 */
+ spe_roti(f, fbR_reg, fbR_reg, -8);
+ /* mask = mask << 8 */
+ spe_roti(f, mask_reg, mask_reg, 8);
+
+ /* fbG = fbRGBA & mask */
+ spe_and(f, fbG_reg, fbRGBA_reg, mask_reg);
+ /* fbG = fbG >> 16 */
+ spe_roti(f, fbG_reg, fbG_reg, -16);
+ /* mask = mask << 8 */
+ spe_roti(f, mask_reg, mask_reg, 8);
+
+ /* fbB = fbRGBA & mask */
+ spe_and(f, fbB_reg, fbRGBA_reg, mask_reg);
+ /* fbB = fbB >> 24 */
+ spe_roti(f, fbB_reg, fbB_reg, -24);
+ break;
+
+ default:
+ ASSERT(0);
+ }
+
+ /* convert int[4] in [0,255] to float[4] in [0.0, 1.0] */
+ spe_cuflt(f, fbR_reg, fbR_reg, 8);
+ spe_cuflt(f, fbG_reg, fbG_reg, 8);
+ spe_cuflt(f, fbB_reg, fbB_reg, 8);
+ spe_cuflt(f, fbA_reg, fbA_reg, 8);
+
+ spe_release_register(f, mask_reg);
+}
+
+
/**
* Generate SPE code to implement the given blend mode for a quad of pixels.
* \param f SPE function to append instruction onto.
@@ -321,82 +407,9 @@ gen_blend(const struct pipe_blend_state *blend,
ASSERT(blend->blend_enable);
- /* Unpack/convert framebuffer colors from four 32-bit packed colors
- * (fbRGBA) to four float RGBA vectors (fbR, fbG, fbB, fbA).
- * Each 8-bit color component is expanded into a float in [0.0, 1.0].
- */
- {
- int mask_reg = spe_allocate_available_register(f);
-
- /* mask = {0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff} */
- spe_load_int(f, mask_reg, 0xff);
-
- /* XXX there may be more clever ways to implement the following code */
- switch (color_format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- /* fbB = fbB & mask */
- spe_and(f, fbB_reg, fbRGBA_reg, mask_reg);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
-
- /* fbG = fbRGBA & mask */
- spe_and(f, fbG_reg, fbRGBA_reg, mask_reg);
- /* fbG = fbG >> 8 */
- spe_roti(f, fbG_reg, fbG_reg, -8);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
-
- /* fbR = fbRGBA & mask */
- spe_and(f, fbR_reg, fbRGBA_reg, mask_reg);
- /* fbR = fbR >> 16 */
- spe_roti(f, fbR_reg, fbR_reg, -16);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
-
- /* fbA = fbRGBA & mask */
- spe_and(f, fbA_reg, fbRGBA_reg, mask_reg);
- /* fbA = fbA >> 24 */
- spe_roti(f, fbA_reg, fbA_reg, -24);
- break;
-
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- /* fbA = fbA & mask */
- spe_and(f, fbA_reg, fbRGBA_reg, mask_reg);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
-
- /* fbR = fbRGBA & mask */
- spe_and(f, fbR_reg, fbRGBA_reg, mask_reg);
- /* fbR = fbR >> 8 */
- spe_roti(f, fbR_reg, fbR_reg, -8);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
-
- /* fbG = fbRGBA & mask */
- spe_and(f, fbG_reg, fbRGBA_reg, mask_reg);
- /* fbG = fbG >> 16 */
- spe_roti(f, fbG_reg, fbG_reg, -16);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
-
- /* fbB = fbRGBA & mask */
- spe_and(f, fbB_reg, fbRGBA_reg, mask_reg);
- /* fbB = fbB >> 24 */
- spe_roti(f, fbB_reg, fbB_reg, -24);
- break;
-
- default:
- ASSERT(0);
- }
-
- /* convert int[4] in [0,255] to float[4] in [0.0, 1.0] */
- spe_cuflt(f, fbR_reg, fbR_reg, 8);
- spe_cuflt(f, fbG_reg, fbG_reg, 8);
- spe_cuflt(f, fbB_reg, fbB_reg, 8);
- spe_cuflt(f, fbA_reg, fbA_reg, 8);
-
- spe_release_register(f, mask_reg);
- }
+ /* packed RGBA -> float colors */
+ unpack_colors(f, color_format, fbRGBA_reg,
+ fbR_reg, fbG_reg, fbB_reg, fbA_reg);
/*
* Compute Src RGB terms. We're actually looking for the value
--
cgit v1.2.3
From 516dd9b36163259ee5a8d356e59a2eadb6a6bdb1 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Sun, 11 Jan 2009 15:28:38 -0700
Subject: cell: optimize unpack_colors() function, saving 12 cycles
---
src/gallium/drivers/cell/ppu/cell_gen_fragment.c | 65 +++++++++++++-----------
1 file changed, 34 insertions(+), 31 deletions(-)
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
index d0036ec9d6..0ea8f017ef 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
@@ -291,61 +291,61 @@ unpack_colors(struct spe_function *f,
int fbRGBA_reg,
int fbR_reg, int fbG_reg, int fbB_reg, int fbA_reg)
{
- int mask_reg = spe_allocate_available_register(f);
+ int mask0_reg = spe_allocate_available_register(f);
+ int mask1_reg = spe_allocate_available_register(f);
+ int mask2_reg = spe_allocate_available_register(f);
+ int mask3_reg = spe_allocate_available_register(f);
- /* mask = {0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff} */
- spe_load_int(f, mask_reg, 0xff);
+ spe_load_int(f, mask0_reg, 0xff);
+ spe_load_int(f, mask1_reg, 0xff00);
+ spe_load_int(f, mask2_reg, 0xff0000);
+ spe_load_int(f, mask3_reg, 0xff000000);
+
+ spe_comment(f, 0, "Unpack framebuffer colors, convert to floats");
- /* XXX there may be more clever ways to implement the following code */
switch (color_format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
- /* fbB = fbB & mask */
- spe_and(f, fbB_reg, fbRGBA_reg, mask_reg);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
+ /* fbB = fbRGBA & mask */
+ spe_and(f, fbB_reg, fbRGBA_reg, mask0_reg);
/* fbG = fbRGBA & mask */
- spe_and(f, fbG_reg, fbRGBA_reg, mask_reg);
+ spe_and(f, fbG_reg, fbRGBA_reg, mask1_reg);
+
+ /* fbR = fbRGBA & mask */
+ spe_and(f, fbR_reg, fbRGBA_reg, mask2_reg);
+
+ /* fbA = fbRGBA & mask */
+ spe_and(f, fbA_reg, fbRGBA_reg, mask3_reg);
+
/* fbG = fbG >> 8 */
spe_roti(f, fbG_reg, fbG_reg, -8);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
- /* fbR = fbRGBA & mask */
- spe_and(f, fbR_reg, fbRGBA_reg, mask_reg);
/* fbR = fbR >> 16 */
spe_roti(f, fbR_reg, fbR_reg, -16);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
- /* fbA = fbRGBA & mask */
- spe_and(f, fbA_reg, fbRGBA_reg, mask_reg);
/* fbA = fbA >> 24 */
spe_roti(f, fbA_reg, fbA_reg, -24);
break;
case PIPE_FORMAT_B8G8R8A8_UNORM:
- /* fbA = fbA & mask */
- spe_and(f, fbA_reg, fbRGBA_reg, mask_reg);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
+ /* fbA = fbRGBA & mask */
+ spe_and(f, fbA_reg, fbRGBA_reg, mask0_reg);
/* fbR = fbRGBA & mask */
- spe_and(f, fbR_reg, fbRGBA_reg, mask_reg);
+ spe_and(f, fbR_reg, fbRGBA_reg, mask1_reg);
+
+ /* fbG = fbRGBA & mask */
+ spe_and(f, fbG_reg, fbRGBA_reg, mask2_reg);
+
+ /* fbB = fbRGBA & mask */
+ spe_and(f, fbB_reg, fbRGBA_reg, mask3_reg);
+
/* fbR = fbR >> 8 */
spe_roti(f, fbR_reg, fbR_reg, -8);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
- /* fbG = fbRGBA & mask */
- spe_and(f, fbG_reg, fbRGBA_reg, mask_reg);
/* fbG = fbG >> 16 */
spe_roti(f, fbG_reg, fbG_reg, -16);
- /* mask = mask << 8 */
- spe_roti(f, mask_reg, mask_reg, 8);
- /* fbB = fbRGBA & mask */
- spe_and(f, fbB_reg, fbRGBA_reg, mask_reg);
/* fbB = fbB >> 24 */
spe_roti(f, fbB_reg, fbB_reg, -24);
break;
@@ -360,7 +360,10 @@ unpack_colors(struct spe_function *f,
spe_cuflt(f, fbB_reg, fbB_reg, 8);
spe_cuflt(f, fbA_reg, fbA_reg, 8);
- spe_release_register(f, mask_reg);
+ spe_release_register(f, mask0_reg);
+ spe_release_register(f, mask1_reg);
+ spe_release_register(f, mask2_reg);
+ spe_release_register(f, mask3_reg);
}
--
cgit v1.2.3
From 297a9606ead4400a60a1b5106327c226db4b3474 Mon Sep 17 00:00:00 2001
From: Matthieu Herrb
Date: Sat, 13 Sep 2008 19:07:28 +0200
Subject: __builtin_expect is a gcc 3.x feature. define it out for gcc 2.95.
Patch suggested by miod@. Thanks.
---
src/mesa/glapi/glthread.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/mesa/glapi/glthread.h b/src/mesa/glapi/glthread.h
index e2765cebb1..27ccd2e2e7 100644
--- a/src/mesa/glapi/glthread.h
+++ b/src/mesa/glapi/glthread.h
@@ -298,6 +298,10 @@ _glthread_GetTSD(_glthread_TSD *);
extern void
_glthread_SetTSD(_glthread_TSD *, void *);
+#if !defined __GNUC__ || __GNUC__ < 3
+# define __builtin_expect(x, y) x
+#endif
+
#if defined(GLX_USE_TLS)
extern __thread struct _glapi_table * _glapi_tls_Dispatch
--
cgit v1.2.3
From b4866f8a5229d4769a49b4c54a1675a61497d206 Mon Sep 17 00:00:00 2001
From: "Owain G. Ainsworth"
Date: Sun, 11 Jan 2009 20:40:07 +0000
Subject: Fix build with GCC 2.95.
---
src/glx/x11/glx_pbuffer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/glx/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c
index c63d53439d..a602cd2881 100644
--- a/src/glx/x11/glx_pbuffer.c
+++ b/src/glx/x11/glx_pbuffer.c
@@ -220,14 +220,14 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
unsigned int length;
unsigned int i;
unsigned int num_attributes;
+ GLboolean use_glx_1_3;
if ((dpy == NULL) || (drawable == 0)) {
return 0;
}
priv = __glXInitialize(dpy);
- GLboolean use_glx_1_3 = ((priv->majorVersion > 1)
- || (priv->minorVersion >= 3));
+ use_glx_1_3 = ((priv->majorVersion > 1) || (priv->minorVersion >= 3));
*value = 0;
--
cgit v1.2.3
From 356428d4e4dba433b405f63ff918d76eaf4b4215 Mon Sep 17 00:00:00 2001
From: Matthieu Herrb
Date: Sun, 14 Sep 2008 20:58:29 +0200
Subject: replace nearbyint() by rint() for now.
---
src/mesa/drivers/dri/i965/brw_sf_state.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c
index 506126fcfb..741a7c53c4 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_state.c
@@ -229,7 +229,7 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key,
/* XXX clamp max depends on AA vs. non-AA */
sf.sf7.sprite_point = key->point_sprite;
- sf.sf7.point_size = CLAMP(nearbyint(key->point_size), 1, 255) * (1<<3);
+ sf.sf7.point_size = CLAMP(rint(key->point_size), 1, 255) * (1<<3);
sf.sf7.use_point_size_state = !key->point_attenuated;
sf.sf7.aa_line_distance_mode = 0;
--
cgit v1.2.3
From 33f6dc3c334cc065d7c98d0481be19b208e1837d Mon Sep 17 00:00:00 2001
From: Matthieu Herrb
Date: Sun, 21 Sep 2008 10:56:57 +0200
Subject: build fix on big endian OpenBSD architectures.
---
src/mesa/drivers/dri/mach64/mach64_context.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/mesa/drivers/dri/mach64/mach64_context.h b/src/mesa/drivers/dri/mach64/mach64_context.h
index 55e0618ff8..854751626d 100644
--- a/src/mesa/drivers/dri/mach64/mach64_context.h
+++ b/src/mesa/drivers/dri/mach64/mach64_context.h
@@ -294,7 +294,13 @@ extern GLboolean mach64UnbindContext( __DRIcontextPrivate *driContextPriv );
#define LE32_OUT( x, y ) do { *(GLuint *)(x) = (y); } while (0)
#define LE32_OUT_FLOAT( x, y ) do { *(GLfloat *)(x) = (y); } while (0)
#else
+#ifndef __OpenBSD__
#include
+#else
+#include
+#define bswap_32 bswap32
+#endif
+
#define LE32_IN( x ) bswap_32( *(GLuint *)(x) )
#define LE32_IN_FLOAT( x ) \
({ \
--
cgit v1.2.3
From 0f0922f93cbe997a95575c955ab1544bb5cd1d7d Mon Sep 17 00:00:00 2001
From: Matthieu Herrb
Date: Sat, 11 Oct 2008 08:51:43 +0200
Subject: Big endian fixes.
---
src/mesa/main/glheader.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 1d0f178dc4..626806d35f 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -146,7 +146,8 @@
#include
#define CPU_TO_LE32( x ) bswap_32( x )
#else /*__linux__*/
-#define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */
+#include
+#define CPU_TO_LE32( x ) bswap32( x )
#endif /*__linux__*/
#define MESA_BIG_ENDIAN 1
#else
--
cgit v1.2.3
From 436024561aa6d78f78601f690803bd3845d225e7 Mon Sep 17 00:00:00 2001
From: Matthieu Herrb
Date: Sun, 11 Jan 2009 16:56:34 -0700
Subject: Build fixes for gcc 2.95
---
src/glx/x11/drisw_glx.c | 6 +++---
src/glx/x11/glxcurrent.c | 5 ++---
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c
index fee45952b3..35bbd9151c 100644
--- a/src/glx/x11/drisw_glx.c
+++ b/src/glx/x11/drisw_glx.c
@@ -113,7 +113,7 @@ swrastGetDrawableInfo(__DRIdrawable * draw,
int *x, int *y, int *w, int *h, void *loaderPrivate)
{
__GLXDRIdrawablePrivate *pdp = loaderPrivate;
- __GLXDRIdrawable *pdraw = &(pdp->base);;
+ __GLXDRIdrawable *pdraw = &(pdp->base);
Display *dpy = pdraw->psc->dpy;
Drawable drawable;
@@ -141,7 +141,7 @@ swrastPutImage(__DRIdrawable * draw, int op,
int x, int y, int w, int h, char *data, void *loaderPrivate)
{
__GLXDRIdrawablePrivate *pdp = loaderPrivate;
- __GLXDRIdrawable *pdraw = &(pdp->base);;
+ __GLXDRIdrawable *pdraw = &(pdp->base);
Display *dpy = pdraw->psc->dpy;
Drawable drawable;
XImage *ximage;
@@ -176,7 +176,7 @@ swrastGetImage(__DRIdrawable * draw,
int x, int y, int w, int h, char *data, void *loaderPrivate)
{
__GLXDRIdrawablePrivate *pdp = loaderPrivate;
- __GLXDRIdrawable *pdraw = &(pdp->base);;
+ __GLXDRIdrawable *pdraw = &(pdp->base);
Display *dpy = pdraw->psc->dpy;
Drawable drawable;
XImage *ximage;
diff --git a/src/glx/x11/glxcurrent.c b/src/glx/x11/glxcurrent.c
index f3eb045d9f..5af46cf0ba 100644
--- a/src/glx/x11/glxcurrent.c
+++ b/src/glx/x11/glxcurrent.c
@@ -365,7 +365,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
const CARD8 oldOpcode = ((gc == oldGC) || (oldGC == &dummyContext))
? opcode : __glXSetupForCommand(oldGC->currentDpy);
Bool bindReturnValue;
-
+ __GLXattribute *state;
if (!opcode || !oldOpcode) {
return GL_FALSE;
@@ -489,8 +489,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
} while (0);
#endif
- __GLXattribute *state =
- (__GLXattribute *) (gc->client_state_private);
+ state = (__GLXattribute *) (gc->client_state_private);
gc->currentContextTag = reply.contextTag;
if (state->array_state == NULL) {
--
cgit v1.2.3
From 7b6fb34e9d1da73cc92fc63fa1d52082df5904ee Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 13:25:28 +1000
Subject: nouveau: use usage, not uninitialised flags value...
---
src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c
index 6895137506..c8f26d5fad 100644
--- a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c
+++ b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c
@@ -69,7 +69,7 @@ nouveau_pipe_bo_create(struct pipe_winsys *pws, unsigned alignment,
nvbuf->base.usage = usage;
nvbuf->base.size = size;
- flags = nouveau_flags_from_usage(nv, flags);
+ flags = nouveau_flags_from_usage(nv, usage);
if (nouveau_bo_new(dev, flags, alignment, size, &nvbuf->bo)) {
FREE(nvbuf);
--
cgit v1.2.3
From df266471b1f0eae54cf23fd59a741fa3be9b93df Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 13:27:13 +1000
Subject: nouveau: return buffer map to something sane.
Sorry, but no, we're not doing this.. Correctness always takes precedence
over speed. Implement this higher up where you know it's safe to do so,
and doesn't break other things in the process.
---
.../winsys/drm/nouveau/common/nouveau_winsys_pipe.c | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c
index c8f26d5fad..683710ee3c 100644
--- a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c
+++ b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c
@@ -121,26 +121,6 @@ nouveau_pipe_bo_map(struct pipe_winsys *pws, struct pipe_buffer *buf,
if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
map_flags |= NOUVEAU_BO_WR;
- /* XXX: Technically incorrect. If the client maps a buffer for write-only
- * and leaves part of the buffer untouched it probably expects those parts
- * to remain intact. This is violated because we allocate a whole new buffer
- * and don't copy the previous buffer's contents, so this optimization is
- * only valid if the client intends to overwrite the whole buffer.
- */
- if ((map_flags & NOUVEAU_BO_RDWR) == NOUVEAU_BO_WR &&
- !nouveau_bo_busy(nvbuf->bo, map_flags)) {
- struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
- struct nouveau_context *nv = nvpws->nv;
- struct nouveau_device *dev = nv->nv_screen->device;
- struct nouveau_bo *rename;
- uint32_t flags = nouveau_flags_from_usage(nv, buf->usage);
-
- if (!nouveau_bo_new(dev, flags, buf->alignment, buf->size, &rename)) {
- nouveau_bo_del(&nvbuf->bo);
- nvbuf->bo = rename;
- }
- }
-
if (nouveau_bo_map(nvbuf->bo, map_flags))
return NULL;
return nvbuf->bo->map;
--
cgit v1.2.3
From 103020f2646e224a21dcd0dd27d71a10865c0d3d Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 13:42:19 +1000
Subject: nv50: create buffers for each image that makes up a texture
---
src/gallium/drivers/nv50/nv50_context.h | 8 +++++-
src/gallium/drivers/nv50/nv50_miptree.c | 43 ++++++++++++++++++++++++---------
2 files changed, 38 insertions(+), 13 deletions(-)
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index 0958bba334..daa3efaa0a 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -67,11 +67,17 @@ struct nv50_rasterizer_stateobj {
struct nouveau_stateobj *so;
};
+struct nv50_miptree_level {
+ struct pipe_buffer **image;
+ int *image_offset;
+ unsigned image_dirty;
+};
+
struct nv50_miptree {
struct pipe_texture base;
struct pipe_buffer *buffer;
- int *image_offset;
+ struct nv50_miptree_level level[PIPE_MAX_TEXTURE_LEVELS];
int image_nr;
int total_size;
};
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 2497371232..c72b0db9ec 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -27,14 +27,16 @@
#include "nv50_context.h"
static struct pipe_texture *
-nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
+nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
{
struct pipe_winsys *ws = pscreen->winsys;
struct nv50_miptree *mt = CALLOC_STRUCT(nv50_miptree);
- unsigned usage, width = pt->width[0], height = pt->height[0];
- int i;
+ struct pipe_texture *pt = &mt->base;
+ unsigned usage, width = tmp->width[0], height = tmp->height[0];
+ unsigned depth = tmp->depth[0];
+ int i, l;
- mt->base = *pt;
+ mt->base = *tmp;
mt->base.refcount = 1;
mt->base.screen = pscreen;
@@ -59,17 +61,34 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
mt->image_nr = 1;
break;
}
- mt->image_offset = CALLOC(mt->image_nr, sizeof(int));
+
+ for (l = 0; l <= pt->last_level; l++) {
+ struct nv50_miptree_level *lvl = &mt->level[l];
+
+ pt->width[l] = width;
+ pt->height[l] = height;
+ pt->depth[l] = depth;
+ pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
+ pt->nblocksy[l] = pf_get_nblocksy(&pt->block, width);
+
+ lvl->image_offset = CALLOC(mt->image_nr, sizeof(int));
+ lvl->image = CALLOC(mt->image_nr, sizeof(struct pipe_buffer *));
+ }
for (i = 0; i < mt->image_nr; i++) {
- int image_size;
+ for (l = 0; l <= pt->last_level; l++) {
+ struct nv50_miptree_level *lvl = &mt->level[l];
+ int size;
+
+ size = align(pt->width[l], 8) * pt->block.size;
+ size = align(size, 64);
+ size *= align(pt->height[l], 8) * pt->block.size;
- image_size = align(width, 8) * pt->block.size;
- image_size = align(image_size, 64);
- image_size *= align(height, 8) * pt->block.size;
+ lvl->image[i] = ws->buffer_create(ws, 256, 0, size);
+ lvl->image_offset[i] = mt->total_size;
- mt->image_offset[i] = mt->total_size;
- mt->total_size += image_size;
+ mt->total_size += size;
+ }
}
mt->buffer = ws->buffer_create(ws, 256, usage, mt->total_size);
@@ -128,7 +147,7 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ps->nblocksx = pt->nblocksx[level];
ps->nblocksy = pt->nblocksy[level];
ps->stride = ps->width * ps->block.size;
- ps->offset = mt->image_offset[img];
+ ps->offset = mt->level[level].image_offset[img];
ps->usage = flags;
ps->status = PIPE_SURFACE_STATUS_DEFINED;
--
cgit v1.2.3
From 08b6534bc80925e4574d6b893f8aa14751b44a3f Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 14:10:24 +1000
Subject: nv50: any cpu access to a texture is done on its backing images
Still a little dodgy:
- RTT will hit an assertion (hopefully!) and fail
- 3D textures with depth >= 32 will cause bad things to happen
---
src/gallium/drivers/nv50/nv50_context.h | 3 +-
src/gallium/drivers/nv50/nv50_miptree.c | 61 +++++++++++++++++++++++++++++++--
src/gallium/drivers/nv50/nv50_tex.c | 15 ++++++--
3 files changed, 72 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index daa3efaa0a..c1ff6061e4 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -70,7 +70,8 @@ struct nv50_rasterizer_stateobj {
struct nv50_miptree_level {
struct pipe_buffer **image;
int *image_offset;
- unsigned image_dirty;
+ unsigned image_dirty_cpu;
+ unsigned image_dirty_gpu;
};
struct nv50_miptree {
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index c72b0db9ec..415080bc98 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -115,12 +115,50 @@ nv50_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt)
}
}
+void
+nv50_miptree_sync(struct pipe_screen *pscreen, struct nv50_miptree *mt,
+ unsigned level, unsigned image)
+{
+ struct nouveau_winsys *nvws = nv50_screen(pscreen)->nvws;
+ struct nv50_miptree_level *lvl = &mt->level[level];
+ struct pipe_surface *dst, *src;
+ unsigned face = 0, zslice = 0;
+
+ if (!lvl->image_dirty_cpu & (1 << image))
+ return;
+
+ if (mt->base.target == PIPE_TEXTURE_CUBE)
+ face = image;
+ else
+ if (mt->base.target == PIPE_TEXTURE_3D)
+ zslice = image;
+
+ /* Mark as clean already - so we don't continually call this function
+ * trying to get a GPU_WRITE pipe_surface!
+ */
+ lvl->image_dirty_cpu &= ~(1 << image);
+
+ dst = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+ /* Pretend we're doing CPU access so we get the backing pipe_surface
+ * and not a view into the larger miptree.
+ */
+ src = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
+ PIPE_BUFFER_USAGE_CPU_READ);
+
+ nvws->surface_copy(nvws, dst, 0, 0, src, 0, 0, dst->width, dst->height);
+
+ pscreen->tex_surface_release(pscreen, &dst);
+ pscreen->tex_surface_release(pscreen, &src);
+}
+
static struct pipe_surface *
nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
unsigned flags)
{
struct nv50_miptree *mt = nv50_miptree(pt);
+ struct nv50_miptree_level *lvl = &mt->level[level];
struct nv50_surface *s;
struct pipe_surface *ps;
int img;
@@ -147,12 +185,29 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ps->nblocksx = pt->nblocksx[level];
ps->nblocksy = pt->nblocksy[level];
ps->stride = ps->width * ps->block.size;
- ps->offset = mt->level[level].image_offset[img];
ps->usage = flags;
ps->status = PIPE_SURFACE_STATUS_DEFINED;
- pipe_texture_reference(&ps->texture, pt);
- pipe_buffer_reference(pscreen, &ps->buffer, mt->buffer);
+ if (flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
+ assert(!(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE));
+ assert(!(lvl->image_dirty_cpu & (1 << img)));
+
+ ps->offset = 0;
+ pipe_texture_reference(&ps->texture, pt);
+ pipe_buffer_reference(pscreen, &ps->buffer, lvl->image[img]);
+
+ if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
+ lvl->image_dirty_cpu |= (1 << img);
+ } else {
+ nv50_miptree_sync(pscreen, mt, level, img);
+
+ ps->offset = lvl->image_offset[img];
+ pipe_texture_reference(&ps->texture, pt);
+ pipe_buffer_reference(pscreen, &ps->buffer, mt->buffer);
+
+ if (flags & PIPE_BUFFER_USAGE_GPU_WRITE)
+ lvl->image_dirty_gpu |= (1 << img);
+ }
return ps;
}
diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c
index fde3c97c05..cc91c2d924 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -105,14 +105,23 @@ nv50_tex_validate(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
struct nouveau_stateobj *so;
- int i;
+ int unit, level, image;
so = so_new(nv50->miptree_nr * 8 + 3, nv50->miptree_nr * 2);
so_method(so, tesla, 0x0f00, 1);
so_data (so, NV50_CB_TIC);
so_method(so, tesla, 0x40000f04, nv50->miptree_nr * 8);
- for (i = 0; i < nv50->miptree_nr; i++) {
- if (nv50_tex_construct(so, nv50->miptree[i])) {
+ for (unit = 0; unit < nv50->miptree_nr; unit++) {
+ struct nv50_miptree *mt = nv50->miptree[unit];
+
+ for (level = 0; level <= mt->base.last_level; level++) {
+ for (image = 0; image < mt->image_nr; image++) {
+ nv50_miptree_sync(&nv50->screen->pipe, mt,
+ level, image);
+ }
+ }
+
+ if (nv50_tex_construct(so, mt)) {
NOUVEAU_ERR("failed tex validate\n");
so_ref(NULL, &so);
return;
--
cgit v1.2.3
From b01d0077af9d93c582e5f53ebd358ac8148b22df Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 14:26:15 +1000
Subject: nv50: disable shader debug
---
src/gallium/drivers/nv50/nv50_program.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index d66e1d0949..bc85ede92e 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -32,7 +32,7 @@
#include "nv50_context.h"
#define NV50_SU_MAX_TEMP 64
-#define NV50_PROGRAM_DUMP
+//#define NV50_PROGRAM_DUMP
/* ARL - gallium craps itself on progs/vp/arl.txt
*
@@ -1602,13 +1602,19 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p)
if (!upload)
return;
+#ifdef NV50_PROGRAM_DUMP
NOUVEAU_ERR("-------\n");
up = ptr = MALLOC(p->exec_size * 4);
for (e = p->exec_head; e; e = e->next) {
NOUVEAU_ERR("0x%08x\n", e->inst[0]);
if (is_long(e))
NOUVEAU_ERR("0x%08x\n", e->inst[1]);
+ }
+
+#endif
+ up = ptr = MALLOC(p->exec_size * 4);
+ for (e = p->exec_head; e; e = e->next) {
*(ptr++) = e->inst[0];
if (is_long(e))
*(ptr++) = e->inst[1];
--
cgit v1.2.3
From ed8f0b753b42cc9c9519b8cdc6c40729efb7243a Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 14:27:51 +1000
Subject: nv50: enable npot textures
---
src/gallium/drivers/nv50/nv50_screen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 52f6a40688..e2071103fb 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -90,7 +90,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 32;
case PIPE_CAP_NPOT_TEXTURES:
- return 0;
+ return 1;
case PIPE_CAP_TWO_SIDED_STENCIL:
return 1;
case PIPE_CAP_GLSL:
--
cgit v1.2.3
From 515c3d9bc15f66e5ffea87efee52fc27b4b558db Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 15:06:15 +1000
Subject: nv50: fix a typo and a thinko
---
src/gallium/drivers/nv50/nv50_miptree.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 415080bc98..430e75a411 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -124,7 +124,7 @@ nv50_miptree_sync(struct pipe_screen *pscreen, struct nv50_miptree *mt,
struct pipe_surface *dst, *src;
unsigned face = 0, zslice = 0;
- if (!lvl->image_dirty_cpu & (1 << image))
+ if (!(lvl->image_dirty_cpu & (1 << image)))
return;
if (mt->base.target == PIPE_TEXTURE_CUBE)
@@ -138,14 +138,15 @@ nv50_miptree_sync(struct pipe_screen *pscreen, struct nv50_miptree *mt,
*/
lvl->image_dirty_cpu &= ~(1 << image);
- dst = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
- PIPE_BUFFER_USAGE_GPU_WRITE);
/* Pretend we're doing CPU access so we get the backing pipe_surface
* and not a view into the larger miptree.
*/
src = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
PIPE_BUFFER_USAGE_CPU_READ);
+ dst = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+
nvws->surface_copy(nvws, dst, 0, 0, src, 0, 0, dst->width, dst->height);
pscreen->tex_surface_release(pscreen, &dst);
--
cgit v1.2.3
From f935f352873a69767415210c5dace47d240de0b0 Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 15:19:35 +1000
Subject: nv50: remove previous hack to manage tiled surfaces
---
src/gallium/drivers/nv50/nv50_context.h | 1 -
src/gallium/drivers/nv50/nv50_surface.c | 33 +--------------------------------
2 files changed, 1 insertion(+), 33 deletions(-)
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index c1ff6061e4..a1a6b2cb88 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -91,7 +91,6 @@ nv50_miptree(struct pipe_texture *pt)
struct nv50_surface {
struct pipe_surface base;
- struct pipe_buffer *untiled;
};
static INLINE struct nv50_surface *
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index 5bf97d3a6b..3f45a2fe18 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -63,48 +63,17 @@ static void *
nv50_surface_map(struct pipe_screen *screen, struct pipe_surface *ps,
unsigned flags )
{
- struct nouveau_winsys *nvws = nv50_screen(screen)->nvws;
struct pipe_winsys *ws = screen->winsys;
- struct nv50_surface *s = nv50_surface(ps);
- struct nv50_surface m = *s;
- void *map;
- if (!s->untiled) {
- s->untiled = ws->buffer_create(ws, 0, 0, ps->buffer->size);
-
- m.base.buffer = s->untiled;
- nvws->surface_copy(nvws, &m.base, 0, 0, &s->base, 0, 0,
- ps->width, ps->height);
- }
-
- /* Map original tiled surface to disallow it being validated while
- * untiled mirror is mapped.
- */
- ws->buffer_map(ws, ps->buffer, flags);
-
- map = ws->buffer_map(ws, s->untiled, flags);
- if (!map)
- return NULL;
-
- return map;
+ return ws->buffer_map(ws, ps->buffer, flags);
}
static void
nv50_surface_unmap(struct pipe_screen *pscreen, struct pipe_surface *ps)
{
- struct nouveau_winsys *nvws = nv50_screen(pscreen)->nvws;
struct pipe_winsys *ws = pscreen->winsys;
- struct nv50_surface *s = nv50_surface(ps);
- struct nv50_surface m = *s;
- ws->buffer_unmap(ws, s->untiled);
ws->buffer_unmap(ws, ps->buffer);
-
- m.base.buffer = s->untiled;
- nvws->surface_copy(nvws, &s->base, 0, 0, &m.base, 0, 0,
- ps->width, ps->height);
-
- pipe_buffer_reference(pscreen, &s->untiled, NULL);
}
void
--
cgit v1.2.3
From 73f1857aeea8f48deb3d12ef2bfc1fca00df6a69 Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 15:42:20 +1000
Subject: nv50: fix assertion failure
---
src/gallium/drivers/nv50/nv50_miptree.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 430e75a411..c3436db014 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -73,6 +73,10 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
lvl->image_offset = CALLOC(mt->image_nr, sizeof(int));
lvl->image = CALLOC(mt->image_nr, sizeof(struct pipe_buffer *));
+
+ width = MAX2(1, width >> 1);
+ height = MAX2(1, height >> 1);
+ depth = MAX2(1, depth >> 1);
}
for (i = 0; i < mt->image_nr; i++) {
@@ -144,8 +148,11 @@ nv50_miptree_sync(struct pipe_screen *pscreen, struct nv50_miptree *mt,
src = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
PIPE_BUFFER_USAGE_CPU_READ);
+ /* Pretend we're only reading with the GPU so surface doesn't get marked
+ * as dirtied by the GPU.
+ */
dst = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BUFFER_USAGE_GPU_READ);
nvws->surface_copy(nvws, dst, 0, 0, src, 0, 0, dst->width, dst->height);
@@ -191,7 +198,7 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
if (flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
assert(!(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE));
- assert(!(lvl->image_dirty_cpu & (1 << img)));
+ assert(!(lvl->image_dirty_gpu & (1 << img)));
ps->offset = 0;
pipe_texture_reference(&ps->texture, pt);
--
cgit v1.2.3
From ecb2eb4c991be40cf4235fadd286c942179f4036 Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 16:15:58 +1000
Subject: nouveau: fix warning
---
src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.c
index 006978b182..aacfe984d1 100644
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.c
+++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.c
@@ -42,7 +42,7 @@ nouveau_context_create(const __GLcontextModes *glVis,
if (nouveau_context_init(&nv_screen->base, driContextPriv->hHWContext,
(drmLock *)&driScrnPriv->pSAREA->lock,
- nv_share, &nv->base)) {
+ &nv_share->base, &nv->base)) {
return GL_FALSE;
}
--
cgit v1.2.3
From 39bcc397174cbc6a0293a406d34d00a4f6b90e24 Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 16:24:42 +1000
Subject: nv50: another typo..
---
src/gallium/drivers/nv50/nv50_miptree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index c3436db014..3c10a4ff74 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -69,7 +69,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
pt->height[l] = height;
pt->depth[l] = depth;
pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[l] = pf_get_nblocksy(&pt->block, width);
+ pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
lvl->image_offset = CALLOC(mt->image_nr, sizeof(int));
lvl->image = CALLOC(mt->image_nr, sizeof(struct pipe_buffer *));
--
cgit v1.2.3
From ac6516101b555e65d70ba40b253eddd357b811b9 Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 16:32:49 +1000
Subject: nv50: fix handling of depth textures
---
src/gallium/drivers/nv50/nv50_context.h | 8 ++++++--
src/gallium/drivers/nv50/nv50_miptree.c | 28 +++++++++++++++++++++++-----
2 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index a1a6b2cb88..061a4c064b 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -70,8 +70,8 @@ struct nv50_rasterizer_stateobj {
struct nv50_miptree_level {
struct pipe_buffer **image;
int *image_offset;
- unsigned image_dirty_cpu;
- unsigned image_dirty_gpu;
+ unsigned image_dirty_cpu[512/32];
+ unsigned image_dirty_gpu[512/32];
};
struct nv50_miptree {
@@ -192,4 +192,8 @@ extern boolean nv50_state_validate(struct nv50_context *nv50);
/* nv50_tex.c */
extern void nv50_tex_validate(struct nv50_context *);
+/* nv50_miptree.c */
+extern void nv50_miptree_sync(struct pipe_screen *, struct nv50_miptree *,
+ unsigned level, unsigned image);
+
#endif
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 3c10a4ff74..f25922784e 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -104,6 +104,24 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
return &mt->base;
}
+static INLINE void
+mark_dirty(uint32_t *flags, unsigned image)
+{
+ flags[image / 32] |= (1 << (image % 32));
+}
+
+static INLINE void
+mark_clean(uint32_t *flags, unsigned image)
+{
+ flags[image / 32] &= ~(1 << (image % 32));
+}
+
+static INLINE int
+is_dirty(uint32_t *flags, unsigned image)
+{
+ return !!(flags[image / 32] & (1 << (image % 32)));
+}
+
static void
nv50_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt)
{
@@ -128,7 +146,7 @@ nv50_miptree_sync(struct pipe_screen *pscreen, struct nv50_miptree *mt,
struct pipe_surface *dst, *src;
unsigned face = 0, zslice = 0;
- if (!(lvl->image_dirty_cpu & (1 << image)))
+ if (!is_dirty(lvl->image_dirty_cpu, image))
return;
if (mt->base.target == PIPE_TEXTURE_CUBE)
@@ -140,7 +158,7 @@ nv50_miptree_sync(struct pipe_screen *pscreen, struct nv50_miptree *mt,
/* Mark as clean already - so we don't continually call this function
* trying to get a GPU_WRITE pipe_surface!
*/
- lvl->image_dirty_cpu &= ~(1 << image);
+ mark_clean(lvl->image_dirty_cpu, image);
/* Pretend we're doing CPU access so we get the backing pipe_surface
* and not a view into the larger miptree.
@@ -198,14 +216,14 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
if (flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
assert(!(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE));
- assert(!(lvl->image_dirty_gpu & (1 << img)));
+ assert(!is_dirty(lvl->image_dirty_gpu, img));
ps->offset = 0;
pipe_texture_reference(&ps->texture, pt);
pipe_buffer_reference(pscreen, &ps->buffer, lvl->image[img]);
if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
- lvl->image_dirty_cpu |= (1 << img);
+ mark_dirty(lvl->image_dirty_cpu, img);
} else {
nv50_miptree_sync(pscreen, mt, level, img);
@@ -214,7 +232,7 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
pipe_buffer_reference(pscreen, &ps->buffer, mt->buffer);
if (flags & PIPE_BUFFER_USAGE_GPU_WRITE)
- lvl->image_dirty_gpu |= (1 << img);
+ mark_dirty(lvl->image_dirty_gpu, img);
}
return ps;
--
cgit v1.2.3
From 7a90ace9c8c8b8509eaf5a4b30b26101d9c5e612 Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Mon, 12 Jan 2009 16:47:17 +1000
Subject: nv50: make rtt work again
---
src/gallium/drivers/nv50/nv50_miptree.c | 34 ++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index f25922784e..63a23d06b8 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -178,6 +178,38 @@ nv50_miptree_sync(struct pipe_screen *pscreen, struct nv50_miptree *mt,
pscreen->tex_surface_release(pscreen, &src);
}
+/* The reverse of the above */
+void
+nv50_miptree_sync_cpu(struct pipe_screen *pscreen, struct nv50_miptree *mt,
+ unsigned level, unsigned image)
+{
+ struct nouveau_winsys *nvws = nv50_screen(pscreen)->nvws;
+ struct nv50_miptree_level *lvl = &mt->level[level];
+ struct pipe_surface *dst, *src;
+ unsigned face = 0, zslice = 0;
+
+ if (!is_dirty(lvl->image_dirty_gpu, image))
+ return;
+
+ if (mt->base.target == PIPE_TEXTURE_CUBE)
+ face = image;
+ else
+ if (mt->base.target == PIPE_TEXTURE_3D)
+ zslice = image;
+
+ mark_clean(lvl->image_dirty_gpu, image);
+
+ src = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
+ PIPE_BUFFER_USAGE_GPU_READ);
+ dst = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
+ PIPE_BUFFER_USAGE_CPU_READ);
+
+ nvws->surface_copy(nvws, dst, 0, 0, src, 0, 0, dst->width, dst->height);
+
+ pscreen->tex_surface_release(pscreen, &dst);
+ pscreen->tex_surface_release(pscreen, &src);
+}
+
static struct pipe_surface *
nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
@@ -216,7 +248,7 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
if (flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
assert(!(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE));
- assert(!is_dirty(lvl->image_dirty_gpu, img));
+ nv50_miptree_sync_cpu(pscreen, mt, level, img);
ps->offset = 0;
pipe_texture_reference(&ps->texture, pt);
--
cgit v1.2.3
From f586c31fa6259757ae92868b63783377d7943389 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Mon, 12 Jan 2009 12:34:27 +0100
Subject: gallivm: Adapt to header file move in LLVM 2.4.
---
src/gallium/auxiliary/gallivm/gallivm.cpp | 2 +-
src/gallium/auxiliary/gallivm/gallivm_cpu.cpp | 2 +-
src/gallium/auxiliary/gallivm/instructions.cpp | 2 +-
src/gallium/auxiliary/gallivm/instructionssoa.cpp | 2 +-
src/gallium/auxiliary/gallivm/tgsitollvm.cpp | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/gallivm.cpp b/src/gallium/auxiliary/gallivm/gallivm.cpp
index 29adeea47d..f4af5cc8ad 100644
--- a/src/gallium/auxiliary/gallivm/gallivm.cpp
+++ b/src/gallium/auxiliary/gallivm/gallivm.cpp
@@ -53,7 +53,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
diff --git a/src/gallium/auxiliary/gallivm/gallivm_cpu.cpp b/src/gallium/auxiliary/gallivm/gallivm_cpu.cpp
index 93a9748bdb..1bd00a0c2a 100644
--- a/src/gallium/auxiliary/gallivm/gallivm_cpu.cpp
+++ b/src/gallium/auxiliary/gallivm/gallivm_cpu.cpp
@@ -56,7 +56,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
diff --git a/src/gallium/auxiliary/gallivm/instructions.cpp b/src/gallium/auxiliary/gallivm/instructions.cpp
index 599975d5ad..ee8162efce 100644
--- a/src/gallium/auxiliary/gallivm/instructions.cpp
+++ b/src/gallium/auxiliary/gallivm/instructions.cpp
@@ -43,7 +43,7 @@
#include
#include
#include
-#include
+#include
#include
#include
diff --git a/src/gallium/auxiliary/gallivm/instructionssoa.cpp b/src/gallium/auxiliary/gallivm/instructionssoa.cpp
index d5600fd22d..ad57acbe1a 100644
--- a/src/gallium/auxiliary/gallivm/instructionssoa.cpp
+++ b/src/gallium/auxiliary/gallivm/instructionssoa.cpp
@@ -37,7 +37,7 @@
#include
#include
#include
-#include
+#include
#include
#include
diff --git a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp
index c11b88af9e..6b18a68fe6 100644
--- a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp
+++ b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp
@@ -25,7 +25,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
--
cgit v1.2.3
From 359bbe7432babb328a313756b9d1e46e187914b8 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Mon, 12 Jan 2009 12:37:13 +0100
Subject: gallivm: Explicitly specify the LLVM components we need.
---
SConstruct | 2 +-
configs/linux-llvm | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/SConstruct b/SConstruct
index 8c96817dae..baa0f9069b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -133,7 +133,7 @@ if dri:
# LLVM
if llvm:
# See also http://www.scons.org/wiki/UsingPkgConfig
- env.ParseConfig('llvm-config --cflags --ldflags --libs')
+ env.ParseConfig('llvm-config --cflags --ldflags --libs backend bitreader engine ipo')
env.Append(CPPDEFINES = ['MESA_LLVM'])
# Force C++ linkage
env['LINK'] = env['CXX']
diff --git a/configs/linux-llvm b/configs/linux-llvm
index 489cfd0546..a9d740574c 100644
--- a/configs/linux-llvm
+++ b/configs/linux-llvm
@@ -22,9 +22,9 @@ endif
ifeq ($(MESA_LLVM),1)
# LLVM_CFLAGS=`llvm-config --cflags`
- LLVM_CXXFLAGS=`llvm-config --cxxflags` -Wno-long-long
- LLVM_LDFLAGS=`llvm-config --ldflags`
- LLVM_LIBS=`llvm-config --libs`
+ LLVM_CXXFLAGS=`llvm-config --cxxflags backend bitreader engine ipo` -Wno-long-long
+ LLVM_LDFLAGS=`llvm-config --ldflags backend bitreader engine ipo`
+ LLVM_LIBS=`llvm-config --libs backend bitreader engine ipo`
MKLIB_OPTIONS=-cplusplus
else
LLVM_CFLAGS=
--
cgit v1.2.3
From f43e621e2207f819f756d9b9539b2a25b7b936fe Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Mon, 12 Jan 2009 12:39:31 +0100
Subject: gallivm: Print error message from ParseBitcodeFile() in case it
fails.
---
src/gallium/auxiliary/gallivm/instructionssoa.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/instructionssoa.cpp b/src/gallium/auxiliary/gallivm/instructionssoa.cpp
index ad57acbe1a..f93a31d54b 100644
--- a/src/gallium/auxiliary/gallivm/instructionssoa.cpp
+++ b/src/gallium/auxiliary/gallivm/instructionssoa.cpp
@@ -206,11 +206,12 @@ llvm::Module * InstructionsSoa::currentModule() const
void InstructionsSoa::createBuiltins()
{
+ std::string ErrMsg;
MemoryBuffer *buffer = MemoryBuffer::getMemBuffer(
(const char*)&soabuiltins_data[0],
(const char*)&soabuiltins_data[Elements(soabuiltins_data)]);
- m_builtins = ParseBitcodeFile(buffer);
- std::cout<<"Builtins created at "<
Date: Mon, 12 Jan 2009 15:05:05 +0100
Subject: gallivm: Make sure the bitcode buffer is followed by a 0 byte.
May fail to parse otherwise.
---
src/gallium/auxiliary/gallivm/Makefile | 4 ++--
src/gallium/auxiliary/gallivm/gallivm_builtins.cpp | 2 +-
src/gallium/auxiliary/gallivm/instructionssoa.cpp | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/Makefile b/src/gallium/auxiliary/gallivm/Makefile
index c3f7bfba93..5a96d94ec3 100644
--- a/src/gallium/auxiliary/gallivm/Makefile
+++ b/src/gallium/auxiliary/gallivm/Makefile
@@ -66,12 +66,12 @@ depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(INC_SOURCES)
gallivm_builtins.cpp: llvm_builtins.c
clang --emit-llvm < $< |llvm-as|opt -std-compile-opts > temp1.bin
- (echo "static const unsigned char llvm_builtins_data[] = {"; od -txC temp1.bin | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$$d" | sed -e"\$$s/,$$/};/") >$@
+ (echo "static const unsigned char llvm_builtins_data[] = {"; od -txC temp1.bin | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$$d" | sed -e"\$$s/,$$/,0x00};/") >$@
rm temp1.bin
gallivmsoabuiltins.cpp: soabuiltins.c
clang --emit-llvm < $< |llvm-as|opt -std-compile-opts > temp2.bin
- (echo "static const unsigned char soabuiltins_data[] = {"; od -txC temp2.bin | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$$d" | sed -e"\$$s/,$$/};/") >$@
+ (echo "static const unsigned char soabuiltins_data[] = {"; od -txC temp2.bin | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$$d" | sed -e"\$$s/,$$/,0x00};/") >$@
rm temp2.bin
# Emacs tags
diff --git a/src/gallium/auxiliary/gallivm/gallivm_builtins.cpp b/src/gallium/auxiliary/gallivm/gallivm_builtins.cpp
index fcc5c05794..634bac0150 100644
--- a/src/gallium/auxiliary/gallivm/gallivm_builtins.cpp
+++ b/src/gallium/auxiliary/gallivm/gallivm_builtins.cpp
@@ -137,4 +137,4 @@ static const unsigned char llvm_builtins_data[] = {
0x58,0x85,0x05,0x14,0xbe,0x34,0x45,0xb5,0x21,0x10,0x82,0x23,0x15,0x46,0x30,0x2c,
0xc8,0x64,0x02,0x06,0xf0,0x3c,0x91,0x73,0x19,0x00,0xe1,0x4b,0x53,0x64,0x0a,0x84,
0x84,0x34,0x85,0x25,0x0c,0x92,0x20,0x59,0xc1,0x20,0x30,0x8f,0x2d,0x10,0x95,0x84,
-0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
+0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/src/gallium/auxiliary/gallivm/instructionssoa.cpp b/src/gallium/auxiliary/gallivm/instructionssoa.cpp
index f93a31d54b..925e948763 100644
--- a/src/gallium/auxiliary/gallivm/instructionssoa.cpp
+++ b/src/gallium/auxiliary/gallivm/instructionssoa.cpp
@@ -209,7 +209,7 @@ void InstructionsSoa::createBuiltins()
std::string ErrMsg;
MemoryBuffer *buffer = MemoryBuffer::getMemBuffer(
(const char*)&soabuiltins_data[0],
- (const char*)&soabuiltins_data[Elements(soabuiltins_data)]);
+ (const char*)&soabuiltins_data[Elements(soabuiltins_data) - 1]);
m_builtins = ParseBitcodeFile(buffer, &ErrMsg);
std::cout<<"Builtins created at "<
Date: Mon, 12 Jan 2009 07:55:14 -0700
Subject: mesa: add osmesa.pc.in to tarball list
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index 5a47375766..5197e4967b 100644
--- a/Makefile
+++ b/Makefile
@@ -223,6 +223,7 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/sources \
$(DIRECTORY)/src/mesa/descrip.mms \
$(DIRECTORY)/src/mesa/gl.pc.in \
+ $(DIRECTORY)/src/mesa/osmesa.pc.in \
$(DIRECTORY)/src/mesa/depend \
$(DIRECTORY)/src/mesa/main/*.[chS] \
$(DIRECTORY)/src/mesa/main/descrip.mms \
--
cgit v1.2.3
From 88fdddcbbe690c52f91f76216298700c370f9650 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 12 Jan 2009 08:35:53 -0700
Subject: windows: added new sources for 7.3 (may be more, needs testing)
---
windows/VC8/mesa/mesa/mesa.vcproj | 40 +++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/windows/VC8/mesa/mesa/mesa.vcproj b/windows/VC8/mesa/mesa/mesa.vcproj
index 91e1849669..9b11098d54 100644
--- a/windows/VC8/mesa/mesa/mesa.vcproj
+++ b/windows/VC8/mesa/mesa/mesa.vcproj
@@ -179,6 +179,10 @@
RelativePath="..\..\..\..\src\mesa\main\api_arrayelt.c"
>
+
+
@@ -327,6 +331,10 @@
/>
+
+
@@ -465,6 +473,10 @@
RelativePath="..\..\..\..\src\mesa\main\mm.c"
>
+
+
@@ -481,6 +493,10 @@
RelativePath="..\..\..\..\src\mesa\main\pixel.c"
>
+
+
@@ -857,6 +873,10 @@
RelativePath="..\..\..\..\src\mesa\tnl\t_pipeline.c"
>
+
+
@@ -921,6 +941,10 @@
RelativePath="..\..\..\..\src\mesa\main\texcompress_s3tc.c"
>
+
+
@@ -929,6 +953,10 @@
RelativePath="..\..\..\..\src\mesa\main\texformat.c"
>
+
+
@@ -937,6 +965,10 @@
RelativePath="..\..\..\..\src\mesa\main\texobj.c"
>
+
+
@@ -1346,6 +1378,10 @@
RelativePath="..\..\..\..\src\mesa\main\polygon.h"
>
+
+
@@ -1522,6 +1558,10 @@
RelativePath="..\..\..\..\src\mesa\shader\shader_api.h"
>
+
+
--
cgit v1.2.3
From 06fdb6a74cfdddb5f598ddfeab890c59f176dab8 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 12 Jan 2009 08:52:54 -0700
Subject: glsl: better fix for for-loop scope issue (commit
6333005f7aea3e5d1d86a5c47b3fa2a1ed2f3ff0)
---
src/mesa/shader/slang/library/slang_shader.syn | 13 +++----------
src/mesa/shader/slang/library/slang_shader_syn.h | 4 +---
src/mesa/shader/slang/slang_compile.c | 18 ------------------
3 files changed, 4 insertions(+), 31 deletions(-)
diff --git a/src/mesa/shader/slang/library/slang_shader.syn b/src/mesa/shader/slang/library/slang_shader.syn
index 0ad4a1cba6..cc5c70a02f 100644
--- a/src/mesa/shader/slang/library/slang_shader.syn
+++ b/src/mesa/shader/slang/library/slang_shader.syn
@@ -1161,13 +1161,6 @@ compound_statement_2
compound_statement_3
lbrace .and statement_list .and rbrace;
-/*
- * ::=
- * |
- */
-statement_no_new_scope
- compound_statement_no_new_scope .or simple_statement;
-
/*
* ::= "{" "}"
* | "{" "}"
@@ -1181,6 +1174,7 @@ compound_statement_no_new_scope_2
compound_statement_no_new_scope_3
lbrace .and statement_list .and rbrace;
+
/*
* ::=
* |
@@ -1242,8 +1236,7 @@ condition_3
/*
* ::= "while" "(" ")"
* | "do" "while" "(" ")" ";"
- * | "for" "(" ")"
- *
+ * | "for" "(" ")"
*/
iteration_statement
iteration_statement_1 .or iteration_statement_2 .or iteration_statement_3;
@@ -1255,7 +1248,7 @@ iteration_statement_2
expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;
iteration_statement_3
"for" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and
- for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;
+ for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement;
/*
* ::=
diff --git a/src/mesa/shader/slang/library/slang_shader_syn.h b/src/mesa/shader/slang/library/slang_shader_syn.h
index e1705dfe19..6a382970e1 100644
--- a/src/mesa/shader/slang/library/slang_shader_syn.h
+++ b/src/mesa/shader/slang/library/slang_shader_syn.h
@@ -566,8 +566,6 @@
" lbrace .and rbrace;\n"
"compound_statement_3\n"
" lbrace .and statement_list .and rbrace;\n"
-"statement_no_new_scope\n"
-" compound_statement_no_new_scope .or simple_statement;\n"
"compound_statement_no_new_scope\n"
" compound_statement_no_new_scope_1 .emit OP_BLOCK_BEGIN_NO_NEW_SCOPE .and .true .emit OP_END;\n"
"compound_statement_no_new_scope_1\n"
@@ -617,7 +615,7 @@
" expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;\n"
"iteration_statement_3\n"
" \"for\" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and\n"
-" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n"
+" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement;\n"
"for_init_statement\n"
" expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;\n"
"conditionopt\n"
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index add8594ff9..ec27fc69df 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -1138,26 +1138,8 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
RETURN0;
if (!parse_child_operation(C, &o, oper, GL_FALSE))
RETURN0;
-#if 0
if (!parse_child_operation(C, &o, oper, GL_TRUE))
RETURN0;
-#else
- /* force creation of new scope for loop body */
- {
- slang_operation *ch;
- slang_output_ctx oo = o;
-
- /* grow child array */
- ch = slang_operation_grow(&oper->num_children, &oper->children);
- ch->type = SLANG_OPER_BLOCK_NEW_SCOPE;
-
- ch->locals->outer_scope = o.vars;
- oo.vars = ch->locals;
-
- if (!parse_child_operation(C, &oo, ch, GL_TRUE))
- RETURN0;
- }
-#endif
}
break;
case OP_PRECISION:
--
cgit v1.2.3
From a0318d7f8eea286a99c8fd6afb4d71b66d2b341c Mon Sep 17 00:00:00 2001
From: Thomas Henn
Date: Mon, 12 Jan 2009 10:56:42 -0700
Subject: windows: updated VC8 project files
---
windows/VC8/mesa/mesa/mesa.vcproj | 97 +++++++++++++++++++++++++++++++++++---
windows/VC8/progs/glut/glut.vcproj | 9 +++-
2 files changed, 99 insertions(+), 7 deletions(-)
diff --git a/windows/VC8/mesa/mesa/mesa.vcproj b/windows/VC8/mesa/mesa/mesa.vcproj
index 9b11098d54..88cc2fc6b8 100644
--- a/windows/VC8/mesa/mesa/mesa.vcproj
+++ b/windows/VC8/mesa/mesa/mesa.vcproj
@@ -1,9 +1,10 @@
+
+
@@ -263,6 +268,10 @@
RelativePath="..\..\..\..\src\mesa\main\dlist.c"
>
+
+
@@ -295,6 +304,10 @@
RelativePath="..\..\..\..\src\mesa\main\feedback.c"
>
+
+
@@ -505,6 +518,10 @@
RelativePath="..\..\..\..\src\mesa\main\polygon.c"
>
+
+
@@ -573,6 +590,10 @@
RelativePath="..\..\..\..\src\mesa\main\rbadaptors.c"
>
+
+
@@ -693,6 +714,10 @@
RelativePath="..\..\..\..\src\mesa\swrast\s_zoom.c"
>
+
+
@@ -861,6 +886,10 @@
RelativePath="..\..\..\..\src\mesa\main\stencil.c"
>
+
+
@@ -1082,6 +1111,10 @@
RelativePath="..\..\..\..\src\mesa\main\api_eval.h"
>
+
+
@@ -1106,6 +1139,10 @@
RelativePath="..\..\..\..\src\mesa\shader\arbprogram_syn.h"
>
+
+
@@ -1114,6 +1151,10 @@
RelativePath="..\..\..\..\src\mesa\main\attrib.h"
>
+
+
@@ -1126,6 +1167,10 @@
RelativePath="..\..\..\..\src\mesa\main\buffers.h"
>
+
+
@@ -1170,6 +1215,10 @@
RelativePath="..\..\..\..\src\mesa\main\dlist.h"
>
+
+
@@ -1198,6 +1247,10 @@
RelativePath="..\..\..\..\src\mesa\main\feedback.h"
>
+
+
@@ -1346,6 +1399,18 @@
RelativePath="..\..\..\..\src\mesa\main\matrix.h"
>
+
+
+
+
+
+
@@ -1354,6 +1419,10 @@
RelativePath="..\..\..\..\src\mesa\main\mtypes.h"
>
+
+
@@ -1371,15 +1440,15 @@
>
+
+
@@ -1555,11 +1628,11 @@
>
+
+
@@ -1726,6 +1803,10 @@
RelativePath="..\..\..\..\src\mesa\main\texformat_tmp.h"
>
+
+
@@ -1734,6 +1815,10 @@
RelativePath="..\..\..\..\src\mesa\main\texobj.h"
>
+
+
diff --git a/windows/VC8/progs/glut/glut.vcproj b/windows/VC8/progs/glut/glut.vcproj
index 72b3266b1e..8d03c37841 100644
--- a/windows/VC8/progs/glut/glut.vcproj
+++ b/windows/VC8/progs/glut/glut.vcproj
@@ -1,9 +1,10 @@
@@ -324,6 +327,10 @@
RelativePath="..\..\..\..\src\glut\glx\glut_overlay.c"
>
+
+
--
cgit v1.2.3
From 7f7fc3e3af6471a224a10bf3d2cd6ddd7a96d334 Mon Sep 17 00:00:00 2001
From: Julien Cristau
Date: Mon, 12 Jan 2009 16:04:32 +0100
Subject: mesa: match against *-gnu* instead of *-gnu in configure.ac
Fixes build on arm-linux-gnueabi
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index d3a93645e8..6a99f3031e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,7 +83,7 @@ dnl Compiler macros
DEFINES=""
AC_SUBST([DEFINES])
case "$host_os" in
-*-gnu)
+*-gnu*)
if test "x$GCC" = xyes; then
DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
fi
--
cgit v1.2.3
From 29f603a270da711a2a980cc9896e5883e59227cd Mon Sep 17 00:00:00 2001
From: Dan Nicholson
Date: Mon, 12 Jan 2009 11:10:31 -0800
Subject: autoconf: Only _GNU_SOURCE feature test macro needed on gnu systems
According to feature_test_macros(7), _GNU_SOURCE encompasses all the
other feature macros we were setting, so we can just dispose of them.
---
configure.ac | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6a99f3031e..33c107266a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,10 +84,7 @@ DEFINES=""
AC_SUBST([DEFINES])
case "$host_os" in
*-gnu*)
-if test "x$GCC" = xyes; then
- DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
-fi
- DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS"
+ DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
;;
solaris*)
DEFINES="$DEFINES -DPTHREADS -DSVR4"
--
cgit v1.2.3
From de35989cdec9807c60b2b4389e5988037ce23d95 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 9 Jan 2009 15:52:04 -0700
Subject: i965: fix broken ARB fp fog options
Just call _mesa_append_fog_code() if the fragment program's FogOption is
not GL_NONE.
This allows us to remove some unnecessary i965 fog code.
Note, the arbfplight.c demo can be used to test this (see DO_FRAGMENT_FOG).
---
src/mesa/drivers/dri/i965/brw_program.c | 6 ++++
src/mesa/drivers/dri/i965/brw_wm_fp.c | 52 ---------------------------------
2 files changed, 6 insertions(+), 52 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index a18dee85e8..0c86911044 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -111,9 +111,15 @@ static void brwProgramStringNotify( GLcontext *ctx,
struct gl_program *prog )
{
if (target == GL_FRAGMENT_PROGRAM_ARB) {
+ struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
struct brw_context *brw = brw_context(ctx);
struct brw_fragment_program *p = (struct brw_fragment_program *)prog;
struct brw_fragment_program *fp = (struct brw_fragment_program *)brw->fragment_program;
+ if (fprog->FogOption) {
+ _mesa_append_fog_code(ctx, fprog);
+ fprog->FogOption = GL_NONE;
+ }
+
if (p == fp)
brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
p->id = brw->program_id++;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index f4583877aa..1a00b69825 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -811,57 +811,6 @@ static void precalc_txp( struct brw_wm_compile *c,
-
-
-/***********************************************************************
- * Add instructions to perform fog blending
- */
-
-static void fog_blend( struct brw_wm_compile *c,
- struct prog_src_register fog_factor )
-{
- struct prog_dst_register outcolor = dst_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
- struct prog_src_register fogcolor = search_or_add_param5( c, STATE_FOG_COLOR, 0,0,0,0 );
-
- /* color.xyz = LRP fog_factor.xxxx, output_color, fog_color */
-
- emit_op(c,
- OPCODE_LRP,
- dst_mask(outcolor, WRITEMASK_XYZ),
- 0, 0, 0,
- fog_factor,
- src_reg_from_dst(outcolor),
- fogcolor);
-}
-
-
-
-/* This one is simple - just take the interpolated fog coordinate and
- * use it as the fog blend factor.
- */
-static void fog_interpolated( struct brw_wm_compile *c )
-{
- struct prog_src_register fogc = src_reg(PROGRAM_INPUT, FRAG_ATTRIB_FOGC);
-
- if (!(c->fp_interp_emitted & (1<fp->program.FogOption)
- return;
-
- if (1)
- fog_interpolated( c );
- else {
- /* TODO: per-pixel fog */
- assert(0);
- }
-}
-
static void emit_fb_write( struct brw_wm_compile *c )
{
struct prog_src_register payload_r0_depth = src_reg(PROGRAM_PAYLOAD, PAYLOAD_DEPTH);
@@ -1059,7 +1008,6 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
emit_ddy(c, inst);
break;
case OPCODE_END:
- emit_fog(c);
emit_fb_write(c);
break;
case OPCODE_PRINT:
--
cgit v1.2.3
From 3a5463d158eff483a992c9792d771fb80db9aed0 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 12 Jan 2009 15:43:54 -0700
Subject: i965: fix broken glBitmap + depth test
When we use the do_blit_bitmap() function, it seems the fragment Z is always
1.0. If depth testing is on, that means that bitmap fragments are often
occluded by other rendering. So, the bitmap doesn't appear even if
rasterpos.Z==0.
The fix is to use the intel_texture_bitmap() path when depth testing is on.
Also, fix the incorrect Z coordinate. It needs to be an NDC value in [-1,1].
---
src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 1d7f15f10a..3a01f63dc7 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -204,6 +204,14 @@ do_blit_bitmap( GLcontext *ctx,
/* Update draw buffer bounds */
_mesa_update_state(ctx);
+ if (ctx->Depth.Test) {
+ /* The blit path produces incorrect results when depth testing is on.
+ * It seems the blit Z coord is always 1.0 (the far plane) so fragments
+ * will likely be obscured by other, closer geometry.
+ */
+ return GL_FALSE;
+ }
+
if (!dst)
return GL_FALSE;
@@ -357,6 +365,7 @@ intel_texture_bitmap(GLcontext * ctx,
GLubyte *unpacked_bitmap;
GLubyte *a8_bitmap;
int x, y;
+ GLfloat dst_z;
/* We need a fragment program for the KIL effect */
if (!ctx->Extensions.ARB_fragment_program ||
@@ -456,21 +465,24 @@ intel_texture_bitmap(GLcontext * ctx,
intel_meta_set_passthrough_vertex_program(intel);
intel_meta_set_passthrough_transform(intel);
+ /* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */
+ dst_z = -1.0 + 2.0 * ctx->Current.RasterPos[2];
+
vertices[0][0] = dst_x;
vertices[0][1] = dst_y;
- vertices[0][2] = ctx->Current.RasterPos[2];
+ vertices[0][2] = dst_z;
vertices[0][3] = 1.0;
vertices[1][0] = dst_x + width;
vertices[1][1] = dst_y;
- vertices[1][2] = ctx->Current.RasterPos[2];
+ vertices[1][2] = dst_z;
vertices[1][3] = 1.0;
vertices[2][0] = dst_x + width;
vertices[2][1] = dst_y + height;
- vertices[2][2] = ctx->Current.RasterPos[2];
+ vertices[2][2] = dst_z;
vertices[2][3] = 1.0;
vertices[3][0] = dst_x;
vertices[3][1] = dst_y + height;
- vertices[3][2] = ctx->Current.RasterPos[2];
+ vertices[3][2] = dst_z;
vertices[3][3] = 1.0;
texcoords[0][0] = 0.0;
--
cgit v1.2.3
From eeeed45c2cf6c876d79ae20a9a96172ece8642fe Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 12 Jan 2009 15:47:36 -0700
Subject: i965: fix glDrawPixels Z coordinate in intel_texture_drawpixels().
As for glBitmap, it needs to be an NDC coord in [-1,1].
---
src/mesa/drivers/dri/intel/intel_pixel_draw.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index 2af839b803..0e83afa645 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -71,6 +71,7 @@ intel_texture_drawpixels(GLcontext * ctx,
GLuint texname;
GLfloat vertices[4][4];
GLfloat texcoords[4][2];
+ GLfloat z;
/* We're going to mess with texturing with no regard to existing texture
* state, so if there is some set up we have to bail.
@@ -140,6 +141,9 @@ intel_texture_drawpixels(GLcontext * ctx,
intel_meta_set_passthrough_transform(intel);
+ /* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */
+ z = -1.0 + 2.0 * ctx->Current.RasterPos[2];
+
/* Create the vertex buffer based on the current raster pos. The x and y
* we're handed are ctx->Current.RasterPos[0,1] rounded to integers.
* We also apply the depth. However, the W component is already multiplied
@@ -147,19 +151,19 @@ intel_texture_drawpixels(GLcontext * ctx,
*/
vertices[0][0] = x;
vertices[0][1] = y;
- vertices[0][2] = ctx->Current.RasterPos[2];
+ vertices[0][2] = z;
vertices[0][3] = 1.0;
vertices[1][0] = x + width * ctx->Pixel.ZoomX;
vertices[1][1] = y;
- vertices[1][2] = ctx->Current.RasterPos[2];
+ vertices[1][2] = z;
vertices[1][3] = 1.0;
vertices[2][0] = x + width * ctx->Pixel.ZoomX;
vertices[2][1] = y + height * ctx->Pixel.ZoomY;
- vertices[2][2] = ctx->Current.RasterPos[2];
+ vertices[2][2] = z;
vertices[2][3] = 1.0;
vertices[3][0] = x;
vertices[3][1] = y + height * ctx->Pixel.ZoomY;
- vertices[3][2] = ctx->Current.RasterPos[2];
+ vertices[3][2] = z;
vertices[3][3] = 1.0;
texcoords[0][0] = 0.0;
--
cgit v1.2.3
From 402e6752b53d04af0bbfc5391547c2d127bce859 Mon Sep 17 00:00:00 2001
From: Jonathan Adamczewski
Date: Mon, 12 Jan 2009 16:24:49 -0700
Subject: cell: allocate batch buffers w/ 16-byte alignment
Replace cell_batch{align,alloc)*() with cell_batch_alloc16(), allocating
multiples of 16 bytes that are 16 byte aligned.
Opcodes are stored in preferred slot of SPU machine word.
Various structures are explicitly padded to 16 byte multiples.
Added STATIC_ASSERT().
---
src/gallium/drivers/cell/common.h | 43 +++++++++++----
src/gallium/drivers/cell/ppu/cell_batch.c | 73 ++++----------------------
src/gallium/drivers/cell/ppu/cell_batch.h | 9 +---
src/gallium/drivers/cell/ppu/cell_clear.c | 5 +-
src/gallium/drivers/cell/ppu/cell_flush.c | 13 ++---
src/gallium/drivers/cell/ppu/cell_state_emit.c | 43 ++++++++-------
src/gallium/drivers/cell/ppu/cell_vbuf.c | 16 +++---
src/gallium/drivers/cell/spu/spu_command.c | 52 +++++++++---------
8 files changed, 111 insertions(+), 143 deletions(-)
diff --git a/src/gallium/drivers/cell/common.h b/src/gallium/drivers/cell/common.h
index 98554d7f52..1f6860da11 100644
--- a/src/gallium/drivers/cell/common.h
+++ b/src/gallium/drivers/cell/common.h
@@ -49,6 +49,15 @@
}
+
+#define JOIN(x, y) JOIN_AGAIN(x, y)
+#define JOIN_AGAIN(x, y) x ## y
+
+#define STATIC_ASSERT(e) \
+{typedef char JOIN(assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1];}
+
+
+
/** for sanity checking */
#define ASSERT_ALIGN16(ptr) \
ASSERT((((unsigned long) (ptr)) & 0xf) == 0);
@@ -134,6 +143,11 @@ struct cell_fence
volatile uint status[CELL_MAX_SPUS][4];
};
+#ifdef __SPU__
+typedef vector unsigned int opcode_t;
+#else
+typedef unsigned int opcode_t[4];
+#endif
/**
* Fence command sent to SPUs. In response, the SPUs will write
@@ -141,8 +155,9 @@ struct cell_fence
*/
struct cell_command_fence
{
- uint64_t opcode; /**< CELL_CMD_FENCE */
+ opcode_t opcode; /**< CELL_CMD_FENCE */
struct cell_fence *fence;
+ uint32_t pad_[3];
};
@@ -163,7 +178,7 @@ struct cell_command_fence
*/
struct cell_command_fragment_ops
{
- uint64_t opcode; /**< CELL_CMD_STATE_FRAGMENT_OPS */
+ opcode_t opcode; /**< CELL_CMD_STATE_FRAGMENT_OPS */
/* Fields for the fallback case */
struct pipe_depth_stencil_alpha_state dsa;
@@ -189,8 +204,9 @@ struct cell_command_fragment_ops
*/
struct cell_command_fragment_program
{
- uint64_t opcode; /**< CELL_CMD_STATE_FRAGMENT_PROGRAM */
+ opcode_t opcode; /**< CELL_CMD_STATE_FRAGMENT_PROGRAM */
uint num_inst; /**< Number of instructions */
+ uint32_t pad[3];
unsigned code[SPU_MAX_FRAGMENT_PROGRAM_INSTS];
};
@@ -200,10 +216,11 @@ struct cell_command_fragment_program
*/
struct cell_command_framebuffer
{
- uint64_t opcode; /**< CELL_CMD_STATE_FRAMEBUFFER */
+ opcode_t opcode; /**< CELL_CMD_STATE_FRAMEBUFFER */
int width, height;
void *color_start, *depth_start;
enum pipe_format color_format, depth_format;
+ uint32_t pad_[2];
};
@@ -212,7 +229,7 @@ struct cell_command_framebuffer
*/
struct cell_command_rasterizer
{
- uint64_t opcode; /**< CELL_CMD_STATE_RASTERIZER */
+ opcode_t opcode; /**< CELL_CMD_STATE_RASTERIZER */
struct pipe_rasterizer_state rasterizer;
};
@@ -222,9 +239,10 @@ struct cell_command_rasterizer
*/
struct cell_command_clear_surface
{
- uint64_t opcode; /**< CELL_CMD_CLEAR_SURFACE */
+ opcode_t opcode; /**< CELL_CMD_CLEAR_SURFACE */
uint surface; /**< Temporary: 0=color, 1=Z */
uint value;
+ uint32_t pad[2];
};
@@ -271,7 +289,7 @@ struct cell_shader_info
#define SPU_VERTS_PER_BATCH 64
struct cell_command_vs
{
- uint64_t opcode; /**< CELL_CMD_VS_EXECUTE */
+ opcode_t opcode; /**< CELL_CMD_VS_EXECUTE */
uint64_t vOut[SPU_VERTS_PER_BATCH];
unsigned num_elts;
unsigned elts[SPU_VERTS_PER_BATCH];
@@ -283,7 +301,7 @@ struct cell_command_vs
struct cell_command_render
{
- uint64_t opcode; /**< CELL_CMD_RENDER */
+ opcode_t opcode; /**< CELL_CMD_RENDER */
uint prim_type; /**< PIPE_PRIM_x */
uint num_verts;
uint vertex_size; /**< bytes per vertex */
@@ -292,27 +310,30 @@ struct cell_command_render
float xmin, ymin, xmax, ymax; /* XXX another dummy field */
uint min_index;
boolean inline_verts;
+ uint32_t pad_[1];
};
struct cell_command_release_verts
{
- uint64_t opcode; /**< CELL_CMD_RELEASE_VERTS */
+ opcode_t opcode; /**< CELL_CMD_RELEASE_VERTS */
uint vertex_buf; /**< in [0, CELL_NUM_BUFFERS-1] */
+ uint32_t pad_[3];
};
struct cell_command_sampler
{
- uint64_t opcode; /**< CELL_CMD_STATE_SAMPLER */
+ opcode_t opcode; /**< CELL_CMD_STATE_SAMPLER */
uint unit;
struct pipe_sampler_state state;
+ uint32_t pad_[1];
};
struct cell_command_texture
{
- uint64_t opcode; /**< CELL_CMD_STATE_TEXTURE */
+ opcode_t opcode; /**< CELL_CMD_STATE_TEXTURE */
uint target; /**< PIPE_TEXTURE_x */
uint unit;
void *start[CELL_MAX_TEXTURE_LEVELS]; /**< Address in main memory */
diff --git a/src/gallium/drivers/cell/ppu/cell_batch.c b/src/gallium/drivers/cell/ppu/cell_batch.c
index 962775cd33..fe144f8b84 100644
--- a/src/gallium/drivers/cell/ppu/cell_batch.c
+++ b/src/gallium/drivers/cell/ppu/cell_batch.c
@@ -108,15 +108,16 @@ emit_fence(struct cell_context *cell)
fence->status[i][0] = CELL_FENCE_EMITTED;
}
+ STATIC_ASSERT(sizeof(struct cell_command_fence) % 16 == 0);
+ ASSERT(size % 16 == 0);
ASSERT(size + sizeof(struct cell_command_fence) <= CELL_BUFFER_SIZE);
fence_cmd = (struct cell_command_fence *) (cell->buffer[batch] + size);
- fence_cmd->opcode = CELL_CMD_FENCE;
+ fence_cmd->opcode[0] = CELL_CMD_FENCE;
fence_cmd->fence = fence;
/* update batch buffer size */
cell->buffer_size[batch] = size + sizeof(struct cell_command_fence);
- assert(sizeof(struct cell_command_fence) % 8 == 0);
}
@@ -191,70 +192,19 @@ cell_batch_free_space(const struct cell_context *cell)
}
-/**
- * Append data to the current batch buffer.
- * \param data address of block of bytes to append
- * \param bytes size of block of bytes
- */
-void
-cell_batch_append(struct cell_context *cell, const void *data, uint bytes)
-{
- uint size;
-
- ASSERT(bytes % 8 == 0);
- ASSERT(bytes <= CELL_BUFFER_SIZE);
- ASSERT(cell->cur_batch >= 0);
-
-#ifdef ASSERT
- {
- uint spu;
- for (spu = 0; spu < cell->num_spus; spu++) {
- ASSERT(cell->buffer_status[spu][cell->cur_batch][0]
- == CELL_BUFFER_STATUS_USED);
- }
- }
-#endif
-
- size = cell->buffer_size[cell->cur_batch];
-
- if (bytes > cell_batch_free_space(cell)) {
- cell_batch_flush(cell);
- size = 0;
- }
-
- ASSERT(size + bytes <= CELL_BUFFER_SIZE);
-
- memcpy(cell->buffer[cell->cur_batch] + size, data, bytes);
-
- cell->buffer_size[cell->cur_batch] = size + bytes;
-}
-
-
/**
* Allocate space in the current batch buffer for 'bytes' space.
+ * Bytes must be a multiple of 16 bytes. Allocation will be 16 byte aligned.
* \return address in batch buffer to put data
*/
void *
-cell_batch_alloc(struct cell_context *cell, uint bytes)
-{
- return cell_batch_alloc_aligned(cell, bytes, 1);
-}
-
-
-/**
- * Same as \sa cell_batch_alloc, but return an address at a particular
- * alignment.
- */
-void *
-cell_batch_alloc_aligned(struct cell_context *cell, uint bytes,
- uint alignment)
+cell_batch_alloc16(struct cell_context *cell, uint bytes)
{
void *pos;
- uint size, padbytes;
+ uint size;
- ASSERT(bytes % 8 == 0);
+ ASSERT(bytes % 16 == 0);
ASSERT(bytes <= CELL_BUFFER_SIZE);
- ASSERT(alignment > 0);
ASSERT(cell->cur_batch >= 0);
#ifdef ASSERT
@@ -269,17 +219,12 @@ cell_batch_alloc_aligned(struct cell_context *cell, uint bytes,
size = cell->buffer_size[cell->cur_batch];
- padbytes = (alignment - (size % alignment)) % alignment;
-
- if (padbytes + bytes > cell_batch_free_space(cell)) {
+ if (bytes > cell_batch_free_space(cell)) {
cell_batch_flush(cell);
size = 0;
}
- else {
- size += padbytes;
- }
- ASSERT(size % alignment == 0);
+ ASSERT(size % 16 == 0);
ASSERT(size + bytes <= CELL_BUFFER_SIZE);
pos = (void *) (cell->buffer[cell->cur_batch] + size);
diff --git a/src/gallium/drivers/cell/ppu/cell_batch.h b/src/gallium/drivers/cell/ppu/cell_batch.h
index f74dd60079..290136031a 100644
--- a/src/gallium/drivers/cell/ppu/cell_batch.h
+++ b/src/gallium/drivers/cell/ppu/cell_batch.h
@@ -44,15 +44,8 @@ cell_batch_flush(struct cell_context *cell);
extern uint
cell_batch_free_space(const struct cell_context *cell);
-extern void
-cell_batch_append(struct cell_context *cell, const void *data, uint bytes);
-
-extern void *
-cell_batch_alloc(struct cell_context *cell, uint bytes);
-
extern void *
-cell_batch_alloc_aligned(struct cell_context *cell, uint bytes,
- uint alignment);
+cell_batch_alloc16(struct cell_context *cell, uint bytes);
extern void
cell_init_batch_buffers(struct cell_context *cell);
diff --git a/src/gallium/drivers/cell/ppu/cell_clear.c b/src/gallium/drivers/cell/ppu/cell_clear.c
index 037635e466..c2e276988c 100644
--- a/src/gallium/drivers/cell/ppu/cell_clear.c
+++ b/src/gallium/drivers/cell/ppu/cell_clear.c
@@ -99,10 +99,11 @@ cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps,
/* Build a CLEAR command and place it in the current batch buffer */
{
+ STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0);
struct cell_command_clear_surface *clr
= (struct cell_command_clear_surface *)
- cell_batch_alloc(cell, sizeof(*clr));
- clr->opcode = CELL_CMD_CLEAR_SURFACE;
+ cell_batch_alloc16(cell, sizeof(*clr));
+ clr->opcode[0] = CELL_CMD_CLEAR_SURFACE;
clr->surface = surfIndex;
clr->value = clearValue;
}
diff --git a/src/gallium/drivers/cell/ppu/cell_flush.c b/src/gallium/drivers/cell/ppu/cell_flush.c
index a64967b4b9..8275c9dc9c 100644
--- a/src/gallium/drivers/cell/ppu/cell_flush.c
+++ b/src/gallium/drivers/cell/ppu/cell_flush.c
@@ -72,8 +72,9 @@ cell_flush_int(struct cell_context *cell, unsigned flags)
flushing = TRUE;
if (flags & CELL_FLUSH_WAIT) {
- uint64_t *cmd = (uint64_t *) cell_batch_alloc(cell, sizeof(uint64_t));
- *cmd = CELL_CMD_FINISH;
+ STATIC_ASSERT(sizeof(opcode_t) % 16 == 0);
+ opcode_t *cmd = (opcode_t*) cell_batch_alloc16(cell, sizeof(opcode_t));
+ *cmd[0] = CELL_CMD_FINISH;
}
cell_batch_flush(cell);
@@ -101,11 +102,11 @@ void
cell_flush_buffer_range(struct cell_context *cell, void *ptr,
unsigned size)
{
- uint64_t batch[1 + (ROUNDUP8(sizeof(struct cell_buffer_range)) / 8)];
- struct cell_buffer_range *br = (struct cell_buffer_range *) & batch[1];
-
+ STATIC_ASSERT((sizeof(opcode_t) + sizeof(struct cell_buffer_range)) % 16 == 0);
+ uint32_t *batch = (uint32_t*)cell_batch_alloc16(cell,
+ sizeof(opcode_t) + sizeof(struct cell_buffer_range));
+ struct cell_buffer_range *br = (struct cell_buffer_range *) &batch[4];
batch[0] = CELL_CMD_FLUSH_BUFFER_RANGE;
br->base = (uintptr_t) ptr;
br->size = size;
- cell_batch_append(cell, batch, sizeof(batch));
}
diff --git a/src/gallium/drivers/cell/ppu/cell_state_emit.c b/src/gallium/drivers/cell/ppu/cell_state_emit.c
index 0a0af81f53..39b85faeb8 100644
--- a/src/gallium/drivers/cell/ppu/cell_state_emit.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_emit.c
@@ -133,7 +133,7 @@ lookup_fragment_ops(struct cell_context *cell)
*/
ops = CALLOC_VARIANT_LENGTH_STRUCT(cell_command_fragment_ops, total_code_size);
/* populate the new cell_command_fragment_ops object */
- ops->opcode = CELL_CMD_STATE_FRAGMENT_OPS;
+ ops->opcode[0] = CELL_CMD_STATE_FRAGMENT_OPS;
ops->total_code_size = total_code_size;
ops->front_code_index = 0;
memcpy(ops->code, spe_code_front.store, front_code_size);
@@ -178,10 +178,10 @@ static void
emit_state_cmd(struct cell_context *cell, uint cmd,
const void *state, uint state_size)
{
- uint64_t *dst = (uint64_t *)
- cell_batch_alloc(cell, ROUNDUP8(sizeof(uint64_t) + state_size));
+ uint32_t *dst = (uint32_t *)
+ cell_batch_alloc16(cell, ROUNDUP16(sizeof(opcode_t) + state_size));
*dst = cmd;
- memcpy(dst + 1, state, state_size);
+ memcpy(dst + 4, state, state_size);
}
@@ -195,9 +195,10 @@ cell_emit_state(struct cell_context *cell)
if (cell->dirty & CELL_NEW_FRAMEBUFFER) {
struct pipe_surface *cbuf = cell->framebuffer.cbufs[0];
struct pipe_surface *zbuf = cell->framebuffer.zsbuf;
+ STATIC_ASSERT(sizeof(struct cell_command_framebuffer) % 16 == 0);
struct cell_command_framebuffer *fb
- = cell_batch_alloc(cell, sizeof(*fb));
- fb->opcode = CELL_CMD_STATE_FRAMEBUFFER;
+ = cell_batch_alloc16(cell, sizeof(*fb));
+ fb->opcode[0] = CELL_CMD_STATE_FRAMEBUFFER;
fb->color_start = cell->cbuf_map[0];
fb->color_format = cbuf->format;
fb->depth_start = cell->zsbuf_map;
@@ -211,17 +212,19 @@ cell_emit_state(struct cell_context *cell)
}
if (cell->dirty & (CELL_NEW_RASTERIZER)) {
+ STATIC_ASSERT(sizeof(struct cell_command_rasterizer) % 16 == 0);
struct cell_command_rasterizer *rast =
- cell_batch_alloc(cell, sizeof(*rast));
- rast->opcode = CELL_CMD_STATE_RASTERIZER;
+ cell_batch_alloc16(cell, sizeof(*rast));
+ rast->opcode[0] = CELL_CMD_STATE_RASTERIZER;
rast->rasterizer = *cell->rasterizer;
}
if (cell->dirty & (CELL_NEW_FS)) {
/* Send new fragment program to SPUs */
+ STATIC_ASSERT(sizeof(struct cell_command_fragment_program) % 16 == 0);
struct cell_command_fragment_program *fp
- = cell_batch_alloc(cell, sizeof(*fp));
- fp->opcode = CELL_CMD_STATE_FRAGMENT_PROGRAM;
+ = cell_batch_alloc16(cell, sizeof(*fp));
+ fp->opcode[0] = CELL_CMD_STATE_FRAGMENT_PROGRAM;
fp->num_inst = cell->fs->code.num_inst;
memcpy(&fp->code, cell->fs->code.store,
SPU_MAX_FRAGMENT_PROGRAM_INSTS * SPE_INST_SIZE);
@@ -238,14 +241,14 @@ cell_emit_state(struct cell_context *cell)
const uint shader = PIPE_SHADER_FRAGMENT;
const uint num_const = cell->constants[shader].size / sizeof(float);
uint i, j;
- float *buf = cell_batch_alloc(cell, 16 + num_const * sizeof(float));
- uint64_t *ibuf = (uint64_t *) buf;
+ float *buf = cell_batch_alloc16(cell, ROUNDUP16(32 + num_const * sizeof(float)));
+ uint32_t *ibuf = (uint32_t *) buf;
const float *constants = pipe_buffer_map(cell->pipe.screen,
cell->constants[shader].buffer,
PIPE_BUFFER_USAGE_CPU_READ);
ibuf[0] = CELL_CMD_STATE_FS_CONSTANTS;
- ibuf[1] = num_const;
- j = 4;
+ ibuf[4] = num_const;
+ j = 8;
for (i = 0; i < num_const; i++) {
buf[j++] = constants[i];
}
@@ -258,7 +261,7 @@ cell_emit_state(struct cell_context *cell)
struct cell_command_fragment_ops *fops, *fops_cmd;
/* Note that cell_command_fragment_ops is a variant-sized record */
fops = lookup_fragment_ops(cell);
- fops_cmd = cell_batch_alloc(cell, sizeof(*fops_cmd) + fops->total_code_size);
+ fops_cmd = cell_batch_alloc16(cell, ROUNDUP16(sizeof(*fops_cmd) + fops->total_code_size));
memcpy(fops_cmd, fops, sizeof(*fops) + fops->total_code_size);
}
@@ -267,9 +270,10 @@ cell_emit_state(struct cell_context *cell)
for (i = 0; i < CELL_MAX_SAMPLERS; i++) {
if (cell->dirty_samplers & (1 << i)) {
if (cell->sampler[i]) {
+ STATIC_ASSERT(sizeof(struct cell_command_sampler) % 16 == 0);
struct cell_command_sampler *sampler
- = cell_batch_alloc(cell, sizeof(*sampler));
- sampler->opcode = CELL_CMD_STATE_SAMPLER;
+ = cell_batch_alloc16(cell, sizeof(*sampler));
+ sampler->opcode[0] = CELL_CMD_STATE_SAMPLER;
sampler->unit = i;
sampler->state = *cell->sampler[i];
}
@@ -282,9 +286,10 @@ cell_emit_state(struct cell_context *cell)
uint i;
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
- = cell_batch_alloc(cell, sizeof(*texture));
- texture->opcode = CELL_CMD_STATE_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]) {
uint level;
diff --git a/src/gallium/drivers/cell/ppu/cell_vbuf.c b/src/gallium/drivers/cell/ppu/cell_vbuf.c
index 65ba51b6bb..ab54e79689 100644
--- a/src/gallium/drivers/cell/ppu/cell_vbuf.c
+++ b/src/gallium/drivers/cell/ppu/cell_vbuf.c
@@ -116,10 +116,11 @@ cell_vbuf_release_vertices(struct vbuf_render *vbr, void *vertices,
/* Tell SPUs they can release the vert buf */
if (cvbr->vertex_buf != ~0U) {
+ STATIC_ASSERT(sizeof(struct cell_command_release_verts) % 16 == 0);
struct cell_command_release_verts *release
= (struct cell_command_release_verts *)
- cell_batch_alloc(cell, sizeof(struct cell_command_release_verts));
- release->opcode = CELL_CMD_RELEASE_VERTS;
+ cell_batch_alloc16(cell, sizeof(struct cell_command_release_verts));
+ release->opcode[0] = CELL_CMD_RELEASE_VERTS;
release->vertex_buf = cvbr->vertex_buf;
}
@@ -210,15 +211,16 @@ cell_vbuf_draw(struct vbuf_render *vbr,
/* build/insert batch RENDER command */
{
- const uint index_bytes = ROUNDUP8(nr_indices * 2);
- const uint vertex_bytes = nr_vertices * 4 * cell->vertex_info.size;
+ const uint index_bytes = ROUNDUP16(nr_indices * 2);
+ const uint vertex_bytes = ROUNDUP16(nr_vertices * 4 * cell->vertex_info.size);
+ STATIC_ASSERT(sizeof(struct cell_command_render) % 16 == 0);
const uint batch_size = sizeof(struct cell_command_render) + index_bytes;
struct cell_command_render *render
= (struct cell_command_render *)
- cell_batch_alloc(cell, batch_size);
+ cell_batch_alloc16(cell, batch_size);
- render->opcode = CELL_CMD_RENDER;
+ render->opcode[0] = CELL_CMD_RENDER;
render->prim_type = cvbr->prim;
render->num_indexes = nr_indices;
@@ -236,7 +238,7 @@ cell_vbuf_draw(struct vbuf_render *vbr,
min_index == 0 &&
vertex_bytes + 16 <= cell_batch_free_space(cell)) {
/* vertex data inlined, after indices, at 16-byte boundary */
- void *dst = cell_batch_alloc_aligned(cell, vertex_bytes, 16);
+ void *dst = cell_batch_alloc16(cell, vertex_bytes);
memcpy(dst, vertices, vertex_bytes);
render->inline_verts = TRUE;
render->vertex_buf = ~0;
diff --git a/src/gallium/drivers/cell/spu/spu_command.c b/src/gallium/drivers/cell/spu/spu_command.c
index 8500d19754..5c0179d954 100644
--- a/src/gallium/drivers/cell/spu/spu_command.c
+++ b/src/gallium/drivers/cell/spu/spu_command.c
@@ -292,10 +292,10 @@ cmd_state_fragment_program(const struct cell_command_fragment_program *fp)
static uint
-cmd_state_fs_constants(const uint64_t *buffer, uint pos)
+cmd_state_fs_constants(const qword *buffer, uint pos)
{
- const uint num_const = buffer[pos + 1];
- const float *constants = (const float *) &buffer[pos + 2];
+ const uint num_const = spu_extract((vector unsigned int)buffer[pos+1], 0);
+ const float *constants = (const float *) &buffer[pos+2];
uint i;
D_PRINTF(CELL_DEBUG_CMD, "CMD_STATE_FS_CONSTANTS (%u)\n", num_const);
@@ -306,8 +306,8 @@ cmd_state_fs_constants(const uint64_t *buffer, uint pos)
spu.constants[i] = spu_splats(constants[i]);
}
- /* return new buffer pos (in 8-byte words) */
- return pos + 2 + num_const / 2;
+ /* return new buffer pos (in 16-byte words) */
+ return pos + 2 + (ROUNDUP16(num_const * sizeof(float)) / 16);
}
@@ -547,8 +547,8 @@ cmd_batch(uint opcode)
{
const uint buf = (opcode >> 8) & 0xff;
uint size = (opcode >> 16);
- uint64_t buffer[CELL_BUFFER_SIZE / 8] ALIGN16_ATTRIB;
- const unsigned usize = size / sizeof(buffer[0]);
+ qword buffer[CELL_BUFFER_SIZE / 16] ALIGN16_ATTRIB;
+ const unsigned usize = ROUNDUP16(size) / sizeof(buffer[0]);
uint pos;
D_PRINTF(CELL_DEBUG_CMD, "BATCH buffer %u, len %u, from %p\n",
@@ -578,7 +578,7 @@ cmd_batch(uint opcode)
* Loop over commands in the batch buffer
*/
for (pos = 0; pos < usize; /* no incr */) {
- switch (buffer[pos]) {
+ switch (si_to_uint(buffer[pos])) {
/*
* rendering commands
*/
@@ -587,7 +587,7 @@ cmd_batch(uint opcode)
struct cell_command_clear_surface *clr
= (struct cell_command_clear_surface *) &buffer[pos];
cmd_clear_surface(clr);
- pos += sizeof(*clr) / 8;
+ pos += sizeof(*clr) / 16;
}
break;
case CELL_CMD_RENDER:
@@ -596,7 +596,7 @@ cmd_batch(uint opcode)
= (struct cell_command_render *) &buffer[pos];
uint pos_incr;
cmd_render(render, &pos_incr);
- pos += pos_incr;
+ pos += ((pos_incr+1)&~1) / 2; // should 'fix' cmd_render return
}
break;
/*
@@ -607,7 +607,7 @@ cmd_batch(uint opcode)
struct cell_command_framebuffer *fb
= (struct cell_command_framebuffer *) &buffer[pos];
cmd_state_framebuffer(fb);
- pos += sizeof(*fb) / 8;
+ pos += sizeof(*fb) / 16;
}
break;
case CELL_CMD_STATE_FRAGMENT_OPS:
@@ -616,7 +616,7 @@ cmd_batch(uint opcode)
= (struct cell_command_fragment_ops *) &buffer[pos];
cmd_state_fragment_ops(fops);
/* This is a variant-sized command */
- pos += (sizeof(*fops) + fops->total_code_size)/ 8;
+ pos += ROUNDUP16(sizeof(*fops) + fops->total_code_size) / 16;
}
break;
case CELL_CMD_STATE_FRAGMENT_PROGRAM:
@@ -624,7 +624,7 @@ cmd_batch(uint opcode)
struct cell_command_fragment_program *fp
= (struct cell_command_fragment_program *) &buffer[pos];
cmd_state_fragment_program(fp);
- pos += sizeof(*fp) / 8;
+ pos += sizeof(*fp) / 16;
}
break;
case CELL_CMD_STATE_FS_CONSTANTS:
@@ -635,7 +635,7 @@ cmd_batch(uint opcode)
struct cell_command_rasterizer *rast =
(struct cell_command_rasterizer *) &buffer[pos];
spu.rasterizer = rast->rasterizer;
- pos += sizeof(*rast) / 8;
+ pos += sizeof(*rast) / 16;
}
break;
case CELL_CMD_STATE_SAMPLER:
@@ -643,7 +643,7 @@ cmd_batch(uint opcode)
struct cell_command_sampler *sampler
= (struct cell_command_sampler *) &buffer[pos];
cmd_state_sampler(sampler);
- pos += sizeof(*sampler) / 8;
+ pos += sizeof(*sampler) / 16;
}
break;
case CELL_CMD_STATE_TEXTURE:
@@ -651,37 +651,37 @@ cmd_batch(uint opcode)
struct cell_command_texture *texture
= (struct cell_command_texture *) &buffer[pos];
cmd_state_texture(texture);
- pos += sizeof(*texture) / 8;
+ pos += sizeof(*texture) / 16;
}
break;
case CELL_CMD_STATE_VERTEX_INFO:
cmd_state_vertex_info((struct vertex_info *) &buffer[pos+1]);
- pos += (1 + ROUNDUP8(sizeof(struct vertex_info)) / 8);
+ pos += 1 + ROUNDUP16(sizeof(struct vertex_info)) / 16;
break;
case CELL_CMD_STATE_VIEWPORT:
(void) memcpy(& draw.viewport, &buffer[pos+1],
sizeof(struct pipe_viewport_state));
- pos += (1 + ROUNDUP8(sizeof(struct pipe_viewport_state)) / 8);
+ pos += 1 + ROUNDUP16(sizeof(struct pipe_viewport_state)) / 16;
break;
case CELL_CMD_STATE_UNIFORMS:
- draw.constants = (const float (*)[4]) (uintptr_t) buffer[pos + 1];
+ draw.constants = (const float (*)[4]) (uintptr_t)spu_extract((vector unsigned int)buffer[pos+1],0);
pos += 2;
break;
case CELL_CMD_STATE_VS_ARRAY_INFO:
cmd_state_vs_array_info((struct cell_array_info *) &buffer[pos+1]);
- pos += (1 + ROUNDUP8(sizeof(struct cell_array_info)) / 8);
+ pos += 1 + ROUNDUP16(sizeof(struct cell_array_info)) / 16;
break;
case CELL_CMD_STATE_BIND_VS:
#if 0
spu_bind_vertex_shader(&draw,
(struct cell_shader_info *) &buffer[pos+1]);
#endif
- pos += (1 + ROUNDUP8(sizeof(struct cell_shader_info)) / 8);
+ pos += 1 + ROUNDUP16(sizeof(struct cell_shader_info)) / 16;
break;
case CELL_CMD_STATE_ATTRIB_FETCH:
cmd_state_attrib_fetch((struct cell_attribute_fetch_code *)
&buffer[pos+1]);
- pos += (1 + ROUNDUP8(sizeof(struct cell_attribute_fetch_code)) / 8);
+ pos += 1 + ROUNDUP16(sizeof(struct cell_attribute_fetch_code)) / 16;
break;
/*
* misc commands
@@ -695,7 +695,7 @@ cmd_batch(uint opcode)
struct cell_command_fence *fence_cmd =
(struct cell_command_fence *) &buffer[pos];
cmd_fence(fence_cmd);
- pos += sizeof(*fence_cmd) / 8;
+ pos += sizeof(*fence_cmd) / 16;
}
break;
case CELL_CMD_RELEASE_VERTS:
@@ -703,7 +703,7 @@ cmd_batch(uint opcode)
struct cell_command_release_verts *release
= (struct cell_command_release_verts *) &buffer[pos];
cmd_release_verts(release);
- pos += sizeof(*release) / 8;
+ pos += sizeof(*release) / 16;
}
break;
case CELL_CMD_FLUSH_BUFFER_RANGE: {
@@ -711,11 +711,11 @@ cmd_batch(uint opcode)
&buffer[pos+1];
spu_dcache_mark_dirty((unsigned) br->base, br->size);
- pos += (1 + ROUNDUP8(sizeof(struct cell_buffer_range)) / 8);
+ pos += 1 + ROUNDUP16(sizeof(struct cell_buffer_range)) / 16;
break;
}
default:
- printf("SPU %u: bad opcode: 0x%llx\n", spu.init.id, buffer[pos]);
+ printf("SPU %u: bad opcode: 0x%x\n", spu.init.id, si_to_uint(buffer[pos]));
ASSERT(0);
break;
}
--
cgit v1.2.3
From 068107b5ad0d3b6e2575cc712398d876f266bb90 Mon Sep 17 00:00:00 2001
From: Jonathan Adamczewski
Date: Tue, 13 Jan 2009 14:02:18 +1100
Subject: cell: Add missing suffix to SHUFFLE macro
---
src/gallium/drivers/cell/spu/spu_shuffle.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/drivers/cell/spu/spu_shuffle.h b/src/gallium/drivers/cell/spu/spu_shuffle.h
index 7cbdb814d2..74f2a0b6d2 100644
--- a/src/gallium/drivers/cell/spu/spu_shuffle.h
+++ b/src/gallium/drivers/cell/spu/spu_shuffle.h
@@ -171,7 +171,7 @@
SHUFFLE_PATTERN_16_##M##__, \
SHUFFLE_PATTERN_16_##N##__, \
SHUFFLE_PATTERN_16_##O##__, \
- SHUFFLE_PATTERN_16_##P
+ SHUFFLE_PATTERN_16_##P##__
#define SHUFFLE16(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) \
((const vector unsigned char){ \
--
cgit v1.2.3
From d2442016afdc5e3b12b04d912f005ab183f7b8ff Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Tue, 13 Jan 2009 09:56:40 +1000
Subject: nv50: implement KIL enough for progs/fp/kil to work
---
src/gallium/drivers/nv50/nv50_program.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index bc85ede92e..5537a47902 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -841,6 +841,28 @@ emit_neg(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
emit(pc, e);
}
+static void
+emit_kil(struct nv50_pc *pc, struct nv50_reg *src)
+{
+ struct nv50_program_exec *e;
+ const int r_pred = 1;
+
+ /* Sets predicate reg ? */
+ e = exec(pc);
+ e->inst[0] = 0xa00001fd;
+ e->inst[1] = 0xc4014788;
+ set_src_0(pc, src, e);
+ set_pred_wr(pc, 1, r_pred, e);
+ emit(pc, e);
+
+ /* This is probably KILP */
+ e = exec(pc);
+ e->inst[0] = 0x000001fe;
+ set_long(pc, e);
+ set_pred(pc, 1 /* LT? */, r_pred, e);
+ emit(pc, e);
+}
+
static struct nv50_reg *
tgsi_dst(struct nv50_pc *pc, int c, const struct tgsi_full_dst_register *dst)
{
@@ -1069,6 +1091,12 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok)
}
free_temp(pc, temp);
break;
+ case TGSI_OPCODE_KIL:
+ emit_kil(pc, src[0][0]);
+ emit_kil(pc, src[0][1]);
+ emit_kil(pc, src[0][2]);
+ emit_kil(pc, src[0][3]);
+ break;
case TGSI_OPCODE_LIT:
emit_lit(pc, &dst[0], mask, &src[0][0]);
break;
--
cgit v1.2.3
From 918fc55e5f5cbedd3ab8fb3e02b225106c059fa6 Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Tue, 13 Jan 2009 10:44:52 +1000
Subject: nv50: occlusion queries
Not quite working, but the general idea is right I think.
---
src/gallium/drivers/nv50/nv50_query.c | 84 +++++++++++++++++++++++++++++-----
src/gallium/drivers/nv50/nv50_screen.c | 2 +-
2 files changed, 73 insertions(+), 13 deletions(-)
diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c
index 777e77906d..b923c820eb 100644
--- a/src/gallium/drivers/nv50/nv50_query.c
+++ b/src/gallium/drivers/nv50/nv50_query.c
@@ -21,41 +21,101 @@
*/
#include "pipe/p_context.h"
+#include "pipe/p_inlines.h"
#include "nv50_context.h"
+struct nv50_query {
+ struct pipe_buffer *buffer;
+ unsigned type;
+ boolean ready;
+ uint64_t result;
+};
+
+static INLINE struct nv50_query *
+nv50_query(struct pipe_query *pipe)
+{
+ return (struct nv50_query *)pipe;
+}
+
static struct pipe_query *
nv50_query_create(struct pipe_context *pipe, unsigned type)
{
- NOUVEAU_ERR("unimplemented\n");
- return NULL;
+ struct pipe_winsys *ws = pipe->winsys;
+ struct nv50_query *q = CALLOC_STRUCT(nv50_query);
+
+ assert (q->type == PIPE_QUERY_OCCLUSION_COUNTER);
+ q->type = type;
+
+ q->buffer = ws->buffer_create(ws, 256, 0, 16);
+ if (!q->buffer) {
+ FREE(q);
+ return NULL;
+ }
+
+ return (struct pipe_query *)q;
}
static void
-nv50_query_destroy(struct pipe_context *pipe, struct pipe_query *q)
+nv50_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
{
- NOUVEAU_ERR("unimplemented\n");
+ struct nv50_query *q = nv50_query(pq);
+
+ if (q) {
+ pipe_buffer_reference(pipe, &q->buffer, NULL);
+ FREE(q);
+ }
}
static void
-nv50_query_begin(struct pipe_context *pipe, struct pipe_query *q)
+nv50_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
{
- NOUVEAU_ERR("unimplemented\n");
+ struct nv50_context *nv50 = nv50_context(pipe);
+ struct nv50_query *q = nv50_query(pq);
+
+ BEGIN_RING(tesla, 0x1530, 1);
+ OUT_RING (1);
+ BEGIN_RING(tesla, 0x1514, 1);
+ OUT_RING (1);
+
+ q->ready = FALSE;
}
static void
-nv50_query_end(struct pipe_context *pipe, struct pipe_query *q)
+nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq)
{
- NOUVEAU_ERR("unimplemented\n");
+ struct nv50_context *nv50 = nv50_context(pipe);
+ struct nv50_query *q = nv50_query(pq);
+
+ BEGIN_RING(tesla, 0x1b00, 4);
+ OUT_RELOCh(q->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCl(q->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RING (0x00000000);
+ OUT_RING (0x0100f002);
+ FIRE_RING (NULL);
}
static boolean
-nv50_query_result(struct pipe_context *pipe, struct pipe_query *q,
+nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq,
boolean wait, uint64_t *result)
{
- NOUVEAU_ERR("unimplemented\n");
- *result = 0xdeadcafe;
- return TRUE;
+ struct pipe_winsys *ws = pipe->winsys;
+ struct nv50_query *q = nv50_query(pq);
+
+ /*XXX: Want to be able to return FALSE here instead of blocking
+ * until the result is available..
+ */
+
+ if (!q->ready) {
+ uint32_t *map = ws->buffer_map(ws, q->buffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
+ q->result = map[1];
+ q->ready = TRUE;
+ ws->buffer_unmap(ws, q->buffer);
+ }
+
+ *result = q->result;
+ return q->ready;
}
void
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index e2071103fb..b46619d786 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -104,7 +104,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
case PIPE_CAP_MAX_RENDER_TARGETS:
return 8;
case PIPE_CAP_OCCLUSION_QUERY:
- return 0;
+ return 1;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 0;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
--
cgit v1.2.3
From f7c2010525a3fb37079c2cff51d4c593ef8e807b Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Tue, 13 Jan 2009 10:55:06 +1000
Subject: nv50: aniso
---
src/gallium/drivers/nv50/nv50_screen.c | 2 +-
src/gallium/drivers/nv50/nv50_state.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index b46619d786..381b3e2f39 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -98,7 +98,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
case PIPE_CAP_S3TC:
return 0;
case PIPE_CAP_ANISOTROPIC_FILTER:
- return 0;
+ return 1;
case PIPE_CAP_POINT_SPRITE:
return 0;
case PIPE_CAP_MAX_RENDER_TARGETS:
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 95f9d408b5..cabe54bde3 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -175,6 +175,27 @@ nv50_sampler_state_create(struct pipe_context *pipe,
break;
}
+ if (cso->max_anisotropy >= 16.0)
+ tsc[0] |= (7 << 20);
+ else
+ if (cso->max_anisotropy >= 12.0)
+ tsc[0] |= (6 << 20);
+ else
+ if (cso->max_anisotropy >= 10.0)
+ tsc[0] |= (5 << 20);
+ else
+ if (cso->max_anisotropy >= 8.0)
+ tsc[0] |= (4 << 20);
+ else
+ if (cso->max_anisotropy >= 6.0)
+ tsc[0] |= (3 << 20);
+ else
+ if (cso->max_anisotropy >= 4.0)
+ tsc[0] |= (2 << 20);
+ else
+ if (cso->max_anisotropy >= 2.0)
+ tsc[0] |= (1 << 20);
+
return (void *)tsc;
}
--
cgit v1.2.3
From 68bb26b62d87ae6737ba51a4bffda49eeb7647cb Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Tue, 13 Jan 2009 10:58:17 +1000
Subject: nv50: shadow mapping
---
src/gallium/drivers/nv50/nv50_screen.c | 2 +-
src/gallium/drivers/nv50/nv50_state.c | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 381b3e2f39..8e084e6714 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -106,7 +106,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
- return 0;
+ return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 13;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index cabe54bde3..38c1d938b8 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -196,6 +196,11 @@ nv50_sampler_state_create(struct pipe_context *pipe,
if (cso->max_anisotropy >= 2.0)
tsc[0] |= (1 << 20);
+ if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
+ tsc[0] |= (1 << 8);
+ tsc[0] |= (nvgl_comparison_op(cso->compare_func) & 0x7);
+ }
+
return (void *)tsc;
}
--
cgit v1.2.3
From e8b00886925cdb1f02759ce603ea7d54397d2264 Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Tue, 13 Jan 2009 11:44:30 +1000
Subject: nv50: add DXTn formats
---
src/gallium/drivers/nv50/nv50_screen.c | 6 +++++-
src/gallium/drivers/nv50/nv50_tex.c | 28 ++++++++++++++++++++++++++++
src/gallium/drivers/nv50/nv50_texture.h | 3 +++
3 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 8e084e6714..ef46233f83 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -57,6 +57,10 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
case PIPE_FORMAT_A8_UNORM:
case PIPE_FORMAT_I8_UNORM:
case PIPE_FORMAT_A8L8_UNORM:
+ case PIPE_FORMAT_DXT1_RGB:
+ case PIPE_FORMAT_DXT1_RGBA:
+ case PIPE_FORMAT_DXT3_RGBA:
+ case PIPE_FORMAT_DXT5_RGBA:
return TRUE;
default:
break;
@@ -96,7 +100,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
case PIPE_CAP_GLSL:
return 0;
case PIPE_CAP_S3TC:
- return 0;
+ return 1;
case PIPE_CAP_ANISOTROPIC_FILTER:
return 1;
case PIPE_CAP_POINT_SPRITE:
diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c
index cc91c2d924..239407c92b 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -85,6 +85,34 @@ nv50_tex_construct(struct nouveau_stateobj *so, struct nv50_miptree *mt)
NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM |
NV50TIC_0_0_FMT_8_8);
break;
+ case PIPE_FORMAT_DXT1_RGB:
+ so_data(so, NV50TIC_0_0_MAPA_ONE | NV50TIC_0_0_TYPEA_UNORM |
+ NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
+ NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
+ NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM |
+ NV50TIC_0_0_FMT_DXT1);
+ break;
+ case PIPE_FORMAT_DXT1_RGBA:
+ so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM |
+ NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
+ NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
+ NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM |
+ NV50TIC_0_0_FMT_DXT1);
+ break;
+ case PIPE_FORMAT_DXT3_RGBA:
+ so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM |
+ NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
+ NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
+ NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM |
+ NV50TIC_0_0_FMT_DXT3);
+ break;
+ case PIPE_FORMAT_DXT5_RGBA:
+ so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM |
+ NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
+ NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM |
+ NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM |
+ NV50TIC_0_0_FMT_DXT5);
+ break;
default:
return 1;
}
diff --git a/src/gallium/drivers/nv50/nv50_texture.h b/src/gallium/drivers/nv50/nv50_texture.h
index 6861d67b4d..aca622c73b 100644
--- a/src/gallium/drivers/nv50/nv50_texture.h
+++ b/src/gallium/drivers/nv50/nv50_texture.h
@@ -50,6 +50,9 @@
#define NV50TIC_0_0_FMT_5_6_5 0x00000015
#define NV50TIC_0_0_FMT_8_8 0x00000018
#define NV50TIC_0_0_FMT_8 0x0000001d
+#define NV50TIC_0_0_FMT_DXT1 0x00000024
+#define NV50TIC_0_0_FMT_DXT3 0x00000025
+#define NV50TIC_0_0_FMT_DXT5 0x00000026
#define NV50TIC_0_1_OFFSET_LOW_MASK 0xffffffff
#define NV50TIC_0_1_OFFSET_LOW_SHIFT 0
--
cgit v1.2.3
From 8337c78d91612d615a1368ee8ee188d80574fad4 Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Tue, 13 Jan 2009 12:49:53 +1000
Subject: nv50: change some magic reg, makes more things work
No real idea what this does.. but a lot of things that misrendered and
made the GPU throw a DATA_ERROR now work.. I'm wondering what side-effects
we'll see from this :)
---
src/gallium/drivers/nv50/nv50_program.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 5537a47902..7686f746eb 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -1739,7 +1739,7 @@ nv50_fragprog_validate(struct nv50_context *nv50)
so_reloc (so, p->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
NOUVEAU_BO_LOW, 0, 0);
so_method(so, tesla, 0x1904, 4);
- so_data (so, 0x01040404); /* p: 0x01000404 */
+ so_data (so, 0x00040404); /* p: 0x01000404 */
so_data (so, 0x00000004);
so_data (so, 0x00000000);
so_data (so, 0x00000000);
--
cgit v1.2.3
From adee4b902166fe57d8e28f604ba4917ff0d17987 Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Tue, 13 Jan 2009 13:19:22 +1000
Subject: nv50: get glxgears showing all 3 gears instead of 1!!
This fixes a lot of other things where not all the geometry got drawn
also.
---
src/gallium/drivers/nv50/nv50_vbo.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index 584336682e..f41bb92174 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -60,6 +60,8 @@ nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start,
OUT_RING (0);
BEGIN_RING(tesla, 0x142c, 1);
OUT_RING (0);
+ BEGIN_RING(tesla, 0x1440, 1);
+ OUT_RING (0);
BEGIN_RING(tesla, NV50TCL_VERTEX_BEGIN, 1);
OUT_RING (nv50_prim(mode));
--
cgit v1.2.3
From f883c14560fad2ab88744e3212776a338a96fb96 Mon Sep 17 00:00:00 2001
From: Ben Skeggs
Date: Tue, 13 Jan 2009 13:25:14 +1000
Subject: nv50: fix progs/tests/manytex
Previously all squares were textured with the same texture.. not quite what
the demo was supposed to look like!
---
src/gallium/drivers/nv50/nv50_vbo.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index f41bb92174..435dc9777d 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -62,6 +62,8 @@ nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start,
OUT_RING (0);
BEGIN_RING(tesla, 0x1440, 1);
OUT_RING (0);
+ BEGIN_RING(tesla, 0x1334, 1);
+ OUT_RING (0);
BEGIN_RING(tesla, NV50TCL_VERTEX_BEGIN, 1);
OUT_RING (nv50_prim(mode));
--
cgit v1.2.3
From 00c02626d8087cab0cf5581911c4e68f7b32eb6e Mon Sep 17 00:00:00 2001
From: Karl Schultz
Date: Tue, 13 Jan 2009 09:01:34 -0700
Subject: windows: try to create a context in wglCreateLayerContext()
---
src/mesa/drivers/windows/gdi/wgl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/windows/gdi/wgl.c b/src/mesa/drivers/windows/gdi/wgl.c
index 9f0bb9122a..8d8087067f 100644
--- a/src/mesa/drivers/windows/gdi/wgl.c
+++ b/src/mesa/drivers/windows/gdi/wgl.c
@@ -601,8 +601,9 @@ WINGDIAPI BOOL GLAPIENTRY wglCopyContext(HGLRC hglrcSrc,
WINGDIAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC hdc,
int iLayerPlane)
{
- (void) hdc; (void) iLayerPlane;
SetLastError(0);
+ if (iLayerPlane == 0)
+ return wglCreateContext( hdc );
return(NULL);
}
--
cgit v1.2.3
From 34500a6da565f769e55babc6d28c14f606e2d52a Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 13 Jan 2009 09:03:43 -0700
Subject: docs: fixes since 7.3-rc1
---
docs/relnotes-7.3.html | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docs/relnotes-7.3.html b/docs/relnotes-7.3.html
index c486614011..b6c2463b81 100644
--- a/docs/relnotes-7.3.html
+++ b/docs/relnotes-7.3.html
@@ -43,6 +43,8 @@ tbd
Assorted GLSL bug fixes
Assorted i965 driver fixes
+
Fix for wglCreateLayerContext() in WGL/Windows driver
+
Build fixes for OpenBSD and gcc 2.95
Changes
--
cgit v1.2.3
From 1f47388dfebf15f610993f046e1f945024c8fc3c Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Fri, 9 Jan 2009 18:28:38 -0800
Subject: Add language about implicit flush and command completion
Copied language from the glXSwapBuffers manual page about the implicit
glFlush and expected command completion. This just codifies what
people already expect from glXCopySubBufferMESA. The intention of
this command is to work like glXSwapBuffers but on a sub-rectangle of
the drawable.
Acked-by: Brian Paul
---
docs/MESA_copy_sub_buffer.spec | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/docs/MESA_copy_sub_buffer.spec b/docs/MESA_copy_sub_buffer.spec
index 43424a5f46..752a014b35 100644
--- a/docs/MESA_copy_sub_buffer.spec
+++ b/docs/MESA_copy_sub_buffer.spec
@@ -16,7 +16,7 @@ Status
Version
- Last Modified Date: 8 June 2000
+ Last Modified Date: 12 January 2009
Number
@@ -69,6 +69,12 @@ Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors)
and indicate the size in pixels. Coordinate (0,0)
corresponds to the lower-left pixel of the window, like glReadPixels.
+ If dpy and drawable are the display and drawable for the calling
+ thread's current context, glXCopySubBufferMESA performs an
+ implicit glFlush before it returns. Subsequent OpenGL commands
+ may be issued immediately after calling glXCopySubBufferMESA, but
+ are not executed until the copy is completed.
+
GLX Protocol
None at this time. The extension is implemented in terms of ordinary
@@ -84,5 +90,7 @@ New State
Revision History
- 8 June 2000 - initial specification
+ 12 January 2009 Ian Romanick - Added language about implicit flush
+ and command completion.
+ 8 June 2000 Brian Paul - initial specification
--
cgit v1.2.3
From 01a0938776ad12e6560a17163bb7a6a3da9e9820 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 13 Jan 2009 15:06:52 -0700
Subject: glsl: add preprocessor support for #pragma
Two forms are supported:
Pragmas are silently ignored at this time.
---
.../shader/slang/library/slang_pp_directives.syn | 20 ++++++++++
.../shader/slang/library/slang_pp_directives_syn.h | 11 ++++++
src/mesa/shader/slang/slang_preprocess.c | 44 +++++++++++++++++++++-
3 files changed, 74 insertions(+), 1 deletion(-)
diff --git a/src/mesa/shader/slang/library/slang_pp_directives.syn b/src/mesa/shader/slang/library/slang_pp_directives.syn
index d4a321034d..b51d168cc0 100644
--- a/src/mesa/shader/slang/library/slang_pp_directives.syn
+++ b/src/mesa/shader/slang/library/slang_pp_directives.syn
@@ -79,6 +79,12 @@
.emtcode BEHAVIOR_WARN 3
.emtcode BEHAVIOR_DISABLE 4
+/*
+ * The PRAGMA_* symbols follow TOKEN_PRAGMA
+ */
+.emtcode PRAGMA_NO_PARAM 0
+.emtcode PRAGMA_PARAM 1
+
source
optional_directive .and .loop source_element .and '\0' .emit ESCAPE_TOKEN .emit TOKEN_END;
@@ -153,6 +159,7 @@ directive
dir_elif .emit TOKEN_ELIF .or
dir_endif .emit TOKEN_ENDIF .or
dir_ext .emit TOKEN_EXTENSION .or
+ dir_pragma .emit TOKEN_PRAGMA .or
dir_line .emit TOKEN_LINE;
dir_define
@@ -187,6 +194,19 @@ dir_ext
dir_line
optional_space .and '#' .and optional_space .and "line" .and expression;
+dir_pragma
+ optional_space .and '#' .and optional_space .and "pragma" .and symbol .and opt_pragma_param;
+
+
+opt_pragma_param
+ pragma_param .or .true .emit PRAGMA_NO_PARAM;
+
+pragma_param
+ optional_space .and '(' .emit PRAGMA_PARAM .and optional_space .and symbol_no_space .and optional_space .and ')';
+
+symbol_no_space
+ symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\0';
+
symbol
space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\0';
diff --git a/src/mesa/shader/slang/library/slang_pp_directives_syn.h b/src/mesa/shader/slang/library/slang_pp_directives_syn.h
index 35e7bc2761..430f8d8217 100644
--- a/src/mesa/shader/slang/library/slang_pp_directives_syn.h
+++ b/src/mesa/shader/slang/library/slang_pp_directives_syn.h
@@ -20,6 +20,8 @@
".emtcode BEHAVIOR_ENABLE 2\n"
".emtcode BEHAVIOR_WARN 3\n"
".emtcode BEHAVIOR_DISABLE 4\n"
+".emtcode PRAGMA_NO_PARAM 0\n"
+".emtcode PRAGMA_PARAM 1\n"
"source\n"
" optional_directive .and .loop source_element .and '\\0' .emit ESCAPE_TOKEN .emit TOKEN_END;\n"
"source_element\n"
@@ -76,6 +78,7 @@
" dir_elif .emit TOKEN_ELIF .or\n"
" dir_endif .emit TOKEN_ENDIF .or\n"
" dir_ext .emit TOKEN_EXTENSION .or\n"
+" dir_pragma .emit TOKEN_PRAGMA .or\n"
" dir_line .emit TOKEN_LINE;\n"
"dir_define\n"
" optional_space .and '#' .and optional_space .and \"define\" .and symbol .and opt_parameters .and\n"
@@ -99,6 +102,14 @@
" optional_space .and ':' .and optional_space .and extension_behavior;\n"
"dir_line\n"
" optional_space .and '#' .and optional_space .and \"line\" .and expression;\n"
+"dir_pragma\n"
+" optional_space .and '#' .and optional_space .and \"pragma\" .and symbol .and opt_pragma_param;\n"
+"opt_pragma_param\n"
+" pragma_param .or .true .emit PRAGMA_NO_PARAM;\n"
+"pragma_param\n"
+" optional_space .and '(' .emit PRAGMA_PARAM .and optional_space .and symbol_no_space .and optional_space .and ')';\n"
+"symbol_no_space\n"
+" symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\\0';\n"
"symbol\n"
" space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\\0';\n"
"opt_parameters\n"
diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c
index 76e757cb38..244a09171c 100644
--- a/src/mesa/shader/slang/slang_preprocess.c
+++ b/src/mesa/shader/slang/slang_preprocess.c
@@ -51,6 +51,9 @@ grammar_error_to_log (slang_info_log *log)
GLint pos;
grammar_get_last_error ((byte *) (buf), sizeof (buf), &pos);
+ if (buf[0] == 0) {
+ _mesa_snprintf(buf, sizeof(buf), "Preprocessor error");
+ }
slang_info_log_error (log, buf);
}
@@ -528,6 +531,20 @@ pp_ext_set(pp_ext *self, const char *name, GLboolean enable)
}
+/**
+ * Called in response to #pragma. For example, "#pragma debug(on)" would
+ * call this function as pp_pragma("debug", "on").
+ * At this time, pragmas are silently ignored.
+ */
+static void
+pp_pragma(const char *pragma, const char *param)
+{
+#if 0
+ printf("#pragma %s %s\n", pragma, param);
+#endif
+}
+
+
/**
* The state of preprocessor: current line, file and version number, list
* of all defined macros and the #if/#endif context.
@@ -862,6 +879,10 @@ parse_if (slang_string *output, const byte *prod, GLuint *pi, GLint *result, pp_
#define BEHAVIOR_WARN 3
#define BEHAVIOR_DISABLE 4
+#define PRAGMA_NO_PARAM 0
+#define PRAGMA_PARAM 1
+
+
static GLboolean
preprocess_source (slang_string *output, const char *source,
grammar pid, grammar eid,
@@ -940,9 +961,11 @@ preprocess_source (slang_string *output, const char *source,
else {
const char *id;
GLuint idlen;
+ GLubyte token;
i++;
- switch (prod[i++]) {
+ token = prod[i++];
+ switch (token) {
case TOKEN_END:
/* End of source string.
@@ -1159,6 +1182,25 @@ preprocess_source (slang_string *output, const char *source,
}
break;
+ case TOKEN_PRAGMA:
+ {
+ GLint have_param;
+ const char *pragma, *param;
+
+ pragma = (const char *) (&prod[i]);
+ i += _mesa_strlen(pragma) + 1;
+ have_param = (prod[i++] == PRAGMA_PARAM);
+ if (have_param) {
+ param = (const char *) (&prod[i]);
+ i += _mesa_strlen(param) + 1;
+ }
+ else {
+ param = NULL;
+ }
+ pp_pragma(pragma, param);
+ }
+ break;
+
case TOKEN_LINE:
id = (const char *) (&prod[i]);
i += _mesa_strlen (id) + 1;
--
cgit v1.2.3
From 34d17d2bdc3da2fe8b669adc166f3ee07ad11391 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 13 Jan 2009 15:09:13 -0700
Subject: docs: #pragma now handled
---
docs/relnotes-7.3.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/relnotes-7.3.html b/docs/relnotes-7.3.html
index b6c2463b81..69f335f2d8 100644
--- a/docs/relnotes-7.3.html
+++ b/docs/relnotes-7.3.html
@@ -45,6 +45,7 @@ tbd
Assorted i965 driver fixes
Fix for wglCreateLayerContext() in WGL/Windows driver